-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-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.
Description
let cache_fresh_trait_pred = self.infcx.freshen(stack.obligation.predicate); |
erases all lifetimes for caching, including 'static
.
freshener: infcx.freshener_keep_static(), |
let fresh_trait_pred = obligation.predicate.fold_with(&mut self.freshener); |
rust/compiler/rustc_trait_selection/src/traits/select/mod.rs
Lines 1026 to 1036 in d9297d2
// If we erased any lifetimes, then we want to use | |
// `EvaluatedToOkModuloRegions` instead of `EvaluatedToOk` | |
// as your final result. The result will be cached using | |
// the freshened trait predicate as a key, so we need | |
// our result to be correct by *any* choice of original lifetimes, | |
// not just the lifetime choice for this particular (non-erased) | |
// predicate. | |
// See issue #80691 | |
if stack.fresh_trait_pred.has_erased_regions() { | |
result = result.max(EvaluatedToOkModuloRegions); | |
} |
changes the evaluation result depending on whether there are any erased regions in the predicate, excluding 'static
.
if other.evaluation.must_apply_considering_regions() { |
selection only drops allowed-to-overlap candidate if the other resulted in EvaluatedToOk
.
This means that depending on the order of evaluation, marker traits can either succeed or result in ambiguity
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-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.