diff options
| author | bors <bors@rust-lang.org> | 2022-11-30 00:42:43 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-11-30 00:42:43 +0000 |
| commit | d38a99078cd3c4dadac1ba8b729ea77e8d1d5a82 (patch) | |
| tree | 6368485d2eeb91c5242b8264797afc8b9e584948 /compiler/rustc_middle | |
| parent | bddad597feb997a4e5d2cd174a76c3b07a84e4d6 (diff) | |
| parent | a5ca67b951df38347d09ffc309a048b5fb2d0e5c (diff) | |
| download | rust-d38a99078cd3c4dadac1ba8b729ea77e8d1d5a82.tar.gz rust-d38a99078cd3c4dadac1ba8b729ea77e8d1d5a82.zip | |
Auto merge of #105070 - matthiaskrgr:rollup-9b25khj, r=matthiaskrgr
Rollup of 14 pull requests
Successful merges:
- #103876 (type alias impl trait: add tests showing that hidden type only outlives lifetimes that occur in bounds)
- #104427 (Explain why `rematch_impl` fails to be infallible)
- #104436 (Add slice to the stack allocated string comment)
- #104523 (Don't use periods in target names)
- #104627 (Print all features with --print target-features)
- #104911 (Make inferred_outlives_crate return Clause)
- #105002 (Add `PathBuf::as_mut_os_string` and `Path::as_mut_os_str`)
- #105023 (Statics used in reachable function's inline asm are reachable)
- #105045 (`rustc_ast_{passes,pretty}`: remove `ref` patterns)
- #105049 (Hermit: Minor build fixes)
- #105051 (Replace a macro with a function)
- #105062 (rustdoc: use shorthand background for rustdoc toggle CSS)
- #105066 (move `candidate_from_obligation` out of assembly)
- #105068 (Run patchelf also on rust-analyzer-proc-macro-srv.)
Failed merges:
- #105050 (Remove useless borrows and derefs)
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_middle')
| -rw-r--r-- | compiler/rustc_middle/src/query/mod.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/codec.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/mod.rs | 9 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/parameterized.rs | 3 |
4 files changed, 19 insertions, 3 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 38b72ec9231..e1220320eea 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -562,7 +562,7 @@ rustc_queries! { /// Returns the inferred outlives predicates (e.g., for `struct /// Foo<'a, T> { x: &'a T }`, this would return `T: 'a`). - query inferred_outlives_of(key: DefId) -> &'tcx [(ty::Predicate<'tcx>, Span)] { + query inferred_outlives_of(key: DefId) -> &'tcx [(ty::Clause<'tcx>, Span)] { desc { |tcx| "computing inferred outlives predicates of `{}`", tcx.def_path_str(key) } cache_on_disk_if { key.is_local() } separate_provide_extern diff --git a/compiler/rustc_middle/src/ty/codec.rs b/compiler/rustc_middle/src/ty/codec.rs index b22b3961f34..75f2d45eadb 100644 --- a/compiler/rustc_middle/src/ty/codec.rs +++ b/compiler/rustc_middle/src/ty/codec.rs @@ -345,6 +345,14 @@ impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> RefDecodable<'tcx, D> } } +impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> RefDecodable<'tcx, D> for [(ty::Clause<'tcx>, Span)] { + fn decode(decoder: &mut D) -> &'tcx Self { + decoder.interner().arena.alloc_from_iter( + (0..decoder.read_usize()).map(|_| Decodable::decode(decoder)).collect::<Vec<_>>(), + ) + } +} + impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> RefDecodable<'tcx, D> for ty::List<ty::BoundVariableKind> { diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index a32a2e17573..dd4ab3e8d30 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -734,7 +734,7 @@ pub struct CratePredicatesMap<'tcx> { /// For each struct with outlive bounds, maps to a vector of the /// predicate of its outlive bounds. If an item has no outlives /// bounds, it will have no entry. - pub predicates: FxHashMap<DefId, &'tcx [(Predicate<'tcx>, Span)]>, + pub predicates: FxHashMap<DefId, &'tcx [(Clause<'tcx>, Span)]>, } impl<'tcx> Predicate<'tcx> { @@ -1167,6 +1167,13 @@ impl<'tcx> ToPredicate<'tcx, Predicate<'tcx>> for Binder<'tcx, PredicateKind<'tc } } +impl<'tcx> ToPredicate<'tcx, Predicate<'tcx>> for Clause<'tcx> { + #[inline(always)] + fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> { + tcx.mk_predicate(ty::Binder::dummy(ty::PredicateKind::Clause(self))) + } +} + impl<'tcx> ToPredicate<'tcx, Predicate<'tcx>> for Binder<'tcx, TraitRef<'tcx>> { #[inline(always)] fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> { diff --git a/compiler/rustc_middle/src/ty/parameterized.rs b/compiler/rustc_middle/src/ty/parameterized.rs index b2bcf0e29cd..c7d6c6abd1c 100644 --- a/compiler/rustc_middle/src/ty/parameterized.rs +++ b/compiler/rustc_middle/src/ty/parameterized.rs @@ -5,7 +5,7 @@ use rustc_index::vec::{Idx, IndexVec}; use crate::middle::exported_symbols::ExportedSymbol; use crate::mir::Body; use crate::ty::{ - self, Const, FnSig, GeneratorDiagnosticData, GenericPredicates, Predicate, TraitRef, Ty, + self, Clause, Const, FnSig, GeneratorDiagnosticData, GenericPredicates, Predicate, TraitRef, Ty, }; pub trait ParameterizedOverTcx: 'static { @@ -121,6 +121,7 @@ parameterized_over_tcx! { TraitRef, Const, Predicate, + Clause, GeneratorDiagnosticData, Body, ExportedSymbol, |
