diff options
| author | Moulins <arthur.heuillard@orange.fr> | 2023-06-23 21:05:24 +0200 |
|---|---|---|
| committer | Moulins <arthur.heuillard@orange.fr> | 2023-07-21 03:31:45 +0200 |
| commit | 8b847ef734e2bf2d424cf111f671978505c04cf1 (patch) | |
| tree | a6e24f684ef942b6328125dd3a99c2d1a2032d64 /compiler/rustc_ty_utils/src | |
| parent | 30ae640a3c4ebe70ec5bb1b8782f9e8206ed324e (diff) | |
| download | rust-8b847ef734e2bf2d424cf111f671978505c04cf1.tar.gz rust-8b847ef734e2bf2d424cf111f671978505c04cf1.zip | |
add crate-local `-Z reference_niches` unstable flag (does nothing for now)
Diffstat (limited to 'compiler/rustc_ty_utils/src')
| -rw-r--r-- | compiler/rustc_ty_utils/src/layout.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs index 2afe1cb37bb..19545a1b135 100644 --- a/compiler/rustc_ty_utils/src/layout.rs +++ b/compiler/rustc_ty_utils/src/layout.rs @@ -3,7 +3,7 @@ use rustc_hir as hir; use rustc_index::bit_set::BitSet; use rustc_index::{IndexSlice, IndexVec}; use rustc_middle::mir::{GeneratorLayout, GeneratorSavedLocal}; -use rustc_middle::query::Providers; +use rustc_middle::query::{LocalCrate, Providers}; use rustc_middle::ty::layout::{ IntegerExt, LayoutCx, LayoutError, LayoutOf, NaiveLayout, TyAndLayout, TyAndNaiveLayout, MAX_SIMD_LANES, @@ -25,7 +25,14 @@ use crate::errors::{ use crate::layout_sanity_check::sanity_check_layout; pub fn provide(providers: &mut Providers) { - *providers = Providers { layout_of, naive_layout_of, ..*providers }; + *providers = Providers { layout_of, naive_layout_of, reference_niches_policy, ..*providers }; +} + +#[instrument(skip(tcx), level = "debug")] +fn reference_niches_policy<'tcx>(tcx: TyCtxt<'tcx>, _: LocalCrate) -> ReferenceNichePolicy { + const DEFAULT: ReferenceNichePolicy = ReferenceNichePolicy { size: false, align: false }; + + tcx.sess.opts.unstable_opts.reference_niches.unwrap_or(DEFAULT) } #[instrument(skip(tcx, query), level = "debug")] |
