Rollup merge of #91329 - Aaron1011:modulo-regions-test, r=jackh726
Fix incorrect usage of `EvaluatedToOk` when evaluating `TypeOutlives` A global predicate is not guarnatenteed to outlive all regions. If the predicate involves late-bound regions, then it may fail to outlive other regions (e.g. `for<'b> &'b bool: 'static` does not hold) We now only produce `EvaluatedToOk` when a global predicate has no late-bound regions - in that case, the ony region that can be present in the type is 'static
This commit is contained in:
commit
fd6e66f423
4 changed files with 82 additions and 1 deletions
|
@ -521,7 +521,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
},
|
||||
|
||||
ty::PredicateKind::TypeOutlives(pred) => {
|
||||
if pred.0.is_known_global() {
|
||||
// A global type with no late-bound regions can only
|
||||
// contain the "'static" lifetime (any other lifetime
|
||||
// would either be late-bound or local), so it is guaranteed
|
||||
// to outlive any other lifetime
|
||||
if pred.0.is_global(self.infcx.tcx) && !pred.0.has_late_bound_regions() {
|
||||
Ok(EvaluatedToOk)
|
||||
} else {
|
||||
Ok(EvaluatedToOkModuloRegions)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue