diff --git a/compiler/rustc_codegen_llvm/src/attributes.rs b/compiler/rustc_codegen_llvm/src/attributes.rs index 1f00e47a89927..f0beb11668c72 100644 --- a/compiler/rustc_codegen_llvm/src/attributes.rs +++ b/compiler/rustc_codegen_llvm/src/attributes.rs @@ -530,9 +530,7 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>( to_add.extend(sanitize_attrs(cx, tcx, codegen_fn_attrs.sanitizers)); // For non-naked functions, set branch protection attributes on aarch64. - if let Some(BranchProtection { bti, pac_ret, gcs }) = - sess.opts.unstable_opts.branch_protection - { + if let Some(BranchProtection { bti, pac_ret, gcs }) = sess.opts.cg.branch_protection { assert!(sess.target.arch == Arch::AArch64); if bti { to_add.push(llvm::CreateAttrString(cx.llcx, "branch-target-enforcement")); diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index 8f1910eaced13..e05329de1d185 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -396,7 +396,7 @@ pub(crate) unsafe fn create_module<'ll>( } } - if let Some(regparm_count) = sess.opts.unstable_opts.regparm { + if let Some(regparm_count) = sess.opts.cg.regparm { llvm::add_module_flag_u32( llmod, llvm::ModuleFlagMergeBehavior::Error, @@ -405,8 +405,7 @@ pub(crate) unsafe fn create_module<'ll>( ); } - if let Some(BranchProtection { bti, pac_ret, gcs }) = sess.opts.unstable_opts.branch_protection - { + if let Some(BranchProtection { bti, pac_ret, gcs }) = sess.opts.cg.branch_protection { if sess.target.arch == Arch::AArch64 { llvm::add_module_flag_u32( llmod, @@ -511,7 +510,7 @@ pub(crate) unsafe fn create_module<'ll>( ); } - if sess.opts.unstable_opts.indirect_branch_cs_prefix { + if sess.opts.cg.indirect_branch_cs_prefix { llvm::add_module_flag_u32( llmod, llvm::ModuleFlagMergeBehavior::Override, diff --git a/compiler/rustc_codegen_llvm/src/errors.rs b/compiler/rustc_codegen_llvm/src/errors.rs index bcbafab585b40..8ed560966890b 100644 --- a/compiler/rustc_codegen_llvm/src/errors.rs +++ b/compiler/rustc_codegen_llvm/src/errors.rs @@ -205,7 +205,7 @@ pub(crate) struct MismatchedDataLayout<'a> { } #[derive(Diagnostic)] -#[diag("the `-Zfixed-x18` flag is not supported on the `{$arch}` architecture")] +#[diag("the `-Tfixed-x18` flag is not supported on the `{$arch}` architecture")] pub(crate) struct FixedX18InvalidArch<'a> { pub arch: &'a str, } diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 87d8676cd8018..1ecafad75dc91 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -634,7 +634,7 @@ fn llvm_features_by_flags(sess: &Session, features: &mut Vec) { target_features::sanitizer_features_by_flags(sess, features); // -Zfixed-x18 - if sess.opts.unstable_opts.fixed_x18 { + if sess.opts.cg.fixed_x18 { if sess.target.arch != Arch::AArch64 { sess.dcx().emit_fatal(errors::FixedX18InvalidArch { arch: sess.target.arch.desc() }); } else { diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs index d3af6eba33374..caaea7db484f9 100644 --- a/compiler/rustc_codegen_ssa/src/base.rs +++ b/compiler/rustc_codegen_ssa/src/base.rs @@ -727,7 +727,7 @@ pub fn codegen_crate< && tcx.sess.target.unsupported_cpus.contains(&target_cpu.into()) { // The target cpu is explicitly listed as an unsupported cpu - tcx.dcx().emit_fatal(diagnostics::CpuUnsupported { target_cpu: target_cpu.clone() }); + tcx.dcx().emit_fatal(diagnostics::CpuUnsupported { target_cpu: target_cpu.to_string() }); } let cgu_name_builder = &mut CodegenUnitNameBuilder::new(tcx); diff --git a/compiler/rustc_codegen_ssa/src/diagnostics.rs b/compiler/rustc_codegen_ssa/src/diagnostics.rs index 1fe52c34e89f4..a77b1d82e1de2 100644 --- a/compiler/rustc_codegen_ssa/src/diagnostics.rs +++ b/compiler/rustc_codegen_ssa/src/diagnostics.rs @@ -537,7 +537,7 @@ pub(crate) struct CheckInstalledVisualStudio; pub(crate) struct InsufficientVSCodeProduct; #[derive(Diagnostic)] -#[diag("target requires explicitly specifying a cpu with `-C target-cpu`")] +#[diag("target requires explicitly specifying a cpu with `-T target-cpu`")] pub(crate) struct CpuRequired; #[derive(Diagnostic)] diff --git a/compiler/rustc_codegen_ssa/src/target_features.rs b/compiler/rustc_codegen_ssa/src/target_features.rs index 8f459e5a218d2..234c3dff678ca 100644 --- a/compiler/rustc_codegen_ssa/src/target_features.rs +++ b/compiler/rustc_codegen_ssa/src/target_features.rs @@ -484,17 +484,17 @@ pub fn flag_to_backend_features<'a>( /// Computes the backend target features to be added to account for retpoline flags. /// Used by both LLVM and GCC since their target features are, conveniently, the same. pub fn retpoline_features_by_flags(sess: &Session, features: &mut Vec) { - // -Zretpoline without -Zretpoline-external-thunk enables + // -Tretpoline without -Tretpoline-external-thunk enables // retpoline-indirect-branches and retpoline-indirect-calls target features - let unstable_opts = &sess.opts.unstable_opts; - if unstable_opts.retpoline && !unstable_opts.retpoline_external_thunk { + let cg = &sess.opts.cg; + if cg.retpoline && !cg.retpoline_external_thunk { features.push("+retpoline-indirect-branches".into()); features.push("+retpoline-indirect-calls".into()); } - // -Zretpoline-external-thunk (maybe, with -Zretpoline too) enables + // -Tretpoline-external-thunk (maybe, with -Tretpoline too) enables // retpoline-external-thunk, retpoline-indirect-branches and // retpoline-indirect-calls target features - if unstable_opts.retpoline_external_thunk { + if cg.retpoline_external_thunk { features.push("+retpoline-external-thunk".into()); features.push("+retpoline-indirect-branches".into()); features.push("+retpoline-indirect-calls".into()); diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 7b4c5626a79e1..2ee9af289804a 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -939,6 +939,7 @@ fn usage(verbose: bool, include_unstable_options: bool, nightly_build: bool) { safe_println!( "{options}{at_path}\nAdditional help: -C help Print codegen options + -T help Print target modifier options -W help \ Print 'lint' options and default settings{nightly}{verbose}\n", options = options.usage(message), diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 22b643e74e582..2dc9d51868821 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -630,6 +630,14 @@ fn test_codegen_options_tracking_hash() { // Make sure that changing a [TRACKED] option changes the hash. // tidy-alphabetical-start + tracked!( + branch_protection, + Some(BranchProtection { + bti: true, + pac_ret: Some(PacRet { leaf: true, pc: true, key: PAuthKey::B }), + gcs: true, + }) + ); tracked!(code_model, Some(CodeModel::Large)); tracked!(collapse_macro_debuginfo, CollapseMacroDebuginfo::Yes); tracked!(control_flow_guard, CFGuard::Checks); @@ -637,8 +645,10 @@ fn test_codegen_options_tracking_hash() { tracked!(debuginfo, DebugInfo::Limited); tracked!(dwarf_version, Some(5)); tracked!(embed_bitcode, false); + tracked!(fixed_x18, true); tracked!(force_frame_pointers, FramePointer::Always); tracked!(force_unwind_tables, Some(true)); + tracked!(indirect_branch_cs_prefix, true); tracked!(instrument_coverage, InstrumentCoverage::Yes); tracked!(jump_tables, false); tracked!(link_dead_code, Some(true)); @@ -657,8 +667,14 @@ fn test_codegen_options_tracking_hash() { tracked!(prefer_dynamic, true); tracked!(profile_generate, SwitchWithOptPath::Enabled(None)); tracked!(profile_use, Some(PathBuf::from("abc"))); + tracked!(reg_struct_return, true); + tracked!(regparm, Some(3)); tracked!(relocation_model, Some(RelocModel::Pic)); tracked!(relro_level, Some(RelroLevel::Full)); + tracked!(retpoline, true); + tracked!(retpoline_external_thunk, true); + tracked!(sanitizer, SanitizerSet::CFI); + tracked!(sanitizer_cfi_normalize_integers, Some(true)); tracked!(split_debuginfo, Some(SplitDebuginfo::Packed)); tracked!(symbol_mangling_version, Some(SymbolManglingVersion::V0)); tracked!(target_cpu, Some(String::from("abc"))); @@ -789,14 +805,6 @@ fn test_unstable_options_tracking_hash() { tracked!(autodiff_post_passes, Some("function(mem2reg,instsimplify,simplifycfg)".to_string())); tracked!(binary_dep_depinfo, true); tracked!(box_noalias, false); - tracked!( - branch_protection, - Some(BranchProtection { - bti: true, - pac_ret: Some(PacRet { leaf: true, pc: true, key: PAuthKey::B }), - gcs: true, - }) - ); tracked!(codegen_backend, Some("abc".to_string())); tracked!(codegen_emit_retag, Some(CodegenRetagOptions::default())); tracked!( @@ -820,7 +828,6 @@ fn test_unstable_options_tracking_hash() { tracked!(embed_source, true); tracked!(export_executable_symbols, true); tracked!(fewer_names, Some(true)); - tracked!(fixed_x18, true); tracked!(flatten_format_args, false); tracked!(fmt_debug, FmtDebug::Shallow); tracked!(force_unstable_if_unmarked, true); @@ -829,7 +836,6 @@ fn test_unstable_options_tracking_hash() { tracked!(hint_mostly_unused, true); tracked!(human_readable_cgu_names, true); tracked!(incremental_ignore_spans, true); - tracked!(indirect_branch_cs_prefix, true); tracked!(inline_mir, Some(true)); tracked!(inline_mir_hint_threshold, Some(123)); tracked!(inline_mir_threshold, Some(123)); @@ -872,14 +878,10 @@ fn test_unstable_options_tracking_hash() { tracked!(precise_enum_drop_elaboration, false); tracked!(profile_sample_use, Some(PathBuf::from("abc"))); tracked!(profiler_runtime, "abc".to_string()); - tracked!(reg_struct_return, true); - tracked!(regparm, Some(3)); tracked!(relax_elf_relocations, Some(true)); tracked!(remap_cwd_prefix, Some(PathBuf::from("abc"))); - tracked!(sanitizer, SanitizerSet::ADDRESS); tracked!(sanitizer_cfi_canonical_jump_tables, None); tracked!(sanitizer_cfi_generalize_pointers, Some(true)); - tracked!(sanitizer_cfi_normalize_integers, Some(true)); tracked!(sanitizer_dataflow_abilist, vec![String::from("/rustc/abc")]); tracked!(sanitizer_kcfi_arity, Some(true)); tracked!(sanitizer_memory_track_origins, 2); diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs index bb91d855feaeb..052294464e4db 100644 --- a/compiler/rustc_metadata/src/creader.rs +++ b/compiler/rustc_metadata/src/creader.rs @@ -22,10 +22,7 @@ use rustc_middle::ty::data_structures::IndexSet; use rustc_middle::ty::{TyCtxt, TyCtxtFeed}; use rustc_proc_macro::bridge::client::Client as ProcMacroClient; use rustc_session::config::mitigation_coverage::DeniedPartialMitigationLevel; -use rustc_session::config::{ - CrateType, ExtendedTargetModifierInfo, ExternLocation, Externs, OptionsTargetModifiers, - TargetModifier, -}; +use rustc_session::config::{CrateType, ExternLocation, Externs}; use rustc_session::cstore::{CrateDepKind, CrateSource, ExternCrate, ExternCrateSource}; use rustc_session::output::validate_crate_name; use rustc_session::search_paths::PathKind; @@ -38,9 +35,7 @@ use tracing::{debug, info, trace}; use crate::diagnostics; use crate::locator::{CrateError, CrateLocator, CratePaths, CrateRejections}; -use crate::rmeta::{ - CrateDep, CrateMetadata, CrateNumMap, CrateRoot, MetadataBlob, TargetModifiers, -}; +use crate::rmeta::{CrateDep, CrateMetadata, CrateNumMap, CrateRoot, MetadataBlob}; /// The backend's way to give the crate store access to the metadata in a library. /// Note that it returns the raw metadata bytes stored in the library file, whether @@ -338,116 +333,6 @@ impl CStore { } } - fn report_target_modifiers_extended( - tcx: TyCtxt<'_>, - krate: &Crate, - mods: &TargetModifiers, - dep_mods: &TargetModifiers, - data: &CrateMetadata, - ) { - let span = krate.spans.inner_span.shrink_to_lo(); - let allowed_flag_mismatches = &tcx.sess.opts.cg.unsafe_allow_abi_mismatch; - let local_crate = tcx.crate_name(LOCAL_CRATE); - let tmod_extender = |tmod: &TargetModifier| (tmod.extend(), tmod.clone()); - let report_diff = |prefix: &String, - opt_name: &String, - flag_local_value: Option<&String>, - flag_extern_value: Option<&String>| { - if allowed_flag_mismatches.contains(&opt_name) { - return; - } - let extern_crate = data.name(); - let flag_name = opt_name.clone(); - let flag_name_prefixed = format!("-{}{}", prefix, opt_name); - - match (flag_local_value, flag_extern_value) { - (Some(local_value), Some(extern_value)) => { - tcx.dcx().emit_err(diagnostics::IncompatibleTargetModifiers { - span, - extern_crate, - local_crate, - flag_name, - flag_name_prefixed, - local_value: local_value.to_string(), - extern_value: extern_value.to_string(), - }) - } - (None, Some(extern_value)) => { - tcx.dcx().emit_err(diagnostics::IncompatibleTargetModifiersLMissed { - span, - extern_crate, - local_crate, - flag_name, - flag_name_prefixed, - extern_value: extern_value.to_string(), - has_extern_value: !extern_value.is_empty(), - }) - } - (Some(local_value), None) => { - tcx.dcx().emit_err(diagnostics::IncompatibleTargetModifiersRMissed { - span, - extern_crate, - local_crate, - flag_name, - flag_name_prefixed, - local_value: local_value.to_string(), - has_local_value: !local_value.is_empty(), - }) - } - (None, None) => panic!("Incorrect target modifiers report_diff(None, None)"), - }; - }; - let mut it1 = mods.iter().map(tmod_extender); - let mut it2 = dep_mods.iter().map(tmod_extender); - let mut left_name_val: Option<(ExtendedTargetModifierInfo, TargetModifier)> = None; - let mut right_name_val: Option<(ExtendedTargetModifierInfo, TargetModifier)> = None; - loop { - left_name_val = left_name_val.or_else(|| it1.next()); - right_name_val = right_name_val.or_else(|| it2.next()); - match (&left_name_val, &right_name_val) { - (Some(l), Some(r)) => match l.1.opt.cmp(&r.1.opt) { - cmp::Ordering::Equal => { - if !l.1.consistent(&tcx.sess, Some(&r.1)) { - report_diff( - &l.0.prefix, - &l.0.name, - Some(&l.1.value_name), - Some(&r.1.value_name), - ); - } - left_name_val = None; - right_name_val = None; - } - cmp::Ordering::Greater => { - if !r.1.consistent(&tcx.sess, None) { - report_diff(&r.0.prefix, &r.0.name, None, Some(&r.1.value_name)); - } - right_name_val = None; - } - cmp::Ordering::Less => { - if !l.1.consistent(&tcx.sess, None) { - report_diff(&l.0.prefix, &l.0.name, Some(&l.1.value_name), None); - } - left_name_val = None; - } - }, - (Some(l), None) => { - if !l.1.consistent(&tcx.sess, None) { - report_diff(&l.0.prefix, &l.0.name, Some(&l.1.value_name), None); - } - left_name_val = None; - } - (None, Some(r)) => { - if !r.1.consistent(&tcx.sess, None) { - report_diff(&r.0.prefix, &r.0.name, None, Some(&r.1.value_name)); - } - right_name_val = None; - } - (None, None) => break, - } - } - } - pub fn report_session_incompatibilities(&self, tcx: TyCtxt<'_>, krate: &Crate) { self.report_incompatible_target_modifiers(tcx, krate); self.report_incompatible_partial_mitigations(tcx, krate); @@ -456,22 +341,25 @@ impl CStore { pub fn report_incompatible_target_modifiers(&self, tcx: TyCtxt<'_>, krate: &Crate) { for flag_name in &tcx.sess.opts.cg.unsafe_allow_abi_mismatch { - if !OptionsTargetModifiers::is_target_modifier(flag_name) { + if !tcx.sess.opts.cg.is_target_modifier(flag_name) { tcx.dcx().emit_err(diagnostics::UnknownTargetModifierUnsafeAllowed { span: krate.spans.inner_span.shrink_to_lo(), flag_name: flag_name.clone(), }); } } - let mods = tcx.sess.opts.gather_target_modifiers(); - for (_cnum, data) in self.iter_crate_data() { + + for (_, data) in self.iter_crate_data() { if data.is_proc_macro_crate() { continue; } - let dep_mods = data.target_modifiers(); - if mods != dep_mods { - Self::report_target_modifiers_extended(tcx, krate, &mods, &dep_mods, data); - } + tcx.sess.opts.cg.report_mismatched_flags_with_dep( + tcx.sess, + krate.spans.inner_span.shrink_to_lo(), + tcx.crate_name(LOCAL_CRATE), + data.target_modifiers(), + data.name(), + ); } } diff --git a/compiler/rustc_metadata/src/diagnostics.rs b/compiler/rustc_metadata/src/diagnostics.rs index 01456377a234f..7d8edb18ae2ee 100644 --- a/compiler/rustc_metadata/src/diagnostics.rs +++ b/compiler/rustc_metadata/src/diagnostics.rs @@ -575,93 +575,6 @@ pub(crate) struct WasmCAbi { pub span: Span, } -#[derive(Diagnostic)] -#[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")] -#[help( - "the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely" -)] -#[note( - "`{$flag_name_prefixed}={$local_value}` in this crate is incompatible with `{$flag_name_prefixed}={$extern_value}` in dependency `{$extern_crate}`" -)] -#[help( - "set `{$flag_name_prefixed}={$extern_value}` in this crate or `{$flag_name_prefixed}={$local_value}` in `{$extern_crate}`" -)] -#[help( - "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error" -)] -pub(crate) struct IncompatibleTargetModifiers { - #[primary_span] - pub span: Span, - pub extern_crate: Symbol, - pub local_crate: Symbol, - pub flag_name: String, - pub flag_name_prefixed: String, - pub local_value: String, - pub extern_value: String, -} - -#[derive(Diagnostic)] -#[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")] -#[help( - "the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely" -)] -#[note( - "`{$flag_name_prefixed}` is unset in this crate which is incompatible with {$has_extern_value -> - [false] `{$flag_name_prefixed}` being set - *[other] `{$flag_name_prefixed}={$extern_value}` - } in dependency `{$extern_crate}`" -)] -#[help( - "set {$has_extern_value -> - [false] `{$flag_name_prefixed}` - *[other] `{$flag_name_prefixed}={$extern_value}` - } in this crate or unset `{$flag_name_prefixed}` in `{$extern_crate}`" -)] -#[help( - "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error" -)] -pub(crate) struct IncompatibleTargetModifiersLMissed { - #[primary_span] - pub span: Span, - pub extern_crate: Symbol, - pub local_crate: Symbol, - pub flag_name: String, - pub flag_name_prefixed: String, - pub extern_value: String, - pub has_extern_value: bool, -} - -#[derive(Diagnostic)] -#[diag("mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`")] -#[help( - "the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely" -)] -#[note( - "{$has_local_value -> - [false] `{$flag_name_prefixed}` being set - *[other] `{$flag_name_prefixed}={$local_value}` - } in this crate is incompatible with `{$flag_name_prefixed}` being unset in dependency `{$extern_crate}`" -)] -#[help( - "unset `{$flag_name_prefixed}` in this crate or set {$has_local_value -> - [false] `{$flag_name_prefixed}` - *[other] `{$flag_name_prefixed}={$local_value}` - } in `{$extern_crate}`" -)] -#[help( - "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error" -)] -pub(crate) struct IncompatibleTargetModifiersRMissed { - #[primary_span] - pub span: Span, - pub extern_crate: Symbol, - pub local_crate: Symbol, - pub flag_name: String, - pub flag_name_prefixed: String, - pub local_value: String, - pub has_local_value: bool, -} - #[derive(Diagnostic)] #[diag( "unknown target modifier `{$flag_name}`, requested by `-Cunsafe-allow-abi-mismatch={$flag_name}`" diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index 349a8445d48ba..586ff9d1232b5 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -30,7 +30,7 @@ use rustc_middle::{bug, implement_ty_decoder}; use rustc_proc_macro::bridge::client::Client as ProcMacroClient; use rustc_serialize::opaque::MemDecoder; use rustc_serialize::{Decodable, Decoder}; -use rustc_session::config::TargetModifier; +use rustc_session::config::CollectedTargetModifiers; use rustc_session::config::mitigation_coverage::DeniedPartialMitigation; use rustc_session::cstore::{CrateSource, ExternCrate}; use rustc_span::def_id::ModId; @@ -81,10 +81,6 @@ impl MetadataBlob { /// own crate numbers. pub(crate) type CrateNumMap = IndexVec; -/// Target modifiers - abi or exploit mitigations options that may cause unsoundness when mixed or -/// partially enabled. -pub(crate) type TargetModifiers = Vec; - /// The set of mitigations that cannot be partially enabled (see /// [RFC 3855](https://github.com/rust-lang/rfcs/pull/3855)), but are currently enabled for this /// crate. @@ -925,20 +921,17 @@ impl MetadataBlob { write!(out, "\n")?; } + #[allow(rustc::potential_query_instability)] // `FxHashMap` order only for testing "target_modifiers" => { writeln!(out, "=Target modifiers=")?; - - for modifier in root.decode_target_modifiers(self) { - let extended = modifier.extend(); - - writeln!( - out, - "-{}{}={} [{}]", - extended.prefix, - extended.name, - modifier.value_name, - extended.tech_value, - )?; + let cg: FxHashMap<_, _> = root.target_modifiers.codegen.decode(self).collect(); + for (key, val) in cg { + writeln!(out, "-T{key}{val}")?; + } + let unstable: FxHashMap<_, _> = + root.target_modifiers.unstable.decode(self).collect(); + for (key, val) in unstable { + writeln!(out, "-T{key}{val}")?; } } @@ -990,13 +983,6 @@ impl CrateRoot { self.crate_deps.decode(metadata) } - pub(crate) fn decode_target_modifiers<'a>( - &self, - metadata: &'a MetadataBlob, - ) -> impl ExactSizeIterator { - self.target_modifiers.decode(metadata) - } - pub(crate) fn decode_denied_partial_mitigations<'a>( &self, metadata: &'a MetadataBlob, @@ -1992,14 +1978,17 @@ impl CrateMetadata { self.cnum_map.iter().copied() } - pub(crate) fn target_modifiers(&self) -> TargetModifiers { - self.root.decode_target_modifiers(&self.blob).collect() - } - pub(crate) fn enabled_denied_partial_mitigations(&self) -> DeniedPartialMitigations { self.root.decode_denied_partial_mitigations(&self.blob).collect() } + pub(crate) fn target_modifiers(&self) -> CollectedTargetModifiers { + CollectedTargetModifiers { + codegen: self.root.target_modifiers.codegen.decode(&self.blob).collect(), + unstable: self.root.target_modifiers.unstable.decode(&self.blob).collect(), + } + } + /// Keep `new_extern_crate` if it looks better in diagnostics pub(crate) fn update_extern_crate_diagnostics( &mut self, diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index 7209e3d8ec338..3d2bda5fcd734 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -27,7 +27,7 @@ use rustc_middle::ty::fast_reject::{self, TreatParams}; use rustc_middle::{bug, span_bug}; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder, opaque}; use rustc_session::config::mitigation_coverage::DeniedPartialMitigation; -use rustc_session::config::{CrateType, OptLevel, TargetModifier}; +use rustc_session::config::{CrateType, OptLevel}; use rustc_span::def_id::CRATE_MOD_ID; use rustc_span::hygiene::HygieneEncodeContext; use rustc_span::{ @@ -719,9 +719,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { // Encode source_map. This needs to be done last, because encoding `Span`s tells us which // `SourceFiles` we actually need to encode. let source_map = stat!("source-map", || self.encode_source_map()); - let target_modifiers = stat!("target-modifiers", || self.encode_target_modifiers()); let denied_partial_mitigations = stat!("denied-partial-mitigations", || self .encode_enabled_denied_partial_mitigations()); + let target_modifiers = stat!("target-modifiers", || self.encode_target_modifiers()); let root = stat!("final", || { let attrs = tcx.hir_krate_attrs(); @@ -752,6 +752,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { panic_runtime: find_attr!(attrs, PanicRuntime), profiler_runtime: find_attr!(attrs, ProfilerRuntime), symbol_mangling_version: tcx.sess.opts.get_symbol_mangling_version(), + target_modifiers, crate_deps, dylib_dependency_formats, @@ -765,7 +766,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { native_libraries, foreign_modules, source_map, - target_modifiers, denied_partial_mitigations, traits, impls, @@ -2110,16 +2110,44 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { self.lazy_array(deps.iter().map(|(_, dep)| dep)) } - fn encode_target_modifiers(&mut self) -> LazyArray { + fn encode_enabled_denied_partial_mitigations(&mut self) -> LazyArray { empty_proc_macro!(self); let tcx = self.tcx; - self.lazy_array(tcx.sess.opts.gather_target_modifiers()) + self.lazy_array(tcx.sess.gather_enabled_denied_partial_mitigations()) } - fn encode_enabled_denied_partial_mitigations(&mut self) -> LazyArray { - empty_proc_macro!(self); + fn encode_target_modifiers(&mut self) -> TargetModifiers { + if self.is_proc_macro { + return TargetModifiers { + codegen: LazyArray::default(), + unstable: LazyArray::default(), + }; + } + let tcx = self.tcx; - self.lazy_array(tcx.sess.gather_enabled_denied_partial_mitigations()) + // JUSTIFICATION: Iteration order doesn't matter + #[allow(rustc::potential_query_instability)] + let codegen = self.lazy_array( + tcx.sess + .opts + .collected_options + .target_modifiers + .codegen + .iter() + .map(|(k, v)| (k.clone(), v.clone())), + ); + // JUSTIFICATION: Iteration order doesn't matter + #[allow(rustc::potential_query_instability)] + let unstable = self.lazy_array( + tcx.sess + .opts + .collected_options + .target_modifiers + .unstable + .iter() + .map(|(k, v)| (k.clone(), v.clone())), + ); + TargetModifiers { codegen, unstable } } fn encode_lib_features(&mut self) -> LazyArray<(Symbol, FeatureStability)> { diff --git a/compiler/rustc_metadata/src/rmeta/mod.rs b/compiler/rustc_metadata/src/rmeta/mod.rs index 63096ecd2c636..4a5eb32a096b2 100644 --- a/compiler/rustc_metadata/src/rmeta/mod.rs +++ b/compiler/rustc_metadata/src/rmeta/mod.rs @@ -2,7 +2,7 @@ use std::marker::PhantomData; use std::num::NonZero; use decoder::LazyDecoder; -pub(crate) use decoder::{CrateMetadata, CrateNumMap, MetadataBlob, TargetModifiers}; +pub(crate) use decoder::{CrateMetadata, CrateNumMap, MetadataBlob}; use def_path_hash_map::DefPathHashMapRef; use encoder::EncodeContext; pub use encoder::{EncodedMetadata, encode_metadata, rendered_const}; @@ -37,7 +37,9 @@ use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_middle::util::Providers; use rustc_serialize::opaque::FileEncoder; use rustc_session::config::mitigation_coverage::DeniedPartialMitigation; -use rustc_session::config::{SymbolManglingVersion, TargetModifier}; +use rustc_session::config::{ + CodegenOptionsKey, SymbolManglingVersion, TargetModifierValue, UnstableOptionsKey, +}; use rustc_session::cstore::{CrateDepKind, ForeignModule, LinkagePreference, NativeLib}; use rustc_span::edition::Edition; use rustc_span::hygiene::{ExpnIndex, MacroKind, SyntaxContextKey}; @@ -203,6 +205,12 @@ pub enum ProcMacroKind { Bang { name: String }, } +#[derive(MetadataEncodable, LazyDecodable)] +pub(crate) struct TargetModifiers { + codegen: LazyArray<(CodegenOptionsKey, TargetModifierValue)>, + unstable: LazyArray<(UnstableOptionsKey, TargetModifierValue)>, +} + /// Serialized crate metadata. /// /// This contains just enough information to determine if we should load the `CrateRoot` or not. @@ -293,8 +301,8 @@ pub(crate) struct CrateRoot { def_path_hash_map: LazyValue>, source_map: LazyTable>>, - target_modifiers: LazyArray, denied_partial_mitigations: LazyArray, + target_modifiers: TargetModifiers, compiler_builtins: bool, needs_allocator: bool, diff --git a/compiler/rustc_metadata/src/rmeta/parameterized.rs b/compiler/rustc_metadata/src/rmeta/parameterized.rs index a156dbb21d6ba..4e5e9b19e349c 100644 --- a/compiler/rustc_metadata/src/rmeta/parameterized.rs +++ b/compiler/rustc_metadata/src/rmeta/parameterized.rs @@ -129,7 +129,9 @@ trivially_parameterized_over_tcx! { rustc_middle::ty::Visibility, rustc_middle::ty::adjustment::CoerceUnsizedInfo, rustc_middle::ty::fast_reject::SimplifiedType, - rustc_session::config::TargetModifier, + rustc_session::config::CodegenOptionsKey, + rustc_session::config::TargetModifierValue, + rustc_session::config::UnstableOptionsKey, rustc_session::config::mitigation_coverage::DeniedPartialMitigation, rustc_session::cstore::ForeignModule, rustc_session::cstore::LinkagePreference, diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index 3fb35d48513ad..6e3ae176dde19 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -614,8 +614,8 @@ impl<'tcx> HasTargetSpec for TyCtxt<'tcx> { impl<'tcx> HasX86AbiOpt for TyCtxt<'tcx> { fn x86_abi_opt(&self) -> X86Abi { X86Abi { - regparm: self.sess.opts.unstable_opts.regparm, - reg_struct_return: self.sess.opts.unstable_opts.reg_struct_return, + regparm: self.sess.opts.cg.regparm, + reg_struct_return: self.sess.opts.cg.reg_struct_return, } } } diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 37488ebbf1e8f..de3e3c18a4cfe 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -10,7 +10,7 @@ use std::hash::Hash; use std::path::{Path, PathBuf}; use std::str::{self, FromStr}; use std::sync::LazyLock; -use std::{cmp, fs, iter}; +use std::{cmp, fmt, fs, iter}; use externs::{ExternOpt, split_extern_opt}; use rustc_data_structures::fx::{FxHashSet, FxIndexMap}; @@ -1471,8 +1471,7 @@ impl Default for Options { color: ColorConfig::Auto, logical_env: FxIndexMap::default(), verbose: false, - target_modifiers: BTreeMap::default(), - mitigation_coverage_map: Default::default(), + collected_options: Default::default(), } } } @@ -1585,27 +1584,52 @@ impl Passes { } } -#[derive(Clone, Copy, Hash, Debug, PartialEq)] +#[derive(Clone, Copy, Hash, Debug, PartialEq, Encodable, BlobDecodable)] pub enum PAuthKey { A, B, } -#[derive(Clone, Copy, Hash, Debug, PartialEq)] +#[derive(Clone, Copy, Hash, Debug, PartialEq, Encodable, BlobDecodable)] pub struct PacRet { pub leaf: bool, pub pc: bool, pub key: PAuthKey, } -#[derive(Clone, Copy, Hash, Debug, PartialEq, Default)] +#[derive(Clone, Copy, Hash, Debug, PartialEq, Default, Encodable, BlobDecodable)] pub struct BranchProtection { pub bti: bool, pub pac_ret: Option, pub gcs: bool, } -#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialOrd, PartialEq)] +impl fmt::Display for BranchProtection { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let mut parts = Vec::new(); + if self.bti { + parts.push("bti"); + } + if let Some(pac_ret) = self.pac_ret { + parts.push("pac-ret"); + if pac_ret.leaf { + parts.push("leaf"); + } + if pac_ret.pc { + parts.push("pc"); + } + if matches!(pac_ret.key, PAuthKey::B) { + parts.push("b-key"); + } + } + if self.gcs { + parts.push("gcs"); + } + write!(f, "{}", parts.join(",")) + } +} + +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialOrd, PartialEq, Encodable, BlobDecodable)] pub enum PointerAuthOption { // See and Clang's command line reference: // @@ -1626,6 +1650,7 @@ pub enum PointerAuthOption { VTPtrTypeDisc, // tidy-alphabetical-end } + impl PointerAuthOption { pub fn parse(s: &str) -> Option { match s { @@ -1647,6 +1672,28 @@ impl PointerAuthOption { } } +impl fmt::Display for PointerAuthOption { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Aarch64JumpTableHardening => write!(f, "aarch64-jump-table-hardening"), + Self::AuthTraps => write!(f, "auth-traps"), + Self::Calls => write!(f, "calls"), + Self::ElfGot => write!(f, "elf-got"), + Self::FunctionPointerTypeDiscrimination => { + write!(f, "function-pointer-type-discrimination") + } + Self::IndirectGotos => write!(f, "indirect-gotos"), + Self::InitFini => write!(f, "init-fini"), + Self::InitFiniAddressDiscrimination => write!(f, "init-fini-address-discrimination"), + Self::Intrinsics => write!(f, "intrinsics"), + Self::ReturnAddresses => write!(f, "return-addresses"), + Self::TypeInfoVTPtrDisc => write!(f, "typeinfo-vt-ptr-discrimination"), + Self::VTPtrAddrDisc => write!(f, "vt-ptr-addr-discrimination"), + Self::VTPtrTypeDisc => write!(f, "vt-ptr-type-discrimination"), + } + } +} + pub fn build_configuration(sess: &Session, mut user_cfg: Cfg) -> Cfg { // First disallow some configuration given on the command line cfg::disallow_cfgs(sess, &user_cfg); @@ -1900,6 +1947,14 @@ pub fn rustc_optgroups() -> Vec { "", ), opt(Stable, Multi, "C", "codegen", "Set a codegen option", "[=]"), + opt( + Stable, + Multi, + "T", + "target-modifier", + "Set a target modifier option", + "[=]", + ), opt(Stable, Flag, "V", "version", "Print version info and exit", ""), opt(Stable, Flag, "v", "verbose", "Use verbose output", ""), ]; @@ -2527,7 +2582,6 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M .unwrap_or_else(|e| early_dcx.early_fatal(e)); let mut collected_options = Default::default(); - let mut unstable_opts = UnstableOptions::build(early_dcx, matches, &mut collected_options); if unstable_opts.staticlib_hide_internal_symbols && !crate_types.contains(&CrateType::StaticLib) @@ -2561,6 +2615,11 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M let output_types = parse_output_types(early_dcx, &unstable_opts, matches); let mut cg = CodegenOptions::build(early_dcx, matches, &mut collected_options); + CodegenOptions::require_unstable_options( + early_dcx, + &collected_options, + unstable_opts.unstable_options, + ); let (disable_local_thinlto, codegen_units) = should_override_cgus_and_disable_thinlto( early_dcx, &output_types, @@ -2705,12 +2764,8 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M let prints = print_request::collect_print_requests(early_dcx, &mut cg, &unstable_opts, matches); // -Zretpoline-external-thunk also requires -Zretpoline - if unstable_opts.retpoline_external_thunk { - unstable_opts.retpoline = true; - collected_options.target_modifiers.insert( - OptionsTargetModifiers::UnstableOptions(UnstableOptionsTargetModifiers::Retpoline), - "true".to_string(), - ); + if cg.retpoline_external_thunk { + cg.retpoline = true; } let cg = cg; @@ -2870,8 +2925,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M color, logical_env, verbose, - target_modifiers: collected_options.target_modifiers, - mitigation_coverage_map: collected_options.mitigations, + collected_options, } } diff --git a/compiler/rustc_session/src/diagnostics.rs b/compiler/rustc_session/src/diagnostics.rs index 9efc4bc4a1df8..3ee9c9b4d5199 100644 --- a/compiler/rustc_session/src/diagnostics.rs +++ b/compiler/rustc_session/src/diagnostics.rs @@ -299,9 +299,13 @@ pub(crate) struct SanitizersNotSupported { } #[derive(Diagnostic)] -#[diag("`-Zsanitizer={$first}` is incompatible with `-Zsanitizer={$second}`")] +#[diag( + "`-{$first_prefix}sanitizer={$first}` is incompatible with `-{$second_prefix}sanitizer={$second}`" +)] pub(crate) struct CannotMixAndMatchSanitizers { + pub(crate) first_prefix: &'static str, pub(crate) first: String, + pub(crate) second_prefix: &'static str, pub(crate) second: String, } @@ -318,31 +322,31 @@ pub(crate) struct CannotEnableCrtStaticLinux; pub(crate) struct CannotEnableCrtStaticPointerAuth; #[derive(Diagnostic)] -#[diag("`-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto`")] +#[diag("`-Tsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto`")] pub(crate) struct SanitizerCfiRequiresLto; #[derive(Diagnostic)] -#[diag("`-Zsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1`")] +#[diag("`-Tsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1`")] pub(crate) struct SanitizerCfiRequiresSingleCodegenUnit; #[derive(Diagnostic)] -#[diag("`-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi`")] +#[diag("`-Zsanitizer-cfi-canonical-jump-tables` requires `-Tsanitizer=cfi`")] pub(crate) struct SanitizerCfiCanonicalJumpTablesRequiresCfi; #[derive(Diagnostic)] -#[diag("`-Zsanitizer-cfi-generalize-pointers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi`")] +#[diag("`-Zsanitizer-cfi-generalize-pointers` requires `-Tsanitizer=cfi` or `-Tsanitizer=kcfi`")] pub(crate) struct SanitizerCfiGeneralizePointersRequiresCfi; #[derive(Diagnostic)] -#[diag("`-Zsanitizer-cfi-normalize-integers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi`")] +#[diag("`-Tsanitizer-cfi-normalize-integers` requires `-Tsanitizer=cfi` or `-Tsanitizer=kcfi`")] pub(crate) struct SanitizerCfiNormalizeIntegersRequiresCfi; #[derive(Diagnostic)] -#[diag("`-Zsanitizer-kcfi-arity` requires `-Zsanitizer=kcfi`")] +#[diag("`-Zsanitizer-kcfi-arity` requires `-Tsanitizer=kcfi`")] pub(crate) struct SanitizerKcfiArityRequiresKcfi; #[derive(Diagnostic)] -#[diag("`-Z sanitizer=kcfi` requires `-C panic=abort`")] +#[diag("`-Tsanitizer=kcfi` requires `-C panic=abort`")] pub(crate) struct SanitizerKcfiRequiresPanicAbort; #[derive(Diagnostic)] @@ -389,7 +393,7 @@ pub(crate) struct PointerAuthenticationTypeDiscriminationNotSupportedForTarget<' #[derive(Diagnostic)] #[diag( - "`-Z pointer-authentication` is not supported for target {$target_triple} and will be ignored" + "`-T pointer-authentication` is not supported for target {$target_triple} and will be ignored" )] pub(crate) struct PointerAuthenticationNotSupportedForTarget<'a> { pub(crate) target_triple: &'a TargetTuple, @@ -404,7 +408,7 @@ pub(crate) struct SmallDataThresholdNotSupportedForTarget<'a> { } #[derive(Diagnostic)] -#[diag("`-Zbranch-protection` is only supported on aarch64")] +#[diag("`-Tbranch-protection` is only supported on aarch64")] pub(crate) struct BranchProtectionRequiresAArch64; #[derive(Diagnostic)] @@ -685,21 +689,21 @@ pub(crate) struct FunctionReturnRequiresX86OrX8664; pub(crate) struct FunctionReturnThunkExternRequiresNonLargeCodeModel; #[derive(Diagnostic)] -#[diag("`-Zindirect-branch-cs-prefix` is only supported on x86 and x86_64")] +#[diag("`-Tindirect-branch-cs-prefix` is only supported on x86 and x86_64")] pub(crate) struct IndirectBranchCsPrefixRequiresX86OrX8664; #[derive(Diagnostic)] -#[diag("`-Zregparm={$regparm}` is unsupported (valid values 0-3)")] +#[diag("`-Tregparm={$regparm}` is unsupported (valid values 0-3)")] pub(crate) struct UnsupportedRegparm { pub(crate) regparm: u32, } #[derive(Diagnostic)] -#[diag("`-Zregparm=N` is only supported on x86")] +#[diag("`-Tregparm=N` is only supported on x86")] pub(crate) struct UnsupportedRegparmArch; #[derive(Diagnostic)] -#[diag("`-Zreg-struct-return` is only supported on x86")] +#[diag("`-Treg-struct-return` is only supported on x86")] pub(crate) struct UnsupportedRegStructReturnArch; #[derive(Diagnostic)] @@ -739,3 +743,89 @@ pub(crate) struct NativeTargetCpuNotAllowed<'a> { pub(crate) target_triple: &'a TargetTuple, pub(crate) need_explicit_cpu: bool, } + +#[derive(Diagnostic)] +#[diag( + "mixing `-{$target_modifier_prefix}{$flag_name}` will cause an ABI mismatch in crate `{$local_crate}`" +)] +#[help( + "the `-{$target_modifier_prefix}{$flag_name}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely" +)] +#[note( + "`-{$target_modifier_prefix}{$flag_name}{$local_value}` in this crate is incompatible with `-{$target_modifier_prefix}{$flag_name}{$extern_value}` in dependency `{$extern_crate}`" +)] +#[help( + "set `-{$target_modifier_prefix}{$flag_name}{$extern_value}` in this crate or `-{$target_modifier_prefix}{$flag_name}{$local_value}` in `{$extern_crate}`" +)] +#[help( + "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error" +)] +pub(crate) struct IncompatibleFlagsMismatched { + #[primary_span] + pub span: Span, + pub extern_crate: Symbol, + pub local_crate: Symbol, + pub prefix: &'static str, + pub target_modifier_prefix: &'static str, + pub flag_name: String, + pub local_value: String, + pub extern_value: String, +} + +#[derive(Diagnostic)] +#[diag( + "mixing `-{$target_modifier_prefix}{$flag_name}` will cause an ABI mismatch in crate `{$local_crate}`" +)] +#[help( + "the `-{$target_modifier_prefix}{$flag_name}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely" +)] +#[note( + "unset `-{$target_modifier_prefix}{$flag_name}` in this crate is incompatible with `-{$target_modifier_prefix}{$flag_name}{$extern_value}` in dependency `{$extern_crate}`" +)] +#[help( + "set `-{$target_modifier_prefix}{$flag_name}{$extern_value}` in this crate, unset `-{$target_modifier_prefix}{$flag_name}` in `{$extern_crate}`, or use `-{$prefix}{$flag_name}` in `{$extern_crate}`" +)] +#[help( + "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error" +)] +pub(crate) struct IncompatibleFlagsUnsetLocally { + #[primary_span] + pub span: Span, + pub extern_crate: Symbol, + pub local_crate: Symbol, + pub prefix: &'static str, + pub target_modifier_prefix: &'static str, + pub flag_name: String, + pub extern_value: String, +} + +#[derive(Diagnostic)] +#[diag( + "mixing `-{$target_modifier_prefix}{$flag_name}` will cause an ABI mismatch in crate `{$local_crate}`" +)] +#[help( + "the `-{$target_modifier_prefix}{$flag_name}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely" +)] +#[note( + "unset `-{$target_modifier_prefix}{$flag_name}` in `{$extern_crate}` is incompatible with `-{$target_modifier_prefix}{$flag_name}{$local_value}` in this crate" +)] +#[help( + "set `-{$target_modifier_prefix}{$flag_name}{$local_value}` in `{$extern_crate}`, unset `-{$target_modifier_prefix}{$flag_name}` in this crate, or use `-{$prefix}{$flag_name}` in this crate instead" +)] +#[help( + "if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error" +)] +pub(crate) struct IncompatibleFlagsUnsetExternally { + #[primary_span] + pub span: Span, + pub extern_crate: Symbol, + pub local_crate: Symbol, + pub prefix: &'static str, + pub target_modifier_prefix: &'static str, + pub flag_name: String, + pub local_value: String, +} + +#[derive(Diagnostic)] +#[diag("`target-cpu` must be set with `-Ttarget-cpu` for this target")] +pub(crate) struct TargetCpuNeedsTargetModifierOpt; diff --git a/compiler/rustc_session/src/lib.rs b/compiler/rustc_session/src/lib.rs index 94566c943d7ed..8ee761f577e25 100644 --- a/compiler/rustc_session/src/lib.rs +++ b/compiler/rustc_session/src/lib.rs @@ -5,7 +5,6 @@ #![feature(default_field_values)] #![feature(iter_intersperse)] #![feature(macro_derive)] -#![feature(macro_metavar_expr)] #![feature(option_into_flat_iter)] #![feature(rustc_attrs)] // To generate CodegenOptionsTargetModifiers and UnstableOptionsTargetModifiers enums diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 5b71c0435185a..e1215272b8e11 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1,11 +1,11 @@ use std::collections::BTreeMap; use std::num::{IntErrorKind, NonZero}; use std::path::PathBuf; -use std::str; +use std::{fmt, str}; use rustc_abi::Align; use rustc_ast::attr::version::RustcVersion; -use rustc_data_structures::fx::FxIndexMap; +use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap}; use rustc_data_structures::profiling::TimePassesFormat; use rustc_data_structures::stable_hash::StableHasher; use rustc_errors::{ColorConfig, TerminalUrl}; @@ -25,7 +25,7 @@ use rustc_target::spec::{ use crate::config::*; use crate::search_paths::SearchPath; use crate::utils::NativeLib; -use crate::{EarlyDiagCtxt, Session, lint}; +use crate::{EarlyDiagCtxt, lint}; macro_rules! insert { ($opt_name:ident, $opt_expr:expr, $sub_hashes:expr) => { @@ -41,6 +41,7 @@ macro_rules! insert { macro_rules! hash_opt { ($opt_name:ident, $opt_expr:expr, $sub_hashes:expr, $_for_crate_hash: ident, [UNTRACKED]) => {{}}; ($opt_name:ident, $opt_expr:expr, $sub_hashes:expr, $_for_crate_hash: ident, [TRACKED]) => {{ insert!($opt_name, $opt_expr, $sub_hashes) }}; + ($opt_name:ident, $opt_expr:expr, $sub_hashes:expr, $_for_crate_hash: ident, [TRACKED_UNSTABLE]) => {{ insert!($opt_name, $opt_expr, $sub_hashes) }}; ($opt_name:ident, $opt_expr:expr, $sub_hashes:expr, $for_crate_hash: ident, [TRACKED_NO_CRATE_HASH]) => {{ if !$for_crate_hash { insert!($opt_name, $opt_expr, $sub_hashes) @@ -52,6 +53,7 @@ macro_rules! hash_opt { macro_rules! hash_substruct { ($opt_name:ident, $opt_expr:expr, $error_format:expr, $for_crate_hash:expr, $hasher:expr, [UNTRACKED]) => {{}}; ($opt_name:ident, $opt_expr:expr, $error_format:expr, $for_crate_hash:expr, $hasher:expr, [TRACKED]) => {{}}; + ($opt_name:ident, $opt_expr:expr, $error_format:expr, $for_crate_hash:expr, $hasher:expr, [TRACKED_UNSTABLE]) => {{}}; ($opt_name:ident, $opt_expr:expr, $error_format:expr, $for_crate_hash:expr, $hasher:expr, [TRACKED_NO_CRATE_HASH]) => {{}}; ($opt_name:ident, $opt_expr:expr, $error_format:expr, $for_crate_hash:expr, $hasher:expr, [SUBSTRUCT]) => {{ use crate::config::dep_tracking::DepTrackingHash; @@ -63,141 +65,8 @@ macro_rules! hash_substruct { }}; } -/// Extended target modifier info. -/// For example, when external target modifier is '-Zregparm=2': -/// Target modifier enum value + user value ('2') from external crate -/// is converted into description: prefix ('Z'), name ('regparm'), tech value ('Some(2)'). -pub struct ExtendedTargetModifierInfo { - /// Flag prefix (usually, 'C' for codegen flags or 'Z' for unstable flags) - pub prefix: String, - /// Flag name - pub name: String, - /// Flag parsed technical value - pub tech_value: String, -} - -/// A recorded -Zopt_name=opt_value (or -Copt_name=opt_value) -/// which alter the ABI or effectiveness of exploit mitigations. -#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Encodable, BlobDecodable)] -pub struct TargetModifier { - /// Option enum value - pub opt: OptionsTargetModifiers, - /// User-provided option value (before parsing) - pub value_name: String, -} - pub mod mitigation_coverage; -mod target_modifier_consistency_check { - use super::*; - pub(super) fn sanitizer(l: &TargetModifier, r: Option<&TargetModifier>) -> bool { - let mut lparsed: SanitizerSet = Default::default(); - let lval = if l.value_name.is_empty() { None } else { Some(l.value_name.as_str()) }; - parse::parse_sanitizers(&mut lparsed, lval); - - let mut rparsed: SanitizerSet = Default::default(); - let rval = r.filter(|v| !v.value_name.is_empty()).map(|v| v.value_name.as_str()); - parse::parse_sanitizers(&mut rparsed, rval); - - // Some sanitizers need to be target modifiers, and some do not. - // For now, we should mark all sanitizers as target modifiers except for these: - // AddressSanitizer, LeakSanitizer - let tmod_sanitizers = SanitizerSet::MEMORY - | SanitizerSet::THREAD - | SanitizerSet::HWADDRESS - | SanitizerSet::CFI - | SanitizerSet::MEMTAG - | SanitizerSet::SHADOWCALLSTACK - | SanitizerSet::KCFI - | SanitizerSet::KERNELADDRESS - | SanitizerSet::KERNELHWADDRESS - | SanitizerSet::SAFESTACK - | SanitizerSet::DATAFLOW; - - lparsed & tmod_sanitizers == rparsed & tmod_sanitizers - } - pub(super) fn sanitizer_cfi_normalize_integers( - sess: &Session, - l: &TargetModifier, - r: Option<&TargetModifier>, - ) -> bool { - // For kCFI, the helper flag -Zsanitizer-cfi-normalize-integers should also be a target modifier - if sess.sanitizers().contains(SanitizerSet::KCFI) { - if let Some(r) = r { - return l.extend().tech_value == r.extend().tech_value; - } else { - return false; - } - } - true - } - pub(super) fn target_cpu( - sess: &Session, - l: &TargetModifier, - r: Option<&TargetModifier>, - ) -> bool { - if !sess.target.requires_consistent_cpu { - return true; - } - let l_tech_value = l.extend().tech_value; - let r_tech_value = match r { - Some(r) => r.extend().tech_value, - // If only one of the two compared crates specifies the CPU - // explicitly we compare against the target's default CPU. - None => { - // We reuse the same parsing logic. - CodegenOptionsTargetModifiers::TargetCpu - .reparse(sess.target.cpu.as_ref()) - .tech_value - } - }; - l_tech_value == r_tech_value - } -} - -impl TargetModifier { - pub fn extend(&self) -> ExtendedTargetModifierInfo { - self.opt.reparse(&self.value_name) - } - // Custom consistency check for target modifiers (or default `l.tech_value == r.tech_value`) - // When other is None, consistency with default value is checked - pub fn consistent(&self, sess: &Session, other: Option<&TargetModifier>) -> bool { - assert!(other.is_none() || self.opt == other.unwrap().opt); - match self.opt { - OptionsTargetModifiers::UnstableOptions(unstable) => match unstable { - UnstableOptionsTargetModifiers::Sanitizer => { - return target_modifier_consistency_check::sanitizer(self, other); - } - UnstableOptionsTargetModifiers::SanitizerCfiNormalizeIntegers => { - return target_modifier_consistency_check::sanitizer_cfi_normalize_integers( - sess, self, other, - ); - } - _ => {} - }, - OptionsTargetModifiers::CodegenOptions(codegen) => match codegen { - CodegenOptionsTargetModifiers::TargetCpu => { - return target_modifier_consistency_check::target_cpu(sess, self, other); - } - }, - }; - match other { - Some(other) => self.extend().tech_value == other.extend().tech_value, - None => false, - } - } -} - -fn tmod_push_impl( - opt: OptionsTargetModifiers, - tmod_vals: &BTreeMap, - tmods: &mut Vec, -) { - if let Some(v) = tmod_vals.get(&opt) { - tmods.push(TargetModifier { opt, value_name: v.clone() }) - } -} - macro_rules! top_level_options { ( $(#[$top_level_attr:meta])* @@ -206,45 +75,10 @@ macro_rules! top_level_options { $(#[$attr:meta])* $opt:ident : $t:ty [$dep_tracking_marker:ident] - $( { TARGET_MODIFIER: $tmod_variant:ident($tmod_enum:ident) } )? , )* } ) => { - #[derive(PartialEq, Eq, PartialOrd, Ord, Debug, Copy, Clone, Encodable, BlobDecodable)] - pub enum OptionsTargetModifiers { - $( - $( - $tmod_variant($tmod_enum), - )? - )* - } - - impl OptionsTargetModifiers { - pub fn reparse(&self, user_value: &str) -> ExtendedTargetModifierInfo { - match self { - $( - $( - Self::$tmod_variant(v) => v.reparse(user_value), - )? - )* - #[allow(unreachable_patterns)] - _ => panic!("unknown target modifier option: {self:?}"), - } - } - - pub fn is_target_modifier(flag_name: &str) -> bool { - $( - $( - if $tmod_enum::is_target_modifier(flag_name) { - return true - } - )? - )* - false - } - } - #[derive(Clone)] $(#[$top_level_attr])* pub struct Options { @@ -252,8 +86,7 @@ macro_rules! top_level_options { $(#[$attr])* pub $opt: $t, )* - pub target_modifiers: BTreeMap, - pub mitigation_coverage_map: mitigation_coverage::MitigationCoverageMap, + pub collected_options: CollectedOptions, } impl Options { @@ -287,19 +120,6 @@ macro_rules! top_level_options { )* hasher.finish() } - - pub fn gather_target_modifiers(&self) -> Vec { - let mut mods = Vec::::new(); - $( - $( - // Only expand for flags that have `TARGET_MODIFIER`. - ${ignore($tmod_enum)} - self.$opt.gather_target_modifiers(&mut mods, &self.target_modifiers); - )? - )* - mods.sort_by(|a, b| a.opt.cmp(&b.opt)); - mods - } } } } @@ -361,9 +181,9 @@ top_level_options!( /// directory to store intermediate results. incremental: Option [UNTRACKED], - unstable_opts: UnstableOptions [SUBSTRUCT] { TARGET_MODIFIER: UnstableOptions(UnstableOptionsTargetModifiers) }, + unstable_opts: UnstableOptions [SUBSTRUCT], prints: Vec [UNTRACKED], - cg: CodegenOptions [SUBSTRUCT] { TARGET_MODIFIER: CodegenOptions(CodegenOptionsTargetModifiers) }, + cg: CodegenOptions [SUBSTRUCT], externs: Externs [UNTRACKED], crate_name: Option [TRACKED], /// Indicates how the compiler should treat unstable features. @@ -440,43 +260,224 @@ top_level_options!( } ); -#[derive(Default)] +/// Enum of types that command-line options can take - eventually stored into cross-crate metadata +/// instead of a `Box`. +#[derive(BlobDecodable, Clone, Encodable, PartialEq)] +pub enum TargetModifierValue { + Bool(bool), + U32(u32), + Usize(usize), + String(String), + BranchProtection(BranchProtection), + Sanitizers(SanitizerSet), + PointerAuthentication(Vec<(PointerAuthOption, bool)>), +} + +impl fmt::Display for TargetModifierValue { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Bool(_) => write!(f, ""), + Self::U32(val) => write!(f, "={val}"), + Self::Usize(val) => write!(f, "={val}"), + Self::String(val) => write!(f, "={val}"), + Self::BranchProtection(val) => write!(f, "={val}"), + Self::Sanitizers(val) => write!(f, "={val}"), + Self::PointerAuthentication(vals) => { + let mut parts = Vec::new(); + for (opt, pos) in vals { + let polarity = if *pos { "+" } else { "-" }; + parts.push(format!("{polarity}{opt}")); + } + write!(f, "={}", parts.join(",")) + } + } + } +} + +macro_rules! noop_target_modifier_ty { + ($($ty:ty => $ctor:expr,)+) => { + $( + impl From<$ty> for TargetModifierValue { + fn from(value: $ty) -> Self { + $ctor(value) + } + } + )+ + } +} + +noop_target_modifier_ty!( + // tidy-alphabetical-start + SanitizerSet => Self::Sanitizers, + String => Self::String, + Vec<(PointerAuthOption, bool)> => Self::PointerAuthentication, + bool => Self::Bool, + u32 => Self::U32, + usize => Self::Usize, + // tidy-alphabetical-end +); + +macro_rules! opt_or_default_target_modifier_ty { + ($($ty:ty => $ctor:expr,)+) => { + $( + impl From> for TargetModifierValue { + fn from(value: Option<$ty>) -> Self { + $ctor(value.unwrap_or_default()) + } + } + )+ + } +} + +opt_or_default_target_modifier_ty!( + // tidy-alphabetical-start + BranchProtection => Self::BranchProtection, + String => Self::String, + bool => Self::Bool, + u32 => Self::U32, + usize => Self::Usize, + // tidy-alphabetical-end +); + +macro_rules! unsupported_target_modifier_ty { + ($($ty:ty,)*) => { + $( + impl From<$ty> for TargetModifierValue { + fn from(_: $ty) -> Self { + unimplemented!("type not supported for a target modifier: {}", stringify!($ty)) + } + } + )+ + } +} + +unsupported_target_modifier_ty!( + // tidy-alphabetical-start + (), + AnnotateMoves, + CFGuard, + CFProtection, + CollapseMacroDebuginfo, + CoverageOptions, + DebugInfo, + DebugInfoCompression, + DumpMonoStatsFormat, + FmtDebug, + FramePointer, + FunctionReturn, + InliningThreshold, + InstrumentCoverage, + InstrumentMcount, + LinkSelfContained, + LinkerFeaturesCli, + LinkerPluginLto, + LocationDetail, + LtoCli, + MirIncludeSpans, + MirStripDebugInfo, + NextSolverConfig, + OnBrokenPipe, + Option, + Option, + Option, + Option, + Option, + Option, + Option, + Option>, + Option, + Option, + Option, + Option, + Option, + Option, + Option, + Option, + Option, + Option, + Option>, + Option, + Option, + PanicStrategy, + Passes, + PatchableFunctionEntry, + Polonius, + ProcMacroExecutionStrategy, + SplitDwarfKind, + StackProtector, + Strip, + SwitchWithOptPath, + TerminalUrl, + TimePassesFormat, + Vec<(String, bool)>, + Vec<(String, u32, String)>, + Vec, + Vec, + Vec, + // tidy-alphabetical-end +); + +#[derive(Clone, Default)] +pub struct CollectedTargetModifiers { + pub codegen: FxHashMap, + pub unstable: FxHashMap, +} + +#[derive(Clone, Default)] +pub struct CollectedIsSet { + pub codegen: FxHashSet, + pub unstable: FxHashSet, +} + +#[derive(Clone, Default)] pub struct CollectedOptions { - pub target_modifiers: BTreeMap, pub mitigations: mitigation_coverage::MitigationCoverageMap, + pub is_set: CollectedIsSet, + pub target_modifiers: CollectedTargetModifiers, } macro_rules! setter_for { // the allow/deny-mitigations options use collected/index instead of the cg, since they // work across option groups - (allow_partial_mitigations, $struct_name:ident, $parse:ident) => { + (allow_partial_mitigations, $struct_name:ident, $group_name:ident, $key_name:ident, $parse:ident) => { pub(super) fn allow_partial_mitigations( _cg: &mut super::$struct_name, collected: &mut super::CollectedOptions, v: Option<&str>, index: usize, + _: bool, ) -> bool { collected.mitigations.handle_allowdeny_mitigation_option(v, index, true) } }; - (deny_partial_mitigations, $struct_name:ident, $parse:ident) => { + (deny_partial_mitigations, $struct_name:ident, $group_name:ident, $key_name:ident, $parse:ident) => { pub(super) fn deny_partial_mitigations( _cg: &mut super::$struct_name, collected: &mut super::CollectedOptions, v: Option<&str>, index: usize, + _: bool, ) -> bool { collected.mitigations.handle_allowdeny_mitigation_option(v, index, false) } }; - ($opt:ident, $struct_name:ident, $parse:ident) => { + ($opt:ident, $struct_name:ident, $group_name:ident, $key_name:ident, $parse:ident) => { pub(super) fn $opt( cg: &mut super::$struct_name, - _collected: &mut super::CollectedOptions, + collected: &mut super::CollectedOptions, v: Option<&str>, _index: usize, + is_target_modifier: bool, ) -> bool { - super::parse::$parse(&mut redirect_field!(cg.$opt), v) + collected.is_set.$group_name.insert(super::$key_name::$opt); + let res = super::parse::$parse(&mut redirect_field!(cg.$opt), v, is_target_modifier); + if is_target_modifier { + let _ = collected + .target_modifiers + .$group_name + .insert(super::$key_name::$opt, redirect_field!(cg.$opt).clone().into()); + } + res } }; } @@ -491,12 +492,14 @@ macro_rules! setter_for { /// hand-written parsers for parsing specific types of values in this module. macro_rules! options { ( - $struct_name:ident, - $tmod_enum:ident, - $stat:ident, - $optmod:ident, - $prefix:expr, - $outputname:expr, + $(#[$struct_attr:meta])* + $struct_name:ident, // e.g. `UnstableOptions` + $key_name: ident, // e.g. `UnstableOptionsKey` + $opt_descs_var:ident, // e.g. `Z_OPTIONS` + $opt_mod_name:ident, // e.g. `dbopts` + $prefix:expr, // e.g. `-Z` + $target_modifier_prefix:expr, // e.g. `Some("-T")` or `None` + $group_name:ident, // e.g. `unstable` $( $(#[$attr:meta])* @@ -504,14 +507,15 @@ macro_rules! options { $init:expr, $parse:ident, [$dep_tracking_marker:ident] - $( { TARGET_MODIFIER: $tmod_variant:ident } )? $( { MITIGATION: $mitigation_variant:ident } )? + $( { TARGET_MODIFIER: $target_modifier_filter:ident } )? , $desc:literal $(, removed: $removed:ident )? ), )* ) => { + $(#[$struct_attr])* #[derive(Clone)] #[rustc_lint_opt_ty] pub struct $struct_name { @@ -521,46 +525,21 @@ macro_rules! options { )* } - #[derive(PartialEq, Eq, PartialOrd, Ord, Debug, Copy, Clone, Encodable, BlobDecodable)] - pub enum $tmod_enum { + #[allow(nonstandard_style)] + #[derive(BlobDecodable, Copy, Clone, Eq, Encodable, Hash, PartialEq, PartialOrd, Ord)] + #[repr(u32)] + pub enum $key_name { $( - $( $tmod_variant, )? + $opt, )* } - impl $tmod_enum { - pub fn reparse(&self, _user_value: &str) -> ExtendedTargetModifierInfo { + impl fmt::Display for $key_name { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { $( - $( - Self::$tmod_variant => { - let mut parsed: $t = Default::default(); - let val = if _user_value.is_empty() { None } else { Some(_user_value) }; - parse::$parse(&mut parsed, val); - ExtendedTargetModifierInfo { - prefix: $prefix.to_string(), - name: stringify!($opt).to_string().replace('_', "-"), - tech_value: format!("{:?}", parsed), - } - } - )? - )* - - #[allow(unreachable_patterns)] - _ => panic!("unknown target modifier option: {:?}", *self) - } - } - - pub fn is_target_modifier(flag_name: &str) -> bool { - match flag_name.replace('-', "_").as_str() { - $( - $( - // Only expand for flags that have `TARGET_MODIFIER`. - ${ignore($tmod_variant)} - stringify!($opt) => true, - )? - )* - _ => false, + Self::$opt => write!(f, "{}", stringify!($opt).replace('_', "-")) + ),* } } } @@ -579,9 +558,17 @@ macro_rules! options { pub fn build( early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches, - target_modifiers: &mut CollectedOptions, + collected_options: &mut CollectedOptions, ) -> $struct_name { - build_options(early_dcx, matches, target_modifiers, $stat, $prefix, $outputname) + build_options( + early_dcx, + matches, + collected_options, + $opt_descs_var, + $prefix, + $target_modifier_prefix, + stringify!($group_name) + ) } fn dep_tracking_hash( @@ -609,36 +596,102 @@ macro_rules! options { hasher.finish() } - pub fn gather_target_modifiers( - &self, - _mods: &mut Vec, - _tmod_vals: &BTreeMap, + pub fn require_unstable_options( + _early_dcx: &EarlyDiagCtxt, + _collected_options: &CollectedOptions, + _unstable_opts: bool ) { $( - $( - if self.$opt != $init { - tmod_push_impl( - OptionsTargetModifiers::$struct_name($tmod_enum::$tmod_variant), - _tmod_vals, - _mods, - ); + require_unstable_options!( + $opt, + $group_name, + $key_name, + [$dep_tracking_marker], + (_early_dcx, _collected_options, _unstable_opts) + ); + )* + } + + pub fn is_target_modifier(&self, flag_name: &str) -> bool { + let flag_name = flag_name.replace('-', "_").to_string(); + match $opt_descs_var.iter().find(|opt_desc| opt_desc.name == flag_name) { + Some(OptionDesc { target_modifier_filter: Some(TargetModifierFilter::Never), .. }) => false, + Some(_) => true, + None => false, + } + } + + pub fn report_mismatched_flags_with_dep( + &self, + sess: &crate::Session, + span: rustc_span::Span, + local_crate: rustc_span::Symbol, + extern_opts: CollectedTargetModifiers, + extern_crate: rustc_span::Symbol + ) { + let allowed_flag_mismatches = &sess.opts.cg.unsafe_allow_abi_mismatch; + let compare = |local_value: Option<&TargetModifierValue>, extern_value: Option<&TargetModifierValue>, flag_name| { + match (local_value, extern_value) { + (Some(local_value), Some(extern_value)) if local_value != extern_value => { + sess.dcx().emit_err(crate::diagnostics::IncompatibleFlagsMismatched { + span, + local_crate, + extern_crate, + prefix: $prefix, + target_modifier_prefix: $target_modifier_prefix.expect("mismatch w/out prefix"), + flag_name, + local_value: local_value.to_string(), + extern_value: extern_value.to_string(), + }); + }, + (None, Some(extern_value)) => { + sess.dcx().emit_err(crate::diagnostics::IncompatibleFlagsUnsetLocally { + span, + local_crate, + extern_crate, + prefix: $prefix, + target_modifier_prefix: $target_modifier_prefix.expect("mismatch w/out prefix"), + flag_name, + extern_value: extern_value.to_string(), + }); + }, + (Some(local_value), None) => { + sess.dcx().emit_err(crate::diagnostics::IncompatibleFlagsUnsetExternally { + span, + local_crate, + extern_crate, + prefix: $prefix, + target_modifier_prefix: $target_modifier_prefix.expect("mismatch w/out prefix"), + flag_name, + local_value: local_value.to_string(), + }); + }, + (Some(_), Some(_)) => { /* no-op, matching flag values */ } + (None, None) => { /* no-op, neither flag is passed as a target modifier */ } } - )? + }; + + $( + let flag_name = stringify!($opt).replace('_', "-").to_string(); + let allowed = allowed_flag_mismatches.contains(&flag_name); + if !allowed { + let local_value = sess.opts.collected_options.target_modifiers.$group_name.get(&$key_name::$opt); + let extern_value = extern_opts.$group_name.get(&$key_name::$opt); + compare(local_value, extern_value, flag_name); + } )* } } - pub const $stat: OptionDescrs<$struct_name> = &[ + pub const $opt_descs_var: OptionDescrs<$struct_name> = &[ $( OptionDesc { name: stringify!($opt), - setter: $optmod::$opt, + setter: $opt_mod_name::$opt, type_desc: desc::$parse, desc: $desc, removed: None $( .or(Some(RemovedOption::$removed)) )?, - tmod: None $( .or(Some( - OptionsTargetModifiers::$struct_name($tmod_enum::$tmod_variant) - )))?, + target_modifier_filter: None $( .or(Some(TargetModifierFilter::$target_modifier_filter)) )?, mitigation: None $( .or(Some( mitigation_coverage::DeniedPartialMitigationKind::$mitigation_variant )))?, @@ -646,14 +699,33 @@ macro_rules! options { )* ]; - mod $optmod { + mod $opt_mod_name { $( - setter_for!($opt, $struct_name, $parse); + setter_for!($opt, $struct_name, $group_name, $key_name, $parse); )* } } } +macro_rules! require_unstable_options { + ($opt:ident, $group_name:ident, $key_name:ident, [UNTRACKED], + ($early_dcx:ident, $collected_options:ident, $unstable_opts:ident)) => {{}}; + ($opt:ident, $group_name:ident, $key_name:ident, [TRACKED], + ($early_dcx:ident, $collected_options:ident, $unstable_opts:ident)) => {{}}; + ($opt:ident, $group_name:ident, $key_name:ident, [TRACKED_UNSTABLE], + ($early_dcx:ident, $collected_options:ident, $unstable_opts:ident)) => {{ + if $collected_options.is_set.$group_name.contains(&$key_name::$opt) && !$unstable_opts { + $early_dcx + .early_err(format!("`-T{}` requires `-Zunstable-options`", stringify!($opt))) + .raise_fatal(); + } + }}; + ($opt:ident, $group_name:ident, $key_name:ident, [TRACKED_NO_CRATE_HASH], + ($early_dcx:ident, $collected_options:ident, $unstable_opts:ident)) => {{}}; + ($opt:ident, $group_name:ident, $key_name:ident, [SUBSTRUCT], + ($early_dcx:ident, $collected_options:ident, $unstable_opts:ident)) => {{}}; +} + impl CodegenOptions { // JUSTIFICATION: defn of the suggested wrapper fn #[allow(rustc::bad_opt_access)] @@ -676,7 +748,13 @@ macro_rules! redirect_field { }; } -type OptionSetter = fn(&mut O, &mut CollectedOptions, v: Option<&str>, pos: usize) -> bool; +type OptionSetter = fn( + &mut O, + &mut CollectedOptions, + v: Option<&str>, + pos: usize, + is_target_modifier: bool, +) -> bool; type OptionDescrs = &'static [OptionDesc]; /// Indicates whether a removed option should warn or error. @@ -686,6 +764,13 @@ enum RemovedOption { Err, } +enum TargetModifierFilter { + // Option cannot be passed as a target modifier + Never, + // Option can only be passed as a target modifier + Only, +} + pub struct OptionDesc { name: &'static str, setter: OptionSetter, @@ -694,7 +779,7 @@ pub struct OptionDesc { // description for option from options table desc: &'static str, removed: Option, - tmod: Option, + target_modifier_filter: Option, mitigation: Option, } @@ -714,93 +799,98 @@ fn build_options( collected_options: &mut CollectedOptions, descrs: OptionDescrs, prefix: &str, + target_modifier_prefix: Option<&str>, outputname: &str, ) -> O { let mut op = O::default(); - for (index, option) in matches.opt_strs_pos(prefix) { - let (key, value) = match option.split_once('=') { - None => (option, None), - Some((k, v)) => (k.to_string(), Some(v)), - }; + let mut build_with_prefix = |current_prefix: &str, is_target_modifier: bool| { + for (index, option) in matches.opt_strs_pos(current_prefix) { + let (key, value) = match option.split_once('=') { + None => (option, None), + Some((k, v)) => (k.to_string(), Some(v)), + }; - let option_to_lookup = key.replace('-', "_"); - match descrs.iter().find(|opt_desc| opt_desc.name == option_to_lookup) { - Some(OptionDesc { name: _, setter, type_desc, desc, removed, tmod, mitigation }) => { - if let Some(removed) = removed { - // deprecation works for prefixed options only - assert!(!prefix.is_empty()); - match removed { - RemovedOption::Warn => { - early_dcx.early_warn(format!("`-{prefix} {key}`: {desc}")) - } - RemovedOption::Err => { - early_dcx.early_fatal(format!("`-{prefix} {key}`: {desc}")) + let option_to_lookup = key.replace('-', "_"); + match descrs.iter().find(|opt_desc| opt_desc.name == option_to_lookup) { + Some(OptionDesc { + name: _, + setter, + type_desc, + desc, + removed, + mitigation, + target_modifier_filter, + }) => { + if let Some(removed) = removed { + // deprecation works for prefixed options only + assert!(!current_prefix.is_empty()); + match removed { + RemovedOption::Warn => { + early_dcx.early_warn(format!("`-{current_prefix} {key}`: {desc}")) + } + RemovedOption::Err => { + early_dcx.early_fatal(format!("`-{current_prefix} {key}`: {desc}")) + } } } - } - if !setter(&mut op, collected_options, value, index) { - match value { - None => early_dcx.early_fatal( - format!( - "{outputname} option `{key}` requires {type_desc} (`-{prefix} {key}=`)" + match target_modifier_filter { + Some(TargetModifierFilter::Only) if !is_target_modifier => { + early_dcx.early_fatal(format!("`-{current_prefix} {key}`: can only be passed with `-{}`", target_modifier_prefix.expect("option only allowed with target modifier but substruct does not have a target modifier variant"))) + }, + Some(TargetModifierFilter::Never) if is_target_modifier => { + early_dcx.early_fatal(format!("`-{current_prefix} {key}`: can only be passed with `-{}`", prefix)) + }, + _ => (), + } + if !setter(&mut op, collected_options, value, index, is_target_modifier) { + match value { + None => early_dcx.early_fatal( + format!( + "{outputname} option `{key}` requires {type_desc} (`-{current_prefix} {key}=`)" + ), ), - ), - Some(value) => early_dcx.early_fatal( - format!( - "incorrect value `{value}` for {outputname} option `{key}` - {type_desc} was expected" + Some(value) => early_dcx.early_fatal( + format!( + "incorrect value `{value}` for {outputname} option `{key}` - {type_desc} was expected" + ), ), - ), - } - } - if let Some(tmod) = *tmod { - let v = value.map_or(String::new(), ToOwned::to_owned); - - // Accumulate all the -Zsanitizer flags into a single target modifier. - match tmod { - OptionsTargetModifiers::UnstableOptions( - UnstableOptionsTargetModifiers::Sanitizer, - ) => { - collected_options - .target_modifiers - .entry(tmod) - .and_modify(|existing| { - existing.push(','); - existing.push_str(&v); - }) - .or_insert(v); - } - _ => { - collected_options.target_modifiers.insert(tmod, v); } } + if let Some(mitigation) = mitigation { + collected_options.mitigations.reset_mitigation(*mitigation, index); + } } - if let Some(mitigation) = mitigation { - collected_options.mitigations.reset_mitigation(*mitigation, index); - } - } - None => { - let mut error = - early_dcx.early_struct_fatal(format!("unknown {outputname} option: `{key}`")); - let max_dist = option_to_lookup.chars().count().max(3) / 3; - if let Some(option) = descrs - .iter() - .filter(|option| option.removed.is_none()) - .filter_map(|option| { - edit_distance(&option_to_lookup, option.name, max_dist) - .map(|dist| (dist, option)) - }) - .min_by_key(|(dist, _)| *dist) - .map(|(_, option)| option) - { - let name = option.name.replace('_', "-"); - let value = - if option.type_desc == desc::parse_no_value { "" } else { "=" }; - error.help(format!("you might have meant to use `-{prefix} {name}{value}`")); + None => { + let mut error = early_dcx + .early_struct_fatal(format!("unknown {outputname} option: `{key}`")); + let max_dist = option_to_lookup.chars().count().max(3) / 3; + if let Some(option) = descrs + .iter() + .filter(|option| option.removed.is_none()) + .filter_map(|option| { + edit_distance(&option_to_lookup, option.name, max_dist) + .map(|dist| (dist, option)) + }) + .min_by_key(|(dist, _)| *dist) + .map(|(_, option)| option) + { + let name = option.name.replace('_', "-"); + let value = + if option.type_desc == desc::parse_no_value { "" } else { "=" }; + error + .help(format!("you might have meant to use `-{prefix} {name}{value}`")); + } + error.emit() } - error.emit() } } + }; + + build_with_prefix(prefix, false); + if let Some(prefix) = target_modifier_prefix { + build_with_prefix(prefix, true); } + op } @@ -835,7 +925,8 @@ mod desc { pub(crate) const parse_patchable_function_entry: &str = "a comma separated list of (prefix_nops,total_nops,section_name), (prefix_nops,total_nops), or (total_nops). Where prefix_nops <= total_nops where 0 < total_nops <= 255 and prefix_nops <= total_nops"; pub(crate) const parse_opt_panic_strategy: &str = parse_panic_strategy; pub(crate) const parse_relro_level: &str = "one of: `full`, `partial`, or `off`"; - pub(crate) const parse_sanitizers: &str = "comma separated list of sanitizers: `address`, `cfi`, `dataflow`, `hwaddress`, `kcfi`, `kernel-address`, `kernel-hwaddress`, `leak`, `memory`, `memtag`, `safestack`, `shadow-call-stack`, `thread`, or 'realtime'"; + pub(crate) const parse_sanitizers: &str = "comma separated list of sanitizers: `address`, or `leak` with `-C`; and `cfi`, `dataflow`, `hwaddress`, `kcfi`, `kernel-address`, `kernel-hwaddress`, `leak`, `memory`, `memtag`, `safestack`, `shadow-call-stack`, `thread`, or 'realtime' with `-T`"; + pub(crate) const parse_sanitizers_unfiltered: &str = "comma separated list of sanitizers: `address`, `cfi`, `dataflow`, `hwaddress`, `leak`, `kcfi`, `kernel-address`, `kernel-hwaddress`, `leak`, `memory`, `memtag`, `safestack`, `shadow-call-stack`, `thread`, or 'realtime'"; pub(crate) const parse_sanitizer_memory_track_origins: &str = "0, 1, or 2"; pub(crate) const parse_cfguard: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), `checks`, or `nochecks`"; @@ -926,7 +1017,7 @@ pub mod parse { /// Ignore the value. Used for removed options where we don't actually want to store /// anything in the session. - pub(crate) fn parse_ignore(_slot: &mut (), _v: Option<&str>) -> bool { + pub(crate) fn parse_ignore(_slot: &mut (), _v: Option<&str>, _: bool) -> bool { true } @@ -935,7 +1026,7 @@ pub mod parse { /// /// This style of option is deprecated, and is mainly used by old options /// beginning with `no-`. - pub(crate) fn parse_no_value(slot: &mut bool, v: Option<&str>) -> bool { + pub(crate) fn parse_no_value(slot: &mut bool, v: Option<&str>, _: bool) -> bool { match v { None => { *slot = true; @@ -947,7 +1038,7 @@ pub mod parse { } /// Use this for any boolean option that has a static default. - pub(crate) fn parse_bool(slot: &mut bool, v: Option<&str>) -> bool { + pub(crate) fn parse_bool(slot: &mut bool, v: Option<&str>, _: bool) -> bool { match v { Some("y") | Some("yes") | Some("on") | Some("true") | None => { *slot = true; @@ -964,7 +1055,7 @@ pub mod parse { /// Use this for any boolean option that lacks a static default. (The /// actions taken when such an option is not specified will depend on /// other factors, such as other options, or target options.) - pub(crate) fn parse_opt_bool(slot: &mut Option, v: Option<&str>) -> bool { + pub(crate) fn parse_opt_bool(slot: &mut Option, v: Option<&str>, _: bool) -> bool { match v { Some("y") | Some("yes") | Some("on") | Some("true") | None => { *slot = Some(true); @@ -979,7 +1070,7 @@ pub mod parse { } /// Parses whether polonius is enabled, and if so, which version. - pub(crate) fn parse_polonius(slot: &mut Polonius, v: Option<&str>) -> bool { + pub(crate) fn parse_polonius(slot: &mut Polonius, v: Option<&str>, _: bool) -> bool { match v { Some("legacy") | None => { *slot = Polonius::Legacy; @@ -993,7 +1084,11 @@ pub mod parse { } } - pub(crate) fn parse_annotate_moves(slot: &mut AnnotateMoves, v: Option<&str>) -> bool { + pub(crate) fn parse_annotate_moves( + slot: &mut AnnotateMoves, + v: Option<&str>, + is_target_modifier: bool, + ) -> bool { let mut bslot = false; let mut nslot = 0u64; @@ -1001,7 +1096,7 @@ pub mod parse { // No value provided: -Z annotate-moves (enable with default limit) None => AnnotateMoves::Enabled(None), // Explicit boolean value provided: -Z annotate-moves=yes/no - s @ Some(_) if parse_bool(&mut bslot, s) => { + s @ Some(_) if parse_bool(&mut bslot, s, is_target_modifier) => { if bslot { AnnotateMoves::Enabled(None) } else { @@ -1009,7 +1104,9 @@ pub mod parse { } } // With numeric limit provided: -Z annotate-moves=1234 - s @ Some(_) if parse_number(&mut nslot, s) => AnnotateMoves::Enabled(Some(nslot)), + s @ Some(_) if parse_number(&mut nslot, s, is_target_modifier) => { + AnnotateMoves::Enabled(Some(nslot)) + } _ => return false, }; @@ -1017,7 +1114,7 @@ pub mod parse { } /// Use this for any string option that has a static default. - pub(crate) fn parse_string(slot: &mut String, v: Option<&str>) -> bool { + pub(crate) fn parse_string(slot: &mut String, v: Option<&str>, _: bool) -> bool { match v { Some(s) => { *slot = s.to_string(); @@ -1028,7 +1125,7 @@ pub mod parse { } /// Use this for any string option that lacks a static default. - pub(crate) fn parse_opt_string(slot: &mut Option, v: Option<&str>) -> bool { + pub(crate) fn parse_opt_string(slot: &mut Option, v: Option<&str>, _: bool) -> bool { match v { Some(s) => { *slot = Some(s.to_string()); @@ -1038,7 +1135,7 @@ pub mod parse { } } - pub(crate) fn parse_opt_pathbuf(slot: &mut Option, v: Option<&str>) -> bool { + pub(crate) fn parse_opt_pathbuf(slot: &mut Option, v: Option<&str>, _: bool) -> bool { match v { Some(s) => { *slot = Some(PathBuf::from(s)); @@ -1048,7 +1145,7 @@ pub mod parse { } } - pub(crate) fn parse_string_push(slot: &mut Vec, v: Option<&str>) -> bool { + pub(crate) fn parse_string_push(slot: &mut Vec, v: Option<&str>, _: bool) -> bool { match v { Some(s) => { slot.push(s.to_string()); @@ -1058,7 +1155,7 @@ pub mod parse { } } - pub(crate) fn parse_list(slot: &mut Vec, v: Option<&str>) -> bool { + pub(crate) fn parse_list(slot: &mut Vec, v: Option<&str>, _: bool) -> bool { match v { Some(s) => { slot.extend(s.split_whitespace().map(|s| s.to_string())); @@ -1071,6 +1168,7 @@ pub mod parse { pub(crate) fn parse_list_with_polarity( slot: &mut Vec<(String, bool)>, v: Option<&str>, + _: bool, ) -> bool { match v { Some(s) => { @@ -1087,6 +1185,7 @@ pub mod parse { pub(crate) fn parse_pointer_authentication_list_with_polarity( slot: &mut Vec<(PointerAuthOption, bool)>, v: Option<&str>, + _: bool, ) -> bool { let Some(s) = v else { return false; @@ -1115,7 +1214,7 @@ pub mod parse { true } - pub(crate) fn parse_fmt_debug(opt: &mut FmtDebug, v: Option<&str>) -> bool { + pub(crate) fn parse_fmt_debug(opt: &mut FmtDebug, v: Option<&str>, _: bool) -> bool { *opt = match v { Some("full") => FmtDebug::Full, Some("shallow") => FmtDebug::Shallow, @@ -1125,7 +1224,7 @@ pub mod parse { true } - pub(crate) fn parse_location_detail(ld: &mut LocationDetail, v: Option<&str>) -> bool { + pub(crate) fn parse_location_detail(ld: &mut LocationDetail, v: Option<&str>, _: bool) -> bool { if let Some(v) = v { ld.line = false; ld.file = false; @@ -1147,7 +1246,7 @@ pub mod parse { } } - pub(crate) fn parse_comma_list(slot: &mut Vec, v: Option<&str>) -> bool { + pub(crate) fn parse_comma_list(slot: &mut Vec, v: Option<&str>, _: bool) -> bool { match v { Some(s) => { let mut v: Vec<_> = s.split(',').map(|s| s.to_string()).collect(); @@ -1159,7 +1258,11 @@ pub mod parse { } } - pub(crate) fn parse_opt_comma_list(slot: &mut Option>, v: Option<&str>) -> bool { + pub(crate) fn parse_opt_comma_list( + slot: &mut Option>, + v: Option<&str>, + _: bool, + ) -> bool { match v { Some(s) => { let mut v: Vec<_> = s.split(',').map(|s| s.to_string()).collect(); @@ -1171,7 +1274,7 @@ pub mod parse { } } - pub(crate) fn parse_threads(slot: &mut Option, v: Option<&str>) -> bool { + pub(crate) fn parse_threads(slot: &mut Option, v: Option<&str>, _: bool) -> bool { let Some(s) = v else { return false }; if s == "sync" { // Enable synchronization despite only using one thread. @@ -1191,7 +1294,7 @@ pub mod parse { } /// Use this for any numeric option that has a static default. - pub(crate) fn parse_number(slot: &mut T, v: Option<&str>) -> bool { + pub(crate) fn parse_number(slot: &mut T, v: Option<&str>, _: bool) -> bool { match v.and_then(|s| s.parse().ok()) { Some(i) => { *slot = i; @@ -1205,6 +1308,7 @@ pub mod parse { pub(crate) fn parse_opt_number( slot: &mut Option, v: Option<&str>, + _: bool, ) -> bool { match v { Some(s) => { @@ -1215,11 +1319,17 @@ pub mod parse { } } - pub(crate) fn parse_frame_pointer(slot: &mut FramePointer, v: Option<&str>) -> bool { + pub(crate) fn parse_frame_pointer( + slot: &mut FramePointer, + v: Option<&str>, + is_target_modifier: bool, + ) -> bool { let mut yes = false; match v { - _ if parse_bool(&mut yes, v) && yes => slot.ratchet(FramePointer::Always), - _ if parse_bool(&mut yes, v) => slot.ratchet(FramePointer::MayOmit), + _ if parse_bool(&mut yes, v, is_target_modifier) && yes => { + slot.ratchet(FramePointer::Always) + } + _ if parse_bool(&mut yes, v, is_target_modifier) => slot.ratchet(FramePointer::MayOmit), Some("always") => slot.ratchet(FramePointer::Always), Some("non-leaf") => slot.ratchet(FramePointer::NonLeaf), _ => return false, @@ -1227,7 +1337,11 @@ pub mod parse { true } - pub(crate) fn parse_passes(slot: &mut Passes, v: Option<&str>) -> bool { + pub(crate) fn parse_passes( + slot: &mut Passes, + v: Option<&str>, + is_target_modifier: bool, + ) -> bool { match v { Some("all") => { *slot = Passes::All; @@ -1235,7 +1349,7 @@ pub mod parse { } v => { let mut passes = vec![]; - if parse_list(&mut passes, v) { + if parse_list(&mut passes, v, is_target_modifier) { slot.extend(passes); true } else { @@ -1248,6 +1362,7 @@ pub mod parse { pub(crate) fn parse_opt_panic_strategy( slot: &mut Option, v: Option<&str>, + _: bool, ) -> bool { match v { Some("unwind") => *slot = Some(PanicStrategy::Unwind), @@ -1258,7 +1373,7 @@ pub mod parse { true } - pub(crate) fn parse_panic_strategy(slot: &mut PanicStrategy, v: Option<&str>) -> bool { + pub(crate) fn parse_panic_strategy(slot: &mut PanicStrategy, v: Option<&str>, _: bool) -> bool { match v { Some("unwind") => *slot = PanicStrategy::Unwind, Some("abort") => *slot = PanicStrategy::Abort, @@ -1268,7 +1383,7 @@ pub mod parse { true } - pub(crate) fn parse_on_broken_pipe(slot: &mut OnBrokenPipe, v: Option<&str>) -> bool { + pub(crate) fn parse_on_broken_pipe(slot: &mut OnBrokenPipe, v: Option<&str>, _: bool) -> bool { match v { // OnBrokenPipe::Default can't be explicitly specified Some("kill") => *slot = OnBrokenPipe::Kill, @@ -1282,21 +1397,22 @@ pub mod parse { pub(crate) fn parse_patchable_function_entry( slot: &mut PatchableFunctionEntry, v: Option<&str>, + is_target_modifier: bool, ) -> bool { let mut total_nops = 0; let mut prefix_nops = 0; let mut section = None; - if !parse_number(&mut total_nops, v) { + if !parse_number(&mut total_nops, v, is_target_modifier) { let parts: Vec<_> = v.unwrap_or("").split(',').collect(); if parts.len() < 2 || parts.len() > 3 { return false; } - if !parse_number(&mut total_nops, Some(parts[0])) { + if !parse_number(&mut total_nops, Some(parts[0]), is_target_modifier) { return false; } - if !parse_number(&mut prefix_nops, Some(parts[1])) { + if !parse_number(&mut prefix_nops, Some(parts[1]), is_target_modifier) { return false; } section = parts.get(2).map(|x| x.to_string()); @@ -1309,7 +1425,11 @@ pub mod parse { false } - pub(crate) fn parse_relro_level(slot: &mut Option, v: Option<&str>) -> bool { + pub(crate) fn parse_relro_level( + slot: &mut Option, + v: Option<&str>, + _: bool, + ) -> bool { match v { Some(s) => match s.parse::() { Ok(level) => *slot = Some(level), @@ -1320,24 +1440,51 @@ pub mod parse { true } - pub(crate) fn parse_sanitizers(slot: &mut SanitizerSet, v: Option<&str>) -> bool { + pub(crate) fn parse_sanitizers( + slot: &mut SanitizerSet, + v: Option<&str>, + is_target_modifier: bool, + ) -> bool { + parse_sanitizers_with_filter(slot, v, is_target_modifier, true) + } + + pub(crate) fn parse_sanitizers_unfiltered( + slot: &mut SanitizerSet, + v: Option<&str>, + is_target_modifier: bool, + ) -> bool { + parse_sanitizers_with_filter(slot, v, is_target_modifier, false) + } + + fn parse_sanitizers_with_filter( + slot: &mut SanitizerSet, + v: Option<&str>, + is_target_modifier: bool, + with_filter: bool, + ) -> bool { if let Some(v) = v { for s in v.split(',') { *slot |= match s { - "address" => SanitizerSet::ADDRESS, - "cfi" => SanitizerSet::CFI, - "dataflow" => SanitizerSet::DATAFLOW, - "kcfi" => SanitizerSet::KCFI, - "kernel-address" => SanitizerSet::KERNELADDRESS, - "kernel-hwaddress" => SanitizerSet::KERNELHWADDRESS, - "leak" => SanitizerSet::LEAK, - "memory" => SanitizerSet::MEMORY, - "memtag" => SanitizerSet::MEMTAG, - "shadow-call-stack" => SanitizerSet::SHADOWCALLSTACK, - "thread" => SanitizerSet::THREAD, - "hwaddress" => SanitizerSet::HWADDRESS, - "safestack" => SanitizerSet::SAFESTACK, - "realtime" => SanitizerSet::REALTIME, + "cfi" if !with_filter || is_target_modifier => SanitizerSet::CFI, + "dataflow" if !with_filter || is_target_modifier => SanitizerSet::DATAFLOW, + "kcfi" if !with_filter || is_target_modifier => SanitizerSet::KCFI, + "kernel-address" if !with_filter || is_target_modifier => { + SanitizerSet::KERNELADDRESS + } + "kernel-hwaddress" if !with_filter || is_target_modifier => { + SanitizerSet::KERNELHWADDRESS + } + "memory" if !with_filter || is_target_modifier => SanitizerSet::MEMORY, + "memtag" if !with_filter || is_target_modifier => SanitizerSet::MEMTAG, + "shadow-call-stack" if !with_filter || is_target_modifier => { + SanitizerSet::SHADOWCALLSTACK + } + "thread" if !with_filter || is_target_modifier => SanitizerSet::THREAD, + "hwaddress" if !with_filter || is_target_modifier => SanitizerSet::HWADDRESS, + "safestack" if !with_filter || is_target_modifier => SanitizerSet::SAFESTACK, + "realtime" if !with_filter || is_target_modifier => SanitizerSet::REALTIME, + "address" if !with_filter || !is_target_modifier => SanitizerSet::ADDRESS, + "leak" if !with_filter || !is_target_modifier => SanitizerSet::LEAK, _ => return false, } } @@ -1347,7 +1494,11 @@ pub mod parse { } } - pub(crate) fn parse_sanitizer_memory_track_origins(slot: &mut usize, v: Option<&str>) -> bool { + pub(crate) fn parse_sanitizer_memory_track_origins( + slot: &mut usize, + v: Option<&str>, + _: bool, + ) -> bool { match v { Some("2") | None => { *slot = 2; @@ -1365,7 +1516,7 @@ pub mod parse { } } - pub(crate) fn parse_strip(slot: &mut Strip, v: Option<&str>) -> bool { + pub(crate) fn parse_strip(slot: &mut Strip, v: Option<&str>, _: bool) -> bool { match v { Some("none") => *slot = Strip::None, Some("debuginfo") => *slot = Strip::Debuginfo, @@ -1375,10 +1526,14 @@ pub mod parse { true } - pub(crate) fn parse_cfguard(slot: &mut CFGuard, v: Option<&str>) -> bool { + pub(crate) fn parse_cfguard( + slot: &mut CFGuard, + v: Option<&str>, + is_target_modifier: bool, + ) -> bool { if v.is_some() { let mut bool_arg = None; - if parse_opt_bool(&mut bool_arg, v) { + if parse_opt_bool(&mut bool_arg, v, is_target_modifier) { *slot = if bool_arg.unwrap() { CFGuard::Checks } else { CFGuard::Disabled }; return true; } @@ -1393,10 +1548,14 @@ pub mod parse { true } - pub(crate) fn parse_cfprotection(slot: &mut CFProtection, v: Option<&str>) -> bool { + pub(crate) fn parse_cfprotection( + slot: &mut CFProtection, + v: Option<&str>, + is_target_modifier: bool, + ) -> bool { if v.is_some() { let mut bool_arg = None; - if parse_opt_bool(&mut bool_arg, v) { + if parse_opt_bool(&mut bool_arg, v, is_target_modifier) { *slot = if bool_arg.unwrap() { CFProtection::Full } else { CFProtection::None }; return true; } @@ -1412,7 +1571,7 @@ pub mod parse { true } - pub(crate) fn parse_debuginfo(slot: &mut DebugInfo, v: Option<&str>) -> bool { + pub(crate) fn parse_debuginfo(slot: &mut DebugInfo, v: Option<&str>, _: bool) -> bool { match v { Some("0") | Some("none") => *slot = DebugInfo::None, Some("line-directives-only") => *slot = DebugInfo::LineDirectivesOnly, @@ -1427,6 +1586,7 @@ pub mod parse { pub(crate) fn parse_debuginfo_compression( slot: &mut DebugInfoCompression, v: Option<&str>, + _: bool, ) -> bool { match v { Some("none") => *slot = DebugInfoCompression::None, @@ -1437,7 +1597,11 @@ pub mod parse { true } - pub(crate) fn parse_mir_strip_debuginfo(slot: &mut MirStripDebugInfo, v: Option<&str>) -> bool { + pub(crate) fn parse_mir_strip_debuginfo( + slot: &mut MirStripDebugInfo, + v: Option<&str>, + _: bool, + ) -> bool { match v { Some("none") => *slot = MirStripDebugInfo::None, Some("locals-in-tiny-functions") => *slot = MirStripDebugInfo::LocalsInTinyFunctions, @@ -1447,7 +1611,11 @@ pub mod parse { true } - pub(crate) fn parse_linker_flavor(slot: &mut Option, v: Option<&str>) -> bool { + pub(crate) fn parse_linker_flavor( + slot: &mut Option, + v: Option<&str>, + _: bool, + ) -> bool { match v.and_then(|v| LinkerFlavorCli::from_str(v).ok()) { Some(lf) => *slot = Some(lf), _ => return false, @@ -1458,6 +1626,7 @@ pub mod parse { pub(crate) fn parse_opt_symbol_visibility( slot: &mut Option, v: Option<&str>, + _: bool, ) -> bool { if let Some(v) = v { if let Ok(vis) = SymbolVisibility::from_str(v) { @@ -1469,7 +1638,7 @@ pub mod parse { true } - pub(crate) fn parse_unpretty(slot: &mut Option, v: Option<&str>) -> bool { + pub(crate) fn parse_unpretty(slot: &mut Option, v: Option<&str>, _: bool) -> bool { match v { None => false, Some(s) if s.split('=').count() <= 2 => { @@ -1480,7 +1649,11 @@ pub mod parse { } } - pub(crate) fn parse_time_passes_format(slot: &mut TimePassesFormat, v: Option<&str>) -> bool { + pub(crate) fn parse_time_passes_format( + slot: &mut TimePassesFormat, + v: Option<&str>, + _: bool, + ) -> bool { match v { None => true, Some("json") => { @@ -1495,7 +1668,11 @@ pub mod parse { } } - pub(crate) fn parse_dump_mono_stats(slot: &mut DumpMonoStatsFormat, v: Option<&str>) -> bool { + pub(crate) fn parse_dump_mono_stats( + slot: &mut DumpMonoStatsFormat, + v: Option<&str>, + _: bool, + ) -> bool { match v { None => true, Some("json") => { @@ -1510,7 +1687,7 @@ pub mod parse { } } - pub(crate) fn parse_offload(slot: &mut Vec, v: Option<&str>) -> bool { + pub(crate) fn parse_offload(slot: &mut Vec, v: Option<&str>, _: bool) -> bool { let Some(v) = v else { *slot = vec![]; return true; @@ -1557,7 +1734,7 @@ pub mod parse { true } - pub(crate) fn parse_autodiff(slot: &mut Vec, v: Option<&str>) -> bool { + pub(crate) fn parse_autodiff(slot: &mut Vec, v: Option<&str>, _: bool) -> bool { let Some(v) = v else { *slot = vec![]; return true; @@ -1606,10 +1783,11 @@ pub mod parse { pub(crate) fn parse_instrument_coverage( slot: &mut InstrumentCoverage, v: Option<&str>, + is_target_modifier: bool, ) -> bool { if v.is_some() { let mut bool_arg = false; - if parse_bool(&mut bool_arg, v) { + if parse_bool(&mut bool_arg, v, is_target_modifier) { *slot = if bool_arg { InstrumentCoverage::Yes } else { InstrumentCoverage::No }; return true; } @@ -1633,6 +1811,7 @@ pub mod parse { pub(crate) fn parse_codegen_retag_options( slot: &mut Option, v: Option<&str>, + _: bool, ) -> bool { let mut no_precise_im = false; let mut no_precise_pin = false; @@ -1653,7 +1832,11 @@ pub mod parse { true } - pub(crate) fn parse_coverage_options(slot: &mut CoverageOptions, v: Option<&str>) -> bool { + pub(crate) fn parse_coverage_options( + slot: &mut CoverageOptions, + v: Option<&str>, + _: bool, + ) -> bool { let Some(v) = v else { return true }; for option in v.split(',') { @@ -1668,9 +1851,13 @@ pub mod parse { true } - pub(crate) fn parse_instrument_mcount(slot: &mut InstrumentMcount, v: Option<&str>) -> bool { + pub(crate) fn parse_instrument_mcount( + slot: &mut InstrumentMcount, + v: Option<&str>, + is_target_modifier: bool, + ) -> bool { let mut use_mcount = false; - if parse_bool(&mut use_mcount, v) { + if parse_bool(&mut use_mcount, v, is_target_modifier) { *slot = if use_mcount { InstrumentMcount::Mcount } else { InstrumentMcount::Disabled }; true } else if let Some("fentry") = v { @@ -1684,10 +1871,11 @@ pub mod parse { pub(crate) fn parse_instrument_xray( slot: &mut Option, v: Option<&str>, + is_target_modifier: bool, ) -> bool { if v.is_some() { let mut bool_arg = None; - if parse_opt_bool(&mut bool_arg, v) { + if parse_opt_bool(&mut bool_arg, v, is_target_modifier) { *slot = if bool_arg.unwrap() { Some(InstrumentXRay::default()) } else { None }; return true; } @@ -1746,6 +1934,7 @@ pub mod parse { pub(crate) fn parse_treat_err_as_bug( slot: &mut Option>, v: Option<&str>, + _: bool, ) -> bool { match v { Some(s) => match s.parse() { @@ -1765,7 +1954,11 @@ pub mod parse { } } - pub(crate) fn parse_next_solver_config(slot: &mut NextSolverConfig, v: Option<&str>) -> bool { + pub(crate) fn parse_next_solver_config( + slot: &mut NextSolverConfig, + v: Option<&str>, + _: bool, + ) -> bool { if let Some(config) = v { *slot = match config { "no" => NextSolverConfig { coherence: false, globally: false }, @@ -1780,10 +1973,10 @@ pub mod parse { true } - pub(crate) fn parse_lto(slot: &mut LtoCli, v: Option<&str>) -> bool { + pub(crate) fn parse_lto(slot: &mut LtoCli, v: Option<&str>, is_target_modifier: bool) -> bool { if v.is_some() { let mut bool_arg = None; - if parse_opt_bool(&mut bool_arg, v) { + if parse_opt_bool(&mut bool_arg, v, is_target_modifier) { *slot = if bool_arg.unwrap() { LtoCli::Yes } else { LtoCli::No }; return true; } @@ -1798,10 +1991,14 @@ pub mod parse { true } - pub(crate) fn parse_linker_plugin_lto(slot: &mut LinkerPluginLto, v: Option<&str>) -> bool { + pub(crate) fn parse_linker_plugin_lto( + slot: &mut LinkerPluginLto, + v: Option<&str>, + is_target_modifier: bool, + ) -> bool { if v.is_some() { let mut bool_arg = None; - if parse_opt_bool(&mut bool_arg, v) { + if parse_opt_bool(&mut bool_arg, v, is_target_modifier) { *slot = if bool_arg.unwrap() { LinkerPluginLto::LinkerPluginAuto } else { @@ -1821,6 +2018,7 @@ pub mod parse { pub(crate) fn parse_switch_with_opt_path( slot: &mut SwitchWithOptPath, v: Option<&str>, + _: bool, ) -> bool { *slot = match v { None => SwitchWithOptPath::Enabled(None), @@ -1832,6 +2030,7 @@ pub mod parse { pub(crate) fn parse_merge_functions( slot: &mut Option, v: Option<&str>, + _: bool, ) -> bool { match v.and_then(|s| MergeFunctions::from_str(s).ok()) { Some(mergefunc) => *slot = Some(mergefunc), @@ -1840,7 +2039,11 @@ pub mod parse { true } - pub(crate) fn parse_relocation_model(slot: &mut Option, v: Option<&str>) -> bool { + pub(crate) fn parse_relocation_model( + slot: &mut Option, + v: Option<&str>, + _: bool, + ) -> bool { match v.and_then(|s| RelocModel::from_str(s).ok()) { Some(relocation_model) => *slot = Some(relocation_model), None if v == Some("default") => *slot = None, @@ -1849,7 +2052,7 @@ pub mod parse { true } - pub(crate) fn parse_code_model(slot: &mut Option, v: Option<&str>) -> bool { + pub(crate) fn parse_code_model(slot: &mut Option, v: Option<&str>, _: bool) -> bool { match v.and_then(|s| CodeModel::from_str(s).ok()) { Some(code_model) => *slot = Some(code_model), _ => return false, @@ -1857,7 +2060,7 @@ pub mod parse { true } - pub(crate) fn parse_tls_model(slot: &mut Option, v: Option<&str>) -> bool { + pub(crate) fn parse_tls_model(slot: &mut Option, v: Option<&str>, _: bool) -> bool { match v.and_then(|s| TlsModel::from_str(s).ok()) { Some(tls_model) => *slot = Some(tls_model), _ => return false, @@ -1865,7 +2068,7 @@ pub mod parse { true } - pub(crate) fn parse_terminal_url(slot: &mut TerminalUrl, v: Option<&str>) -> bool { + pub(crate) fn parse_terminal_url(slot: &mut TerminalUrl, v: Option<&str>, _: bool) -> bool { *slot = match v { Some("on" | "" | "yes" | "y") | None => TerminalUrl::Yes, Some("off" | "no" | "n") => TerminalUrl::No, @@ -1878,6 +2081,7 @@ pub mod parse { pub(crate) fn parse_symbol_mangling_version( slot: &mut Option, v: Option<&str>, + _: bool, ) -> bool { *slot = match v { Some("legacy") => Some(SymbolManglingVersion::Legacy), @@ -1891,6 +2095,7 @@ pub mod parse { pub(crate) fn parse_src_file_hash( slot: &mut Option, v: Option<&str>, + _: bool, ) -> bool { match v.and_then(|s| SourceFileHashAlgorithm::from_str(s).ok()) { Some(hash_kind) => *slot = Some(hash_kind), @@ -1902,6 +2107,7 @@ pub mod parse { pub(crate) fn parse_cargo_src_file_hash( slot: &mut Option, v: Option<&str>, + _: bool, ) -> bool { match v.and_then(|s| SourceFileHashAlgorithm::from_str(s).ok()) { Some(hash_kind) => { @@ -1912,7 +2118,7 @@ pub mod parse { true } - pub(crate) fn parse_target_feature(slot: &mut String, v: Option<&str>) -> bool { + pub(crate) fn parse_target_feature(slot: &mut String, v: Option<&str>, _: bool) -> bool { match v { Some(s) => { if !slot.is_empty() { @@ -1925,7 +2131,11 @@ pub mod parse { } } - pub(crate) fn parse_link_self_contained(slot: &mut LinkSelfContained, v: Option<&str>) -> bool { + pub(crate) fn parse_link_self_contained( + slot: &mut LinkSelfContained, + v: Option<&str>, + _: bool, + ) -> bool { // Whenever `-C link-self-contained` is passed without a value, it's an opt-in // just like `parse_opt_bool`, the historical value of this flag. // @@ -1954,7 +2164,11 @@ pub mod parse { } /// Parse a comma-separated list of enabled and disabled linker features. - pub(crate) fn parse_linker_features(slot: &mut LinkerFeaturesCli, v: Option<&str>) -> bool { + pub(crate) fn parse_linker_features( + slot: &mut LinkerFeaturesCli, + v: Option<&str>, + _: bool, + ) -> bool { match v { Some(s) => { for feature in s.split(',') { @@ -1969,7 +2183,11 @@ pub mod parse { } } - pub(crate) fn parse_wasi_exec_model(slot: &mut Option, v: Option<&str>) -> bool { + pub(crate) fn parse_wasi_exec_model( + slot: &mut Option, + v: Option<&str>, + _: bool, + ) -> bool { match v { Some("command") => *slot = Some(WasiExecModel::Command), Some("reactor") => *slot = Some(WasiExecModel::Reactor), @@ -1981,6 +2199,7 @@ pub mod parse { pub(crate) fn parse_split_debuginfo( slot: &mut Option, v: Option<&str>, + _: bool, ) -> bool { match v.and_then(|s| SplitDebuginfo::from_str(s).ok()) { Some(e) => *slot = Some(e), @@ -1989,7 +2208,11 @@ pub mod parse { true } - pub(crate) fn parse_split_dwarf_kind(slot: &mut SplitDwarfKind, v: Option<&str>) -> bool { + pub(crate) fn parse_split_dwarf_kind( + slot: &mut SplitDwarfKind, + v: Option<&str>, + _: bool, + ) -> bool { match v.and_then(|s| SplitDwarfKind::from_str(s).ok()) { Some(e) => *slot = e, _ => return false, @@ -1997,7 +2220,11 @@ pub mod parse { true } - pub(crate) fn parse_stack_protector(slot: &mut StackProtector, v: Option<&str>) -> bool { + pub(crate) fn parse_stack_protector( + slot: &mut StackProtector, + v: Option<&str>, + _: bool, + ) -> bool { match v.and_then(|s| StackProtector::from_str(s).ok()) { Some(ssp) => *slot = ssp, _ => return false, @@ -2008,6 +2235,7 @@ pub mod parse { pub(crate) fn parse_branch_protection( slot: &mut Option, v: Option<&str>, + _: bool, ) -> bool { match v { Some(s) => { @@ -2043,10 +2271,11 @@ pub mod parse { pub(crate) fn parse_collapse_macro_debuginfo( slot: &mut CollapseMacroDebuginfo, v: Option<&str>, + is_target_modifier: bool, ) -> bool { if v.is_some() { let mut bool_arg = None; - if parse_opt_bool(&mut bool_arg, v) { + if parse_opt_bool(&mut bool_arg, v, is_target_modifier) { *slot = if bool_arg.unwrap() { CollapseMacroDebuginfo::Yes } else { @@ -2066,6 +2295,7 @@ pub mod parse { pub(crate) fn parse_proc_macro_execution_strategy( slot: &mut ProcMacroExecutionStrategy, v: Option<&str>, + _: bool, ) -> bool { *slot = match v { Some("same-thread") => ProcMacroExecutionStrategy::SameThread, @@ -2075,7 +2305,11 @@ pub mod parse { true } - pub(crate) fn parse_inlining_threshold(slot: &mut InliningThreshold, v: Option<&str>) -> bool { + pub(crate) fn parse_inlining_threshold( + slot: &mut InliningThreshold, + v: Option<&str>, + _: bool, + ) -> bool { match v { Some("always" | "yes") => { *slot = InliningThreshold::Always; @@ -2098,6 +2332,7 @@ pub mod parse { pub(crate) fn parse_llvm_module_flag( slot: &mut Vec<(String, u32, String)>, v: Option<&str>, + _: bool, ) -> bool { let elements = v.unwrap_or_default().split(':').collect::>(); let [key, md_type, value, behavior] = elements.as_slice() else { @@ -2122,7 +2357,11 @@ pub mod parse { true } - pub(crate) fn parse_function_return(slot: &mut FunctionReturn, v: Option<&str>) -> bool { + pub(crate) fn parse_function_return( + slot: &mut FunctionReturn, + v: Option<&str>, + _: bool, + ) -> bool { match v { Some("keep") => *slot = FunctionReturn::Keep, Some("thunk-extern") => *slot = FunctionReturn::ThunkExtern, @@ -2131,11 +2370,15 @@ pub mod parse { true } - pub(crate) fn parse_wasm_c_abi(_slot: &mut (), v: Option<&str>) -> bool { + pub(crate) fn parse_wasm_c_abi(_slot: &mut (), v: Option<&str>, _: bool) -> bool { v == Some("spec") } - pub(crate) fn parse_mir_include_spans(slot: &mut MirIncludeSpans, v: Option<&str>) -> bool { + pub(crate) fn parse_mir_include_spans( + slot: &mut MirIncludeSpans, + v: Option<&str>, + _: bool, + ) -> bool { *slot = match v { Some("on" | "yes" | "y" | "true") | None => MirIncludeSpans::On, Some("off" | "no" | "n" | "false") => MirIncludeSpans::Off, @@ -2146,9 +2389,13 @@ pub mod parse { true } - pub(crate) fn parse_align(slot: &mut Option, v: Option<&str>) -> bool { + pub(crate) fn parse_align( + slot: &mut Option, + v: Option<&str>, + is_target_modifier: bool, + ) -> bool { let mut bytes = 0u64; - if !parse_number(&mut bytes, v) { + if !parse_number(&mut bytes, v, is_target_modifier) { return false; } @@ -2164,6 +2411,7 @@ pub mod parse { pub(crate) fn parse_assert_incr_state( slot: &mut Option, v: Option<&str>, + _: bool, ) -> bool { *slot = match v { Some("loaded") => Some(IncrementalStateAssertion::Loaded), @@ -2173,7 +2421,11 @@ pub mod parse { true } - pub(crate) fn parse_rust_version(slot: &mut Option, v: Option<&str>) -> bool { + pub(crate) fn parse_rust_version( + slot: &mut Option, + v: Option<&str>, + _: bool, + ) -> bool { let Some(v) = v else { return false; }; @@ -2187,7 +2439,7 @@ pub mod parse { } options! { - CodegenOptions, CodegenOptionsTargetModifiers, CG_OPTIONS, cgopts, "C", "codegen", + CodegenOptions, CodegenOptionsKey, CG_OPTIONS, cgopts, "C", Some("T"), codegen, // If you add a new option, please update: // - compiler/rustc_interface/src/tests.rs @@ -2197,6 +2449,8 @@ options! { ar: () = ((), parse_ignore, [UNTRACKED], "this option has been removed", removed: Err), + branch_protection: Option = (None, parse_branch_protection, [TRACKED_UNSTABLE] { TARGET_MODIFIER: Only }, + "set options for branch target identification and pointer authentication on AArch64"), #[rustc_lint_opt_deny_field_access("use `Session::code_model` instead of this field")] code_model: Option = (None, parse_code_model, [TRACKED], "choose the code model to use (`rustc --print code-models` for details)"), @@ -2221,8 +2475,10 @@ options! { "version of DWARF debug information to emit (default: 2 or 4, depending on platform)"), embed_bitcode: bool = (true, parse_bool, [TRACKED], "emit bitcode in rlibs (default: yes)"), - extra_filename: String = (String::new(), parse_string, [UNTRACKED], + extra_filename: String = (String::new(), parse_string, [UNTRACKED] { TARGET_MODIFIER: Never }, "extra data to put in each output filename"), + fixed_x18: bool = (false, parse_bool, [TRACKED_UNSTABLE] { TARGET_MODIFIER: Only }, + "make the x18 register reserved on AArch64 (default: no)"), force_frame_pointers: FramePointer = (FramePointer::MayOmit, parse_frame_pointer, [TRACKED], "force use of the frame pointers"), #[rustc_lint_opt_deny_field_access("use `Session::must_emit_unwind_tables` instead of this field")] @@ -2231,6 +2487,8 @@ options! { help: bool = (false, parse_no_value, [UNTRACKED], "Print codegen options"), incremental: Option = (None, parse_opt_string, [UNTRACKED], "enable incremental compilation"), + indirect_branch_cs_prefix: bool = (false, parse_bool, [TRACKED_UNSTABLE] { TARGET_MODIFIER: Only }, + "add `cs` prefix to `call` and `jmp` to indirect thunks (default: no)"), inline_threshold: () = ((), parse_ignore, [UNTRACKED], "this option has been removed \ (consider using `-Cllvm-args=--inline-threshold=...`)", @@ -2289,6 +2547,25 @@ options! { "panic strategy to compile crate with"), passes: Vec = (Vec::new(), parse_list, [TRACKED], "a list of extra LLVM passes to run (space separated)"), + pointer_authentication: Vec<(PointerAuthOption, bool)> = ( + Vec::new(), + parse_pointer_authentication_list_with_polarity, + [TRACKED_UNSTABLE] { TARGET_MODIFIER: Only }, + "A comma-separated list of pointer authentication options, each prefixed with `+` (enable) or `-` (disable). Available options: + `aarch64-jump-table-hardening` - enable hardened lowering for jump-table dispatch + `auth-traps` - trap immediately on pointer authentication failure + `calls` - enable signing and authentication of all indirect calls + `elf-got` - enable authentication of pointers from GOT (ELF only) + `function-pointer-type-discrimination` - enable type discrimination on C function pointers + `indirect-gotos` - enable signing and authentication of indirect goto targets + `init-fini` - enable signing of function pointers in init/fini arrays + `init-fini-address-discrimination` - enable address discrimination in init/fini arrays + `intrinsics` - pointer authentication intrinsics + `return-addresses` - enable signing and authentication of return addresses + `typeinfo-vt-ptr-discrimination - incorporate type and address discrimination in authenticated vtable pointers for std::type_info + `vt-ptr-addr-discrimination - incorporate address discrimination in authenticated vtable pointers + `vt-ptr-type-discrimination - incorporate type discrimination in authenticated vtable pointers + Example: `-Zpointer-authentication=+calls,-init-fini`."), prefer_dynamic: bool = (false, parse_bool, [TRACKED], "prefer dynamic linking to static linking (default: no)"), profile_generate: SwitchWithOptPath = (SwitchWithOptPath::Disabled, @@ -2296,6 +2573,12 @@ options! { "compile the program with profiling instrumentation"), profile_use: Option = (None, parse_opt_pathbuf, [TRACKED], "use the given `.profdata` file for profile-guided optimization"), + reg_struct_return: bool = (false, parse_bool, [TRACKED_UNSTABLE] { TARGET_MODIFIER: Only }, + "On x86-32 targets, it overrides the default ABI to return small structs in registers."), + regparm: Option = (None, parse_opt_number, [TRACKED_UNSTABLE] { TARGET_MODIFIER: Only }, + "On x86-32 targets, setting this to N causes the compiler to pass N arguments \ + in registers EAX, EDX, and ECX instead of on the stack for\ + \"C\", \"cdecl\", and \"stdcall\" fn."), #[rustc_lint_opt_deny_field_access("use `Session::relocation_model` instead of this field")] relocation_model: Option = (None, parse_relocation_model, [TRACKED], "control generation of position-independent code (PIC) \ @@ -2304,8 +2587,18 @@ options! { "choose which RELRO level to use"), remark: Passes = (Passes::Some(Vec::new()), parse_passes, [UNTRACKED], "output remarks for these optimization passes (space separated, or \"all\")"), + retpoline: bool = (false, parse_bool, [TRACKED_UNSTABLE] { TARGET_MODIFIER: Only }, + "enables retpoline-indirect-branches and retpoline-indirect-calls target features (default: no)"), + retpoline_external_thunk: bool = (false, parse_bool, [TRACKED_UNSTABLE] { TARGET_MODIFIER: Only }, + "enables retpoline-external-thunk, retpoline-indirect-branches and retpoline-indirect-calls \ + target features (default: no)"), rpath: bool = (false, parse_bool, [UNTRACKED], "set rpath values in libs/exes (default: no)"), + #[rustc_lint_opt_deny_field_access("use `Session::sanitizers()` instead of this field")] + sanitizer: SanitizerSet = (SanitizerSet::empty(), parse_sanitizers, [TRACKED], + "use a sanitizer"), + sanitizer_cfi_normalize_integers: Option = (None, parse_opt_bool, [TRACKED_UNSTABLE] { TARGET_MODIFIER: Only }, + "enable normalizing integer types (default: no)"), save_temps: bool = (false, parse_bool, [UNTRACKED], "save all temporary output files during compilation (default: no)"), soft_float: () = ((), parse_ignore, [UNTRACKED], @@ -2320,7 +2613,7 @@ options! { symbol_mangling_version: Option = (None, parse_symbol_mangling_version, [TRACKED], "which mangling version to use for symbol names ('legacy', 'v0' (default), or 'hashed')"), - target_cpu: Option = (None, parse_opt_string, [TRACKED] { TARGET_MODIFIER: TargetCpu }, + target_cpu: Option = (None, parse_opt_string, [TRACKED], "select target processor (`rustc --print target-cpus` for details)"), target_feature: String = (String::new(), parse_target_feature, [TRACKED], "target specific attributes. (`rustc --print target-features` for details). \ @@ -2335,7 +2628,7 @@ options! { } options! { - UnstableOptions, UnstableOptionsTargetModifiers, Z_OPTIONS, dbopts, "Z", "unstable", + UnstableOptions, UnstableOptionsKey, Z_OPTIONS, dbopts, "Z", None, unstable, // If you add a new option, please update: // - compiler/rustc_interface/src/tests.rs @@ -2385,8 +2678,6 @@ options! { (default: no)"), box_noalias: bool = (true, parse_bool, [TRACKED], "emit noalias metadata for box (default: yes)"), - branch_protection: Option = (None, parse_branch_protection, [TRACKED] { TARGET_MODIFIER: BranchProtection }, - "set options for branch target identification and pointer authentication on AArch64"), build_sdylib_interface: bool = (false, parse_bool, [UNTRACKED], "whether the stable interface is being built"), cache_proc_macros: bool = (false, parse_bool, [TRACKED], @@ -2492,8 +2783,6 @@ options! { fewer_names: Option = (None, parse_opt_bool, [TRACKED], "reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) \ (default: no)"), - fixed_x18: bool = (false, parse_bool, [TRACKED] { TARGET_MODIFIER: FixedX18 }, - "make the x18 register reserved on AArch64 (default: no)"), flatten_format_args: bool = (true, parse_bool, [TRACKED], "flatten nested format_args!() and literals into a simplified format_args!() call \ (default: yes)"), @@ -2541,8 +2830,6 @@ options! { - hashes of green query instances - hash collisions of query keys - hash collisions when creating dep-nodes"), - indirect_branch_cs_prefix: bool = (false, parse_bool, [TRACKED] { TARGET_MODIFIER: IndirectBranchCsPrefix }, - "add `cs` prefix to `call` and `jmp` to indirect thunks (default: no)"), inline_llvm: bool = (true, parse_bool, [TRACKED], "enable LLVM inlining (default: yes)"), inline_mir: Option = (None, parse_opt_bool, [TRACKED], @@ -2705,26 +2992,6 @@ options! { "whether to use the PLT when calling into shared libraries; only has effect for PIC code on systems with ELF binaries (default: PLT is disabled if full relro is enabled on x86_64)"), - pointer_authentication: Vec<(PointerAuthOption, bool)> = ( - Vec::new(), - parse_pointer_authentication_list_with_polarity, - [TRACKED] - { TARGET_MODIFIER: PointerAuthentication }, - "A comma-separated list of pointer authentication options, each prefixed with `+` (enable) or `-` (disable). Available options: - `aarch64-jump-table-hardening` - enable hardened lowering for jump-table dispatch - `auth-traps` - trap immediately on pointer authentication failure - `calls` - enable signing and authentication of all indirect calls - `elf-got` - enable authentication of pointers from GOT (ELF only) - `function-pointer-type-discrimination` - enable type discrimination on C function pointers - `indirect-gotos` - enable signing and authentication of indirect goto targets - `init-fini` - enable signing of function pointers in init/fini arrays - `init-fini-address-discrimination` - enable address discrimination in init/fini arrays - `intrinsics` - pointer authentication intrinsics - `return-addresses` - enable signing and authentication of return addresses - `typeinfo-vt-ptr-discrimination - incorporate type and address discrimination in authenticated vtable pointers for std::type_info - `vt-ptr-addr-discrimination - incorporate address discrimination in authenticated vtable pointers - `vt-ptr-type-discrimination - incorporate type discrimination in authenticated vtable pointers - Example: `-Zpointer-authentication=+calls,-init-fini`."), polonius: Polonius = (Polonius::default(), parse_polonius, [TRACKED], "enable polonius-based borrow-checker (default: no)"), pre_link_arg: (/* redirected to pre_link_args */) = ((), parse_string_push, [UNTRACKED], @@ -2762,14 +3029,6 @@ options! { "enable queries of the dependency graph for regression testing (default: no)"), randomize_layout: bool = (false, parse_bool, [TRACKED], "randomize the layout of types (default: no)"), - reg_struct_return: bool = (false, parse_bool, [TRACKED] { TARGET_MODIFIER: RegStructReturn }, - "On x86-32 targets, it overrides the default ABI to return small structs in registers. - It is UNSOUND to link together crates that use different values for this flag!"), - regparm: Option = (None, parse_opt_number, [TRACKED] { TARGET_MODIFIER: Regparm }, - "On x86-32 targets, setting this to N causes the compiler to pass N arguments \ - in registers EAX, EDX, and ECX instead of on the stack for\ - \"C\", \"cdecl\", and \"stdcall\" fn.\ - It is UNSOUND to link together crates that use different values for this flag!"), relax_elf_relocations: Option = (None, parse_opt_bool, [TRACKED], "whether ELF relocations can be relaxed"), remap_cwd_prefix: Option = (None, parse_opt_pathbuf, [TRACKED], @@ -2779,27 +3038,22 @@ options! { written to standard error output)"), renormalize_rigid_aliases: bool = (false, parse_bool, [TRACKED], "do not skip rigid aliases in normalization for internal debugging"), - retpoline: bool = (false, parse_bool, [TRACKED] { TARGET_MODIFIER: Retpoline }, + retpoline: bool = (false, parse_bool, [TRACKED], "enables retpoline-indirect-branches and retpoline-indirect-calls target features (default: no)"), - retpoline_external_thunk: bool = (false, parse_bool, [TRACKED] { TARGET_MODIFIER: RetpolineExternalThunk }, + retpoline_external_thunk: bool = (false, parse_bool, [TRACKED], "enables retpoline-external-thunk, retpoline-indirect-branches and retpoline-indirect-calls \ target features (default: no)"), - #[rustc_lint_opt_deny_field_access("use `Session::sanitizers()` instead of this field")] - sanitizer: SanitizerSet = (SanitizerSet::empty(), parse_sanitizers, [TRACKED] { TARGET_MODIFIER: Sanitizer }, - "use a sanitizer"), sanitizer_cfi_canonical_jump_tables: Option = (Some(true), parse_opt_bool, [TRACKED], "enable canonical jump tables (default: yes)"), sanitizer_cfi_generalize_pointers: Option = (None, parse_opt_bool, [TRACKED], "enable generalizing pointer types (default: no)"), - sanitizer_cfi_normalize_integers: Option = (None, parse_opt_bool, [TRACKED] { TARGET_MODIFIER: SanitizerCfiNormalizeIntegers }, - "enable normalizing integer types (default: no)"), sanitizer_dataflow_abilist: Vec = (Vec::new(), parse_comma_list, [TRACKED], "additional ABI list files that control how shadow parameters are passed (comma separated)"), sanitizer_kcfi_arity: Option = (None, parse_opt_bool, [TRACKED], "enable KCFI arity indicator (default: no)"), sanitizer_memory_track_origins: usize = (0, parse_sanitizer_memory_track_origins, [TRACKED], "enable origins tracking in MemorySanitizer"), - sanitizer_recover: SanitizerSet = (SanitizerSet::empty(), parse_sanitizers, [TRACKED], + sanitizer_recover: SanitizerSet = (SanitizerSet::empty(), parse_sanitizers_unfiltered, [TRACKED], "enable recovery for selected sanitizers"), saturating_float_casts: Option = (None, parse_opt_bool, [TRACKED], "make float->int casts UB-free: numbers outside the integer type's range are clipped to \ diff --git a/compiler/rustc_session/src/options/mitigation_coverage.rs b/compiler/rustc_session/src/options/mitigation_coverage.rs index dbe989100d567..225dad4550e69 100644 --- a/compiler/rustc_session/src/options/mitigation_coverage.rs +++ b/compiler/rustc_session/src/options/mitigation_coverage.rs @@ -227,7 +227,9 @@ impl Options { .all_denied_partial_mitigations() .filter(|mitigation| mitigation.allowed_by_default_at(edition)) .collect(); - for (kind, MitigationStatus { index: _, allowed }) in &self.mitigation_coverage_map.map { + for (kind, MitigationStatus { index: _, allowed }) in + &self.collected_options.mitigations.map + { match allowed { Some(true) => { result.insert(*kind); diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index eebead6fc1f47..2d913e76c53c4 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -36,9 +36,9 @@ use rustc_target::spec::{ use crate::code_stats::CodeStats; pub use crate::code_stats::{DataTypeKind, FieldInfo, FieldKind, SizeKind, VariantInfo}; use crate::config::{ - self, Cfg, CheckCfg, CoverageLevel, CoverageOptions, CrateType, DebugInfo, ErrorOutputType, - FunctionReturn, Input, InstrumentCoverage, InstrumentMcount, NATIVE_CPU, OptLevel, OutFileName, - OutputType, PointerAuthOption, SwitchWithOptPath, + self, Cfg, CheckCfg, CodegenOptionsKey, CoverageLevel, CoverageOptions, CrateType, DebugInfo, + ErrorOutputType, FunctionReturn, Input, InstrumentCoverage, InstrumentMcount, NATIVE_CPU, + OptLevel, OutFileName, OutputType, PointerAuthOption, SwitchWithOptPath, }; use crate::filesearch::FileSearch; use crate::lint::LintId; @@ -606,7 +606,7 @@ impl Session { } pub fn is_sanitizer_cfi_normalize_integers_enabled(&self) -> bool { - self.opts.unstable_opts.sanitizer_cfi_normalize_integers == Some(true) + self.opts.cg.sanitizer_cfi_normalize_integers == Some(true) } pub fn is_sanitizer_kcfi_arity_enabled(&self) -> bool { @@ -934,7 +934,7 @@ impl Session { let more_names = self.opts.output_types.contains_key(&OutputType::LlvmAssembly) || self.opts.output_types.contains_key(&OutputType::Bitcode) // AddressSanitizer and MemorySanitizer use alloca name when reporting an issue. - || self.opts.unstable_opts.sanitizer.intersects(SanitizerSet::ADDRESS | SanitizerSet::MEMORY); + || self.opts.cg.sanitizer.intersects(SanitizerSet::ADDRESS | SanitizerSet::MEMORY); !more_names } } @@ -1168,7 +1168,7 @@ impl Session { } pub fn sanitizers(&self) -> SanitizerSet { - return self.opts.unstable_opts.sanitizer | self.target.options.default_sanitizers; + return self.opts.cg.sanitizer | self.target.options.default_sanitizers; } pub fn pointer_authentication(&self) -> bool { @@ -1245,7 +1245,7 @@ fn default_emitter(sopts: &config::Options, source_map: Arc) -> Box, target: Target, @@ -1287,6 +1287,19 @@ pub fn build_session( dcx.handle().warn(warning) } + // If the target requires `target-opt` be a target modifier then it is desirable that the + // default for the option be compatible with an explicitly set `-Ttarget-cpu`, but because the + // `-Ttarget-cpu` default cannot be set in `options!` (it's target-specific, unsurprisingly), + // the default needs to be written here so it is in cross-crate metadata. + let target_cpu_set = + sopts.collected_options.is_set.codegen.contains(&CodegenOptionsKey::target_cpu); + if target.requires_consistent_cpu && !target_cpu_set { + sopts.collected_options.target_modifiers.codegen.insert( + CodegenOptionsKey::target_cpu, + config::TargetModifierValue::String(target.cpu.to_string()), + ); + } + let self_profiler = if let SwitchWithOptPath::Enabled(ref d) = sopts.unstable_opts.self_profile { let directory = if let Some(directory) = d { directory } else { std::path::Path::new(".") }; @@ -1342,7 +1355,7 @@ pub fn build_session( let timings = TimingSectionHandler::new(sopts.json_timings); let pointer_auth_config: Option = - PointerAuthConfig::from_raw(&sopts.unstable_opts.pointer_authentication, &target); + PointerAuthConfig::from_raw(&sopts.cg.pointer_authentication, &target); let sess = Session { target, @@ -1424,14 +1437,24 @@ fn validate_commandline_args_with_session_available(sess: &Session) { ); } - if sess.target.cfg_abi != CfgAbi::Pauthtest - && !sess.opts.unstable_opts.pointer_authentication.is_empty() - { + if sess.target.cfg_abi != CfgAbi::Pauthtest && !sess.opts.cg.pointer_authentication.is_empty() { sess.dcx().emit_warn(diagnostics::PointerAuthenticationNotSupportedForTarget { target_triple: &sess.opts.target_triple, }); } + let target_cpu_set = + sess.opts.collected_options.is_set.codegen.contains(&CodegenOptionsKey::target_cpu); + let target_cpu_set_as_modifier = sess + .opts + .collected_options + .target_modifiers + .codegen + .contains_key(&CodegenOptionsKey::target_cpu); + if sess.target.requires_consistent_cpu && target_cpu_set && !target_cpu_set_as_modifier { + sess.dcx().emit_err(diagnostics::TargetCpuNeedsTargetModifierOpt); + } + // Make sure that any given profiling data actually exists so LLVM can't // decide to silently skip PGO. if let Some(ref path) = sess.opts.cg.profile_use { @@ -1456,10 +1479,10 @@ fn validate_commandline_args_with_session_available(sess: &Session) { // Sanitizers can only be used on platforms that we know have working sanitizer codegen. let supported_sanitizers = sess.target.options.supported_sanitizers; - let mut unsupported_sanitizers = sess.opts.unstable_opts.sanitizer - supported_sanitizers; + let mut unsupported_sanitizers = sess.opts.cg.sanitizer - supported_sanitizers; // Niche: if `fixed-x18`, or effectively switching on `reserved-x18` flag, is enabled // we should allow Shadow Call Stack sanitizer. - if sess.opts.unstable_opts.fixed_x18 && sess.target.arch == Arch::AArch64 { + if sess.opts.cg.fixed_x18 && sess.target.arch == Arch::AArch64 { unsupported_sanitizers -= SanitizerSet::SHADOWCALLSTACK; } match unsupported_sanitizers.into_iter().count() { @@ -1477,18 +1500,17 @@ fn validate_commandline_args_with_session_available(sess: &Session) { } // Cannot mix and match mutually-exclusive sanitizers. - if let Some((first, second)) = sess.opts.unstable_opts.sanitizer.mutually_exclusive() { + if let Some((first, second)) = sess.opts.cg.sanitizer.mutually_exclusive() { sess.dcx().emit_err(diagnostics::CannotMixAndMatchSanitizers { + first_prefix: first.prefix().expect("no prefix"), first: first.to_string(), + second_prefix: second.prefix().expect("no prefix"), second: second.to_string(), }); } // Cannot enable crt-static with sanitizers on Linux - if sess.crt_static(None) - && !sess.opts.unstable_opts.sanitizer.is_empty() - && !sess.target.is_like_msvc - { + if sess.crt_static(None) && !sess.opts.cg.sanitizer.is_empty() && !sess.target.is_like_msvc { sess.dcx().emit_err(diagnostics::CannotEnableCrtStaticLinux); } @@ -1578,7 +1600,7 @@ fn validate_commandline_args_with_session_available(sess: &Session) { } } - if sess.opts.unstable_opts.branch_protection.is_some() && sess.target.arch != Arch::AArch64 { + if sess.opts.cg.branch_protection.is_some() && sess.target.arch != Arch::AArch64 { sess.dcx().emit_err(diagnostics::BranchProtectionRequiresAArch64); } @@ -1635,13 +1657,13 @@ fn validate_commandline_args_with_session_available(sess: &Session) { } } - if sess.opts.unstable_opts.indirect_branch_cs_prefix { + if sess.opts.cg.indirect_branch_cs_prefix { if !matches!(sess.target.arch, Arch::X86 | Arch::X86_64) { sess.dcx().emit_err(diagnostics::IndirectBranchCsPrefixRequiresX86OrX8664); } } - if let Some(regparm) = sess.opts.unstable_opts.regparm { + if let Some(regparm) = sess.opts.cg.regparm { if regparm > 3 { sess.dcx().emit_err(diagnostics::UnsupportedRegparm { regparm }); } @@ -1649,7 +1671,7 @@ fn validate_commandline_args_with_session_available(sess: &Session) { sess.dcx().emit_err(diagnostics::UnsupportedRegparmArch); } } - if sess.opts.unstable_opts.reg_struct_return { + if sess.opts.cg.reg_struct_return { if sess.target.arch != Arch::X86 { sess.dcx().emit_err(diagnostics::UnsupportedRegStructReturnArch); } diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index a747b0aec7b28..0416a55480ccd 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -1147,7 +1147,7 @@ impl ToJson for StackProbeType { } } -#[derive(Default, Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, StableHash)] +#[derive(Default, Clone, Copy, PartialEq, Eq, Hash, Encodable, BlobDecodable, StableHash)] pub struct SanitizerSet(u16); bitflags::bitflags! { impl SanitizerSet: u16 { @@ -1229,6 +1229,25 @@ impl SanitizerSet { }) } + pub fn prefix(self) -> Option<&'static str> { + Some(match self { + SanitizerSet::ADDRESS | SanitizerSet::LEAK => "C", + SanitizerSet::CFI + | SanitizerSet::DATAFLOW + | SanitizerSet::KCFI + | SanitizerSet::KERNELADDRESS + | SanitizerSet::KERNELHWADDRESS + | SanitizerSet::MEMORY + | SanitizerSet::MEMTAG + | SanitizerSet::SAFESTACK + | SanitizerSet::SHADOWCALLSTACK + | SanitizerSet::THREAD + | SanitizerSet::HWADDRESS + | SanitizerSet::REALTIME => "T", + _ => return None, + }) + } + pub fn mutually_exclusive(self) -> Option<(SanitizerSet, SanitizerSet)> { Self::MUTUALLY_EXCLUSIVE .into_iter() diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs index ce09972396e56..e2200769d8611 100644 --- a/compiler/rustc_target/src/target_features.rs +++ b/compiler/rustc_target/src/target_features.rs @@ -311,7 +311,7 @@ static AARCH64_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[ ("rdm", Stable, &["neon"]), ( "reserve-x18", - Forbidden { reason: "use `-Zfixed-x18` compiler flag instead", hard_error: false }, + Forbidden { reason: "use `-Tfixed-x18` compiler flag instead", hard_error: false }, &[], ), // FEAT_SB diff --git a/src/doc/rustc/src/SUMMARY.md b/src/doc/rustc/src/SUMMARY.md index 3abeea4e41af3..a378c5aadedd4 100644 --- a/src/doc/rustc/src/SUMMARY.md +++ b/src/doc/rustc/src/SUMMARY.md @@ -4,6 +4,7 @@ - [Command-line Arguments](command-line-arguments.md) - [Print Options](command-line-arguments/print-options.md) - [Codegen Options](codegen-options/index.md) + - [Target Options](target-options/index.md) - [Jobserver](jobserver.md) - [Lints](lints/index.md) - [Lint Levels](lints/levels.md) diff --git a/src/doc/rustc/src/target-options/index.md b/src/doc/rustc/src/target-options/index.md new file mode 100644 index 0000000000000..f2f63a01574a0 --- /dev/null +++ b/src/doc/rustc/src/target-options/index.md @@ -0,0 +1,5 @@ +# Target Options + +All of these options are passed to `rustc` via the `-T` flag, short for "target." You can see +a version of this list for your exact compiler by running `rustc -T help`. Target options must be +set to the same value across all crates in the dependency graph. diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 840f9d025c3cf..6ece686481c72 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -8,8 +8,8 @@ use std::{fmt, io}; use rustc_data_structures::fx::FxIndexMap; use rustc_errors::DiagCtxtHandle; use rustc_session::config::{ - self, CodegenOptions, CrateType, ErrorOutputType, Externs, Input, JsonUnusedExterns, - OptionsTargetModifiers, OutFileName, Sysroot, UnstableOptions, get_cmd_lint_options, + self, CodegenOptions, CollectedOptions, CrateType, ErrorOutputType, Externs, Input, + JsonUnusedExterns, OutFileName, Sysroot, UnstableOptions, get_cmd_lint_options, nightly_options, parse_crate_types_from_list, parse_externs, parse_target_triple, }; use rustc_session::lint::Level; @@ -88,10 +88,14 @@ pub(crate) struct Options { pub(crate) codegen_options: CodegenOptions, /// Codegen options strings to hand to the compiler. pub(crate) codegen_options_strs: Vec, + /// Target options strings to hand to the compiler. + pub(crate) target_opts_strs: Vec, /// Unstable (`-Z`) options to pass to the compiler. pub(crate) unstable_opts: UnstableOptions, /// Unstable (`-Z`) options strings to pass to the compiler. pub(crate) unstable_opts_strs: Vec, + /// Side-table populated during option parsing + pub(crate) collected_options: CollectedOptions, /// The target used to compile the crate against. pub(crate) target: TargetTuple, /// Edition used when reading the crate. Defaults to "2015". Also used by default when @@ -166,9 +170,6 @@ pub(crate) struct Options { /// Arguments to be used when compiling doctests. pub(crate) doctest_build_args: Vec, - - /// Target modifiers. - pub(crate) target_modifiers: BTreeMap, } impl fmt::Debug for Options { @@ -411,6 +412,12 @@ impl Options { let mut collected_options = Default::default(); let codegen_options = CodegenOptions::build(early_dcx, matches, &mut collected_options); let unstable_opts = UnstableOptions::build(early_dcx, matches, &mut collected_options); + CodegenOptions::require_unstable_options( + early_dcx, + &collected_options, + #[allow(rustc::bad_opt_access)] + unstable_opts.unstable_options, + ); let remap_path_prefix = match parse_remap_path_prefix(matches) { Ok(prefix_mappings) => prefix_mappings, @@ -866,6 +873,7 @@ impl Options { let persist_doctests = matches.opt_str("persist-doctests").map(PathBuf::from); let test_builder = matches.opt_str("test-builder").map(PathBuf::from); let codegen_options_strs = matches.opt_strs("C"); + let target_opts_strs = matches.opt_strs("T"); let unstable_opts_strs = matches.opt_strs("Z"); let lib_strs = matches.opt_strs("L"); let extern_strs = matches.opt_strs("extern"); @@ -921,8 +929,10 @@ impl Options { check_cfgs, codegen_options, codegen_options_strs, + target_opts_strs, unstable_opts, unstable_opts_strs, + collected_options, target, edition, sysroot, @@ -951,7 +961,6 @@ impl Options { scrape_examples_options, unstable_features, doctest_build_args, - target_modifiers: collected_options.target_modifiers, }; let render_options = RenderOptions { output, diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index c1ae5f977cb89..10cb651c05e44 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -218,6 +218,7 @@ pub(crate) fn create_config( check_cfgs, codegen_options, unstable_opts, + collected_options, target, edition, sysroot, @@ -227,7 +228,6 @@ pub(crate) fn create_config( scrape_examples_options, remap_path_prefix, remap_path_scope, - target_modifiers, .. }: RustdocOptions, render_options: &RenderOptions, @@ -274,6 +274,7 @@ pub(crate) fn create_config( lint_opts, lint_cap, cg: codegen_options, + collected_options, externs, target_triple: target, unstable_features: UnstableFeatures::from_environment(crate_name.as_deref()), @@ -293,7 +294,6 @@ pub(crate) fn create_config( } else { OutputTypes::new(&[]) }, - target_modifiers, ..Options::default() }; diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 2b7f9c4dbb7fa..4ee7743b4f865 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -112,6 +112,9 @@ pub(crate) fn generate_args_file(file_path: &Path, options: &RustdocOptions) -> for codegen_options_str in &options.codegen_options_strs { content.push(format!("-C{codegen_options_str}")); } + for target_option_str in &options.target_opts_strs { + content.push(format!("-T{target_option_str}")); + } for unstable_option_str in &options.unstable_opts_strs { content.push(format!("-Z{unstable_option_str}")); } @@ -174,7 +177,7 @@ pub(crate) fn run(dcx: DiagCtxtHandle<'_>, input: Input, options: RustdocOptions remap_path_scope: options.remap_path_scope.clone(), unstable_opts: options.unstable_opts.clone(), error_format: options.error_format.clone(), - target_modifiers: options.target_modifiers.clone(), + collected_options: options.collected_options.clone(), ..config::Options::default() }; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index be830cad6c735..b4a7dff203f45 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -244,6 +244,14 @@ fn opts() -> Vec { "", ), opt(Stable, Multi, "C", "codegen", "pass a codegen option to rustc", "OPT[=VALUE]"), + opt( + Stable, + Multi, + "T", + "target-modifier", + "pass a target modifier option to rustc", + "[=]", + ), opt(Stable, FlagMulti, "", "document-private-items", "document private items", ""), opt( Unstable, diff --git a/tests/assembly-llvm/aarch64-pointer-auth.rs b/tests/assembly-llvm/aarch64-pointer-auth.rs index 2406e8ccb5dc9..bc76e24d68fa1 100644 --- a/tests/assembly-llvm/aarch64-pointer-auth.rs +++ b/tests/assembly-llvm/aarch64-pointer-auth.rs @@ -4,12 +4,12 @@ //@ revisions: GCS PACRET PAUTHLR_NOP PAUTHLR //@ assembly-output: emit-asm //@ needs-llvm-components: aarch64 -//@ compile-flags: --target aarch64-unknown-linux-gnu +//@ compile-flags: --target aarch64-unknown-linux-gnu -Zunstable-options //@ [GCS] ignore-apple (XCode version needs updating) -//@ [GCS] compile-flags: -Z branch-protection=gcs -//@ [PACRET] compile-flags: -Z branch-protection=pac-ret,leaf -//@ [PAUTHLR_NOP] compile-flags: -Z branch-protection=pac-ret,pc,leaf -//@ [PAUTHLR] compile-flags: -C target-feature=+pauth-lr -Z branch-protection=pac-ret,pc,leaf +//@ [GCS] compile-flags: -T branch-protection=gcs +//@ [PACRET] compile-flags: -T branch-protection=pac-ret,leaf +//@ [PAUTHLR_NOP] compile-flags: -T branch-protection=pac-ret,pc,leaf +//@ [PAUTHLR] compile-flags: -C target-feature=+pauth-lr -T branch-protection=pac-ret,pc,leaf #![feature(no_core, lang_items)] #![no_std] diff --git a/tests/assembly-llvm/asm/avr-modifiers.rs b/tests/assembly-llvm/asm/avr-modifiers.rs index a65eeeced7077..717eee0bf06a8 100644 --- a/tests/assembly-llvm/asm/avr-modifiers.rs +++ b/tests/assembly-llvm/asm/avr-modifiers.rs @@ -1,6 +1,6 @@ //@ add-minicore //@ assembly-output: emit-asm -//@ compile-flags: --target avr-none -C target-cpu=atmega328p +//@ compile-flags: --target avr-none -T target-cpu=atmega328p //@ needs-llvm-components: avr #![feature(no_core, asm_experimental_arch)] diff --git a/tests/assembly-llvm/asm/avr-types.rs b/tests/assembly-llvm/asm/avr-types.rs index 29a937b58e9e0..5333cd5537744 100644 --- a/tests/assembly-llvm/asm/avr-types.rs +++ b/tests/assembly-llvm/asm/avr-types.rs @@ -1,6 +1,6 @@ //@ add-minicore //@ assembly-output: emit-asm -//@ compile-flags: --target avr-none -C target-cpu=atmega328p +//@ compile-flags: --target avr-none -T target-cpu=atmega328p //@ needs-llvm-components: avr #![feature(no_core, asm_experimental_arch)] diff --git a/tests/assembly-llvm/c-variadic/avr.rs b/tests/assembly-llvm/c-variadic/avr.rs index a795e57cb8287..223f580261871 100644 --- a/tests/assembly-llvm/c-variadic/avr.rs +++ b/tests/assembly-llvm/c-variadic/avr.rs @@ -2,7 +2,7 @@ //@ assembly-output: emit-asm // //@ revisions: AVR -//@ [AVR] compile-flags: -Copt-level=3 --target=avr-none -Ctarget-cpu=atmega328p +//@ [AVR] compile-flags: -Copt-level=3 --target=avr-none -Ttarget-cpu=atmega328p //@ [AVR] needs-llvm-components: avr #![feature(c_variadic_experimental_arch, no_core, lang_items, intrinsics, rustc_attrs)] #![no_core] diff --git a/tests/assembly-llvm/c-variadic/gpu.rs b/tests/assembly-llvm/c-variadic/gpu.rs index 0bc9c0f428705..dc2bd956746c5 100644 --- a/tests/assembly-llvm/c-variadic/gpu.rs +++ b/tests/assembly-llvm/c-variadic/gpu.rs @@ -3,7 +3,7 @@ //@ compile-flags: -Copt-level=3 // //@ revisions: AMDGPU NVPTX -//@ [AMDGPU] compile-flags: --crate-type=rlib --target=amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 +//@ [AMDGPU] compile-flags: --crate-type=rlib --target=amdgcn-amd-amdhsa -Ttarget-cpu=gfx900 //@ [AMDGPU] needs-llvm-components: amdgpu //@ [NVPTX] compile-flags: --crate-type=rlib --target=nvptx64-nvidia-cuda //@ [NVPTX] needs-llvm-components: nvptx diff --git a/tests/assembly-llvm/naked-functions/aarch64-naked-fn-no-bti-prolog.rs b/tests/assembly-llvm/naked-functions/aarch64-naked-fn-no-bti-prolog.rs index 430d4a59da6df..4ff020336ea73 100644 --- a/tests/assembly-llvm/naked-functions/aarch64-naked-fn-no-bti-prolog.rs +++ b/tests/assembly-llvm/naked-functions/aarch64-naked-fn-no-bti-prolog.rs @@ -1,4 +1,5 @@ -//@ compile-flags: -C no-prepopulate-passes -Zbranch-protection=bti -Cunsafe-allow-abi-mismatch=branch-protection +//@ compile-flags: -C no-prepopulate-passes -Tbranch-protection=bti +//@ compile-flags: -Cunsafe-allow-abi-mismatch=branch-protection -Zunstable-options //@ assembly-output: emit-asm //@ needs-asm-support //@ only-aarch64 diff --git a/tests/assembly-llvm/reg-struct-return.rs b/tests/assembly-llvm/reg-struct-return.rs index d364954abe30d..9bb6ee973d1a5 100644 --- a/tests/assembly-llvm/reg-struct-return.rs +++ b/tests/assembly-llvm/reg-struct-return.rs @@ -7,9 +7,9 @@ //! `-Zreg-struct-return` is activated //@ add-minicore //@ assembly-output: emit-asm -//@ compile-flags: -O --target=i686-unknown-linux-gnu -Crelocation-model=static +//@ compile-flags: -O --target=i686-unknown-linux-gnu -Crelocation-model=static -Zunstable-options //@ revisions: WITH WITHOUT -//@[WITH] compile-flags: -Zreg-struct-return +//@[WITH] compile-flags: -Treg-struct-return //@ needs-llvm-components: x86 #![feature(no_core)] diff --git a/tests/assembly-llvm/regparm-module-flag.rs b/tests/assembly-llvm/regparm-module-flag.rs index 4a08bfdf85e5f..72c96e968f5d1 100644 --- a/tests/assembly-llvm/regparm-module-flag.rs +++ b/tests/assembly-llvm/regparm-module-flag.rs @@ -2,11 +2,11 @@ // Issue: https://github.com/rust-lang/rust/issues/145271 //@ add-minicore //@ assembly-output: emit-asm -//@ compile-flags: -O --target=i686-unknown-linux-gnu -Crelocation-model=static +//@ compile-flags: -O --target=i686-unknown-linux-gnu -Crelocation-model=static -Zunstable-options //@ revisions: REGPARM1 REGPARM2 REGPARM3 -//@[REGPARM1] compile-flags: -Zregparm=1 -//@[REGPARM2] compile-flags: -Zregparm=2 -//@[REGPARM3] compile-flags: -Zregparm=3 +//@[REGPARM1] compile-flags: -Tregparm=1 +//@[REGPARM2] compile-flags: -Tregparm=2 +//@[REGPARM3] compile-flags: -Tregparm=3 //@ needs-llvm-components: x86 #![feature(no_core)] #![no_std] diff --git a/tests/assembly-llvm/sanitizer/hwasan-vs-khwasan.rs b/tests/assembly-llvm/sanitizer/hwasan-vs-khwasan.rs index a4362b3621326..e0393d1ae7cb8 100644 --- a/tests/assembly-llvm/sanitizer/hwasan-vs-khwasan.rs +++ b/tests/assembly-llvm/sanitizer/hwasan-vs-khwasan.rs @@ -3,9 +3,9 @@ //@ add-minicore //@ assembly-output: emit-asm //@ revisions: hwasan khwasan -//@[hwasan] compile-flags: --target aarch64-unknown-linux-gnu -Zsanitizer=hwaddress +//@[hwasan] compile-flags: --target aarch64-unknown-linux-gnu -Tsanitizer=hwaddress -Zunstable-options //@[hwasan] needs-llvm-components: aarch64 -//@[khwasan] compile-flags: --target aarch64-unknown-none -Zsanitizer=kernel-hwaddress +//@[khwasan] compile-flags: --target aarch64-unknown-none -Tsanitizer=kernel-hwaddress -Zunstable-options //@[khwasan] needs-llvm-components: aarch64 //@ compile-flags: -Copt-level=1 diff --git a/tests/assembly-llvm/sanitizer/kcfi/emit-arity-indicator.rs b/tests/assembly-llvm/sanitizer/kcfi/emit-arity-indicator.rs index ba9cabd6cef74..6776140436145 100644 --- a/tests/assembly-llvm/sanitizer/kcfi/emit-arity-indicator.rs +++ b/tests/assembly-llvm/sanitizer/kcfi/emit-arity-indicator.rs @@ -3,7 +3,7 @@ //@ add-minicore //@ revisions: x86_64 //@ assembly-output: emit-asm -//@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu -Cllvm-args=-x86-asm-syntax=intel -Ctarget-feature=-crt-static -Cpanic=abort -Zsanitizer=kcfi -Zsanitizer-kcfi-arity -Copt-level=0 +//@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu -Cllvm-args=-x86-asm-syntax=intel -Ctarget-feature=-crt-static -Cpanic=abort -Tsanitizer=kcfi -Zsanitizer-kcfi-arity -Copt-level=0 -Zunstable-options //@ [x86_64] needs-llvm-components: x86 #![crate_type = "lib"] diff --git a/tests/assembly-llvm/targets/targets-amdgpu.rs b/tests/assembly-llvm/targets/targets-amdgpu.rs index 69a90ff70bee9..a44d176dde76f 100644 --- a/tests/assembly-llvm/targets/targets-amdgpu.rs +++ b/tests/assembly-llvm/targets/targets-amdgpu.rs @@ -2,7 +2,7 @@ //@ assembly-output: emit-asm // ignore-tidy-linelength //@ revisions: amdgcn_amd_amdhsa -//@ [amdgcn_amd_amdhsa] compile-flags: --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 +//@ [amdgcn_amd_amdhsa] compile-flags: --target amdgcn-amd-amdhsa -Ttarget-cpu=gfx900 //@ [amdgcn_amd_amdhsa] needs-llvm-components: amdgpu // Sanity-check that each target can produce assembly code. diff --git a/tests/assembly-llvm/targets/targets-pe.rs b/tests/assembly-llvm/targets/targets-pe.rs index 2f4472ac74d9b..b963114eab39f 100644 --- a/tests/assembly-llvm/targets/targets-pe.rs +++ b/tests/assembly-llvm/targets/targets-pe.rs @@ -17,7 +17,7 @@ //@ [arm64ec_pc_windows_msvc] compile-flags: --target arm64ec-pc-windows-msvc //@ [arm64ec_pc_windows_msvc] needs-llvm-components: aarch64 //@ revisions: avr_none -//@ [avr_none] compile-flags: --target avr-none -C target-cpu=atmega328p +//@ [avr_none] compile-flags: --target avr-none -T target-cpu=atmega328p //@ [avr_none] needs-llvm-components: avr //@ revisions: bpfeb_unknown_none //@ [bpfeb_unknown_none] compile-flags: --target bpfeb-unknown-none diff --git a/tests/codegen-llvm/amdgpu-addrspacecast.rs b/tests/codegen-llvm/amdgpu-addrspacecast.rs index 144565f7e28ca..29db57865bc20 100644 --- a/tests/codegen-llvm/amdgpu-addrspacecast.rs +++ b/tests/codegen-llvm/amdgpu-addrspacecast.rs @@ -1,6 +1,6 @@ // Check that pointers are casted to addrspace(0) before they are used -//@ compile-flags: --crate-type=rlib --target=amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 -O +//@ compile-flags: --crate-type=rlib --target=amdgcn-amd-amdhsa -Ttarget-cpu=gfx900 -O //@ needs-llvm-components: amdgpu //@ add-minicore //@ revisions: LLVM21 LLVM22 diff --git a/tests/codegen-llvm/amdgpu-dispatch-ptr.rs b/tests/codegen-llvm/amdgpu-dispatch-ptr.rs index 00bde96c3d596..743673b1ef6c5 100644 --- a/tests/codegen-llvm/amdgpu-dispatch-ptr.rs +++ b/tests/codegen-llvm/amdgpu-dispatch-ptr.rs @@ -1,6 +1,6 @@ // Tests the amdgpu_dispatch_ptr intrinsic. -//@ compile-flags: --crate-type=rlib --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 +//@ compile-flags: --crate-type=rlib --target amdgcn-amd-amdhsa -Ttarget-cpu=gfx900 //@ needs-llvm-components: amdgpu //@ add-minicore #![feature(intrinsics, no_core, rustc_attrs)] diff --git a/tests/codegen-llvm/asm/aarch64-clobbers.rs b/tests/codegen-llvm/asm/aarch64-clobbers.rs index e86956cb47977..d59fb0d0b793d 100644 --- a/tests/codegen-llvm/asm/aarch64-clobbers.rs +++ b/tests/codegen-llvm/asm/aarch64-clobbers.rs @@ -2,7 +2,7 @@ //@ revisions: aarch64 aarch64_fixed_x18 aarch64_no_x18 aarch64_reserve_x18 arm64ec //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu //@[aarch64] needs-llvm-components: aarch64 -//@[aarch64_fixed_x18] compile-flags: --target aarch64-unknown-linux-gnu -Zfixed-x18 +//@[aarch64_fixed_x18] compile-flags: --target aarch64-unknown-linux-gnu -Tfixed-x18 -Zunstable-options //@[aarch64_fixed_x18] needs-llvm-components: aarch64 //@[aarch64_no_x18] compile-flags: --target aarch64-pc-windows-msvc //@[aarch64_no_x18] needs-llvm-components: aarch64 diff --git a/tests/codegen-llvm/asm/avr-clobbers.rs b/tests/codegen-llvm/asm/avr-clobbers.rs index 472ee328465b6..626483ecf2530 100644 --- a/tests/codegen-llvm/asm/avr-clobbers.rs +++ b/tests/codegen-llvm/asm/avr-clobbers.rs @@ -1,6 +1,6 @@ //@ add-minicore //@ assembly-output: emit-asm -//@ compile-flags: --target avr-none -C target-cpu=atmega328p +//@ compile-flags: --target avr-none -T target-cpu=atmega328p //@ needs-llvm-components: avr #![crate_type = "rlib"] diff --git a/tests/codegen-llvm/avr/avr-func-addrspace.rs b/tests/codegen-llvm/avr/avr-func-addrspace.rs index 2a40f0f247542..2d0deac8742ab 100644 --- a/tests/codegen-llvm/avr/avr-func-addrspace.rs +++ b/tests/codegen-llvm/avr/avr-func-addrspace.rs @@ -1,5 +1,5 @@ //@ add-minicore -//@ compile-flags: -Copt-level=3 --target=avr-none -C target-cpu=atmega328p --crate-type=rlib -C panic=abort +//@ compile-flags: -Copt-level=3 --target=avr-none -T target-cpu=atmega328p --crate-type=rlib -C panic=abort //@ needs-llvm-components: avr // This test validates that function pointers can be stored in global variables diff --git a/tests/codegen-llvm/branch-protection.rs b/tests/codegen-llvm/branch-protection.rs index 11847c256d6ba..75822e89cdf38 100644 --- a/tests/codegen-llvm/branch-protection.rs +++ b/tests/codegen-llvm/branch-protection.rs @@ -3,16 +3,16 @@ //@ add-minicore //@ revisions: BTI GCS PACRET LEAF BKEY PAUTHLR PAUTHLR_BKEY PAUTHLR_LEAF PAUTHLR_BTI NONE //@ needs-llvm-components: aarch64 -//@ [BTI] compile-flags: -Z branch-protection=bti -//@ [GCS] compile-flags: -Z branch-protection=gcs -//@ [PACRET] compile-flags: -Z branch-protection=pac-ret -//@ [LEAF] compile-flags: -Z branch-protection=pac-ret,leaf -//@ [BKEY] compile-flags: -Z branch-protection=pac-ret,b-key -//@ [PAUTHLR] compile-flags: -Z branch-protection=pac-ret,pc -//@ [PAUTHLR_BKEY] compile-flags: -Z branch-protection=pac-ret,pc,b-key -//@ [PAUTHLR_LEAF] compile-flags: -Z branch-protection=pac-ret,pc,leaf -//@ [PAUTHLR_BTI] compile-flags: -Z branch-protection=bti,pac-ret,pc -//@ compile-flags: --target aarch64-unknown-linux-gnu +//@ [BTI] compile-flags: -T branch-protection=bti +//@ [GCS] compile-flags: -T branch-protection=gcs +//@ [PACRET] compile-flags: -T branch-protection=pac-ret +//@ [LEAF] compile-flags: -T branch-protection=pac-ret,leaf +//@ [BKEY] compile-flags: -T branch-protection=pac-ret,b-key +//@ [PAUTHLR] compile-flags: -T branch-protection=pac-ret,pc +//@ [PAUTHLR_BKEY] compile-flags: -T branch-protection=pac-ret,pc,b-key +//@ [PAUTHLR_LEAF] compile-flags: -T branch-protection=pac-ret,pc,leaf +//@ [PAUTHLR_BTI] compile-flags: -T branch-protection=bti,pac-ret,pc +//@ compile-flags: --target aarch64-unknown-linux-gnu -Zunstable-options #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen-llvm/fixed-x18.rs b/tests/codegen-llvm/fixed-x18.rs index 2020c2ea18305..696af8219971a 100644 --- a/tests/codegen-llvm/fixed-x18.rs +++ b/tests/codegen-llvm/fixed-x18.rs @@ -5,7 +5,7 @@ //@ revisions: unset set //@ needs-llvm-components: aarch64 //@ compile-flags: --target aarch64-unknown-none -//@ [set] compile-flags: -Zfixed-x18 +//@ [set] compile-flags: -Tfixed-x18 -Zunstable-options #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen-llvm/gpu-convergent.rs b/tests/codegen-llvm/gpu-convergent.rs index 376d65a3d4a25..069d3cc55167b 100644 --- a/tests/codegen-llvm/gpu-convergent.rs +++ b/tests/codegen-llvm/gpu-convergent.rs @@ -3,7 +3,7 @@ //@ add-minicore //@ revisions: amdgpu nvptx -//@ [amdgpu] compile-flags: --crate-type=rlib --target=amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 +//@ [amdgpu] compile-flags: --crate-type=rlib --target=amdgcn-amd-amdhsa -Ttarget-cpu=gfx900 //@ [amdgpu] needs-llvm-components: amdgpu //@ [nvptx] compile-flags: --crate-type=rlib --target=nvptx64-nvidia-cuda //@ [nvptx] needs-llvm-components: nvptx diff --git a/tests/codegen-llvm/gpu-kernel-abi.rs b/tests/codegen-llvm/gpu-kernel-abi.rs index 828b10c37880d..dbf6ba301b000 100644 --- a/tests/codegen-llvm/gpu-kernel-abi.rs +++ b/tests/codegen-llvm/gpu-kernel-abi.rs @@ -2,7 +2,7 @@ //@ add-minicore //@ revisions: amdgpu nvptx -//@ [amdgpu] compile-flags: --crate-type=rlib --target=amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 +//@ [amdgpu] compile-flags: --crate-type=rlib --target=amdgcn-amd-amdhsa -Ttarget-cpu=gfx900 //@ [amdgpu] needs-llvm-components: amdgpu //@ [nvptx] compile-flags: --crate-type=rlib --target=nvptx64-nvidia-cuda //@ [nvptx] needs-llvm-components: nvptx diff --git a/tests/codegen-llvm/gpu-launch-sized-workgroup-memory.rs b/tests/codegen-llvm/gpu-launch-sized-workgroup-memory.rs index 4764160fd0b59..e06c92492ee2b 100644 --- a/tests/codegen-llvm/gpu-launch-sized-workgroup-memory.rs +++ b/tests/codegen-llvm/gpu-launch-sized-workgroup-memory.rs @@ -4,7 +4,7 @@ //@ revisions: amdgpu nvptx-pre-llvm-23 nvptx-post-llvm-23 //@ compile-flags: --crate-type=rlib -Copt-level=1 // -//@ [amdgpu] compile-flags: --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 +//@ [amdgpu] compile-flags: --target amdgcn-amd-amdhsa -Ttarget-cpu=gfx900 //@ [amdgpu] needs-llvm-components: amdgpu //@ [nvptx-pre-llvm-23] compile-flags: --target nvptx64-nvidia-cuda diff --git a/tests/codegen-llvm/indirect-branch-cs-prefix.rs b/tests/codegen-llvm/indirect-branch-cs-prefix.rs index 9ad7f9d9afa68..7f97d4d97dbfa 100644 --- a/tests/codegen-llvm/indirect-branch-cs-prefix.rs +++ b/tests/codegen-llvm/indirect-branch-cs-prefix.rs @@ -5,7 +5,7 @@ //@ revisions: unset set //@ needs-llvm-components: x86 //@ compile-flags: --target x86_64-unknown-linux-gnu -//@ [set] compile-flags: -Zindirect-branch-cs-prefix +//@ [set] compile-flags: -Tindirect-branch-cs-prefix -Zunstable-options #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen-llvm/naked-asan.rs b/tests/codegen-llvm/naked-asan.rs index 9dbbee47f75d7..0bc04bab6d48b 100644 --- a/tests/codegen-llvm/naked-asan.rs +++ b/tests/codegen-llvm/naked-asan.rs @@ -1,6 +1,6 @@ //@ add-minicore //@ needs-llvm-components: x86 -//@ compile-flags: --target x86_64-unknown-linux-gnu -Zsanitizer=address -Ctarget-feature=-crt-static +//@ compile-flags: --target x86_64-unknown-linux-gnu -Csanitizer=address -Ctarget-feature=-crt-static -Zunstable-options // Make sure we do not request sanitizers for naked functions. diff --git a/tests/codegen-llvm/reg-struct-return.rs b/tests/codegen-llvm/reg-struct-return.rs index 52a1e174dfe6b..90f3d758b0cad 100644 --- a/tests/codegen-llvm/reg-struct-return.rs +++ b/tests/codegen-llvm/reg-struct-return.rs @@ -6,7 +6,7 @@ //@ revisions: ENABLED DISABLED //@ add-minicore //@ compile-flags: --target i686-unknown-linux-gnu -Cno-prepopulate-passes -Copt-level=3 -//@ [ENABLED] compile-flags: -Zreg-struct-return +//@ [ENABLED] compile-flags: -Treg-struct-return -Zunstable-options //@ needs-llvm-components: x86 #![crate_type = "lib"] diff --git a/tests/codegen-llvm/regparm-inreg.rs b/tests/codegen-llvm/regparm-inreg.rs index 77d4c206071e7..50ef809182f3e 100644 --- a/tests/codegen-llvm/regparm-inreg.rs +++ b/tests/codegen-llvm/regparm-inreg.rs @@ -3,14 +3,15 @@ // x86 only. //@ add-minicore -//@ compile-flags: --target i686-unknown-linux-gnu -Cno-prepopulate-passes -Copt-level=3 -Ctarget-feature=+avx +//@ compile-flags: --target i686-unknown-linux-gnu -Cno-prepopulate-passes -Copt-level=3 +//@ compile-flags: -Ctarget-feature=+avx -Zunstable-options //@ needs-llvm-components: x86 //@ revisions:regparm0 regparm1 regparm2 regparm3 -//@[regparm0] compile-flags: -Zregparm=0 -//@[regparm1] compile-flags: -Zregparm=1 -//@[regparm2] compile-flags: -Zregparm=2 -//@[regparm3] compile-flags: -Zregparm=3 +//@[regparm0] compile-flags: -Tregparm=0 +//@[regparm1] compile-flags: -Tregparm=1 +//@[regparm2] compile-flags: -Tregparm=2 +//@[regparm3] compile-flags: -Tregparm=3 #![crate_type = "lib"] #![no_core] diff --git a/tests/codegen-llvm/retpoline.rs b/tests/codegen-llvm/retpoline.rs index 89313d02db130..28ac9c5077ff9 100644 --- a/tests/codegen-llvm/retpoline.rs +++ b/tests/codegen-llvm/retpoline.rs @@ -7,8 +7,8 @@ //@ revisions: disabled enabled_retpoline enabled_retpoline_external_thunk //@ needs-llvm-components: x86 //@ compile-flags: --target x86_64-unknown-linux-gnu -//@ [enabled_retpoline] compile-flags: -Zretpoline -//@ [enabled_retpoline_external_thunk] compile-flags: -Zretpoline-external-thunk +//@ [enabled_retpoline] compile-flags: -Tretpoline -Zunstable-options +//@ [enabled_retpoline_external_thunk] compile-flags: -Tretpoline-external-thunk -Zunstable-options #![crate_type = "lib"] #![feature(no_core)] #![no_core] diff --git a/tests/codegen-llvm/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs b/tests/codegen-llvm/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs index bde2bd095b779..7ec35074a5e59 100644 --- a/tests/codegen-llvm/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs +++ b/tests/codegen-llvm/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs @@ -1,8 +1,8 @@ //@ add-minicore //@ revisions: aarch64 android -//@[aarch64] compile-flags: --target aarch64-unknown-none -Zfixed-x18 -Zsanitizer=shadow-call-stack +//@[aarch64] compile-flags: --target aarch64-unknown-none -Tfixed-x18 -Tsanitizer=shadow-call-stack -Zunstable-options //@[aarch64] needs-llvm-components: aarch64 -//@[android] compile-flags: --target aarch64-linux-android -Zsanitizer=shadow-call-stack +//@[android] compile-flags: --target aarch64-linux-android -Tsanitizer=shadow-call-stack -Zunstable-options //@[android] needs-llvm-components: aarch64 #![allow(internal_features)] diff --git a/tests/codegen-llvm/sanitizer/address-sanitizer-globals-tracking.rs b/tests/codegen-llvm/sanitizer/address-sanitizer-globals-tracking.rs index ada525b6c8033..7597b79bb745d 100644 --- a/tests/codegen-llvm/sanitizer/address-sanitizer-globals-tracking.rs +++ b/tests/codegen-llvm/sanitizer/address-sanitizer-globals-tracking.rs @@ -19,7 +19,7 @@ //@ only-linux // //@ revisions:ASAN ASAN-FAT-LTO -//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Csanitizer=address -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer -Zunstable-options // [ASAN] no extra compile-flags //@[ASAN-FAT-LTO] compile-flags: -Cprefer-dynamic=false -Clto=fat diff --git a/tests/codegen-llvm/sanitizer/cfi/add-canonical-jump-tables-flag.rs b/tests/codegen-llvm/sanitizer/cfi/add-canonical-jump-tables-flag.rs index 77857ca4ccb9e..e1c8178fdfda8 100644 --- a/tests/codegen-llvm/sanitizer/cfi/add-canonical-jump-tables-flag.rs +++ b/tests/codegen-llvm/sanitizer/cfi/add-canonical-jump-tables-flag.rs @@ -1,7 +1,8 @@ // Verifies that "CFI Canonical Jump Tables" module flag is added. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Tsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/add-cfi-normalize-integers-flag.rs b/tests/codegen-llvm/sanitizer/cfi/add-cfi-normalize-integers-flag.rs index 6cf9a72b7488d..c863c7cad0ff9 100644 --- a/tests/codegen-llvm/sanitizer/cfi/add-cfi-normalize-integers-flag.rs +++ b/tests/codegen-llvm/sanitizer/cfi/add-cfi-normalize-integers-flag.rs @@ -1,7 +1,9 @@ // Verifies that "cfi-normalize-integers" module flag is added. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers +//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Tsanitizer=cfi +//@ compile-flags: -Tsanitizer-cfi-normalize-integers -Zunstable-options +//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/add-enable-split-lto-unit-flag.rs b/tests/codegen-llvm/sanitizer/cfi/add-enable-split-lto-unit-flag.rs index 0bfdbfba5d2e2..aba155e1c6123 100644 --- a/tests/codegen-llvm/sanitizer/cfi/add-enable-split-lto-unit-flag.rs +++ b/tests/codegen-llvm/sanitizer/cfi/add-enable-split-lto-unit-flag.rs @@ -1,7 +1,8 @@ // Verifies that "EnableSplitLTOUnit" module flag is added. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Ctarget-feature=-crt-static -Tsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/dbg-location-on-cfi-blocks.rs b/tests/codegen-llvm/sanitizer/cfi/dbg-location-on-cfi-blocks.rs index 2a18e30e2b0de..18a8296bcf580 100644 --- a/tests/codegen-llvm/sanitizer/cfi/dbg-location-on-cfi-blocks.rs +++ b/tests/codegen-llvm/sanitizer/cfi/dbg-location-on-cfi-blocks.rs @@ -1,7 +1,8 @@ // Verifies that the parent block's debug information are assigned to the inserted cfi block. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -Cdebuginfo=1 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Tsanitizer=cfi -Ctarget-feature=-crt-static -Cdebuginfo=1 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-checks-attr-sanitize-off.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-checks-attr-sanitize-off.rs index c49438f43186f..7a7696765356a 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-checks-attr-sanitize-off.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-checks-attr-sanitize-off.rs @@ -1,7 +1,8 @@ // Verifies that pointer type membership tests for indirect calls are omitted. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Tsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] #![feature(sanitize)] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-checks.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-checks.rs index 9cad88f651820..959a02d22907f 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-checks.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-checks.rs @@ -1,7 +1,8 @@ // Verifies that pointer type membership tests for indirect calls are emitted. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Tsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs index cd9088f58af4a..8b71b20cd70fd 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-attr-cfi-encoding.rs @@ -1,7 +1,8 @@ // Verifies that user-defined CFI encoding for types are emitted. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Tsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] #![feature(cfi_encoding, extern_types)] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs index cf26c17af1ed3..3b4e673ac372d 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-const-generics.rs @@ -2,7 +2,8 @@ // for const generics. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Tsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] #![feature(type_alias_impl_trait)] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs index c6e7e2771b6b8..0efea41079b90 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-drop-in-place.rs @@ -5,7 +5,8 @@ // future. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Tsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs index 047b532e994ea..4ccab646bf7f4 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-function-types.rs @@ -2,7 +2,8 @@ // for function types. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Tsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs index 92b2ab32ea036..7a212e05f1bb8 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-lifetimes.rs @@ -2,7 +2,8 @@ // for lifetimes/regions. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Tsanitizer=cfi -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] #![feature(type_alias_impl_trait)] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs index 5de39dc85c17e..aa06fcfdcf1c1 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs @@ -2,7 +2,8 @@ // self so they can be used as function pointers. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Tsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs index 4ce9c57070a72..9aa6c178ed279 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs @@ -2,7 +2,8 @@ // for paths. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Tsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] #![feature(type_alias_impl_trait)] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs index ad4fe11d08723..a8297c6b47462 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-pointer-types.rs @@ -2,7 +2,8 @@ // for pointer types. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Tsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs index 93845d0519541..e05394a08846b 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs @@ -2,7 +2,8 @@ // for primitive types. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Tsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs index 025aa902658ec..4cc8049247c47 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs @@ -2,7 +2,8 @@ // for repr transparent types. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Tsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-return-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-return-types.rs index 74a6e2c4a1128..8bba722e82d5d 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-return-types.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-return-types.rs @@ -2,7 +2,7 @@ // for return types. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Tsanitizer=cfi -Ctarget-feature=-crt-static -Cunsafe-allow-abi-mismatch=sanitizer -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs index 76c8150b77859..7fda98f860cc8 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-sequence-types.rs @@ -2,7 +2,8 @@ // for sequence types. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Tsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs index 4fafdd2f040fc..17c6ed2ba59a8 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-trait-types.rs @@ -2,7 +2,8 @@ // for trait types. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Tsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs index 91351096ca201..c99af3e6aed75 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-user-defined-types.rs @@ -2,7 +2,8 @@ // for user-defined types. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Tsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] #![feature(extern_types)] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs index 22d518cca7442..99fbe0c72ec9f 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-generalized.rs @@ -1,7 +1,8 @@ // Verifies that generalized type metadata for functions are emitted. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Tsanitizer=cfi -Zsanitizer-cfi-generalize-pointers -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs index 5b1aa97ab3338..c849eabeb813c 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized-generalized.rs @@ -1,7 +1,10 @@ // Verifies that normalized and generalized type metadata for functions are emitted. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Tsanitizer=cfi +//@ compile-flags: -Tsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers +//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs index acd72b0ca3cff..ba29d9cf37c15 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi-normalized.rs @@ -1,7 +1,9 @@ // Verifies that normalized type metadata for functions are emitted. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Tsanitizer=cfi +//@ compile-flags: -Tsanitizer-cfi-normalize-integers -Zunstable-options +//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs index fa5cd471466e2..170a02976de0c 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-itanium-cxx-abi.rs @@ -1,7 +1,8 @@ // Verifies that type metadata for functions are emitted. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zunstable-options +//@ compile-flags: -Tsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-trait-objects.rs b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-trait-objects.rs index 82873e935b292..800d954e504e9 100644 --- a/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-trait-objects.rs +++ b/tests/codegen-llvm/sanitizer/cfi/emit-type-metadata-trait-objects.rs @@ -1,7 +1,8 @@ // Verifies that type metadata identifiers for trait objects are emitted correctly. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Ctarget-feature=-crt-static -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Ctarget-feature=-crt-static -Tsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs b/tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs index 6ac95aabae877..d90146783167b 100644 --- a/tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs +++ b/tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs @@ -2,7 +2,8 @@ // emitted correctly. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clinker-plugin-lto -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clinker-plugin-lto -Copt-level=0 -Tsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "bin"] #![feature(linkage)] diff --git a/tests/codegen-llvm/sanitizer/cfi/generalize-pointers.rs b/tests/codegen-llvm/sanitizer/cfi/generalize-pointers.rs index caa2f258f8f2a..14eb103046844 100644 --- a/tests/codegen-llvm/sanitizer/cfi/generalize-pointers.rs +++ b/tests/codegen-llvm/sanitizer/cfi/generalize-pointers.rs @@ -1,7 +1,8 @@ // Verifies that pointer types are generalized. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Tsanitizer=cfi -Zsanitizer-cfi-generalize-pointers -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/cfi/normalize-integers.rs b/tests/codegen-llvm/sanitizer/cfi/normalize-integers.rs index 16f76adafb826..fe307a6c5ae0d 100644 --- a/tests/codegen-llvm/sanitizer/cfi/normalize-integers.rs +++ b/tests/codegen-llvm/sanitizer/cfi/normalize-integers.rs @@ -1,7 +1,9 @@ // Verifies that integer types are normalized. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Tsanitizer=cfi +//@ compile-flags: -Tsanitizer-cfi-normalize-integers -Copt-level=0 -Zunstable-options +//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/hwasan-vs-khwasan.rs b/tests/codegen-llvm/sanitizer/hwasan-vs-khwasan.rs index c34df8c3c5acd..a30d9ce71e3b9 100644 --- a/tests/codegen-llvm/sanitizer/hwasan-vs-khwasan.rs +++ b/tests/codegen-llvm/sanitizer/hwasan-vs-khwasan.rs @@ -2,11 +2,11 @@ // //@ add-minicore //@ revisions: hwasan khwasan -//@[hwasan] compile-flags: --target aarch64-unknown-linux-gnu -Zsanitizer=hwaddress +//@[hwasan] compile-flags: --target aarch64-unknown-linux-gnu -Tsanitizer=hwaddress //@[hwasan] needs-llvm-components: aarch64 -//@[khwasan] compile-flags: --target aarch64-unknown-none -Zsanitizer=kernel-hwaddress +//@[khwasan] compile-flags: --target aarch64-unknown-none -Tsanitizer=kernel-hwaddress //@[khwasan] needs-llvm-components: aarch64 -//@ compile-flags: -Copt-level=0 +//@ compile-flags: -Copt-level=0 -Zunstable-options #![crate_type = "lib"] #![feature(no_core, lang_items, sanitize)] diff --git a/tests/codegen-llvm/sanitizer/kasan-emits-instrumentation.rs b/tests/codegen-llvm/sanitizer/kasan-emits-instrumentation.rs index f0135cdd00115..6b713d877ab73 100644 --- a/tests/codegen-llvm/sanitizer/kasan-emits-instrumentation.rs +++ b/tests/codegen-llvm/sanitizer/kasan-emits-instrumentation.rs @@ -1,7 +1,7 @@ -// Verifies that `-Zsanitizer=kernel-address` emits sanitizer instrumentation. +// Verifies that `-Tsanitizer=kernel-address` emits sanitizer instrumentation. //@ add-minicore -//@ compile-flags: -Zsanitizer=kernel-address -Copt-level=0 +//@ compile-flags: -Tsanitizer=kernel-address -Copt-level=0 -Zunstable-options //@ revisions: aarch64 aarch64v8r riscv64imac riscv64gc x86_64 //@[aarch64] compile-flags: --target aarch64-unknown-none //@[aarch64] needs-llvm-components: aarch64 diff --git a/tests/codegen-llvm/sanitizer/kasan-recover.rs b/tests/codegen-llvm/sanitizer/kasan-recover.rs index f0f9180ae595e..1ad292356b81a 100644 --- a/tests/codegen-llvm/sanitizer/kasan-recover.rs +++ b/tests/codegen-llvm/sanitizer/kasan-recover.rs @@ -5,7 +5,7 @@ //@ revisions: KASAN KASAN-RECOVER //@ compile-flags: -Copt-level=0 //@ needs-llvm-components: x86 -//@ compile-flags: -Zsanitizer=kernel-address --target x86_64-unknown-none +//@ compile-flags: -Tsanitizer=kernel-address --target x86_64-unknown-none -Zunstable-options //@[KASAN-RECOVER] compile-flags: -Zsanitizer-recover=kernel-address #![feature(no_core, sanitize, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs b/tests/codegen-llvm/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs index 53b8c605eb73b..b779633f7a60f 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs @@ -8,7 +8,8 @@ //@ [aarch64v8r] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers +//@ compile-flags: -Ctarget-feature=-crt-static -Tsanitizer=kcfi -Tsanitizer-cfi-normalize-integers +//@ compile-flags: -Zunstable-options #![feature(no_core, lang_items)] #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-arity-flag.rs b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-arity-flag.rs index 7a0e3b1da2506..ae8053627ad85 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-arity-flag.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-arity-flag.rs @@ -4,7 +4,8 @@ //@ revisions: x86_64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=-crt-static -Cpanic=abort -Zsanitizer=kcfi -Zsanitizer-kcfi-arity +//@ compile-flags: -Ctarget-feature=-crt-static -Cpanic=abort -Tsanitizer=kcfi -Zsanitizer-kcfi-arity +//@ compile-flags: -Zunstable-options #![feature(no_core, lang_items)] #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-flag.rs b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-flag.rs index 9058d5b5cfcb9..ed1fa424bf471 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-flag.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-flag.rs @@ -8,7 +8,7 @@ //@ [aarch64v8r] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi +//@ compile-flags: -Ctarget-feature=-crt-static -Tsanitizer=kcfi -Zunstable-options #![feature(no_core, lang_items)] #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-offset-flag.rs b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-offset-flag.rs index 6574302033c82..0f08ec6251a23 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-offset-flag.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/add-kcfi-offset-flag.rs @@ -8,7 +8,8 @@ //@ [aarch64v8r] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi -Z patchable-function-entry=4,3 +//@ compile-flags: -Ctarget-feature=-crt-static -Tsanitizer=kcfi -Z patchable-function-entry=4,3 +//@ compile-flags: -Zunstable-options #![feature(no_core, lang_items, patchable_function_entry)] #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-sanitize-off.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-sanitize-off.rs index eb9ab6b8f90cb..eec81a1c5c983 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-sanitize-off.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-sanitize-off.rs @@ -8,7 +8,7 @@ //@ [aarch64v8r] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 +//@ compile-flags: -Cno-prepopulate-passes -Tsanitizer=kcfi -Copt-level=0 -Zunstable-options #![crate_type = "lib"] #![feature(no_core, sanitize, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs index f934a3bfcee76..b5a2ba1acb6e6 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs @@ -8,7 +8,8 @@ //@ [aarch64v8r] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-generalize-pointers +//@ compile-flags: -Cno-prepopulate-passes -Tsanitizer=kcfi -Zsanitizer-cfi-generalize-pointers +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs index b72b6d7ce308e..79b42ef837a7e 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs @@ -8,7 +8,8 @@ //@ [aarch64v8r] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers +//@ compile-flags: -Cno-prepopulate-passes -Tsanitizer=kcfi -Tsanitizer-cfi-normalize-integers +//@ compile-flags: -Zsanitizer-cfi-generalize-pointers -Zunstable-options #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs index 064ab53a18561..e950259cb4300 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs @@ -8,7 +8,8 @@ //@ [aarch64v8r] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers +//@ compile-flags: -Cno-prepopulate-passes -Tsanitizer=kcfi -Tsanitizer-cfi-normalize-integers +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs index 8410286e49dbf..937ee5d787bb4 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs @@ -8,7 +8,7 @@ //@ [aarch64v8r] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 +//@ compile-flags: -Cno-prepopulate-passes -Tsanitizer=kcfi -Copt-level=0 -Zunstable-options #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle.rs index 3494854bcffd3..74cefcc5a69f6 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/emit-kcfi-operand-bundle.rs @@ -8,7 +8,7 @@ //@ [aarch64v8r] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 +//@ compile-flags: -Cno-prepopulate-passes -Tsanitizer=kcfi -Copt-level=0 -Zunstable-options #![crate_type = "lib"] #![feature(no_core, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/emit-type-metadata-trait-objects.rs b/tests/codegen-llvm/sanitizer/kcfi/emit-type-metadata-trait-objects.rs index 7d71be8e33d80..29fb0cca5d842 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/emit-type-metadata-trait-objects.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/emit-type-metadata-trait-objects.rs @@ -8,7 +8,8 @@ //@ [aarch64v8r] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0 +//@ compile-flags: -Cno-prepopulate-passes -Tsanitizer=kcfi -Copt-level=0 +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] #![feature(arbitrary_self_types, no_core, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/kcfi/fn-ptr-reify-shim.rs b/tests/codegen-llvm/sanitizer/kcfi/fn-ptr-reify-shim.rs index 8cfb6a57a4a97..f2a6afc0855e9 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/fn-ptr-reify-shim.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/fn-ptr-reify-shim.rs @@ -6,7 +6,8 @@ //@ [aarch64v8r] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi -Cno-prepopulate-passes -Copt-level=0 +//@ compile-flags: -Ctarget-feature=-crt-static -Tsanitizer=kcfi -Cno-prepopulate-passes -Copt-level=0 +//@ compile-flags: -Zunstable-options #![feature(no_core, lang_items)] #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/kcfi/naked-function.rs b/tests/codegen-llvm/sanitizer/kcfi/naked-function.rs index 6b9d11b192b33..922976152bb68 100644 --- a/tests/codegen-llvm/sanitizer/kcfi/naked-function.rs +++ b/tests/codegen-llvm/sanitizer/kcfi/naked-function.rs @@ -6,7 +6,8 @@ //@ [aarch64v8r] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Ctarget-feature=-crt-static -Zsanitizer=kcfi -Cno-prepopulate-passes -Copt-level=0 +//@ compile-flags: -Ctarget-feature=-crt-static -Tsanitizer=kcfi -Cno-prepopulate-passes -Copt-level=0 +//@ compile-flags: -Zunstable-options #![feature(no_core, lang_items)] #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/khwasan-lifetime-markers.rs b/tests/codegen-llvm/sanitizer/khwasan-lifetime-markers.rs index 26dc7983d7314..1e81e33b8ab20 100644 --- a/tests/codegen-llvm/sanitizer/khwasan-lifetime-markers.rs +++ b/tests/codegen-llvm/sanitizer/khwasan-lifetime-markers.rs @@ -1,7 +1,7 @@ -// Verifies that `-Zsanitizer=kernel-hwaddress` enables lifetime markers. +// Verifies that `-Tsanitizer=kernel-hwaddress` enables lifetime markers. //@ add-minicore -//@ compile-flags: -Zsanitizer=kernel-hwaddress -Copt-level=0 +//@ compile-flags: -Tsanitizer=kernel-hwaddress -Copt-level=0 -Zunstable-options //@ compile-flags: --target aarch64-unknown-none //@ needs-llvm-components: aarch64 diff --git a/tests/codegen-llvm/sanitizer/khwasan-recover.rs b/tests/codegen-llvm/sanitizer/khwasan-recover.rs index 452a0f579fc72..069b7a066bbbe 100644 --- a/tests/codegen-llvm/sanitizer/khwasan-recover.rs +++ b/tests/codegen-llvm/sanitizer/khwasan-recover.rs @@ -6,7 +6,7 @@ //@ revisions: KHWASAN KHWASAN-RECOVER //@ no-prefer-dynamic //@ compile-flags: -Copt-level=0 -//@ compile-flags: -Zsanitizer=kernel-hwaddress --target aarch64-unknown-none +//@ compile-flags: -Tsanitizer=kernel-hwaddress --target aarch64-unknown-none -Zunstable-options //@[KHWASAN-RECOVER] compile-flags: -Zsanitizer-recover=kernel-hwaddress #![feature(no_core, sanitize, lang_items)] diff --git a/tests/codegen-llvm/sanitizer/memory-track-origins.rs b/tests/codegen-llvm/sanitizer/memory-track-origins.rs index a72e523c4e193..526ff0684acf8 100644 --- a/tests/codegen-llvm/sanitizer/memory-track-origins.rs +++ b/tests/codegen-llvm/sanitizer/memory-track-origins.rs @@ -4,7 +4,8 @@ //@ needs-sanitizer-memory //@ revisions:MSAN-0 MSAN-1 MSAN-2 MSAN-1-LTO MSAN-2-LTO // -//@ compile-flags: -Zsanitizer=memory -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Tsanitizer=memory -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options // [MSAN-0] no extra compile-flags //@[MSAN-1] compile-flags: -Zsanitizer-memory-track-origins=1 //@[MSAN-2] compile-flags: -Zsanitizer-memory-track-origins diff --git a/tests/codegen-llvm/sanitizer/memtag-attr-check.rs b/tests/codegen-llvm/sanitizer/memtag-attr-check.rs index fc430f3a57003..e70e99549214d 100644 --- a/tests/codegen-llvm/sanitizer/memtag-attr-check.rs +++ b/tests/codegen-llvm/sanitizer/memtag-attr-check.rs @@ -2,7 +2,8 @@ // applied when enabling the memtag sanitizer. // //@ needs-sanitizer-memtag -//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer -Zsanitizer=memtag -Ctarget-feature=+mte -Copt-level=0 +//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer -Tsanitizer=memtag -Ctarget-feature=+mte -Copt-level=0 +//@ compile-flags: -Zunstable-options #![crate_type = "lib"] diff --git a/tests/codegen-llvm/sanitizer/riscv64-shadow-call-stack.rs b/tests/codegen-llvm/sanitizer/riscv64-shadow-call-stack.rs index 72f9c12fae0e2..ab4c4818839f5 100644 --- a/tests/codegen-llvm/sanitizer/riscv64-shadow-call-stack.rs +++ b/tests/codegen-llvm/sanitizer/riscv64-shadow-call-stack.rs @@ -1,5 +1,6 @@ //@ add-minicore -//@ compile-flags: --target riscv64imac-unknown-none-elf -Zsanitizer=shadow-call-stack +//@ compile-flags: --target riscv64imac-unknown-none-elf -Tsanitizer=shadow-call-stack +//@ compile-flags: -Zunstable-options //@ needs-llvm-components: riscv #![allow(internal_features)] diff --git a/tests/codegen-llvm/sanitizer/sanitize-off-asan-kasan.rs b/tests/codegen-llvm/sanitizer/sanitize-off-asan-kasan.rs index cef4a650e4775..7c605837d5342 100644 --- a/tests/codegen-llvm/sanitizer/sanitize-off-asan-kasan.rs +++ b/tests/codegen-llvm/sanitizer/sanitize-off-asan-kasan.rs @@ -2,7 +2,8 @@ // the kernel address sanitizer. // //@ add-minicore -//@ compile-flags: -Zsanitizer=kernel-address -Ctarget-feature=-crt-static -Copt-level=0 +//@ compile-flags: -Tsanitizer=kernel-address -Ctarget-feature=-crt-static -Copt-level=0 +//@ compile-flags: -Zunstable-options //@ revisions: aarch64 aarch64v8r riscv64imac riscv64gc x86_64 //@[aarch64] compile-flags: --target aarch64-unknown-none //@[aarch64] needs-llvm-components: aarch64 diff --git a/tests/codegen-llvm/sanitizer/sanitize-off-hwasan-khwasan.rs b/tests/codegen-llvm/sanitizer/sanitize-off-hwasan-khwasan.rs index 313f48031e4ab..37b7e6bf65d73 100644 --- a/tests/codegen-llvm/sanitizer/sanitize-off-hwasan-khwasan.rs +++ b/tests/codegen-llvm/sanitizer/sanitize-off-hwasan-khwasan.rs @@ -2,7 +2,7 @@ // the kernel hardware-assisted address sanitizer. // //@ add-minicore -//@ compile-flags: -Zsanitizer=kernel-hwaddress --target aarch64-unknown-none +//@ compile-flags: -Tsanitizer=kernel-hwaddress --target aarch64-unknown-none -Zunstable-options //@ compile-flags: -Ctarget-feature=-crt-static -Copt-level=0 //@ needs-llvm-components: aarch64 diff --git a/tests/codegen-llvm/sanitizer/sanitize-off-inlining.rs b/tests/codegen-llvm/sanitizer/sanitize-off-inlining.rs index 0f43e6b8393dd..f7dbf03ee29d7 100644 --- a/tests/codegen-llvm/sanitizer/sanitize-off-inlining.rs +++ b/tests/codegen-llvm/sanitizer/sanitize-off-inlining.rs @@ -5,8 +5,8 @@ //@ revisions: ASAN LSAN //@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer //@ compile-flags: -Copt-level=3 -Zmir-opt-level=4 -Ctarget-feature=-crt-static -//@[ASAN] compile-flags: -Zsanitizer=address -//@[LSAN] compile-flags: -Zsanitizer=leak +//@[ASAN] compile-flags: -Csanitizer=address -Zunstable-options +//@[LSAN] compile-flags: -Csanitizer=leak -Zunstable-options #![crate_type = "lib"] #![feature(sanitize)] diff --git a/tests/codegen-llvm/sanitizer/sanitize-off-kasan-asan.rs b/tests/codegen-llvm/sanitizer/sanitize-off-kasan-asan.rs index 61ad0ba7d90d3..dcf198fe45856 100644 --- a/tests/codegen-llvm/sanitizer/sanitize-off-kasan-asan.rs +++ b/tests/codegen-llvm/sanitizer/sanitize-off-kasan-asan.rs @@ -2,7 +2,8 @@ // the address sanitizer. // //@ needs-sanitizer-address -//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static -Copt-level=0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Csanitizer=address -Ctarget-feature=-crt-static -Copt-level=0 +//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer -Zunstable-options #![crate_type = "lib"] #![feature(sanitize)] diff --git a/tests/codegen-llvm/sanitizer/sanitize-off-khwasan-hwasan.rs b/tests/codegen-llvm/sanitizer/sanitize-off-khwasan-hwasan.rs index a4491eb9f785d..4d2f5b338befa 100644 --- a/tests/codegen-llvm/sanitizer/sanitize-off-khwasan-hwasan.rs +++ b/tests/codegen-llvm/sanitizer/sanitize-off-khwasan-hwasan.rs @@ -4,7 +4,7 @@ //@ needs-sanitizer-hwaddress //@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitizer //@ compile-flags: -Ctarget-feature=-crt-static -//@ compile-flags: -Zsanitizer=hwaddress -Copt-level=0 +//@ compile-flags: -Tsanitizer=hwaddress -Copt-level=0 -Zunstable-options #![crate_type = "lib"] #![feature(sanitize)] diff --git a/tests/codegen-llvm/sanitizer/sanitize-off.rs b/tests/codegen-llvm/sanitizer/sanitize-off.rs index ac7c49322c6d8..fabe2c4707842 100644 --- a/tests/codegen-llvm/sanitizer/sanitize-off.rs +++ b/tests/codegen-llvm/sanitizer/sanitize-off.rs @@ -2,7 +2,7 @@ // selectively disable sanitizer instrumentation. // //@ needs-sanitizer-address -//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static -Copt-level=0 +//@ compile-flags: -Csanitizer=address -Ctarget-feature=-crt-static -Copt-level=0 -Zunstable-options #![crate_type = "lib"] #![feature(sanitize)] diff --git a/tests/codegen-llvm/sanitizer/sanitizer-recover.rs b/tests/codegen-llvm/sanitizer/sanitizer-recover.rs index 5e05b92f3b100..0e8d52f849c9e 100644 --- a/tests/codegen-llvm/sanitizer/sanitizer-recover.rs +++ b/tests/codegen-llvm/sanitizer/sanitizer-recover.rs @@ -7,11 +7,13 @@ //@ no-prefer-dynamic //@ compile-flags: -Cunsafe-allow-abi-mismatch=sanitizer //@ compile-flags: -Ctarget-feature=-crt-static -//@[ASAN] compile-flags: -Zsanitizer=address -Copt-level=0 -//@[ASAN-RECOVER] compile-flags: -Zsanitizer=address -Zsanitizer-recover=address -Copt-level=0 -//@[MSAN] compile-flags: -Zsanitizer=memory -//@[MSAN-RECOVER] compile-flags: -Zsanitizer=memory -Zsanitizer-recover=memory -//@[MSAN-RECOVER-LTO] compile-flags: -Zsanitizer=memory -Zsanitizer-recover=memory -C lto=fat +//@[ASAN] compile-flags: -Csanitizer=address -Copt-level=0 -Zunstable-options +//@[ASAN-RECOVER] compile-flags: -Csanitizer=address -Zsanitizer-recover=address -Copt-level=0 +//@[MSAN] compile-flags: -Tsanitizer=memory -Zunstable-options +//@[MSAN-RECOVER] compile-flags: -Tsanitizer=memory -Zsanitizer-recover=memory +//@[MSAN-RECOVER] compile-flags: -Zunstable-options +//@[MSAN-RECOVER-LTO] compile-flags: -Tsanitizer=memory -Zsanitizer-recover=memory -C lto=fat +//@[MSAN-RECOVER-LTO] compile-flags: -Zunstable-options // // MSAN-NOT: @__msan_keep_going // MSAN-RECOVER: @__msan_keep_going = weak_odr {{.*}}constant i32 1 diff --git a/tests/run-make/avr-custom-target-missing-cpu/rmake.rs b/tests/run-make/avr-custom-target-missing-cpu/rmake.rs index d076eb3d378b2..615932e69885b 100644 --- a/tests/run-make/avr-custom-target-missing-cpu/rmake.rs +++ b/tests/run-make/avr-custom-target-missing-cpu/rmake.rs @@ -12,5 +12,5 @@ fn main() { .target("avr-custom-missing-cpu.json") .crate_type("lib") .run_fail() - .assert_stderr_contains("target requires explicitly specifying a cpu with `-C target-cpu`"); + .assert_stderr_contains("target requires explicitly specifying a cpu with `-T target-cpu`"); } diff --git a/tests/run-make/pointer-auth-link-with-c/rmake.rs b/tests/run-make/pointer-auth-link-with-c/rmake.rs index 1ac68c95559c6..a863b2b8d1dfc 100644 --- a/tests/run-make/pointer-auth-link-with-c/rmake.rs +++ b/tests/run-make/pointer-auth-link-with-c/rmake.rs @@ -17,7 +17,8 @@ fn main() { build_native_static_lib("test"); rustc() .arg("-Cunsafe-allow-abi-mismatch=branch-protection") - .arg("-Zbranch-protection=bti,gcs,pac-ret,leaf") + .arg("-Zunstable-options") + .arg("-Tbranch-protection=bti,gcs,pac-ret,leaf") .input("test.rs") .run(); run("test"); @@ -31,7 +32,8 @@ fn main() { llvm_ar().obj_to_ar().output_input("libtest.a", &obj_file).run(); rustc() .arg("-Cunsafe-allow-abi-mismatch=branch-protection") - .arg("-Zbranch-protection=bti,gcs,pac-ret,leaf") + .arg("-Zunstable-options") + .arg("-Tbranch-protection=bti,gcs,pac-ret,leaf") .input("test.rs") .run(); run("test"); diff --git a/tests/run-make/rustc-help/help-v.diff b/tests/run-make/rustc-help/help-v.diff index 94ed6a0ed027c..d64226d39b7ae 100644 --- a/tests/run-make/rustc-help/help-v.diff +++ b/tests/run-make/rustc-help/help-v.diff @@ -1,5 +1,5 @@ -@@ -65,10 +65,31 @@ - Set a codegen option +@@ -67,11 +67,32 @@ + Set a target modifier option -V, --version Print version info and exit -v, --verbose Use verbose output + --extern [=] @@ -27,6 +27,7 @@ Additional help: -C help Print codegen options + -T help Print target modifier options -W help Print 'lint' options and default settings -Z help Print unstable compiler options - --help -v Print the full set of options rustc accepts diff --git a/tests/run-make/rustc-help/help-v.stdout b/tests/run-make/rustc-help/help-v.stdout index 1531f61089e9a..01567e6b97883 100644 --- a/tests/run-make/rustc-help/help-v.stdout +++ b/tests/run-make/rustc-help/help-v.stdout @@ -63,6 +63,8 @@ Options: lints are capped at this level -C, --codegen [=] Set a codegen option + -T, --target-modifier [=] + Set a target modifier option -V, --version Print version info and exit -v, --verbose Use verbose output --extern [=] @@ -90,6 +92,7 @@ Options: Additional help: -C help Print codegen options + -T help Print target modifier options -W help Print 'lint' options and default settings -Z help Print unstable compiler options diff --git a/tests/run-make/rustc-help/help.stdout b/tests/run-make/rustc-help/help.stdout index f96feccf35980..4505824f75a82 100644 --- a/tests/run-make/rustc-help/help.stdout +++ b/tests/run-make/rustc-help/help.stdout @@ -63,11 +63,14 @@ Options: lints are capped at this level -C, --codegen [=] Set a codegen option + -T, --target-modifier [=] + Set a target modifier option -V, --version Print version info and exit -v, --verbose Use verbose output Additional help: -C help Print codegen options + -T help Print target modifier options -W help Print 'lint' options and default settings -Z help Print unstable compiler options --help -v Print the full set of options rustc accepts diff --git a/tests/run-make/rustdoc/default-output/output-default.stdout b/tests/run-make/rustdoc/default-output/output-default.stdout index 78dfbf03c1b10..1c9e712b49136 100644 --- a/tests/run-make/rustdoc/default-output/output-default.stdout +++ b/tests/run-make/rustdoc/default-output/output-default.stdout @@ -29,6 +29,8 @@ Options: `html_root_url` -C, --codegen OPT[=VALUE] pass a codegen option to rustc + -T, --target-modifier [=] + pass a target modifier option to rustc --document-private-items document private items --document-hidden-items diff --git a/tests/run-make/rustdoc/target-modifiers/rmake.rs b/tests/run-make/rustdoc/target-modifiers/rmake.rs index ffe87f3f7650e..7264b9407f1a3 100644 --- a/tests/run-make/rustdoc/target-modifiers/rmake.rs +++ b/tests/run-make/rustdoc/target-modifiers/rmake.rs @@ -15,7 +15,8 @@ fn main() { .emit("metadata") .sysroot("/dev/null") .target("aarch64-unknown-none-softfloat") - .arg("-Zfixed-x18") + .arg("-Tfixed-x18") + .arg("-Zunstable-options") .run(); rustdoc() @@ -23,7 +24,8 @@ fn main() { .crate_type("rlib") .extern_("d", "libd.rmeta") .target("aarch64-unknown-none-softfloat") - .arg("-Zfixed-x18") + .arg("-Tfixed-x18") + .arg("-Zunstable-options") .run(); rustdoc() @@ -31,7 +33,8 @@ fn main() { .crate_type("rlib") .extern_("d", "libd.rmeta") .target("aarch64-unknown-none-softfloat") - .arg("-Zfixed-x18") + .arg("-Tfixed-x18") + .arg("-Zunstable-options") .arg("--test") .run(); @@ -41,7 +44,8 @@ fn main() { .crate_type("rlib") .extern_("d", "libd.rmeta") .target("aarch64-unknown-none-softfloat") - .arg("-Zfixed-x18") + .arg("-Tfixed-x18") + .arg("-Zunstable-options") .arg("--test") .run(); @@ -53,7 +57,7 @@ fn main() { .target("aarch64-unknown-none-softfloat") .arg("--test") .run_fail() - .assert_stderr_contains("mixing `-Zfixed-x18` will cause an ABI mismatch"); + .assert_stderr_contains("mixing `-Tfixed-x18` will cause an ABI mismatch"); // rustdoc --test -Cunsafe-allow-abi-mismatch=... ignores the mismatch rustdoc() diff --git a/tests/run-make/simd-ffi/rmake.rs b/tests/run-make/simd-ffi/rmake.rs index 054ea402a698d..60d19ce16dfbf 100644 --- a/tests/run-make/simd-ffi/rmake.rs +++ b/tests/run-make/simd-ffi/rmake.rs @@ -64,7 +64,7 @@ fn main() { } else if target.starts_with("mips") { "+msa,+fp64" } else if target.starts_with("amdgcn") { - cmd.arg("-Ctarget-cpu=gfx900"); + cmd.arg("-Ttarget-cpu=gfx900"); "" } else { panic!("missing target_feature case for {target}"); diff --git a/tests/run-make/target-cpu-as-target-modifier/rmake.rs b/tests/run-make/target-cpu-as-target-modifier/rmake.rs index a3be062dd8090..2afe059debc3e 100644 --- a/tests/run-make/target-cpu-as-target-modifier/rmake.rs +++ b/tests/run-make/target-cpu-as-target-modifier/rmake.rs @@ -75,37 +75,40 @@ fn verify_cross_crate_compatibility() { let targets: Vec<&str> = target_list.lines().collect(); for target in targets.iter() { - let compiler = |cpu: &str, input: &str| { + let compiler = |cpu: &str, input: &str, prefix: &str| { let mut cmd = rustc(); cmd.target(target) - .target_cpu(cpu) + .arg(format!("-{prefix}target-cpu={cpu}")) .input(input) .panic("abort") .args(["--emit=metadata", "-Zcodegen-backend=dummy"]); cmd }; let (first_cpu, second_cpu) = ("A", "B"); + let prefix = if EXPECTED.contains(target) { "T" } else { "C" }; // Build dependency.rs using the first target-cpu - compiler(first_cpu, "dependency.rs").run(); + compiler(first_cpu, "dependency.rs", prefix).run(); if EXPECTED.contains(target) { - // Testing targets where `-Ctarget-cpu` acts as a target modifier: + // Testing targets where `-Ttarget-cpu` acts as a target modifier: // Building with the same target cpu must succeed. - compiler(first_cpu, "main.rs").run(); + compiler(first_cpu, "main.rs", prefix).run(); // Building with a different target cpu must succeed if // rustc is invoked with `-Cunsafe-allow-abi-mismatch=target-cpu` - compiler(second_cpu, "main.rs").arg("-Cunsafe-allow-abi-mismatch=target-cpu").run(); + compiler(second_cpu, "main.rs", prefix) + .arg("-Cunsafe-allow-abi-mismatch=target-cpu") + .run(); // Building with a different target cpu must fail if // rustc is _not_ invoked with `-Cunsafe-allow-abi-mismatch=target-cpu` - compiler(second_cpu, "main.rs").run_fail().assert_stderr_contains( - "error: mixing `-Ctarget-cpu` will cause \ + compiler(second_cpu, "main.rs", prefix).run_fail().assert_stderr_contains( + "error: mixing `-Ttarget-cpu` will cause \ an ABI mismatch in crate `main`", ); } else { // Testing targets where `-Ctarget-cpu` does not act as a target modifier: // Building with a different target cpu must succeed. - compiler(second_cpu, "main.rs").run(); + compiler(second_cpu, "main.rs", prefix).run(); } } } diff --git a/tests/run-make/target-cpu-precedence/lib.rs b/tests/run-make/target-cpu-precedence/lib.rs index 3f92f54eb357e..25588ef2282db 100644 --- a/tests/run-make/target-cpu-precedence/lib.rs +++ b/tests/run-make/target-cpu-precedence/lib.rs @@ -24,7 +24,7 @@ pub trait MetaSized: PointeeSized {} pub trait Sized: MetaSized {} // Capture the effective CPU from LLVM IR. This also verifies that the second -// `-Ctarget-cpu` argument took precedence. +// `-Ttarget-cpu` argument took precedence. // CHECK-LABEL: target triple = "nvptx64-nvidia-cuda" // CHECK-LABEL: define {{.*}} @foo() {{.*}} #0 // CHECK-LABEL: attributes #0 = {{.*}} "target-cpu"="sm_80" {{.*}} @@ -34,4 +34,4 @@ pub fn foo() { } // The value reconstructed from crate metadata must be identical. // CHECK-LABEL: =Target modifiers= -// CHECK-LABEL: -Ctarget-cpu=sm_80 [Some("sm_80")] +// CHECK-LABEL: -Ttarget-cpu=sm_80 diff --git a/tests/run-make/target-cpu-precedence/rmake.rs b/tests/run-make/target-cpu-precedence/rmake.rs index 13dfcd72e3891..57fb2a742e496 100644 --- a/tests/run-make/target-cpu-precedence/rmake.rs +++ b/tests/run-make/target-cpu-precedence/rmake.rs @@ -15,8 +15,8 @@ fn main() { .input("lib.rs") .crate_name("target_cpu_precedence") .target(TARGET) - .target_cpu(FIRST_CPU) - .target_cpu(LAST_CPU) + .arg(format!("-Ttarget-cpu={FIRST_CPU}")) + .arg(format!("-Ttarget-cpu={LAST_CPU}")) .emit("llvm-ir=output.ll,metadata=output.rmeta") .run(); diff --git a/tests/run-make/target-specs/rmake.rs b/tests/run-make/target-specs/rmake.rs index 6c88f3164e9e4..aeb5d2a1d3524 100644 --- a/tests/run-make/target-specs/rmake.rs +++ b/tests/run-make/target-specs/rmake.rs @@ -93,7 +93,7 @@ fn main() { .input("foo.rs") .target("require-explicit-cpu") .crate_type("lib") - .arg("-Ctarget-cpu=generic") + .arg("-Ttarget-cpu=generic") .run(); rustc().arg("-Zunstable-options").target("require-explicit-cpu").print("target-cpus").run(); } diff --git a/tests/ui/abi/avr-sram.rs b/tests/ui/abi/avr-sram.rs index 0266f7d6b22ca..d5ebec2cd46e6 100644 --- a/tests/ui/abi/avr-sram.rs +++ b/tests/ui/abi/avr-sram.rs @@ -1,10 +1,10 @@ //@ revisions: has_sram no_sram disable_sram //@ build-pass -//@[has_sram] compile-flags: --target avr-none -C target-cpu=atmega328p +//@[has_sram] compile-flags: --target avr-none -T target-cpu=atmega328p //@[has_sram] needs-llvm-components: avr -//@[no_sram] compile-flags: --target avr-none -C target-cpu=attiny11 +//@[no_sram] compile-flags: --target avr-none -T target-cpu=attiny11 //@[no_sram] needs-llvm-components: avr -//@[disable_sram] compile-flags: --target avr-none -C target-cpu=atmega328p -C target-feature=-sram +//@[disable_sram] compile-flags: --target avr-none -T target-cpu=atmega328p -C target-feature=-sram //@[disable_sram] needs-llvm-components: avr //@ ignore-backends: gcc //[no_sram,disable_sram]~? WARN target feature `sram` must be enabled diff --git a/tests/ui/abi/cannot-be-called.rs b/tests/ui/abi/cannot-be-called.rs index eef2f8c671efa..e92898de3bf77 100644 --- a/tests/ui/abi/cannot-be-called.rs +++ b/tests/ui/abi/cannot-be-called.rs @@ -17,11 +17,11 @@ So we test that they error in essentially all of the same places. //@ [riscv64] needs-llvm-components: riscv //@ [riscv64] compile-flags: --target=riscv64gc-unknown-none-elf --crate-type=rlib //@ [avr] needs-llvm-components: avr -//@ [avr] compile-flags: --target=avr-none -C target-cpu=atmega328p --crate-type=rlib +//@ [avr] compile-flags: --target=avr-none -T target-cpu=atmega328p --crate-type=rlib //@ [msp430] needs-llvm-components: msp430 //@ [msp430] compile-flags: --target=msp430-none-elf --crate-type=rlib //@ [amdgpu] needs-llvm-components: amdgpu -//@ [amdgpu] compile-flags: --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 --crate-type=rlib +//@ [amdgpu] compile-flags: --target amdgcn-amd-amdhsa -Ttarget-cpu=gfx900 --crate-type=rlib //@ [nvptx] needs-llvm-components: nvptx //@ [nvptx] compile-flags: --target nvptx64-nvidia-cuda --crate-type=rlib //@ ignore-backends: gcc diff --git a/tests/ui/abi/cannot-be-coroutine.rs b/tests/ui/abi/cannot-be-coroutine.rs index 239f5aa5c31fe..89a86baad6bc5 100644 --- a/tests/ui/abi/cannot-be-coroutine.rs +++ b/tests/ui/abi/cannot-be-coroutine.rs @@ -13,11 +13,11 @@ //@ [riscv64] needs-llvm-components: riscv //@ [riscv64] compile-flags: --target=riscv64gc-unknown-none-elf --crate-type=rlib //@ [avr] needs-llvm-components: avr -//@ [avr] compile-flags: --target=avr-none -C target-cpu=atmega328p --crate-type=rlib +//@ [avr] compile-flags: --target=avr-none -T target-cpu=atmega328p --crate-type=rlib //@ [msp430] needs-llvm-components: msp430 //@ [msp430] compile-flags: --target=msp430-none-elf --crate-type=rlib //@ [amdgpu] needs-llvm-components: amdgpu -//@ [amdgpu] compile-flags: --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 --crate-type=rlib +//@ [amdgpu] compile-flags: --target amdgcn-amd-amdhsa -Ttarget-cpu=gfx900 --crate-type=rlib //@ [nvptx] needs-llvm-components: nvptx //@ [nvptx] compile-flags: --target nvptx64-nvidia-cuda --crate-type=rlib //@ ignore-backends: gcc diff --git a/tests/ui/abi/cannot-return.rs b/tests/ui/abi/cannot-return.rs index 9a5db30431b9f..ba737c7dc328b 100644 --- a/tests/ui/abi/cannot-return.rs +++ b/tests/ui/abi/cannot-return.rs @@ -4,7 +4,7 @@ //@ revisions: amdgpu nvptx // //@ [amdgpu] needs-llvm-components: amdgpu -//@ [amdgpu] compile-flags: --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 --crate-type=rlib +//@ [amdgpu] compile-flags: --target amdgcn-amd-amdhsa -Ttarget-cpu=gfx900 --crate-type=rlib //@ [nvptx] needs-llvm-components: nvptx //@ [nvptx] compile-flags: --target nvptx64-nvidia-cuda --crate-type=rlib #![no_core] diff --git a/tests/ui/abi/fixed_x18.rs b/tests/ui/abi/fixed_x18.rs index 0f09b0105fca5..cd1b84bb13ecf 100644 --- a/tests/ui/abi/fixed_x18.rs +++ b/tests/ui/abi/fixed_x18.rs @@ -1,10 +1,10 @@ -// This tests that -Zfixed-x18 causes a compilation failure on targets other than aarch64. +// This tests that -Tfixed-x18 causes a compilation failure on targets other than aarch64. // Behavior on aarch64 is tested by tests/codegen-llvm/fixed-x18.rs. // //@ revisions: x64 i686 arm riscv32 riscv64 //@ dont-check-compiler-stderr // -//@ compile-flags: -Zfixed-x18 +//@ compile-flags: -Tfixed-x18 -Zunstable-options //@ [x64] needs-llvm-components: x86 //@ [x64] compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib //@ [i686] needs-llvm-components: x86 @@ -28,4 +28,4 @@ trait MetaSized: PointeeSized {} #[lang = "sized"] trait Sized: MetaSized {} -//~? ERROR the `-Zfixed-x18` flag is not supported on the ` +//~? ERROR the `-Tfixed-x18` flag is not supported on the ` diff --git a/tests/ui/abi/interrupt-invalid-signature.rs b/tests/ui/abi/interrupt-invalid-signature.rs index 083d93fef0774..5d8c7901b4a5c 100644 --- a/tests/ui/abi/interrupt-invalid-signature.rs +++ b/tests/ui/abi/interrupt-invalid-signature.rs @@ -19,7 +19,7 @@ This test uses `cfg` because it is not testing whether these ABIs work on the pl //@ [riscv64] needs-llvm-components: riscv //@ [riscv64] compile-flags: --target=riscv64gc-unknown-none-elf --crate-type=rlib //@ [avr] needs-llvm-components: avr -//@ [avr] compile-flags: --target=avr-none -C target-cpu=atmega328p --crate-type=rlib +//@ [avr] compile-flags: --target=avr-none -T target-cpu=atmega328p --crate-type=rlib //@ [msp430] needs-llvm-components: msp430 //@ [msp430] compile-flags: --target=msp430-none-elf --crate-type=rlib //@ ignore-backends: gcc diff --git a/tests/ui/abi/interrupt-returns-never-or-unit.rs b/tests/ui/abi/interrupt-returns-never-or-unit.rs index 75786730a2ca4..c552008200b35 100644 --- a/tests/ui/abi/interrupt-returns-never-or-unit.rs +++ b/tests/ui/abi/interrupt-returns-never-or-unit.rs @@ -18,7 +18,7 @@ This test uses `cfg` because it is not testing whether these ABIs work on the pl //@ [riscv64] needs-llvm-components: riscv //@ [riscv64] compile-flags: --target=riscv64gc-unknown-none-elf --crate-type=rlib //@ [avr] needs-llvm-components: avr -//@ [avr] compile-flags: --target=avr-none -C target-cpu=atmega328p --crate-type=rlib +//@ [avr] compile-flags: --target=avr-none -T target-cpu=atmega328p --crate-type=rlib //@ [msp430] needs-llvm-components: msp430 //@ [msp430] compile-flags: --target=msp430-none-elf --crate-type=rlib //@ ignore-backends: gcc diff --git a/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs b/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs index 824327ad06d36..6ff14fa61a75f 100644 --- a/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs +++ b/tests/ui/abi/shadow-call-stack-without-fixed-x18.rs @@ -1,4 +1,4 @@ -//@ compile-flags: --target aarch64-unknown-none -Zsanitizer=shadow-call-stack +//@ compile-flags: --target aarch64-unknown-none -Tsanitizer=shadow-call-stack -Zunstable-options //@ dont-check-compiler-stderr //@ needs-llvm-components: aarch64 //@ ignore-backends: gcc diff --git a/tests/ui/asm/global-asm-isnt-really-a-mir-body.rs b/tests/ui/asm/global-asm-isnt-really-a-mir-body.rs index 94dab4235e093..2a10764faa605 100644 --- a/tests/ui/asm/global-asm-isnt-really-a-mir-body.rs +++ b/tests/ui/asm/global-asm-isnt-really-a-mir-body.rs @@ -10,7 +10,8 @@ //@[instrument] only-linux // Make sure we don't try to CFI encode it. -//@[cfi] compile-flags: -Zsanitizer=cfi -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Clink-dead-code=true +//@[cfi] compile-flags: -Tsanitizer=cfi -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Clink-dead-code=true +//@[cfi] compile-flags: -Zunstable-options //@[cfi] needs-sanitizer-cfi //@[cfi] no-prefer-dynamic // FIXME(#122848) Remove only-linux once OSX CFI binaries work diff --git a/tests/ui/cfg/cfg_target_object_format.rs b/tests/ui/cfg/cfg_target_object_format.rs index cea2027b35c0b..87a036a9d87e8 100644 --- a/tests/ui/cfg/cfg_target_object_format.rs +++ b/tests/ui/cfg/cfg_target_object_format.rs @@ -49,7 +49,7 @@ //@[bpfel] needs-llvm-components: bpf // //@ revisions: avr -//@[avr] compile-flags: --target avr-none -Ctarget-cpu=atmega328 +//@[avr] compile-flags: --target avr-none -Ttarget-cpu=atmega328 //@[avr] needs-llvm-components: avr // //@ revisions: msp430 diff --git a/tests/ui/compile-flags/invalid/branch-protection-missing-pac-ret.BADFLAGS.stderr b/tests/ui/compile-flags/invalid/branch-protection-missing-pac-ret.BADFLAGS.stderr index 277111a41f29c..4ed88fcceb538 100644 --- a/tests/ui/compile-flags/invalid/branch-protection-missing-pac-ret.BADFLAGS.stderr +++ b/tests/ui/compile-flags/invalid/branch-protection-missing-pac-ret.BADFLAGS.stderr @@ -1,2 +1,2 @@ -error: incorrect value `leaf` for unstable option `branch-protection` - a `,` separated combination of `bti`, `gcs`, `pac-ret`, (optionally with `pc`, `b-key`, `leaf` if `pac-ret` is set) was expected +error: incorrect value `leaf` for codegen option `branch-protection` - a `,` separated combination of `bti`, `gcs`, `pac-ret`, (optionally with `pc`, `b-key`, `leaf` if `pac-ret` is set) was expected diff --git a/tests/ui/compile-flags/invalid/branch-protection-missing-pac-ret.BADFLAGSPC.stderr b/tests/ui/compile-flags/invalid/branch-protection-missing-pac-ret.BADFLAGSPC.stderr index e1ade01d2fe76..13752a951c28b 100644 --- a/tests/ui/compile-flags/invalid/branch-protection-missing-pac-ret.BADFLAGSPC.stderr +++ b/tests/ui/compile-flags/invalid/branch-protection-missing-pac-ret.BADFLAGSPC.stderr @@ -1,2 +1,2 @@ -error: incorrect value `pc` for unstable option `branch-protection` - a `,` separated combination of `bti`, `gcs`, `pac-ret`, (optionally with `pc`, `b-key`, `leaf` if `pac-ret` is set) was expected +error: incorrect value `pc` for codegen option `branch-protection` - a `,` separated combination of `bti`, `gcs`, `pac-ret`, (optionally with `pc`, `b-key`, `leaf` if `pac-ret` is set) was expected diff --git a/tests/ui/compile-flags/invalid/branch-protection-missing-pac-ret.BADTARGET.stderr b/tests/ui/compile-flags/invalid/branch-protection-missing-pac-ret.BADTARGET.stderr index 7bc17c5c68c2b..0b55961eed727 100644 --- a/tests/ui/compile-flags/invalid/branch-protection-missing-pac-ret.BADTARGET.stderr +++ b/tests/ui/compile-flags/invalid/branch-protection-missing-pac-ret.BADTARGET.stderr @@ -1,4 +1,4 @@ -error: `-Zbranch-protection` is only supported on aarch64 +error: `-Tbranch-protection` is only supported on aarch64 error: aborting due to 1 previous error diff --git a/tests/ui/compile-flags/invalid/branch-protection-missing-pac-ret.rs b/tests/ui/compile-flags/invalid/branch-protection-missing-pac-ret.rs index bb23f9fe5c673..481d536cf32ab 100644 --- a/tests/ui/compile-flags/invalid/branch-protection-missing-pac-ret.rs +++ b/tests/ui/compile-flags/invalid/branch-protection-missing-pac-ret.rs @@ -1,11 +1,12 @@ +//@ compile-flags: -Zunstable-options //@ revisions: BADFLAGS BADFLAGSPC BADTARGET -//@ [BADFLAGS] compile-flags: --target=aarch64-unknown-linux-gnu -Zbranch-protection=leaf +//@ [BADFLAGS] compile-flags: --target=aarch64-unknown-linux-gnu -Tbranch-protection=leaf //@ [BADFLAGS] check-fail //@ [BADFLAGS] needs-llvm-components: aarch64 -//@ [BADFLAGSPC] compile-flags: --target=aarch64-unknown-linux-gnu -Zbranch-protection=pc +//@ [BADFLAGSPC] compile-flags: --target=aarch64-unknown-linux-gnu -Tbranch-protection=pc //@ [BADFLAGSPC] check-fail //@ [BADFLAGSPC] needs-llvm-components: aarch64 -//@ [BADTARGET] compile-flags: --target=x86_64-unknown-linux-gnu -Zbranch-protection=bti +//@ [BADTARGET] compile-flags: --target=x86_64-unknown-linux-gnu -Tbranch-protection=bti //@ [BADTARGET] check-fail //@ [BADTARGET] needs-llvm-components: x86 @@ -22,6 +23,6 @@ pub trait MetaSized: PointeeSized {} #[lang = "sized"] pub trait Sized: MetaSized {} -//[BADFLAGS]~? ERROR incorrect value `leaf` for unstable option `branch-protection` -//[BADFLAGSPC]~? ERROR incorrect value `pc` for unstable option `branch-protection` -//[BADTARGET]~? ERROR `-Zbranch-protection` is only supported on aarch64 +//[BADFLAGS]~? ERROR incorrect value `leaf` for codegen option `branch-protection` +//[BADFLAGSPC]~? ERROR incorrect value `pc` for codegen option `branch-protection` +//[BADTARGET]~? ERROR `-Tbranch-protection` is only supported on aarch64 diff --git a/tests/ui/compile-flags/invalid/indirect-branch-cs-prefix/requires-x86-or-x86_64.aarch64.stderr b/tests/ui/compile-flags/invalid/indirect-branch-cs-prefix/requires-x86-or-x86_64.aarch64.stderr index e3f7871da3524..aa74adb1b7946 100644 --- a/tests/ui/compile-flags/invalid/indirect-branch-cs-prefix/requires-x86-or-x86_64.aarch64.stderr +++ b/tests/ui/compile-flags/invalid/indirect-branch-cs-prefix/requires-x86-or-x86_64.aarch64.stderr @@ -1,4 +1,4 @@ -error: `-Zindirect-branch-cs-prefix` is only supported on x86 and x86_64 +error: `-Tindirect-branch-cs-prefix` is only supported on x86 and x86_64 error: aborting due to 1 previous error diff --git a/tests/ui/compile-flags/invalid/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs b/tests/ui/compile-flags/invalid/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs index f0409a6f07796..f9ad12e907920 100644 --- a/tests/ui/compile-flags/invalid/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs +++ b/tests/ui/compile-flags/invalid/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs @@ -1,6 +1,6 @@ //@ revisions: x86 x86_64 aarch64 -//@ compile-flags: -Zindirect-branch-cs-prefix +//@ compile-flags: -Tindirect-branch-cs-prefix -Zunstable-options //@[x86] check-pass //@[x86] needs-llvm-components: x86 @@ -19,4 +19,4 @@ #![no_core] #![no_main] -//[aarch64]~? ERROR `-Zindirect-branch-cs-prefix` is only supported on x86 and x86_64 +//[aarch64]~? ERROR `-Tindirect-branch-cs-prefix` is only supported on x86 and x86_64 diff --git a/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.aarch64.stderr b/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.aarch64.stderr index 9bc85cc7e62d8..99b7c4da1b889 100644 --- a/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.aarch64.stderr +++ b/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.aarch64.stderr @@ -1,4 +1,4 @@ -error: `-Zreg-struct-return` is only supported on x86 +error: `-Treg-struct-return` is only supported on x86 error: aborting due to 1 previous error diff --git a/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.rs b/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.rs index 321cf56cd2a0f..a09a73a87ff46 100644 --- a/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.rs +++ b/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.rs @@ -1,6 +1,6 @@ //@ revisions: x86 x86_64 aarch64 -//@ compile-flags: -Zreg-struct-return +//@ compile-flags: -Treg-struct-return -Zunstable-options //@[x86] check-pass //@[x86] needs-llvm-components: x86 @@ -19,5 +19,5 @@ #![no_core] #![no_main] -//[x86_64]~? ERROR `-Zreg-struct-return` is only supported on x86 -//[aarch64]~? ERROR `-Zreg-struct-return` is only supported on x86 +//[x86_64]~? ERROR `-Treg-struct-return` is only supported on x86 +//[aarch64]~? ERROR `-Treg-struct-return` is only supported on x86 diff --git a/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.x86_64.stderr b/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.x86_64.stderr index 9bc85cc7e62d8..99b7c4da1b889 100644 --- a/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.x86_64.stderr +++ b/tests/ui/compile-flags/invalid/reg-struct-return/requires-x86.x86_64.stderr @@ -1,4 +1,4 @@ -error: `-Zreg-struct-return` is only supported on x86 +error: `-Treg-struct-return` is only supported on x86 error: aborting due to 1 previous error diff --git a/tests/ui/compile-flags/invalid/regparm/regparm-valid-values.regparm4.stderr b/tests/ui/compile-flags/invalid/regparm/regparm-valid-values.regparm4.stderr index 8fc04adf57f56..81a5e846d5cc9 100644 --- a/tests/ui/compile-flags/invalid/regparm/regparm-valid-values.regparm4.stderr +++ b/tests/ui/compile-flags/invalid/regparm/regparm-valid-values.regparm4.stderr @@ -1,4 +1,4 @@ -error: `-Zregparm=4` is unsupported (valid values 0-3) +error: `-Tregparm=4` is unsupported (valid values 0-3) error: aborting due to 1 previous error diff --git a/tests/ui/compile-flags/invalid/regparm/regparm-valid-values.rs b/tests/ui/compile-flags/invalid/regparm/regparm-valid-values.rs index 6999eaac962aa..72364adb2a35f 100644 --- a/tests/ui/compile-flags/invalid/regparm/regparm-valid-values.rs +++ b/tests/ui/compile-flags/invalid/regparm/regparm-valid-values.rs @@ -1,26 +1,26 @@ //@ revisions: regparm0 regparm1 regparm2 regparm3 regparm4 //@ needs-llvm-components: x86 -//@ compile-flags: --target i686-unknown-linux-gnu +//@ compile-flags: --target i686-unknown-linux-gnu -Zunstable-options //@[regparm0] check-pass -//@[regparm0] compile-flags: -Zregparm=0 +//@[regparm0] compile-flags: -Tregparm=0 //@[regparm1] check-pass -//@[regparm1] compile-flags: -Zregparm=1 +//@[regparm1] compile-flags: -Tregparm=1 //@[regparm2] check-pass -//@[regparm2] compile-flags: -Zregparm=2 +//@[regparm2] compile-flags: -Tregparm=2 //@[regparm3] check-pass -//@[regparm3] compile-flags: -Zregparm=3 +//@[regparm3] compile-flags: -Tregparm=3 //@[regparm4] check-fail -//@[regparm4] compile-flags: -Zregparm=4 +//@[regparm4] compile-flags: -Tregparm=4 //@ ignore-backends: gcc #![feature(no_core)] #![no_core] #![no_main] -//[regparm4]~? ERROR `-Zregparm=4` is unsupported (valid values 0-3) +//[regparm4]~? ERROR `-Tregparm=4` is unsupported (valid values 0-3) diff --git a/tests/ui/compile-flags/invalid/regparm/requires-x86.aarch64.stderr b/tests/ui/compile-flags/invalid/regparm/requires-x86.aarch64.stderr index 2433519f803c8..234edaa8860e4 100644 --- a/tests/ui/compile-flags/invalid/regparm/requires-x86.aarch64.stderr +++ b/tests/ui/compile-flags/invalid/regparm/requires-x86.aarch64.stderr @@ -1,4 +1,4 @@ -error: `-Zregparm=N` is only supported on x86 +error: `-Tregparm=N` is only supported on x86 error: aborting due to 1 previous error diff --git a/tests/ui/compile-flags/invalid/regparm/requires-x86.rs b/tests/ui/compile-flags/invalid/regparm/requires-x86.rs index 983e412376dc0..3c0f0432a4421 100644 --- a/tests/ui/compile-flags/invalid/regparm/requires-x86.rs +++ b/tests/ui/compile-flags/invalid/regparm/requires-x86.rs @@ -1,6 +1,6 @@ //@ revisions: x86 x86_64 aarch64 -//@ compile-flags: -Zregparm=3 +//@ compile-flags: -Tregparm=3 -Zunstable-options //@[x86] check-pass //@[x86] needs-llvm-components: x86 @@ -19,5 +19,5 @@ #![no_core] #![no_main] -//[x86_64]~? ERROR `-Zregparm=N` is only supported on x86 -//[aarch64]~? ERROR `-Zregparm=N` is only supported on x86 +//[x86_64]~? ERROR `-Tregparm=N` is only supported on x86 +//[aarch64]~? ERROR `-Tregparm=N` is only supported on x86 diff --git a/tests/ui/compile-flags/invalid/regparm/requires-x86.x86_64.stderr b/tests/ui/compile-flags/invalid/regparm/requires-x86.x86_64.stderr index 2433519f803c8..234edaa8860e4 100644 --- a/tests/ui/compile-flags/invalid/regparm/requires-x86.x86_64.stderr +++ b/tests/ui/compile-flags/invalid/regparm/requires-x86.x86_64.stderr @@ -1,4 +1,4 @@ -error: `-Zregparm=N` is only supported on x86 +error: `-Tregparm=N` is only supported on x86 error: aborting due to 1 previous error diff --git a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs index 164bc1b5c29db..e491ecb66dad7 100644 --- a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs @@ -1,6 +1,6 @@ //@ add-minicore //@ needs-llvm-components: avr -//@ compile-flags: --target=avr-none -C target-cpu=atmega328p --crate-type=rlib +//@ compile-flags: --target=avr-none -T target-cpu=atmega328p --crate-type=rlib //@ ignore-backends: gcc #![no_core] #![feature(no_core, lang_items)] diff --git a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs index d442c9317f64e..54d225657b4da 100644 --- a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs +++ b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs @@ -1,7 +1,7 @@ //@ revisions: HOST AMDGPU NVPTX //@ add-minicore //@ compile-flags: --crate-type=rlib -//@[AMDGPU] compile-flags: --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx1100 +//@[AMDGPU] compile-flags: --target amdgcn-amd-amdhsa -Ttarget-cpu=gfx1100 //@[AMDGPU] needs-llvm-components: amdgpu //@[NVPTX] compile-flags: --target nvptx64-nvidia-cuda //@[NVPTX] needs-llvm-components: nvptx diff --git a/tests/ui/feature-gates/feature-gate-c_variadic_experimental_arch.rs b/tests/ui/feature-gates/feature-gate-c_variadic_experimental_arch.rs index 49c0bdf3a724b..d1820f98a3dd9 100644 --- a/tests/ui/feature-gates/feature-gate-c_variadic_experimental_arch.rs +++ b/tests/ui/feature-gates/feature-gate-c_variadic_experimental_arch.rs @@ -9,7 +9,7 @@ //@[sparc] compile-flags: --target sparc-unknown-none-elf //@[sparc] needs-llvm-components: sparc // -//@[avr] compile-flags: --target avr-none -Ctarget-cpu=atmega328p +//@[avr] compile-flags: --target avr-none -Ttarget-cpu=atmega328p //@[avr] needs-llvm-components: avr // //@[m68k] compile-flags: --target m68k-unknown-none-elf -Ctarget-cpu=M68020 diff --git a/tests/ui/lint/lint-gpu-kernel.rs b/tests/ui/lint/lint-gpu-kernel.rs index 9b3ed0d14d8ad..7ac97745b2774 100644 --- a/tests/ui/lint/lint-gpu-kernel.rs +++ b/tests/ui/lint/lint-gpu-kernel.rs @@ -6,7 +6,7 @@ //@ revisions: amdgpu nvptx //@ add-minicore //@ edition: 2024 -//@[amdgpu] compile-flags: --target amdgcn-amd-amdhsa -Ctarget-cpu=gfx900 +//@[amdgpu] compile-flags: --target amdgcn-amd-amdhsa -Ttarget-cpu=gfx900 //@[amdgpu] needs-llvm-components: amdgpu //@[nvptx] compile-flags: --target nvptx64-nvidia-cuda //@[nvptx] needs-llvm-components: nvptx diff --git a/tests/ui/pointer_authentication/enable_pointer_authentication_validation.all_unknown.stderr b/tests/ui/pointer_authentication/enable_pointer_authentication_validation.all_unknown.stderr index 47e61f2b8be73..18fba4735a7fb 100644 --- a/tests/ui/pointer_authentication/enable_pointer_authentication_validation.all_unknown.stderr +++ b/tests/ui/pointer_authentication/enable_pointer_authentication_validation.all_unknown.stderr @@ -1,2 +1,2 @@ -error: incorrect value `+I,+do,-not,-exist` for unstable option `pointer-authentication` - a comma-separated list of options, each of the form `+` or `-`, where `` is one of: `aarch64-jump-table-hardening`, `auth-traps`, `calls`, `elf-got`, `function-pointer-type-discrimination`, `indirect-gotos`, `init-fini`, `init-fini-address-discrimination`, `intrinsics`, `return-addresses`, `typeinfo-vt-ptr-discrimination`, `vt-ptr-addr-discrimination` or `vt-ptr-type-discrimination` was expected +error: incorrect value `+I,+do,-not,-exist` for codegen option `pointer-authentication` - a comma-separated list of options, each of the form `+` or `-`, where `` is one of: `aarch64-jump-table-hardening`, `auth-traps`, `calls`, `elf-got`, `function-pointer-type-discrimination`, `indirect-gotos`, `init-fini`, `init-fini-address-discrimination`, `intrinsics`, `return-addresses`, `typeinfo-vt-ptr-discrimination`, `vt-ptr-addr-discrimination` or `vt-ptr-type-discrimination` was expected diff --git a/tests/ui/pointer_authentication/enable_pointer_authentication_validation.empty.stderr b/tests/ui/pointer_authentication/enable_pointer_authentication_validation.empty.stderr index 9a4cd16c15a14..bd27df70ee216 100644 --- a/tests/ui/pointer_authentication/enable_pointer_authentication_validation.empty.stderr +++ b/tests/ui/pointer_authentication/enable_pointer_authentication_validation.empty.stderr @@ -1,2 +1,2 @@ -error: incorrect value `` for unstable option `pointer-authentication` - a comma-separated list of options, each of the form `+` or `-`, where `` is one of: `aarch64-jump-table-hardening`, `auth-traps`, `calls`, `elf-got`, `function-pointer-type-discrimination`, `indirect-gotos`, `init-fini`, `init-fini-address-discrimination`, `intrinsics`, `return-addresses`, `typeinfo-vt-ptr-discrimination`, `vt-ptr-addr-discrimination` or `vt-ptr-type-discrimination` was expected +error: incorrect value `` for codegen option `pointer-authentication` - a comma-separated list of options, each of the form `+` or `-`, where `` is one of: `aarch64-jump-table-hardening`, `auth-traps`, `calls`, `elf-got`, `function-pointer-type-discrimination`, `indirect-gotos`, `init-fini`, `init-fini-address-discrimination`, `intrinsics`, `return-addresses`, `typeinfo-vt-ptr-discrimination`, `vt-ptr-addr-discrimination` or `vt-ptr-type-discrimination` was expected diff --git a/tests/ui/pointer_authentication/enable_pointer_authentication_validation.mixed.stderr b/tests/ui/pointer_authentication/enable_pointer_authentication_validation.mixed.stderr index ea8b9250f31b9..f2fb32e62da5d 100644 --- a/tests/ui/pointer_authentication/enable_pointer_authentication_validation.mixed.stderr +++ b/tests/ui/pointer_authentication/enable_pointer_authentication_validation.mixed.stderr @@ -1,2 +1,2 @@ -error: incorrect value `+elf-got,-imaginary` for unstable option `pointer-authentication` - a comma-separated list of options, each of the form `+` or `-`, where `` is one of: `aarch64-jump-table-hardening`, `auth-traps`, `calls`, `elf-got`, `function-pointer-type-discrimination`, `indirect-gotos`, `init-fini`, `init-fini-address-discrimination`, `intrinsics`, `return-addresses`, `typeinfo-vt-ptr-discrimination`, `vt-ptr-addr-discrimination` or `vt-ptr-type-discrimination` was expected +error: incorrect value `+elf-got,-imaginary` for codegen option `pointer-authentication` - a comma-separated list of options, each of the form `+` or `-`, where `` is one of: `aarch64-jump-table-hardening`, `auth-traps`, `calls`, `elf-got`, `function-pointer-type-discrimination`, `indirect-gotos`, `init-fini`, `init-fini-address-discrimination`, `intrinsics`, `return-addresses`, `typeinfo-vt-ptr-discrimination`, `vt-ptr-addr-discrimination` or `vt-ptr-type-discrimination` was expected diff --git a/tests/ui/pointer_authentication/enable_pointer_authentication_validation.rs b/tests/ui/pointer_authentication/enable_pointer_authentication_validation.rs index d7306508f39d4..9a21332ddd06a 100644 --- a/tests/ui/pointer_authentication/enable_pointer_authentication_validation.rs +++ b/tests/ui/pointer_authentication/enable_pointer_authentication_validation.rs @@ -1,24 +1,25 @@ //@ ignore-backends: gcc //@ revisions: empty unprefixed all_unknown all_known mixed +//@ compile-flags: -Zunstable-options //@[empty] needs-llvm-components: aarch64 -//@[empty] compile-flags: --target aarch64-unknown-linux-pauthtest -Zpointer-authentication= +//@[empty] compile-flags: --target aarch64-unknown-linux-pauthtest -Tpointer-authentication= //@[unprefixed] needs-llvm-components: aarch64 -//@[unprefixed] compile-flags: --target aarch64-unknown-linux-pauthtest -Zpointer-authentication=auth-traps +//@[unprefixed] compile-flags: --target aarch64-unknown-linux-pauthtest -Tpointer-authentication=auth-traps //@[all_unknown] needs-llvm-components: aarch64 -//@[all_unknown] compile-flags: --target aarch64-unknown-linux-pauthtest -Zpointer-authentication=+I,+do,-not,-exist +//@[all_unknown] compile-flags: --target aarch64-unknown-linux-pauthtest -Tpointer-authentication=+I,+do,-not,-exist //@[all_known] check-pass //@[all_known] needs-llvm-components: aarch64 -//@[all_known] compile-flags: --target aarch64-unknown-linux-pauthtest -Zpointer-authentication=+elf-got,-init-fini +//@[all_known] compile-flags: --target aarch64-unknown-linux-pauthtest -Tpointer-authentication=+elf-got,-init-fini //@[mixed] needs-llvm-components: aarch64 -//@[mixed] compile-flags: --target aarch64-unknown-linux-pauthtest -Zpointer-authentication=+elf-got,-imaginary +//@[mixed] compile-flags: --target aarch64-unknown-linux-pauthtest -Tpointer-authentication=+elf-got,-imaginary #![feature(no_core)] #![no_std] #![no_main] #![no_core] -//[empty]~? ERROR incorrect value `` for unstable option `pointer-authentication` -//[unprefixed]~? ERROR incorrect value `auth-traps` for unstable option `pointer-authentication` -//[all_unknown]~? ERROR incorrect value `+I,+do,-not,-exist` for unstable option `pointer-authentication` -//[mixed]~? ERROR incorrect value `+elf-got,-imaginary` for unstable option `pointer-authentication` +//[empty]~? ERROR incorrect value `` for codegen option `pointer-authentication` +//[unprefixed]~? ERROR incorrect value `auth-traps` for codegen option `pointer-authentication` +//[all_unknown]~? ERROR incorrect value `+I,+do,-not,-exist` for codegen option `pointer-authentication` +//[mixed]~? ERROR incorrect value `+elf-got,-imaginary` for codegen option `pointer-authentication` diff --git a/tests/ui/pointer_authentication/enable_pointer_authentication_validation.unprefixed.stderr b/tests/ui/pointer_authentication/enable_pointer_authentication_validation.unprefixed.stderr index c6ff1e36350ee..8aec0241f834b 100644 --- a/tests/ui/pointer_authentication/enable_pointer_authentication_validation.unprefixed.stderr +++ b/tests/ui/pointer_authentication/enable_pointer_authentication_validation.unprefixed.stderr @@ -1,2 +1,2 @@ -error: incorrect value `auth-traps` for unstable option `pointer-authentication` - a comma-separated list of options, each of the form `+` or `-`, where `` is one of: `aarch64-jump-table-hardening`, `auth-traps`, `calls`, `elf-got`, `function-pointer-type-discrimination`, `indirect-gotos`, `init-fini`, `init-fini-address-discrimination`, `intrinsics`, `return-addresses`, `typeinfo-vt-ptr-discrimination`, `vt-ptr-addr-discrimination` or `vt-ptr-type-discrimination` was expected +error: incorrect value `auth-traps` for codegen option `pointer-authentication` - a comma-separated list of options, each of the form `+` or `-`, where `` is one of: `aarch64-jump-table-hardening`, `auth-traps`, `calls`, `elf-got`, `function-pointer-type-discrimination`, `indirect-gotos`, `init-fini`, `init-fini-address-discrimination`, `intrinsics`, `return-addresses`, `typeinfo-vt-ptr-discrimination`, `vt-ptr-addr-discrimination` or `vt-ptr-type-discrimination` was expected diff --git a/tests/ui/pointer_authentication/invalid_target_pointer_authentication.rs b/tests/ui/pointer_authentication/invalid_target_pointer_authentication.rs index 2d8b3b7a1915d..696c18319ceef 100644 --- a/tests/ui/pointer_authentication/invalid_target_pointer_authentication.rs +++ b/tests/ui/pointer_authentication/invalid_target_pointer_authentication.rs @@ -2,10 +2,10 @@ //@ check-pass //@ needs-llvm-components: aarch64 -//@ compile-flags: -Zpointer-authentication=-elf-got --crate-type=lib --target aarch64-unknown-linux-gnu +//@ compile-flags: -Zunstable-options -Tpointer-authentication=-elf-got --crate-type=lib --target aarch64-unknown-linux-gnu #![feature(no_core)] #![no_std] #![no_main] #![no_core] -//~? WARN `-Z pointer-authentication` is not supported for target aarch64-unknown-linux-gnu and will be ignored +//~? WARN `-T pointer-authentication` is not supported for target aarch64-unknown-linux-gnu and will be ignored diff --git a/tests/ui/pointer_authentication/invalid_target_pointer_authentication.stderr b/tests/ui/pointer_authentication/invalid_target_pointer_authentication.stderr index 1b1a33fd16c2b..ffe7be3bf56c9 100644 --- a/tests/ui/pointer_authentication/invalid_target_pointer_authentication.stderr +++ b/tests/ui/pointer_authentication/invalid_target_pointer_authentication.stderr @@ -1,4 +1,4 @@ -warning: `-Z pointer-authentication` is not supported for target aarch64-unknown-linux-gnu and will be ignored +warning: `-T pointer-authentication` is not supported for target aarch64-unknown-linux-gnu and will be ignored warning: 1 warning emitted diff --git a/tests/ui/pointer_authentication/type_discrimination_not_supported_pointer_authentication.rs b/tests/ui/pointer_authentication/type_discrimination_not_supported_pointer_authentication.rs index 6838e749fd333..f30d14472d456 100644 --- a/tests/ui/pointer_authentication/type_discrimination_not_supported_pointer_authentication.rs +++ b/tests/ui/pointer_authentication/type_discrimination_not_supported_pointer_authentication.rs @@ -2,7 +2,7 @@ //@ check-fail //@ needs-llvm-components: aarch64 -//@ compile-flags: -Zpointer-authentication=+function-pointer-type-discrimination --crate-type=lib --target aarch64-unknown-linux-pauthtest +//@ compile-flags: -Zunstable-options -Tpointer-authentication=+function-pointer-type-discrimination --crate-type=lib --target aarch64-unknown-linux-pauthtest #![feature(no_core)] #![no_std] diff --git a/tests/ui/repr/16-bit-repr-c-enum.rs b/tests/ui/repr/16-bit-repr-c-enum.rs index f981ea23ee24e..0d9a40aa7d2e2 100644 --- a/tests/ui/repr/16-bit-repr-c-enum.rs +++ b/tests/ui/repr/16-bit-repr-c-enum.rs @@ -3,7 +3,7 @@ //@ revisions: avr msp430 // //@ [avr] needs-llvm-components: avr -//@ [avr] compile-flags: --target=avr-none -C target-cpu=atmega328p --crate-type=rlib +//@ [avr] compile-flags: --target=avr-none -T target-cpu=atmega328p --crate-type=rlib //@ [msp430] needs-llvm-components: msp430 //@ [msp430] compile-flags: --target=msp430-none-elf --crate-type=rlib //@ ignore-backends: gcc diff --git a/tests/ui/sanitizer/cfg-kasan.rs b/tests/ui/sanitizer/cfg-kasan.rs index 2d934357adfe0..e505ffab0ee04 100644 --- a/tests/ui/sanitizer/cfg-kasan.rs +++ b/tests/ui/sanitizer/cfg-kasan.rs @@ -1,9 +1,9 @@ -// Verifies that when compiling with -Zsanitizer=kernel-address, +// Verifies that when compiling with -Tsanitizer=kernel-address, // the `#[cfg(sanitize = "address")]` attribute is configured. //@ add-minicore //@ check-pass -//@ compile-flags: -Zsanitizer=kernel-address +//@ compile-flags: -Tsanitizer=kernel-address -Zunstable-options //@ revisions: aarch64 riscv64imac riscv64gc x86_64 //@[aarch64] compile-flags: --target aarch64-unknown-none //@[aarch64] needs-llvm-components: aarch64 diff --git a/tests/ui/sanitizer/cfg-khwasan.rs b/tests/ui/sanitizer/cfg-khwasan.rs index 27a2f6030d0ba..d3f5fa415f247 100644 --- a/tests/ui/sanitizer/cfg-khwasan.rs +++ b/tests/ui/sanitizer/cfg-khwasan.rs @@ -3,7 +3,7 @@ //@ add-minicore //@ check-pass -//@ compile-flags: -Zsanitizer=kernel-hwaddress --target aarch64-unknown-none +//@ compile-flags: -Tsanitizer=kernel-hwaddress --target aarch64-unknown-none -Zunstable-options //@ needs-llvm-components: aarch64 //@ ignore-backends: gcc diff --git a/tests/ui/sanitizer/cfg.rs b/tests/ui/sanitizer/cfg.rs index 70914dcf93617..f562c7afc5df9 100644 --- a/tests/ui/sanitizer/cfg.rs +++ b/tests/ui/sanitizer/cfg.rs @@ -6,23 +6,23 @@ //@ revisions: address cfi kcfi leak memory thread //@compile-flags: -Ctarget-feature=-crt-static //@[address]needs-sanitizer-address -//@[address]compile-flags: -Zsanitizer=address +//@[address]compile-flags: -Csanitizer=address -Zunstable-options //@[cfi]needs-sanitizer-cfi -//@[cfi]compile-flags: -Zsanitizer=cfi +//@[cfi]compile-flags: -Tsanitizer=cfi -Zunstable-options //@[cfi]compile-flags: -Clto -Ccodegen-units=1 //@[kcfi]needs-llvm-components: x86 -//@[kcfi]compile-flags: -Zsanitizer=kcfi --target x86_64-unknown-none +//@[kcfi]compile-flags: -Tsanitizer=kcfi --target x86_64-unknown-none -Zunstable-options //@[kcfi]compile-flags: -C panic=abort //@[leak]needs-sanitizer-leak -//@[leak]compile-flags: -Zsanitizer=leak +//@[leak]compile-flags: -Csanitizer=leak -Zunstable-options //@[memory]needs-sanitizer-memory -//@[memory]compile-flags: -Zsanitizer=memory +//@[memory]compile-flags: -Tsanitizer=memory -Zunstable-options //@[thread]needs-sanitizer-thread -//@[thread]compile-flags: -Zsanitizer=thread +//@[thread]compile-flags: -Tsanitizer=thread -Zunstable-options //@ ignore-backends: gcc #![feature(cfg_sanitize, no_core)] -#![crate_type="lib"] +#![crate_type = "lib"] #![no_core] extern crate minicore; diff --git a/tests/ui/sanitizer/cfi/assoc-const-projection-issue-151878.rs b/tests/ui/sanitizer/cfi/assoc-const-projection-issue-151878.rs index 3fd33c7c1bb67..3e7fe04acc6d1 100644 --- a/tests/ui/sanitizer/cfi/assoc-const-projection-issue-151878.rs +++ b/tests/ui/sanitizer/cfi/assoc-const-projection-issue-151878.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Zsanitizer=cfi -Cunsafe-allow-abi-mismatch=sanitizer -Ccodegen-units=1 -Clto +//@ compile-flags: -Tsanitizer=cfi -Cunsafe-allow-abi-mismatch=sanitizer -Ccodegen-units=1 -Clto -Zunstable-options //@ needs-rustc-debug-assertions //@ needs-sanitizer-cfi //@ build-pass diff --git a/tests/ui/sanitizer/cfi/async-closures.rs b/tests/ui/sanitizer/cfi/async-closures.rs index 621a0882c91b2..e39af75e8fd57 100644 --- a/tests/ui/sanitizer/cfi/async-closures.rs +++ b/tests/ui/sanitizer/cfi/async-closures.rs @@ -9,8 +9,8 @@ //@ [kcfi] needs-sanitizer-kcfi //@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer //@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi +//@ [cfi] compile-flags: -T sanitizer=cfi -Z unstable-options +//@ [kcfi] compile-flags: -T sanitizer=kcfi -Z unstable-options //@ [kcfi] compile-flags: -C panic=abort -Z panic-abort-tests -C prefer-dynamic=off //@ run-pass diff --git a/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.rs b/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.rs index 36f6e3bc95e18..beb85dbddda3e 100644 --- a/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.rs +++ b/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.rs @@ -7,4 +7,4 @@ #![no_core] #![no_main] -//~? ERROR `-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi` +//~? ERROR `-Zsanitizer-cfi-canonical-jump-tables` requires `-Tsanitizer=cfi` diff --git a/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.stderr b/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.stderr index de67d6a6b7f06..5ce1755f0eb5c 100644 --- a/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.stderr +++ b/tests/ui/sanitizer/cfi/canonical-jump-tables-requires-cfi.stderr @@ -1,4 +1,4 @@ -error: `-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi` +error: `-Zsanitizer-cfi-canonical-jump-tables` requires `-Tsanitizer=cfi` error: aborting due to 1 previous error diff --git a/tests/ui/sanitizer/cfi/closures.rs b/tests/ui/sanitizer/cfi/closures.rs index 7493dba4928b0..df4bd24336251 100644 --- a/tests/ui/sanitizer/cfi/closures.rs +++ b/tests/ui/sanitizer/cfi/closures.rs @@ -8,8 +8,8 @@ //@ [kcfi] needs-sanitizer-kcfi //@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer //@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi +//@ [cfi] compile-flags: -T sanitizer=cfi -Z unstable-options +//@ [kcfi] compile-flags: -T sanitizer=kcfi -Z unstable-options //@ [kcfi] compile-flags: -C panic=abort -Z panic-abort-tests -C prefer-dynamic=off //@ compile-flags: --test //@ run-pass diff --git a/tests/ui/sanitizer/cfi/complex-receiver.rs b/tests/ui/sanitizer/cfi/complex-receiver.rs index adacc0d6c5df7..d0eb1ab38a31a 100644 --- a/tests/ui/sanitizer/cfi/complex-receiver.rs +++ b/tests/ui/sanitizer/cfi/complex-receiver.rs @@ -10,8 +10,8 @@ //@ [kcfi] needs-sanitizer-kcfi //@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer //@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi +//@ [cfi] compile-flags: -T sanitizer=cfi -Z unstable-options +//@ [kcfi] compile-flags: -T sanitizer=kcfi -Z unstable-options //@ [kcfi] compile-flags: -C panic=abort -C prefer-dynamic=off //@ run-pass diff --git a/tests/ui/sanitizer/cfi/coroutine.rs b/tests/ui/sanitizer/cfi/coroutine.rs index d85615b597de2..fca40cb9662e0 100644 --- a/tests/ui/sanitizer/cfi/coroutine.rs +++ b/tests/ui/sanitizer/cfi/coroutine.rs @@ -10,8 +10,8 @@ //@ compile-flags: -C target-feature=-crt-static //@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer //@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi +//@ [cfi] compile-flags: -T sanitizer=cfi -Z unstable-options +//@ [kcfi] compile-flags: -T sanitizer=kcfi -Z unstable-options //@ [kcfi] compile-flags: -C panic=abort -Z panic-abort-tests -C prefer-dynamic=off //@ compile-flags: --test //@ run-pass diff --git a/tests/ui/sanitizer/cfi/drop-in-place.rs b/tests/ui/sanitizer/cfi/drop-in-place.rs index fe59d54631248..f23186454be96 100644 --- a/tests/ui/sanitizer/cfi/drop-in-place.rs +++ b/tests/ui/sanitizer/cfi/drop-in-place.rs @@ -4,7 +4,7 @@ //@ only-linux //@ ignore-backends: gcc //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Copt-level=0 -Cprefer-dynamic=off -Ctarget-feature=-crt-static -Zsanitizer=cfi +//@ compile-flags: -Clto -Copt-level=0 -Cprefer-dynamic=off -Ctarget-feature=-crt-static -Tsanitizer=cfi -Zunstable-options //@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer //@ run-pass diff --git a/tests/ui/sanitizer/cfi/drop-no-principal.rs b/tests/ui/sanitizer/cfi/drop-no-principal.rs index 4fb905eb51d05..ab51defa9239b 100644 --- a/tests/ui/sanitizer/cfi/drop-no-principal.rs +++ b/tests/ui/sanitizer/cfi/drop-no-principal.rs @@ -4,7 +4,7 @@ // FIXME(#122848) Remove only-linux once OSX CFI binaries works //@ only-linux //@ ignore-backends: gcc -//@ compile-flags: --crate-type=bin -Cprefer-dynamic=off -Clto -Zsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: --crate-type=bin -Cprefer-dynamic=off -Clto -Tsanitizer=cfi -C unsafe-allow-abi-mismatch=sanitizer -Zunstable-options //@ compile-flags: -C target-feature=-crt-static -C codegen-units=1 -C opt-level=0 // FIXME(#118761) Should be run-pass once the labels on drop are compatible. // This test is being landed ahead of that to test that the compiler doesn't ICE while labeling the diff --git a/tests/ui/sanitizer/cfi/fn-ptr.rs b/tests/ui/sanitizer/cfi/fn-ptr.rs index bdb8c7ceb328c..acf9066559cf6 100644 --- a/tests/ui/sanitizer/cfi/fn-ptr.rs +++ b/tests/ui/sanitizer/cfi/fn-ptr.rs @@ -10,8 +10,8 @@ //@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer //@ [cfi] compile-flags: -C opt-level=0 -C codegen-units=1 -C lto //@ [cfi] compile-flags: -C prefer-dynamic=off -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi +//@ [cfi] compile-flags: -T sanitizer=cfi -Z unstable-options +//@ [kcfi] compile-flags: -T sanitizer=kcfi -Z unstable-options //@ [kcfi] compile-flags: -C panic=abort -C prefer-dynamic=off //@ run-pass diff --git a/tests/ui/sanitizer/cfi/fn-trait-objects.rs b/tests/ui/sanitizer/cfi/fn-trait-objects.rs index 977d4124fff0c..5cfda443c6016 100644 --- a/tests/ui/sanitizer/cfi/fn-trait-objects.rs +++ b/tests/ui/sanitizer/cfi/fn-trait-objects.rs @@ -4,7 +4,7 @@ //@ needs-sanitizer-cfi //@ only-linux //@ ignore-backends: gcc -//@ compile-flags: -Ctarget-feature=-crt-static -Ccodegen-units=1 -Clto -Cprefer-dynamic=off -Copt-level=0 -Zsanitizer=cfi -Cunsafe-allow-abi-mismatch=sanitizer --test +//@ compile-flags: -Ctarget-feature=-crt-static -Ccodegen-units=1 -Clto -Cprefer-dynamic=off -Copt-level=0 -Tsanitizer=cfi -Cunsafe-allow-abi-mismatch=sanitizer -Zunstable-options --test //@ run-pass #![feature(fn_traits)] diff --git a/tests/ui/sanitizer/cfi/generalize-pointers-attr-cfg.rs b/tests/ui/sanitizer/cfi/generalize-pointers-attr-cfg.rs index 44cdcb250e701..71433913adefd 100644 --- a/tests/ui/sanitizer/cfi/generalize-pointers-attr-cfg.rs +++ b/tests/ui/sanitizer/cfi/generalize-pointers-attr-cfg.rs @@ -3,7 +3,7 @@ // //@ needs-sanitizer-cfi //@ check-pass -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-generalize-pointers +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Tsanitizer=cfi -Zsanitizer-cfi-generalize-pointers -Zunstable-options //@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer #![feature(cfg_sanitizer_cfi)] diff --git a/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.rs b/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.rs index 83277da528c96..6b7c06b162963 100644 --- a/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.rs +++ b/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.rs @@ -8,4 +8,4 @@ #![no_core] #![no_main] -//~? ERROR `-Zsanitizer-cfi-generalize-pointers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi` +//~? ERROR `-Zsanitizer-cfi-generalize-pointers` requires `-Tsanitizer=cfi` or `-Tsanitizer=kcfi` diff --git a/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.stderr b/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.stderr index 621708de241c2..1145b0bb4b34d 100644 --- a/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.stderr +++ b/tests/ui/sanitizer/cfi/generalize-pointers-requires-cfi.stderr @@ -1,4 +1,4 @@ -error: `-Zsanitizer-cfi-generalize-pointers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi` +error: `-Zsanitizer-cfi-generalize-pointers` requires `-Tsanitizer=cfi` or `-Tsanitizer=kcfi` error: aborting due to 1 previous error diff --git a/tests/ui/sanitizer/cfi/invalid-attr-encoding.rs b/tests/ui/sanitizer/cfi/invalid-attr-encoding.rs index 23ffabad62fe8..3ac5c337a2a39 100644 --- a/tests/ui/sanitizer/cfi/invalid-attr-encoding.rs +++ b/tests/ui/sanitizer/cfi/invalid-attr-encoding.rs @@ -1,7 +1,7 @@ // Verifies that invalid user-defined CFI encodings can't be used. // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Tsanitizer=cfi -Zunstable-options #![feature(cfi_encoding, no_core)] #![no_core] diff --git a/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.aarch64.stderr b/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.aarch64.stderr index 7f596a19104e6..2183592ebaacc 100644 --- a/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.aarch64.stderr +++ b/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.aarch64.stderr @@ -1,6 +1,6 @@ error: cfi sanitizer is not supported for this target -error: `-Zsanitizer=cfi` is incompatible with `-Zsanitizer=kcfi` +error: `-Tsanitizer=cfi` is incompatible with `-Tsanitizer=kcfi` error: aborting due to 2 previous errors diff --git a/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.rs b/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.rs index 71cae90743078..c4fa8006536c4 100644 --- a/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.rs +++ b/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.rs @@ -5,7 +5,7 @@ //@ [aarch64] needs-llvm-components: aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-none //@ [x86_64] needs-llvm-components: x86 -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer=kcfi +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Tsanitizer=cfi -Tsanitizer=kcfi -Zunstable-options //@ ignore-backends: gcc #![feature(no_core)] @@ -13,4 +13,4 @@ #![no_main] //~? ERROR cfi sanitizer is not supported for this target -//~? ERROR `-Zsanitizer=cfi` is incompatible with `-Zsanitizer=kcfi` +//~? ERROR `-Tsanitizer=cfi` is incompatible with `-Tsanitizer=kcfi` diff --git a/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.x86_64.stderr b/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.x86_64.stderr index 7f596a19104e6..2183592ebaacc 100644 --- a/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.x86_64.stderr +++ b/tests/ui/sanitizer/cfi/is-incompatible-with-kcfi.x86_64.stderr @@ -1,6 +1,6 @@ error: cfi sanitizer is not supported for this target -error: `-Zsanitizer=cfi` is incompatible with `-Zsanitizer=kcfi` +error: `-Tsanitizer=cfi` is incompatible with `-Tsanitizer=kcfi` error: aborting due to 2 previous errors diff --git a/tests/ui/sanitizer/cfi/normalize-integers-attr-cfg.rs b/tests/ui/sanitizer/cfi/normalize-integers-attr-cfg.rs index ce4e31eb69b5a..8de9fb572a30f 100644 --- a/tests/ui/sanitizer/cfi/normalize-integers-attr-cfg.rs +++ b/tests/ui/sanitizer/cfi/normalize-integers-attr-cfg.rs @@ -1,9 +1,11 @@ -// Verifies that when compiling with `-Zsanitizer-cfi-normalize-integers` the +// Verifies that when compiling with `-Tsanitizer-cfi-normalize-integers` the // `#[cfg(sanitizer_cfi_normalize_integers)]` attribute is configured. // //@ needs-sanitizer-cfi //@ check-pass -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Tsanitizer=cfi +//@ compile-flags: -Tsanitizer-cfi-normalize-integers -Zunstable-options +//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer,sanitizer-cfi-normalize-integers #![feature(cfg_sanitizer_cfi)] diff --git a/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.rs b/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.rs index b9d5b9623d5f0..3f6175a1ba541 100644 --- a/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.rs +++ b/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.rs @@ -1,11 +1,12 @@ -// Verifies that `-Zsanitizer-cfi-normalize-integers` requires `-Zsanitizer=cfi` or -// `-Zsanitizer=kcfi` +// Verifies that `-Tsanitizer-cfi-normalize-integers` requires `-Tsanitizer=cfi` or +// `-Tsanitizer=kcfi` // //@ needs-sanitizer-cfi -//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer-cfi-normalize-integers +//@ compile-flags: -Clto -Cno-prepopulate-passes -Ctarget-feature=-crt-static +//@ compile-flags: -Tsanitizer-cfi-normalize-integers -Zunstable-options #![feature(no_core)] #![no_core] #![no_main] -//~? ERROR `-Zsanitizer-cfi-normalize-integers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi` +//~? ERROR `-Tsanitizer-cfi-normalize-integers` requires `-Tsanitizer=cfi` or `-Tsanitizer=kcfi` diff --git a/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.stderr b/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.stderr index 748fb60dad92e..b253ded6b4ed0 100644 --- a/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.stderr +++ b/tests/ui/sanitizer/cfi/normalize-integers-requires-cfi.stderr @@ -1,4 +1,4 @@ -error: `-Zsanitizer-cfi-normalize-integers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi` +error: `-Tsanitizer-cfi-normalize-integers` requires `-Tsanitizer=cfi` or `-Tsanitizer=kcfi` error: aborting due to 1 previous error diff --git a/tests/ui/sanitizer/cfi/requires-lto.rs b/tests/ui/sanitizer/cfi/requires-lto.rs index db83f5f6bf020..0e0fcb8e0a9c8 100644 --- a/tests/ui/sanitizer/cfi/requires-lto.rs +++ b/tests/ui/sanitizer/cfi/requires-lto.rs @@ -1,10 +1,10 @@ // Verifies that `-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto`. // //@ needs-sanitizer-cfi -//@ compile-flags: -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer=cfi +//@ compile-flags: -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Tsanitizer=cfi -Zunstable-options #![feature(no_core)] #![no_core] #![no_main] -//~? ERROR `-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto` +//~? ERROR `-Tsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto` diff --git a/tests/ui/sanitizer/cfi/requires-lto.stderr b/tests/ui/sanitizer/cfi/requires-lto.stderr index efc0c43138e12..2238d0ac5dfd5 100644 --- a/tests/ui/sanitizer/cfi/requires-lto.stderr +++ b/tests/ui/sanitizer/cfi/requires-lto.stderr @@ -1,4 +1,4 @@ -error: `-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto` +error: `-Tsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto` error: aborting due to 1 previous error diff --git a/tests/ui/sanitizer/cfi/self-ref.rs b/tests/ui/sanitizer/cfi/self-ref.rs index 827610a261064..d1100d98b2be9 100644 --- a/tests/ui/sanitizer/cfi/self-ref.rs +++ b/tests/ui/sanitizer/cfi/self-ref.rs @@ -8,8 +8,8 @@ //@ [kcfi] needs-sanitizer-kcfi //@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer //@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi +//@ [cfi] compile-flags: -T sanitizer=cfi -Z unstable-options +//@ [kcfi] compile-flags: -T sanitizer=kcfi -Z unstable-options //@ [kcfi] compile-flags: -C panic=abort -C prefer-dynamic=off //@ run-pass diff --git a/tests/ui/sanitizer/cfi/sized-associated-ty.rs b/tests/ui/sanitizer/cfi/sized-associated-ty.rs index da8c385c6fc8b..28e0305e901f0 100644 --- a/tests/ui/sanitizer/cfi/sized-associated-ty.rs +++ b/tests/ui/sanitizer/cfi/sized-associated-ty.rs @@ -9,8 +9,8 @@ //@ [kcfi] needs-sanitizer-kcfi //@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer //@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi +//@ [cfi] compile-flags: -T sanitizer=cfi -Z unstable-options +//@ [kcfi] compile-flags: -T sanitizer=kcfi -Z unstable-options //@ [kcfi] compile-flags: -C panic=abort -C prefer-dynamic=off //@ run-pass diff --git a/tests/ui/sanitizer/cfi/supertraits.rs b/tests/ui/sanitizer/cfi/supertraits.rs index b2782dff5d555..a0953732b1d6a 100644 --- a/tests/ui/sanitizer/cfi/supertraits.rs +++ b/tests/ui/sanitizer/cfi/supertraits.rs @@ -8,8 +8,8 @@ //@ [kcfi] needs-sanitizer-kcfi //@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer //@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi +//@ [cfi] compile-flags: -T sanitizer=cfi -Z unstable-options +//@ [kcfi] compile-flags: -T sanitizer=kcfi -Z unstable-options //@ [kcfi] compile-flags: -C panic=abort -C prefer-dynamic=off //@ run-pass diff --git a/tests/ui/sanitizer/cfi/virtual-auto.rs b/tests/ui/sanitizer/cfi/virtual-auto.rs index d3a715c079aa6..dee3b612e0c23 100644 --- a/tests/ui/sanitizer/cfi/virtual-auto.rs +++ b/tests/ui/sanitizer/cfi/virtual-auto.rs @@ -8,8 +8,8 @@ //@ [kcfi] needs-sanitizer-kcfi //@ compile-flags: -C target-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer //@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0 -//@ [cfi] compile-flags: -Z sanitizer=cfi -//@ [kcfi] compile-flags: -Z sanitizer=kcfi +//@ [cfi] compile-flags: -T sanitizer=cfi -Z unstable-options +//@ [kcfi] compile-flags: -T sanitizer=kcfi -Z unstable-options //@ [kcfi] compile-flags: -C panic=abort -C prefer-dynamic=off //@ run-pass diff --git a/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.rs b/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.rs index 4ef5b6756a495..c468efbd37ac5 100644 --- a/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.rs +++ b/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.rs @@ -1,10 +1,10 @@ -// Verifies that `-Zsanitizer=cfi` with `-Clto` or `-Clto=thin` requires `-Ccodegen-units=1`. +// Verifies that `-Tsanitizer=cfi` with `-Clto` or `-Clto=thin` requires `-Ccodegen-units=1`. // //@ needs-sanitizer-cfi -//@ compile-flags: -Ccodegen-units=2 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi +//@ compile-flags: -Ccodegen-units=2 -Clto -Ctarget-feature=-crt-static -Tsanitizer=cfi -Zunstable-options #![feature(no_core)] #![no_core] #![no_main] -//~? ERROR `-Zsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1` +//~? ERROR `-Tsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1` diff --git a/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.stderr b/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.stderr index 8d6dc1d8f1ea4..17baa86534e0b 100644 --- a/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.stderr +++ b/tests/ui/sanitizer/cfi/with-rustc-lto-requires-single-codegen-unit.stderr @@ -1,4 +1,4 @@ -error: `-Zsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1` +error: `-Tsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1` error: aborting due to 1 previous error diff --git a/tests/ui/sanitizer/crt-static.rs b/tests/ui/sanitizer/crt-static.rs index b8bdf28351c3d..e58b9d199b6de 100644 --- a/tests/ui/sanitizer/crt-static.rs +++ b/tests/ui/sanitizer/crt-static.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Z sanitizer=address -C target-feature=+crt-static --target x86_64-unknown-linux-gnu +//@ compile-flags: -C sanitizer=address -C target-feature=+crt-static --target x86_64-unknown-linux-gnu -Z unstable-options //@ needs-llvm-components: x86 #![feature(no_core)] diff --git a/tests/ui/sanitizer/incompatible-khwasan.rs b/tests/ui/sanitizer/incompatible-khwasan.rs index eb6a5d33a472b..be7b1d4d57837 100644 --- a/tests/ui/sanitizer/incompatible-khwasan.rs +++ b/tests/ui/sanitizer/incompatible-khwasan.rs @@ -1,4 +1,5 @@ -//@ compile-flags: -Z sanitizer=kernel-hwaddress -Z sanitizer=kernel-address --target aarch64-unknown-none +//@ compile-flags: -T sanitizer=kernel-hwaddress -T sanitizer=kernel-address --target aarch64-unknown-none +//@ compile-flags: -Z unstable-options //@ needs-llvm-components: aarch64 //@ ignore-backends: gcc @@ -6,4 +7,4 @@ #![no_core] #![no_main] -//~? ERROR `-Zsanitizer=kernel-address` is incompatible with `-Zsanitizer=kernel-hwaddress` +//~? ERROR `-Tsanitizer=kernel-address` is incompatible with `-Tsanitizer=kernel-hwaddress` diff --git a/tests/ui/sanitizer/incompatible-khwasan.stderr b/tests/ui/sanitizer/incompatible-khwasan.stderr index 35246fb266230..6b7b8176b1eb5 100644 --- a/tests/ui/sanitizer/incompatible-khwasan.stderr +++ b/tests/ui/sanitizer/incompatible-khwasan.stderr @@ -1,4 +1,4 @@ -error: `-Zsanitizer=kernel-address` is incompatible with `-Zsanitizer=kernel-hwaddress` +error: `-Tsanitizer=kernel-address` is incompatible with `-Tsanitizer=kernel-hwaddress` error: aborting due to 1 previous error diff --git a/tests/ui/sanitizer/incompatible.rs b/tests/ui/sanitizer/incompatible.rs index c706a5a2e4e7b..55f3a0a08de0f 100644 --- a/tests/ui/sanitizer/incompatible.rs +++ b/tests/ui/sanitizer/incompatible.rs @@ -1,8 +1,8 @@ -//@ compile-flags: -Z sanitizer=address -Z sanitizer=memory --target x86_64-unknown-linux-gnu +//@ compile-flags: -Csanitizer=address -Tsanitizer=memory --target x86_64-unknown-linux-gnu -Zunstable-options //@ needs-llvm-components: x86 #![feature(no_core)] #![no_core] #![no_main] -//~? ERROR `-Zsanitizer=address` is incompatible with `-Zsanitizer=memory` +//~? ERROR `-Csanitizer=address` is incompatible with `-Tsanitizer=memory` diff --git a/tests/ui/sanitizer/incompatible.stderr b/tests/ui/sanitizer/incompatible.stderr index 4dff813ee1be6..68b31b0624a9f 100644 --- a/tests/ui/sanitizer/incompatible.stderr +++ b/tests/ui/sanitizer/incompatible.stderr @@ -1,4 +1,4 @@ -error: `-Zsanitizer=address` is incompatible with `-Zsanitizer=memory` +error: `-Csanitizer=address` is incompatible with `-Tsanitizer=memory` error: aborting due to 1 previous error diff --git a/tests/ui/sanitizer/issue-114275-cfi-const-expr-in-arry-len.rs b/tests/ui/sanitizer/issue-114275-cfi-const-expr-in-arry-len.rs index f7af2842ad613..16cd4714153e0 100644 --- a/tests/ui/sanitizer/issue-114275-cfi-const-expr-in-arry-len.rs +++ b/tests/ui/sanitizer/issue-114275-cfi-const-expr-in-arry-len.rs @@ -2,7 +2,7 @@ // was expecting array type lengths to be evaluated, this was causing an ICE. // //@ build-pass -//@ compile-flags: -Ccodegen-units=1 -Clto -Zsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Ccodegen-units=1 -Clto -Tsanitizer=cfi -Ctarget-feature=-crt-static -C unsafe-allow-abi-mismatch=sanitizer -Zunstable-options //@ needs-sanitizer-cfi #![crate_type = "lib"] diff --git a/tests/ui/sanitizer/kcfi-arity-requires-kcfi.rs b/tests/ui/sanitizer/kcfi-arity-requires-kcfi.rs index 12aabb3b86236..d617196aed563 100644 --- a/tests/ui/sanitizer/kcfi-arity-requires-kcfi.rs +++ b/tests/ui/sanitizer/kcfi-arity-requires-kcfi.rs @@ -3,7 +3,7 @@ //@ needs-sanitizer-kcfi //@ compile-flags: -Cno-prepopulate-passes -Ctarget-feature=-crt-static -Zsanitizer-kcfi-arity -//~? ERROR `-Zsanitizer-kcfi-arity` requires `-Zsanitizer=kcfi` +//~? ERROR `-Zsanitizer-kcfi-arity` requires `-Tsanitizer=kcfi` #![feature(no_core)] #![no_core] #![no_main] diff --git a/tests/ui/sanitizer/kcfi-arity-requires-kcfi.stderr b/tests/ui/sanitizer/kcfi-arity-requires-kcfi.stderr index 4ed1b754fd431..75cdd9487006e 100644 --- a/tests/ui/sanitizer/kcfi-arity-requires-kcfi.stderr +++ b/tests/ui/sanitizer/kcfi-arity-requires-kcfi.stderr @@ -1,4 +1,4 @@ -error: `-Zsanitizer-kcfi-arity` requires `-Zsanitizer=kcfi` +error: `-Zsanitizer-kcfi-arity` requires `-Tsanitizer=kcfi` error: aborting due to 1 previous error diff --git a/tests/ui/sanitizer/kcfi-c-variadic.rs b/tests/ui/sanitizer/kcfi-c-variadic.rs index 2f88ccfb1269c..1541e584216f5 100644 --- a/tests/ui/sanitizer/kcfi-c-variadic.rs +++ b/tests/ui/sanitizer/kcfi-c-variadic.rs @@ -1,6 +1,7 @@ //@ needs-sanitizer-kcfi //@ no-prefer-dynamic -//@ compile-flags: -Zsanitizer=kcfi -Cpanic=abort -Cunsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Tsanitizer=kcfi -Cpanic=abort -Cunsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -Zunstable-options //@ ignore-backends: gcc //@ run-pass diff --git a/tests/ui/sanitizer/kcfi-mangling.rs b/tests/ui/sanitizer/kcfi-mangling.rs index 371f34ba72af2..ff03254cd346d 100644 --- a/tests/ui/sanitizer/kcfi-mangling.rs +++ b/tests/ui/sanitizer/kcfi-mangling.rs @@ -2,7 +2,8 @@ //@ needs-sanitizer-kcfi //@ no-prefer-dynamic -//@ compile-flags: -C panic=abort -Zsanitizer=kcfi -C symbol-mangling-version=v0 -C unsafe-allow-abi-mismatch=sanitizer +//@ compile-flags: -C panic=abort -Tsanitizer=kcfi -C symbol-mangling-version=v0 +//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer -Zunstable-options //@ build-pass //@ ignore-backends: gcc diff --git a/tests/ui/sanitizer/kcfi/fn-trait-objects.rs b/tests/ui/sanitizer/kcfi/fn-trait-objects.rs index 3f6b78545a0a1..7d6ea9148a30e 100644 --- a/tests/ui/sanitizer/kcfi/fn-trait-objects.rs +++ b/tests/ui/sanitizer/kcfi/fn-trait-objects.rs @@ -4,7 +4,7 @@ //@ needs-sanitizer-kcfi //@ only-linux //@ ignore-backends: gcc -//@ compile-flags: -Ctarget-feature=-crt-static -Zpanic_abort_tests -Cpanic=abort -Cprefer-dynamic=off -Copt-level=0 -Zsanitizer=kcfi -Cunsafe-allow-abi-mismatch=sanitizer --test +//@ compile-flags: -Ctarget-feature=-crt-static -Zpanic_abort_tests -Cpanic=abort -Cprefer-dynamic=off -Copt-level=0 -Tsanitizer=kcfi -Cunsafe-allow-abi-mismatch=sanitizer --test -Zunstable-options //@ run-pass #![feature(fn_traits)] diff --git a/tests/ui/sanitizer/unsupported-target-khwasan.rs b/tests/ui/sanitizer/unsupported-target-khwasan.rs index bef6d95e57b21..1a3c3167f1472 100644 --- a/tests/ui/sanitizer/unsupported-target-khwasan.rs +++ b/tests/ui/sanitizer/unsupported-target-khwasan.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Z sanitizer=kernel-hwaddress --target x86_64-unknown-none +//@ compile-flags: -Tsanitizer=kernel-hwaddress --target x86_64-unknown-none -Zunstable-options //@ needs-llvm-components: x86 //@ ignore-backends: gcc diff --git a/tests/ui/sanitizer/unsupported-target.rs b/tests/ui/sanitizer/unsupported-target.rs index 0776c769e0796..092e31f666b96 100644 --- a/tests/ui/sanitizer/unsupported-target.rs +++ b/tests/ui/sanitizer/unsupported-target.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Z sanitizer=leak --target i686-unknown-linux-gnu +//@ compile-flags: -Csanitizer=leak --target i686-unknown-linux-gnu -Zunstable-options //@ needs-llvm-components: x86 //@ ignore-backends: gcc diff --git a/tests/ui/target-cpu/explicit-target-cpu.amdgcn_nocpu.stderr b/tests/ui/target-cpu/explicit-target-cpu.amdgcn_nocpu.stderr index 7480a8ed38f15..c2b1a09cf7f98 100644 --- a/tests/ui/target-cpu/explicit-target-cpu.amdgcn_nocpu.stderr +++ b/tests/ui/target-cpu/explicit-target-cpu.amdgcn_nocpu.stderr @@ -1,4 +1,4 @@ -error: target requires explicitly specifying a cpu with `-C target-cpu` +error: target requires explicitly specifying a cpu with `-T target-cpu` error: aborting due to 1 previous error diff --git a/tests/ui/target-cpu/explicit-target-cpu.avr_nocpu.stderr b/tests/ui/target-cpu/explicit-target-cpu.avr_nocpu.stderr index 7480a8ed38f15..c2b1a09cf7f98 100644 --- a/tests/ui/target-cpu/explicit-target-cpu.avr_nocpu.stderr +++ b/tests/ui/target-cpu/explicit-target-cpu.avr_nocpu.stderr @@ -1,4 +1,4 @@ -error: target requires explicitly specifying a cpu with `-C target-cpu` +error: target requires explicitly specifying a cpu with `-T target-cpu` error: aborting due to 1 previous error diff --git a/tests/ui/target-cpu/explicit-target-cpu.rs b/tests/ui/target-cpu/explicit-target-cpu.rs index 29f8e9de1f6ea..65cdb5ea49249 100644 --- a/tests/ui/target-cpu/explicit-target-cpu.rs +++ b/tests/ui/target-cpu/explicit-target-cpu.rs @@ -1,4 +1,4 @@ -//! Check that certain target *requires* the user to specify a target CPU via `-C target-cpu`. +//! Check that certain target *requires* the user to specify a target CPU via `-T target-cpu`. //@ revisions: amdgcn_nocpu amdgcn_cpu @@ -8,7 +8,7 @@ //@[amdgcn_cpu] compile-flags: --target=amdgcn-amd-amdhsa //@[amdgcn_cpu] needs-llvm-components: amdgpu -//@[amdgcn_cpu] compile-flags: -Ctarget-cpu=gfx900 +//@[amdgcn_cpu] compile-flags: -Ttarget-cpu=gfx900 //@[amdgcn_cpu] build-pass //@ revisions: avr_nocpu avr_cpu @@ -19,16 +19,16 @@ //@[avr_cpu] compile-flags: --target=avr-none //@[avr_cpu] needs-llvm-components: avr -//@[avr_cpu] compile-flags: -Ctarget-cpu=atmega328p +//@[avr_cpu] compile-flags: -Ttarget-cpu=atmega328p //@[avr_cpu] build-pass //@ ignore-backends: gcc #![crate_type = "rlib"] // We don't want to link in any other crate as this would make it necessary to specify -// a `-Ctarget-cpu` for them resulting in a *target-modifier* disagreement error instead of the +// a `-Ttarget-cpu` for them resulting in a *target-modifier* disagreement error instead of the // error mentioned below. #![feature(no_core)] #![no_core] -//[amdgcn_nocpu,avr_nocpu]~? ERROR target requires explicitly specifying a cpu with `-C target-cpu` +//[amdgcn_nocpu,avr_nocpu]~? ERROR target requires explicitly specifying a cpu with `-T target-cpu` diff --git a/tests/ui/target-cpu/unsupported-target-cpu.rs b/tests/ui/target-cpu/unsupported-target-cpu.rs index dafbfbc015ec1..4e92cce5ee07a 100644 --- a/tests/ui/target-cpu/unsupported-target-cpu.rs +++ b/tests/ui/target-cpu/unsupported-target-cpu.rs @@ -2,7 +2,7 @@ //@ revisions: nvptx-sm60 -//@[nvptx-sm60] compile-flags: --target=nvptx64-nvidia-cuda --crate-type=rlib -Ctarget-cpu=sm_60 +//@[nvptx-sm60] compile-flags: --target=nvptx64-nvidia-cuda --crate-type=rlib -Ttarget-cpu=sm_60 //@[nvptx-sm60] needs-llvm-components: nvptx //@[nvptx-sm60] build-fail //@ ignore-backends: gcc diff --git a/tests/ui/target-feature/retpoline-target-feature-flag.rs b/tests/ui/target-feature/retpoline-target-feature-flag.rs index 182b5b86520ce..6d9db7b054781 100644 --- a/tests/ui/target-feature/retpoline-target-feature-flag.rs +++ b/tests/ui/target-feature/retpoline-target-feature-flag.rs @@ -1,8 +1,8 @@ //@ add-minicore //@ revisions: by_flag by_feature1 by_feature2 by_feature3 -//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib +//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib -Zunstable-options //@ needs-llvm-components: x86 -//@ [by_flag]compile-flags: -Zretpoline +//@ [by_flag]compile-flags: -Tretpoline //@ [by_feature1]compile-flags: -Ctarget-feature=+retpoline-external-thunk //@ [by_feature2]compile-flags: -Ctarget-feature=+retpoline-indirect-branches diff --git a/tests/ui/target_modifiers/auxiliary/enabled_reg_struct_return.rs b/tests/ui/target_modifiers/auxiliary/enabled_reg_struct_return.rs index 4bda4ba24c548..8f83a032e414d 100644 --- a/tests/ui/target_modifiers/auxiliary/enabled_reg_struct_return.rs +++ b/tests/ui/target_modifiers/auxiliary/enabled_reg_struct_return.rs @@ -1,5 +1,5 @@ //@ no-prefer-dynamic -//@ compile-flags: --target i686-unknown-linux-gnu -Zreg-struct-return=true +//@ compile-flags: --target i686-unknown-linux-gnu -Treg-struct-return=true -Zunstable-options //@ needs-llvm-components: x86 #![feature(no_core)] diff --git a/tests/ui/target_modifiers/auxiliary/fixed_x18.rs b/tests/ui/target_modifiers/auxiliary/fixed_x18.rs index 32eff76ec54c4..b42b03a22e3f9 100644 --- a/tests/ui/target_modifiers/auxiliary/fixed_x18.rs +++ b/tests/ui/target_modifiers/auxiliary/fixed_x18.rs @@ -1,5 +1,5 @@ //@ no-prefer-dynamic -//@ compile-flags: --target aarch64-unknown-none -Zfixed-x18 +//@ compile-flags: --target aarch64-unknown-none -Tfixed-x18 -Zunstable-options //@ needs-llvm-components: aarch64 #![feature(no_core)] diff --git a/tests/ui/target_modifiers/auxiliary/kcfi-normalize-ints.rs b/tests/ui/target_modifiers/auxiliary/kcfi-normalize-ints.rs index f97005a14502d..9d213041e35bd 100644 --- a/tests/ui/target_modifiers/auxiliary/kcfi-normalize-ints.rs +++ b/tests/ui/target_modifiers/auxiliary/kcfi-normalize-ints.rs @@ -1,6 +1,6 @@ //@ no-prefer-dynamic //@ needs-sanitizer-kcfi -//@ compile-flags: -C panic=abort -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers +//@ compile-flags: -C panic=abort -Tsanitizer=kcfi -Tsanitizer-cfi-normalize-integers -Zunstable-options #![feature(no_core)] #![crate_type = "rlib"] diff --git a/tests/ui/target_modifiers/auxiliary/target_cpu_default_explicit.rs b/tests/ui/target_modifiers/auxiliary/target_cpu_default_explicit.rs index 3c56f64dfdb3a..1b29a1f3d01c2 100644 --- a/tests/ui/target_modifiers/auxiliary/target_cpu_default_explicit.rs +++ b/tests/ui/target_modifiers/auxiliary/target_cpu_default_explicit.rs @@ -1,5 +1,5 @@ //@ no-prefer-dynamic -//@ compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_70 +//@ compile-flags: --target nvptx64-nvidia-cuda -Ttarget-cpu=sm_70 //@ needs-llvm-components: nvptx //@ ignore-backends: gcc diff --git a/tests/ui/target_modifiers/auxiliary/target_cpu_non_default.rs b/tests/ui/target_modifiers/auxiliary/target_cpu_non_default.rs index a4fa7e2a33af6..11912587520fe 100644 --- a/tests/ui/target_modifiers/auxiliary/target_cpu_non_default.rs +++ b/tests/ui/target_modifiers/auxiliary/target_cpu_non_default.rs @@ -1,5 +1,5 @@ //@ no-prefer-dynamic -//@ compile-flags: --target nvptx64-nvidia-cuda -Ctarget-cpu=sm_80 +//@ compile-flags: --target nvptx64-nvidia-cuda -Ttarget-cpu=sm_80 //@ needs-llvm-components: nvptx //@ ignore-backends: gcc diff --git a/tests/ui/target_modifiers/auxiliary/wrong_regparm.rs b/tests/ui/target_modifiers/auxiliary/wrong_regparm.rs index 267292faecd5a..b4de16f2806c1 100644 --- a/tests/ui/target_modifiers/auxiliary/wrong_regparm.rs +++ b/tests/ui/target_modifiers/auxiliary/wrong_regparm.rs @@ -1,5 +1,5 @@ //@ no-prefer-dynamic -//@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=2 +//@ compile-flags: --target i686-unknown-linux-gnu -Tregparm=2 -Zunstable-options //@ needs-llvm-components: x86 #![feature(no_core)] diff --git a/tests/ui/target_modifiers/auxiliary/wrong_regparm_and_ret.rs b/tests/ui/target_modifiers/auxiliary/wrong_regparm_and_ret.rs index 82ee3e71d16a8..a4bf165ab36ff 100644 --- a/tests/ui/target_modifiers/auxiliary/wrong_regparm_and_ret.rs +++ b/tests/ui/target_modifiers/auxiliary/wrong_regparm_and_ret.rs @@ -1,5 +1,6 @@ //@ no-prefer-dynamic -//@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=2 -Zreg-struct-return=true +//@ compile-flags: --target i686-unknown-linux-gnu -Tregparm=2 -Treg-struct-return=true +//@ compile-flags: -Zunstable-options //@ needs-llvm-components: x86 #![feature(no_core)] diff --git a/tests/ui/target_modifiers/defaults_check.error.stderr b/tests/ui/target_modifiers/defaults_check.error.stderr index 106e64ff29356..d8779c40c817f 100644 --- a/tests/ui/target_modifiers/defaults_check.error.stderr +++ b/tests/ui/target_modifiers/defaults_check.error.stderr @@ -1,12 +1,12 @@ -error: mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `defaults_check` - --> $DIR/defaults_check.rs:16:1 +error: mixing `-Treg-struct-return` will cause an ABI mismatch in crate `defaults_check` + --> $DIR/defaults_check.rs:15:1 | LL | #![feature(no_core)] | ^ | - = help: the `-Zreg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: `-Zreg-struct-return=true` in this crate is incompatible with `-Zreg-struct-return` being unset in dependency `default_reg_struct_return` - = help: unset `-Zreg-struct-return` in this crate or set `-Zreg-struct-return=true` in `default_reg_struct_return` + = help: the `-Treg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely + = note: unset `-Treg-struct-return` in `default_reg_struct_return` is incompatible with `-Treg-struct-return` in this crate + = help: set `-Treg-struct-return` in `default_reg_struct_return`, unset `-Treg-struct-return` in this crate, or use `-Creg-struct-return` in this crate instead = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=reg-struct-return` to silence this error error: aborting due to 1 previous error diff --git a/tests/ui/target_modifiers/defaults_check.error_explicit.stderr b/tests/ui/target_modifiers/defaults_check.error_explicit.stderr new file mode 100644 index 0000000000000..d8779c40c817f --- /dev/null +++ b/tests/ui/target_modifiers/defaults_check.error_explicit.stderr @@ -0,0 +1,13 @@ +error: mixing `-Treg-struct-return` will cause an ABI mismatch in crate `defaults_check` + --> $DIR/defaults_check.rs:15:1 + | +LL | #![feature(no_core)] + | ^ + | + = help: the `-Treg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely + = note: unset `-Treg-struct-return` in `default_reg_struct_return` is incompatible with `-Treg-struct-return` in this crate + = help: set `-Treg-struct-return` in `default_reg_struct_return`, unset `-Treg-struct-return` in this crate, or use `-Creg-struct-return` in this crate instead + = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=reg-struct-return` to silence this error + +error: aborting due to 1 previous error + diff --git a/tests/ui/target_modifiers/defaults_check.rs b/tests/ui/target_modifiers/defaults_check.rs index af42ee92a826d..3a0433220e80f 100644 --- a/tests/ui/target_modifiers/defaults_check.rs +++ b/tests/ui/target_modifiers/defaults_check.rs @@ -2,19 +2,19 @@ // with the same value, explicitly specified //@ aux-build:default_reg_struct_return.rs -//@ compile-flags: --target i686-unknown-linux-gnu -Cpanic=abort +//@ compile-flags: --target i686-unknown-linux-gnu -Cpanic=abort -Zunstable-options //@ needs-llvm-components: x86 -//@ revisions: ok ok_explicit error +//@ revisions: ok error_explicit error // [ok] no extra compile-flags -//@[ok_explicit] compile-flags: -Zreg-struct-return=false -//@[error] compile-flags: -Zreg-struct-return=true +//@[error_explicit] compile-flags: -Treg-struct-return=false +//@[error] compile-flags: -Treg-struct-return=true //@[ok] check-pass -//@[ok_explicit] check-pass //@ ignore-backends: gcc #![feature(no_core)] -//[error]~^ ERROR mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `defaults_check` +//[error_explicit]~^ ERROR mixing `-Treg-struct-return` will cause an ABI mismatch in crate `defaults_check` +//[error]~^^ ERROR mixing `-Treg-struct-return` will cause an ABI mismatch in crate `defaults_check` #![crate_type = "rlib"] #![no_core] diff --git a/tests/ui/target_modifiers/incompatible_fixedx18.error_generated.stderr b/tests/ui/target_modifiers/incompatible_fixedx18.error_generated.stderr index bcdee625830a7..fca40eb50def4 100644 --- a/tests/ui/target_modifiers/incompatible_fixedx18.error_generated.stderr +++ b/tests/ui/target_modifiers/incompatible_fixedx18.error_generated.stderr @@ -1,12 +1,12 @@ -error: mixing `-Zfixed-x18` will cause an ABI mismatch in crate `incompatible_fixedx18` +error: mixing `-Tfixed-x18` will cause an ABI mismatch in crate `incompatible_fixedx18` --> $DIR/incompatible_fixedx18.rs:13:1 | LL | #![feature(no_core)] | ^ | - = help: the `-Zfixed-x18` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: `-Zfixed-x18` is unset in this crate which is incompatible with `-Zfixed-x18` being set in dependency `fixed_x18` - = help: set `-Zfixed-x18` in this crate or unset `-Zfixed-x18` in `fixed_x18` + = help: the `-Tfixed-x18` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely + = note: unset `-Tfixed-x18` in this crate is incompatible with `-Tfixed-x18` in dependency `fixed_x18` + = help: set `-Tfixed-x18` in this crate, unset `-Tfixed-x18` in `fixed_x18`, or use `-Cfixed-x18` in `fixed_x18` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=fixed-x18` to silence this error error: aborting due to 1 previous error diff --git a/tests/ui/target_modifiers/incompatible_fixedx18.rs b/tests/ui/target_modifiers/incompatible_fixedx18.rs index 320cf0137e510..abbcfc656d4f2 100644 --- a/tests/ui/target_modifiers/incompatible_fixedx18.rs +++ b/tests/ui/target_modifiers/incompatible_fixedx18.rs @@ -3,7 +3,7 @@ //@ needs-llvm-components: aarch64 //@ revisions:allow_match allow_mismatch error_generated -//@[allow_match] compile-flags: -Zfixed-x18 +//@[allow_match] compile-flags: -Tfixed-x18 -Zunstable-options //@[allow_mismatch] compile-flags: -Cunsafe-allow-abi-mismatch=fixed-x18 // [error_generated] no extra compile-flags //@[allow_mismatch] check-pass @@ -11,7 +11,7 @@ //@ ignore-backends: gcc #![feature(no_core)] -//[error_generated]~^ ERROR mixing `-Zfixed-x18` will cause an ABI mismatch in crate `incompatible_fixedx18` +//[error_generated]~^ ERROR mixing `-Tfixed-x18` will cause an ABI mismatch in crate `incompatible_fixedx18` #![crate_type = "rlib"] #![no_core] diff --git a/tests/ui/target_modifiers/incompatible_regparm.error_generated.stderr b/tests/ui/target_modifiers/incompatible_regparm.error_generated.stderr index f58debe566789..cecd42bd6910c 100644 --- a/tests/ui/target_modifiers/incompatible_regparm.error_generated.stderr +++ b/tests/ui/target_modifiers/incompatible_regparm.error_generated.stderr @@ -1,12 +1,12 @@ -error: mixing `-Zregparm` will cause an ABI mismatch in crate `incompatible_regparm` +error: mixing `-Tregparm` will cause an ABI mismatch in crate `incompatible_regparm` --> $DIR/incompatible_regparm.rs:12:1 | LL | #![feature(no_core)] | ^ | - = help: the `-Zregparm` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: `-Zregparm=1` in this crate is incompatible with `-Zregparm=2` in dependency `wrong_regparm` - = help: set `-Zregparm=2` in this crate or `-Zregparm=1` in `wrong_regparm` + = help: the `-Tregparm` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely + = note: `-Tregparm=1` in this crate is incompatible with `-Tregparm=2` in dependency `wrong_regparm` + = help: set `-Tregparm=2` in this crate or `-Tregparm=1` in `wrong_regparm` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=regparm` to silence this error error: aborting due to 1 previous error diff --git a/tests/ui/target_modifiers/incompatible_regparm.rs b/tests/ui/target_modifiers/incompatible_regparm.rs index c6261b4c6c986..c770f08b7e3b7 100644 --- a/tests/ui/target_modifiers/incompatible_regparm.rs +++ b/tests/ui/target_modifiers/incompatible_regparm.rs @@ -1,5 +1,5 @@ //@ aux-build:wrong_regparm.rs -//@ compile-flags: --target i686-unknown-linux-gnu -Zregparm=1 +//@ compile-flags: --target i686-unknown-linux-gnu -Tregparm=1 -Zunstable-options //@ needs-llvm-components: x86 //@ revisions:allow_regparm_mismatch allow_no_value error_generated @@ -10,7 +10,7 @@ //@ ignore-backends: gcc #![feature(no_core)] -//[error_generated]~^ ERROR mixing `-Zregparm` will cause an ABI mismatch in crate `incompatible_regparm` +//[error_generated]~^ ERROR mixing `-Tregparm` will cause an ABI mismatch in crate `incompatible_regparm` #![crate_type = "rlib"] #![no_core] diff --git a/tests/ui/target_modifiers/no_value_bool.error.stderr b/tests/ui/target_modifiers/no_value_bool.error.stderr index c0e3178b89cf2..130c02523122f 100644 --- a/tests/ui/target_modifiers/no_value_bool.error.stderr +++ b/tests/ui/target_modifiers/no_value_bool.error.stderr @@ -1,12 +1,12 @@ -error: mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `no_value_bool` +error: mixing `-Treg-struct-return` will cause an ABI mismatch in crate `no_value_bool` --> $DIR/no_value_bool.rs:17:1 | LL | #![feature(no_core)] | ^ | - = help: the `-Zreg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: `-Zreg-struct-return` is unset in this crate which is incompatible with `-Zreg-struct-return=true` in dependency `enabled_reg_struct_return` - = help: set `-Zreg-struct-return=true` in this crate or unset `-Zreg-struct-return` in `enabled_reg_struct_return` + = help: the `-Treg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely + = note: unset `-Treg-struct-return` in this crate is incompatible with `-Treg-struct-return` in dependency `enabled_reg_struct_return` + = help: set `-Treg-struct-return` in this crate, unset `-Treg-struct-return` in `enabled_reg_struct_return`, or use `-Creg-struct-return` in `enabled_reg_struct_return` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=reg-struct-return` to silence this error error: aborting due to 1 previous error diff --git a/tests/ui/target_modifiers/no_value_bool.error_explicit.stderr b/tests/ui/target_modifiers/no_value_bool.error_explicit.stderr index c0e3178b89cf2..3de9c3a2530a6 100644 --- a/tests/ui/target_modifiers/no_value_bool.error_explicit.stderr +++ b/tests/ui/target_modifiers/no_value_bool.error_explicit.stderr @@ -1,12 +1,12 @@ -error: mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `no_value_bool` +error: mixing `-Treg-struct-return` will cause an ABI mismatch in crate `no_value_bool` --> $DIR/no_value_bool.rs:17:1 | LL | #![feature(no_core)] | ^ | - = help: the `-Zreg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: `-Zreg-struct-return` is unset in this crate which is incompatible with `-Zreg-struct-return=true` in dependency `enabled_reg_struct_return` - = help: set `-Zreg-struct-return=true` in this crate or unset `-Zreg-struct-return` in `enabled_reg_struct_return` + = help: the `-Treg-struct-return` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely + = note: `-Treg-struct-return` in this crate is incompatible with `-Treg-struct-return` in dependency `enabled_reg_struct_return` + = help: set `-Treg-struct-return` in this crate or `-Treg-struct-return` in `enabled_reg_struct_return` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=reg-struct-return` to silence this error error: aborting due to 1 previous error diff --git a/tests/ui/target_modifiers/no_value_bool.rs b/tests/ui/target_modifiers/no_value_bool.rs index 46f92ead95a74..ac6fc710a4b52 100644 --- a/tests/ui/target_modifiers/no_value_bool.rs +++ b/tests/ui/target_modifiers/no_value_bool.rs @@ -2,21 +2,21 @@ // with the -Zflag specified without value (-Zflag=true is consistent with -Zflag) //@ aux-build:enabled_reg_struct_return.rs -//@ compile-flags: --target i686-unknown-linux-gnu -Cpanic=abort +//@ compile-flags: --target i686-unknown-linux-gnu -Cpanic=abort -Zunstable-options //@ needs-llvm-components: x86 //@ revisions: ok ok_explicit error error_explicit -//@[ok] compile-flags: -Zreg-struct-return -//@[ok_explicit] compile-flags: -Zreg-struct-return=true +//@[ok] compile-flags: -Treg-struct-return +//@[ok_explicit] compile-flags: -Treg-struct-return=true // [error] no extra compile-flags -//@[error_explicit] compile-flags: -Zreg-struct-return=false +//@[error_explicit] compile-flags: -Treg-struct-return=false //@[ok] check-pass //@[ok_explicit] check-pass //@ ignore-backends: gcc #![feature(no_core)] -//[error]~^ ERROR mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `no_value_bool` -//[error_explicit]~^^ ERROR mixing `-Zreg-struct-return` will cause an ABI mismatch in crate `no_value_bool` +//[error]~^ ERROR mixing `-Treg-struct-return` will cause an ABI mismatch in crate `no_value_bool` +//[error_explicit]~^^ ERROR mixing `-Treg-struct-return` will cause an ABI mismatch in crate `no_value_bool` #![crate_type = "rlib"] #![no_core] diff --git a/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.rs b/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.rs index cb9f701349ae6..58249c5582c36 100644 --- a/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.rs +++ b/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.rs @@ -1,17 +1,18 @@ -// For kCFI, the helper flag -Zsanitizer-cfi-normalize-integers should also be a target modifier. +// For kCFI, the helper flag -Tsanitizer-cfi-normalize-integers should also be a target modifier. //@ needs-sanitizer-kcfi //@ aux-build:kcfi-normalize-ints.rs //@ compile-flags: -Cpanic=abort //@ revisions: ok wrong_flag wrong_sanitizer -//@[ok] compile-flags: -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers -//@[wrong_flag] compile-flags: -Zsanitizer=kcfi +//@[ok] compile-flags: -Tsanitizer=kcfi -Tsanitizer-cfi-normalize-integers -Zunstable-options +//@[wrong_flag] compile-flags: -Tsanitizer=kcfi -Zunstable-options //@[ok] check-pass #![feature(no_core)] -//[wrong_flag]~^ ERROR mixing `-Zsanitizer-cfi-normalize-integers` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints` -//[wrong_sanitizer]~^^ ERROR mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints` +//[wrong_flag]~^ ERROR mixing `-Tsanitizer-cfi-normalize-integers` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints` +//[wrong_sanitizer]~^^ ERROR mixing `-Tsanitizer` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints` +//[wrong_sanitizer]~| ERROR mixing `-Tsanitizer-cfi-normalize-integers` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints` #![crate_type = "rlib"] #![no_core] diff --git a/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_flag.stderr b/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_flag.stderr index c6abc4b574322..e6283714c2cc4 100644 --- a/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_flag.stderr +++ b/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_flag.stderr @@ -1,12 +1,12 @@ -error: mixing `-Zsanitizer-cfi-normalize-integers` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints` +error: mixing `-Tsanitizer-cfi-normalize-integers` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints` --> $DIR/sanitizer-kcfi-normalize-ints.rs:12:1 | LL | #![feature(no_core)] | ^ | - = help: the `-Zsanitizer-cfi-normalize-integers` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: `-Zsanitizer-cfi-normalize-integers` is unset in this crate which is incompatible with `-Zsanitizer-cfi-normalize-integers` being set in dependency `kcfi_normalize_ints` - = help: set `-Zsanitizer-cfi-normalize-integers` in this crate or unset `-Zsanitizer-cfi-normalize-integers` in `kcfi_normalize_ints` + = help: the `-Tsanitizer-cfi-normalize-integers` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely + = note: unset `-Tsanitizer-cfi-normalize-integers` in this crate is incompatible with `-Tsanitizer-cfi-normalize-integers` in dependency `kcfi_normalize_ints` + = help: set `-Tsanitizer-cfi-normalize-integers` in this crate, unset `-Tsanitizer-cfi-normalize-integers` in `kcfi_normalize_ints`, or use `-Csanitizer-cfi-normalize-integers` in `kcfi_normalize_ints` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer-cfi-normalize-integers` to silence this error error: aborting due to 1 previous error diff --git a/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_sanitizer.stderr b/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_sanitizer.stderr index 79e8ffbf04a5b..e76e43266b4ea 100644 --- a/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_sanitizer.stderr +++ b/tests/ui/target_modifiers/sanitizer-kcfi-normalize-ints.wrong_sanitizer.stderr @@ -1,13 +1,24 @@ -error: mixing `-Zsanitizer` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints` +error: mixing `-Tsanitizer` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints` --> $DIR/sanitizer-kcfi-normalize-ints.rs:12:1 | LL | #![feature(no_core)] | ^ | - = help: the `-Zsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: `-Zsanitizer` is unset in this crate which is incompatible with `-Zsanitizer=kcfi` in dependency `kcfi_normalize_ints` - = help: set `-Zsanitizer=kcfi` in this crate or unset `-Zsanitizer` in `kcfi_normalize_ints` + = help: the `-Tsanitizer` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely + = note: unset `-Tsanitizer` in this crate is incompatible with `-Tsanitizer=kcfi` in dependency `kcfi_normalize_ints` + = help: set `-Tsanitizer=kcfi` in this crate, unset `-Tsanitizer` in `kcfi_normalize_ints`, or use `-Csanitizer` in `kcfi_normalize_ints` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer` to silence this error -error: aborting due to 1 previous error +error: mixing `-Tsanitizer-cfi-normalize-integers` will cause an ABI mismatch in crate `sanitizer_kcfi_normalize_ints` + --> $DIR/sanitizer-kcfi-normalize-ints.rs:12:1 + | +LL | #![feature(no_core)] + | ^ + | + = help: the `-Tsanitizer-cfi-normalize-integers` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely + = note: unset `-Tsanitizer-cfi-normalize-integers` in this crate is incompatible with `-Tsanitizer-cfi-normalize-integers` in dependency `kcfi_normalize_ints` + = help: set `-Tsanitizer-cfi-normalize-integers` in this crate, unset `-Tsanitizer-cfi-normalize-integers` in `kcfi_normalize_ints`, or use `-Csanitizer-cfi-normalize-integers` in `kcfi_normalize_ints` + = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=sanitizer-cfi-normalize-integers` to silence this error + +error: aborting due to 2 previous errors diff --git a/tests/ui/target_modifiers/sanitizers-good-for-inconsistency.rs b/tests/ui/target_modifiers/sanitizers-good-for-inconsistency.rs index abda7be9e4057..2edfc52cd1232 100644 --- a/tests/ui/target_modifiers/sanitizers-good-for-inconsistency.rs +++ b/tests/ui/target_modifiers/sanitizers-good-for-inconsistency.rs @@ -8,8 +8,8 @@ //@ aux-build:no-sanitizers.rs //@ compile-flags: -Cpanic=abort -C target-feature=-crt-static -//@[wrong_address_san] compile-flags: -Zsanitizer=address -//@[wrong_leak_san] compile-flags: -Zsanitizer=leak +//@[wrong_address_san] compile-flags: -Csanitizer=address -Zunstable-options +//@[wrong_leak_san] compile-flags: -Csanitizer=leak -Zunstable-options //@ check-pass #![feature(no_core)] diff --git a/tests/ui/target_modifiers/target_cpu_default.explicit_mismatch.stderr b/tests/ui/target_modifiers/target_cpu_default.explicit_mismatch.stderr index 775569818175b..dcbf72801149a 100644 --- a/tests/ui/target_modifiers/target_cpu_default.explicit_mismatch.stderr +++ b/tests/ui/target_modifiers/target_cpu_default.explicit_mismatch.stderr @@ -1,12 +1,12 @@ -error: mixing `-Ctarget-cpu` will cause an ABI mismatch in crate `target_cpu_default` +error: mixing `-Ttarget-cpu` will cause an ABI mismatch in crate `target_cpu_default` --> $DIR/target_cpu_default.rs:25:1 | LL | #![feature(no_core)] | ^ | - = help: the `-Ctarget-cpu` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: `-Ctarget-cpu=sm_70` in this crate is incompatible with `-Ctarget-cpu=sm_80` in dependency `target_cpu_non_default` - = help: set `-Ctarget-cpu=sm_80` in this crate or `-Ctarget-cpu=sm_70` in `target_cpu_non_default` + = help: the `-Ttarget-cpu` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely + = note: `-Ttarget-cpu=sm_70` in this crate is incompatible with `-Ttarget-cpu=sm_80` in dependency `target_cpu_non_default` + = help: set `-Ttarget-cpu=sm_80` in this crate or `-Ttarget-cpu=sm_70` in `target_cpu_non_default` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=target-cpu` to silence this error error: aborting due to 1 previous error diff --git a/tests/ui/target_modifiers/target_cpu_default.implicit_mismatch.stderr b/tests/ui/target_modifiers/target_cpu_default.implicit_mismatch.stderr index ecfef76992d37..dcbf72801149a 100644 --- a/tests/ui/target_modifiers/target_cpu_default.implicit_mismatch.stderr +++ b/tests/ui/target_modifiers/target_cpu_default.implicit_mismatch.stderr @@ -1,12 +1,12 @@ -error: mixing `-Ctarget-cpu` will cause an ABI mismatch in crate `target_cpu_default` +error: mixing `-Ttarget-cpu` will cause an ABI mismatch in crate `target_cpu_default` --> $DIR/target_cpu_default.rs:25:1 | LL | #![feature(no_core)] | ^ | - = help: the `-Ctarget-cpu` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely - = note: `-Ctarget-cpu` is unset in this crate which is incompatible with `-Ctarget-cpu=sm_80` in dependency `target_cpu_non_default` - = help: set `-Ctarget-cpu=sm_80` in this crate or unset `-Ctarget-cpu` in `target_cpu_non_default` + = help: the `-Ttarget-cpu` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely + = note: `-Ttarget-cpu=sm_70` in this crate is incompatible with `-Ttarget-cpu=sm_80` in dependency `target_cpu_non_default` + = help: set `-Ttarget-cpu=sm_80` in this crate or `-Ttarget-cpu=sm_70` in `target_cpu_non_default` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=target-cpu` to silence this error error: aborting due to 1 previous error diff --git a/tests/ui/target_modifiers/target_cpu_default.rs b/tests/ui/target_modifiers/target_cpu_default.rs index b4f3a5afda2e6..7f5309c4e0c9d 100644 --- a/tests/ui/target_modifiers/target_cpu_default.rs +++ b/tests/ui/target_modifiers/target_cpu_default.rs @@ -1,9 +1,9 @@ -// Check that an implicit default `-Ctarget-cpu` and an explicit default -// `-Ctarget-cpu` compare equal. +// Check that an implicit default `-Ttarget-cpu` and an explicit default +// `-Ttarget-cpu` compare equal. // -// NVPTX requires consistent `-Ctarget-cpu` values across crates, but it does +// NVPTX requires consistent `-Ttarget-cpu` values across crates, but it does // not require the CPU to be specified explicitly. Therefore, compiling one crate -// without `-Ctarget-cpu` and another crate with the target's default CPU +// without `-Ttarget-cpu` and another crate with the target's default CPU // explicitly specified must be accepted. // // The mismatch revisions additionally check that an implicit or explicit default @@ -18,13 +18,13 @@ //@ revisions: implicit_default explicit_default implicit_mismatch explicit_mismatch //@[implicit_default] check-pass -//@[explicit_default] compile-flags: -Ctarget-cpu=sm_70 +//@[explicit_default] compile-flags: -Ttarget-cpu=sm_70 //@[explicit_default] check-pass -//@[explicit_mismatch] compile-flags: -Ctarget-cpu=sm_70 +//@[explicit_mismatch] compile-flags: -Ttarget-cpu=sm_70 #![feature(no_core)] -//[implicit_mismatch]~^ ERROR mixing `-Ctarget-cpu` will cause an ABI mismatch -//[explicit_mismatch]~^^ ERROR mixing `-Ctarget-cpu` will cause an ABI mismatch +//[implicit_mismatch]~^ ERROR mixing `-Ttarget-cpu` will cause an ABI mismatch +//[explicit_mismatch]~^^ ERROR mixing `-Ttarget-cpu` will cause an ABI mismatch #![crate_type = "rlib"] #![no_core] diff --git a/tests/ui/target_modifiers/two_flags.rs b/tests/ui/target_modifiers/two_flags.rs index 6c5f102458c9d..3681241358488 100644 --- a/tests/ui/target_modifiers/two_flags.rs +++ b/tests/ui/target_modifiers/two_flags.rs @@ -1,10 +1,10 @@ //@ aux-build:wrong_regparm_and_ret.rs -//@ compile-flags: --target i686-unknown-linux-gnu +//@ compile-flags: --target i686-unknown-linux-gnu -Zunstable-options //@ needs-llvm-components: x86 //@ revisions:two_allowed unknown_allowed //@[two_allowed] compile-flags: -Cunsafe-allow-abi-mismatch=regparm,reg-struct-return -//@[unknown_allowed] compile-flags: -Cunsafe-allow-abi-mismatch=unknown_flag -Zregparm=2 -Zreg-struct-return=true +//@[unknown_allowed] compile-flags: -Cunsafe-allow-abi-mismatch=unknown_flag -Tregparm=2 -Treg-struct-return=true //@[two_allowed] check-pass //@ ignore-backends: gcc