Skip to content

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

Closed
@aliemjay

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

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