-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
RPIT allows defining use with invalid args #111935
Copy link
Copy link
Closed
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.Category: This is a bug.P-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Metadata
Metadata
Assignees
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.Category: This is a bug.P-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Note: All examples in this post was fixed in #112842. However the issue persists for lifetime arguments. See this comment for more.
The following compiles since v1.62:
While the equivalent TAIT version doesn't compile because
Opaque<u8> == u8is not a valid defining use forOpaque(because it is ambiguous whetherOpaque<T> = TorOpaque<T> = u8):I believe that TAIT behavior is the correct one because it's maximally compatible with future changes. Keeping this behavior for RPIT can also result in some surprising errors:
This was stabilized (most likely unintentionally) in #94081. Cc @oli-obk.
See related code:
rust/compiler/rustc_borrowck/src/region_infer/opaque_types.rs
Line 335 in 776f222