Auto merge of #85090 - Aaron1011:type-outlives-global, r=matthewjasper,jackh726
Return `EvaluatedToOk` when type in outlives predicate is global A global type doesn't reference any local regions or types, so it's guaranteed to outlive any region.
This commit is contained in:
commit
d34a3a401b
3 changed files with 24 additions and 16 deletions
|
@ -492,7 +492,15 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
None => Ok(EvaluatedToAmbig),
|
||||
},
|
||||
|
||||
ty::PredicateKind::TypeOutlives(..) | ty::PredicateKind::RegionOutlives(..) => {
|
||||
ty::PredicateKind::TypeOutlives(pred) => {
|
||||
if pred.0.is_global() {
|
||||
Ok(EvaluatedToOk)
|
||||
} else {
|
||||
Ok(EvaluatedToOkModuloRegions)
|
||||
}
|
||||
}
|
||||
|
||||
ty::PredicateKind::RegionOutlives(..) => {
|
||||
// We do not consider region relationships when evaluating trait matches.
|
||||
Ok(EvaluatedToOkModuloRegions)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue