Auto merge of #88139 - lcnr:marker-trait-attr, r=nikomatsakis
marker_traits: require `EvaluatedToOk` during winnowing
closes #84955, while it doesn't really fix it in a way that makes me happy it should prevent the issue for now and this
test can't be reproduced anyways, so it doesn't make much sense to keep it open.
fixes #84917 as only one of the impls depends on regions, so we now drop the ambiguous one instead of the correct one.
cc 247899832
r? `@nikomatsakis`
This commit is contained in:
commit
1eb187c16e
6 changed files with 93 additions and 3 deletions
|
@ -1586,12 +1586,19 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
// See if we can toss out `victim` based on specialization.
|
||||
// This requires us to know *for sure* that the `other` impl applies
|
||||
// i.e., `EvaluatedToOk`.
|
||||
//
|
||||
// FIXME(@lcnr): Using `modulo_regions` here seems kind of scary
|
||||
// to me but is required for `std` to compile, so I didn't change it
|
||||
// for now.
|
||||
let tcx = self.tcx();
|
||||
if other.evaluation.must_apply_modulo_regions() {
|
||||
let tcx = self.tcx();
|
||||
if tcx.specializes((other_def, victim_def)) {
|
||||
return true;
|
||||
}
|
||||
return match tcx.impls_are_allowed_to_overlap(other_def, victim_def) {
|
||||
}
|
||||
|
||||
if other.evaluation.must_apply_considering_regions() {
|
||||
match tcx.impls_are_allowed_to_overlap(other_def, victim_def) {
|
||||
Some(ty::ImplOverlapKind::Permitted { marker: true }) => {
|
||||
// Subtle: If the predicate we are evaluating has inference
|
||||
// variables, do *not* allow discarding candidates due to
|
||||
|
@ -1636,7 +1643,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
}
|
||||
Some(_) => true,
|
||||
None => false,
|
||||
};
|
||||
}
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue