-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
lack of implied bounds for opaque types in binders is unsound #153596
Copy link
Copy link
Closed
Labels
A-higher-rankedArea: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-implied-boundsArea: Implied bounds / inferred outlives-boundsArea: Implied bounds / inferred outlives-boundsA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-highHigh priorityHigh priorityT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-higher-rankedArea: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)Area: Higher-ranked things (e.g., lifetimes, types, trait bounds aka HRTBs)A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-implied-boundsArea: Implied bounds / inferred outlives-boundsArea: Implied bounds / inferred outlives-boundsA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-highHigh priorityHigh priorityT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Completed
A more general version of #152735 (comment). This is not limited to coroutine witnesses.
The quick summary:
We use item-bounds of opaque types during analysis and normalize them during codegen.
fn impossible_predicatesis used when building trait objects to avoid creating vtable entries for uncallable methods. We rely on the trait solver to be complete during codegen for soundness: if we successfully proved something during analysis, then this has to also be true in an empty environment during codegen.The way implied bounds on binders works breaks this property.
impl ReqWf: ReqWfis assumed to trivially hold as this has been proven inside ofmk_opaque. However, this proof relies on the implied bound'b: 'afrom the function signature.When we now check
impl ReqWf: ReqWfduring codegen, we instantiate'band'awith placeholders without tracking implied bounds. Normalizing<Inv<'a, 'b> as Trait>::Assocnow adds a'b: 'arequirement which does not hold.