diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/src/core/config/tests.rs | 12 | ||||
| -rw-r--r-- | src/bootstrap/src/core/download.rs | 1 | ||||
| -rw-r--r-- | src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile | 1 | ||||
| -rw-r--r-- | src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile | 1 | ||||
| m--------- | src/tools/cargo | 0 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_utils/src/diagnostics.rs | 4 | ||||
| -rw-r--r-- | src/tools/compiletest/src/header.rs | 6 | ||||
| -rw-r--r-- | src/tools/miri/rust-version | 2 | ||||
| -rw-r--r-- | src/tools/miri/src/diagnostics.rs | 2 | ||||
| -rw-r--r-- | src/tools/miri/tests/pass/overflow_checks_off.rs | 6 | ||||
| -rw-r--r-- | src/tools/miropt-test-tools/Cargo.toml | 1 | ||||
| -rw-r--r-- | src/tools/miropt-test-tools/src/lib.rs | 19 | ||||
| -rw-r--r-- | src/tools/rustfmt/src/parse/session.rs | 11 | ||||
| -rw-r--r-- | src/tools/tidy/src/style.rs | 12 |
14 files changed, 56 insertions, 22 deletions
diff --git a/src/bootstrap/src/core/config/tests.rs b/src/bootstrap/src/core/config/tests.rs index 0ae466eca7d..6ac573c68df 100644 --- a/src/bootstrap/src/core/config/tests.rs +++ b/src/bootstrap/src/core/config/tests.rs @@ -11,9 +11,15 @@ use std::{ }; fn parse(config: &str) -> Config { - Config::parse_inner(&["check".to_owned(), "--config=/does/not/exist".to_owned()], |&_| { - toml::from_str(config).unwrap() - }) + let config = format!("{config} \r\n build.rustc = \"/does-not-exists\" "); + Config::parse_inner( + &[ + "check".to_owned(), + "--config=/does/not/exist".to_owned(), + "--skip-stage0-validation".to_owned(), + ], + |&_| toml::from_str(&config).unwrap(), + ) } #[test] diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs index e63d60feff1..b4ae3578ce3 100644 --- a/src/bootstrap/src/core/download.rs +++ b/src/bootstrap/src/core/download.rs @@ -399,6 +399,7 @@ impl Config { self.fix_bin_or_dylib(&cargo_clippy.with_file_name(exe("clippy-driver", host))); } + self.create(&clippy_stamp, date); cargo_clippy } diff --git a/src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile index f5274104d60..1704bef1e4e 100644 --- a/src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile @@ -25,6 +25,7 @@ RUN yum upgrade -y && \ openssl-devel \ patch \ perl \ + perl-core \ pkgconfig \ python3 \ unzip \ diff --git a/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile index 9a2fcb0ce0a..fe84c23a11c 100644 --- a/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile @@ -25,6 +25,7 @@ RUN yum upgrade -y && \ openssl-devel \ patch \ perl \ + perl-core \ pkgconfig \ python3 \ unzip \ diff --git a/src/tools/cargo b/src/tools/cargo -Subproject fc1d58fd0531a57a6b942a14cdcdbcb82ece16f +Subproject 7b7af3077bff8d60b7f124189bc9de227d3063a diff --git a/src/tools/clippy/clippy_utils/src/diagnostics.rs b/src/tools/clippy/clippy_utils/src/diagnostics.rs index 56978eb2ee8..5199959c0f2 100644 --- a/src/tools/clippy/clippy_utils/src/diagnostics.rs +++ b/src/tools/clippy/clippy_utils/src/diagnostics.rs @@ -84,9 +84,9 @@ pub fn span_lint_and_help<T: LintContext>( cx.span_lint(lint, span, msg.to_string(), |diag| { let help = help.to_string(); if let Some(help_span) = help_span { - diag.span_help(help_span, help.to_string()); + diag.span_help(help_span, help); } else { - diag.help(help.to_string()); + diag.help(help); } docs_link(diag, lint); }); diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 4ceb8a646e0..117828645a9 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -6,6 +6,7 @@ use std::io::BufReader; use std::path::{Path, PathBuf}; use std::process::Command; +use once_cell::sync::Lazy; use regex::Regex; use tracing::*; @@ -829,7 +830,8 @@ fn iter_header_extra( let mut ln = String::new(); let mut line_number = 0; - let revision_magic_comment = Regex::new("//(\\[.*\\])?~.*").unwrap(); + static REVISION_MAGIC_COMMENT_RE: Lazy<Regex> = + Lazy::new(|| Regex::new("//(\\[.*\\])?~.*").unwrap()); loop { line_number += 1; @@ -849,7 +851,7 @@ fn iter_header_extra( // First try to accept `ui_test` style comments } else if let Some((lncfg, ln)) = line_directive(comment, ln) { it(lncfg, orig_ln, ln, line_number); - } else if mode == Mode::Ui && suite == "ui" && !revision_magic_comment.is_match(ln) { + } else if mode == Mode::Ui && suite == "ui" && !REVISION_MAGIC_COMMENT_RE.is_match(ln) { let Some((_, rest)) = line_directive("//", ln) else { continue; }; diff --git a/src/tools/miri/rust-version b/src/tools/miri/rust-version index ab6f899cd3a..921a55d48c6 100644 --- a/src/tools/miri/rust-version +++ b/src/tools/miri/rust-version @@ -1 +1 @@ -4316d0c6252cb1f833e582dfa68adb98efd5ddfb +1f8e824f111c972c9df8dbb378d87c33f67bbad4 diff --git a/src/tools/miri/src/diagnostics.rs b/src/tools/miri/src/diagnostics.rs index d47f446716b..c1b404a2e36 100644 --- a/src/tools/miri/src/diagnostics.rs +++ b/src/tools/miri/src/diagnostics.rs @@ -505,7 +505,7 @@ pub fn report_msg<'tcx>( let is_local = machine.is_local(frame_info); // No span for non-local frames and the first frame (which is the error site). if is_local && idx > 0 { - err.eager_subdiagnostic(err.dcx, frame_info.as_note(machine.tcx)); + err.subdiagnostic(err.dcx, frame_info.as_note(machine.tcx)); } else { let sm = sess.source_map(); let span = sm.span_to_embeddable_string(frame_info.span); diff --git a/src/tools/miri/tests/pass/overflow_checks_off.rs b/src/tools/miri/tests/pass/overflow_checks_off.rs index 79aa510ef97..831bffb6c5e 100644 --- a/src/tools/miri/tests/pass/overflow_checks_off.rs +++ b/src/tools/miri/tests/pass/overflow_checks_off.rs @@ -1,12 +1,16 @@ //@compile-flags: -C overflow-checks=off // Check that we correctly implement the intended behavior of these operators -// when they are not being overflow-checked. +// when they are not being overflow-checked at runtime. // FIXME: if we call the functions in `std::ops`, we still get the panics. // Miri does not implement the codegen-time hack that backs `#[rustc_inherit_overflow_checks]`. // use std::ops::*; +// Disable _compile-time_ overflow linting +// so that we can test runtime overflow checks +#![allow(arithmetic_overflow)] + fn main() { assert_eq!(-{ -0x80i8 }, -0x80); diff --git a/src/tools/miropt-test-tools/Cargo.toml b/src/tools/miropt-test-tools/Cargo.toml index 8589a44cf1b..09b4c7d16dc 100644 --- a/src/tools/miropt-test-tools/Cargo.toml +++ b/src/tools/miropt-test-tools/Cargo.toml @@ -4,4 +4,3 @@ version = "0.1.0" edition = "2021" [dependencies] -regex = "1.0" diff --git a/src/tools/miropt-test-tools/src/lib.rs b/src/tools/miropt-test-tools/src/lib.rs index 7d60033c3e8..4317f23a822 100644 --- a/src/tools/miropt-test-tools/src/lib.rs +++ b/src/tools/miropt-test-tools/src/lib.rs @@ -100,14 +100,19 @@ pub fn files_for_miropt_test( } else { // Allow-list for file extensions that can be produced by MIR dumps. // Other extensions can be added here, as needed by new dump flags. - let ext_re = regex::Regex::new(r#"(\.(mir|dot))$"#).unwrap(); - let cap = ext_re.captures_iter(test_name).next().unwrap_or_else(|| { - panic!("in {testfile:?}:\nEMIT_MIR has an unrecognized extension: {test_name}") - }); - let extension = cap.get(1).unwrap().as_str(); + static ALLOWED_EXT: &[&str] = &["mir", "dot"]; + let Some((test_name_wo_ext, test_name_ext)) = test_name.rsplit_once('.') else { + panic!( + "in {testfile:?}:\nEMIT_MIR has an unrecognized extension: {test_name}, expected one of {ALLOWED_EXT:?}" + ) + }; + if !ALLOWED_EXT.contains(&test_name_ext) { + panic!( + "in {testfile:?}:\nEMIT_MIR has an unrecognized extension: {test_name}, expected one of {ALLOWED_EXT:?}" + ) + } - expected_file = - format!("{}{}{}", test_name.trim_end_matches(extension), suffix, extension,); + expected_file = format!("{}{}.{}", test_name_wo_ext, suffix, test_name_ext); from_file = test_name.to_string(); assert!(test_names.next().is_none(), "two mir pass names specified for MIR dump"); to_file = None; diff --git a/src/tools/rustfmt/src/parse/session.rs b/src/tools/rustfmt/src/parse/session.rs index f0af401d3da..cff025cf2ab 100644 --- a/src/tools/rustfmt/src/parse/session.rs +++ b/src/tools/rustfmt/src/parse/session.rs @@ -1,3 +1,4 @@ +use std::borrow::Cow; use std::path::Path; use std::sync::atomic::{AtomicBool, Ordering}; @@ -40,6 +41,16 @@ impl Translate for SilentEmitter { fn fallback_fluent_bundle(&self) -> &rustc_errors::FluentBundle { panic!("silent emitter attempted to translate a diagnostic"); } + + // Override `translate_message` for the silent emitter because eager translation of + // subdiagnostics result in a call to this. + fn translate_message<'a>( + &'a self, + message: &'a rustc_errors::DiagnosticMessage, + _: &'a rustc_errors::translation::FluentArgs<'_>, + ) -> Result<Cow<'_, str>, rustc_errors::error::TranslateError<'_>> { + rustc_errors::emitter::silent_translate(message) + } } impl Emitter for SilentEmitter { diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index a8aae6f5bc9..28d70b4454c 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -130,16 +130,20 @@ fn should_ignore(line: &str) -> bool { // Matches test annotations like `//~ ERROR text`. // This mirrors the regex in src/tools/compiletest/src/runtest.rs, please // update both if either are changed. - let re = Regex::new("\\s*//(\\[.*\\])?~.*").unwrap(); + lazy_static::lazy_static! { + static ref ANNOTATION_RE: Regex = Regex::new("\\s*//(\\[.*\\])?~.*").unwrap(); + } // For `ui_test`-style UI test directives, also ignore // - `//@[rev] compile-flags` // - `//@[rev] normalize-stderr-test` - let ui_test_long_directives = + lazy_static::lazy_static! { + static ref UI_TEST_LONG_DIRECTIVES_RE: Regex = Regex::new("\\s*//@(\\[.*\\]) (compile-flags|normalize-stderr-test|error-pattern).*") .unwrap(); - re.is_match(line) + } + ANNOTATION_RE.is_match(line) || ANNOTATIONS_TO_IGNORE.iter().any(|a| line.contains(a)) - || ui_test_long_directives.is_match(line) + || UI_TEST_LONG_DIRECTIVES_RE.is_match(line) } /// Returns `true` if `line` is allowed to be longer than the normal limit. |
