-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
obligations_for_self_ty leaks placeholders #124385
Copy link
Copy link
Open
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)A-inferenceArea: Type inferenceArea: Type inferenceP-lowLow priorityLow 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-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)A-inferenceArea: Type inferenceArea: Type inferenceP-lowLow priorityLow 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.
During typeck, the signature of
|x| println!("{x}")gets inferred tofn(&'!a i32)where'!ais a placeholder which is not nameable by the closure. This is unsound as in "it breaks a core invariant of the type system". As all regions are erased after hir typeck and rechecked during mir borrowck it should not cause any "allows for UB at runtime" unsoundness.This is still something we should fix, ideally by "pulling down" the inference variables of the closure signature into the root universe when deducing it. The same issue exists for all uses of
obligations_for_self_ty.This may cause some ICEs in the future if we improve our validation of type system invariants in the future.
cc @rust-lang/types
edit: for now this is actually not too different from how higher ranked relate works in general. However, the same issue exists with
feature(non_lifetime_binders)and we want to more eagerly handle these placeholder constraints in the future to handle where-bounds on binders