Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #108521

Merged
merged 96 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
9742679
Preparing for merge from rustc
RalfJung Jan 13, 2023
9475277
Merge from rustc
RalfJung Jan 13, 2023
4aa07c9
clippy
RalfJung Jan 13, 2023
cd952c8
Auto merge of #2756 - RalfJung:rustup, r=RalfJung
bors Jan 13, 2023
ec5f825
Preparing for merge from rustc
RalfJung Jan 15, 2023
b237952
Merge from rustc
RalfJung Jan 15, 2023
59d3572
Auto merge of #2758 - RalfJung:rustup, r=RalfJung
bors Jan 15, 2023
cb77707
Preparing for merge from rustc
RalfJung Jan 23, 2023
e0df042
Merge from rustc
RalfJung Jan 23, 2023
2018054
Auto merge of #2762 - RalfJung:rustup, r=RalfJung
bors Jan 23, 2023
f055ad3
Preparing for merge from rustc
oli-obk Jan 23, 2023
461f272
Merge from rustc
oli-obk Jan 23, 2023
9defdc7
Auto merge of #2763 - oli-obk:rustup, r=oli-obk
bors Jan 23, 2023
ff5132e
add scfix test
RalfJung Jan 25, 2023
3ed2c0a
Auto merge of #2765 - RalfJung:scfix, r=RalfJung
bors Jan 25, 2023
523325a
remove scfix test
RalfJung Jan 29, 2023
02ded33
Auto merge of #2766 - RalfJung:scfix, r=RalfJung
bors Jan 29, 2023
8a10a4f
Add a note for using ssh login with josh
oli-obk Jan 30, 2023
6e7ef5a
Preparing for merge from rustc
RalfJung Jan 30, 2023
f8509e4
Merge from rustc
RalfJung Jan 30, 2023
247a5f3
Update CONTRIBUTING.md
oli-obk Jan 31, 2023
e57962f
Auto merge of #2767 - oli-obk:josh_auth, r=RalfJung
bors Jan 31, 2023
a78e178
dont run optimized MIR for now, it is broken
RalfJung Jan 31, 2023
0aaa9ea
Auto merge of #2772 - RalfJung:rustup, r=RalfJung
bors Jan 31, 2023
15b9f45
busy waiting implementation for sleep
DebugSteven Dec 17, 2022
6b3e496
Preparing for merge from rustc
RalfJung Feb 1, 2023
5c67bd5
Merge from rustc
RalfJung Feb 1, 2023
40cbe49
fmt
RalfJung Feb 1, 2023
1812f60
Auto merge of #2773 - RalfJung:rustup, r=RalfJung
bors Feb 1, 2023
ff6fb4c
Preparing for merge from rustc
RalfJung Feb 2, 2023
dcf9c9d
Merge from rustc
RalfJung Feb 2, 2023
072d5cd
re-enable mir-opt tests
RalfJung Feb 3, 2023
104048f
Auto merge of #2775 - RalfJung:rustup, r=RalfJung
bors Feb 3, 2023
929bc0f
Auto merge of #2764 - DebugSteven:sleep, r=oli-obk
bors Feb 3, 2023
a0dcb9d
Bump tokio from 1.23.1 to 1.24.2 in /test_dependencies
dependabot[bot] Feb 4, 2023
6c8d407
Auto merge of #2776 - rust-lang:dependabot/cargo/test_dependencies/to…
bors Feb 4, 2023
f70f526
Preparing for merge from rustc
RalfJung Feb 7, 2023
ff07108
Merge from rustc
RalfJung Feb 7, 2023
8461c0e
fmt
RalfJung Feb 7, 2023
0d225bc
Auto merge of #2780 - RalfJung:rustup, r=RalfJung
bors Feb 7, 2023
1851562
Preparing for merge from rustc
RalfJung Feb 9, 2023
6f451fc
Merge from rustc
RalfJung Feb 9, 2023
73a3666
don't waste half the address space on AVR targets
RalfJung Feb 9, 2023
8deed11
Auto merge of #2782 - RalfJung:rustup, r=RalfJung
bors Feb 9, 2023
f407e96
Preparing for merge from rustc
RalfJung Feb 15, 2023
1a2908b
Merge from rustc
RalfJung Feb 15, 2023
52af045
Auto merge of #2789 - RalfJung:rustup, r=RalfJung
bors Feb 15, 2023
f0ab39b
Preparing for merge from rustc
RalfJung Feb 16, 2023
044aa87
Merge from rustc
RalfJung Feb 16, 2023
73f83ff
Auto merge of #2790 - RalfJung:rustup, r=RalfJung
bors Feb 16, 2023
3fcbd1c
Add tests for moving data across await point
bryangarza Feb 11, 2023
aed3b3f
Preparing for merge from rustc
RalfJung Feb 18, 2023
036929d
Merge from rustc
RalfJung Feb 18, 2023
b76b26e
fmt
RalfJung Feb 18, 2023
6c7f09b
Auto merge of #2792 - RalfJung:rustup, r=RalfJung
bors Feb 18, 2023
610dbcb
Auto merge of #2784 - bryangarza:future-sizes-tests, r=RalfJung
bors Feb 18, 2023
a52c750
Preparing for merge from rustc
RalfJung Feb 20, 2023
d1a2425
Merge from rustc
RalfJung Feb 20, 2023
9669e57
Auto merge of #2793 - RalfJung:rustup, r=RalfJung
bors Feb 20, 2023
d46d6bd
Preparing for merge from rustc
RalfJung Feb 21, 2023
84f3452
Merge from rustc
RalfJung Feb 21, 2023
9005c77
silence clippy
RalfJung Feb 21, 2023
4e0cb32
Avoid formatting dyn* test as rustftm doesn't understand it yet and j…
oli-obk Feb 21, 2023
2a979f8
Auto merge of #2794 - RalfJung:rustup, r=RalfJung
bors Feb 21, 2023
02b3664
Drive-by assertion in collect_return_position_impl_trait_in_trait_tys
compiler-errors Feb 21, 2023
9bf32c4
Don't project specializable RPITIT projection
compiler-errors Feb 21, 2023
025d2a1
Unify validity checks into a single query
Noratrieb Feb 22, 2023
a80f527
Add shim for `llvm.arm.hint`
LevitatingLion Feb 24, 2023
d4d7edf
Use pointers to `c_char` instead of `i8` in `miri_host_to_target_path`
LevitatingLion Feb 24, 2023
04b2aab
Add ARM targets to CI
LevitatingLion Feb 24, 2023
47aeaba
bump rustc_tools_util
klensy Feb 24, 2023
9a32db7
use setup_version_info!
klensy Feb 24, 2023
e81ebb9
Use full path to `c_char` in README
LevitatingLion Feb 24, 2023
9cb27d2
CI: Move `arm-unknown-linux-gnueabi` tests to Windows host
LevitatingLion Feb 24, 2023
81490e1
Auto merge of #2799 - klensy:dep-up, r=RalfJung
bors Feb 24, 2023
ffd12f6
Auto merge of #2798 - LevitatingLion:master, r=oli-obk
bors Feb 25, 2023
b30d0da
Update the output of the `check` descriptions
clubby789 Feb 25, 2023
11fbb57
Simplify diagnostic_items.
cjgillot Oct 25, 2022
752ddd0
Merge the two diagnostics.
cjgillot Feb 26, 2023
32da026
generalize help message
y21 Feb 26, 2023
9fb1852
Preparing for merge from rustc
RalfJung Feb 26, 2023
cb45103
Merge from rustc
RalfJung Feb 26, 2023
56ac6bf
Auto merge of #2803 - RalfJung:rustup, r=RalfJung
bors Feb 26, 2023
3f88f4c
update lockfile
RalfJung Feb 26, 2023
27db688
Clean up JS files code a bit
GuillaumeGomez Feb 26, 2023
4afb2d4
Remove @nagisa from review rotation
nagisa Feb 26, 2023
65e5661
Don't trigger ICE for ReError when the other region is empty.
lenko-d Feb 26, 2023
3a6c542
Rollup merge of #108319 - compiler-errors:dont-project-to-specializab…
matthiaskrgr Feb 27, 2023
3fcc79f
Rollup merge of #108364 - Nilstrieb:validity-checks-refactor, r=compi…
matthiaskrgr Feb 27, 2023
2f6ba7b
Rollup merge of #108463 - clubby789:update-check-output, r=albertlars…
matthiaskrgr Feb 27, 2023
69b1b94
Rollup merge of #108477 - y21:replace-semi-with-comma-sugg, r=compile…
matthiaskrgr Feb 27, 2023
abc8248
Rollup merge of #108486 - cjgillot:owner-ditem, r=Nilstrieb
matthiaskrgr Feb 27, 2023
c813994
Rollup merge of #108494 - GuillaumeGomez:cleanup-js, r=notriddle
matthiaskrgr Feb 27, 2023
37338b8
Rollup merge of #108500 - RalfJung:miri, r=RalfJung
matthiaskrgr Feb 27, 2023
bade556
Rollup merge of #108502 - lenko-d:cannot_relate_region, r=compiler-er…
matthiaskrgr Feb 27, 2023
ce33975
Rollup merge of #108513 - nagisa:unrotate, r=joshtriplett
matthiaskrgr Feb 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ dependencies = [
"directories",
"rustc-build-sysroot",
"rustc-workspace-hack",
"rustc_tools_util 0.2.1",
"rustc_tools_util",
"rustc_version",
"serde",
"serde_json",
Expand Down Expand Up @@ -738,7 +738,7 @@ dependencies = [
"regex",
"rustc-semver",
"rustc-workspace-hack",
"rustc_tools_util 0.3.0",
"rustc_tools_util",
"semver",
"serde",
"syn",
Expand Down Expand Up @@ -4725,12 +4725,6 @@ dependencies = [
"tracing",
]

[[package]]
name = "rustc_tools_util"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "598f48ce2a421542b3e64828aa742b687cc1b91d2f96591cfdb7ac5988cd6366"

[[package]]
name = "rustc_tools_util"
version = "0.3.0"
Expand Down
8 changes: 0 additions & 8 deletions compiler/rustc_abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1505,14 +1505,6 @@ pub struct PointeeInfo {
pub safe: Option<PointerKind>,
}

/// Used in `might_permit_raw_init` to indicate the kind of initialisation
/// that is checked to be valid
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum InitKind {
Zero,
UninitMitigated0x01Fill,
}

impl LayoutS {
/// Returns `true` if the layout corresponds to an unsized type.
pub fn is_unsized(&self) -> bool {
Expand Down
10 changes: 7 additions & 3 deletions compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ mod simd;
pub(crate) use cpuid::codegen_cpuid_call;
pub(crate) use llvm::codegen_llvm_intrinsic_call;

use rustc_middle::ty::layout::HasParamEnv;
use rustc_middle::ty;
use rustc_middle::ty::layout::{HasParamEnv, InitKind};
use rustc_middle::ty::print::with_no_trimmed_paths;
use rustc_middle::ty::subst::SubstsRef;
use rustc_span::symbol::{kw, sym, Symbol};
Expand Down Expand Up @@ -642,7 +643,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
if intrinsic == sym::assert_zero_valid
&& !fx
.tcx
.permits_zero_init(fx.param_env().and(ty))
.check_validity_of_init((InitKind::Zero, fx.param_env().and(ty)))
.expect("expected to have layout during codegen")
{
with_no_trimmed_paths!({
Expand All @@ -661,7 +662,10 @@ fn codegen_regular_intrinsic_call<'tcx>(
if intrinsic == sym::assert_mem_uninitialized_valid
&& !fx
.tcx
.permits_uninit_init(fx.param_env().and(ty))
.check_validity_of_init((
InitKind::UninitMitigated0x01Fill,
fx.param_env().and(ty),
))
.expect("expected to have layout during codegen")
{
with_no_trimmed_paths!({
Expand Down
9 changes: 6 additions & 3 deletions compiler/rustc_codegen_ssa/src/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
use rustc_hir::lang_items::LangItem;
use rustc_index::vec::Idx;
use rustc_middle::mir::{self, AssertKind, SwitchTargets};
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
use rustc_middle::ty::layout::{HasTyCtxt, InitKind, LayoutOf};
use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
use rustc_middle::ty::{self, Instance, Ty, TypeVisitableExt};
use rustc_session::config::OptLevel;
Expand Down Expand Up @@ -676,11 +676,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
Inhabited => layout.abi.is_uninhabited(),
ZeroValid => !bx
.tcx()
.permits_zero_init(bx.param_env().and(ty))
.check_validity_of_init((InitKind::Zero, bx.param_env().and(ty)))
.expect("expected to have layout during codegen"),
MemUninitializedValid => !bx
.tcx()
.permits_uninit_init(bx.param_env().and(ty))
.check_validity_of_init((
InitKind::UninitMitigated0x01Fill,
bx.param_env().and(ty),
))
.expect("expected to have layout during codegen"),
};
Some(if do_panic {
Expand Down
9 changes: 6 additions & 3 deletions compiler/rustc_const_eval/src/interpret/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use rustc_middle::mir::{
BinOp, NonDivergingIntrinsic,
};
use rustc_middle::ty;
use rustc_middle::ty::layout::LayoutOf as _;
use rustc_middle::ty::layout::{InitKind, LayoutOf as _};
use rustc_middle::ty::subst::SubstsRef;
use rustc_middle::ty::{Ty, TyCtxt};
use rustc_span::symbol::{sym, Symbol};
Expand Down Expand Up @@ -437,7 +437,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
if intrinsic_name == sym::assert_zero_valid {
let should_panic = !self
.tcx
.permits_zero_init(self.param_env.and(ty))
.check_validity_of_init((InitKind::Zero, self.param_env.and(ty)))
.map_err(|_| err_inval!(TooGeneric))?;

if should_panic {
Expand All @@ -454,7 +454,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
if intrinsic_name == sym::assert_mem_uninitialized_valid {
let should_panic = !self
.tcx
.permits_uninit_init(self.param_env.and(ty))
.check_validity_of_init((
InitKind::UninitMitigated0x01Fill,
self.param_env.and(ty),
))
.map_err(|_| err_inval!(TooGeneric))?;

if should_panic {
Expand Down
7 changes: 2 additions & 5 deletions compiler/rustc_const_eval/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage};
use rustc_macros::fluent_messages;
use rustc_middle::ty;
use rustc_middle::ty::query::Providers;
use rustc_target::abi::InitKind;

fluent_messages! { "../locales/en-US.ftl" }

Expand All @@ -62,9 +61,7 @@ pub fn provide(providers: &mut Providers) {
let (param_env, value) = param_env_and_value.into_parts();
const_eval::deref_mir_constant(tcx, param_env, value)
};
providers.permits_uninit_init = |tcx, param_env_and_ty| {
util::might_permit_raw_init(tcx, param_env_and_ty, InitKind::UninitMitigated0x01Fill)
providers.check_validity_of_init = |tcx, (init_kind, param_env_and_ty)| {
util::might_permit_raw_init(tcx, init_kind, param_env_and_ty)
};
providers.permits_zero_init =
|tcx, param_env_and_ty| util::might_permit_raw_init(tcx, param_env_and_ty, InitKind::Zero);
}
6 changes: 3 additions & 3 deletions compiler/rustc_const_eval/src/util/might_permit_raw_init.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rustc_middle::ty::layout::{LayoutCx, LayoutError, LayoutOf, TyAndLayout};
use rustc_middle::ty::layout::{InitKind, LayoutCx, LayoutError, LayoutOf, TyAndLayout};
use rustc_middle::ty::{ParamEnv, ParamEnvAnd, Ty, TyCtxt};
use rustc_session::Limit;
use rustc_target::abi::{Abi, FieldsShape, InitKind, Scalar, Variants};
use rustc_target::abi::{Abi, FieldsShape, Scalar, Variants};

use crate::const_eval::{CheckAlignment, CompileTimeInterpreter};
use crate::interpret::{InterpCx, MemoryKind, OpTy};
Expand All @@ -20,8 +20,8 @@ use crate::interpret::{InterpCx, MemoryKind, OpTy};
/// to the full uninit check).
pub fn might_permit_raw_init<'tcx>(
tcx: TyCtxt<'tcx>,
param_env_and_ty: ParamEnvAnd<'tcx, Ty<'tcx>>,
kind: InitKind,
param_env_and_ty: ParamEnvAnd<'tcx, Ty<'tcx>>,
) -> Result<bool, LayoutError<'tcx>> {
if tcx.sess.opts.unstable_opts.strict_init_checks {
might_permit_raw_init_strict(tcx.layout_of(param_env_and_ty)?, tcx, kind)
Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,13 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
tcx.fn_sig(trait_m.def_id).subst(tcx, trait_to_placeholder_substs),
)
.fold_with(&mut collector);

debug_assert_ne!(
collector.types.len(),
0,
"expect >1 RPITITs in call to `collect_return_position_impl_trait_in_trait_tys`"
);

let trait_sig = ocx.normalize(&norm_cause, param_env, unnormalized_trait_sig);
trait_sig.error_reported()?;
let trait_return_ty = trait_sig.output();
Expand Down
12 changes: 10 additions & 2 deletions compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,11 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
}
(VarValue::Value(a), VarValue::Empty(_)) => {
match *a {
ReLateBound(..) | ReErased | ReError(_) => {
// this is always on an error path,
// so it doesn't really matter if it's shorter or longer than an empty region
ReError(_) => false,

ReLateBound(..) | ReErased => {
bug!("cannot relate region: {:?}", a);
}

Expand Down Expand Up @@ -467,7 +471,11 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
}
(VarValue::Empty(a_ui), VarValue::Value(b)) => {
match *b {
ReLateBound(..) | ReErased | ReError(_) => {
// this is always on an error path,
// so it doesn't really matter if it's shorter or longer than an empty region
ReError(_) => false,

ReLateBound(..) | ReErased => {
bug!("cannot relate region: {:?}", b);
}

Expand Down
14 changes: 9 additions & 5 deletions compiler/rustc_middle/src/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,17 @@ impl ModuleItems {
self.foreign_items.iter().copied()
}

pub fn definitions(&self) -> impl Iterator<Item = LocalDefId> + '_ {
pub fn owners(&self) -> impl Iterator<Item = OwnerId> + '_ {
self.items
.iter()
.map(|id| id.owner_id.def_id)
.chain(self.trait_items.iter().map(|id| id.owner_id.def_id))
.chain(self.impl_items.iter().map(|id| id.owner_id.def_id))
.chain(self.foreign_items.iter().map(|id| id.owner_id.def_id))
.map(|id| id.owner_id)
.chain(self.trait_items.iter().map(|id| id.owner_id))
.chain(self.impl_items.iter().map(|id| id.owner_id))
.chain(self.foreign_items.iter().map(|id| id.owner_id))
}

pub fn definitions(&self) -> impl Iterator<Item = LocalDefId> + '_ {
self.owners().map(|id| id.def_id)
}

pub fn par_items(&self, f: impl Fn(ItemId) + Send + Sync) {
Expand Down
24 changes: 23 additions & 1 deletion compiler/rustc_middle/src/query/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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,
}
}
}
8 changes: 2 additions & 6 deletions compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
17 changes: 17 additions & 0 deletions compiler/rustc_middle/src/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,23 @@ pub const FAT_PTR_EXTRA: usize = 1;
/// * Cranelift stores the base-2 log of the lane count in a 4 bit integer.
pub const MAX_SIMD_LANES: u64 = 1 << 0xF;

/// Used in `might_permit_raw_init` to indicate the kind of initialisation
/// that is checked to be valid
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable)]
pub enum InitKind {
Zero,
UninitMitigated0x01Fill,
}

impl fmt::Display for InitKind {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Zero => f.write_str("zeroed"),
Self::UninitMitigated0x01Fill => f.write_str("filled with 0x01"),
}
}
}

#[derive(Copy, Clone, Debug, HashStable, TyEncodable, TyDecodable)]
pub enum LayoutError<'tcx> {
Unknown(Ty<'tcx>),
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_middle/src/ty/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use crate::traits::specialization_graph;
use crate::traits::{self, ImplSource};
use crate::ty::context::TyCtxtFeed;
use crate::ty::fast_reject::SimplifiedType;
use crate::ty::layout::InitKind;
use crate::ty::subst::{GenericArg, SubstsRef};
use crate::ty::util::AlwaysRequiresDrop;
use crate::ty::GeneratorDiagnosticData;
Expand Down
Loading