diff options
| author | bors <bors@rust-lang.org> | 2021-07-03 22:42:58 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-07-03 22:42:58 +0000 |
| commit | d34a3a401b4e44f289a4d5bf53da83367cbb6aa7 (patch) | |
| tree | c7f1e37d3df6c707c8c8e892b73b8c0ba7f6413b /compiler/rustc_trait_selection | |
| parent | 71b8742bbcbed2cd908dbc031d6552d8b528c037 (diff) | |
| parent | 1f7cb16fce3f5a334a3b05d168e8c933473e227f (diff) | |
| download | rust-d34a3a401b4e44f289a4d5bf53da83367cbb6aa7.tar.gz rust-d34a3a401b4e44f289a4d5bf53da83367cbb6aa7.zip | |
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.
Diffstat (limited to 'compiler/rustc_trait_selection')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/select/mod.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index ea5eb2b6866..6cecff4b89d 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -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) } |
