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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user