Skip to content

NLL and closures: higher-ranked lifetime bounds are not enforced in type tests #98693

Closed

Description

@aliemjay

This code compiles after #95565 although it shouldn't: (playground)

fn assert_static<T>() where for<'a> T: 'a, {}

fn test<T>() {
    || {
        assert_static::<T>();
    };
}

This is similar to #98095 in that we're not taking into account placeholder regions when "promoting" type-tests from the closure to its caller:

for ur in self.scc_values.universal_regions_outlived_by(r_scc) {

@rustbot label T-types regression-from-stable-to-beta C-bug A-NLL I-unsound

Activity

  1. added
    A-NLL
    C-bug
    I-unsound
    regression-from-stable-to-beta
    T-types
    I-prioritize
    on Jun 29, 2022
  2. aliemjay commented on Jun 29, 2022

    @aliemjay
    ContributorAuthor

    I guess it would be an easy fix
    @rustbot claim

  3. steffahn commented on Jun 30, 2022

    @steffahn
    Member

    The unsoundness exploitation in #98095 can easily be adapted for this issue, so it is in fact a soundness issue: playground

  4. added this to the 1.63.0 milestone on Jun 30, 2022
  5. added
    I-types-nominated
    on Jun 30, 2022
  6. apiraino commented on Jun 30, 2022

    @apiraino
    Contributor

    issue touched in today's T-compiler meeting, notes from Zulip chat. Will also be discussed tomorrow during the T-types meeting.

  7. apiraino commented on Jul 4, 2022

    @apiraino
    Contributor

    WG-prioritization assigning priority (Zulip discussion).

    @rustbot label -I-prioritize +P-critical

  8. added
    P-critical
    and removed
    I-prioritize
    on Jul 4, 2022
  9. added 2 commits that reference this issue on Jul 10, 2022
    377b92a
    2cb7d1c
  10. removed
    I-types-nominated
    on Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-NLLC-bugI-unsoundP-criticalT-typesregression-from-stable-to-beta

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions