From 123cc413bd253492f112b0d21722c8387e0d6b53 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Mon, 6 Mar 2023 10:31:16 +0100 Subject: [PATCH 01/28] include eventual comment in the compiletest ignore reason --- src/tools/compiletest/src/header.rs | 72 ++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 17 deletions(-) diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 5bc9d9afcb9d1..15020a373f069 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -16,8 +16,20 @@ use crate::{extract_cdb_version, extract_gdb_version}; mod tests; /// The result of parse_cfg_name_directive. +#[derive(Clone, PartialEq, Debug)] +struct ParsedNameDirective { + comment: Option, + outcome: MatchOutcome, +} + +impl ParsedNameDirective { + fn invalid() -> Self { + Self { comment: None, outcome: MatchOutcome::NoMatch } + } +} + #[derive(Clone, Copy, PartialEq, Debug)] -enum ParsedNameDirective { +enum MatchOutcome { /// No match. NoMatch, /// Match. @@ -647,7 +659,7 @@ impl Config { } fn parse_custom_normalization(&self, mut line: &str, prefix: &str) -> Option<(String, String)> { - if self.parse_cfg_name_directive(line, prefix) == ParsedNameDirective::Match { + if self.parse_cfg_name_directive(line, prefix).outcome == MatchOutcome::Match { let from = parse_normalization_string(&mut line)?; let to = parse_normalization_string(&mut line)?; Some((from, to)) @@ -668,13 +680,15 @@ impl Config { /// or `normalize-stderr-32bit`. fn parse_cfg_name_directive(&self, line: &str, prefix: &str) -> ParsedNameDirective { if !line.as_bytes().starts_with(prefix.as_bytes()) { - return ParsedNameDirective::NoMatch; + return ParsedNameDirective::invalid(); } if line.as_bytes().get(prefix.len()) != Some(&b'-') { - return ParsedNameDirective::NoMatch; + return ParsedNameDirective::invalid(); } + let line = &line[prefix.len() + 1..]; - let name = line[prefix.len() + 1..].split(&[':', ' '][..]).next().unwrap(); + let (name, comment) = + line.split_once(&[':', ' ']).map(|(l, c)| (l, Some(c))).unwrap_or((line, None)); let matches_pointer_width = || { name.strip_suffix("bit") @@ -723,7 +737,10 @@ impl Config { None => false, }; - if is_match { ParsedNameDirective::Match } else { ParsedNameDirective::NoMatch } + ParsedNameDirective { + comment: comment.map(|c| c.trim().trim_start_matches('-').trim().to_string()), + outcome: if is_match { MatchOutcome::Match } else { MatchOutcome::NoMatch }, + } } fn has_cfg_prefix(&self, line: &str, prefix: &str) -> bool { @@ -992,19 +1009,40 @@ pub fn make_test_description( } }; } - ignore = match config.parse_cfg_name_directive(ln, "ignore") { - ParsedNameDirective::Match => { - ignore_message = Some("cfg -> ignore => Match"); - true - } - ParsedNameDirective::NoMatch => ignore, - }; + + { + let parsed = config.parse_cfg_name_directive(ln, "ignore"); + ignore = match parsed.outcome { + MatchOutcome::Match => { + ignore_message = Some(match parsed.comment { + // The ignore reason must be a &'static str, so we have to leak memory to + // create it. This is fine, as the header is parsed only at the start of + // compiletest so it won't grow indefinitely. + Some(comment) => Box::leak(Box::::from(format!( + "cfg -> ignore => Match ({comment})" + ))), + None => "cfg -> ignore => Match", + }); + true + } + MatchOutcome::NoMatch => ignore, + }; + } if config.has_cfg_prefix(ln, "only") { - ignore = match config.parse_cfg_name_directive(ln, "only") { - ParsedNameDirective::Match => ignore, - ParsedNameDirective::NoMatch => { - ignore_message = Some("cfg -> only => NoMatch"); + let parsed = config.parse_cfg_name_directive(ln, "only"); + ignore = match parsed.outcome { + MatchOutcome::Match => ignore, + MatchOutcome::NoMatch => { + ignore_message = Some(match parsed.comment { + // The ignore reason must be a &'static str, so we have to leak memory to + // create it. This is fine, as the header is parsed only at the start of + // compiletest so it won't grow indefinitely. + Some(comment) => Box::leak(Box::::from(format!( + "cfg -> only => NoMatch ({comment})" + ))), + None => "cfg -> only => NoMatch", + }); true } }; From 4e2a98268a3193e3161adafd4534c036f139da8f Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Mon, 6 Mar 2023 12:10:55 +0100 Subject: [PATCH 02/28] include pretty reason why ignore-FOO matched --- src/tools/compiletest/src/common.rs | 16 +-- src/tools/compiletest/src/header.rs | 198 +++++++++++++++++++--------- 2 files changed, 141 insertions(+), 73 deletions(-) diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 28c045f83824b..496b83a956b9c 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -159,7 +159,7 @@ pub enum Debugger { } impl Debugger { - fn to_str(&self) -> &'static str { + pub(crate) fn to_str(&self) -> &'static str { match self { Debugger::Cdb => "cdb", Debugger::Gdb => "gdb", @@ -396,7 +396,7 @@ impl Config { }) } - fn target_cfg(&self) -> &TargetCfg { + pub fn target_cfg(&self) -> &TargetCfg { self.target_cfg.borrow_with(|| TargetCfg::new(self)) } @@ -451,12 +451,12 @@ impl Config { #[derive(Clone, Debug)] pub struct TargetCfg { - arch: String, - os: String, - env: String, - abi: String, - families: Vec, - pointer_width: u32, + pub(crate) arch: String, + pub(crate) os: String, + pub(crate) env: String, + pub(crate) abi: String, + pub(crate) families: Vec, + pub(crate) pointer_width: u32, endian: Endian, panic: PanicStrategy, } diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 15020a373f069..ea900ff068fc5 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -8,7 +8,7 @@ use std::process::Command; use tracing::*; -use crate::common::{CompareMode, Config, Debugger, FailMode, Mode, PassMode}; +use crate::common::{Config, Debugger, FailMode, Mode, PassMode}; use crate::util; use crate::{extract_cdb_version, extract_gdb_version}; @@ -17,14 +17,16 @@ mod tests; /// The result of parse_cfg_name_directive. #[derive(Clone, PartialEq, Debug)] -struct ParsedNameDirective { - comment: Option, +struct ParsedNameDirective<'a> { + name: Option<&'a str>, + pretty_reason: Option, + comment: Option<&'a str>, outcome: MatchOutcome, } -impl ParsedNameDirective { +impl ParsedNameDirective<'_> { fn invalid() -> Self { - Self { comment: None, outcome: MatchOutcome::NoMatch } + Self { name: None, pretty_reason: None, comment: None, outcome: MatchOutcome::NoMatch } } } @@ -678,7 +680,7 @@ impl Config { /// Parses a name-value directive which contains config-specific information, e.g., `ignore-x86` /// or `normalize-stderr-32bit`. - fn parse_cfg_name_directive(&self, line: &str, prefix: &str) -> ParsedNameDirective { + fn parse_cfg_name_directive<'a>(&self, line: &'a str, prefix: &str) -> ParsedNameDirective<'a> { if !line.as_bytes().starts_with(prefix.as_bytes()) { return ParsedNameDirective::invalid(); } @@ -690,56 +692,124 @@ impl Config { let (name, comment) = line.split_once(&[':', ' ']).map(|(l, c)| (l, Some(c))).unwrap_or((line, None)); - let matches_pointer_width = || { - name.strip_suffix("bit") - .and_then(|width| width.parse::().ok()) - .map(|width| self.get_pointer_width() == width) - .unwrap_or(false) - }; + let mut is_match = None; + + macro_rules! maybe_condition { + (name: $name:expr, $(condition: $condition:expr,)? message: $($message:tt)*) => { + if let Some(expected) = $name { + if name == expected $(&& $condition)? { + is_match = Some(format!($($message)*)); + } + } + }; + } + macro_rules! condition { + (name: $name:expr, $(condition: $condition:expr,)? message: $($message:tt)*) => { + maybe_condition! { + name: Some($name), + $(condition: $condition,)* + message: $($message)* + } + }; + } + + condition! { + name: "test", + message: "always" + } + condition! { + name: &self.target, + message: "when the target is {name}" + } + + let target_cfg = self.target_cfg(); + condition! { + name: &target_cfg.os, + message: "when the operative system is {name}" + } + condition! { + name: &target_cfg.env, + message: "when the target environment is {name}" + } + condition! { + name: &target_cfg.abi, + message: "when the ABI is {name}" + } + condition! { + name: &target_cfg.arch, + message: "when the architecture is {name}" + } + condition! { + name: format!("{}bit", target_cfg.pointer_width), + message: "when the pointer width is {name}" + } + for family in &target_cfg.families { + condition! { + name: family, + message: "when the target family is {name}" + } + } // If something is ignored for emscripten, it likely also needs to be // ignored for wasm32-unknown-unknown. // `wasm32-bare` is an alias to refer to just wasm32-unknown-unknown // (in contrast to `wasm32` which also matches non-bare targets like // asmjs-unknown-emscripten). - let matches_wasm32_alias = || { - self.target == "wasm32-unknown-unknown" && matches!(name, "emscripten" | "wasm32-bare") - }; + condition! { + name: "emscripten", + condition: self.target == "wasm32-unknown-unknown", + message: "when the target is WASM", + } + condition! { + name: "wasm32-bare", + condition: self.target == "wasm32-unknown-unknown", + message: "when the target is WASM" + } - let is_match = name == "test" || - self.target == name || // triple - self.matches_os(name) || - self.matches_env(name) || - self.matches_abi(name) || - self.matches_family(name) || - self.target.ends_with(name) || // target and env - self.matches_arch(name) || - matches_wasm32_alias() || - matches_pointer_width() || - name == self.stage_id.split('-').next().unwrap() || // stage - name == self.channel || // channel - (self.target != self.host && name == "cross-compile") || - (name == "endian-big" && self.is_big_endian()) || - (self.remote_test_client.is_some() && name == "remote") || - match self.compare_mode { - Some(CompareMode::Polonius) => name == "compare-mode-polonius", - Some(CompareMode::Chalk) => name == "compare-mode-chalk", - Some(CompareMode::NextSolver) => name == "compare-mode-next-solver", - Some(CompareMode::SplitDwarf) => name == "compare-mode-split-dwarf", - Some(CompareMode::SplitDwarfSingle) => name == "compare-mode-split-dwarf-single", - None => false, - } || - (cfg!(debug_assertions) && name == "debug") || - match self.debugger { - Some(Debugger::Cdb) => name == "cdb", - Some(Debugger::Gdb) => name == "gdb", - Some(Debugger::Lldb) => name == "lldb", - None => false, - }; + condition! { + name: &self.channel, + message: "when the release channel is {name}", + } + condition! { + name: "cross-compile", + condition: self.target != self.host, + message: "when cross-compiling" + } + condition! { + name: "endian-big", + condition: self.is_big_endian(), + message: "on big-endian targets", + } + condition! { + name: self.stage_id.split('-').next().unwrap(), + message: "when the bootstrapping stage is {name}", + } + condition! { + name: "remote", + condition: self.remote_test_client.is_some(), + message: "when running tests remotely", + } + condition! { + name: "debug", + condition: cfg!(debug_assertions), + message: "when building with debug assertions", + } + maybe_condition! { + name: self.debugger.as_ref().map(|d| d.to_str()), + message: "when the debugger is {name}", + } + maybe_condition! { + name: self.compare_mode + .as_ref() + .map(|d| format!("compare-mode-{}", d.to_str())), + message: "when comparing with {name}", + } ParsedNameDirective { - comment: comment.map(|c| c.trim().trim_start_matches('-').trim().to_string()), - outcome: if is_match { MatchOutcome::Match } else { MatchOutcome::NoMatch }, + name: Some(name), + comment: comment.map(|c| c.trim().trim_start_matches('-').trim()), + outcome: if is_match.is_some() { MatchOutcome::Match } else { MatchOutcome::NoMatch }, + pretty_reason: is_match, } } @@ -1014,15 +1084,14 @@ pub fn make_test_description( let parsed = config.parse_cfg_name_directive(ln, "ignore"); ignore = match parsed.outcome { MatchOutcome::Match => { - ignore_message = Some(match parsed.comment { - // The ignore reason must be a &'static str, so we have to leak memory to - // create it. This is fine, as the header is parsed only at the start of - // compiletest so it won't grow indefinitely. - Some(comment) => Box::leak(Box::::from(format!( - "cfg -> ignore => Match ({comment})" - ))), - None => "cfg -> ignore => Match", - }); + let reason = parsed.pretty_reason.unwrap(); + // The ignore reason must be a &'static str, so we have to leak memory to + // create it. This is fine, as the header is parsed only at the start of + // compiletest so it won't grow indefinitely. + ignore_message = Some(Box::leak(Box::::from(match parsed.comment { + Some(comment) => format!("ignored {reason} ({comment})"), + None => format!("ignored {reason}"), + })) as &str); true } MatchOutcome::NoMatch => ignore, @@ -1034,15 +1103,14 @@ pub fn make_test_description( ignore = match parsed.outcome { MatchOutcome::Match => ignore, MatchOutcome::NoMatch => { - ignore_message = Some(match parsed.comment { - // The ignore reason must be a &'static str, so we have to leak memory to - // create it. This is fine, as the header is parsed only at the start of - // compiletest so it won't grow indefinitely. - Some(comment) => Box::leak(Box::::from(format!( - "cfg -> only => NoMatch ({comment})" - ))), - None => "cfg -> only => NoMatch", - }); + let name = parsed.name.unwrap(); + // The ignore reason must be a &'static str, so we have to leak memory to + // create it. This is fine, as the header is parsed only at the start of + // compiletest so it won't grow indefinitely. + ignore_message = Some(Box::leak(Box::::from(match parsed.comment { + Some(comment) => format!("did not match only-{name} ({comment})"), + None => format!("did not match only-{name}"), + })) as &str); true } }; From 9bc8bb91de5f5428da0d9f13c79bff68cf6f9b3c Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 8 Mar 2023 10:27:38 +0100 Subject: [PATCH 03/28] validate ignore-FOO/only-FOO directives and output only-FOO reasoning --- src/tools/compiletest/src/common.rs | 118 ++++++++++++++++++++++------ src/tools/compiletest/src/header.rs | 96 ++++++++++++++++++---- src/tools/compiletest/src/main.rs | 2 +- 3 files changed, 178 insertions(+), 38 deletions(-) diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 496b83a956b9c..9df5c298757dc 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -9,6 +9,7 @@ use std::str::FromStr; use crate::util::{add_dylib_path, PathBufExt}; use lazycell::LazyCell; +use std::collections::HashSet; use test::{ColorConfig, OutputFormat}; #[derive(Clone, Copy, PartialEq, Debug)] @@ -129,6 +130,14 @@ pub enum CompareMode { } impl CompareMode { + pub(crate) const VARIANTS: &'static [CompareMode] = &[ + CompareMode::Polonius, + CompareMode::Chalk, + CompareMode::NextSolver, + CompareMode::SplitDwarf, + CompareMode::SplitDwarfSingle, + ]; + pub(crate) fn to_str(&self) -> &'static str { match *self { CompareMode::Polonius => "polonius", @@ -159,6 +168,9 @@ pub enum Debugger { } impl Debugger { + pub(crate) const VARIANTS: &'static [Debugger] = + &[Debugger::Cdb, Debugger::Gdb, Debugger::Lldb]; + pub(crate) fn to_str(&self) -> &'static str { match self { Debugger::Cdb => "cdb", @@ -396,8 +408,12 @@ impl Config { }) } + pub fn target_cfgs(&self) -> &TargetCfgs { + self.target_cfgs.borrow_with(|| TargetCfgs::new(self)) + } + pub fn target_cfg(&self) -> &TargetCfg { - self.target_cfg.borrow_with(|| TargetCfg::new(self)) + &self.target_cfgs().current } pub fn matches_arch(&self, arch: &str) -> bool { @@ -449,6 +465,63 @@ impl Config { } } +#[derive(Debug, Clone)] +pub struct TargetCfgs { + pub current: TargetCfg, + pub all_targets: HashSet, + pub all_archs: HashSet, + pub all_oses: HashSet, + pub all_envs: HashSet, + pub all_abis: HashSet, + pub all_families: HashSet, + pub all_pointer_widths: HashSet, +} + +impl TargetCfgs { + fn new(config: &Config) -> TargetCfgs { + // Gather list of all targets + let targets = rustc_output(config, &["--print=target-list"]); + + let mut current = None; + let mut all_targets = HashSet::new(); + let mut all_archs = HashSet::new(); + let mut all_oses = HashSet::new(); + let mut all_envs = HashSet::new(); + let mut all_abis = HashSet::new(); + let mut all_families = HashSet::new(); + let mut all_pointer_widths = HashSet::new(); + + for target in targets.trim().lines() { + let cfg = TargetCfg::new(config, target); + + all_archs.insert(cfg.arch.clone()); + all_oses.insert(cfg.os.clone()); + all_envs.insert(cfg.env.clone()); + all_abis.insert(cfg.abi.clone()); + for family in &cfg.families { + all_families.insert(family.clone()); + } + all_pointer_widths.insert(format!("{}bit", cfg.pointer_width)); + + if target == config.target { + current = Some(cfg); + } + all_targets.insert(target.into()); + } + + Self { + current: current.expect("current target not found"), + all_targets, + all_archs, + all_oses, + all_envs, + all_abis, + all_families, + all_pointer_widths, + } + } +} + #[derive(Clone, Debug)] pub struct TargetCfg { pub(crate) arch: String, @@ -468,28 +541,8 @@ pub enum Endian { } impl TargetCfg { - fn new(config: &Config) -> TargetCfg { - let mut command = Command::new(&config.rustc_path); - add_dylib_path(&mut command, iter::once(&config.compile_lib_path)); - let output = match command - .arg("--print=cfg") - .arg("--target") - .arg(&config.target) - .args(&config.target_rustcflags) - .output() - { - Ok(output) => output, - Err(e) => panic!("error: failed to get cfg info from {:?}: {e}", config.rustc_path), - }; - if !output.status.success() { - panic!( - "error: failed to get cfg info from {:?}\n--- stdout\n{}\n--- stderr\n{}", - config.rustc_path, - String::from_utf8(output.stdout).unwrap(), - String::from_utf8(output.stderr).unwrap(), - ); - } - let print_cfg = String::from_utf8(output.stdout).unwrap(); + fn new(config: &Config, target: &str) -> TargetCfg { + let print_cfg = rustc_output(config, &["--print=cfg", "--target", target]); let mut arch = None; let mut os = None; let mut env = None; @@ -539,6 +592,25 @@ impl TargetCfg { } } +fn rustc_output(config: &Config, args: &[&str]) -> String { + let mut command = Command::new(&config.rustc_path); + add_dylib_path(&mut command, iter::once(&config.compile_lib_path)); + command.args(&config.target_rustcflags).args(args); + + let output = match command.output() { + Ok(output) => output, + Err(e) => panic!("error: failed to run {command:?}: {e}"), + }; + if !output.status.success() { + panic!( + "error: failed to run {command:?}\n--- stdout\n{}\n--- stderr\n{}", + String::from_utf8(output.stdout).unwrap(), + String::from_utf8(output.stderr).unwrap(), + ); + } + String::from_utf8(output.stdout).unwrap() +} + #[derive(Debug, Clone)] pub struct TestPaths { pub file: PathBuf, // e.g., compile-test/foo/bar/baz.rs diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index ea900ff068fc5..71e1072ceb376 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -8,6 +8,7 @@ use std::process::Command; use tracing::*; +use crate::common::CompareMode; use crate::common::{Config, Debugger, FailMode, Mode, PassMode}; use crate::util; use crate::{extract_cdb_version, extract_gdb_version}; @@ -36,6 +37,10 @@ enum MatchOutcome { NoMatch, /// Match. Match, + /// The directive was invalid. + Invalid, + /// The directive is handled by other parts of our tooling. + External, } /// Properties which must be known very early, before actually running @@ -692,26 +697,60 @@ impl Config { let (name, comment) = line.split_once(&[':', ' ']).map(|(l, c)| (l, Some(c))).unwrap_or((line, None)); - let mut is_match = None; + let mut outcome = MatchOutcome::Invalid; + let mut message = None; macro_rules! maybe_condition { - (name: $name:expr, $(condition: $condition:expr,)? message: $($message:tt)*) => { - if let Some(expected) = $name { - if name == expected $(&& $condition)? { - is_match = Some(format!($($message)*)); + ( + name: $name:expr, + $(allowed_names: $allowed_names:expr,)? + $(condition: $condition:expr,)? + message: $($message:tt)* + ) => {{ + // This is not inlined to avoid problems with macro repetitions. + let format_message = || format!($($message)*); + + if outcome != MatchOutcome::Invalid { + // Ignore all other matches if we already found one + } else if $name.as_ref().map(|n| n == &name).unwrap_or(false) { + message = Some(format_message()); + if true $(&& $condition)? { + outcome = MatchOutcome::Match; + } else { + outcome = MatchOutcome::NoMatch; } } - }; + $(else if $allowed_names.contains(name) { + message = Some(format_message()); + outcome = MatchOutcome::NoMatch; + })? + }}; } macro_rules! condition { - (name: $name:expr, $(condition: $condition:expr,)? message: $($message:tt)*) => { + ( + name: $name:expr, + $(allowed_names: $allowed_names:expr,)? + $(condition: $condition:expr,)? + message: $($message:tt)* + ) => { maybe_condition! { name: Some($name), + $(allowed_names: $allowed_names,)* $(condition: $condition,)* message: $($message)* } }; } + macro_rules! hashset { + ($($value:expr),* $(,)?) => {{ + let mut set = HashSet::new(); + $(set.insert($value);)* + set + }} + } + + let target_cfgs = self.target_cfgs(); + let target_cfg = self.target_cfg(); condition! { name: "test", @@ -719,33 +758,38 @@ impl Config { } condition! { name: &self.target, + allowed_names: &target_cfgs.all_targets, message: "when the target is {name}" } - - let target_cfg = self.target_cfg(); condition! { name: &target_cfg.os, + allowed_names: &target_cfgs.all_oses, message: "when the operative system is {name}" } condition! { name: &target_cfg.env, + allowed_names: &target_cfgs.all_envs, message: "when the target environment is {name}" } condition! { name: &target_cfg.abi, + allowed_names: &target_cfgs.all_abis, message: "when the ABI is {name}" } condition! { name: &target_cfg.arch, + allowed_names: &target_cfgs.all_archs, message: "when the architecture is {name}" } condition! { name: format!("{}bit", target_cfg.pointer_width), + allowed_names: &target_cfgs.all_pointer_widths, message: "when the pointer width is {name}" } for family in &target_cfg.families { condition! { name: family, + allowed_names: &target_cfgs.all_families, message: "when the target family is {name}" } } @@ -768,6 +812,7 @@ impl Config { condition! { name: &self.channel, + allowed_names: hashset!["stable", "beta", "nightly"], message: "when the release channel is {name}", } condition! { @@ -782,6 +827,7 @@ impl Config { } condition! { name: self.stage_id.split('-').next().unwrap(), + allowed_names: hashset!["stable", "beta", "nightly"], message: "when the bootstrapping stage is {name}", } condition! { @@ -796,20 +842,38 @@ impl Config { } maybe_condition! { name: self.debugger.as_ref().map(|d| d.to_str()), + allowed_names: Debugger::VARIANTS + .iter() + .map(|v| v.to_str()) + .collect::>(), message: "when the debugger is {name}", } maybe_condition! { name: self.compare_mode .as_ref() .map(|d| format!("compare-mode-{}", d.to_str())), + allowed_names: CompareMode::VARIANTS + .iter() + .map(|cm| format!("compare-mode-{}", cm.to_str())) + .collect::>(), message: "when comparing with {name}", } + // Don't error out for ignore-tidy-* diretives, as those are not handled by compiletest. + if prefix == "ignore" && name.starts_with("tidy-") && outcome == MatchOutcome::Invalid { + outcome = MatchOutcome::External; + } + + // Don't error out for ignore-pass, as that is handled elsewhere. + if prefix == "ignore" && name == "pass" && outcome == MatchOutcome::Invalid { + outcome = MatchOutcome::External; + } + ParsedNameDirective { name: Some(name), comment: comment.map(|c| c.trim().trim_start_matches('-').trim()), - outcome: if is_match.is_some() { MatchOutcome::Match } else { MatchOutcome::NoMatch }, - pretty_reason: is_match, + outcome, + pretty_reason: message, } } @@ -1095,6 +1159,8 @@ pub fn make_test_description( true } MatchOutcome::NoMatch => ignore, + MatchOutcome::External => ignore, + MatchOutcome::Invalid => panic!("invalid line in {}: {ln}", path.display()), }; } @@ -1103,16 +1169,18 @@ pub fn make_test_description( ignore = match parsed.outcome { MatchOutcome::Match => ignore, MatchOutcome::NoMatch => { - let name = parsed.name.unwrap(); + let reason = parsed.pretty_reason.unwrap(); // The ignore reason must be a &'static str, so we have to leak memory to // create it. This is fine, as the header is parsed only at the start of // compiletest so it won't grow indefinitely. ignore_message = Some(Box::leak(Box::::from(match parsed.comment { - Some(comment) => format!("did not match only-{name} ({comment})"), - None => format!("did not match only-{name}"), + Some(comment) => format!("only executed {reason} ({comment})"), + None => format!("only executed {reason}"), })) as &str); true } + MatchOutcome::External => ignore, + MatchOutcome::Invalid => panic!("invalid line in {}: {ln}", path.display()), }; } diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 7048b0e08bbfd..b10c2d36d602c 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -311,7 +311,7 @@ pub fn parse_config(args: Vec) -> Config { force_rerun: matches.opt_present("force-rerun"), - target_cfg: LazyCell::new(), + target_cfgs: LazyCell::new(), nocapture: matches.opt_present("nocapture"), } From 0aaf9d58a24a6efba88842318b4c66d0b7418867 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 8 Mar 2023 14:28:57 +0100 Subject: [PATCH 04/28] reduce boilerplate with common enums --- src/tools/compiletest/src/common.rs | 216 ++++++++++------------------ src/tools/compiletest/src/main.rs | 6 +- 2 files changed, 76 insertions(+), 146 deletions(-) diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 9df5c298757dc..86810179ff8bc 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -12,104 +12,78 @@ use lazycell::LazyCell; use std::collections::HashSet; use test::{ColorConfig, OutputFormat}; -#[derive(Clone, Copy, PartialEq, Debug)] -pub enum Mode { - RunPassValgrind, - Pretty, - DebugInfo, - Codegen, - Rustdoc, - RustdocJson, - CodegenUnits, - Incremental, - RunMake, - Ui, - JsDocTest, - MirOpt, - Assembly, -} +macro_rules! string_enum { + ($(#[$meta:meta])* $vis:vis enum $name:ident { $($variant:ident => $repr:expr,)* }) => { + $(#[$meta])* + $vis enum $name { + $($variant,)* + } -impl Mode { - pub fn disambiguator(self) -> &'static str { - // Pretty-printing tests could run concurrently, and if they do, - // they need to keep their output segregated. - match self { - Pretty => ".pretty", - _ => "", + impl $name { + $vis const VARIANTS: &'static [Self] = &[$(Self::$variant,)*]; + + $vis fn to_str(&self) -> &'static str { + match self { + $(Self::$variant => $repr,)* + } + } } - } -} -impl FromStr for Mode { - type Err = (); - fn from_str(s: &str) -> Result { - match s { - "run-pass-valgrind" => Ok(RunPassValgrind), - "pretty" => Ok(Pretty), - "debuginfo" => Ok(DebugInfo), - "codegen" => Ok(Codegen), - "rustdoc" => Ok(Rustdoc), - "rustdoc-json" => Ok(RustdocJson), - "codegen-units" => Ok(CodegenUnits), - "incremental" => Ok(Incremental), - "run-make" => Ok(RunMake), - "ui" => Ok(Ui), - "js-doc-test" => Ok(JsDocTest), - "mir-opt" => Ok(MirOpt), - "assembly" => Ok(Assembly), - _ => Err(()), + impl fmt::Display for $name { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::Display::fmt(self.to_str(), f) + } } - } -} -impl fmt::Display for Mode { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let s = match *self { - RunPassValgrind => "run-pass-valgrind", - Pretty => "pretty", - DebugInfo => "debuginfo", - Codegen => "codegen", - Rustdoc => "rustdoc", - RustdocJson => "rustdoc-json", - CodegenUnits => "codegen-units", - Incremental => "incremental", - RunMake => "run-make", - Ui => "ui", - JsDocTest => "js-doc-test", - MirOpt => "mir-opt", - Assembly => "assembly", - }; - fmt::Display::fmt(s, f) + impl FromStr for $name { + type Err = (); + + fn from_str(s: &str) -> Result { + match s { + $($repr => Ok(Self::$variant),)* + _ => Err(()), + } + } + } } } -#[derive(Clone, Copy, PartialEq, Debug, Hash)] -pub enum PassMode { - Check, - Build, - Run, +string_enum! { + #[derive(Clone, Copy, PartialEq, Debug)] + pub enum Mode { + RunPassValgrind => "run-pass-valgrind", + Pretty => "pretty", + DebugInfo => "debuginfo", + Codegen => "codegen", + Rustdoc => "rustdoc", + RustdocJson => "rustdoc-json", + CodegenUnits => "codegen-units", + Incremental => "incremental", + RunMake => "run-make", + Ui => "ui", + JsDocTest => "js-doc-test", + MirOpt => "mir-opt", + Assembly => "assembly", + } } -impl FromStr for PassMode { - type Err = (); - fn from_str(s: &str) -> Result { - match s { - "check" => Ok(PassMode::Check), - "build" => Ok(PassMode::Build), - "run" => Ok(PassMode::Run), - _ => Err(()), +impl Mode { + pub fn disambiguator(self) -> &'static str { + // Pretty-printing tests could run concurrently, and if they do, + // they need to keep their output segregated. + match self { + Pretty => ".pretty", + _ => "", } } } -impl fmt::Display for PassMode { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let s = match *self { - PassMode::Check => "check", - PassMode::Build => "build", - PassMode::Run => "run", - }; - fmt::Display::fmt(s, f) +string_enum! { + #[derive(Clone, Copy, PartialEq, Debug, Hash)] + pub enum PassMode { + Check => "check", + Build => "build", + Run => "run", } } @@ -120,69 +94,23 @@ pub enum FailMode { Run, } -#[derive(Clone, Debug, PartialEq)] -pub enum CompareMode { - Polonius, - Chalk, - NextSolver, - SplitDwarf, - SplitDwarfSingle, -} - -impl CompareMode { - pub(crate) const VARIANTS: &'static [CompareMode] = &[ - CompareMode::Polonius, - CompareMode::Chalk, - CompareMode::NextSolver, - CompareMode::SplitDwarf, - CompareMode::SplitDwarfSingle, - ]; - - pub(crate) fn to_str(&self) -> &'static str { - match *self { - CompareMode::Polonius => "polonius", - CompareMode::Chalk => "chalk", - CompareMode::NextSolver => "next-solver", - CompareMode::SplitDwarf => "split-dwarf", - CompareMode::SplitDwarfSingle => "split-dwarf-single", - } - } - - pub fn parse(s: String) -> CompareMode { - match s.as_str() { - "polonius" => CompareMode::Polonius, - "chalk" => CompareMode::Chalk, - "next-solver" => CompareMode::NextSolver, - "split-dwarf" => CompareMode::SplitDwarf, - "split-dwarf-single" => CompareMode::SplitDwarfSingle, - x => panic!("unknown --compare-mode option: {}", x), - } - } -} - -#[derive(Clone, Copy, Debug, PartialEq)] -pub enum Debugger { - Cdb, - Gdb, - Lldb, -} - -impl Debugger { - pub(crate) const VARIANTS: &'static [Debugger] = - &[Debugger::Cdb, Debugger::Gdb, Debugger::Lldb]; - - pub(crate) fn to_str(&self) -> &'static str { - match self { - Debugger::Cdb => "cdb", - Debugger::Gdb => "gdb", - Debugger::Lldb => "lldb", - } +string_enum! { + #[derive(Clone, Debug, PartialEq)] + pub enum CompareMode { + Polonius => "polonius", + Chalk => "chalk", + NextSolver => "next-solver", + SplitDwarf => "split-dwarf", + SplitDwarfSingle => "split-dwarf-single", } } -impl fmt::Display for Debugger { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Display::fmt(self.to_str(), f) +string_enum! { + #[derive(Clone, Copy, Debug, PartialEq)] + pub enum Debugger { + Cdb => "cdb", + Gdb => "gdb", + Lldb => "lldb", } } diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index b10c2d36d602c..7700db0c74d86 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -6,7 +6,7 @@ extern crate test; use crate::common::{expected_output_path, output_base_dir, output_relative_path, UI_EXTENSIONS}; -use crate::common::{CompareMode, Config, Debugger, Mode, PassMode, TestPaths}; +use crate::common::{Config, Debugger, Mode, PassMode, TestPaths}; use crate::util::logv; use build_helper::git::{get_git_modified_files, get_git_untracked_files}; use core::panic; @@ -293,7 +293,9 @@ pub fn parse_config(args: Vec) -> Config { only_modified: matches.opt_present("only-modified"), color, remote_test_client: matches.opt_str("remote-test-client").map(PathBuf::from), - compare_mode: matches.opt_str("compare-mode").map(CompareMode::parse), + compare_mode: matches + .opt_str("compare-mode") + .map(|s| s.parse().expect("invalid --compare-mode provided")), rustfix_coverage: matches.opt_present("rustfix-coverage"), has_tidy, channel: matches.opt_str("channel").unwrap(), From 703ba0ce260b76b0ea4aefb0bfe2a66df2f822a2 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 8 Mar 2023 10:12:27 +0100 Subject: [PATCH 05/28] fix ignore-thumbv8m.base --- tests/ui/attributes/issue-105594-invalid-attr-validation.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ui/attributes/issue-105594-invalid-attr-validation.rs b/tests/ui/attributes/issue-105594-invalid-attr-validation.rs index 6c68e6b046f03..096ce97ab0481 100644 --- a/tests/ui/attributes/issue-105594-invalid-attr-validation.rs +++ b/tests/ui/attributes/issue-105594-invalid-attr-validation.rs @@ -1,7 +1,7 @@ // This checks that the attribute validation ICE in issue #105594 doesn't // recur. // -// ignore-thumbv8m.base +// ignore-thumbv8m.base-none-eabi #![feature(cmse_nonsecure_entry)] fn main() {} From 8dd6c193797a528ecd203c7268497c6add7ad5a5 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 8 Mar 2023 10:25:46 +0100 Subject: [PATCH 06/28] split invalid only-x86-windows into only-x86 and only-windows --- tests/ui/symbol-names/x86-stdcall.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/ui/symbol-names/x86-stdcall.rs b/tests/ui/symbol-names/x86-stdcall.rs index 9948488c0e950..dd0e5477e2e17 100644 --- a/tests/ui/symbol-names/x86-stdcall.rs +++ b/tests/ui/symbol-names/x86-stdcall.rs @@ -1,5 +1,6 @@ // build-pass -// only-x86-windows +// only-x86 +// only-windows #![crate_type = "cdylib"] #![feature(abi_vectorcall)] From 64af5093774f355875b6f0df339a392f153cc962 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 8 Mar 2023 10:13:02 +0100 Subject: [PATCH 07/28] remove invalid ignore-pretty --- tests/ui/abi/stack-probes-lto.rs | 1 - tests/ui/binding/optional_comma_in_match_arm.rs | 1 - tests/ui/borrowck/borrowck-pat-enum.rs | 1 - tests/ui/command/command-exec.rs | 1 - tests/ui/hygiene/arguments.rs | 2 -- tests/ui/hygiene/arguments.stderr | 2 +- tests/ui/hygiene/assoc_item_ctxt.rs | 2 -- tests/ui/hygiene/assoc_item_ctxt.stderr | 4 ++-- tests/ui/hygiene/assoc_ty_bindings.rs | 1 - tests/ui/hygiene/auxiliary/legacy_interaction.rs | 2 -- tests/ui/hygiene/fields.rs | 2 -- tests/ui/hygiene/fields.stderr | 8 ++++---- tests/ui/hygiene/generic_params.rs | 1 - tests/ui/hygiene/impl_items.rs | 2 -- tests/ui/hygiene/impl_items.stderr | 2 +- tests/ui/hygiene/intercrate.rs | 2 -- tests/ui/hygiene/intercrate.stderr | 2 +- tests/ui/hygiene/issue-47311.rs | 1 - tests/ui/hygiene/issue-47312.rs | 1 - tests/ui/hygiene/items.rs | 1 - tests/ui/hygiene/legacy_interaction.rs | 1 - tests/ui/hygiene/lexical.rs | 1 - tests/ui/hygiene/specialization.rs | 1 - tests/ui/hygiene/trait_items-2.rs | 1 - tests/ui/hygiene/wrap_unhygienic_example.rs | 1 - tests/ui/hygiene/xcrate.rs | 1 - .../issue-26873-multifile/issue-26873-multifile.rs | 1 - tests/ui/issues/issue-11709.rs | 1 - tests/ui/issues/issue-28839.rs | 1 - tests/ui/issues/issue-38190.rs | 1 - tests/ui/issues/issue-9129.rs | 1 - .../lexer-crlf-line-endings-string-literal-doc-comment.rs | 1 - tests/ui/macros/issue-40469.rs | 1 - tests/ui/macros/macro-comma-support-rpass.rs | 1 - tests/ui/macros/macro-include-items.rs | 1 - tests/ui/macros/syntax-extension-source-utils.rs | 7 +++---- tests/ui/modules/mod_dir_implicit.rs | 1 - tests/ui/modules/mod_dir_path.rs | 1 - tests/ui/modules/mod_dir_path2.rs | 1 - tests/ui/modules/mod_dir_path3.rs | 1 - tests/ui/modules/mod_dir_path_multi.rs | 1 - tests/ui/modules/mod_dir_recursive.rs | 1 - tests/ui/modules/mod_dir_simple.rs | 1 - tests/ui/modules/mod_file.rs | 1 - tests/ui/modules/mod_file_with_path_attr.rs | 1 - tests/ui/non_modrs_mods/non_modrs_mods.rs | 1 - tests/ui/parser/issues/issue-48508.rs | 1 - tests/ui/proc-macro/span-api-tests.rs | 1 - tests/ui/runtime/backtrace-debuginfo.rs | 1 - tests/ui/traits/dyn-trait.rs | 1 - 50 files changed, 12 insertions(+), 63 deletions(-) diff --git a/tests/ui/abi/stack-probes-lto.rs b/tests/ui/abi/stack-probes-lto.rs index a455eef42eacc..039507d51040b 100644 --- a/tests/ui/abi/stack-probes-lto.rs +++ b/tests/ui/abi/stack-probes-lto.rs @@ -9,7 +9,6 @@ // ignore-emscripten no processes // ignore-sgx no processes // ignore-musl FIXME #31506 -// ignore-pretty // ignore-fuchsia no exception handler registered for segfault // compile-flags: -C lto // no-prefer-dynamic diff --git a/tests/ui/binding/optional_comma_in_match_arm.rs b/tests/ui/binding/optional_comma_in_match_arm.rs index fc268bf2a45ad..71e2f07bb6b0b 100644 --- a/tests/ui/binding/optional_comma_in_match_arm.rs +++ b/tests/ui/binding/optional_comma_in_match_arm.rs @@ -1,6 +1,5 @@ // run-pass #![allow(unused_unsafe)] -// ignore-pretty issue #37199 #![allow(while_true)] fn main() { diff --git a/tests/ui/borrowck/borrowck-pat-enum.rs b/tests/ui/borrowck/borrowck-pat-enum.rs index 7f9c5544d0bd1..6e51a2b2e0274 100644 --- a/tests/ui/borrowck/borrowck-pat-enum.rs +++ b/tests/ui/borrowck/borrowck-pat-enum.rs @@ -1,6 +1,5 @@ // run-pass #![allow(dead_code)] -// ignore-pretty issue #37199 fn match_ref(v: Option) -> isize { match v { diff --git a/tests/ui/command/command-exec.rs b/tests/ui/command/command-exec.rs index 032dad1840d47..edc33446d79b6 100644 --- a/tests/ui/command/command-exec.rs +++ b/tests/ui/command/command-exec.rs @@ -2,7 +2,6 @@ #![allow(stable_features)] // ignore-windows - this is a unix-specific test -// ignore-pretty issue #37199 // ignore-emscripten no processes // ignore-sgx no processes // ignore-fuchsia no execvp syscall provided diff --git a/tests/ui/hygiene/arguments.rs b/tests/ui/hygiene/arguments.rs index f0f732f4c6ff3..ab58301d468b0 100644 --- a/tests/ui/hygiene/arguments.rs +++ b/tests/ui/hygiene/arguments.rs @@ -1,5 +1,3 @@ -// ignore-pretty pretty-printing is unhygienic - #![feature(decl_macro)] macro m($t:ty, $e:expr) { diff --git a/tests/ui/hygiene/arguments.stderr b/tests/ui/hygiene/arguments.stderr index d072086e086d6..714178375f2d1 100644 --- a/tests/ui/hygiene/arguments.stderr +++ b/tests/ui/hygiene/arguments.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `S` in this scope - --> $DIR/arguments.rs:16:8 + --> $DIR/arguments.rs:14:8 | LL | m!(S, S); | ^ not found in this scope diff --git a/tests/ui/hygiene/assoc_item_ctxt.rs b/tests/ui/hygiene/assoc_item_ctxt.rs index 65593d1d56077..f09f81a5d52d6 100644 --- a/tests/ui/hygiene/assoc_item_ctxt.rs +++ b/tests/ui/hygiene/assoc_item_ctxt.rs @@ -1,5 +1,3 @@ -// ignore-pretty pretty-printing is unhygienic - #![feature(decl_macro)] #![allow(unused)] diff --git a/tests/ui/hygiene/assoc_item_ctxt.stderr b/tests/ui/hygiene/assoc_item_ctxt.stderr index d65716ec2ce61..effa9e8d65592 100644 --- a/tests/ui/hygiene/assoc_item_ctxt.stderr +++ b/tests/ui/hygiene/assoc_item_ctxt.stderr @@ -1,5 +1,5 @@ error[E0407]: method `method` is not a member of trait `Tr` - --> $DIR/assoc_item_ctxt.rs:35:13 + --> $DIR/assoc_item_ctxt.rs:33:13 | LL | fn method() {} | ^^^------^^^^^ @@ -13,7 +13,7 @@ LL | mac_trait_impl!(); = note: this error originates in the macro `mac_trait_impl` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0046]: not all trait items implemented, missing: `method` - --> $DIR/assoc_item_ctxt.rs:34:9 + --> $DIR/assoc_item_ctxt.rs:32:9 | LL | fn method(); | ------------ `method` from trait diff --git a/tests/ui/hygiene/assoc_ty_bindings.rs b/tests/ui/hygiene/assoc_ty_bindings.rs index 0567beab9b9c8..a786127493298 100644 --- a/tests/ui/hygiene/assoc_ty_bindings.rs +++ b/tests/ui/hygiene/assoc_ty_bindings.rs @@ -1,5 +1,4 @@ // check-pass -// ignore-pretty pretty-printing is unhygienic #![feature(decl_macro, associated_type_defaults)] diff --git a/tests/ui/hygiene/auxiliary/legacy_interaction.rs b/tests/ui/hygiene/auxiliary/legacy_interaction.rs index 90d5243b74b7b..3293e346dadee 100644 --- a/tests/ui/hygiene/auxiliary/legacy_interaction.rs +++ b/tests/ui/hygiene/auxiliary/legacy_interaction.rs @@ -1,5 +1,3 @@ -// ignore-pretty pretty-printing is unhygienic - #[macro_export] macro_rules! m { () => { diff --git a/tests/ui/hygiene/fields.rs b/tests/ui/hygiene/fields.rs index 7a417b46fcc97..86b3d8151d04e 100644 --- a/tests/ui/hygiene/fields.rs +++ b/tests/ui/hygiene/fields.rs @@ -1,5 +1,3 @@ -// ignore-pretty pretty-printing is unhygienic - #![feature(decl_macro)] mod foo { diff --git a/tests/ui/hygiene/fields.stderr b/tests/ui/hygiene/fields.stderr index 978120b1f101d..99252c4b752cc 100644 --- a/tests/ui/hygiene/fields.stderr +++ b/tests/ui/hygiene/fields.stderr @@ -1,5 +1,5 @@ error: type `foo::S` is private - --> $DIR/fields.rs:15:17 + --> $DIR/fields.rs:13:17 | LL | let s = S { x: 0 }; | ^^^^^^^^^^ private type @@ -10,7 +10,7 @@ LL | let s = foo::m!(S, x); = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `foo::S` is private - --> $DIR/fields.rs:16:17 + --> $DIR/fields.rs:14:17 | LL | let _ = s.x; | ^ private type @@ -21,7 +21,7 @@ LL | let s = foo::m!(S, x); = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `T` is private - --> $DIR/fields.rs:18:17 + --> $DIR/fields.rs:16:17 | LL | let t = T(0); | ^^^^ private type @@ -32,7 +32,7 @@ LL | let s = foo::m!(S, x); = note: this error originates in the macro `foo::m` (in Nightly builds, run with -Z macro-backtrace for more info) error: type `T` is private - --> $DIR/fields.rs:19:17 + --> $DIR/fields.rs:17:17 | LL | let _ = t.0; | ^ private type diff --git a/tests/ui/hygiene/generic_params.rs b/tests/ui/hygiene/generic_params.rs index 3b6216c3e6372..b42152955f77b 100644 --- a/tests/ui/hygiene/generic_params.rs +++ b/tests/ui/hygiene/generic_params.rs @@ -1,7 +1,6 @@ // Ensure that generic parameters always have modern hygiene. // check-pass -// ignore-pretty pretty-printing is unhygienic #![feature(decl_macro, rustc_attrs)] diff --git a/tests/ui/hygiene/impl_items.rs b/tests/ui/hygiene/impl_items.rs index ddb25c06b1b17..51088e3693d73 100644 --- a/tests/ui/hygiene/impl_items.rs +++ b/tests/ui/hygiene/impl_items.rs @@ -1,5 +1,3 @@ -// ignore-pretty pretty-printing is unhygienic - #![feature(decl_macro)] mod foo { diff --git a/tests/ui/hygiene/impl_items.stderr b/tests/ui/hygiene/impl_items.stderr index 46a2500386e0f..32ba3741a59e6 100644 --- a/tests/ui/hygiene/impl_items.stderr +++ b/tests/ui/hygiene/impl_items.stderr @@ -1,5 +1,5 @@ error: type `for<'a> fn(&'a foo::S) {foo::S::f}` is private - --> $DIR/impl_items.rs:12:23 + --> $DIR/impl_items.rs:10:23 | LL | let _: () = S.f(); | ^ private type diff --git a/tests/ui/hygiene/intercrate.rs b/tests/ui/hygiene/intercrate.rs index d9b5b789e4ab5..2de62f6aff77f 100644 --- a/tests/ui/hygiene/intercrate.rs +++ b/tests/ui/hygiene/intercrate.rs @@ -1,5 +1,3 @@ -// ignore-pretty pretty-printing is unhygienic - // aux-build:intercrate.rs #![feature(decl_macro)] diff --git a/tests/ui/hygiene/intercrate.stderr b/tests/ui/hygiene/intercrate.stderr index 91358b279e2b2..f108617fba615 100644 --- a/tests/ui/hygiene/intercrate.stderr +++ b/tests/ui/hygiene/intercrate.stderr @@ -1,5 +1,5 @@ error: type `fn() -> u32 {foo::bar::f}` is private - --> $DIR/intercrate.rs:10:16 + --> $DIR/intercrate.rs:8:16 | LL | assert_eq!(intercrate::foo::m!(), 1); | ^^^^^^^^^^^^^^^^^^^^^ private type diff --git a/tests/ui/hygiene/issue-47311.rs b/tests/ui/hygiene/issue-47311.rs index 5c2379a8ababf..3f1b7397301c1 100644 --- a/tests/ui/hygiene/issue-47311.rs +++ b/tests/ui/hygiene/issue-47311.rs @@ -1,5 +1,4 @@ // check-pass -// ignore-pretty pretty-printing is unhygienic #![feature(decl_macro)] #![allow(unused)] diff --git a/tests/ui/hygiene/issue-47312.rs b/tests/ui/hygiene/issue-47312.rs index bbcb3a7f39311..c8b5c36767cf6 100644 --- a/tests/ui/hygiene/issue-47312.rs +++ b/tests/ui/hygiene/issue-47312.rs @@ -1,5 +1,4 @@ // check-pass -// ignore-pretty pretty-printing is unhygienic #![feature(decl_macro)] #![allow(unused)] diff --git a/tests/ui/hygiene/items.rs b/tests/ui/hygiene/items.rs index 1c625a9728c4f..a7ed749f526ea 100644 --- a/tests/ui/hygiene/items.rs +++ b/tests/ui/hygiene/items.rs @@ -1,5 +1,4 @@ // check-pass -// ignore-pretty pretty-printing is unhygienic #![feature(decl_macro)] diff --git a/tests/ui/hygiene/legacy_interaction.rs b/tests/ui/hygiene/legacy_interaction.rs index 52008eed51515..4d150baf5d491 100644 --- a/tests/ui/hygiene/legacy_interaction.rs +++ b/tests/ui/hygiene/legacy_interaction.rs @@ -1,6 +1,5 @@ // check-pass #![allow(dead_code)] -// ignore-pretty pretty-printing is unhygienic // aux-build:legacy_interaction.rs diff --git a/tests/ui/hygiene/lexical.rs b/tests/ui/hygiene/lexical.rs index 3d25c720989bf..81de974c20355 100644 --- a/tests/ui/hygiene/lexical.rs +++ b/tests/ui/hygiene/lexical.rs @@ -1,5 +1,4 @@ // check-pass -// ignore-pretty pretty-printing is unhygienic #![feature(decl_macro)] diff --git a/tests/ui/hygiene/specialization.rs b/tests/ui/hygiene/specialization.rs index 656aa880ad1f1..b8c4c1b0d587c 100644 --- a/tests/ui/hygiene/specialization.rs +++ b/tests/ui/hygiene/specialization.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty pretty-printing is unhygienic #![feature(decl_macro)] diff --git a/tests/ui/hygiene/trait_items-2.rs b/tests/ui/hygiene/trait_items-2.rs index 39edfc37d6978..cd9122656cd2d 100644 --- a/tests/ui/hygiene/trait_items-2.rs +++ b/tests/ui/hygiene/trait_items-2.rs @@ -1,5 +1,4 @@ // check-pass -// ignore-pretty pretty-printing is unhygienic #![feature(decl_macro)] diff --git a/tests/ui/hygiene/wrap_unhygienic_example.rs b/tests/ui/hygiene/wrap_unhygienic_example.rs index 50c6b35ab18dd..f6b48156888cf 100644 --- a/tests/ui/hygiene/wrap_unhygienic_example.rs +++ b/tests/ui/hygiene/wrap_unhygienic_example.rs @@ -1,5 +1,4 @@ // check-pass -// ignore-pretty pretty-printing is unhygienic // aux-build:my_crate.rs // aux-build:unhygienic_example.rs diff --git a/tests/ui/hygiene/xcrate.rs b/tests/ui/hygiene/xcrate.rs index 6981ce3f687d1..6366bebb52f3f 100644 --- a/tests/ui/hygiene/xcrate.rs +++ b/tests/ui/hygiene/xcrate.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty pretty-printing is unhygienic // aux-build:xcrate.rs diff --git a/tests/ui/imports/issue-26873-multifile/issue-26873-multifile.rs b/tests/ui/imports/issue-26873-multifile/issue-26873-multifile.rs index da2acf6c9f704..d369f1e71d06f 100644 --- a/tests/ui/imports/issue-26873-multifile/issue-26873-multifile.rs +++ b/tests/ui/imports/issue-26873-multifile/issue-26873-multifile.rs @@ -3,7 +3,6 @@ #![allow(unused_imports)] #![allow(non_snake_case)] -// ignore-pretty issue #37195 #[path = "issue-26873-multifile/mod.rs"] mod multifile; diff --git a/tests/ui/issues/issue-11709.rs b/tests/ui/issues/issue-11709.rs index cb5e3dff3b31b..58424f9e4c583 100644 --- a/tests/ui/issues/issue-11709.rs +++ b/tests/ui/issues/issue-11709.rs @@ -1,6 +1,5 @@ // run-pass #![allow(dead_code)] -// ignore-pretty issue #37199 // Don't panic on blocks without results // There are several tests in this run-pass that raised diff --git a/tests/ui/issues/issue-28839.rs b/tests/ui/issues/issue-28839.rs index 73be87a0c1e69..c086f412a2885 100644 --- a/tests/ui/issues/issue-28839.rs +++ b/tests/ui/issues/issue-28839.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37199 pub struct Foo; diff --git a/tests/ui/issues/issue-38190.rs b/tests/ui/issues/issue-38190.rs index cfa0420c80d1d..3bb4c7b980cac 100644 --- a/tests/ui/issues/issue-38190.rs +++ b/tests/ui/issues/issue-38190.rs @@ -1,6 +1,5 @@ // run-pass // aux-build:issue-38190.rs -// ignore-pretty issue #37195 #[macro_use] extern crate issue_38190; diff --git a/tests/ui/issues/issue-9129.rs b/tests/ui/issues/issue-9129.rs index 04110b3ae8959..5d623ed540f76 100644 --- a/tests/ui/issues/issue-9129.rs +++ b/tests/ui/issues/issue-9129.rs @@ -2,7 +2,6 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] -// ignore-pretty unreported pub trait bomb { fn boom(&self, _: Ident); } pub struct S; diff --git a/tests/ui/lexer/lexer-crlf-line-endings-string-literal-doc-comment.rs b/tests/ui/lexer/lexer-crlf-line-endings-string-literal-doc-comment.rs index 802be7f5afb57..9ba01540aaf23 100644 --- a/tests/ui/lexer/lexer-crlf-line-endings-string-literal-doc-comment.rs +++ b/tests/ui/lexer/lexer-crlf-line-endings-string-literal-doc-comment.rs @@ -6,7 +6,6 @@ // N.B., this file needs CRLF line endings. The .gitattributes file in // this directory should enforce it. -// ignore-pretty issue #37195 /// Doc comment that ends in CRLF pub fn foo() {} diff --git a/tests/ui/macros/issue-40469.rs b/tests/ui/macros/issue-40469.rs index 25e08ef85e967..9b22aaef289a5 100644 --- a/tests/ui/macros/issue-40469.rs +++ b/tests/ui/macros/issue-40469.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 #![allow(dead_code)] diff --git a/tests/ui/macros/macro-comma-support-rpass.rs b/tests/ui/macros/macro-comma-support-rpass.rs index 25b8c3cc62e16..cb019792e656f 100644 --- a/tests/ui/macros/macro-comma-support-rpass.rs +++ b/tests/ui/macros/macro-comma-support-rpass.rs @@ -8,7 +8,6 @@ // implementations for some macro_rules! macros as an implementation // detail. -// ignore-pretty issue #37195 // compile-flags: --test -C debug_assertions=yes // revisions: std core diff --git a/tests/ui/macros/macro-include-items.rs b/tests/ui/macros/macro-include-items.rs index 332bf59c944eb..ad6f04009b6c7 100644 --- a/tests/ui/macros/macro-include-items.rs +++ b/tests/ui/macros/macro-include-items.rs @@ -1,7 +1,6 @@ // run-pass #![allow(non_camel_case_types)] -// ignore-pretty issue #37195 fn bar() {} diff --git a/tests/ui/macros/syntax-extension-source-utils.rs b/tests/ui/macros/syntax-extension-source-utils.rs index 7e46260d5163f..f41faddddf6ce 100644 --- a/tests/ui/macros/syntax-extension-source-utils.rs +++ b/tests/ui/macros/syntax-extension-source-utils.rs @@ -1,7 +1,6 @@ // run-pass #![allow(stable_features)] -// ignore-pretty issue #37195 pub mod m1 { pub mod m2 { @@ -14,9 +13,9 @@ pub mod m1 { macro_rules! indirect_line { () => ( line!() ) } pub fn main() { - assert_eq!(line!(), 17); + assert_eq!(line!(), 16); assert_eq!(column!(), 16); - assert_eq!(indirect_line!(), 19); + assert_eq!(indirect_line!(), 18); assert!((file!().ends_with("syntax-extension-source-utils.rs"))); assert_eq!(stringify!((2*3) + 5).to_string(), "(2 * 3) + 5".to_string()); assert!(include!("syntax-extension-source-utils-files/includeme.\ @@ -33,5 +32,5 @@ pub fn main() { // The Windows tests are wrapped in an extra module for some reason assert!((m1::m2::where_am_i().ends_with("m1::m2"))); - assert_eq!((36, "(2 * 3) + 5"), (line!(), stringify!((2*3) + 5))); + assert_eq!((35, "(2 * 3) + 5"), (line!(), stringify!((2*3) + 5))); } diff --git a/tests/ui/modules/mod_dir_implicit.rs b/tests/ui/modules/mod_dir_implicit.rs index d6ea6a98bda46..7eac90f4d9b63 100644 --- a/tests/ui/modules/mod_dir_implicit.rs +++ b/tests/ui/modules/mod_dir_implicit.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 mod mod_dir_implicit_aux; diff --git a/tests/ui/modules/mod_dir_path.rs b/tests/ui/modules/mod_dir_path.rs index 70f592d0c0edd..72db8e44be31d 100644 --- a/tests/ui/modules/mod_dir_path.rs +++ b/tests/ui/modules/mod_dir_path.rs @@ -1,6 +1,5 @@ // run-pass #![allow(unused_macros)] -// ignore-pretty issue #37195 mod mod_dir_simple { #[path = "test.rs"] diff --git a/tests/ui/modules/mod_dir_path2.rs b/tests/ui/modules/mod_dir_path2.rs index c3e3e1d639e90..b4f8f1c84547c 100644 --- a/tests/ui/modules/mod_dir_path2.rs +++ b/tests/ui/modules/mod_dir_path2.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 #[path = "mod_dir_simple"] mod pancakes { diff --git a/tests/ui/modules/mod_dir_path3.rs b/tests/ui/modules/mod_dir_path3.rs index fed70c1bc9845..56980c01049b3 100644 --- a/tests/ui/modules/mod_dir_path3.rs +++ b/tests/ui/modules/mod_dir_path3.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 #[path = "mod_dir_simple"] mod pancakes { diff --git a/tests/ui/modules/mod_dir_path_multi.rs b/tests/ui/modules/mod_dir_path_multi.rs index 2b805141a63d8..1c111294a337e 100644 --- a/tests/ui/modules/mod_dir_path_multi.rs +++ b/tests/ui/modules/mod_dir_path_multi.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 #[path = "mod_dir_simple"] mod biscuits { diff --git a/tests/ui/modules/mod_dir_recursive.rs b/tests/ui/modules/mod_dir_recursive.rs index b109d13d1643d..56f26139828f5 100644 --- a/tests/ui/modules/mod_dir_recursive.rs +++ b/tests/ui/modules/mod_dir_recursive.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 // Testing that the parser for each file tracks its modules // and paths independently. The load_another_mod module should diff --git a/tests/ui/modules/mod_dir_simple.rs b/tests/ui/modules/mod_dir_simple.rs index 1d92c968a8fe6..56f15b1d6105a 100644 --- a/tests/ui/modules/mod_dir_simple.rs +++ b/tests/ui/modules/mod_dir_simple.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 mod mod_dir_simple { pub mod test; diff --git a/tests/ui/modules/mod_file.rs b/tests/ui/modules/mod_file.rs index 0ca52889e5c9f..7b56b99eb3ace 100644 --- a/tests/ui/modules/mod_file.rs +++ b/tests/ui/modules/mod_file.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 // Testing that a plain .rs file can load modules from other source files diff --git a/tests/ui/modules/mod_file_with_path_attr.rs b/tests/ui/modules/mod_file_with_path_attr.rs index 48e253eadae50..e739366954eb6 100644 --- a/tests/ui/modules/mod_file_with_path_attr.rs +++ b/tests/ui/modules/mod_file_with_path_attr.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37195 // Testing that a plain .rs file can load modules from other source files diff --git a/tests/ui/non_modrs_mods/non_modrs_mods.rs b/tests/ui/non_modrs_mods/non_modrs_mods.rs index f664b0166d80d..b3fa390087f5c 100644 --- a/tests/ui/non_modrs_mods/non_modrs_mods.rs +++ b/tests/ui/non_modrs_mods/non_modrs_mods.rs @@ -1,6 +1,5 @@ // run-pass // -// ignore-pretty issue #37195 pub mod modrs_mod; pub mod foors_mod; #[path = "some_crazy_attr_mod_dir/arbitrary_name.rs"] diff --git a/tests/ui/parser/issues/issue-48508.rs b/tests/ui/parser/issues/issue-48508.rs index 37d04c5d65f06..1e7db9df814b4 100644 --- a/tests/ui/parser/issues/issue-48508.rs +++ b/tests/ui/parser/issues/issue-48508.rs @@ -7,7 +7,6 @@ // issue-48508-aux.rs // compile-flags:-g -// ignore-pretty issue #37195 // ignore-asmjs wasm2js does not support source maps yet #![allow(uncommon_codepoints)] diff --git a/tests/ui/proc-macro/span-api-tests.rs b/tests/ui/proc-macro/span-api-tests.rs index 3f04ba866b7d6..7493f9cdb3de2 100644 --- a/tests/ui/proc-macro/span-api-tests.rs +++ b/tests/ui/proc-macro/span-api-tests.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty // aux-build:span-api-tests.rs // aux-build:span-test-macros.rs // compile-flags: -Ztranslate-remapped-path-to-local-path=yes diff --git a/tests/ui/runtime/backtrace-debuginfo.rs b/tests/ui/runtime/backtrace-debuginfo.rs index 8b5466b6cfa0b..5d233b38dbe20 100644 --- a/tests/ui/runtime/backtrace-debuginfo.rs +++ b/tests/ui/runtime/backtrace-debuginfo.rs @@ -9,7 +9,6 @@ // compile-flags:-g -Copt-level=0 -Cllvm-args=-enable-tail-merge=0 // compile-flags:-Cforce-frame-pointers=yes // compile-flags:-Cstrip=none -// ignore-pretty issue #37195 // ignore-emscripten spawning processes is not supported // ignore-sgx no processes // ignore-fuchsia Backtrace not symbolized, trace different line alignment diff --git a/tests/ui/traits/dyn-trait.rs b/tests/ui/traits/dyn-trait.rs index e1c1a8de55a08..10e69105cedae 100644 --- a/tests/ui/traits/dyn-trait.rs +++ b/tests/ui/traits/dyn-trait.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty `dyn ::foo` parses differently in the current edition use std::fmt::Display; From e592aaa70596741af5969a91f6054a0b16b60352 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 8 Mar 2023 10:14:42 +0100 Subject: [PATCH 08/28] remove invalid ignore-powerpc64le --- tests/codegen/global_asm.rs | 1 - tests/codegen/global_asm_include.rs | 1 - tests/codegen/global_asm_x2.rs | 1 - .../codegen/repr-transparent-aggregates-2.rs | 1 - tests/ui/target-feature/gate.rs | 1 - tests/ui/target-feature/gate.stderr | 2 +- tests/ui/target-feature/invalid-attribute.rs | 1 - .../target-feature/invalid-attribute.stderr | 44 +++++++++---------- 8 files changed, 23 insertions(+), 29 deletions(-) diff --git a/tests/codegen/global_asm.rs b/tests/codegen/global_asm.rs index fab84868fdfbb..9d27fc447f6fc 100644 --- a/tests/codegen/global_asm.rs +++ b/tests/codegen/global_asm.rs @@ -10,7 +10,6 @@ // ignore-mips64 // ignore-msp430 // ignore-powerpc64 -// ignore-powerpc64le // ignore-powerpc // ignore-r600 // ignore-amdgcn diff --git a/tests/codegen/global_asm_include.rs b/tests/codegen/global_asm_include.rs index 02ee916458f4a..438d37445c2b1 100644 --- a/tests/codegen/global_asm_include.rs +++ b/tests/codegen/global_asm_include.rs @@ -10,7 +10,6 @@ // ignore-mips64 // ignore-msp430 // ignore-powerpc64 -// ignore-powerpc64le // ignore-powerpc // ignore-r600 // ignore-amdgcn diff --git a/tests/codegen/global_asm_x2.rs b/tests/codegen/global_asm_x2.rs index bdcf0ea843c4c..f9840e44157b0 100644 --- a/tests/codegen/global_asm_x2.rs +++ b/tests/codegen/global_asm_x2.rs @@ -10,7 +10,6 @@ // ignore-mips64 // ignore-msp430 // ignore-powerpc64 -// ignore-powerpc64le // ignore-powerpc // ignore-r600 // ignore-amdgcn diff --git a/tests/codegen/repr-transparent-aggregates-2.rs b/tests/codegen/repr-transparent-aggregates-2.rs index df7e88f08c733..e9fa5143b1889 100644 --- a/tests/codegen/repr-transparent-aggregates-2.rs +++ b/tests/codegen/repr-transparent-aggregates-2.rs @@ -6,7 +6,6 @@ // ignore-mips64 // ignore-powerpc // ignore-powerpc64 -// ignore-powerpc64le // ignore-riscv64 see codegen/riscv-abi // ignore-s390x // ignore-sparc diff --git a/tests/ui/target-feature/gate.rs b/tests/ui/target-feature/gate.rs index 2382c98f8f128..2eea087c7059b 100644 --- a/tests/ui/target-feature/gate.rs +++ b/tests/ui/target-feature/gate.rs @@ -6,7 +6,6 @@ // ignore-mips64 // ignore-powerpc // ignore-powerpc64 -// ignore-powerpc64le // ignore-riscv64 // ignore-sparc // ignore-sparc64 diff --git a/tests/ui/target-feature/gate.stderr b/tests/ui/target-feature/gate.stderr index ee542b60a2634..2d6abcc0a0150 100644 --- a/tests/ui/target-feature/gate.stderr +++ b/tests/ui/target-feature/gate.stderr @@ -1,5 +1,5 @@ error[E0658]: the target feature `avx512bw` is currently unstable - --> $DIR/gate.rs:32:18 + --> $DIR/gate.rs:31:18 | LL | #[target_feature(enable = "avx512bw")] | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/target-feature/invalid-attribute.rs b/tests/ui/target-feature/invalid-attribute.rs index 0c400d7bf9724..b59ed076f936c 100644 --- a/tests/ui/target-feature/invalid-attribute.rs +++ b/tests/ui/target-feature/invalid-attribute.rs @@ -6,7 +6,6 @@ // ignore-mips64 // ignore-powerpc // ignore-powerpc64 -// ignore-powerpc64le // ignore-riscv64 // ignore-s390x // ignore-sparc diff --git a/tests/ui/target-feature/invalid-attribute.stderr b/tests/ui/target-feature/invalid-attribute.stderr index 6d37d0917bc61..c36392d430f73 100644 --- a/tests/ui/target-feature/invalid-attribute.stderr +++ b/tests/ui/target-feature/invalid-attribute.stderr @@ -1,11 +1,11 @@ error: malformed `target_feature` attribute input - --> $DIR/invalid-attribute.rs:32:1 + --> $DIR/invalid-attribute.rs:31:1 | LL | #[target_feature = "+sse2"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[target_feature(enable = "name")]` error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:17:1 + --> $DIR/invalid-attribute.rs:16:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -14,7 +14,7 @@ LL | extern crate alloc; | ------------------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:22:1 + --> $DIR/invalid-attribute.rs:21:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | use alloc::alloc::alloc; | ------------------------ not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:27:1 + --> $DIR/invalid-attribute.rs:26:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -32,7 +32,7 @@ LL | extern "Rust" {} | ---------------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:49:1 + --> $DIR/invalid-attribute.rs:48:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -41,7 +41,7 @@ LL | mod another {} | -------------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:54:1 + --> $DIR/invalid-attribute.rs:53:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -50,7 +50,7 @@ LL | const FOO: usize = 7; | --------------------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:59:1 + --> $DIR/invalid-attribute.rs:58:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | struct Foo; | ----------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:64:1 + --> $DIR/invalid-attribute.rs:63:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -68,7 +68,7 @@ LL | enum Bar {} | ----------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:69:1 + --> $DIR/invalid-attribute.rs:68:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -81,7 +81,7 @@ LL | | } | |_- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:77:1 + --> $DIR/invalid-attribute.rs:76:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -90,7 +90,7 @@ LL | type Uwu = (); | -------------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:82:1 + --> $DIR/invalid-attribute.rs:81:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -99,7 +99,7 @@ LL | trait Baz {} | ------------ not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:92:1 + --> $DIR/invalid-attribute.rs:91:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -108,7 +108,7 @@ LL | static A: () = (); | ------------------ not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:97:1 + --> $DIR/invalid-attribute.rs:96:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -117,7 +117,7 @@ LL | impl Quux for u8 {} | ------------------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:102:1 + --> $DIR/invalid-attribute.rs:101:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -126,7 +126,7 @@ LL | impl Foo {} | ----------- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:120:5 + --> $DIR/invalid-attribute.rs:119:5 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -138,7 +138,7 @@ LL | | } | |_____- not a function definition error: attribute should be applied to a function definition - --> $DIR/invalid-attribute.rs:128:5 + --> $DIR/invalid-attribute.rs:127:5 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -147,25 +147,25 @@ LL | || {}; | ----- not a function definition error: the feature named `foo` is not valid for this target - --> $DIR/invalid-attribute.rs:34:18 + --> $DIR/invalid-attribute.rs:33:18 | LL | #[target_feature(enable = "foo")] | ^^^^^^^^^^^^^^ `foo` is not valid for this target error: malformed `target_feature` attribute input - --> $DIR/invalid-attribute.rs:37:18 + --> $DIR/invalid-attribute.rs:36:18 | LL | #[target_feature(bar)] | ^^^ help: must be of the form: `enable = ".."` error: malformed `target_feature` attribute input - --> $DIR/invalid-attribute.rs:39:18 + --> $DIR/invalid-attribute.rs:38:18 | LL | #[target_feature(disable = "baz")] | ^^^^^^^^^^^^^^^ help: must be of the form: `enable = ".."` error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions - --> $DIR/invalid-attribute.rs:43:1 + --> $DIR/invalid-attribute.rs:42:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -177,13 +177,13 @@ LL | fn bar() {} = help: add `#![feature(target_feature_11)]` to the crate attributes to enable error: cannot use `#[inline(always)]` with `#[target_feature]` - --> $DIR/invalid-attribute.rs:87:1 + --> $DIR/invalid-attribute.rs:86:1 | LL | #[inline(always)] | ^^^^^^^^^^^^^^^^^ error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions - --> $DIR/invalid-attribute.rs:112:5 + --> $DIR/invalid-attribute.rs:111:5 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From ef2bf6d5053f55057aecd0f0cb35c13ef332d72a Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 9 Mar 2023 14:52:45 +0100 Subject: [PATCH 09/28] implement --print=all-target-specs-json --- compiler/rustc_driver_impl/src/lib.rs | 11 +++++++++++ compiler/rustc_session/src/config.rs | 19 ++++++++++++++++--- .../valid-print-requests.stderr | 2 +- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index b96b356f55177..730d41ab962f8 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -44,8 +44,10 @@ use rustc_session::{early_error, early_error_no_abort, early_warn}; use rustc_span::source_map::{FileLoader, FileName}; use rustc_span::symbol::sym; use rustc_target::json::ToJson; +use rustc_target::spec::{Target, TargetTriple}; use std::cmp::max; +use std::collections::BTreeMap; use std::env; use std::ffi::OsString; use std::fs; @@ -648,6 +650,15 @@ fn print_crate_info( TargetSpec => { println!("{}", serde_json::to_string_pretty(&sess.target.to_json()).unwrap()); } + AllTargetSpecs => { + let mut targets = BTreeMap::new(); + for name in rustc_target::spec::TARGETS { + let triple = TargetTriple::from_triple(name); + let target = Target::expect_builtin(&triple); + targets.insert(name, target.to_json()); + } + println!("{}", serde_json::to_string_pretty(&targets).unwrap()); + } FileNames | CrateName => { let Some(attrs) = attrs.as_ref() else { // no crate attributes, print out an error and exit diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 485c3f554625a..7ad3d59a1d3a2 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -580,6 +580,7 @@ pub enum PrintRequest { CodeModels, TlsModels, TargetSpec, + AllTargetSpecs, NativeStaticLibs, StackProtectorStrategies, LinkArgs, @@ -1439,8 +1440,8 @@ pub fn rustc_short_optgroups() -> Vec { "Compiler information to print on stdout", "[crate-name|file-names|sysroot|target-libdir|cfg|calling-conventions|\ target-list|target-cpus|target-features|relocation-models|code-models|\ - tls-models|target-spec-json|native-static-libs|stack-protector-strategies|\ - link-args]", + tls-models|target-spec-json|all-target-specs-json|native-static-libs|\ + stack-protector-strategies|link-args]", ), opt::flagmulti_s("g", "", "Equivalent to -C debuginfo=2"), opt::flagmulti_s("O", "", "Equivalent to -C opt-level=2"), @@ -1887,6 +1888,7 @@ fn collect_print_requests( ("native-static-libs", PrintRequest::NativeStaticLibs), ("stack-protector-strategies", PrintRequest::StackProtectorStrategies), ("target-spec-json", PrintRequest::TargetSpec), + ("all-target-specs-json", PrintRequest::AllTargetSpecs), ("link-args", PrintRequest::LinkArgs), ("split-debuginfo", PrintRequest::SplitDebuginfo), ]; @@ -1900,7 +1902,18 @@ fn collect_print_requests( early_error( error_format, "the `-Z unstable-options` flag must also be passed to \ - enable the target-spec-json print option", + enable the target-spec-json print option", + ); + } + } + Some((_, PrintRequest::AllTargetSpecs)) => { + if unstable_opts.unstable_options { + PrintRequest::AllTargetSpecs + } else { + early_error( + error_format, + "the `-Z unstable-options` flag must also be passed to \ + enable the all-target-specs-json print option", ); } } diff --git a/tests/run-make/valid-print-requests/valid-print-requests.stderr b/tests/run-make/valid-print-requests/valid-print-requests.stderr index 5191e4676486a..bea6ce067f6e8 100644 --- a/tests/run-make/valid-print-requests/valid-print-requests.stderr +++ b/tests/run-make/valid-print-requests/valid-print-requests.stderr @@ -1,2 +1,2 @@ -error: unknown print request `uwu`. Valid print requests are: `crate-name`, `file-names`, `sysroot`, `target-libdir`, `cfg`, `calling-conventions`, `target-list`, `target-cpus`, `target-features`, `relocation-models`, `code-models`, `tls-models`, `native-static-libs`, `stack-protector-strategies`, `target-spec-json`, `link-args`, `split-debuginfo` +error: unknown print request `uwu`. Valid print requests are: `crate-name`, `file-names`, `sysroot`, `target-libdir`, `cfg`, `calling-conventions`, `target-list`, `target-cpus`, `target-features`, `relocation-models`, `code-models`, `tls-models`, `native-static-libs`, `stack-protector-strategies`, `target-spec-json`, `all-target-specs-json`, `link-args`, `split-debuginfo` From 0e6d2053b460a130ad798a5037708bb01352b3ea Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 9 Mar 2023 17:04:11 +0100 Subject: [PATCH 10/28] use target specs rather than --print=cfg to discover targets --- src/tools/compiletest/src/common.rs | 78 +++++++++++------------------ 1 file changed, 29 insertions(+), 49 deletions(-) diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 86810179ff8bc..03c0f2982fa73 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -11,6 +11,7 @@ use crate::util::{add_dylib_path, PathBufExt}; use lazycell::LazyCell; use std::collections::HashSet; use test::{ColorConfig, OutputFormat}; +use serde::de::{Deserialize, Deserializer, Error as _}; macro_rules! string_enum { ($(#[$meta:meta])* $vis:vis enum $name:ident { $($variant:ident => $repr:expr,)* }) => { @@ -114,8 +115,10 @@ string_enum! { } } -#[derive(Clone, Copy, Debug, PartialEq)] +#[derive(Clone, Copy, Debug, PartialEq, Default, serde::Deserialize)] +#[serde(rename_all = "kebab-case")] pub enum PanicStrategy { + #[default] Unwind, Abort, } @@ -450,72 +453,43 @@ impl TargetCfgs { } } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, serde::Deserialize)] +#[serde(rename_all = "kebab-case")] pub struct TargetCfg { pub(crate) arch: String, + #[serde(default)] pub(crate) os: String, + #[serde(default)] pub(crate) env: String, + #[serde(default)] pub(crate) abi: String, + #[serde(rename = "target-family", default)] pub(crate) families: Vec, + #[serde(rename = "target-pointer-width", deserialize_with = "serde_parse_u32")] pub(crate) pointer_width: u32, + #[serde(rename = "target-endian", default)] endian: Endian, + #[serde(rename = "panic-strategy", default)] panic: PanicStrategy, } -#[derive(Eq, PartialEq, Clone, Debug)] +#[derive(Eq, PartialEq, Clone, Debug, Default, serde::Deserialize)] +#[serde(rename_all = "kebab-case")] pub enum Endian { + #[default] Little, Big, } impl TargetCfg { fn new(config: &Config, target: &str) -> TargetCfg { - let print_cfg = rustc_output(config, &["--print=cfg", "--target", target]); - let mut arch = None; - let mut os = None; - let mut env = None; - let mut abi = None; - let mut families = Vec::new(); - let mut pointer_width = None; - let mut endian = None; - let mut panic = None; - for line in print_cfg.lines() { - if let Some((name, value)) = line.split_once('=') { - let value = value.trim_matches('"'); - match name { - "target_arch" => arch = Some(value), - "target_os" => os = Some(value), - "target_env" => env = Some(value), - "target_abi" => abi = Some(value), - "target_family" => families.push(value.to_string()), - "target_pointer_width" => pointer_width = Some(value.parse().unwrap()), - "target_endian" => { - endian = Some(match value { - "little" => Endian::Little, - "big" => Endian::Big, - s => panic!("unexpected {s}"), - }) - } - "panic" => { - panic = match value { - "abort" => Some(PanicStrategy::Abort), - "unwind" => Some(PanicStrategy::Unwind), - s => panic!("unexpected {s}"), - } - } - _ => {} - } - } - } - TargetCfg { - arch: arch.unwrap().to_string(), - os: os.unwrap().to_string(), - env: env.unwrap().to_string(), - abi: abi.unwrap().to_string(), - families, - pointer_width: pointer_width.unwrap(), - endian: endian.unwrap(), - panic: panic.unwrap(), + let json = rustc_output( + config, + &["--print=target-spec-json", "-Zunstable-options", "--target", target], + ); + match serde_json::from_str(&json) { + Ok(res) => res, + Err(err) => panic!("failed to parse target spec for {target}: {err}"), } } } @@ -524,6 +498,7 @@ fn rustc_output(config: &Config, args: &[&str]) -> String { let mut command = Command::new(&config.rustc_path); add_dylib_path(&mut command, iter::once(&config.compile_lib_path)); command.args(&config.target_rustcflags).args(args); + command.env("RUSTC_BOOTSTRAP", "1"); let output = match command.output() { Ok(output) => output, @@ -539,6 +514,11 @@ fn rustc_output(config: &Config, args: &[&str]) -> String { String::from_utf8(output.stdout).unwrap() } +fn serde_parse_u32<'de, D: Deserializer<'de>>(deserializer: D) -> Result { + let string = String::deserialize(deserializer)?; + string.parse().map_err(D::Error::custom) +} + #[derive(Debug, Clone)] pub struct TestPaths { pub file: PathBuf, // e.g., compile-test/foo/bar/baz.rs From c075691b825dce55e4261aba570cd2d9665950c0 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 9 Mar 2023 17:14:25 +0100 Subject: [PATCH 11/28] use --print=all-target-specs-json for stage1+ --- src/tools/compiletest/src/common.rs | 53 ++++++++++++++++++----------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 03c0f2982fa73..833579aa926e6 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -9,9 +9,9 @@ use std::str::FromStr; use crate::util::{add_dylib_path, PathBufExt}; use lazycell::LazyCell; -use std::collections::HashSet; -use test::{ColorConfig, OutputFormat}; use serde::de::{Deserialize, Deserializer, Error as _}; +use std::collections::{HashMap, HashSet}; +use test::{ColorConfig, OutputFormat}; macro_rules! string_enum { ($(#[$meta:meta])* $vis:vis enum $name:ident { $($variant:ident => $repr:expr,)* }) => { @@ -410,8 +410,17 @@ pub struct TargetCfgs { impl TargetCfgs { fn new(config: &Config) -> TargetCfgs { - // Gather list of all targets - let targets = rustc_output(config, &["--print=target-list"]); + let targets: HashMap = if config.stage_id.starts_with("stage0-") { + // #[cfg(bootstrap)] + // Needed only for one cycle, remove during the bootstrap bump. + Self::collect_all_slow(config) + } else { + serde_json::from_str(&rustc_output( + config, + &["--print=all-target-specs-json", "-Zunstable-options"], + )) + .unwrap() + }; let mut current = None; let mut all_targets = HashSet::new(); @@ -422,9 +431,7 @@ impl TargetCfgs { let mut all_families = HashSet::new(); let mut all_pointer_widths = HashSet::new(); - for target in targets.trim().lines() { - let cfg = TargetCfg::new(config, target); - + for (target, cfg) in targets.into_iter() { all_archs.insert(cfg.arch.clone()); all_oses.insert(cfg.os.clone()); all_envs.insert(cfg.env.clone()); @@ -451,6 +458,25 @@ impl TargetCfgs { all_pointer_widths, } } + + // #[cfg(bootstrap)] + // Needed only for one cycle, remove during the bootstrap bump. + fn collect_all_slow(config: &Config) -> HashMap { + let mut result = HashMap::new(); + for target in rustc_output(config, &["--print=target-list"]).trim().lines() { + let json = rustc_output( + config, + &["--print=target-spec-json", "-Zunstable-options", "--target", target], + ); + match serde_json::from_str(&json) { + Ok(res) => { + result.insert(target.into(), res); + } + Err(err) => panic!("failed to parse target spec for {target}: {err}"), + } + } + result + } } #[derive(Clone, Debug, serde::Deserialize)] @@ -481,19 +507,6 @@ pub enum Endian { Big, } -impl TargetCfg { - fn new(config: &Config, target: &str) -> TargetCfg { - let json = rustc_output( - config, - &["--print=target-spec-json", "-Zunstable-options", "--target", target], - ); - match serde_json::from_str(&json) { - Ok(res) => res, - Err(err) => panic!("failed to parse target spec for {target}: {err}"), - } - } -} - fn rustc_output(config: &Config, args: &[&str]) -> String { let mut command = Command::new(&config.rustc_path); add_dylib_path(&mut command, iter::once(&config.compile_lib_path)); From 55121a9c460115a6a5758dd5b7057c20407f5b71 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 10 Mar 2023 12:17:36 +0100 Subject: [PATCH 12/28] avoid cloning the whole compiletest configuration for every test --- src/tools/compiletest/src/common.rs | 12 +++-- src/tools/compiletest/src/main.rs | 66 ++++++++++++++++------------ src/tools/compiletest/src/runtest.rs | 3 +- 3 files changed, 50 insertions(+), 31 deletions(-) diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 833579aa926e6..3d3f8278f6528 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -8,7 +8,7 @@ use std::process::Command; use std::str::FromStr; use crate::util::{add_dylib_path, PathBufExt}; -use lazycell::LazyCell; +use lazycell::AtomicLazyCell; use serde::de::{Deserialize, Deserializer, Error as _}; use std::collections::{HashMap, HashSet}; use test::{ColorConfig, OutputFormat}; @@ -326,7 +326,7 @@ pub struct Config { /// Only rerun the tests that result has been modified accoring to Git status pub only_modified: bool, - pub target_cfg: LazyCell, + pub target_cfgs: AtomicLazyCell, pub nocapture: bool, } @@ -340,7 +340,13 @@ impl Config { } pub fn target_cfgs(&self) -> &TargetCfgs { - self.target_cfgs.borrow_with(|| TargetCfgs::new(self)) + match self.target_cfgs.borrow() { + Some(cfgs) => cfgs, + None => { + let _ = self.target_cfgs.fill(TargetCfgs::new(self)); + self.target_cfgs.borrow().unwrap() + } + } } pub fn target_cfg(&self) -> &TargetCfg { diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 7700db0c74d86..cfb1ee34f679a 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -11,7 +11,7 @@ use crate::util::logv; use build_helper::git::{get_git_modified_files, get_git_untracked_files}; use core::panic; use getopts::Options; -use lazycell::LazyCell; +use lazycell::AtomicLazyCell; use std::collections::BTreeSet; use std::ffi::OsString; use std::fs; @@ -25,6 +25,7 @@ use tracing::*; use walkdir::WalkDir; use self::header::{make_test_description, EarlyProps}; +use std::sync::Arc; #[cfg(test)] mod tests; @@ -42,7 +43,7 @@ pub mod util; fn main() { tracing_subscriber::fmt::init(); - let config = parse_config(env::args().collect()); + let config = Arc::new(parse_config(env::args().collect())); if config.valgrind_path.is_none() && config.force_valgrind { panic!("Can't find Valgrind to run Valgrind tests"); @@ -313,7 +314,7 @@ pub fn parse_config(args: Vec) -> Config { force_rerun: matches.opt_present("force-rerun"), - target_cfgs: LazyCell::new(), + target_cfgs: AtomicLazyCell::new(), nocapture: matches.opt_present("nocapture"), } @@ -369,7 +370,7 @@ pub fn opt_str2(maybestr: Option) -> String { } } -pub fn run_tests(config: Config) { +pub fn run_tests(config: Arc) { // If we want to collect rustfix coverage information, // we first make sure that the coverage file does not exist. // It will be created later on. @@ -411,7 +412,7 @@ pub fn run_tests(config: Config) { }; let mut tests = Vec::new(); - for c in &configs { + for c in configs { let mut found_paths = BTreeSet::new(); make_tests(c, &mut tests, &mut found_paths); check_overlapping_tests(&found_paths); @@ -433,7 +434,11 @@ pub fn run_tests(config: Config) { println!( "Some tests failed in compiletest suite={}{} mode={} host={} target={}", config.suite, - config.compare_mode.map(|c| format!(" compare_mode={:?}", c)).unwrap_or_default(), + config + .compare_mode + .as_ref() + .map(|c| format!(" compare_mode={:?}", c)) + .unwrap_or_default(), config.mode, config.host, config.target @@ -453,13 +458,13 @@ pub fn run_tests(config: Config) { } } -fn configure_cdb(config: &Config) -> Option { +fn configure_cdb(config: &Config) -> Option> { config.cdb.as_ref()?; - Some(Config { debugger: Some(Debugger::Cdb), ..config.clone() }) + Some(Arc::new(Config { debugger: Some(Debugger::Cdb), ..config.clone() })) } -fn configure_gdb(config: &Config) -> Option { +fn configure_gdb(config: &Config) -> Option> { config.gdb_version?; if config.matches_env("msvc") { @@ -490,10 +495,10 @@ fn configure_gdb(config: &Config) -> Option { env::set_var("RUST_TEST_THREADS", "1"); } - Some(Config { debugger: Some(Debugger::Gdb), ..config.clone() }) + Some(Arc::new(Config { debugger: Some(Debugger::Gdb), ..config.clone() })) } -fn configure_lldb(config: &Config) -> Option { +fn configure_lldb(config: &Config) -> Option> { config.lldb_python_dir.as_ref()?; if let Some(350) = config.lldb_version { @@ -506,7 +511,7 @@ fn configure_lldb(config: &Config) -> Option { return None; } - Some(Config { debugger: Some(Debugger::Lldb), ..config.clone() }) + Some(Arc::new(Config { debugger: Some(Debugger::Lldb), ..config.clone() })) } pub fn test_opts(config: &Config) -> test::TestOpts { @@ -541,17 +546,17 @@ pub fn test_opts(config: &Config) -> test::TestOpts { } pub fn make_tests( - config: &Config, + config: Arc, tests: &mut Vec, found_paths: &mut BTreeSet, ) { debug!("making tests from {:?}", config.src_base.display()); - let inputs = common_inputs_stamp(config); - let modified_tests = modified_tests(config, &config.src_base).unwrap_or_else(|err| { + let inputs = common_inputs_stamp(&config); + let modified_tests = modified_tests(&config, &config.src_base).unwrap_or_else(|err| { panic!("modified_tests got error from dir: {}, error: {}", config.src_base.display(), err) }); collect_tests_from_dir( - config, + config.clone(), &config.src_base, &PathBuf::new(), &inputs, @@ -622,7 +627,7 @@ fn modified_tests(config: &Config, dir: &Path) -> Result, String> { } fn collect_tests_from_dir( - config: &Config, + config: Arc, dir: &Path, relative_dir_path: &Path, inputs: &Stamp, @@ -650,7 +655,7 @@ fn collect_tests_from_dir( // sequential loop because otherwise, if we do it in the // tests themselves, they race for the privilege of // creating the directories and sometimes fail randomly. - let build_dir = output_relative_path(config, relative_dir_path); + let build_dir = output_relative_path(&config, relative_dir_path); fs::create_dir_all(&build_dir).unwrap(); // Add each `.rs` file as a test, and recurse further on any @@ -666,13 +671,13 @@ fn collect_tests_from_dir( let paths = TestPaths { file: file_path, relative_dir: relative_dir_path.to_path_buf() }; - tests.extend(make_test(config, &paths, inputs)) + tests.extend(make_test(config.clone(), &paths, inputs)) } else if file_path.is_dir() { let relative_file_path = relative_dir_path.join(file.file_name()); if &file_name != "auxiliary" { debug!("found directory: {:?}", file_path.display()); collect_tests_from_dir( - config, + config.clone(), &file_path, &relative_file_path, inputs, @@ -701,14 +706,18 @@ pub fn is_test(file_name: &OsString) -> bool { !invalid_prefixes.iter().any(|p| file_name.starts_with(p)) } -fn make_test(config: &Config, testpaths: &TestPaths, inputs: &Stamp) -> Vec { +fn make_test( + config: Arc, + testpaths: &TestPaths, + inputs: &Stamp, +) -> Vec { let test_path = if config.mode == Mode::RunMake { // Parse directives in the Makefile testpaths.file.join("Makefile") } else { PathBuf::from(&testpaths.file) }; - let early_props = EarlyProps::from_file(config, &test_path); + let early_props = EarlyProps::from_file(&config, &test_path); // Incremental tests are special, they inherently cannot be run in parallel. // `runtest::run` will be responsible for iterating over revisions. @@ -723,19 +732,22 @@ fn make_test(config: &Config, testpaths: &TestPaths, inputs: &Stamp) -> Vec, testpaths: &TestPaths, revision: Option<&String>, ) -> test::TestFn { diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index a400307231052..794c845458b24 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -30,6 +30,7 @@ use std::iter; use std::path::{Path, PathBuf}; use std::process::{Child, Command, ExitStatus, Output, Stdio}; use std::str; +use std::sync::Arc; use glob::glob; use once_cell::sync::Lazy; @@ -96,7 +97,7 @@ pub fn get_lib_name(lib: &str, dylib: bool) -> String { } } -pub fn run(config: Config, testpaths: &TestPaths, revision: Option<&str>) { +pub fn run(config: Arc, testpaths: &TestPaths, revision: Option<&str>) { match &*config.target { "arm-linux-androideabi" | "armv7-linux-androideabi" From 8eb3def446b7026b2ff2a981791e5fc6fe031944 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 10 Mar 2023 12:22:07 +0100 Subject: [PATCH 13/28] handle "ignore-" and "only-" --- src/tools/compiletest/src/header.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 71e1072ceb376..b0b66e2320147 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -697,6 +697,12 @@ impl Config { let (name, comment) = line.split_once(&[':', ' ']).map(|(l, c)| (l, Some(c))).unwrap_or((line, None)); + // Some of the matchers might be "" depending on what the target information is. To avoid + // problems we outright reject empty directives. + if name == "" { + return ParsedNameDirective::invalid(); + } + let mut outcome = MatchOutcome::Invalid; let mut message = None; From 9cb4373a8458e38c1ed8b1d8e768e11f305e551f Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 10 Mar 2023 12:32:02 +0100 Subject: [PATCH 14/28] move cfg handling into its own module --- src/tools/compiletest/src/header.rs | 237 +----------------------- src/tools/compiletest/src/header/cfg.rs | 233 +++++++++++++++++++++++ 2 files changed, 239 insertions(+), 231 deletions(-) create mode 100644 src/tools/compiletest/src/header/cfg.rs diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index b0b66e2320147..50b99b8057293 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -8,41 +8,16 @@ use std::process::Command; use tracing::*; -use crate::common::CompareMode; use crate::common::{Config, Debugger, FailMode, Mode, PassMode}; +use crate::header::cfg::parse_cfg_name_directive; +use crate::header::cfg::MatchOutcome; use crate::util; use crate::{extract_cdb_version, extract_gdb_version}; +mod cfg; #[cfg(test)] mod tests; -/// The result of parse_cfg_name_directive. -#[derive(Clone, PartialEq, Debug)] -struct ParsedNameDirective<'a> { - name: Option<&'a str>, - pretty_reason: Option, - comment: Option<&'a str>, - outcome: MatchOutcome, -} - -impl ParsedNameDirective<'_> { - fn invalid() -> Self { - Self { name: None, pretty_reason: None, comment: None, outcome: MatchOutcome::NoMatch } - } -} - -#[derive(Clone, Copy, PartialEq, Debug)] -enum MatchOutcome { - /// No match. - NoMatch, - /// Match. - Match, - /// The directive was invalid. - Invalid, - /// The directive is handled by other parts of our tooling. - External, -} - /// Properties which must be known very early, before actually running /// the test. #[derive(Default)] @@ -666,7 +641,7 @@ impl Config { } fn parse_custom_normalization(&self, mut line: &str, prefix: &str) -> Option<(String, String)> { - if self.parse_cfg_name_directive(line, prefix).outcome == MatchOutcome::Match { + if parse_cfg_name_directive(self, line, prefix).outcome == MatchOutcome::Match { let from = parse_normalization_string(&mut line)?; let to = parse_normalization_string(&mut line)?; Some((from, to)) @@ -683,206 +658,6 @@ impl Config { self.parse_name_directive(line, "needs-profiler-support") } - /// Parses a name-value directive which contains config-specific information, e.g., `ignore-x86` - /// or `normalize-stderr-32bit`. - fn parse_cfg_name_directive<'a>(&self, line: &'a str, prefix: &str) -> ParsedNameDirective<'a> { - if !line.as_bytes().starts_with(prefix.as_bytes()) { - return ParsedNameDirective::invalid(); - } - if line.as_bytes().get(prefix.len()) != Some(&b'-') { - return ParsedNameDirective::invalid(); - } - let line = &line[prefix.len() + 1..]; - - let (name, comment) = - line.split_once(&[':', ' ']).map(|(l, c)| (l, Some(c))).unwrap_or((line, None)); - - // Some of the matchers might be "" depending on what the target information is. To avoid - // problems we outright reject empty directives. - if name == "" { - return ParsedNameDirective::invalid(); - } - - let mut outcome = MatchOutcome::Invalid; - let mut message = None; - - macro_rules! maybe_condition { - ( - name: $name:expr, - $(allowed_names: $allowed_names:expr,)? - $(condition: $condition:expr,)? - message: $($message:tt)* - ) => {{ - // This is not inlined to avoid problems with macro repetitions. - let format_message = || format!($($message)*); - - if outcome != MatchOutcome::Invalid { - // Ignore all other matches if we already found one - } else if $name.as_ref().map(|n| n == &name).unwrap_or(false) { - message = Some(format_message()); - if true $(&& $condition)? { - outcome = MatchOutcome::Match; - } else { - outcome = MatchOutcome::NoMatch; - } - } - $(else if $allowed_names.contains(name) { - message = Some(format_message()); - outcome = MatchOutcome::NoMatch; - })? - }}; - } - macro_rules! condition { - ( - name: $name:expr, - $(allowed_names: $allowed_names:expr,)? - $(condition: $condition:expr,)? - message: $($message:tt)* - ) => { - maybe_condition! { - name: Some($name), - $(allowed_names: $allowed_names,)* - $(condition: $condition,)* - message: $($message)* - } - }; - } - macro_rules! hashset { - ($($value:expr),* $(,)?) => {{ - let mut set = HashSet::new(); - $(set.insert($value);)* - set - }} - } - - let target_cfgs = self.target_cfgs(); - let target_cfg = self.target_cfg(); - - condition! { - name: "test", - message: "always" - } - condition! { - name: &self.target, - allowed_names: &target_cfgs.all_targets, - message: "when the target is {name}" - } - condition! { - name: &target_cfg.os, - allowed_names: &target_cfgs.all_oses, - message: "when the operative system is {name}" - } - condition! { - name: &target_cfg.env, - allowed_names: &target_cfgs.all_envs, - message: "when the target environment is {name}" - } - condition! { - name: &target_cfg.abi, - allowed_names: &target_cfgs.all_abis, - message: "when the ABI is {name}" - } - condition! { - name: &target_cfg.arch, - allowed_names: &target_cfgs.all_archs, - message: "when the architecture is {name}" - } - condition! { - name: format!("{}bit", target_cfg.pointer_width), - allowed_names: &target_cfgs.all_pointer_widths, - message: "when the pointer width is {name}" - } - for family in &target_cfg.families { - condition! { - name: family, - allowed_names: &target_cfgs.all_families, - message: "when the target family is {name}" - } - } - - // If something is ignored for emscripten, it likely also needs to be - // ignored for wasm32-unknown-unknown. - // `wasm32-bare` is an alias to refer to just wasm32-unknown-unknown - // (in contrast to `wasm32` which also matches non-bare targets like - // asmjs-unknown-emscripten). - condition! { - name: "emscripten", - condition: self.target == "wasm32-unknown-unknown", - message: "when the target is WASM", - } - condition! { - name: "wasm32-bare", - condition: self.target == "wasm32-unknown-unknown", - message: "when the target is WASM" - } - - condition! { - name: &self.channel, - allowed_names: hashset!["stable", "beta", "nightly"], - message: "when the release channel is {name}", - } - condition! { - name: "cross-compile", - condition: self.target != self.host, - message: "when cross-compiling" - } - condition! { - name: "endian-big", - condition: self.is_big_endian(), - message: "on big-endian targets", - } - condition! { - name: self.stage_id.split('-').next().unwrap(), - allowed_names: hashset!["stable", "beta", "nightly"], - message: "when the bootstrapping stage is {name}", - } - condition! { - name: "remote", - condition: self.remote_test_client.is_some(), - message: "when running tests remotely", - } - condition! { - name: "debug", - condition: cfg!(debug_assertions), - message: "when building with debug assertions", - } - maybe_condition! { - name: self.debugger.as_ref().map(|d| d.to_str()), - allowed_names: Debugger::VARIANTS - .iter() - .map(|v| v.to_str()) - .collect::>(), - message: "when the debugger is {name}", - } - maybe_condition! { - name: self.compare_mode - .as_ref() - .map(|d| format!("compare-mode-{}", d.to_str())), - allowed_names: CompareMode::VARIANTS - .iter() - .map(|cm| format!("compare-mode-{}", cm.to_str())) - .collect::>(), - message: "when comparing with {name}", - } - - // Don't error out for ignore-tidy-* diretives, as those are not handled by compiletest. - if prefix == "ignore" && name.starts_with("tidy-") && outcome == MatchOutcome::Invalid { - outcome = MatchOutcome::External; - } - - // Don't error out for ignore-pass, as that is handled elsewhere. - if prefix == "ignore" && name == "pass" && outcome == MatchOutcome::Invalid { - outcome = MatchOutcome::External; - } - - ParsedNameDirective { - name: Some(name), - comment: comment.map(|c| c.trim().trim_start_matches('-').trim()), - outcome, - pretty_reason: message, - } - } - fn has_cfg_prefix(&self, line: &str, prefix: &str) -> bool { // returns whether this line contains this prefix or not. For prefix // "ignore", returns true if line says "ignore-x86_64", "ignore-arch", @@ -1151,7 +926,7 @@ pub fn make_test_description( } { - let parsed = config.parse_cfg_name_directive(ln, "ignore"); + let parsed = parse_cfg_name_directive(config, ln, "ignore"); ignore = match parsed.outcome { MatchOutcome::Match => { let reason = parsed.pretty_reason.unwrap(); @@ -1171,7 +946,7 @@ pub fn make_test_description( } if config.has_cfg_prefix(ln, "only") { - let parsed = config.parse_cfg_name_directive(ln, "only"); + let parsed = parse_cfg_name_directive(config, ln, "only"); ignore = match parsed.outcome { MatchOutcome::Match => ignore, MatchOutcome::NoMatch => { diff --git a/src/tools/compiletest/src/header/cfg.rs b/src/tools/compiletest/src/header/cfg.rs new file mode 100644 index 0000000000000..a6812792c277d --- /dev/null +++ b/src/tools/compiletest/src/header/cfg.rs @@ -0,0 +1,233 @@ +use crate::common::{Config, CompareMode, Debugger}; +use std::collections::HashSet; + +/// Parses a name-value directive which contains config-specific information, e.g., `ignore-x86` +/// or `normalize-stderr-32bit`. +pub(super) fn parse_cfg_name_directive<'a>( + config: &Config, + line: &'a str, + prefix: &str, +) -> ParsedNameDirective<'a> { + if !line.as_bytes().starts_with(prefix.as_bytes()) { + return ParsedNameDirective::invalid(); + } + if line.as_bytes().get(prefix.len()) != Some(&b'-') { + return ParsedNameDirective::invalid(); + } + let line = &line[prefix.len() + 1..]; + + let (name, comment) = + line.split_once(&[':', ' ']).map(|(l, c)| (l, Some(c))).unwrap_or((line, None)); + + // Some of the matchers might be "" depending on what the target information is. To avoid + // problems we outright reject empty directives. + if name == "" { + return ParsedNameDirective::invalid(); + } + + let mut outcome = MatchOutcome::Invalid; + let mut message = None; + + macro_rules! maybe_condition { + ( + name: $name:expr, + $(allowed_names: $allowed_names:expr,)? + $(condition: $condition:expr,)? + message: $($message:tt)* + ) => {{ + // This is not inlined to avoid problems with macro repetitions. + let format_message = || format!($($message)*); + + if outcome != MatchOutcome::Invalid { + // Ignore all other matches if we already found one + } else if $name.as_ref().map(|n| n == &name).unwrap_or(false) { + message = Some(format_message()); + if true $(&& $condition)? { + outcome = MatchOutcome::Match; + } else { + outcome = MatchOutcome::NoMatch; + } + } + $(else if $allowed_names.contains(name) { + message = Some(format_message()); + outcome = MatchOutcome::NoMatch; + })? + }}; + } + macro_rules! condition { + ( + name: $name:expr, + $(allowed_names: $allowed_names:expr,)? + $(condition: $condition:expr,)? + message: $($message:tt)* + ) => { + maybe_condition! { + name: Some($name), + $(allowed_names: $allowed_names,)* + $(condition: $condition,)* + message: $($message)* + } + }; + } + macro_rules! hashset { + ($($value:expr),* $(,)?) => {{ + let mut set = HashSet::new(); + $(set.insert($value);)* + set + }} + } + + let target_cfgs = config.target_cfgs(); + let target_cfg = config.target_cfg(); + + condition! { + name: "test", + message: "always" + } + condition! { + name: &config.target, + allowed_names: &target_cfgs.all_targets, + message: "when the target is {name}" + } + condition! { + name: &target_cfg.os, + allowed_names: &target_cfgs.all_oses, + message: "when the operative system is {name}" + } + condition! { + name: &target_cfg.env, + allowed_names: &target_cfgs.all_envs, + message: "when the target environment is {name}" + } + condition! { + name: &target_cfg.abi, + allowed_names: &target_cfgs.all_abis, + message: "when the ABI is {name}" + } + condition! { + name: &target_cfg.arch, + allowed_names: &target_cfgs.all_archs, + message: "when the architecture is {name}" + } + condition! { + name: format!("{}bit", target_cfg.pointer_width), + allowed_names: &target_cfgs.all_pointer_widths, + message: "when the pointer width is {name}" + } + for family in &target_cfg.families { + condition! { + name: family, + allowed_names: &target_cfgs.all_families, + message: "when the target family is {name}" + } + } + + // If something is ignored for emscripten, it likely also needs to be + // ignored for wasm32-unknown-unknown. + // `wasm32-bare` is an alias to refer to just wasm32-unknown-unknown + // (in contrast to `wasm32` which also matches non-bare targets like + // asmjs-unknown-emscripten). + condition! { + name: "emscripten", + condition: config.target == "wasm32-unknown-unknown", + message: "when the target is WASM", + } + condition! { + name: "wasm32-bare", + condition: config.target == "wasm32-unknown-unknown", + message: "when the target is WASM" + } + + condition! { + name: &config.channel, + allowed_names: hashset!["stable", "beta", "nightly"], + message: "when the release channel is {name}", + } + condition! { + name: "cross-compile", + condition: config.target != config.host, + message: "when cross-compiling" + } + condition! { + name: "endian-big", + condition: config.is_big_endian(), + message: "on big-endian targets", + } + condition! { + name: config.stage_id.split('-').next().unwrap(), + allowed_names: hashset!["stable", "beta", "nightly"], + message: "when the bootstrapping stage is {name}", + } + condition! { + name: "remote", + condition: config.remote_test_client.is_some(), + message: "when running tests remotely", + } + condition! { + name: "debug", + condition: cfg!(debug_assertions), + message: "when building with debug assertions", + } + maybe_condition! { + name: config.debugger.as_ref().map(|d| d.to_str()), + allowed_names: Debugger::VARIANTS + .iter() + .map(|v| v.to_str()) + .collect::>(), + message: "when the debugger is {name}", + } + maybe_condition! { + name: config.compare_mode + .as_ref() + .map(|d| format!("compare-mode-{}", d.to_str())), + allowed_names: CompareMode::VARIANTS + .iter() + .map(|cm| format!("compare-mode-{}", cm.to_str())) + .collect::>(), + message: "when comparing with {name}", + } + + // Don't error out for ignore-tidy-* diretives, as those are not handled by compiletest. + if prefix == "ignore" && name.starts_with("tidy-") && outcome == MatchOutcome::Invalid { + outcome = MatchOutcome::External; + } + + // Don't error out for ignore-pass, as that is handled elsewhere. + if prefix == "ignore" && name == "pass" && outcome == MatchOutcome::Invalid { + outcome = MatchOutcome::External; + } + + ParsedNameDirective { + name: Some(name), + comment: comment.map(|c| c.trim().trim_start_matches('-').trim()), + outcome, + pretty_reason: message, + } +} + +/// The result of parse_cfg_name_directive. +#[derive(Clone, PartialEq, Debug)] +pub(super) struct ParsedNameDirective<'a> { + pub(super) name: Option<&'a str>, + pub(super) pretty_reason: Option, + pub(super) comment: Option<&'a str>, + pub(super) outcome: MatchOutcome, +} + +impl ParsedNameDirective<'_> { + fn invalid() -> Self { + Self { name: None, pretty_reason: None, comment: None, outcome: MatchOutcome::NoMatch } + } +} + +#[derive(Clone, Copy, PartialEq, Debug)] +pub(super) enum MatchOutcome { + /// No match. + NoMatch, + /// Match. + Match, + /// The directive was invalid. + Invalid, + /// The directive is handled by other parts of our tooling. + External, +} From bc991de2336df5e6c29d50fb448778c725f9d9cf Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 10 Mar 2023 14:05:43 +0100 Subject: [PATCH 15/28] reduce allocations when validating cfgs --- src/tools/compiletest/src/common.rs | 3 +- src/tools/compiletest/src/header/cfg.rs | 64 +++++++++++++++++-------- 2 files changed, 47 insertions(+), 20 deletions(-) diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 3d3f8278f6528..f03f732684cda 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -22,8 +22,9 @@ macro_rules! string_enum { impl $name { $vis const VARIANTS: &'static [Self] = &[$(Self::$variant,)*]; + $vis const STR_VARIANTS: &'static [&'static str] = &[$(Self::$variant.to_str(),)*]; - $vis fn to_str(&self) -> &'static str { + $vis const fn to_str(&self) -> &'static str { match self { $(Self::$variant => $repr,)* } diff --git a/src/tools/compiletest/src/header/cfg.rs b/src/tools/compiletest/src/header/cfg.rs index a6812792c277d..a14943c9466cd 100644 --- a/src/tools/compiletest/src/header/cfg.rs +++ b/src/tools/compiletest/src/header/cfg.rs @@ -1,4 +1,4 @@ -use crate::common::{Config, CompareMode, Debugger}; +use crate::common::{CompareMode, Config, Debugger}; use std::collections::HashSet; /// Parses a name-value directive which contains config-specific information, e.g., `ignore-x86` @@ -48,7 +48,7 @@ pub(super) fn parse_cfg_name_directive<'a>( outcome = MatchOutcome::NoMatch; } } - $(else if $allowed_names.contains(name) { + $(else if $allowed_names.custom_contains(name) { message = Some(format_message()); outcome = MatchOutcome::NoMatch; })? @@ -69,13 +69,6 @@ pub(super) fn parse_cfg_name_directive<'a>( } }; } - macro_rules! hashset { - ($($value:expr),* $(,)?) => {{ - let mut set = HashSet::new(); - $(set.insert($value);)* - set - }} - } let target_cfgs = config.target_cfgs(); let target_cfg = config.target_cfg(); @@ -140,7 +133,7 @@ pub(super) fn parse_cfg_name_directive<'a>( condition! { name: &config.channel, - allowed_names: hashset!["stable", "beta", "nightly"], + allowed_names: &["stable", "beta", "nightly"], message: "when the release channel is {name}", } condition! { @@ -155,7 +148,7 @@ pub(super) fn parse_cfg_name_directive<'a>( } condition! { name: config.stage_id.split('-').next().unwrap(), - allowed_names: hashset!["stable", "beta", "nightly"], + allowed_names: &["stable", "beta", "nightly"], message: "when the bootstrapping stage is {name}", } condition! { @@ -170,20 +163,17 @@ pub(super) fn parse_cfg_name_directive<'a>( } maybe_condition! { name: config.debugger.as_ref().map(|d| d.to_str()), - allowed_names: Debugger::VARIANTS - .iter() - .map(|v| v.to_str()) - .collect::>(), + allowed_names: &Debugger::STR_VARIANTS, message: "when the debugger is {name}", } maybe_condition! { name: config.compare_mode .as_ref() .map(|d| format!("compare-mode-{}", d.to_str())), - allowed_names: CompareMode::VARIANTS - .iter() - .map(|cm| format!("compare-mode-{}", cm.to_str())) - .collect::>(), + allowed_names: ContainsPrefixed { + prefix: "compare-mode-", + inner: CompareMode::STR_VARIANTS, + }, message: "when comparing with {name}", } @@ -231,3 +221,39 @@ pub(super) enum MatchOutcome { /// The directive is handled by other parts of our tooling. External, } + +trait CustomContains { + fn custom_contains(&self, item: &str) -> bool; +} + +impl CustomContains for HashSet { + fn custom_contains(&self, item: &str) -> bool { + self.contains(item) + } +} + +impl CustomContains for &[&str] { + fn custom_contains(&self, item: &str) -> bool { + self.contains(&item) + } +} + +impl CustomContains for [&str; N] { + fn custom_contains(&self, item: &str) -> bool { + self.contains(&item) + } +} + +struct ContainsPrefixed { + prefix: &'static str, + inner: T, +} + +impl CustomContains for ContainsPrefixed { + fn custom_contains(&self, item: &str) -> bool { + match item.strip_prefix(self.prefix) { + Some(stripped) => self.inner.custom_contains(stripped), + None => false, + } + } +} From e085192729c3f276e52eeb7a7e7cfaa39cc5c09c Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 10 Mar 2023 14:09:17 +0100 Subject: [PATCH 16/28] allow some out of tree archs --- src/tools/compiletest/src/header/cfg.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/tools/compiletest/src/header/cfg.rs b/src/tools/compiletest/src/header/cfg.rs index a14943c9466cd..dbc78dd521b72 100644 --- a/src/tools/compiletest/src/header/cfg.rs +++ b/src/tools/compiletest/src/header/cfg.rs @@ -1,6 +1,8 @@ use crate::common::{CompareMode, Config, Debugger}; use std::collections::HashSet; +const EXTRA_ARCHS: &[&str] = &["asmjs", "spirv"]; + /// Parses a name-value directive which contains config-specific information, e.g., `ignore-x86` /// or `normalize-stderr-32bit`. pub(super) fn parse_cfg_name_directive<'a>( @@ -99,7 +101,7 @@ pub(super) fn parse_cfg_name_directive<'a>( } condition! { name: &target_cfg.arch, - allowed_names: &target_cfgs.all_archs, + allowed_names: ContainsEither { a: &target_cfgs.all_archs, b: &EXTRA_ARCHS }, message: "when the architecture is {name}" } condition! { @@ -257,3 +259,14 @@ impl CustomContains for ContainsPrefixed { } } } + +struct ContainsEither<'a, A: CustomContains, B: CustomContains> { + a: &'a A, + b: &'a B, +} + +impl CustomContains for ContainsEither<'_, A, B> { + fn custom_contains(&self, item: &str) -> bool { + self.a.custom_contains(item) || self.b.custom_contains(item) + } +} From 4cdb783cb9813ab3f627303e6d763a49ee730e33 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 10 Mar 2023 15:29:09 +0100 Subject: [PATCH 17/28] migrate existing behavior of matches_arch --- src/tools/compiletest/src/header/cfg.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/tools/compiletest/src/header/cfg.rs b/src/tools/compiletest/src/header/cfg.rs index dbc78dd521b72..747cf10bd3424 100644 --- a/src/tools/compiletest/src/header/cfg.rs +++ b/src/tools/compiletest/src/header/cfg.rs @@ -1,7 +1,7 @@ use crate::common::{CompareMode, Config, Debugger}; use std::collections::HashSet; -const EXTRA_ARCHS: &[&str] = &["asmjs", "spirv"]; +const EXTRA_ARCHS: &[&str] = &["spirv"]; /// Parses a name-value directive which contains config-specific information, e.g., `ignore-x86` /// or `normalize-stderr-32bit`. @@ -133,6 +133,17 @@ pub(super) fn parse_cfg_name_directive<'a>( message: "when the target is WASM" } + condition! { + name: "asmjs", + condition: config.target.starts_with("asmjs"), + message: "when the architecture is asm.js", + } + condition! { + name: "thumb", + condition: config.target.starts_with("thumb"), + message: "when the architecture is part of the Thumb family" + } + condition! { name: &config.channel, allowed_names: &["stable", "beta", "nightly"], From 91be8cadcbcc94eaf78393fc8254b03c6177bca8 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 10 Mar 2023 15:44:58 +0100 Subject: [PATCH 18/28] properly match multiple families --- src/tools/compiletest/src/header/cfg.rs | 64 +++++++++++++++---------- 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/src/tools/compiletest/src/header/cfg.rs b/src/tools/compiletest/src/header/cfg.rs index 747cf10bd3424..0c3250b7f760c 100644 --- a/src/tools/compiletest/src/header/cfg.rs +++ b/src/tools/compiletest/src/header/cfg.rs @@ -30,7 +30,7 @@ pub(super) fn parse_cfg_name_directive<'a>( let mut outcome = MatchOutcome::Invalid; let mut message = None; - macro_rules! maybe_condition { + macro_rules! condition { ( name: $name:expr, $(allowed_names: $allowed_names:expr,)? @@ -42,7 +42,7 @@ pub(super) fn parse_cfg_name_directive<'a>( if outcome != MatchOutcome::Invalid { // Ignore all other matches if we already found one - } else if $name.as_ref().map(|n| n == &name).unwrap_or(false) { + } else if $name.custom_matches(name) { message = Some(format_message()); if true $(&& $condition)? { outcome = MatchOutcome::Match; @@ -56,21 +56,6 @@ pub(super) fn parse_cfg_name_directive<'a>( })? }}; } - macro_rules! condition { - ( - name: $name:expr, - $(allowed_names: $allowed_names:expr,)? - $(condition: $condition:expr,)? - message: $($message:tt)* - ) => { - maybe_condition! { - name: Some($name), - $(allowed_names: $allowed_names,)* - $(condition: $condition,)* - message: $($message)* - } - }; - } let target_cfgs = config.target_cfgs(); let target_cfg = config.target_cfg(); @@ -109,12 +94,10 @@ pub(super) fn parse_cfg_name_directive<'a>( allowed_names: &target_cfgs.all_pointer_widths, message: "when the pointer width is {name}" } - for family in &target_cfg.families { - condition! { - name: family, - allowed_names: &target_cfgs.all_families, - message: "when the target family is {name}" - } + condition! { + name: &*target_cfg.families, + allowed_names: &target_cfgs.all_families, + message: "when the target family is {name}" } // If something is ignored for emscripten, it likely also needs to be @@ -174,12 +157,12 @@ pub(super) fn parse_cfg_name_directive<'a>( condition: cfg!(debug_assertions), message: "when building with debug assertions", } - maybe_condition! { + condition! { name: config.debugger.as_ref().map(|d| d.to_str()), allowed_names: &Debugger::STR_VARIANTS, message: "when the debugger is {name}", } - maybe_condition! { + condition! { name: config.compare_mode .as_ref() .map(|d| format!("compare-mode-{}", d.to_str())), @@ -281,3 +264,34 @@ impl CustomContains for ContainsEither<'_, self.a.custom_contains(item) || self.b.custom_contains(item) } } + +trait CustomMatches { + fn custom_matches(&self, name: &str) -> bool; +} + +impl CustomMatches for &str { + fn custom_matches(&self, name: &str) -> bool { + name == *self + } +} + +impl CustomMatches for String { + fn custom_matches(&self, name: &str) -> bool { + name == self + } +} + +impl CustomMatches for &[T] { + fn custom_matches(&self, name: &str) -> bool { + self.iter().any(|m| m.custom_matches(name)) + } +} + +impl CustomMatches for Option { + fn custom_matches(&self, name: &str) -> bool { + match self { + Some(inner) => inner.custom_matches(name), + None => false, + } + } +} From 54c4762a86e4c278f8aa97d7136997cd77d4ede7 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 10 Mar 2023 16:11:00 +0100 Subject: [PATCH 19/28] fix remaining tests --- src/bootstrap/test.rs | 2 +- src/tools/compiletest/src/common.rs | 6 +++++- src/tools/compiletest/src/header/cfg.rs | 22 +++++++++++++--------- src/tools/compiletest/src/header/tests.rs | 6 +++--- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 92a7603a9df6b..84afddbf97947 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -694,7 +694,7 @@ impl Step for CompiletestTest { /// Runs `cargo test` for compiletest. fn run(self, builder: &Builder<'_>) { let host = self.host; - let compiler = builder.compiler(0, host); + let compiler = builder.compiler(1, host); // We need `ToolStd` for the locally-built sysroot because // compiletest uses unstable features of the `test` crate. diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index f03f732684cda..2e3c1ec48eefb 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -490,7 +490,7 @@ impl TargetCfgs { #[serde(rename_all = "kebab-case")] pub struct TargetCfg { pub(crate) arch: String, - #[serde(default)] + #[serde(default = "default_os")] pub(crate) os: String, #[serde(default)] pub(crate) env: String, @@ -506,6 +506,10 @@ pub struct TargetCfg { panic: PanicStrategy, } +fn default_os() -> String { + "none".into() +} + #[derive(Eq, PartialEq, Clone, Debug, Default, serde::Deserialize)] #[serde(rename_all = "kebab-case")] pub enum Endian { diff --git a/src/tools/compiletest/src/header/cfg.rs b/src/tools/compiletest/src/header/cfg.rs index 0c3250b7f760c..e1931474a5f95 100644 --- a/src/tools/compiletest/src/header/cfg.rs +++ b/src/tools/compiletest/src/header/cfg.rs @@ -70,7 +70,12 @@ pub(super) fn parse_cfg_name_directive<'a>( message: "when the target is {name}" } condition! { - name: &target_cfg.os, + name: &[ + Some(&*target_cfg.os), + // If something is ignored for emscripten, it likely also needs to be + // ignored for wasm32-unknown-unknown. + (config.target == "wasm32-unknown-unknown").then_some("emscripten"), + ], allowed_names: &target_cfgs.all_oses, message: "when the operative system is {name}" } @@ -100,16 +105,9 @@ pub(super) fn parse_cfg_name_directive<'a>( message: "when the target family is {name}" } - // If something is ignored for emscripten, it likely also needs to be - // ignored for wasm32-unknown-unknown. // `wasm32-bare` is an alias to refer to just wasm32-unknown-unknown // (in contrast to `wasm32` which also matches non-bare targets like // asmjs-unknown-emscripten). - condition! { - name: "emscripten", - condition: config.target == "wasm32-unknown-unknown", - message: "when the target is WASM", - } condition! { name: "wasm32-bare", condition: config.target == "wasm32-unknown-unknown", @@ -144,7 +142,7 @@ pub(super) fn parse_cfg_name_directive<'a>( } condition! { name: config.stage_id.split('-').next().unwrap(), - allowed_names: &["stable", "beta", "nightly"], + allowed_names: &["stage0", "stage1", "stage2"], message: "when the bootstrapping stage is {name}", } condition! { @@ -287,6 +285,12 @@ impl CustomMatches for &[T] { } } +impl CustomMatches for [T; N] { + fn custom_matches(&self, name: &str) -> bool { + self.iter().any(|m| m.custom_matches(name)) + } +} + impl CustomMatches for Option { fn custom_matches(&self, name: &str) -> bool { match self { diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs index e42b8c5240842..acd588d7fee04 100644 --- a/src/tools/compiletest/src/header/tests.rs +++ b/src/tools/compiletest/src/header/tests.rs @@ -47,7 +47,7 @@ fn config() -> Config { "--src-base=", "--build-base=", "--sysroot-base=", - "--stage-id=stage2", + "--stage-id=stage2-x86_64-unknown-linux-gnu", "--cc=c", "--cxx=c++", "--cflags=", @@ -174,7 +174,7 @@ fn ignore_target() { assert!(check_ignore(&config, "// ignore-gnu")); assert!(check_ignore(&config, "// ignore-64bit")); - assert!(!check_ignore(&config, "// ignore-i686")); + assert!(!check_ignore(&config, "// ignore-x86")); assert!(!check_ignore(&config, "// ignore-windows")); assert!(!check_ignore(&config, "// ignore-msvc")); assert!(!check_ignore(&config, "// ignore-32bit")); @@ -200,7 +200,7 @@ fn only_target() { #[test] fn stage() { let mut config = config(); - config.stage_id = "stage1".to_owned(); + config.stage_id = "stage1-x86_64-unknown-linux-gnu".to_owned(); assert!(check_ignore(&config, "// ignore-stage1")); assert!(!check_ignore(&config, "// ignore-stage2")); From 60f2761503143937102f37e7ec07ecf2b5b2923e Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 16 Mar 2023 10:19:14 +0100 Subject: [PATCH 20/28] add support for ignore-llvm-version --- src/tools/compiletest/src/header/cfg.rs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/tools/compiletest/src/header/cfg.rs b/src/tools/compiletest/src/header/cfg.rs index e1931474a5f95..ffb81dfdcdb68 100644 --- a/src/tools/compiletest/src/header/cfg.rs +++ b/src/tools/compiletest/src/header/cfg.rs @@ -171,14 +171,22 @@ pub(super) fn parse_cfg_name_directive<'a>( message: "when comparing with {name}", } - // Don't error out for ignore-tidy-* diretives, as those are not handled by compiletest. - if prefix == "ignore" && name.starts_with("tidy-") && outcome == MatchOutcome::Invalid { - outcome = MatchOutcome::External; - } + if prefix == "ignore" && outcome == MatchOutcome::Invalid { + // Don't error out for ignore-tidy-* diretives, as those are not handled by compiletest. + if name.starts_with("tidy-") { + outcome = MatchOutcome::External; + } - // Don't error out for ignore-pass, as that is handled elsewhere. - if prefix == "ignore" && name == "pass" && outcome == MatchOutcome::Invalid { - outcome = MatchOutcome::External; + // Don't error out for ignore-pass, as that is handled elsewhere. + if name == "pass" { + outcome = MatchOutcome::External; + } + + // Don't error out for ignore-llvm-version, that has a custom syntax and is handled + // elsewhere. + if name == "llvm-version" { + outcome = MatchOutcome::External; + } } ParsedNameDirective { From e045598c68dfc9ce4ac5b2eccfa3585c121e1931 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 16 Mar 2023 10:19:27 +0100 Subject: [PATCH 21/28] remove a bunch of unknown archs from the global_asm tests --- tests/codegen/global_asm.rs | 26 ++++---------------------- tests/codegen/global_asm_include.rs | 26 ++++---------------------- tests/codegen/global_asm_x2.rs | 26 ++++---------------------- 3 files changed, 12 insertions(+), 66 deletions(-) diff --git a/tests/codegen/global_asm.rs b/tests/codegen/global_asm.rs index 9d27fc447f6fc..9912b1e75bf5a 100644 --- a/tests/codegen/global_asm.rs +++ b/tests/codegen/global_asm.rs @@ -1,38 +1,20 @@ // ignore-aarch64 -// ignore-aarch64_be // ignore-arm -// ignore-armeb // ignore-avr -// ignore-bpfel -// ignore-bpfeb +// ignore-bpf +// ignore-bpf // ignore-hexagon // ignore-mips // ignore-mips64 // ignore-msp430 // ignore-powerpc64 // ignore-powerpc -// ignore-r600 -// ignore-amdgcn // ignore-sparc -// ignore-sparcv9 -// ignore-sparcel +// ignore-sparc64 // ignore-s390x -// ignore-tce // ignore-thumb -// ignore-thumbeb -// ignore-xcore -// ignore-nvptx // ignore-nvptx64 -// ignore-le32 -// ignore-le64 -// ignore-amdil -// ignore-amdil64 -// ignore-hsail -// ignore-hsail64 -// ignore-spir -// ignore-spir64 -// ignore-kalimba -// ignore-shave +// ignore-spirv // ignore-wasm32 // ignore-wasm64 // ignore-emscripten diff --git a/tests/codegen/global_asm_include.rs b/tests/codegen/global_asm_include.rs index 438d37445c2b1..b68c5ad3b9ddd 100644 --- a/tests/codegen/global_asm_include.rs +++ b/tests/codegen/global_asm_include.rs @@ -1,38 +1,20 @@ // ignore-aarch64 -// ignore-aarch64_be // ignore-arm -// ignore-armeb // ignore-avr -// ignore-bpfel -// ignore-bpfeb +// ignore-bpf +// ignore-bpf // ignore-hexagon // ignore-mips // ignore-mips64 // ignore-msp430 // ignore-powerpc64 // ignore-powerpc -// ignore-r600 -// ignore-amdgcn // ignore-sparc -// ignore-sparcv9 -// ignore-sparcel +// ignore-sparc64 // ignore-s390x -// ignore-tce // ignore-thumb -// ignore-thumbeb -// ignore-xcore -// ignore-nvptx // ignore-nvptx64 -// ignore-le32 -// ignore-le64 -// ignore-amdil -// ignore-amdil64 -// ignore-hsail -// ignore-hsail64 -// ignore-spir -// ignore-spir64 -// ignore-kalimba -// ignore-shave +// ignore-spirv // ignore-wasm32 // ignore-wasm64 // ignore-emscripten diff --git a/tests/codegen/global_asm_x2.rs b/tests/codegen/global_asm_x2.rs index f9840e44157b0..d87e02befb9bf 100644 --- a/tests/codegen/global_asm_x2.rs +++ b/tests/codegen/global_asm_x2.rs @@ -1,38 +1,20 @@ // ignore-aarch64 -// ignore-aarch64_be // ignore-arm -// ignore-armeb // ignore-avr -// ignore-bpfel -// ignore-bpfeb +// ignore-bpf +// ignore-bpf // ignore-hexagon // ignore-mips // ignore-mips64 // ignore-msp430 // ignore-powerpc64 // ignore-powerpc -// ignore-r600 -// ignore-amdgcn // ignore-sparc -// ignore-sparcv9 -// ignore-sparcel +// ignore-sparc64 // ignore-s390x -// ignore-tce // ignore-thumb -// ignore-thumbeb -// ignore-xcore -// ignore-nvptx // ignore-nvptx64 -// ignore-le32 -// ignore-le64 -// ignore-amdil -// ignore-amdil64 -// ignore-hsail -// ignore-hsail64 -// ignore-spir -// ignore-spir64 -// ignore-kalimba -// ignore-shave +// ignore-spirv // ignore-wasm32 // ignore-wasm64 // ignore-emscripten From 3602200d50d895f911c8efe35fcd2463b4e8d891 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 16 Mar 2023 10:20:57 +0100 Subject: [PATCH 22/28] make 32bit ignore more accurate --- tests/codegen/issues/issue-37945.rs | 6 +----- tests/run-make/static-pie/Makefile | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/codegen/issues/issue-37945.rs b/tests/codegen/issues/issue-37945.rs index 19e7e8b1f6e17..4f386d335c7d9 100644 --- a/tests/codegen/issues/issue-37945.rs +++ b/tests/codegen/issues/issue-37945.rs @@ -1,9 +1,5 @@ // compile-flags: -O -Zmerge-functions=disabled -// ignore-x86 -// ignore-arm -// ignore-emscripten -// ignore-gnux32 -// ignore 32-bit platforms (LLVM has a bug with them) +// ignore-32bit LLVM has a bug with them // ignore-debug // Check that LLVM understands that `Iter` pointer is not null. Issue #37945. diff --git a/tests/run-make/static-pie/Makefile b/tests/run-make/static-pie/Makefile index 19c041d94284c..8379730cc3df3 100644 --- a/tests/run-make/static-pie/Makefile +++ b/tests/run-make/static-pie/Makefile @@ -2,7 +2,7 @@ include ../tools.mk # only-x86_64 # only-linux -# ignore-gnux32 +# ignore-32bit # How to manually run this # $ ./x.py test --target x86_64-unknown-linux-[musl,gnu] tests/run-make/static-pie From 8f8873e386e6bab091b50f24d746b3ed0487524f Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 16 Mar 2023 10:21:12 +0100 Subject: [PATCH 23/28] remove unknown xcore arch --- tests/codegen/abi-main-signature-16bit-c-int.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/codegen/abi-main-signature-16bit-c-int.rs b/tests/codegen/abi-main-signature-16bit-c-int.rs index 4ed491dfb2b43..3548cc06a5b63 100644 --- a/tests/codegen/abi-main-signature-16bit-c-int.rs +++ b/tests/codegen/abi-main-signature-16bit-c-int.rs @@ -17,7 +17,6 @@ // ignore-wasm32 // ignore-x86 // ignore-x86_64 -// ignore-xcore fn main() { } From 5b0a0d8254fa9c4d799d501b2a5b280170d4fd95 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 16 Mar 2023 11:19:30 +0100 Subject: [PATCH 24/28] add support for ignore-gdb-version --- src/tools/compiletest/src/header/cfg.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tools/compiletest/src/header/cfg.rs b/src/tools/compiletest/src/header/cfg.rs index ffb81dfdcdb68..da4af98ce91eb 100644 --- a/src/tools/compiletest/src/header/cfg.rs +++ b/src/tools/compiletest/src/header/cfg.rs @@ -187,6 +187,12 @@ pub(super) fn parse_cfg_name_directive<'a>( if name == "llvm-version" { outcome = MatchOutcome::External; } + + // Don't error out for ignore-llvm-version, that has a custom syntax and is handled + // elsewhere. + if name == "gdb-version" { + outcome = MatchOutcome::External; + } } ParsedNameDirective { From 9a2d1b85edc99866f0f0763a000a09c0b61b2f58 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 16 Mar 2023 11:34:18 +0100 Subject: [PATCH 25/28] restore check for both target os and env This is better than the old impl of target.ends_with("windows-gnu"), because it also catches things like windows-gnullvm --- src/tools/compiletest/src/common.rs | 10 ++++++++++ src/tools/compiletest/src/header/cfg.rs | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 2e3c1ec48eefb..98b27a5c6b60a 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -409,6 +409,7 @@ pub struct TargetCfgs { pub all_targets: HashSet, pub all_archs: HashSet, pub all_oses: HashSet, + pub all_oses_and_envs: HashSet, pub all_envs: HashSet, pub all_abis: HashSet, pub all_families: HashSet, @@ -433,6 +434,7 @@ impl TargetCfgs { let mut all_targets = HashSet::new(); let mut all_archs = HashSet::new(); let mut all_oses = HashSet::new(); + let mut all_oses_and_envs = HashSet::new(); let mut all_envs = HashSet::new(); let mut all_abis = HashSet::new(); let mut all_families = HashSet::new(); @@ -441,6 +443,7 @@ impl TargetCfgs { for (target, cfg) in targets.into_iter() { all_archs.insert(cfg.arch.clone()); all_oses.insert(cfg.os.clone()); + all_oses_and_envs.insert(cfg.os_and_env()); all_envs.insert(cfg.env.clone()); all_abis.insert(cfg.abi.clone()); for family in &cfg.families { @@ -459,6 +462,7 @@ impl TargetCfgs { all_targets, all_archs, all_oses, + all_oses_and_envs, all_envs, all_abis, all_families, @@ -506,6 +510,12 @@ pub struct TargetCfg { panic: PanicStrategy, } +impl TargetCfg { + pub(crate) fn os_and_env(&self) -> String { + format!("{}-{}", self.os, self.env) + } +} + fn default_os() -> String { "none".into() } diff --git a/src/tools/compiletest/src/header/cfg.rs b/src/tools/compiletest/src/header/cfg.rs index da4af98ce91eb..3b9333dfe7a0b 100644 --- a/src/tools/compiletest/src/header/cfg.rs +++ b/src/tools/compiletest/src/header/cfg.rs @@ -84,6 +84,11 @@ pub(super) fn parse_cfg_name_directive<'a>( allowed_names: &target_cfgs.all_envs, message: "when the target environment is {name}" } + condition! { + name: &target_cfg.os_and_env(), + allowed_names: &target_cfgs.all_oses_and_envs, + message: "when the operative system and target environment are {name}" + } condition! { name: &target_cfg.abi, allowed_names: &target_cfgs.all_abis, From bf66ddbf24f3be48e31429540e3dfa4f832e61c7 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 16 Mar 2023 11:35:11 +0100 Subject: [PATCH 26/28] fix wrong ignore condition --- tests/ui-fulldeps/stable-mir/crate-info.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ui-fulldeps/stable-mir/crate-info.rs b/tests/ui-fulldeps/stable-mir/crate-info.rs index 99b653f20b636..03dab2350402d 100644 --- a/tests/ui-fulldeps/stable-mir/crate-info.rs +++ b/tests/ui-fulldeps/stable-mir/crate-info.rs @@ -1,7 +1,7 @@ // run-pass // Test that users are able to use stable mir APIs to retrieve information of the current crate -// ignore-stage-1 +// ignore-stage1 // ignore-cross-compile // ignore-remote // edition: 2021 From 48bea636fae05109ea90f08c290bae2b6bd9c69b Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 16 Mar 2023 14:18:07 +0100 Subject: [PATCH 27/28] fix solaris ignore --- tests/run-make/use-extern-for-plugins/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-make/use-extern-for-plugins/Makefile b/tests/run-make/use-extern-for-plugins/Makefile index 6ae53afad207b..b8ec7e8dcda90 100644 --- a/tests/run-make/use-extern-for-plugins/Makefile +++ b/tests/run-make/use-extern-for-plugins/Makefile @@ -2,7 +2,7 @@ include ../tools.mk # ignore-freebsd # ignore-openbsd -# ignore-sunos +# ignore-solaris HOST := $(shell $(RUSTC) -vV | grep 'host:' | sed 's/host: //') ifeq ($(findstring i686,$(HOST)),i686) From bbcbb6fccee0bc9edd7f4da96426d33a1742687d Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Thu, 30 Mar 2023 12:38:41 +0200 Subject: [PATCH 28/28] ignore x86-stdcall on mingw --- tests/ui/symbol-names/x86-stdcall.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/ui/symbol-names/x86-stdcall.rs b/tests/ui/symbol-names/x86-stdcall.rs index dd0e5477e2e17..43c086dc6bc18 100644 --- a/tests/ui/symbol-names/x86-stdcall.rs +++ b/tests/ui/symbol-names/x86-stdcall.rs @@ -1,6 +1,7 @@ // build-pass // only-x86 // only-windows +// ignore-gnu - vectorcall is not supported by GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89485 #![crate_type = "cdylib"] #![feature(abi_vectorcall)]