Skip to content

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

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

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-NLLArea: Non-lexical lifetimes (NLL)C-bugCategory: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-criticalCritical priorityT-typesRelevant to the types team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions