mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
disable size asserts in the compiler when randomizing layouts
This commit is contained in:
parent
f3bc08adbd
commit
5bf8eeb9f3
@ -3569,6 +3569,7 @@ dependencies = [
|
|||||||
"rustc_hir_pretty",
|
"rustc_hir_pretty",
|
||||||
"rustc_hir_typeck",
|
"rustc_hir_typeck",
|
||||||
"rustc_incremental",
|
"rustc_incremental",
|
||||||
|
"rustc_index",
|
||||||
"rustc_infer",
|
"rustc_infer",
|
||||||
"rustc_interface",
|
"rustc_interface",
|
||||||
"rustc_lint",
|
"rustc_lint",
|
||||||
|
@ -30,5 +30,6 @@ features = ['unprefixed_malloc_on_supported_platforms']
|
|||||||
jemalloc = ['dep:jemalloc-sys']
|
jemalloc = ['dep:jemalloc-sys']
|
||||||
llvm = ['rustc_driver_impl/llvm']
|
llvm = ['rustc_driver_impl/llvm']
|
||||||
max_level_info = ['rustc_driver_impl/max_level_info']
|
max_level_info = ['rustc_driver_impl/max_level_info']
|
||||||
|
rustc_randomized_layouts = ['rustc_driver_impl/rustc_randomized_layouts']
|
||||||
rustc_use_parallel_compiler = ['rustc_driver_impl/rustc_use_parallel_compiler']
|
rustc_use_parallel_compiler = ['rustc_driver_impl/rustc_use_parallel_compiler']
|
||||||
# tidy-alphabetical-end
|
# tidy-alphabetical-end
|
||||||
|
@ -23,6 +23,7 @@ rustc_hir_analysis = { path = "../rustc_hir_analysis" }
|
|||||||
rustc_hir_pretty = { path = "../rustc_hir_pretty" }
|
rustc_hir_pretty = { path = "../rustc_hir_pretty" }
|
||||||
rustc_hir_typeck = { path = "../rustc_hir_typeck" }
|
rustc_hir_typeck = { path = "../rustc_hir_typeck" }
|
||||||
rustc_incremental = { path = "../rustc_incremental" }
|
rustc_incremental = { path = "../rustc_incremental" }
|
||||||
|
rustc_index = { path = "../rustc_index" }
|
||||||
rustc_infer = { path = "../rustc_infer" }
|
rustc_infer = { path = "../rustc_infer" }
|
||||||
rustc_interface = { path = "../rustc_interface" }
|
rustc_interface = { path = "../rustc_interface" }
|
||||||
rustc_lint = { path = "../rustc_lint" }
|
rustc_lint = { path = "../rustc_lint" }
|
||||||
@ -72,6 +73,10 @@ ctrlc = "3.4.4"
|
|||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
llvm = ['rustc_interface/llvm']
|
llvm = ['rustc_interface/llvm']
|
||||||
max_level_info = ['rustc_log/max_level_info']
|
max_level_info = ['rustc_log/max_level_info']
|
||||||
|
rustc_randomized_layouts = [
|
||||||
|
'rustc_index/rustc_randomized_layouts',
|
||||||
|
'rustc_middle/rustc_randomized_layouts'
|
||||||
|
]
|
||||||
rustc_use_parallel_compiler = [
|
rustc_use_parallel_compiler = [
|
||||||
'rustc_data_structures/rustc_use_parallel_compiler',
|
'rustc_data_structures/rustc_use_parallel_compiler',
|
||||||
'rustc_interface/rustc_use_parallel_compiler',
|
'rustc_interface/rustc_use_parallel_compiler',
|
||||||
|
@ -20,4 +20,5 @@ nightly = [
|
|||||||
"dep:rustc_macros",
|
"dep:rustc_macros",
|
||||||
"rustc_index_macros/nightly",
|
"rustc_index_macros/nightly",
|
||||||
]
|
]
|
||||||
|
rustc_randomized_layouts = []
|
||||||
# tidy-alphabetical-end
|
# tidy-alphabetical-end
|
||||||
|
@ -33,8 +33,19 @@ pub use vec::IndexVec;
|
|||||||
///
|
///
|
||||||
/// </div>
|
/// </div>
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
|
#[cfg(not(feature = "rustc_randomized_layouts"))]
|
||||||
macro_rules! static_assert_size {
|
macro_rules! static_assert_size {
|
||||||
($ty:ty, $size:expr) => {
|
($ty:ty, $size:expr) => {
|
||||||
const _: [(); $size] = [(); ::std::mem::size_of::<$ty>()];
|
const _: [(); $size] = [(); ::std::mem::size_of::<$ty>()];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
#[cfg(feature = "rustc_randomized_layouts")]
|
||||||
|
macro_rules! static_assert_size {
|
||||||
|
($ty:ty, $size:expr) => {
|
||||||
|
// no effect other than using the statements.
|
||||||
|
// struct sizes are not deterministic under randomized layouts
|
||||||
|
const _: (usize, usize) = ($size, ::std::mem::size_of::<$ty>());
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -40,5 +40,6 @@ tracing = "0.1"
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
|
rustc_randomized_layouts = []
|
||||||
rustc_use_parallel_compiler = ["dep:rustc-rayon-core"]
|
rustc_use_parallel_compiler = ["dep:rustc-rayon-core"]
|
||||||
# tidy-alphabetical-end
|
# tidy-alphabetical-end
|
||||||
|
@ -337,6 +337,7 @@ macro_rules! define_callbacks {
|
|||||||
// Ensure that values grow no larger than 64 bytes by accident.
|
// Ensure that values grow no larger than 64 bytes by accident.
|
||||||
// Increase this limit if necessary, but do try to keep the size low if possible
|
// Increase this limit if necessary, but do try to keep the size low if possible
|
||||||
#[cfg(target_pointer_width = "64")]
|
#[cfg(target_pointer_width = "64")]
|
||||||
|
#[cfg(not(feature = "rustc_randomized_layouts"))]
|
||||||
const _: () = {
|
const _: () = {
|
||||||
if mem::size_of::<Value<'static>>() > 64 {
|
if mem::size_of::<Value<'static>>() > 64 {
|
||||||
panic!("{}", concat!(
|
panic!("{}", concat!(
|
||||||
|
@ -678,6 +678,9 @@ impl Build {
|
|||||||
if self.config.rustc_parallel {
|
if self.config.rustc_parallel {
|
||||||
features.push("rustc_use_parallel_compiler");
|
features.push("rustc_use_parallel_compiler");
|
||||||
}
|
}
|
||||||
|
if self.config.rust_randomize_layout {
|
||||||
|
features.push("rustc_randomized_layouts");
|
||||||
|
}
|
||||||
|
|
||||||
// If debug logging is on, then we want the default for tracing:
|
// If debug logging is on, then we want the default for tracing:
|
||||||
// https://github.com/tokio-rs/tracing/blob/3dd5c03d907afdf2c39444a29931833335171554/tracing/src/level_filters.rs#L26
|
// https://github.com/tokio-rs/tracing/blob/3dd5c03d907afdf2c39444a29931833335171554/tracing/src/level_filters.rs#L26
|
||||||
|
Loading…
Reference in New Issue
Block a user