diff options
| author | bors <bors@rust-lang.org> | 2023-02-27 07:00:27 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-02-27 07:00:27 +0000 |
| commit | 49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39 (patch) | |
| tree | 26fc18407f34d44ed4dfbc51d71f9e4568ebf253 /compiler/rustc_middle/src/query | |
| parent | 58136ffa92c81ec9e6ac1f91773254914da2ca01 (diff) | |
| parent | ce3397503bb86aa520a100dad0a24ac31efc5179 (diff) | |
| download | rust-49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39.tar.gz rust-49b9cc5139dd4d11ef78dc08c1f9170de5b1ca39.zip | |
Auto merge of #108521 - matthiaskrgr:rollup-exkviev, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #108319 (Don't project specializable RPITIT projection) - #108364 (Unify validity checks into a single query) - #108463 (bootstrap: Update the output of the `check` descriptions) - #108477 (Make `match` arm comma suggestion more clear) - #108486 (Merge diagnostic_items duplicate diagnostics) - #108494 (Clean up JS files code a bit) - #108500 (update Miri) - #108502 (Don't trigger error for ReError when other region is empty.) - #108513 (Remove `@nagisa` from review rotation) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_middle/src/query')
| -rw-r--r-- | compiler/rustc_middle/src/query/keys.rs | 24 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/query/mod.rs | 8 |
2 files changed, 25 insertions, 7 deletions
diff --git a/compiler/rustc_middle/src/query/keys.rs b/compiler/rustc_middle/src/query/keys.rs index dc02fd53ed0..111ea6b8cdd 100644 --- a/compiler/rustc_middle/src/query/keys.rs +++ b/compiler/rustc_middle/src/query/keys.rs @@ -4,8 +4,9 @@ use crate::infer::canonical::Canonical; use crate::mir; use crate::traits; use crate::ty::fast_reject::SimplifiedType; +use crate::ty::layout::{InitKind, TyAndLayout}; use crate::ty::subst::{GenericArg, SubstsRef}; -use crate::ty::{self, layout::TyAndLayout, Ty, TyCtxt}; +use crate::ty::{self, Ty, TyCtxt}; use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE}; use rustc_hir::hir_id::{HirId, OwnerId}; use rustc_query_system::query::{DefaultCacheSelector, SingleCacheSelector, VecCacheSelector}; @@ -696,3 +697,24 @@ impl Key for HirId { None } } + +impl<'tcx> Key for (InitKind, ty::ParamEnvAnd<'tcx, Ty<'tcx>>) { + type CacheSelector = DefaultCacheSelector<Self>; + + // Just forward to `Ty<'tcx>` + #[inline(always)] + fn query_crate_is_local(&self) -> bool { + true + } + + fn default_span(&self, _: TyCtxt<'_>) -> Span { + DUMMY_SP + } + + fn ty_adt_id(&self) -> Option<DefId> { + match self.1.value.kind() { + ty::Adt(adt, _) => Some(adt.did()), + _ => None, + } + } +} diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 6a34e5ede19..d4435a54b4a 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -2173,12 +2173,8 @@ rustc_queries! { separate_provide_extern } - query permits_uninit_init(key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> Result<bool, ty::layout::LayoutError<'tcx>> { - desc { "checking to see if `{}` permits being left uninit", key.value } - } - - query permits_zero_init(key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> Result<bool, ty::layout::LayoutError<'tcx>> { - desc { "checking to see if `{}` permits being left zeroed", key.value } + query check_validity_of_init(key: (InitKind, ty::ParamEnvAnd<'tcx, Ty<'tcx>>)) -> Result<bool, ty::layout::LayoutError<'tcx>> { + desc { "checking to see if `{}` permits being left {}", key.1.value, key.0 } } query compare_impl_const( |
