|
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); |
|
// 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
rust/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs
Line 44 in d9297d2
erases all lifetimes for caching, including
'static.rust/compiler/rustc_trait_selection/src/traits/select/mod.rs
Line 221 in d9297d2
rust/compiler/rustc_trait_selection/src/traits/select/mod.rs
Line 2289 in d9297d2
rust/compiler/rustc_trait_selection/src/traits/select/mod.rs
Lines 1026 to 1036 in d9297d2
changes the evaluation result depending on whether there are any erased regions in the predicate, excluding
'static.rust/compiler/rustc_trait_selection/src/traits/select/mod.rs
Line 1753 in d9297d2
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