From 78075e1e26176f86cbafb0bf24f86dba174351ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Fri, 6 Jan 2023 00:00:00 +0000 Subject: [PATCH 1/2] Change type of mutable_noalias to bool --- compiler/rustc_interface/src/tests.rs | 2 +- compiler/rustc_session/src/options.rs | 2 +- compiler/rustc_ty_utils/src/abi.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 316e2e29cd8b3..6c26b47eaa4a0 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -754,7 +754,7 @@ fn test_unstable_options_tracking_hash() { tracked!(mir_enable_passes, vec![("DestProp".to_string(), false)]); tracked!(mir_opt_level, Some(4)); tracked!(move_size_limit, Some(4096)); - tracked!(mutable_noalias, Some(true)); + tracked!(mutable_noalias, false); tracked!(no_generate_arange_section, true); tracked!(no_jump_tables, true); tracked!(no_link, true); diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 043a60a1c5310..43c4fd011e135 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1437,7 +1437,7 @@ options! { "use line numbers relative to the function in mir pretty printing"), move_size_limit: Option = (None, parse_opt_number, [TRACKED], "the size at which the `large_assignments` lint starts to be emitted"), - mutable_noalias: Option = (None, parse_opt_bool, [TRACKED], + mutable_noalias: bool = (true, parse_bool, [TRACKED], "emit noalias metadata for mutable references (default: yes)"), nll_facts: bool = (false, parse_bool, [UNTRACKED], "dump facts from NLL analysis into side files (default: no)"), diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs index f8a5691f29de0..bbb2b3b987d6f 100644 --- a/compiler/rustc_ty_utils/src/abi.rs +++ b/compiler/rustc_ty_utils/src/abi.rs @@ -259,7 +259,7 @@ fn adjust_for_rust_scalar<'tcx>( // LLVM prior to version 12 had known miscompiles in the presence of noalias attributes // (see #54878), so it was conditionally disabled, but we don't support earlier // versions at all anymore. We still support turning it off using -Zmutable-noalias. - let noalias_mut_ref = cx.tcx.sess.opts.unstable_opts.mutable_noalias.unwrap_or(true); + let noalias_mut_ref = cx.tcx.sess.opts.unstable_opts.mutable_noalias; // `&mut` pointer parameters never alias other parameters, // or mutable global data From 72f8d6a6597e4b780e518e606ec39595ee0eda85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Fri, 6 Jan 2023 00:00:00 +0000 Subject: [PATCH 2/2] Change type of box_noalias to bool --- compiler/rustc_interface/src/tests.rs | 2 +- compiler/rustc_session/src/options.rs | 2 +- compiler/rustc_ty_utils/src/abi.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 6c26b47eaa4a0..a3b9891ee64e9 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -715,7 +715,7 @@ fn test_unstable_options_tracking_hash() { tracked!(asm_comments, true); tracked!(assume_incomplete_release, true); tracked!(binary_dep_depinfo, true); - tracked!(box_noalias, Some(false)); + tracked!(box_noalias, false); tracked!( branch_protection, Some(BranchProtection { diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 43c4fd011e135..994be8d5f85fe 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1255,7 +1255,7 @@ options! { binary_dep_depinfo: bool = (false, parse_bool, [TRACKED], "include artifacts (sysroot, crate dependencies) used during compilation in dep-info \ (default: no)"), - box_noalias: Option = (None, parse_opt_bool, [TRACKED], + box_noalias: bool = (true, parse_bool, [TRACKED], "emit noalias metadata for box (default: yes)"), branch_protection: Option = (None, parse_branch_protection, [TRACKED], "set options for branch target identification and pointer authentication on AArch64"), diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs index bbb2b3b987d6f..d1197774fe96c 100644 --- a/compiler/rustc_ty_utils/src/abi.rs +++ b/compiler/rustc_ty_utils/src/abi.rs @@ -254,7 +254,7 @@ fn adjust_for_rust_scalar<'tcx>( // The aliasing rules for `Box` are still not decided, but currently we emit // `noalias` for it. This can be turned off using an unstable flag. // See https://github.com/rust-lang/unsafe-code-guidelines/issues/326 - let noalias_for_box = cx.tcx.sess.opts.unstable_opts.box_noalias.unwrap_or(true); + let noalias_for_box = cx.tcx.sess.opts.unstable_opts.box_noalias; // LLVM prior to version 12 had known miscompiles in the presence of noalias attributes // (see #54878), so it was conditionally disabled, but we don't support earlier