From fa0b0142a764618ee3b8424a66f41ec6de7c97c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sun, 12 Jul 2026 14:09:19 +0200 Subject: [PATCH 01/38] Remove ignore field of CollectedTestDesc It can be represented by the `ignore_message` being `Some`, to avoid duplicated and potentially inconsistent state. --- src/tools/compiletest/src/directives.rs | 6 ++---- src/tools/compiletest/src/directives/tests.rs | 2 +- src/tools/compiletest/src/executor.rs | 9 +++++++-- src/tools/compiletest/src/lib.rs | 3 +-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/tools/compiletest/src/directives.rs b/src/tools/compiletest/src/directives.rs index 49b860d9cd4cf..f6bd0a71ea350 100644 --- a/src/tools/compiletest/src/directives.rs +++ b/src/tools/compiletest/src/directives.rs @@ -1,3 +1,4 @@ +use std::borrow::Cow; use std::collections::HashSet; use std::process::Command; use std::{env, fs}; @@ -895,8 +896,7 @@ pub(crate) fn make_test_description( poisoned: &mut bool, aux_props: &mut AuxProps, ) -> CollectedTestDesc { - let mut ignore = false; - let mut ignore_message = None; + let mut ignore_message: Option> = None; let mut should_fail = false; // Scan through the test file to handle `ignore-*`, `only-*`, and `needs-*` directives. @@ -912,7 +912,6 @@ pub(crate) fn make_test_description( ($e:expr) => { match $e { IgnoreDecision::Ignore { reason } => { - ignore = true; ignore_message = Some(reason.into()); } IgnoreDecision::Error { message } => { @@ -959,7 +958,6 @@ pub(crate) fn make_test_description( CollectedTestDesc { name, filterable_path: filterable_path.to_owned(), - ignore, ignore_message, should_fail, } diff --git a/src/tools/compiletest/src/directives/tests.rs b/src/tools/compiletest/src/directives/tests.rs index 65d7b5360ae0d..bdbe4578b3f58 100644 --- a/src/tools/compiletest/src/directives/tests.rs +++ b/src/tools/compiletest/src/directives/tests.rs @@ -284,7 +284,7 @@ fn check_ignore(config: &Config, contents: &str) -> bool { let tn = String::new(); let p = Utf8Path::new("a.rs"); let d = make_test_description(&config, tn, p, p, contents, None); - d.ignore + d.is_ignored() } #[test] diff --git a/src/tools/compiletest/src/executor.rs b/src/tools/compiletest/src/executor.rs index c800d11d6b2fd..78303438b3a37 100644 --- a/src/tools/compiletest/src/executor.rs +++ b/src/tools/compiletest/src/executor.rs @@ -100,7 +100,7 @@ fn spawn_test_thread( test: &CollectedTest, completion_sender: mpsc::Sender, ) -> Option> { - if test.desc.ignore && !test.config.run_ignored { + if test.desc.is_ignored() && !test.config.run_ignored { completion_sender .send(TestCompletion { id, outcome: TestOutcome::Ignored, stdout: None }) .unwrap(); @@ -336,11 +336,16 @@ pub(crate) struct CollectedTest { pub(crate) struct CollectedTestDesc { pub(crate) name: String, pub(crate) filterable_path: Utf8PathBuf, - pub(crate) ignore: bool, pub(crate) ignore_message: Option>, pub(crate) should_fail: ShouldFail, } +impl CollectedTestDesc { + pub(crate) fn is_ignored(&self) -> bool { + self.ignore_message.is_some() + } +} + /// Tests with `//@ should-fail` are tests of compiletest itself, and should /// be reported as successful if and only if they would have _failed_. #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index 0836caa590f81..493e1ccea1475 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -946,11 +946,10 @@ fn make_test(cx: &TestCollectorCx, collector: &mut TestCollector, testpaths: &Te // If a test's inputs haven't changed since the last time it ran, // mark it as ignored so that the executor will skip it. - if !desc.ignore + if !desc.is_ignored() && !cx.config.force_rerun && is_up_to_date(cx, testpaths, &aux_props, revision) { - desc.ignore = true; // Keep this in sync with the "up-to-date" message detected by bootstrap. // FIXME(Zalathar): Now that we are no longer tied to libtest, we could // find a less fragile way to communicate this status to bootstrap. From ed659fad0c4640d998527c6dd85b40d9dfe75c48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sun, 12 Jul 2026 14:11:03 +0200 Subject: [PATCH 02/38] Explicitly mark debuginfo tests as ignored when the given debugger is not available --- src/tools/compiletest/src/debuggers.rs | 52 --------- src/tools/compiletest/src/directives.rs | 136 +++++++++++++++++------- src/tools/compiletest/src/lib.rs | 35 +++--- 3 files changed, 118 insertions(+), 105 deletions(-) diff --git a/src/tools/compiletest/src/debuggers.rs b/src/tools/compiletest/src/debuggers.rs index 4a1a74ddfe1bd..7b57c4c11052b 100644 --- a/src/tools/compiletest/src/debuggers.rs +++ b/src/tools/compiletest/src/debuggers.rs @@ -1,59 +1,7 @@ -use std::env; use std::process::Command; -use std::sync::Arc; use camino::Utf8Path; -use crate::common::{Config, Debugger}; - -pub(crate) fn configure_cdb(config: &Config) -> Option> { - config.cdb.as_ref()?; - - Some(Arc::new(Config { debugger: Some(Debugger::Cdb), ..config.clone() })) -} - -pub(crate) fn configure_gdb(config: &Config) -> Option> { - config.gdb_version?; - - if config.matches_env("msvc") { - return None; - } - - if config.remote_test_client.is_some() && !config.target.contains("android") { - println!( - "WARNING: debuginfo tests are not available when \ - testing with remote" - ); - return None; - } - - if config.target.contains("android") { - println!( - "{} debug-info test uses tcp 5039 port.\ - please reserve it", - config.target - ); - - // android debug-info test uses remote debugger so, we test 1 thread - // at once as they're all sharing the same TCP port to communicate - // over. - // - // we should figure out how to lift this restriction! (run them all - // on different ports allocated dynamically). - // - // SAFETY: at this point we are still single-threaded. - unsafe { env::set_var("RUST_TEST_THREADS", "1") }; - } - - Some(Arc::new(Config { debugger: Some(Debugger::Gdb), ..config.clone() })) -} - -pub(crate) fn configure_lldb(config: &Config) -> Option> { - config.lldb.as_ref()?; - - Some(Arc::new(Config { debugger: Some(Debugger::Lldb), ..config.clone() })) -} - pub(crate) fn query_cdb_version(cdb: &Utf8Path) -> Option<[u16; 4]> { let mut version = None; if let Ok(output) = Command::new(cdb).arg("/version").output() { diff --git a/src/tools/compiletest/src/directives.rs b/src/tools/compiletest/src/directives.rs index f6bd0a71ea350..19e966b2f1abe 100644 --- a/src/tools/compiletest/src/directives.rs +++ b/src/tools/compiletest/src/directives.rs @@ -899,52 +899,82 @@ pub(crate) fn make_test_description( let mut ignore_message: Option> = None; let mut should_fail = false; - // Scan through the test file to handle `ignore-*`, `only-*`, and `needs-*` directives. - iter_directives(config, file_directives, &mut |ln @ &DirectiveLine { line_number, .. }| { - if !ln.applies_to_test_revision(test_revision) { - return; + // Perform a per-file (rather than per-line) ignore decision to skip running debuginfo tests + // if we don't have a debugger for them available. + // This is needed because we duplicate the Config once for each debugger. + if config.mode == TestMode::DebugInfo { + match &config.debugger { + Some(Debugger::Cdb) => { + if let Some(msg) = check_cdb_support(config) { + ignore_message = Some(Cow::Owned(msg)); + } + } + Some(Debugger::Gdb) => { + if let Some(msg) = check_gdb_support(config) { + ignore_message = Some(Cow::Owned(msg)); + } + } + Some(Debugger::Lldb) => { + if let Some(msg) = check_lldb_support(config) { + ignore_message = Some(Cow::Owned(msg)); + } + } + None => {} } + } - // Parse `aux-*` directives, for use by up-to-date checks. - parse_and_update_aux(config, ln, aux_props); + if ignore_message.is_none() { + // Scan through the test file to handle `ignore-*`, `only-*`, and `needs-*` directives. + iter_directives( + config, + file_directives, + &mut |ln @ &DirectiveLine { line_number, .. }| { + if !ln.applies_to_test_revision(test_revision) { + return; + } - macro_rules! decision { - ($e:expr) => { - match $e { - IgnoreDecision::Ignore { reason } => { - ignore_message = Some(reason.into()); - } - IgnoreDecision::Error { message } => { - error!("{path}:{line_number}: {message}"); - *poisoned = true; - return; - } - IgnoreDecision::Continue => {} + // Parse `aux-*` directives, for use by up-to-date checks. + parse_and_update_aux(config, ln, aux_props); + + macro_rules! decision { + ($e:expr) => { + match $e { + IgnoreDecision::Ignore { reason } => { + ignore_message = Some(reason.into()); + } + IgnoreDecision::Error { message } => { + error!("{path}:{line_number}: {message}"); + *poisoned = true; + return; + } + IgnoreDecision::Continue => {} + } + }; } - }; - } - decision!(cfg::handle_ignore(&cache.cfg_conditions, ln)); - decision!(cfg::handle_only(&cache.cfg_conditions, ln)); - decision!(needs::handle_needs(&cache.needs, config, ln)); - decision!(ignore_llvm(config, ln)); - decision!(ignore_backends(config, ln)); - decision!(needs_backends(config, ln)); - decision!(ignore_cdb(config, ln)); - decision!(ignore_gdb(config, ln)); - decision!(ignore_lldb(config, ln)); - decision!(ignore_parallel_frontend(config, ln)); - - if config.target == "wasm32-unknown-unknown" - && config.parse_name_directive(ln, directives::CHECK_RUN_RESULTS) - { - decision!(IgnoreDecision::Ignore { - reason: "ignored on WASM as the run results cannot be checked there".into(), - }); - } + decision!(cfg::handle_ignore(&cache.cfg_conditions, ln)); + decision!(cfg::handle_only(&cache.cfg_conditions, ln)); + decision!(needs::handle_needs(&cache.needs, config, ln)); + decision!(ignore_llvm(config, ln)); + decision!(ignore_backends(config, ln)); + decision!(needs_backends(config, ln)); + decision!(ignore_cdb(config, ln)); + decision!(ignore_gdb(config, ln)); + decision!(ignore_lldb(config, ln)); + decision!(ignore_parallel_frontend(config, ln)); + + if config.target == "wasm32-unknown-unknown" + && config.parse_name_directive(ln, directives::CHECK_RUN_RESULTS) + { + decision!(IgnoreDecision::Ignore { + reason: "ignored on WASM as the run results cannot be checked there".into(), + }); + } - should_fail |= config.parse_name_directive(ln, "should-fail"); - }); + should_fail |= config.parse_name_directive(ln, "should-fail"); + }, + ); + } // The `should-fail` annotation doesn't apply to pretty tests, // since we run the pretty printer across all tests by default. @@ -963,6 +993,32 @@ pub(crate) fn make_test_description( } } +/// Returns `None` if CDB is available, otherwise returns an ignore message. +fn check_cdb_support(config: &Config) -> Option { + if config.cdb.is_none() { Some("cdb is not available".to_string()) } else { None } +} + +/// Returns `None` if GDB is available, otherwise returns an ignore message. +fn check_gdb_support(config: &Config) -> Option { + if config.gdb_version.is_none() { + return Some("gdb is not available".to_string()); + } + + if config.matches_env("msvc") { + return Some("gdb tests do not run on msvc".to_string()); + } + + if config.remote_test_client.is_some() && !config.target.contains("android") { + return Some("gdb tests are not available when testing with remote".to_string()); + } + None +} + +/// Returns `None` if LLDB is available, otherwise returns an ignore message. +fn check_lldb_support(config: &Config) -> Option { + if config.lldb.is_none() { Some("lldb is not available".to_string()) } else { None } +} + fn ignore_cdb(config: &Config, line: &DirectiveLine<'_>) -> IgnoreDecision { if config.debugger != Some(Debugger::Cdb) { return IgnoreDecision::Continue; diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index 493e1ccea1475..95132e9c53dc7 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -561,19 +561,28 @@ fn run_tests(config: Arc) { if let TestMode::DebugInfo = config.mode { // Debugging emscripten code doesn't make sense today if !config.target.contains("emscripten") { - match config.debugger { - Some(Debugger::Cdb) => configs.extend(debuggers::configure_cdb(&config)), - Some(Debugger::Gdb) => configs.extend(debuggers::configure_gdb(&config)), - Some(Debugger::Lldb) => configs.extend(debuggers::configure_lldb(&config)), - // FIXME: the *implicit* debugger discovery makes it really difficult to control - // which {`cdb`, `gdb`, `lldb`} are used. These should **not** be implicitly - // discovered by `compiletest`; these should be explicit `bootstrap` configuration - // options that are passed to `compiletest`! - None => { - configs.extend(debuggers::configure_cdb(&config)); - configs.extend(debuggers::configure_gdb(&config)); - configs.extend(debuggers::configure_lldb(&config)); - } + // FIXME: ideally, we would just have one config, and then have some mechanism of + // generating multiple variants of a test, one for each debugger (something like + // debuginfo revisions). But for now, we just create three configs. + configs.extend([ + Arc::new(Config { debugger: Some(Debugger::Cdb), ..config.as_ref().clone() }), + Arc::new(Config { debugger: Some(Debugger::Gdb), ..config.as_ref().clone() }), + Arc::new(Config { debugger: Some(Debugger::Lldb), ..config.as_ref().clone() }), + ]); + + // FIXME: this should ideally happen somewhere else.. + if config.target.contains("android") { + println!("{} debug-info test uses tcp 5039 port. please reserve it", config.target); + + // android debug-info test uses remote debugger so, we test 1 thread + // at once as they're all sharing the same TCP port to communicate + // over. + // + // we should figure out how to lift this restriction! (run them all + // on different ports allocated dynamically). + // + // SAFETY: at this point we are still single-threaded. + unsafe { env::set_var("RUST_TEST_THREADS", "1") }; } } } else { From 6cd80d0045b24953f7c88a72166b19e4e4d9813d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sun, 12 Jul 2026 21:57:28 +0200 Subject: [PATCH 03/38] Port compiletest CLI parsing from `getopts` to `clap` --- Cargo.lock | 2 +- src/tools/compiletest/Cargo.toml | 2 +- src/tools/compiletest/src/lib.rs | 729 ++++++++++++++++--------------- 3 files changed, 377 insertions(+), 356 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 96dc56ab189b0..e75d1eac665d1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -887,9 +887,9 @@ dependencies = [ "anstyle-svg", "build_helper", "camino", + "clap", "colored", "diff", - "getopts", "glob", "home", "indexmap", diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index 0d8cbdf789b3f..b2f931cb129f0 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -18,9 +18,9 @@ test = false anstyle-svg = "0.1.11" build_helper = { path = "../../build_helper" } camino = "1" +clap = { version = "4", features = ["derive"] } colored = "3" diff = "0.1.10" -getopts = "0.2" glob = "0.3.0" home = "0.5.5" indexmap = "2.0.0" diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index 0836caa590f81..fe74afa29dd29 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -33,7 +33,7 @@ use std::{env, fs, vec}; use build_helper::git::{get_git_modified_files, get_git_untracked_files}; use camino::{Utf8Component, Utf8Path, Utf8PathBuf}; -use getopts::Options; +use clap::Parser; use rayon::iter::{ParallelBridge, ParallelIterator}; use tracing::debug; use walkdir::WalkDir; @@ -47,214 +47,282 @@ use crate::directives::{AuxProps, DirectivesCache, FileDirectives}; use crate::edition::parse_edition; use crate::executor::CollectedTest; -/// Creates the `Config` instance for this invocation of compiletest. -/// -/// The config mostly reflects command-line arguments, but there might also be -/// some code here that inspects environment variables or even runs executables -/// (e.g. when discovering debugger versions). -fn parse_config(args: Vec) -> Config { - let mut opts = Options::new(); - opts.reqopt("", "compile-lib-path", "path to host shared libraries", "PATH") - .reqopt("", "run-lib-path", "path to target shared libraries", "PATH") - .reqopt("", "rustc-path", "path to rustc to use for compiling", "PATH") - .optopt("", "cargo-path", "path to cargo to use for compiling", "PATH") - .optopt( - "", - "stage0-rustc-path", - "path to rustc to use for compiling run-make recipes", - "PATH", - ) - .optopt( - "", - "query-rustc-path", - "path to rustc to use for querying target information (defaults to `--rustc-path`)", - "PATH", - ) - .optopt("", "rustdoc-path", "path to rustdoc to use for compiling", "PATH") - .optopt("", "coverage-dump-path", "path to coverage-dump to use in tests", "PATH") - .reqopt("", "python", "path to python to use for doc tests", "PATH") - .optopt("", "jsondocck-path", "path to jsondocck to use for doc tests", "PATH") - .optopt("", "jsondoclint-path", "path to jsondoclint to use for doc tests", "PATH") - .optopt("", "run-clang-based-tests-with", "path to Clang executable", "PATH") - .optopt("", "llvm-filecheck", "path to LLVM's FileCheck binary", "DIR") - .reqopt("", "src-root", "directory containing sources", "PATH") - .reqopt("", "src-test-suite-root", "directory containing test suite sources", "PATH") - .reqopt("", "build-root", "path to root build directory", "PATH") - .reqopt("", "build-test-suite-root", "path to test suite specific build directory", "PATH") - .reqopt("", "sysroot-base", "directory containing the compiler sysroot", "PATH") - .reqopt("", "stage", "stage number under test", "N") - .reqopt("", "stage-id", "the target-stage identifier", "stageN-TARGET") - .reqopt( - "", - "mode", - "which sort of compile tests to run", - "pretty | debug-info | codegen | rustdoc-html \ - | rustdoc-json | codegen-units | incremental | run-make | ui \ - | rustdoc-js | mir-opt | assembly | crashes", - ) - .reqopt( - "", - "suite", - "which suite of compile tests to run. used for nicer error reporting.", - "SUITE", - ) - .optopt( - "", - "pass", - "force {check,build,run}-pass tests to this mode.", - "check | build | run", - ) - .optopt("", "run", "whether to execute run-* tests", "auto | always | never") - .optflag("", "ignored", "run tests marked as ignored") - .optflag("", "has-enzyme", "run tests that require enzyme") - .optflag("", "has-offload", "run tests that require offload") - .optflag("", "with-rustc-debug-assertions", "whether rustc was built with debug assertions") - .optflag("", "with-std-debug-assertions", "whether std was built with debug assertions") - .optflag("", "with-std-remap-debuginfo", "whether std was built with remapping") - .optmulti( - "", - "skip", - "skip tests matching SUBSTRING. Can be passed multiple times", - "SUBSTRING", - ) - .optflag("", "exact", "filters match exactly") - .optopt( - "", - "runner", - "supervisor program to run tests under \ - (eg. emulator, valgrind)", - "PROGRAM", - ) - .optmulti("", "host-rustcflags", "flags to pass to rustc for host", "FLAGS") - .optmulti("", "target-rustcflags", "flags to pass to rustc for target", "FLAGS") - .optflag( - "", - "rust-randomized-layout", - "set this when rustc/stdlib were compiled with randomized layouts", - ) - .optflag("", "optimize-tests", "run tests with optimizations enabled") - .optflag("", "verbose", "run tests verbosely, showing all output") - .optflag( - "", - "verbose-run-make-subprocess-output", - "show verbose subprocess output for successful run-make tests", - ) - .optflag( - "", - "bless", - "overwrite stderr/stdout files instead of complaining about a mismatch", - ) - .optflag("", "fail-fast", "stop as soon as possible after any test fails") - .optopt("", "target", "the target to build for", "TARGET") - .optopt("", "host", "the host to build for", "HOST") - .optopt("", "cdb", "path to CDB to use for CDB debuginfo tests", "PATH") - .optopt("", "gdb", "path to GDB to use for GDB debuginfo tests", "PATH") - .optopt("", "lldb", "path to LLDB to use for LLDB debuginfo tests", "PATH") - .optopt("", "lldb-version", "the version of LLDB used", "VERSION STRING") - .optopt("", "llvm-version", "the version of LLVM used", "VERSION STRING") - .optflag("", "system-llvm", "is LLVM the system LLVM") - .optopt("", "android-cross-path", "Android NDK standalone path", "PATH") - .optopt("", "adb-path", "path to the android debugger", "PATH") - .optopt("", "adb-test-dir", "path to tests for the android debugger", "PATH") - .reqopt("", "cc", "path to a C compiler", "PATH") - .reqopt("", "cxx", "path to a C++ compiler", "PATH") - .reqopt("", "cflags", "flags for the C compiler", "FLAGS") - .reqopt("", "cxxflags", "flags for the CXX compiler", "FLAGS") - .optopt("", "ar", "path to an archiver", "PATH") - .optopt("", "target-linker", "path to a linker for the target", "PATH") - .optopt("", "host-linker", "path to a linker for the host", "PATH") - .reqopt("", "llvm-components", "list of LLVM components built in", "LIST") - .optopt("", "llvm-bin-dir", "Path to LLVM's `bin` directory", "PATH") - .optopt("", "nodejs", "the name of nodejs", "PATH") - .optopt("", "npm", "the name of npm", "PATH") - .optopt("", "remote-test-client", "path to the remote test client", "PATH") - .optopt( - "", - "compare-mode", - "mode describing what file the actual ui output will be compared to", - "COMPARE MODE", - ) - .optflag( - "", - "rustfix-coverage", - "enable this to generate a Rustfix coverage file, which is saved in \ - `.//rustfix_missing_coverage.txt`", - ) - .optflag("", "force-rerun", "rerun tests even if the inputs are unchanged") - .optflag("", "only-modified", "only run tests that result been modified") - // FIXME: Temporarily retained so we can point users to `--no-capture` - .optflag("", "nocapture", "") - .optflag("", "no-capture", "don't capture stdout/stderr of tests") - .optflag("", "profiler-runtime", "is the profiler runtime enabled for this target") - .optflag("h", "help", "show this message") - .reqopt("", "channel", "current Rust channel", "CHANNEL") - .optflag( - "", - "git-hash", - "run tests which rely on commit version being compiled into the binaries", - ) - .optopt("", "edition", "default Rust edition", "EDITION") - .reqopt("", "nightly-branch", "name of the git branch for nightly", "BRANCH") - .reqopt( - "", - "git-merge-commit-email", - "email address used for finding merge commits", - "EMAIL", - ) - .optopt( - "", - "compiletest-diff-tool", - "What custom diff tool to use for displaying compiletest tests.", - "COMMAND", - ) - .reqopt("", "minicore-path", "path to minicore aux library", "PATH") - .optopt( - "", - "debugger", - "only test a specific debugger in debuginfo tests", - "gdb | lldb | cdb", - ) - .optopt( - "", - "default-codegen-backend", - "the codegen backend currently used", - "CODEGEN BACKEND NAME", - ) - .optopt( - "", - "override-codegen-backend", - "the codegen backend to use instead of the default one", - "CODEGEN BACKEND [NAME | PATH]", - ) - .optflag("", "bypass-ignore-backends", "ignore `//@ ignore-backends` directives") - .reqopt("", "jobs", "number of parallel jobs bootstrap was configured with", "JOBS") - .optopt( - "", - "parallel-frontend-threads", - "number of parallel threads to use for the frontend when building test artifacts", - "THREADS_COUNT", - ) - .optopt("", "iteration-count", "number of times to execute each test", "COUNT"); - - let (argv0, args_) = args.split_first().unwrap(); - if args.len() == 1 || args[1] == "-h" || args[1] == "--help" { - let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0); - println!("{}", opts.usage(&message)); - println!(); - panic!() - } - - let matches = &match opts.parse(args_) { - Ok(m) => m, - Err(f) => panic!("{:?}", f), - }; +/// Compiletest command-line arguments. +#[derive(clap::Parser)] +struct Args { + // Required paths + /// Path to host shared libraries. + #[arg(long)] + compile_lib_path: Utf8PathBuf, + /// Path to target shared libraries. + #[arg(long)] + run_lib_path: Utf8PathBuf, + /// Path to rustc to use for compiling. + #[arg(long)] + rustc_path: Utf8PathBuf, + /// Path to python to use for doc tests. + #[arg(long)] + python: String, + /// Directory containing sources. + #[arg(long)] + src_root: Utf8PathBuf, + /// Directory containing test suite sources. + #[arg(long)] + src_test_suite_root: Utf8PathBuf, + /// Path to root build directory. + #[arg(long)] + build_root: Utf8PathBuf, + /// Path to test suite specific build directory. + #[arg(long)] + build_test_suite_root: Utf8PathBuf, + /// Directory containing the compiler sysroot. + #[arg(long)] + sysroot_base: Utf8PathBuf, + /// Stage number under test. + #[arg(long)] + stage: u32, + /// The target-stage identifier. + #[arg(long)] + stage_id: String, + /// Which sort of compile tests to run. + #[arg(long)] + mode: String, + /// Which suite of compile tests to run. + #[arg(long)] + suite: String, + /// Path to a C compiler. + #[arg(long)] + cc: String, + /// Path to a C++ compiler. + #[arg(long)] + cxx: String, + /// Flags for the C compiler. + #[arg(long)] + cflags: String, + /// Flags for the CXX compiler. + #[arg(long)] + cxxflags: String, + /// List of LLVM components built in. + #[arg(long)] + llvm_components: String, + /// Current Rust channel. + #[arg(long)] + channel: String, + /// Name of the git branch for nightly. + #[arg(long)] + nightly_branch: String, + /// Email address used for finding merge commits. + #[arg(long)] + git_merge_commit_email: String, + /// Path to minicore aux library. + #[arg(long)] + minicore_path: Utf8PathBuf, + /// Number of parallel jobs bootstrap was configured with. + #[arg(long)] + jobs: u32, + + // Required-by-convention + /// The host to build for. + #[arg(long)] + host: String, + /// The target to build for. + #[arg(long)] + target: String, + + // Optional paths + /// Path to cargo to use for compiling. + #[arg(long)] + cargo_path: Option, + /// Path to rustc to use for compiling run-make recipes. + #[arg(long)] + stage0_rustc_path: Option, + /// Path to rustc to use for querying target information. + #[arg(long)] + query_rustc_path: Option, + /// Path to rustdoc to use for compiling. + #[arg(long)] + rustdoc_path: Option, + /// Path to coverage-dump to use in tests. + #[arg(long)] + coverage_dump_path: Option, + /// Path to jsondocck to use for doc tests. + #[arg(long)] + jsondocck_path: Option, + /// Path to jsondoclint to use for doc tests. + #[arg(long)] + jsondoclint_path: Option, + /// Path to Clang executable. + #[arg(long)] + run_clang_based_tests_with: Option, + /// Path to LLVM's FileCheck binary. + #[arg(long)] + llvm_filecheck: Option, + /// Path to LLVM's bin directory. + #[arg(long)] + llvm_bin_dir: Option, + /// The name of nodejs. + #[arg(long)] + nodejs: Option, + /// The name of npm. + #[arg(long)] + npm: Option, + /// Path to the remote test client. + #[arg(long)] + remote_test_client: Option, + /// Path to CDB to use for CDB debuginfo tests. + #[arg(long)] + cdb: Option, + /// Path to GDB to use for GDB debuginfo tests. + #[arg(long)] + gdb: Option, + /// Path to LLDB to use for LLDB debuginfo tests. + #[arg(long)] + lldb: Option, + /// The version of LLDB used. + #[arg(long)] + lldb_version: Option, + /// The version of LLVM used. + #[arg(long)] + llvm_version: Option, + /// Android NDK standalone path. + #[arg(long)] + android_cross_path: Option, + /// Path to the android debugger. + #[arg(long)] + adb_path: Option, + /// Path to tests for the android debugger. + #[arg(long)] + adb_test_dir: Option, + /// Path to an archiver. + #[arg(long, default_value = "ar")] + ar: String, + /// Path to a linker for the target. + #[arg(long)] + target_linker: Option, + /// Path to a linker for the host. + #[arg(long)] + host_linker: Option, + + // Optional string values + /// Force {check,build,run}-pass tests to this mode. + #[arg(long)] + pass: Option, + /// Whether to execute run-* tests. + #[arg(long)] + run: Option, + /// Supervisor program to run tests under (eg. emulator, valgrind). + #[arg(long)] + runner: Option, + /// Mode describing what file the actual ui output will be compared to. + #[arg(long)] + compare_mode: Option, + /// Default Rust edition. + #[arg(long)] + edition: Option, + /// Only test a specific debugger in debuginfo tests. + #[arg(long)] + debugger: Option, + /// The codegen backend currently used. + #[arg(long)] + default_codegen_backend: Option, + /// The codegen backend to use instead of the default one. + #[arg(long)] + override_codegen_backend: Option, + /// Custom diff tool to use for displaying compiletest tests. + #[arg(long)] + compiletest_diff_tool: Option, + /// Number of parallel threads for the frontend. + #[arg(long)] + parallel_frontend_threads: Option, + /// Number of times to execute each test. + #[arg(long)] + iteration_count: Option, + + // Flags + /// Overwrite stderr/stdout files instead of complaining about a mismatch. + #[arg(long)] + bless: bool, + /// Stop as soon as possible after any test fails. + #[arg(long)] + fail_fast: bool, + /// Run tests marked as ignored. + #[arg(long)] + ignored: bool, + /// Run tests that require enzyme. + #[arg(long)] + has_enzyme: bool, + /// Run tests that require offload. + #[arg(long)] + has_offload: bool, + /// Whether rustc was built with debug assertions. + #[arg(long)] + with_rustc_debug_assertions: bool, + /// Whether std was built with debug assertions. + #[arg(long)] + with_std_debug_assertions: bool, + /// Whether std was built with remapping. + #[arg(long)] + with_std_remap_debuginfo: bool, + /// Filters match exactly. + #[arg(long)] + exact: bool, + /// Set this when rustc/stdlib were compiled with randomized layouts. + #[arg(long)] + rust_randomized_layout: bool, + /// Run tests with optimizations enabled. + #[arg(long)] + optimize_tests: bool, + /// Run tests verbosely, showing all output. + #[arg(long)] + verbose: bool, + /// Show verbose subprocess output for successful run-make tests. + #[arg(long)] + verbose_run_make_subprocess_output: bool, + /// Is LLVM the system LLVM. + #[arg(long)] + system_llvm: bool, + /// Rerun tests even if the inputs are unchanged. + #[arg(long)] + force_rerun: bool, + /// Only run tests that result been modified. + #[arg(long)] + only_modified: bool, + #[arg(long, hide = true)] + nocapture: bool, + /// Don't capture stdout/stderr of tests. + #[arg(long)] + no_capture: bool, + /// Is the profiler runtime enabled for this target. + #[arg(long)] + profiler_runtime: bool, + /// Run tests which rely on commit version being compiled into the binaries. + #[arg(long)] + git_hash: bool, + /// Enable this to generate a Rustfix coverage file. + #[arg(long)] + rustfix_coverage: bool, + /// Ignore `//@ ignore-backends` directives. + #[arg(long)] + bypass_ignore_backends: bool, + + // Multi-value + /// Skip tests matching SUBSTRING. + #[arg(long)] + skip: Vec, + /// Flags to pass to rustc for host. + #[arg(long)] + host_rustcflags: Vec, + /// Flags to pass to rustc for target. + #[arg(long)] + target_rustcflags: Vec, + + // Positional (filters) + /// Test name filters. + filters: Vec, +} - if matches.opt_present("h") || matches.opt_present("help") { - let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0); - println!("{}", opts.usage(&message)); - println!(); - panic!() - } +fn parse_config(args: Vec) -> Config { + let args = Args::parse_from(args); fn make_absolute(path: Utf8PathBuf) -> Utf8PathBuf { if path.is_relative() { @@ -264,62 +332,40 @@ fn parse_config(args: Vec) -> Config { } } - fn opt_path(m: &getopts::Matches, nm: &str) -> Utf8PathBuf { - match m.opt_str(nm) { - Some(s) => Utf8PathBuf::from(&s), - None => panic!("no option (=path) found for {}", nm), - } + if args.nocapture { + panic!("`--nocapture` is deprecated; please use `--no-capture`"); } - let host = matches.opt_str("host").expect("`--host` must be unconditionally specified"); - let target = matches.opt_str("target").expect("`--target` must be unconditionally specified"); - - let android_cross_path = matches.opt_str("android-cross-path").map(Utf8PathBuf::from); - - let adb_path = matches.opt_str("adb-path").map(Utf8PathBuf::from); - let adb_test_dir = matches.opt_str("adb-test-dir").map(Utf8PathBuf::from); - let adb_device_status = target.contains("android") && adb_test_dir.is_some(); + let adb_device_status = args.target.contains("android") && args.adb_test_dir.is_some(); // FIXME: `cdb_version` is *derived* from cdb, but it's *not* technically a config! - let cdb = matches.opt_str("cdb").map(Utf8PathBuf::from); - let cdb_version = cdb.as_deref().and_then(debuggers::query_cdb_version); + let cdb_version = args.cdb.as_deref().and_then(debuggers::query_cdb_version); // FIXME: `gdb_version` is *derived* from gdb, but it's *not* technically a config! - let gdb = matches.opt_str("gdb").map(Utf8PathBuf::from); - let gdb_version = gdb.as_deref().and_then(debuggers::query_gdb_version); + let gdb_version = args.gdb.as_deref().and_then(debuggers::query_gdb_version); // FIXME: `lldb_version` is *derived* from lldb, but it's *not* technically a config! - let lldb = matches.opt_str("lldb").map(Utf8PathBuf::from); - let lldb_version = - matches.opt_str("lldb-version").as_deref().and_then(debuggers::extract_lldb_version); + let lldb_version = args.lldb_version.as_deref().and_then(debuggers::extract_lldb_version); // FIXME: this is very questionable, we really should be obtaining LLVM version info from // `bootstrap`, and not trying to be figuring out that in `compiletest` by running the // `FileCheck` binary. let llvm_version = - matches.opt_str("llvm-version").as_deref().map(directives::extract_llvm_version).or_else( - || directives::extract_llvm_version_from_binary(&matches.opt_str("llvm-filecheck")?), - ); + args.llvm_version.as_deref().map(directives::extract_llvm_version).or_else(|| { + directives::extract_llvm_version_from_binary(args.llvm_filecheck.as_ref()?.as_str()) + }); - let default_codegen_backend = match matches.opt_str("default-codegen-backend").as_deref() { + let default_codegen_backend = match args.default_codegen_backend.as_deref() { Some(backend) => match CodegenBackend::try_from(backend) { Ok(backend) => backend, Err(error) => { - panic!("invalid value `{backend}` for `--defalt-codegen-backend`: {error}") + panic!("invalid value `{backend}` for `--default-codegen-backend`: {error}") } }, // By default, it's always llvm. None => CodegenBackend::Llvm, }; - let override_codegen_backend = matches.opt_str("override-codegen-backend"); - - let run_ignored = matches.opt_present("ignored"); - let with_rustc_debug_assertions = matches.opt_present("with-rustc-debug-assertions"); - let with_std_debug_assertions = matches.opt_present("with-std-debug-assertions"); - let with_std_remap_debuginfo = matches.opt_present("with-std-remap-debuginfo"); - let mode = matches.opt_str("mode").unwrap().parse().expect("invalid mode"); - let has_enzyme = matches.opt_present("has-enzyme"); - let has_offload = matches.opt_present("has-offload"); + + let mode: TestMode = args.mode.parse().expect("invalid mode"); let filters = if mode == TestMode::RunMake { - matches - .free + args.filters .iter() .map(|f| { // Here `f` is relative to `./tests/run-make`. So if you run @@ -346,9 +392,10 @@ fn parse_config(args: Vec) -> Config { // ./x test tests/ui/lint/unused // // the filter is "lint/unused". - matches.free.clone() + args.filters.clone() }; - let compare_mode = matches.opt_str("compare-mode").map(|s| { + + let compare_mode = args.compare_mode.as_deref().map(|s| { s.parse().unwrap_or_else(|_| { let variants: Vec<_> = CompareMode::STR_VARIANTS.iter().copied().collect(); panic!( @@ -357,17 +404,9 @@ fn parse_config(args: Vec) -> Config { ); }) }); - if matches.opt_present("nocapture") { - panic!("`--nocapture` is deprecated; please use `--no-capture`"); - } - let stage = match matches.opt_str("stage") { - Some(stage) => stage.parse::().expect("expected `--stage` to be an unsigned integer"), - None => panic!("`--stage` is required"), - }; - - let src_root = opt_path(matches, "src-root"); - let src_test_suite_root = opt_path(matches, "src-test-suite-root"); + let src_root = args.src_root; + let src_test_suite_root = args.src_test_suite_root; assert!( src_test_suite_root.starts_with(&src_root), "`src-root` must be a parent of `src-test-suite-root`: `src-root`=`{}`, `src-test-suite-root` = `{}`", @@ -375,50 +414,33 @@ fn parse_config(args: Vec) -> Config { src_test_suite_root ); - let build_root = opt_path(matches, "build-root"); - let build_test_suite_root = opt_path(matches, "build-test-suite-root"); + let build_root = args.build_root; + let build_test_suite_root = args.build_test_suite_root; assert!(build_test_suite_root.starts_with(&build_root)); - let jobs = match matches.opt_str("jobs") { - Some(jobs) => jobs.parse::().expect("expected `--jobs` to be an `u32`"), - None => panic!("`--jobs` is required"), - }; - - let parallel_frontend_threads = match matches.opt_str("parallel-frontend-threads") { - Some(threads) => { - threads.parse::().expect("expected `--parallel-frontend-threads` to be an `u32`") - } - None => Config::DEFAULT_PARALLEL_FRONTEND_THREADS, - }; - let iteration_count = match matches.opt_str("iteration-count") { - Some(count) => { - count.parse::().expect("expected `--iteration-count` to be a positive integer") - } - None => Config::DEFAULT_ITERATION_COUNT, - }; + let parallel_frontend_threads = + args.parallel_frontend_threads.unwrap_or(Config::DEFAULT_PARALLEL_FRONTEND_THREADS); + let iteration_count = args.iteration_count.unwrap_or(Config::DEFAULT_ITERATION_COUNT); assert!(iteration_count > 0, "`--iteration-count` must be a positive integer"); Config { - bless: matches.opt_present("bless"), - fail_fast: matches.opt_present("fail-fast") - || env::var_os("RUSTC_TEST_FAIL_FAST").is_some(), - - host_compile_lib_path: make_absolute(opt_path(matches, "compile-lib-path")), - target_run_lib_path: make_absolute(opt_path(matches, "run-lib-path")), - rustc_path: opt_path(matches, "rustc-path"), - cargo_path: matches.opt_str("cargo-path").map(Utf8PathBuf::from), - stage0_rustc_path: matches.opt_str("stage0-rustc-path").map(Utf8PathBuf::from), - query_rustc_path: matches.opt_str("query-rustc-path").map(Utf8PathBuf::from), - rustdoc_path: matches.opt_str("rustdoc-path").map(Utf8PathBuf::from), - coverage_dump_path: matches.opt_str("coverage-dump-path").map(Utf8PathBuf::from), - python: matches.opt_str("python").unwrap(), - jsondocck_path: matches.opt_str("jsondocck-path").map(Utf8PathBuf::from), - jsondoclint_path: matches.opt_str("jsondoclint-path").map(Utf8PathBuf::from), - run_clang_based_tests_with: matches - .opt_str("run-clang-based-tests-with") - .map(Utf8PathBuf::from), - llvm_filecheck: matches.opt_str("llvm-filecheck").map(Utf8PathBuf::from), - llvm_bin_dir: matches.opt_str("llvm-bin-dir").map(Utf8PathBuf::from), + bless: args.bless, + fail_fast: args.fail_fast || env::var_os("RUSTC_TEST_FAIL_FAST").is_some(), + + host_compile_lib_path: make_absolute(args.compile_lib_path), + target_run_lib_path: make_absolute(args.run_lib_path), + rustc_path: args.rustc_path, + cargo_path: args.cargo_path, + stage0_rustc_path: args.stage0_rustc_path, + query_rustc_path: args.query_rustc_path, + rustdoc_path: args.rustdoc_path, + coverage_dump_path: args.coverage_dump_path, + python: args.python, + jsondocck_path: args.jsondocck_path, + jsondoclint_path: args.jsondoclint_path, + run_clang_based_tests_with: args.run_clang_based_tests_with, + llvm_filecheck: args.llvm_filecheck, + llvm_bin_dir: args.llvm_bin_dir, src_root, src_test_suite_root, @@ -426,100 +448,99 @@ fn parse_config(args: Vec) -> Config { build_root, build_test_suite_root, - sysroot_base: opt_path(matches, "sysroot-base"), + sysroot_base: args.sysroot_base, - stage, - stage_id: matches.opt_str("stage-id").unwrap(), + stage: args.stage, + stage_id: args.stage_id, mode, - suite: matches.opt_str("suite").unwrap().parse().expect("invalid suite"), - debugger: matches.opt_str("debugger").map(|debugger| { + suite: args.suite.parse().expect("invalid suite"), + debugger: args.debugger.map(|debugger| { debugger .parse::() .unwrap_or_else(|_| panic!("unknown `--debugger` option `{debugger}` given")) }), - run_ignored, - with_rustc_debug_assertions, - with_std_debug_assertions, - with_std_remap_debuginfo, + run_ignored: args.ignored, + with_rustc_debug_assertions: args.with_rustc_debug_assertions, + with_std_debug_assertions: args.with_std_debug_assertions, + with_std_remap_debuginfo: args.with_std_remap_debuginfo, filters, - skip: matches.opt_strs("skip"), - filter_exact: matches.opt_present("exact"), - force_pass_mode: matches.opt_str("pass").map(|mode| { + skip: args.skip, + filter_exact: args.exact, + force_pass_mode: args.pass.map(|mode| { mode.parse::() .unwrap_or_else(|_| panic!("unknown `--pass` option `{}` given", mode)) }), // FIXME: this run scheme is... confusing. - run: matches.opt_str("run").and_then(|mode| match mode.as_str() { + run: args.run.and_then(|mode| match mode.as_str() { "auto" => None, "always" => Some(true), "never" => Some(false), _ => panic!("unknown `--run` option `{}` given", mode), }), - runner: matches.opt_str("runner"), - host_rustcflags: matches.opt_strs("host-rustcflags"), - target_rustcflags: matches.opt_strs("target-rustcflags"), - optimize_tests: matches.opt_present("optimize-tests"), - rust_randomized_layout: matches.opt_present("rust-randomized-layout"), - target, - host, - cdb, + runner: args.runner, + host_rustcflags: args.host_rustcflags, + target_rustcflags: args.target_rustcflags, + optimize_tests: args.optimize_tests, + rust_randomized_layout: args.rust_randomized_layout, + target: args.target, + host: args.host, + cdb: args.cdb, cdb_version, - gdb, + gdb: args.gdb, gdb_version, - lldb, + lldb: args.lldb, lldb_version, llvm_version, - system_llvm: matches.opt_present("system-llvm"), - android_cross_path, - adb_path, - adb_test_dir, + system_llvm: args.system_llvm, + android_cross_path: args.android_cross_path, + adb_path: args.adb_path, + adb_test_dir: args.adb_test_dir, adb_device_status, - verbose: matches.opt_present("verbose"), - verbose_run_make_subprocess_output: matches - .opt_present("verbose-run-make-subprocess-output"), - only_modified: matches.opt_present("only-modified"), - remote_test_client: matches.opt_str("remote-test-client").map(Utf8PathBuf::from), + verbose: args.verbose, + verbose_run_make_subprocess_output: args.verbose_run_make_subprocess_output, + only_modified: args.only_modified, + remote_test_client: args.remote_test_client, compare_mode, - rustfix_coverage: matches.opt_present("rustfix-coverage"), - has_enzyme, - has_offload, - channel: matches.opt_str("channel").unwrap(), - git_hash: matches.opt_present("git-hash"), - edition: matches.opt_str("edition").as_deref().map(parse_edition), - - cc: matches.opt_str("cc").unwrap(), - cxx: matches.opt_str("cxx").unwrap(), - cflags: matches.opt_str("cflags").unwrap(), - cxxflags: matches.opt_str("cxxflags").unwrap(), - ar: matches.opt_str("ar").unwrap_or_else(|| String::from("ar")), - target_linker: matches.opt_str("target-linker"), - host_linker: matches.opt_str("host-linker"), - llvm_components: matches.opt_str("llvm-components").unwrap(), - nodejs: matches.opt_str("nodejs").map(Utf8PathBuf::from), - - force_rerun: matches.opt_present("force-rerun"), + rustfix_coverage: args.rustfix_coverage, + has_enzyme: args.has_enzyme, + has_offload: args.has_offload, + channel: args.channel, + git_hash: args.git_hash, + edition: args.edition.as_deref().map(parse_edition), + + cc: args.cc, + cxx: args.cxx, + cflags: args.cflags, + cxxflags: args.cxxflags, + ar: args.ar, + target_linker: args.target_linker, + host_linker: args.host_linker, + llvm_components: args.llvm_components, + nodejs: args.nodejs, + + force_rerun: args.force_rerun, target_cfgs: OnceLock::new(), builtin_cfg_names: OnceLock::new(), supported_crate_types: OnceLock::new(), - capture: !matches.opt_present("no-capture"), + capture: !args.no_capture, - nightly_branch: matches.opt_str("nightly-branch").unwrap(), - git_merge_commit_email: matches.opt_str("git-merge-commit-email").unwrap(), + nightly_branch: args.nightly_branch, + git_merge_commit_email: args.git_merge_commit_email, - profiler_runtime: matches.opt_present("profiler-runtime"), + profiler_runtime: args.profiler_runtime, - diff_command: matches.opt_str("compiletest-diff-tool"), + diff_command: args.compiletest_diff_tool, - minicore_path: opt_path(matches, "minicore-path"), + minicore_path: args.minicore_path, default_codegen_backend, - override_codegen_backend, - bypass_ignore_backends: matches.opt_present("bypass-ignore-backends"), + override_codegen_backend: args.override_codegen_backend, + bypass_ignore_backends: args.bypass_ignore_backends, - jobs, + jobs: args.jobs, parallel_frontend_threads, iteration_count, From 838cf60b3141699d56ea4c486ff33b956937eda4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sun, 12 Jul 2026 22:01:27 +0200 Subject: [PATCH 04/38] Clean up compiletest's command-line interface --- src/tools/compiletest/src/common.rs | 9 +-- src/tools/compiletest/src/diagnostics.rs | 4 +- src/tools/compiletest/src/directives.rs | 14 ++--- src/tools/compiletest/src/edition.rs | 26 ++++++--- src/tools/compiletest/src/lib.rs | 74 +++++++++--------------- 5 files changed, 57 insertions(+), 70 deletions(-) diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 1cf9c94a11721..755f6d1446366 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -2,6 +2,7 @@ use std::borrow::Cow; use std::collections::{BTreeSet, HashMap, HashSet}; use std::iter; use std::process::Command; +use std::str::FromStr; use std::sync::OnceLock; use build_helper::git::GitConfig; @@ -227,15 +228,15 @@ pub(crate) enum CodegenBackend { Llvm, } -impl<'a> TryFrom<&'a str> for CodegenBackend { - type Error = &'static str; +impl FromStr for CodegenBackend { + type Err = &'static str; - fn try_from(value: &'a str) -> Result { + fn from_str(value: &str) -> Result { match value.to_lowercase().as_str() { "cranelift" => Ok(Self::Cranelift), "gcc" => Ok(Self::Gcc), "llvm" => Ok(Self::Llvm), - _ => Err("unknown backend"), + _ => Err("unknown codegen backend"), } } } diff --git a/src/tools/compiletest/src/diagnostics.rs b/src/tools/compiletest/src/diagnostics.rs index 207a6cb91d7ca..a7598370c2b9b 100644 --- a/src/tools/compiletest/src/diagnostics.rs +++ b/src/tools/compiletest/src/diagnostics.rs @@ -2,7 +2,7 @@ #[macro_export] macro_rules! fatal { - ($($arg:tt)*) => { + ($($arg:tt)*) => {{ let status = ::colored::Colorize::bright_red("FATAL: "); let status = ::colored::Colorize::bold(status); eprint!("{status}"); @@ -12,7 +12,7 @@ macro_rules! fatal { // FIXME: in the long term, we should handle "logic bug in compiletest itself" vs "fatal // user error" separately. panic!("fatal error"); - }; + }}; } #[macro_export] diff --git a/src/tools/compiletest/src/directives.rs b/src/tools/compiletest/src/directives.rs index 49b860d9cd4cf..b0d8c8266ff4e 100644 --- a/src/tools/compiletest/src/directives.rs +++ b/src/tools/compiletest/src/directives.rs @@ -6,7 +6,7 @@ use camino::{Utf8Path, Utf8PathBuf}; use semver::Version; use tracing::*; -use crate::common::{CodegenBackend, Config, Debugger, PassFailMode, TestMode}; +use crate::common::{Config, Debugger, PassFailMode, TestMode}; use crate::debuggers::{extract_cdb_version, extract_gdb_version}; use crate::directives::auxiliary::parse_and_update_aux; pub(crate) use crate::directives::auxiliary::{AuxCrate, AuxProps}; @@ -1069,12 +1069,10 @@ fn ignore_lldb(config: &Config, line: &DirectiveLine<'_>) -> IgnoreDecision { fn ignore_backends(config: &Config, line: &DirectiveLine<'_>) -> IgnoreDecision { let path = line.file_path; if let Some(backends_to_ignore) = config.parse_name_value_directive(line, "ignore-backends") { - for backend in backends_to_ignore.split_whitespace().map(|backend| { - match CodegenBackend::try_from(backend) { - Ok(backend) => backend, - Err(error) => { - panic!("Invalid ignore-backends value `{backend}` in `{path}`: {error}") - } + for backend in backends_to_ignore.split_whitespace().map(|backend| match backend.parse() { + Ok(backend) => backend, + Err(error) => { + panic!("Invalid ignore-backends value `{backend}` in `{path}`: {error}") } }) { if !config.bypass_ignore_backends && config.default_codegen_backend == backend { @@ -1092,7 +1090,7 @@ fn needs_backends(config: &Config, line: &DirectiveLine<'_>) -> IgnoreDecision { if let Some(needed_backends) = config.parse_name_value_directive(line, "needs-backends") { if !needed_backends .split_whitespace() - .map(|backend| match CodegenBackend::try_from(backend) { + .map(|backend| match backend.parse() { Ok(backend) => backend, Err(error) => { panic!("Invalid needs-backends value `{backend}` in `{path}`: {error}") diff --git a/src/tools/compiletest/src/edition.rs b/src/tools/compiletest/src/edition.rs index 2f5b92ee29a65..95999420daa0b 100644 --- a/src/tools/compiletest/src/edition.rs +++ b/src/tools/compiletest/src/edition.rs @@ -1,3 +1,5 @@ +use std::str::FromStr; + use crate::fatal; #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] @@ -23,13 +25,21 @@ impl From for Edition { } } -pub(crate) fn parse_edition(mut input: &str) -> Edition { - input = input.trim(); - if input == "future" { - Edition::Future - } else { - Edition::Year(input.parse().unwrap_or_else(|_| { - fatal!("`{input}` doesn't look like an edition"); - })) +impl FromStr for Edition { + type Err = String; + + fn from_str(input: &str) -> Result { + let input = input.trim(); + if input == "future" { + Ok(Edition::Future) + } else { + let year: u32 = + input.parse().map_err(|v| format!("{input} is not a valid edition year: {v}"))?; + Ok(Edition::Year(year)) + } } } + +pub(crate) fn parse_edition(input: &str) -> Edition { + input.parse().unwrap_or_else(|_| fatal!("`{input}` doesn't look like an edition")) +} diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index fe74afa29dd29..6665edb04cc99 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -40,17 +40,17 @@ use walkdir::WalkDir; use self::directives::{EarlyProps, make_test_description}; use crate::common::{ - CodegenBackend, CompareMode, Config, Debugger, ForcePassMode, TestMode, TestPaths, + CodegenBackend, CompareMode, Config, Debugger, ForcePassMode, TestMode, TestPaths, TestSuite, UI_EXTENSIONS, expected_output_path, output_base_dir, output_relative_path, }; use crate::directives::{AuxProps, DirectivesCache, FileDirectives}; -use crate::edition::parse_edition; +use crate::edition::Edition; use crate::executor::CollectedTest; /// Compiletest command-line arguments. #[derive(clap::Parser)] struct Args { - // Required paths + // Required options /// Path to host shared libraries. #[arg(long)] compile_lib_path: Utf8PathBuf, @@ -86,10 +86,10 @@ struct Args { stage_id: String, /// Which sort of compile tests to run. #[arg(long)] - mode: String, + mode: TestMode, /// Which suite of compile tests to run. #[arg(long)] - suite: String, + suite: TestSuite, /// Path to a C compiler. #[arg(long)] cc: String, @@ -97,10 +97,10 @@ struct Args { #[arg(long)] cxx: String, /// Flags for the C compiler. - #[arg(long)] + #[arg(long, allow_hyphen_values = true)] cflags: String, /// Flags for the CXX compiler. - #[arg(long)] + #[arg(long, allow_hyphen_values = true)] cxxflags: String, /// List of LLVM components built in. #[arg(long)] @@ -120,8 +120,6 @@ struct Args { /// Number of parallel jobs bootstrap was configured with. #[arg(long)] jobs: u32, - - // Required-by-convention /// The host to build for. #[arg(long)] host: String, @@ -129,7 +127,7 @@ struct Args { #[arg(long)] target: String, - // Optional paths + // Optional options /// Path to cargo to use for compiling. #[arg(long)] cargo_path: Option, @@ -202,11 +200,9 @@ struct Args { /// Path to a linker for the host. #[arg(long)] host_linker: Option, - - // Optional string values /// Force {check,build,run}-pass tests to this mode. #[arg(long)] - pass: Option, + pass: Option, /// Whether to execute run-* tests. #[arg(long)] run: Option, @@ -215,23 +211,23 @@ struct Args { runner: Option, /// Mode describing what file the actual ui output will be compared to. #[arg(long)] - compare_mode: Option, + compare_mode: Option, /// Default Rust edition. #[arg(long)] - edition: Option, + edition: Option, /// Only test a specific debugger in debuginfo tests. #[arg(long)] debugger: Option, /// The codegen backend currently used. #[arg(long)] - default_codegen_backend: Option, + default_codegen_backend: Option, /// The codegen backend to use instead of the default one. #[arg(long)] override_codegen_backend: Option, /// Custom diff tool to use for displaying compiletest tests. #[arg(long)] compiletest_diff_tool: Option, - /// Number of parallel threads for the frontend. + /// Number of parallel threads to use for the frontend when building test artifacts #[arg(long)] parallel_frontend_threads: Option, /// Number of times to execute each test. @@ -287,6 +283,7 @@ struct Args { /// Only run tests that result been modified. #[arg(long)] only_modified: bool, + // Backcompat option #[arg(long, hide = true)] nocapture: bool, /// Don't capture stdout/stderr of tests. @@ -305,19 +302,20 @@ struct Args { #[arg(long)] bypass_ignore_backends: bool, - // Multi-value + // Multi-value, these options can be entered multiple files /// Skip tests matching SUBSTRING. #[arg(long)] skip: Vec, /// Flags to pass to rustc for host. - #[arg(long)] + #[arg(long, allow_hyphen_values = true)] host_rustcflags: Vec, /// Flags to pass to rustc for target. - #[arg(long)] + #[arg(long, allow_hyphen_values = true)] target_rustcflags: Vec, - // Positional (filters) + // Positional arguments /// Test name filters. + /// All leftover arguments will be stored in this list. filters: Vec, } @@ -352,18 +350,9 @@ fn parse_config(args: Vec) -> Config { directives::extract_llvm_version_from_binary(args.llvm_filecheck.as_ref()?.as_str()) }); - let default_codegen_backend = match args.default_codegen_backend.as_deref() { - Some(backend) => match CodegenBackend::try_from(backend) { - Ok(backend) => backend, - Err(error) => { - panic!("invalid value `{backend}` for `--default-codegen-backend`: {error}") - } - }, - // By default, it's always llvm. - None => CodegenBackend::Llvm, - }; + let default_codegen_backend = args.default_codegen_backend.unwrap_or(CodegenBackend::Llvm); - let mode: TestMode = args.mode.parse().expect("invalid mode"); + let mode = args.mode; let filters = if mode == TestMode::RunMake { args.filters .iter() @@ -395,15 +384,7 @@ fn parse_config(args: Vec) -> Config { args.filters.clone() }; - let compare_mode = args.compare_mode.as_deref().map(|s| { - s.parse().unwrap_or_else(|_| { - let variants: Vec<_> = CompareMode::STR_VARIANTS.iter().copied().collect(); - panic!( - "`{s}` is not a valid value for `--compare-mode`, it should be one of: {}", - variants.join(", ") - ); - }) - }); + let compare_mode = args.compare_mode; let src_root = args.src_root; let src_test_suite_root = args.src_test_suite_root; @@ -454,7 +435,7 @@ fn parse_config(args: Vec) -> Config { stage_id: args.stage_id, mode, - suite: args.suite.parse().expect("invalid suite"), + suite: args.suite, debugger: args.debugger.map(|debugger| { debugger .parse::() @@ -467,10 +448,7 @@ fn parse_config(args: Vec) -> Config { filters, skip: args.skip, filter_exact: args.exact, - force_pass_mode: args.pass.map(|mode| { - mode.parse::() - .unwrap_or_else(|_| panic!("unknown `--pass` option `{}` given", mode)) - }), + force_pass_mode: args.pass, // FIXME: this run scheme is... confusing. run: args.run.and_then(|mode| match mode.as_str() { "auto" => None, @@ -507,7 +485,7 @@ fn parse_config(args: Vec) -> Config { has_offload: args.has_offload, channel: args.channel, git_hash: args.git_hash, - edition: args.edition.as_deref().map(parse_edition), + edition: args.edition, cc: args.cc, cxx: args.cxx, @@ -810,7 +788,7 @@ fn collect_tests_from_dir( && let Some(("assembly" | "codegen", backend)) = last.split_once('-') && let Some(Utf8Component::Normal(parent)) = components.next() && parent == "tests" - && let Ok(backend) = CodegenBackend::try_from(backend) + && let Ok(backend) = backend.parse::() && backend != cx.config.default_codegen_backend { // We ignore asm tests which don't match the current codegen backend. From bc709e811be6e6a22779f908440631a13efd2e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sun, 12 Jul 2026 22:07:11 +0200 Subject: [PATCH 05/38] Reduce dependency count of clap --- src/tools/compiletest/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index b2f931cb129f0..000dca8abfca5 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -18,7 +18,7 @@ test = false anstyle-svg = "0.1.11" build_helper = { path = "../../build_helper" } camino = "1" -clap = { version = "4", features = ["derive"] } +clap = { version = "4", features = ["derive", "help", "std"], default-features = false } colored = "3" diff = "0.1.10" glob = "0.3.0" From cfa34fab415526c8b86b9f69223a90c97f6ab838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Tue, 14 Jul 2026 09:01:45 +0200 Subject: [PATCH 06/38] Clarify multi-value comment --- src/tools/compiletest/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index 6665edb04cc99..47ce174744e9f 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -302,7 +302,8 @@ struct Args { #[arg(long)] bypass_ignore_backends: bool, - // Multi-value, these options can be entered multiple files + // These values can be entered multiple times, for example: + // --skip foo --skip bar /// Skip tests matching SUBSTRING. #[arg(long)] skip: Vec, From 394d96960f2e21720a6c4ba695677f1dc467e816 Mon Sep 17 00:00:00 2001 From: Xuyang Zhang Date: Tue, 14 Jul 2026 15:50:21 +0800 Subject: [PATCH 07/38] tidy: handle large numeric sort keys --- src/tools/tidy/src/alphabetical.rs | 19 ++++++++++++------- src/tools/tidy/src/alphabetical/tests.rs | 12 ++++++++++++ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/tools/tidy/src/alphabetical.rs b/src/tools/tidy/src/alphabetical.rs index e3b5437bbc04c..e04569ae6f2ce 100644 --- a/src/tools/tidy/src/alphabetical.rs +++ b/src/tools/tidy/src/alphabetical.rs @@ -285,7 +285,7 @@ fn consume_numeric_prefix>(it: &mut Peekable) -> Str let mut result = String::new(); while let Some(&c) = it.peek() { - if !c.is_numeric() { + if !c.is_ascii_digit() { break; } @@ -296,23 +296,28 @@ fn consume_numeric_prefix>(it: &mut Peekable) -> Str result } -// A sorting function that is case-sensitive, and sorts sequences of digits by their numeric value, -// so that `9` sorts before `12`. +// A sorting function that is case-sensitive, and sorts sequences of ASCII digits by their numeric +// value, so that `9` sorts before `12`. fn version_sort(a: &str, b: &str) -> Ordering { let mut it1 = a.chars().peekable(); let mut it2 = b.chars().peekable(); while let (Some(x), Some(y)) = (it1.peek(), it2.peek()) { - match (x.is_numeric(), y.is_numeric()) { + match (x.is_ascii_digit(), y.is_ascii_digit()) { (true, true) => { let num1: String = consume_numeric_prefix(it1.by_ref()); let num2: String = consume_numeric_prefix(it2.by_ref()); - let int1: u64 = num1.parse().unwrap(); - let int2: u64 = num2.parse().unwrap(); + let digits1 = num1.trim_start_matches('0'); + let digits2 = num2.trim_start_matches('0'); // Compare strings when the numeric value is equal to handle "00" versus "0". - match int1.cmp(&int2).then_with(|| num1.cmp(&num2)) { + match digits1 + .len() + .cmp(&digits2.len()) + .then_with(|| digits1.cmp(digits2)) + .then_with(|| num1.cmp(&num2)) + { Ordering::Equal => continue, different => return different, } diff --git a/src/tools/tidy/src/alphabetical/tests.rs b/src/tools/tidy/src/alphabetical/tests.rs index 96dad53fa359f..a7b8ea09c7694 100644 --- a/src/tools/tidy/src/alphabetical/tests.rs +++ b/src/tools/tidy/src/alphabetical/tests.rs @@ -330,6 +330,18 @@ fn test_numeric_good() { ); } +#[test] +fn test_large_numeric_values() { + good( + "\ + # tidy-alphabetical-start + item18446744073709551616 + item99999999999999999999 + # tidy-alphabetical-end + ", + ); +} + #[test] fn test_numeric_bad() { let lines = "\ From bc585ed04e3201960e900e51593b390cc9b38d66 Mon Sep 17 00:00:00 2001 From: reidliu Date: Wed, 15 Jul 2026 19:39:01 +0800 Subject: [PATCH 08/38] Fix the stale metrics directory warning --- compiler/rustc_driver_impl/src/lib.rs | 2 +- tests/run-make/dump-ice-to-disk/rmake.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index b4a6cd33a60f4..a3cb2fa80f63b 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -1423,7 +1423,7 @@ fn ice_path_with_config(config: Option<&UnstableOptions>) -> &'static Option Date: Wed, 15 Jul 2026 22:31:47 +0800 Subject: [PATCH 09/38] tidy: document numeric sort key limit --- src/tools/tidy/src/alphabetical.rs | 21 +++++++++------------ src/tools/tidy/src/alphabetical/tests.rs | 12 ------------ 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/src/tools/tidy/src/alphabetical.rs b/src/tools/tidy/src/alphabetical.rs index e04569ae6f2ce..d9714c85428ad 100644 --- a/src/tools/tidy/src/alphabetical.rs +++ b/src/tools/tidy/src/alphabetical.rs @@ -9,6 +9,8 @@ //! // tidy-alphabetical-end //! ``` //! +//! Numeric sequences are parsed as `u64` values, so each sequence must fit within `u64`. +//! //! Empty lines and lines starting (ignoring spaces) with `//` or `#` (except those starting with //! `#!`) are considered comments are are sorted together with the next line (but do not affect //! sorting). @@ -285,7 +287,7 @@ fn consume_numeric_prefix>(it: &mut Peekable) -> Str let mut result = String::new(); while let Some(&c) = it.peek() { - if !c.is_ascii_digit() { + if !c.is_numeric() { break; } @@ -296,28 +298,23 @@ fn consume_numeric_prefix>(it: &mut Peekable) -> Str result } -// A sorting function that is case-sensitive, and sorts sequences of ASCII digits by their numeric -// value, so that `9` sorts before `12`. +// A sorting function that is case-sensitive, and sorts sequences of digits by their numeric value, +// so that `9` sorts before `12`. fn version_sort(a: &str, b: &str) -> Ordering { let mut it1 = a.chars().peekable(); let mut it2 = b.chars().peekable(); while let (Some(x), Some(y)) = (it1.peek(), it2.peek()) { - match (x.is_ascii_digit(), y.is_ascii_digit()) { + match (x.is_numeric(), y.is_numeric()) { (true, true) => { let num1: String = consume_numeric_prefix(it1.by_ref()); let num2: String = consume_numeric_prefix(it2.by_ref()); - let digits1 = num1.trim_start_matches('0'); - let digits2 = num2.trim_start_matches('0'); + let int1: u64 = num1.parse().unwrap(); + let int2: u64 = num2.parse().unwrap(); // Compare strings when the numeric value is equal to handle "00" versus "0". - match digits1 - .len() - .cmp(&digits2.len()) - .then_with(|| digits1.cmp(digits2)) - .then_with(|| num1.cmp(&num2)) - { + match int1.cmp(&int2).then_with(|| num1.cmp(&num2)) { Ordering::Equal => continue, different => return different, } diff --git a/src/tools/tidy/src/alphabetical/tests.rs b/src/tools/tidy/src/alphabetical/tests.rs index a7b8ea09c7694..96dad53fa359f 100644 --- a/src/tools/tidy/src/alphabetical/tests.rs +++ b/src/tools/tidy/src/alphabetical/tests.rs @@ -330,18 +330,6 @@ fn test_numeric_good() { ); } -#[test] -fn test_large_numeric_values() { - good( - "\ - # tidy-alphabetical-start - item18446744073709551616 - item99999999999999999999 - # tidy-alphabetical-end - ", - ); -} - #[test] fn test_numeric_bad() { let lines = "\ From 526787dbbcf037718f6470b458a497447051409d Mon Sep 17 00:00:00 2001 From: Jose Torres Date: Fri, 3 Jul 2026 21:26:32 -0400 Subject: [PATCH 10/38] rename from lazy_type_alias to checked_type_aliases Co-authored-by: lcnr --- .../rustc_ast_passes/src/ast_validation.rs | 2 +- compiler/rustc_ast_passes/src/diagnostics.rs | 2 +- compiler/rustc_feature/src/removed.rs | 2 ++ compiler/rustc_feature/src/unstable.rs | 4 ++-- .../rustc_hir_analysis/src/check/check.rs | 2 +- .../rustc_hir_analysis/src/check/wfcheck.rs | 4 ++-- compiler/rustc_hir_analysis/src/collect.rs | 2 +- .../rustc_hir_analysis/src/collect/type_of.rs | 4 ++-- .../src/hir_ty_lowering/errors.rs | 2 +- .../src/hir_ty_lowering/mod.rs | 4 ++-- .../src/outlives/implicit_infer.rs | 2 +- .../rustc_hir_analysis/src/outlives/mod.rs | 2 +- compiler/rustc_lint/src/builtin.rs | 4 ++-- compiler/rustc_lint/src/lints.rs | 2 +- .../src/rmeta/decoder/cstore_impl.rs | 2 +- compiler/rustc_metadata/src/rmeta/encoder.rs | 6 ++--- compiler/rustc_metadata/src/rmeta/mod.rs | 2 +- compiler/rustc_middle/src/queries.rs | 8 +++---- .../src/solve/project_goals/free_alias.rs | 2 +- compiler/rustc_span/src/symbol.rs | 1 + .../src/traits/normalize.rs | 2 +- src/doc/rustc-dev-guide/src/normalization.md | 2 +- src/librustdoc/clean/mod.rs | 2 +- src/librustdoc/html/render/write_shared.rs | 2 +- tests/crashes/114198.rs | 2 +- tests/rustdoc-html/reexport/alias-reexport.rs | 2 +- .../rustdoc-html/reexport/alias-reexport2.rs | 4 ++-- .../reexport/auxiliary/alias-reexport.rs | 2 +- .../reexport/auxiliary/alias-reexport2.rs | 2 +- tests/rustdoc-html/sidebar/top-toc-html.rs | 2 +- tests/rustdoc-html/sidebar/top-toc-idmap.rs | 2 +- .../typedef-inner-variants-lazy_type_alias.rs | 2 +- tests/ui/README.md | 8 +++---- .../multiple-candidates-in-adt-field-3.rs | 2 +- .../type-alias-bounds.stderr | 2 +- .../associated-type-bounds/type-alias.stderr | 24 +++++++++---------- .../auto-trait-impls.rs | 2 +- .../auto-trait-impls.stderr | 0 .../auxiliary/eager.rs | 0 .../auxiliary/lazy.rs | 2 +- .../bad-lazy-type-alias.rs | 2 +- .../bad-lazy-type-alias.stderr | 0 .../coerce-behind-lazy.rs | 2 +- .../constrained-late-bound-regions.rs | 2 +- .../constrained-params-in-impl.rs | 2 +- .../deep-expansion.rs | 2 +- .../def-site-body-wf.rs | 2 +- .../def-site-body-wf.stderr | 0 .../def-site-param-defaults-wf.rs | 2 +- .../def-site-param-defaults-wf.stderr | 0 .../def-site-predicates-wf.rs | 2 +- .../def-site-predicates-wf.stderr | 0 .../enum-variant.rs | 2 +- .../extern-crate-has-eager-type-aliases.rs | 13 +++++----- ...has-lazy-type-aliases.locally_eager.stderr | 0 ...-has-lazy-type-aliases.locally_lazy.stderr | 0 .../extern-crate-has-lazy-type-aliases.rs | 4 ++-- .../implied-outlives-bounds.neg.stderr | 0 .../implied-outlives-bounds.rs | 2 +- .../inherent-impls-conflicting.rs | 2 +- .../inherent-impls-conflicting.stderr | 0 .../inherent-impls-not-nominal.rs | 2 +- .../inherent-impls-not-nominal.stderr | 0 .../inherent-impls-overflow.current.stderr | 0 .../inherent-impls-overflow.next.stderr | 0 .../inherent-impls-overflow.rs | 2 +- .../inherent-impls.rs | 2 +- .../leading-where-clause.fixed | 2 +- .../leading-where-clause.rs | 2 +- .../leading-where-clause.stderr | 0 .../opaq-ty-collection-infinite-recur.rs | 2 +- .../opaq-ty-collection-infinite-recur.stderr | 0 .../trailing-where-clause.rs | 2 +- .../trailing-where-clause.stderr | 0 .../type-alias-bounds-are-enforced.rs | 4 ++-- .../unconstrained-late-bound-regions.rs | 2 +- .../unconstrained-late-bound-regions.stderr | 0 ...strained-params-in-impl-due-to-overflow.rs | 2 +- ...ined-params-in-impl-due-to-overflow.stderr | 0 .../unconstrained-params-in-impl.rs | 2 +- .../unconstrained-params-in-impl.stderr | 0 ...-arguments-not-wfchecked.next-fixed.stderr | 0 .../unused-generic-arguments-not-wfchecked.rs | 8 +++---- .../unused-generic-parameters.fail.stderr | 0 .../unused-generic-parameters.rs | 8 +++---- .../use-site-wf.rs | 2 +- .../use-site-wf.stderr | 0 .../variance-0.rs | 4 ++-- .../variance-1.rs | 4 ++-- .../variance-1.stderr | 0 .../variance-overflow.rs | 2 +- .../variance-overflow.stderr | 0 .../orphan-check-weak-aliases-covering.rs | 2 +- .../orphan-check-weak-aliases-not-covering.rs | 2 +- .../alias_const_param_ty-1.rs | 2 +- .../check_const_arg_type_in_free_alias.rs | 2 +- .../in-trait/alias-bounds-when-not-wf.rs | 2 +- .../infinite-type-alias-mutual-recursion.rs | 2 +- .../infinite/infinite-vec-type-recursion.rs | 2 +- .../impl-debug-for-alias-type.rs | 2 +- .../ui/privacy/private-in-public-warn.stderr | 4 ++-- .../privacy/reach-type-alias-issue-156778.rs | 2 +- .../next-solver/issue-118950-root-region.rs | 2 +- .../dont-ice-on-normalization-failure.rs | 2 +- ...rmalize-self-type-constrains-trait-args.rs | 4 ++-- .../coherence-alias-hang-with-region.rs | 2 +- .../overflow/coherence-alias-hang.rs | 2 +- .../type-alias-normalization.rs | 2 +- .../trivial-bounds-inconsistent.stderr | 2 +- .../recursive-lazy-type-alias-ice-152633.rs | 2 +- .../unresolved-assoc-ty-suggest-trait.rs | 2 +- ...0-type-alias-bound-diagnostic-crash.stderr | 2 +- tests/ui/type/type-alias-bounds.stderr | 18 +++++++------- .../where-clauses/cfg-attr-issue-138010-2.rs | 2 +- .../where-clause-placement-type-alias.stderr | 4 ++-- 115 files changed, 144 insertions(+), 140 deletions(-) rename tests/ui/{lazy-type-alias => checked-type-alias}/auto-trait-impls.rs (96%) rename tests/ui/{lazy-type-alias => checked-type-alias}/auto-trait-impls.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/auxiliary/eager.rs (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/auxiliary/lazy.rs (52%) rename tests/ui/{lazy-type-alias => checked-type-alias}/bad-lazy-type-alias.rs (89%) rename tests/ui/{lazy-type-alias => checked-type-alias}/bad-lazy-type-alias.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/coerce-behind-lazy.rs (87%) rename tests/ui/{lazy-type-alias => checked-type-alias}/constrained-late-bound-regions.rs (91%) rename tests/ui/{lazy-type-alias => checked-type-alias}/constrained-params-in-impl.rs (92%) rename tests/ui/{lazy-type-alias => checked-type-alias}/deep-expansion.rs (94%) rename tests/ui/{lazy-type-alias => checked-type-alias}/def-site-body-wf.rs (95%) rename tests/ui/{lazy-type-alias => checked-type-alias}/def-site-body-wf.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/def-site-param-defaults-wf.rs (91%) rename tests/ui/{lazy-type-alias => checked-type-alias}/def-site-param-defaults-wf.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/def-site-predicates-wf.rs (91%) rename tests/ui/{lazy-type-alias => checked-type-alias}/def-site-predicates-wf.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/enum-variant.rs (87%) rename tests/ui/{lazy-type-alias => checked-type-alias}/extern-crate-has-eager-type-aliases.rs (57%) rename tests/ui/{lazy-type-alias => checked-type-alias}/extern-crate-has-lazy-type-aliases.locally_eager.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/extern-crate-has-lazy-type-aliases.locally_lazy.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/extern-crate-has-lazy-type-aliases.rs (80%) rename tests/ui/{lazy-type-alias => checked-type-alias}/implied-outlives-bounds.neg.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/implied-outlives-bounds.rs (96%) rename tests/ui/{lazy-type-alias => checked-type-alias}/inherent-impls-conflicting.rs (84%) rename tests/ui/{lazy-type-alias => checked-type-alias}/inherent-impls-conflicting.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/inherent-impls-not-nominal.rs (87%) rename tests/ui/{lazy-type-alias => checked-type-alias}/inherent-impls-not-nominal.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/inherent-impls-overflow.current.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/inherent-impls-overflow.next.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/inherent-impls-overflow.rs (97%) rename tests/ui/{lazy-type-alias => checked-type-alias}/inherent-impls.rs (87%) rename tests/ui/{lazy-type-alias => checked-type-alias}/leading-where-clause.fixed (93%) rename tests/ui/{lazy-type-alias => checked-type-alias}/leading-where-clause.rs (95%) rename tests/ui/{lazy-type-alias => checked-type-alias}/leading-where-clause.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/opaq-ty-collection-infinite-recur.rs (96%) rename tests/ui/{lazy-type-alias => checked-type-alias}/opaq-ty-collection-infinite-recur.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/trailing-where-clause.rs (89%) rename tests/ui/{lazy-type-alias => checked-type-alias}/trailing-where-clause.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/type-alias-bounds-are-enforced.rs (69%) rename tests/ui/{lazy-type-alias => checked-type-alias}/unconstrained-late-bound-regions.rs (95%) rename tests/ui/{lazy-type-alias => checked-type-alias}/unconstrained-late-bound-regions.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/unconstrained-params-in-impl-due-to-overflow.rs (82%) rename tests/ui/{lazy-type-alias => checked-type-alias}/unconstrained-params-in-impl-due-to-overflow.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/unconstrained-params-in-impl.rs (89%) rename tests/ui/{lazy-type-alias => checked-type-alias}/unconstrained-params-in-impl.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/unused-generic-arguments-not-wfchecked.next-fixed.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/unused-generic-arguments-not-wfchecked.rs (77%) rename tests/ui/{lazy-type-alias => checked-type-alias}/unused-generic-parameters.fail.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/unused-generic-parameters.rs (80%) rename tests/ui/{lazy-type-alias => checked-type-alias}/use-site-wf.rs (92%) rename tests/ui/{lazy-type-alias => checked-type-alias}/use-site-wf.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/variance-0.rs (93%) rename tests/ui/{lazy-type-alias => checked-type-alias}/variance-1.rs (92%) rename tests/ui/{lazy-type-alias => checked-type-alias}/variance-1.stderr (100%) rename tests/ui/{lazy-type-alias => checked-type-alias}/variance-overflow.rs (96%) rename tests/ui/{lazy-type-alias => checked-type-alias}/variance-overflow.stderr (100%) diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index 8b776edad4d6e..2b5e49794244d 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -1595,7 +1595,7 @@ impl Visitor<'_> for AstValidator<'_> { } self.check_type_no_bounds(bounds, "this context"); - if self.features.lazy_type_alias() { + if self.features.checked_type_aliases() { if let Err(err) = self.check_type_alias_where_clause_location(ty_alias) { self.dcx().emit_err(err); } diff --git a/compiler/rustc_ast_passes/src/diagnostics.rs b/compiler/rustc_ast_passes/src/diagnostics.rs index affe69bd7c5e8..0cf7ef5c1de19 100644 --- a/compiler/rustc_ast_passes/src/diagnostics.rs +++ b/compiler/rustc_ast_passes/src/diagnostics.rs @@ -743,7 +743,7 @@ pub(crate) struct FieldlessUnion { pub(crate) struct WhereClauseAfterTypeAlias { #[primary_span] pub span: Span, - #[help("add `#![feature(lazy_type_alias)]` to the crate attributes to enable")] + #[help("add `#![feature(checked_type_aliases)]` to the crate attributes to enable")] pub help: bool, } diff --git a/compiler/rustc_feature/src/removed.rs b/compiler/rustc_feature/src/removed.rs index 5320f46c8c314..6191269b24857 100644 --- a/compiler/rustc_feature/src/removed.rs +++ b/compiler/rustc_feature/src/removed.rs @@ -179,6 +179,8 @@ declare_features! ( (removed, issue_5723_bootstrap, "1.95.0", None, None), /// Lazily evaluate constants. This allows constants to depend on type parameters. (removed, lazy_normalization_consts, "1.56.0", Some(72219), Some("superseded by `generic_const_exprs`"), 88369), + /// Allow to have type alias types for inter-crate use. + (removed, lazy_type_alias, "1.72.0", Some(112792), Some("renamed to `checked_type_aliases`"), 158758), /// Changes `impl Trait` to capture all lifetimes in scope. (removed, lifetime_capture_rules_2024, "1.87.0", None, Some("unnecessary -- use edition 2024 instead"), 136787), /// Allows using the `#[link_args]` attribute. diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 056ea889afe7b..6c74612fe50e3 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -456,6 +456,8 @@ declare_features! ( (unstable, cfg_version, "1.45.0", Some(64796)), /// Allows to use the `#[cfi_encoding = ""]` attribute. (unstable, cfi_encoding, "1.71.0", Some(89653)), + /// Allow to have type alias types for inter-crate use. + (incomplete, checked_type_aliases, "CURRENT_RUSTC_VERSION", Some(112792)), /// The `clflushopt` target feature on x86. (unstable, clflushopt_target_feature, "1.98.0", Some(157096)), /// Allows `for<...>` on closures and coroutines. @@ -609,8 +611,6 @@ declare_features! ( (unstable, lahfsahf_target_feature, "1.78.0", Some(150251)), /// Allows setting the threshold for the `large_assignments` lint. (unstable, large_assignments, "1.52.0", Some(83518)), - /// Allow to have type alias types for inter-crate use. - (incomplete, lazy_type_alias, "1.72.0", Some(112792)), /// Allows using `#[link(kind = "link-arg", name = "...")]` /// to pass custom arguments to the linker. (unstable, link_arg_attribute, "1.76.0", Some(99427)), diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index 574a2ad6d47f4..626529cb6fc5b 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -976,7 +976,7 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), tcx.ensure_ok().predicates_of(def_id); let ty = tcx.type_of(def_id).instantiate_identity(); let span = tcx.def_span(def_id); - if tcx.type_alias_is_lazy(def_id) { + if tcx.type_alias_is_checked(def_id) { res = res.and(enter_wf_checking_ctxt(tcx, def_id, |wfcx| { let item_ty = wfcx.deeply_normalize(span, Some(WellFormedLoc::Ty(def_id)), ty); wfcx.register_wf_obligation( diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index c02db15d744de..77677d3f8d8a4 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -167,10 +167,10 @@ where let mut wfcx = WfCheckingCtxt { ocx, body_def_id, param_env }; - // As of now, bounds are only checked on lazy type aliases, they're ignored for most type + // As of now, bounds are only enforced on checked type aliases, they're ignored for most type // aliases. So, only check for false global bounds if we're not ignoring bounds altogether. let ignore_bounds = - tcx.def_kind(body_def_id) == DefKind::TyAlias && !tcx.type_alias_is_lazy(body_def_id); + tcx.def_kind(body_def_id) == DefKind::TyAlias && !tcx.type_alias_is_checked(body_def_id); if !ignore_bounds && !tcx.features().trivial_bounds() { wfcx.check_false_global_bounds() diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index 376fa8ee621f3..2c048c16baf13 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -63,7 +63,7 @@ pub(crate) fn provide(providers: &mut Providers) { type_of: type_of::type_of, type_of_opaque: type_of::type_of_opaque, type_of_opaque_hir_typeck: type_of::type_of_opaque_hir_typeck, - type_alias_is_lazy: type_of::type_alias_is_lazy, + type_alias_is_checked: type_of::type_alias_is_checked, item_bounds: item_bounds::item_bounds, explicit_item_bounds: item_bounds::explicit_item_bounds, item_self_bounds: item_bounds::item_self_bounds, diff --git a/compiler/rustc_hir_analysis/src/collect/type_of.rs b/compiler/rustc_hir_analysis/src/collect/type_of.rs index 59e1a2fc1aa43..68b7d50c2ee9b 100644 --- a/compiler/rustc_hir_analysis/src/collect/type_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/type_of.rs @@ -539,9 +539,9 @@ fn check_feature_inherent_assoc_ty(tcx: TyCtxt<'_>, span: Span) { } } -pub(crate) fn type_alias_is_lazy<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> bool { +pub(crate) fn type_alias_is_checked<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> bool { use hir::intravisit::Visitor; - if tcx.features().lazy_type_alias() { + if tcx.features().checked_type_aliases() { return true; } struct HasTait; diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs index 71858951731e6..460ef9d56dee5 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs @@ -281,7 +281,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { let identically_named = suggested_name == assoc_ident.name; if let DefKind::TyAlias = tcx.def_kind(item_def_id) - && !tcx.type_alias_is_lazy(item_def_id) + && !tcx.type_alias_is_checked(item_def_id) { err.sugg = Some(diagnostics::AssocItemNotFoundSugg::SimilarInOtherTraitQPath { diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs index 5778a0f932374..d5ed9012fcaf3 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs @@ -1214,10 +1214,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { let args = self.lower_generic_args_of_path_segment(span, def_id, item_segment); if let DefKind::TyAlias = tcx.def_kind(def_id) - && tcx.type_alias_is_lazy(def_id) + && tcx.type_alias_is_checked(def_id) { // Type aliases defined in crates that have the - // feature `lazy_type_alias` enabled get encoded as a type alias that normalization will + // feature `checked_type_alias` enabled get encoded as a type alias that normalization will // then actually instantiate the where bounds of. let alias_ty = ty::AliasTy::new_from_args(tcx, ty::Free { def_id }, args); Ty::new_alias(tcx, ty::IsRigid::No, alias_ty) diff --git a/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs b/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs index b2deea63dfd16..239a900afb4cf 100644 --- a/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs +++ b/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs @@ -56,7 +56,7 @@ pub(super) fn infer_predicates( } } - DefKind::TyAlias if tcx.type_alias_is_lazy(item_did) => { + DefKind::TyAlias if tcx.type_alias_is_checked(item_did) => { insert_required_predicates_to_be_wf( tcx, tcx.type_of(item_did).instantiate_identity().skip_norm_wip(), diff --git a/compiler/rustc_hir_analysis/src/outlives/mod.rs b/compiler/rustc_hir_analysis/src/outlives/mod.rs index d155f4f98ad79..6cec89afde2fa 100644 --- a/compiler/rustc_hir_analysis/src/outlives/mod.rs +++ b/compiler/rustc_hir_analysis/src/outlives/mod.rs @@ -17,7 +17,7 @@ pub(super) fn inferred_outlives_of( let crate_map = tcx.inferred_outlives_crate(()); crate_map.predicates.get(&item_def_id.to_def_id()).copied().unwrap_or(&[]) } - DefKind::TyAlias if tcx.type_alias_is_lazy(item_def_id) => { + DefKind::TyAlias if tcx.type_alias_is_checked(item_def_id) => { let crate_map = tcx.inferred_outlives_crate(()); crate_map.predicates.get(&item_def_id.to_def_id()).copied().unwrap_or(&[]) } diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index ea0f8f22ab187..e21e306723d3e 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -1317,8 +1317,8 @@ impl<'tcx> LateLintPass<'tcx> for TypeAliasBounds { return; } - // Bounds of lazy type aliases and TAITs are respected. - if cx.tcx.type_alias_is_lazy(item.owner_id) { + // Bounds of checked type aliases and TAITs are respected. + if cx.tcx.type_alias_is_checked(item.owner_id) { return; } diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index a9d67ff4a1d4e..7ea5635034a27 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -319,7 +319,7 @@ impl<'a> Diagnostic<'a, ()> for BuiltinTypeAliasBounds<'_> { see issue #112792 for more information" )); if self.enable_feat_help { - diag.help(msg!("add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics")); + diag.help(msg!("add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics")); } // We perform the walk in here instead of in `` to diff --git a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs index 798709d69d76e..a8c95ed943b9e 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs @@ -228,7 +228,7 @@ provide! { tcx, def_id, other, cdata, explicit_super_predicates_of => { table_defaulted_array } explicit_implied_predicates_of => { table_defaulted_array } type_of => { table } - type_alias_is_lazy => { table_direct } + type_alias_is_checked => { table_direct } variances_of => { table } fn_sig => { table } codegen_fn_attrs => { table } diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index cd5e343e08d1a..c1c16bf2dcd19 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -1579,9 +1579,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { } if let DefKind::TyAlias = def_kind { self.tables - .type_alias_is_lazy - .set(def_id.index, self.tcx.type_alias_is_lazy(def_id)); - if self.tcx.type_alias_is_lazy(def_id) { + .type_alias_is_checked + .set(def_id.index, self.tcx.type_alias_is_checked(def_id)); + if self.tcx.type_alias_is_checked(def_id) { record!(self.tables.args_known_to_outlive_alias_params[def_id] <- tcx.args_known_to_outlive_alias_params(def_id)); } } diff --git a/compiler/rustc_metadata/src/rmeta/mod.rs b/compiler/rustc_metadata/src/rmeta/mod.rs index cccd613aa8ac1..05d8c8e9077e3 100644 --- a/compiler/rustc_metadata/src/rmeta/mod.rs +++ b/compiler/rustc_metadata/src/rmeta/mod.rs @@ -385,7 +385,7 @@ define_tables! { - defaulted: intrinsic: Table>>, is_macro_rules: Table, - type_alias_is_lazy: Table, + type_alias_is_checked: Table, attr_flags: Table, // The u64 is the crate-local part of the DefPathHash. All hashes in this crate have the same // StableCrateId, so we omit encoding those into the table. diff --git a/compiler/rustc_middle/src/queries.rs b/compiler/rustc_middle/src/queries.rs index 05eb8727bafbd..41f267efb1d96 100644 --- a/compiler/rustc_middle/src/queries.rs +++ b/compiler/rustc_middle/src/queries.rs @@ -332,12 +332,12 @@ rustc_queries! { } } - /// Returns whether the type alias given by `DefId` is lazy. + /// Returns whether the type alias given by `DefId` is checked. /// /// I.e., if the type alias expands / ought to expand to a [free] [alias type] /// instead of the underlying aliased type. /// - /// Relevant for features `lazy_type_alias` and `type_alias_impl_trait`. + /// Relevant for features `checked_type_aliases` and `type_alias_impl_trait`. /// /// # Panics /// @@ -345,9 +345,9 @@ rustc_queries! { /// /// [free]: rustc_middle::ty::Free /// [alias type]: rustc_middle::ty::AliasTy - query type_alias_is_lazy(key: DefId) -> bool { + query type_alias_is_checked(key: DefId) -> bool { desc { - "computing whether the type alias `{path}` is lazy", + "computing whether the type alias `{path}` is checked", path = tcx.def_path_str(key), } separate_provide_extern diff --git a/compiler/rustc_next_trait_solver/src/solve/project_goals/free_alias.rs b/compiler/rustc_next_trait_solver/src/solve/project_goals/free_alias.rs index f96b794a64e31..c1867a224ac84 100644 --- a/compiler/rustc_next_trait_solver/src/solve/project_goals/free_alias.rs +++ b/compiler/rustc_next_trait_solver/src/solve/project_goals/free_alias.rs @@ -1,5 +1,5 @@ //! Computes a projection goal for inherent associated types, -//! `#![feature(lazy_type_alias)]` and `#![feature(type_alias_impl_trait)]`. +//! `#![feature(checked_type_aliases)]` and `#![feature(type_alias_impl_trait)]`. //! //! Since a free alias is never ambiguous, this just computes the `type_of` of //! the alias and registers the where-clauses of the type alias. diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 3b44015b4f452..8b30f63231ac1 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -608,6 +608,7 @@ symbols! { cfi, cfi_encoding, char, + checked_type_aliases, clflushopt_target_feature, client, clippy, diff --git a/compiler/rustc_trait_selection/src/traits/normalize.rs b/compiler/rustc_trait_selection/src/traits/normalize.rs index 2a28fab776a12..f2653cb9902e8 100644 --- a/compiler/rustc_trait_selection/src/traits/normalize.rs +++ b/compiler/rustc_trait_selection/src/traits/normalize.rs @@ -315,7 +315,7 @@ impl<'a, 'b, 'tcx> AssocTypeNormalizer<'a, 'b, 'tcx> { // placeholders as the trait solver does not expect to encounter escaping bound // vars in obligations. // - // FIXME(lazy_type_alias): Check how much this actually matters for perf before + // FIXME(checked_type_alias): Check how much this actually matters for perf before // stabilization. This is a bit weird and generally not how we handle binders in // the compiler so ideally we'd do the same boundvar->placeholder->boundvar dance // that other kinds of normalization do. diff --git a/src/doc/rustc-dev-guide/src/normalization.md b/src/doc/rustc-dev-guide/src/normalization.md index 6e98ff8f4b8a3..0a79d98c5db04 100644 --- a/src/doc/rustc-dev-guide/src/normalization.md +++ b/src/doc/rustc-dev-guide/src/normalization.md @@ -189,7 +189,7 @@ Secondly, instead of having normalization directly return the type specified in We do this so that normalization is idempotent/callers do not need to run it in a loop. ```rust -#![feature(lazy_type_alias)] +#![feature(checked_type_alias)] type Foo = Bar; type Bar = ::Item; diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index c7387bf157d10..02ff95dc313ea 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2322,7 +2322,7 @@ pub(crate) fn clean_middle_ty<'tcx>( } ty::Alias(_, ty::AliasTy { kind: ty::Free { def_id }, args, .. }) => { - if cx.tcx.features().lazy_type_alias() { + if cx.tcx.features().checked_type_aliases() { // Free type alias `data` represents the `type X` in `type X = Y`. If we need `Y`, // we need to use `type_of`. let path = diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index ad8c6588e521f..ad3c41bdd2180 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -887,7 +887,7 @@ impl<'item> DocVisitor<'item> for TypeImplCollector<'_, '_, 'item> { // Only include this impl if it actually unifies with this alias. // Synthetic impls are not included; those are also included in the HTML. // - // FIXME(lazy_type_alias): Once the feature is complete or stable, rewrite this + // FIXME(checked_type_alias): Once the feature is complete or stable, rewrite this // to use type unification. // Be aware of `tests/rustdoc-html/type-alias/deeply-nested-112515.rs` which might // regress. diff --git a/tests/crashes/114198.rs b/tests/crashes/114198.rs index 0f479b3615fb0..867439906d1ac 100644 --- a/tests/crashes/114198.rs +++ b/tests/crashes/114198.rs @@ -1,7 +1,7 @@ //@ known-bug: #114198 //@ compile-flags: -Zprint-mono-items -Clink-dead-code -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] impl Trait for Struct {} trait Trait { diff --git a/tests/rustdoc-html/reexport/alias-reexport.rs b/tests/rustdoc-html/reexport/alias-reexport.rs index 41f1f8df0f692..00459f0cc4513 100644 --- a/tests/rustdoc-html/reexport/alias-reexport.rs +++ b/tests/rustdoc-html/reexport/alias-reexport.rs @@ -2,7 +2,7 @@ //@ aux-build:alias-reexport2.rs #![crate_name = "foo"] -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] extern crate alias_reexport2; diff --git a/tests/rustdoc-html/reexport/alias-reexport2.rs b/tests/rustdoc-html/reexport/alias-reexport2.rs index 2fb69b922c8b3..7eb5b2f093976 100644 --- a/tests/rustdoc-html/reexport/alias-reexport2.rs +++ b/tests/rustdoc-html/reexport/alias-reexport2.rs @@ -1,8 +1,8 @@ -// gate-test-lazy_type_alias +// gate-test-checked_type_aliases //@ aux-build:alias-reexport.rs #![crate_name = "foo"] -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] extern crate alias_reexport; diff --git a/tests/rustdoc-html/reexport/auxiliary/alias-reexport.rs b/tests/rustdoc-html/reexport/auxiliary/alias-reexport.rs index 14fafc02d3661..b565a18f0557e 100644 --- a/tests/rustdoc-html/reexport/auxiliary/alias-reexport.rs +++ b/tests/rustdoc-html/reexport/auxiliary/alias-reexport.rs @@ -1,3 +1,3 @@ -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] pub type Reexported = u8; diff --git a/tests/rustdoc-html/reexport/auxiliary/alias-reexport2.rs b/tests/rustdoc-html/reexport/auxiliary/alias-reexport2.rs index ee1f242c1d4ca..af1778c1d3e08 100644 --- a/tests/rustdoc-html/reexport/auxiliary/alias-reexport2.rs +++ b/tests/rustdoc-html/reexport/auxiliary/alias-reexport2.rs @@ -1,4 +1,4 @@ -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] extern crate alias_reexport; diff --git a/tests/rustdoc-html/sidebar/top-toc-html.rs b/tests/rustdoc-html/sidebar/top-toc-html.rs index 0f60396043475..d3433467c8e12 100644 --- a/tests/rustdoc-html/sidebar/top-toc-html.rs +++ b/tests/rustdoc-html/sidebar/top-toc-html.rs @@ -1,7 +1,7 @@ // ignore-tidy-linelength #![crate_name = "foo"] -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] //! # Basic [link](https://example.com), *emphasis*, **_very emphasis_** and `code` diff --git a/tests/rustdoc-html/sidebar/top-toc-idmap.rs b/tests/rustdoc-html/sidebar/top-toc-idmap.rs index af07cb4179b1f..8eaa03a221a70 100644 --- a/tests/rustdoc-html/sidebar/top-toc-idmap.rs +++ b/tests/rustdoc-html/sidebar/top-toc-idmap.rs @@ -1,5 +1,5 @@ #![crate_name = "foo"] -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] //! # Structs diff --git a/tests/rustdoc-html/typedef-inner-variants-lazy_type_alias.rs b/tests/rustdoc-html/typedef-inner-variants-lazy_type_alias.rs index c6bfe495bb0cc..53203504fd225 100644 --- a/tests/rustdoc-html/typedef-inner-variants-lazy_type_alias.rs +++ b/tests/rustdoc-html/typedef-inner-variants-lazy_type_alias.rs @@ -1,6 +1,6 @@ #![crate_name = "inner_types_lazy"] -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] //@ has 'inner_types_lazy/struct.Pair.html' diff --git a/tests/ui/README.md b/tests/ui/README.md index 85a5e6e0cbe1c..b0100dc3ac6b2 100644 --- a/tests/ui/README.md +++ b/tests/ui/README.md @@ -216,6 +216,10 @@ Tests for the `--check-cfg` compiler mechanism for checking cfg configurations, See [Checking conditional configurations | The rustc book](https://doc.rust-lang.org/rustc/check-cfg.html). +## `tests/ui/checked-type-alias/` + +Tests for `#![feature(checked_type_aliases)]`. See [Tracking issue for checked type aliases](https://github.com/rust-lang/rust/issues/112792). + ## `tests/ui/closure-expected-type/`: Closure type inference Tests targeted at how we deduce the types of closure arguments. This process is a result of some heuristics which take into account the *expected type* we have alongside the *actual types* that we get from inputs. @@ -800,10 +804,6 @@ See [Early vs Late bound parameters | rustc-dev-guide](https://rustc-dev-guide.r See [Type Layout | Reference](https://doc.rust-lang.org/reference/type-layout.html). -## `tests/ui/lazy-type-alias/` - -Tests for `#![feature(lazy_type_alias)]`. See [Tracking issue for lazy type aliases #112792](https://github.com/rust-lang/rust/issues/112792). - ## `tests/ui/lazy-type-alias-impl-trait/` This feature allows use of an `impl Trait` in multiple locations while actually using the same concrete type (`type Alias = impl Trait;`) everywhere, keeping the original `impl Trait` hidden. diff --git a/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-3.rs b/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-3.rs index 4c5b382463d54..49ef0061631d6 100644 --- a/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-3.rs +++ b/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-3.rs @@ -1,6 +1,6 @@ //@ check-pass -#![feature(inherent_associated_types, lazy_type_alias)] +#![feature(inherent_associated_types, checked_type_aliases)] #![expect(incomplete_features)] // Test that we *do* normalize free aliases in order to resolve diff --git a/tests/ui/associated-inherent-types/type-alias-bounds.stderr b/tests/ui/associated-inherent-types/type-alias-bounds.stderr index 7a74f7bb18fc8..2173a2a2e3497 100644 --- a/tests/ui/associated-inherent-types/type-alias-bounds.stderr +++ b/tests/ui/associated-inherent-types/type-alias-bounds.stderr @@ -6,7 +6,7 @@ LL | pub type Alias = (Source::Assoc,); | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics = note: `#[warn(type_alias_bounds)]` on by default help: remove this bound | diff --git a/tests/ui/associated-type-bounds/type-alias.stderr b/tests/ui/associated-type-bounds/type-alias.stderr index 3e9b593a6b9e6..a274bca5b6ae5 100644 --- a/tests/ui/associated-type-bounds/type-alias.stderr +++ b/tests/ui/associated-type-bounds/type-alias.stderr @@ -6,7 +6,7 @@ LL | type _TaWhere1 where T: Iterator = T; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics = note: `#[warn(type_alias_bounds)]` on by default help: remove this where clause | @@ -22,7 +22,7 @@ LL | type _TaWhere2 where T: Iterator = T; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this where clause | LL - type _TaWhere2 where T: Iterator = T; @@ -37,7 +37,7 @@ LL | type _TaWhere3 where T: Iterator = T; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this where clause | LL - type _TaWhere3 where T: Iterator = T; @@ -52,7 +52,7 @@ LL | type _TaWhere4 where T: Iterator = T; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this where clause | LL - type _TaWhere4 where T: Iterator = T; @@ -67,7 +67,7 @@ LL | type _TaWhere5 where T: Iterator Into<&'a u8>> = T; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this where clause | LL - type _TaWhere5 where T: Iterator Into<&'a u8>> = T; @@ -82,7 +82,7 @@ LL | type _TaWhere6 where T: Iterator> = T; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this where clause | LL - type _TaWhere6 where T: Iterator> = T; @@ -97,7 +97,7 @@ LL | type _TaInline1> = T; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this bound | LL - type _TaInline1> = T; @@ -112,7 +112,7 @@ LL | type _TaInline2> = T; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this bound | LL - type _TaInline2> = T; @@ -127,7 +127,7 @@ LL | type _TaInline3> = T; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this bound | LL - type _TaInline3> = T; @@ -142,7 +142,7 @@ LL | type _TaInline4> = T; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this bound | LL - type _TaInline4> = T; @@ -157,7 +157,7 @@ LL | type _TaInline5 Into<&'a u8>>> = T; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this bound | LL - type _TaInline5 Into<&'a u8>>> = T; @@ -172,7 +172,7 @@ LL | type _TaInline6>> = T; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this bound | LL - type _TaInline6>> = T; diff --git a/tests/ui/lazy-type-alias/auto-trait-impls.rs b/tests/ui/checked-type-alias/auto-trait-impls.rs similarity index 96% rename from tests/ui/lazy-type-alias/auto-trait-impls.rs rename to tests/ui/checked-type-alias/auto-trait-impls.rs index e5d9c988f0d5f..978143ef7cf56 100644 --- a/tests/ui/lazy-type-alias/auto-trait-impls.rs +++ b/tests/ui/checked-type-alias/auto-trait-impls.rs @@ -5,7 +5,7 @@ //! //! Regression test for . -#![feature(lazy_type_alias, auto_traits, negative_impls)] +#![feature(checked_type_aliases, auto_traits, negative_impls)] #![allow(incomplete_features)] struct Local; diff --git a/tests/ui/lazy-type-alias/auto-trait-impls.stderr b/tests/ui/checked-type-alias/auto-trait-impls.stderr similarity index 100% rename from tests/ui/lazy-type-alias/auto-trait-impls.stderr rename to tests/ui/checked-type-alias/auto-trait-impls.stderr diff --git a/tests/ui/lazy-type-alias/auxiliary/eager.rs b/tests/ui/checked-type-alias/auxiliary/eager.rs similarity index 100% rename from tests/ui/lazy-type-alias/auxiliary/eager.rs rename to tests/ui/checked-type-alias/auxiliary/eager.rs diff --git a/tests/ui/lazy-type-alias/auxiliary/lazy.rs b/tests/ui/checked-type-alias/auxiliary/lazy.rs similarity index 52% rename from tests/ui/lazy-type-alias/auxiliary/lazy.rs rename to tests/ui/checked-type-alias/auxiliary/lazy.rs index 2b678226a8ac8..21d768ae0e53a 100644 --- a/tests/ui/lazy-type-alias/auxiliary/lazy.rs +++ b/tests/ui/checked-type-alias/auxiliary/lazy.rs @@ -1,3 +1,3 @@ -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] pub type Alias = Option; diff --git a/tests/ui/lazy-type-alias/bad-lazy-type-alias.rs b/tests/ui/checked-type-alias/bad-lazy-type-alias.rs similarity index 89% rename from tests/ui/lazy-type-alias/bad-lazy-type-alias.rs rename to tests/ui/checked-type-alias/bad-lazy-type-alias.rs index e9e7de84a7a46..2031a9a84d68f 100644 --- a/tests/ui/lazy-type-alias/bad-lazy-type-alias.rs +++ b/tests/ui/checked-type-alias/bad-lazy-type-alias.rs @@ -1,6 +1,6 @@ // regression test for #127351 -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] type ExplicitTypeOutlives = T; diff --git a/tests/ui/lazy-type-alias/bad-lazy-type-alias.stderr b/tests/ui/checked-type-alias/bad-lazy-type-alias.stderr similarity index 100% rename from tests/ui/lazy-type-alias/bad-lazy-type-alias.stderr rename to tests/ui/checked-type-alias/bad-lazy-type-alias.stderr diff --git a/tests/ui/lazy-type-alias/coerce-behind-lazy.rs b/tests/ui/checked-type-alias/coerce-behind-lazy.rs similarity index 87% rename from tests/ui/lazy-type-alias/coerce-behind-lazy.rs rename to tests/ui/checked-type-alias/coerce-behind-lazy.rs index a69e39b02b32f..80b92b980008e 100644 --- a/tests/ui/lazy-type-alias/coerce-behind-lazy.rs +++ b/tests/ui/checked-type-alias/coerce-behind-lazy.rs @@ -3,7 +3,7 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] use std::any::Any; diff --git a/tests/ui/lazy-type-alias/constrained-late-bound-regions.rs b/tests/ui/checked-type-alias/constrained-late-bound-regions.rs similarity index 91% rename from tests/ui/lazy-type-alias/constrained-late-bound-regions.rs rename to tests/ui/checked-type-alias/constrained-late-bound-regions.rs index e759e72d745a1..140cfbdc8c1c0 100644 --- a/tests/ui/lazy-type-alias/constrained-late-bound-regions.rs +++ b/tests/ui/checked-type-alias/constrained-late-bound-regions.rs @@ -1,7 +1,7 @@ //@ check-pass // Weak alias types constrain late-bound regions if their normalized form constrains them. -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] type Ref<'a> = &'a (); diff --git a/tests/ui/lazy-type-alias/constrained-params-in-impl.rs b/tests/ui/checked-type-alias/constrained-params-in-impl.rs similarity index 92% rename from tests/ui/lazy-type-alias/constrained-params-in-impl.rs rename to tests/ui/checked-type-alias/constrained-params-in-impl.rs index 59693dd5461e9..cd7a4a60fa46a 100644 --- a/tests/ui/lazy-type-alias/constrained-params-in-impl.rs +++ b/tests/ui/checked-type-alias/constrained-params-in-impl.rs @@ -1,6 +1,6 @@ //@ check-pass -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] type Injective = Local; diff --git a/tests/ui/lazy-type-alias/deep-expansion.rs b/tests/ui/checked-type-alias/deep-expansion.rs similarity index 94% rename from tests/ui/lazy-type-alias/deep-expansion.rs rename to tests/ui/checked-type-alias/deep-expansion.rs index c4461abdb8143..730edcbe1d566 100644 --- a/tests/ui/lazy-type-alias/deep-expansion.rs +++ b/tests/ui/checked-type-alias/deep-expansion.rs @@ -4,7 +4,7 @@ // // issue: //@ check-pass -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![expect(incomplete_features)] type T0 = (T1, T1, T1, T1); diff --git a/tests/ui/lazy-type-alias/def-site-body-wf.rs b/tests/ui/checked-type-alias/def-site-body-wf.rs similarity index 95% rename from tests/ui/lazy-type-alias/def-site-body-wf.rs rename to tests/ui/checked-type-alias/def-site-body-wf.rs index 9287cb461195a..853080e3564b3 100644 --- a/tests/ui/lazy-type-alias/def-site-body-wf.rs +++ b/tests/ui/checked-type-alias/def-site-body-wf.rs @@ -1,7 +1,7 @@ // Test that we check the body at the definition site for well-formedness. // Compare with `tests/ui/type-alias/lack-of-wfcheck.rs`. -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] // unsatisified trait bounds type _A = ::Output; //~ ERROR cannot multiply `T` by `T` diff --git a/tests/ui/lazy-type-alias/def-site-body-wf.stderr b/tests/ui/checked-type-alias/def-site-body-wf.stderr similarity index 100% rename from tests/ui/lazy-type-alias/def-site-body-wf.stderr rename to tests/ui/checked-type-alias/def-site-body-wf.stderr diff --git a/tests/ui/lazy-type-alias/def-site-param-defaults-wf.rs b/tests/ui/checked-type-alias/def-site-param-defaults-wf.rs similarity index 91% rename from tests/ui/lazy-type-alias/def-site-param-defaults-wf.rs rename to tests/ui/checked-type-alias/def-site-param-defaults-wf.rs index 7f417de5fd33d..7eb5c0f44ff84 100644 --- a/tests/ui/lazy-type-alias/def-site-param-defaults-wf.rs +++ b/tests/ui/checked-type-alias/def-site-param-defaults-wf.rs @@ -1,5 +1,5 @@ //! Ensure that we check generic parameter defaults for well-formedness at the definition site. -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] type Alias, const N: usize = { 0 - 1 }> = T; diff --git a/tests/ui/lazy-type-alias/def-site-param-defaults-wf.stderr b/tests/ui/checked-type-alias/def-site-param-defaults-wf.stderr similarity index 100% rename from tests/ui/lazy-type-alias/def-site-param-defaults-wf.stderr rename to tests/ui/checked-type-alias/def-site-param-defaults-wf.stderr diff --git a/tests/ui/lazy-type-alias/def-site-predicates-wf.rs b/tests/ui/checked-type-alias/def-site-predicates-wf.rs similarity index 91% rename from tests/ui/lazy-type-alias/def-site-predicates-wf.rs rename to tests/ui/checked-type-alias/def-site-predicates-wf.rs index 5d9235347cb82..2f1f939459856 100644 --- a/tests/ui/lazy-type-alias/def-site-predicates-wf.rs +++ b/tests/ui/checked-type-alias/def-site-predicates-wf.rs @@ -1,5 +1,5 @@ //! Ensure that we check the predicates at the definition site for well-formedness. -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] type Alias0 = () diff --git a/tests/ui/lazy-type-alias/def-site-predicates-wf.stderr b/tests/ui/checked-type-alias/def-site-predicates-wf.stderr similarity index 100% rename from tests/ui/lazy-type-alias/def-site-predicates-wf.stderr rename to tests/ui/checked-type-alias/def-site-predicates-wf.stderr diff --git a/tests/ui/lazy-type-alias/enum-variant.rs b/tests/ui/checked-type-alias/enum-variant.rs similarity index 87% rename from tests/ui/lazy-type-alias/enum-variant.rs rename to tests/ui/checked-type-alias/enum-variant.rs index 236e1933a8a93..6d4d0c0b70976 100644 --- a/tests/ui/lazy-type-alias/enum-variant.rs +++ b/tests/ui/checked-type-alias/enum-variant.rs @@ -1,7 +1,7 @@ // Regression test for issue #113736. //@ check-pass -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] enum Enum { Unit, diff --git a/tests/ui/lazy-type-alias/extern-crate-has-eager-type-aliases.rs b/tests/ui/checked-type-alias/extern-crate-has-eager-type-aliases.rs similarity index 57% rename from tests/ui/lazy-type-alias/extern-crate-has-eager-type-aliases.rs rename to tests/ui/checked-type-alias/extern-crate-has-eager-type-aliases.rs index 3384698776056..52e1736975f46 100644 --- a/tests/ui/lazy-type-alias/extern-crate-has-eager-type-aliases.rs +++ b/tests/ui/checked-type-alias/extern-crate-has-eager-type-aliases.rs @@ -1,18 +1,19 @@ // This test serves as a regression test for issue #114468 and it also ensures that we consider -// type aliases from external crates that don't have `lazy_type_alias` enabled to be eager. +// type aliases from external crates that don't have `checked_type_aliases` +// enabled to be eager. //@ aux-crate:eager=eager.rs //@ edition: 2021 //@ check-pass -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] // This used to crash when we were computing the variances of `Struct` since we would convert -// `eager::Alias` to a weak alias due to the presence of `#![feature(lazy_type_alias)]` in -// this (!) crate and subsequently attempt to obtain the variances of the type alias associated with -// the weak alias which would panic because we don't compute this information for eager type -// aliases at all. +// `eager::Alias` to a weak alias due to the presence of +// `#![feature(checked_type_aliases)]` in this (!) crate and subsequently attempt to +// obtain the variances of the type alias associated with the weak alias which would +// panic because we don't compute this information for eager type aliases at all. struct Struct(eager::Alias); fn main() { diff --git a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr b/tests/ui/checked-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr similarity index 100% rename from tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr rename to tests/ui/checked-type-alias/extern-crate-has-lazy-type-aliases.locally_eager.stderr diff --git a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr b/tests/ui/checked-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr similarity index 100% rename from tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr rename to tests/ui/checked-type-alias/extern-crate-has-lazy-type-aliases.locally_lazy.stderr diff --git a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.rs b/tests/ui/checked-type-alias/extern-crate-has-lazy-type-aliases.rs similarity index 80% rename from tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.rs rename to tests/ui/checked-type-alias/extern-crate-has-lazy-type-aliases.rs index 07490ad45e001..d8bf559690747 100644 --- a/tests/ui/lazy-type-alias/extern-crate-has-lazy-type-aliases.rs +++ b/tests/ui/checked-type-alias/extern-crate-has-lazy-type-aliases.rs @@ -3,11 +3,11 @@ //@ edition: 2021 // Test that we treat lazy type aliases from external crates as lazy independently of whether the -// local crate enables `lazy_type_alias` or not. +// local crate enables `checked_type_aliases` or not. #![cfg_attr( locally_lazy, - feature(lazy_type_alias), + feature(checked_type_aliases), allow(incomplete_features) )] diff --git a/tests/ui/lazy-type-alias/implied-outlives-bounds.neg.stderr b/tests/ui/checked-type-alias/implied-outlives-bounds.neg.stderr similarity index 100% rename from tests/ui/lazy-type-alias/implied-outlives-bounds.neg.stderr rename to tests/ui/checked-type-alias/implied-outlives-bounds.neg.stderr diff --git a/tests/ui/lazy-type-alias/implied-outlives-bounds.rs b/tests/ui/checked-type-alias/implied-outlives-bounds.rs similarity index 96% rename from tests/ui/lazy-type-alias/implied-outlives-bounds.rs rename to tests/ui/checked-type-alias/implied-outlives-bounds.rs index 804801ed591b4..50cbb136411ee 100644 --- a/tests/ui/lazy-type-alias/implied-outlives-bounds.rs +++ b/tests/ui/checked-type-alias/implied-outlives-bounds.rs @@ -3,7 +3,7 @@ //@ revisions: pos neg //@[pos] check-pass -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] type TypeOutlives<'a, T> = &'a T; diff --git a/tests/ui/lazy-type-alias/inherent-impls-conflicting.rs b/tests/ui/checked-type-alias/inherent-impls-conflicting.rs similarity index 84% rename from tests/ui/lazy-type-alias/inherent-impls-conflicting.rs rename to tests/ui/checked-type-alias/inherent-impls-conflicting.rs index 2adb04839ae2e..0680b846d97a0 100644 --- a/tests/ui/lazy-type-alias/inherent-impls-conflicting.rs +++ b/tests/ui/checked-type-alias/inherent-impls-conflicting.rs @@ -1,4 +1,4 @@ -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] type Alias = Local; diff --git a/tests/ui/lazy-type-alias/inherent-impls-conflicting.stderr b/tests/ui/checked-type-alias/inherent-impls-conflicting.stderr similarity index 100% rename from tests/ui/lazy-type-alias/inherent-impls-conflicting.stderr rename to tests/ui/checked-type-alias/inherent-impls-conflicting.stderr diff --git a/tests/ui/lazy-type-alias/inherent-impls-not-nominal.rs b/tests/ui/checked-type-alias/inherent-impls-not-nominal.rs similarity index 87% rename from tests/ui/lazy-type-alias/inherent-impls-not-nominal.rs rename to tests/ui/checked-type-alias/inherent-impls-not-nominal.rs index 0ec23bb7fb757..355b55b646f5c 100644 --- a/tests/ui/lazy-type-alias/inherent-impls-not-nominal.rs +++ b/tests/ui/checked-type-alias/inherent-impls-not-nominal.rs @@ -1,4 +1,4 @@ -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] type Alias = <() as Trait>::Out; diff --git a/tests/ui/lazy-type-alias/inherent-impls-not-nominal.stderr b/tests/ui/checked-type-alias/inherent-impls-not-nominal.stderr similarity index 100% rename from tests/ui/lazy-type-alias/inherent-impls-not-nominal.stderr rename to tests/ui/checked-type-alias/inherent-impls-not-nominal.stderr diff --git a/tests/ui/lazy-type-alias/inherent-impls-overflow.current.stderr b/tests/ui/checked-type-alias/inherent-impls-overflow.current.stderr similarity index 100% rename from tests/ui/lazy-type-alias/inherent-impls-overflow.current.stderr rename to tests/ui/checked-type-alias/inherent-impls-overflow.current.stderr diff --git a/tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr b/tests/ui/checked-type-alias/inherent-impls-overflow.next.stderr similarity index 100% rename from tests/ui/lazy-type-alias/inherent-impls-overflow.next.stderr rename to tests/ui/checked-type-alias/inherent-impls-overflow.next.stderr diff --git a/tests/ui/lazy-type-alias/inherent-impls-overflow.rs b/tests/ui/checked-type-alias/inherent-impls-overflow.rs similarity index 97% rename from tests/ui/lazy-type-alias/inherent-impls-overflow.rs rename to tests/ui/checked-type-alias/inherent-impls-overflow.rs index 6ee4f6b943a22..bb61bea5a5a7d 100644 --- a/tests/ui/lazy-type-alias/inherent-impls-overflow.rs +++ b/tests/ui/checked-type-alias/inherent-impls-overflow.rs @@ -2,7 +2,7 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] type Loop = Loop; diff --git a/tests/ui/lazy-type-alias/inherent-impls.rs b/tests/ui/checked-type-alias/inherent-impls.rs similarity index 87% rename from tests/ui/lazy-type-alias/inherent-impls.rs rename to tests/ui/checked-type-alias/inherent-impls.rs index 835b70bf67a21..d656a25018923 100644 --- a/tests/ui/lazy-type-alias/inherent-impls.rs +++ b/tests/ui/checked-type-alias/inherent-impls.rs @@ -1,6 +1,6 @@ //@ check-pass -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] type Alias = Local; diff --git a/tests/ui/lazy-type-alias/leading-where-clause.fixed b/tests/ui/checked-type-alias/leading-where-clause.fixed similarity index 93% rename from tests/ui/lazy-type-alias/leading-where-clause.fixed rename to tests/ui/checked-type-alias/leading-where-clause.fixed index 003eaa6c54e24..8b681d3bee09d 100644 --- a/tests/ui/lazy-type-alias/leading-where-clause.fixed +++ b/tests/ui/checked-type-alias/leading-where-clause.fixed @@ -1,6 +1,6 @@ //@ run-rustfix -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] #![crate_type = "lib"] diff --git a/tests/ui/lazy-type-alias/leading-where-clause.rs b/tests/ui/checked-type-alias/leading-where-clause.rs similarity index 95% rename from tests/ui/lazy-type-alias/leading-where-clause.rs rename to tests/ui/checked-type-alias/leading-where-clause.rs index 460f7e3a9994d..98aa8066c2ea1 100644 --- a/tests/ui/lazy-type-alias/leading-where-clause.rs +++ b/tests/ui/checked-type-alias/leading-where-clause.rs @@ -1,6 +1,6 @@ //@ run-rustfix -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] #![crate_type = "lib"] diff --git a/tests/ui/lazy-type-alias/leading-where-clause.stderr b/tests/ui/checked-type-alias/leading-where-clause.stderr similarity index 100% rename from tests/ui/lazy-type-alias/leading-where-clause.stderr rename to tests/ui/checked-type-alias/leading-where-clause.stderr diff --git a/tests/ui/lazy-type-alias/opaq-ty-collection-infinite-recur.rs b/tests/ui/checked-type-alias/opaq-ty-collection-infinite-recur.rs similarity index 96% rename from tests/ui/lazy-type-alias/opaq-ty-collection-infinite-recur.rs rename to tests/ui/checked-type-alias/opaq-ty-collection-infinite-recur.rs index 34803c8c1034b..79ed8e555eb06 100644 --- a/tests/ui/lazy-type-alias/opaq-ty-collection-infinite-recur.rs +++ b/tests/ui/checked-type-alias/opaq-ty-collection-infinite-recur.rs @@ -10,7 +10,7 @@ // meaning we get there before we wfcheck `Recur`. // // issue: -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![expect(incomplete_features)] struct Hold([(); { type Recur = Recur; 0 }]); //~ ERROR overflow normalizing the type alias `Recur` diff --git a/tests/ui/lazy-type-alias/opaq-ty-collection-infinite-recur.stderr b/tests/ui/checked-type-alias/opaq-ty-collection-infinite-recur.stderr similarity index 100% rename from tests/ui/lazy-type-alias/opaq-ty-collection-infinite-recur.stderr rename to tests/ui/checked-type-alias/opaq-ty-collection-infinite-recur.stderr diff --git a/tests/ui/lazy-type-alias/trailing-where-clause.rs b/tests/ui/checked-type-alias/trailing-where-clause.rs similarity index 89% rename from tests/ui/lazy-type-alias/trailing-where-clause.rs rename to tests/ui/checked-type-alias/trailing-where-clause.rs index ac9598fe5f6aa..08e558306a02b 100644 --- a/tests/ui/lazy-type-alias/trailing-where-clause.rs +++ b/tests/ui/checked-type-alias/trailing-where-clause.rs @@ -1,4 +1,4 @@ -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] // Check that we allow & respect trailing where-clauses on lazy type aliases. diff --git a/tests/ui/lazy-type-alias/trailing-where-clause.stderr b/tests/ui/checked-type-alias/trailing-where-clause.stderr similarity index 100% rename from tests/ui/lazy-type-alias/trailing-where-clause.stderr rename to tests/ui/checked-type-alias/trailing-where-clause.stderr diff --git a/tests/ui/lazy-type-alias/type-alias-bounds-are-enforced.rs b/tests/ui/checked-type-alias/type-alias-bounds-are-enforced.rs similarity index 69% rename from tests/ui/lazy-type-alias/type-alias-bounds-are-enforced.rs rename to tests/ui/checked-type-alias/type-alias-bounds-are-enforced.rs index f42ed64684f70..061ca36089f35 100644 --- a/tests/ui/lazy-type-alias/type-alias-bounds-are-enforced.rs +++ b/tests/ui/checked-type-alias/type-alias-bounds-are-enforced.rs @@ -1,9 +1,9 @@ // Check that we don't issue the lint `type_alias_bounds` for -// lazy type aliases since the bounds are indeed enforced. +// free type aliases since the bounds are indeed enforced. //@ check-pass -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] #![deny(type_alias_bounds)] diff --git a/tests/ui/lazy-type-alias/unconstrained-late-bound-regions.rs b/tests/ui/checked-type-alias/unconstrained-late-bound-regions.rs similarity index 95% rename from tests/ui/lazy-type-alias/unconstrained-late-bound-regions.rs rename to tests/ui/checked-type-alias/unconstrained-late-bound-regions.rs index 844570e22d275..ac3b56a542825 100644 --- a/tests/ui/lazy-type-alias/unconstrained-late-bound-regions.rs +++ b/tests/ui/checked-type-alias/unconstrained-late-bound-regions.rs @@ -1,6 +1,6 @@ // Weak alias types only constrain late-bound regions if their normalized form constrains them. -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] type NotInjective<'a> = <() as Discard>::Output<'a>; diff --git a/tests/ui/lazy-type-alias/unconstrained-late-bound-regions.stderr b/tests/ui/checked-type-alias/unconstrained-late-bound-regions.stderr similarity index 100% rename from tests/ui/lazy-type-alias/unconstrained-late-bound-regions.stderr rename to tests/ui/checked-type-alias/unconstrained-late-bound-regions.stderr diff --git a/tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.rs b/tests/ui/checked-type-alias/unconstrained-params-in-impl-due-to-overflow.rs similarity index 82% rename from tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.rs rename to tests/ui/checked-type-alias/unconstrained-params-in-impl-due-to-overflow.rs index 7bc91ef426b6c..41ffb76672f99 100644 --- a/tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.rs +++ b/tests/ui/checked-type-alias/unconstrained-params-in-impl-due-to-overflow.rs @@ -1,4 +1,4 @@ -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] impl Loop {} //~ ERROR the type parameter `T` is not constrained diff --git a/tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.stderr b/tests/ui/checked-type-alias/unconstrained-params-in-impl-due-to-overflow.stderr similarity index 100% rename from tests/ui/lazy-type-alias/unconstrained-params-in-impl-due-to-overflow.stderr rename to tests/ui/checked-type-alias/unconstrained-params-in-impl-due-to-overflow.stderr diff --git a/tests/ui/lazy-type-alias/unconstrained-params-in-impl.rs b/tests/ui/checked-type-alias/unconstrained-params-in-impl.rs similarity index 89% rename from tests/ui/lazy-type-alias/unconstrained-params-in-impl.rs rename to tests/ui/checked-type-alias/unconstrained-params-in-impl.rs index d58938b30701c..9f40ac11220c0 100644 --- a/tests/ui/lazy-type-alias/unconstrained-params-in-impl.rs +++ b/tests/ui/checked-type-alias/unconstrained-params-in-impl.rs @@ -1,4 +1,4 @@ -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] impl NotInjective {} //~ ERROR the type parameter `T` is not constrained diff --git a/tests/ui/lazy-type-alias/unconstrained-params-in-impl.stderr b/tests/ui/checked-type-alias/unconstrained-params-in-impl.stderr similarity index 100% rename from tests/ui/lazy-type-alias/unconstrained-params-in-impl.stderr rename to tests/ui/checked-type-alias/unconstrained-params-in-impl.stderr diff --git a/tests/ui/lazy-type-alias/unused-generic-arguments-not-wfchecked.next-fixed.stderr b/tests/ui/checked-type-alias/unused-generic-arguments-not-wfchecked.next-fixed.stderr similarity index 100% rename from tests/ui/lazy-type-alias/unused-generic-arguments-not-wfchecked.next-fixed.stderr rename to tests/ui/checked-type-alias/unused-generic-arguments-not-wfchecked.next-fixed.stderr diff --git a/tests/ui/lazy-type-alias/unused-generic-arguments-not-wfchecked.rs b/tests/ui/checked-type-alias/unused-generic-arguments-not-wfchecked.rs similarity index 77% rename from tests/ui/lazy-type-alias/unused-generic-arguments-not-wfchecked.rs rename to tests/ui/checked-type-alias/unused-generic-arguments-not-wfchecked.rs index eeabe85d82734..393f8dfab2077 100644 --- a/tests/ui/lazy-type-alias/unused-generic-arguments-not-wfchecked.rs +++ b/tests/ui/checked-type-alias/unused-generic-arguments-not-wfchecked.rs @@ -4,9 +4,9 @@ // // (We do still check predicates that reference unused parameters, of course.) // -// FIXME(lazy_type_alias): I consider #100041 to be a stabilization-blocking concern for the checked -// version of LTA! The *entire premise* of checked_LTA is wfchecking; -// we can't have such obvious holes in it! +// FIXME(checked_type_aliases): I consider #100041 to be a stabilization-blocking concern for +// the checked version of LTA! The *entire premise* of checked_LTA +// is wfchecking; we can't have such obvious holes in it! // //@ revisions: current-bugged next-bugged next-fixed // @@ -19,7 +19,7 @@ //@[next-bugged] known-bug: #100041 //@[next-bugged] check-pass -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] type A = (); diff --git a/tests/ui/lazy-type-alias/unused-generic-parameters.fail.stderr b/tests/ui/checked-type-alias/unused-generic-parameters.fail.stderr similarity index 100% rename from tests/ui/lazy-type-alias/unused-generic-parameters.fail.stderr rename to tests/ui/checked-type-alias/unused-generic-parameters.fail.stderr diff --git a/tests/ui/lazy-type-alias/unused-generic-parameters.rs b/tests/ui/checked-type-alias/unused-generic-parameters.rs similarity index 80% rename from tests/ui/lazy-type-alias/unused-generic-parameters.rs rename to tests/ui/checked-type-alias/unused-generic-parameters.rs index 3482512671226..18a65043ef61a 100644 --- a/tests/ui/lazy-type-alias/unused-generic-parameters.rs +++ b/tests/ui/checked-type-alias/unused-generic-parameters.rs @@ -4,9 +4,9 @@ // As long as we check well-formedness before normalization there shouldn't be anything wrong with // such parameters since we know that the corresponding arguments will get wfchecked regardless. // -// FIXME(lazy_type_alias, #100041): At the time of writing however, that's not the case. I consider -// this to be stabilization-blocking concern for the strong / -// checked version of LTA! +// FIXME(checked_type_aliases, #100041): At the time of writing however, that's not the case. +// I consider this to be stabilization-blocking concern for the +// strong checked version of LTA! // See also `unused-generic-arguments-not-wfchecked.rs`. // // (We *do* ofc still detect unsatisfied predicates even if they @@ -17,7 +17,7 @@ //@ revisions: pass fail //@[pass] check-pass -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] type A<'a: 'static> = (); const _: A<'static> = (); diff --git a/tests/ui/lazy-type-alias/use-site-wf.rs b/tests/ui/checked-type-alias/use-site-wf.rs similarity index 92% rename from tests/ui/lazy-type-alias/use-site-wf.rs rename to tests/ui/checked-type-alias/use-site-wf.rs index a44ff3e3493d7..cd10a6c8330d2 100644 --- a/tests/ui/lazy-type-alias/use-site-wf.rs +++ b/tests/ui/checked-type-alias/use-site-wf.rs @@ -1,7 +1,7 @@ // Test that we check usage sites of lazy type aliases, aka free alias types, for well-formedness. // We check trailing where-clauses separately in `trailing-where-clause.rs`. -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] type B = T; diff --git a/tests/ui/lazy-type-alias/use-site-wf.stderr b/tests/ui/checked-type-alias/use-site-wf.stderr similarity index 100% rename from tests/ui/lazy-type-alias/use-site-wf.stderr rename to tests/ui/checked-type-alias/use-site-wf.stderr diff --git a/tests/ui/lazy-type-alias/variance-0.rs b/tests/ui/checked-type-alias/variance-0.rs similarity index 93% rename from tests/ui/lazy-type-alias/variance-0.rs rename to tests/ui/checked-type-alias/variance-0.rs index 1cecdff2977b3..ae55e8ea717e1 100644 --- a/tests/ui/lazy-type-alias/variance-0.rs +++ b/tests/ui/checked-type-alias/variance-0.rs @@ -13,11 +13,11 @@ // //@ check-pass -// FIXME(lazy_type_alias): Revisit this before stabilization (it's not blocking tho): +// FIXME(checked_type_aliases): Revisit this before stabilization (it's not blocking tho): // We might want to compute variances for free alias types again // with a special rule. See `variance-1.rs` for details. -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] // `Co` is covariant over `'a` since we expand `A` to `&'a ()`. struct Co<'a>(A<'a>); diff --git a/tests/ui/lazy-type-alias/variance-1.rs b/tests/ui/checked-type-alias/variance-1.rs similarity index 92% rename from tests/ui/lazy-type-alias/variance-1.rs rename to tests/ui/checked-type-alias/variance-1.rs index 51480d271b439..3fb857b8f91bf 100644 --- a/tests/ui/lazy-type-alias/variance-1.rs +++ b/tests/ui/checked-type-alias/variance-1.rs @@ -3,13 +3,13 @@ // eagerly expand them during variance computation unlike other alias types which constrain args to // be invariant. -// FIXME(lazy_type_alias): Revisit this before stabilization (altho it's not blocking): +// FIXME(checked_type_aliases): Revisit this before stabilization (altho it's not blocking): // Do we want to compute variances for lazy type aliases & free alias types // again and "force bivariant parameters to be invariant" if they're not // constrained by a projection? // This would make `struct WrapDiscard` below compile. -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] type Discard<'a, T> = (); diff --git a/tests/ui/lazy-type-alias/variance-1.stderr b/tests/ui/checked-type-alias/variance-1.stderr similarity index 100% rename from tests/ui/lazy-type-alias/variance-1.stderr rename to tests/ui/checked-type-alias/variance-1.stderr diff --git a/tests/ui/lazy-type-alias/variance-overflow.rs b/tests/ui/checked-type-alias/variance-overflow.rs similarity index 96% rename from tests/ui/lazy-type-alias/variance-overflow.rs rename to tests/ui/checked-type-alias/variance-overflow.rs index 6bd7acc3ebef7..0b5b58e083133 100644 --- a/tests/ui/lazy-type-alias/variance-overflow.rs +++ b/tests/ui/checked-type-alias/variance-overflow.rs @@ -9,7 +9,7 @@ // This means we can't use `type_of` to recurse into free alias types, we do have to use // `expand_free_alias_tys`. -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] // the (unused) type parameter is necessary to actually trigger variance computation for `First`. struct First(Second); diff --git a/tests/ui/lazy-type-alias/variance-overflow.stderr b/tests/ui/checked-type-alias/variance-overflow.stderr similarity index 100% rename from tests/ui/lazy-type-alias/variance-overflow.stderr rename to tests/ui/checked-type-alias/variance-overflow.stderr diff --git a/tests/ui/coherence/orphan-check-weak-aliases-covering.rs b/tests/ui/coherence/orphan-check-weak-aliases-covering.rs index a8b9e905c70b5..d976f9d5f360a 100644 --- a/tests/ui/coherence/orphan-check-weak-aliases-covering.rs +++ b/tests/ui/coherence/orphan-check-weak-aliases-covering.rs @@ -7,7 +7,7 @@ //@ aux-crate:foreign=parametrized-trait.rs //@ edition:2021 -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] type Alias = LocalWrapper; diff --git a/tests/ui/coherence/orphan-check-weak-aliases-not-covering.rs b/tests/ui/coherence/orphan-check-weak-aliases-not-covering.rs index 6d9bccc4c689e..d43c42dfc9722 100644 --- a/tests/ui/coherence/orphan-check-weak-aliases-not-covering.rs +++ b/tests/ui/coherence/orphan-check-weak-aliases-not-covering.rs @@ -3,7 +3,7 @@ //@ aux-crate:foreign=parametrized-trait.rs //@ edition:2021 -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] type Identity = T; diff --git a/tests/ui/const-generics/adt_const_params/alias_const_param_ty-1.rs b/tests/ui/const-generics/adt_const_params/alias_const_param_ty-1.rs index 8825d5384ab91..e59be0f6698ea 100644 --- a/tests/ui/const-generics/adt_const_params/alias_const_param_ty-1.rs +++ b/tests/ui/const-generics/adt_const_params/alias_const_param_ty-1.rs @@ -1,5 +1,5 @@ //@ check-pass -#![feature(adt_const_params, lazy_type_alias)] +#![feature(adt_const_params, checked_type_aliases)] pub type Matrix = [usize; 1]; const EMPTY_MATRIX: Matrix = [0; 1]; diff --git a/tests/ui/const-generics/check_const_arg_type_in_free_alias.rs b/tests/ui/const-generics/check_const_arg_type_in_free_alias.rs index 12e277f0c545a..10d6ceba85f43 100644 --- a/tests/ui/const-generics/check_const_arg_type_in_free_alias.rs +++ b/tests/ui/const-generics/check_const_arg_type_in_free_alias.rs @@ -1,5 +1,5 @@ //@ revisions: eager lazy -#![cfg_attr(lazy, feature(lazy_type_alias))] +#![cfg_attr(lazy, feature(checked_type_aliases))] #![cfg_attr(lazy, expect(incomplete_features))] // We currently do not check free type aliases for well formedness. diff --git a/tests/ui/impl-trait/in-trait/alias-bounds-when-not-wf.rs b/tests/ui/impl-trait/in-trait/alias-bounds-when-not-wf.rs index 84d1d06234111..536deb2efc172 100644 --- a/tests/ui/impl-trait/in-trait/alias-bounds-when-not-wf.rs +++ b/tests/ui/impl-trait/in-trait/alias-bounds-when-not-wf.rs @@ -1,6 +1,6 @@ //@ compile-flags: -Znext-solver -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] trait Foo {} diff --git a/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs b/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs index f876253b42b5f..b2d8eb33a176a 100644 --- a/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs +++ b/tests/ui/infinite/infinite-type-alias-mutual-recursion.rs @@ -6,7 +6,7 @@ #![feature(rustc_attrs)] #![rustc_no_implicit_bounds] -#![cfg_attr(any(feature_old, feature_new), feature(lazy_type_alias))] +#![cfg_attr(any(feature_old, feature_new), feature(checked_type_aliases))] #![allow(incomplete_features)] type X1 = X2; diff --git a/tests/ui/infinite/infinite-vec-type-recursion.rs b/tests/ui/infinite/infinite-vec-type-recursion.rs index c051d11d376c8..3fc8601dec8a7 100644 --- a/tests/ui/infinite/infinite-vec-type-recursion.rs +++ b/tests/ui/infinite/infinite-vec-type-recursion.rs @@ -1,6 +1,6 @@ //@ revisions: feature gated -#![cfg_attr(feature, feature(lazy_type_alias))] +#![cfg_attr(feature, feature(checked_type_aliases))] #![allow(incomplete_features)] type X = Vec; diff --git a/tests/ui/lint/missing-debug-implementations-lint/impl-debug-for-alias-type.rs b/tests/ui/lint/missing-debug-implementations-lint/impl-debug-for-alias-type.rs index 5222df24b61a6..72bb853e5b5e0 100644 --- a/tests/ui/lint/missing-debug-implementations-lint/impl-debug-for-alias-type.rs +++ b/tests/ui/lint/missing-debug-implementations-lint/impl-debug-for-alias-type.rs @@ -1,6 +1,6 @@ //@ check-pass -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![deny(missing_debug_implementations)] pub struct Local; diff --git a/tests/ui/privacy/private-in-public-warn.stderr b/tests/ui/privacy/private-in-public-warn.stderr index 649b117b40afb..231278ac2f877 100644 --- a/tests/ui/privacy/private-in-public-warn.stderr +++ b/tests/ui/privacy/private-in-public-warn.stderr @@ -529,7 +529,7 @@ LL | pub type Alias = T; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics = note: `#[warn(type_alias_bounds)]` on by default help: remove this bound | @@ -545,7 +545,7 @@ LL | pub type Alias where T: PrivTr = T; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this where clause | LL - pub type Alias where T: PrivTr = T; diff --git a/tests/ui/privacy/reach-type-alias-issue-156778.rs b/tests/ui/privacy/reach-type-alias-issue-156778.rs index 4297a44038cfc..f9e56b79e22e3 100644 --- a/tests/ui/privacy/reach-type-alias-issue-156778.rs +++ b/tests/ui/privacy/reach-type-alias-issue-156778.rs @@ -1,5 +1,5 @@ //@ check-pass -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] use src::hidden_core; mod src { diff --git a/tests/ui/traits/next-solver/issue-118950-root-region.rs b/tests/ui/traits/next-solver/issue-118950-root-region.rs index 7a4cd2aaa1f11..15c313ec7bd5a 100644 --- a/tests/ui/traits/next-solver/issue-118950-root-region.rs +++ b/tests/ui/traits/next-solver/issue-118950-root-region.rs @@ -2,7 +2,7 @@ // // This is a gnarly test but I don't know how to minimize it, frankly. -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] trait ToUnit<'a> { type Unit; diff --git a/tests/ui/traits/next-solver/normalize/dont-ice-on-normalization-failure.rs b/tests/ui/traits/next-solver/normalize/dont-ice-on-normalization-failure.rs index 25d11aec56ddb..94bfdc5757e02 100644 --- a/tests/ui/traits/next-solver/normalize/dont-ice-on-normalization-failure.rs +++ b/tests/ui/traits/next-solver/normalize/dont-ice-on-normalization-failure.rs @@ -2,7 +2,7 @@ // Regression test for #151308 -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] trait Trait { type Associated; } diff --git a/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.rs b/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.rs index 921d753fe2a1e..396ac03971fa9 100644 --- a/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.rs +++ b/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.rs @@ -3,9 +3,9 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@ check-pass -// This goal is also possible w/ a GAT, but lazy_type_alias +// This goal is also possible w/ a GAT, but checked_type_aliases // makes the behavior a bit more readable. -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] struct Wr(T); trait Foo {} diff --git a/tests/ui/traits/next-solver/overflow/coherence-alias-hang-with-region.rs b/tests/ui/traits/next-solver/overflow/coherence-alias-hang-with-region.rs index 4ade8a13ca914..1df895d732a40 100644 --- a/tests/ui/traits/next-solver/overflow/coherence-alias-hang-with-region.rs +++ b/tests/ui/traits/next-solver/overflow/coherence-alias-hang-with-region.rs @@ -4,7 +4,7 @@ // Regression test for nalgebra hang . -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![allow(incomplete_features)] type Id = T; diff --git a/tests/ui/traits/next-solver/overflow/coherence-alias-hang.rs b/tests/ui/traits/next-solver/overflow/coherence-alias-hang.rs index 4874e2e1f99c5..a81904b2d37e9 100644 --- a/tests/ui/traits/next-solver/overflow/coherence-alias-hang.rs +++ b/tests/ui/traits/next-solver/overflow/coherence-alias-hang.rs @@ -3,7 +3,7 @@ // Regression test for nalgebra hang . -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![feature(rustc_attrs)] #![rustc_no_implicit_bounds] #![allow(incomplete_features)] diff --git a/tests/ui/transmutability/type-alias-normalization.rs b/tests/ui/transmutability/type-alias-normalization.rs index b42a17c698a76..04d3974e48e9e 100644 --- a/tests/ui/transmutability/type-alias-normalization.rs +++ b/tests/ui/transmutability/type-alias-normalization.rs @@ -1,7 +1,7 @@ //! ICE regression test for https://github.com/rust-lang/rust/issues/151462 //@compile-flags: -Znext-solver=globally //@check-pass -#![feature(lazy_type_alias, transmutability)] +#![feature(checked_type_aliases, transmutability)] #![allow(incomplete_features)] mod assert { use std::mem::{Assume, TransmuteFrom}; diff --git a/tests/ui/trivial-bounds/trivial-bounds-inconsistent.stderr b/tests/ui/trivial-bounds/trivial-bounds-inconsistent.stderr index e4107a4f4abea..7656228a85c12 100644 --- a/tests/ui/trivial-bounds/trivial-bounds-inconsistent.stderr +++ b/tests/ui/trivial-bounds/trivial-bounds-inconsistent.stderr @@ -32,7 +32,7 @@ LL | type Y where i32: Foo = (); | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics = note: `#[warn(type_alias_bounds)]` on by default help: remove this where clause | diff --git a/tests/ui/type-alias/recursive-lazy-type-alias-ice-152633.rs b/tests/ui/type-alias/recursive-lazy-type-alias-ice-152633.rs index 4b3633653133c..ac20f5862edd5 100644 --- a/tests/ui/type-alias/recursive-lazy-type-alias-ice-152633.rs +++ b/tests/ui/type-alias/recursive-lazy-type-alias-ice-152633.rs @@ -3,7 +3,7 @@ //! //! Regression test for . -#![feature(lazy_type_alias)] +#![feature(checked_type_aliases)] #![feature(min_generic_const_args)] trait Trait { diff --git a/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.rs b/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.rs index 2c8d448f3083e..bc226d2893012 100644 --- a/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.rs +++ b/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.rs @@ -2,7 +2,7 @@ // issue: rust-lang/rust#125789 //@ revisions: eager lazy -#![cfg_attr(lazy, feature(lazy_type_alias), allow(incomplete_features))] +#![cfg_attr(lazy, feature(checked_type_aliases), allow(incomplete_features))] trait Trait { type Assoc; } diff --git a/tests/ui/type/issue-67690-type-alias-bound-diagnostic-crash.stderr b/tests/ui/type/issue-67690-type-alias-bound-diagnostic-crash.stderr index ef0a7235c354b..3a55a3cb82ede 100644 --- a/tests/ui/type/issue-67690-type-alias-bound-diagnostic-crash.stderr +++ b/tests/ui/type/issue-67690-type-alias-bound-diagnostic-crash.stderr @@ -6,7 +6,7 @@ LL | pub type T = P; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics = note: `#[warn(type_alias_bounds)]` on by default help: remove this bound | diff --git a/tests/ui/type/type-alias-bounds.stderr b/tests/ui/type/type-alias-bounds.stderr index f7f530a0861c8..1634440100cdc 100644 --- a/tests/ui/type/type-alias-bounds.stderr +++ b/tests/ui/type/type-alias-bounds.stderr @@ -6,7 +6,7 @@ LL | type SVec = Vec; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics = note: `#[warn(type_alias_bounds)]` on by default help: remove this bound | @@ -22,7 +22,7 @@ LL | type S2Vec where T: Send = Vec; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this where clause | LL - type S2Vec where T: Send = Vec; @@ -37,7 +37,7 @@ LL | type VVec<'b, 'a: 'b + 'b> = (&'b u32, Vec<&'a i32>); | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this bound | LL - type VVec<'b, 'a: 'b + 'b> = (&'b u32, Vec<&'a i32>); @@ -52,7 +52,7 @@ LL | type WVec<'b, T: 'b + 'b> = (&'b u32, Vec); | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this bound | LL - type WVec<'b, T: 'b + 'b> = (&'b u32, Vec); @@ -67,7 +67,7 @@ LL | type W2Vec<'b, T> where T: 'b, T: 'b = (&'b u32, Vec); | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this where clause | LL - type W2Vec<'b, T> where T: 'b, T: 'b = (&'b u32, Vec); @@ -82,7 +82,7 @@ LL | type T1 = U::Assoc; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this bound | LL - type T1 = U::Assoc; @@ -101,7 +101,7 @@ LL | type T2 where U: Bound = U::Assoc; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this where clause | LL - type T2 where U: Bound = U::Assoc; @@ -120,7 +120,7 @@ LL | type T5 = ::Assoc; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this bound | LL - type T5 = ::Assoc; @@ -135,7 +135,7 @@ LL | type T6 = ::std::vec::Vec; | = note: this is a known limitation of the type checker that may be lifted in a future edition. see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable the desired semantics + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable the desired semantics help: remove this bound | LL - type T6 = ::std::vec::Vec; diff --git a/tests/ui/where-clauses/cfg-attr-issue-138010-2.rs b/tests/ui/where-clauses/cfg-attr-issue-138010-2.rs index cf84bf3ee3559..0cbcc6abf6168 100644 --- a/tests/ui/where-clauses/cfg-attr-issue-138010-2.rs +++ b/tests/ui/where-clauses/cfg-attr-issue-138010-2.rs @@ -1,4 +1,4 @@ -#![feature(where_clause_attrs, lazy_type_alias)] +#![feature(where_clause_attrs, checked_type_aliases)] #![expect(incomplete_features)] struct Foo; diff --git a/tests/ui/where-clauses/where-clause-placement-type-alias.stderr b/tests/ui/where-clauses/where-clause-placement-type-alias.stderr index d341148b04cb5..23798e5fa6124 100644 --- a/tests/ui/where-clauses/where-clause-placement-type-alias.stderr +++ b/tests/ui/where-clauses/where-clause-placement-type-alias.stderr @@ -5,7 +5,7 @@ LL | type Bar = () where u32: Copy; | ^^^^^^^^^^^^^^^ | = note: see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable error: where clauses are not allowed after the type for type aliases --> $DIR/where-clause-placement-type-alias.rs:8:15 @@ -14,7 +14,7 @@ LL | type Baz = () where; | ^^^^^ | = note: see issue #112792 for more information - = help: add `#![feature(lazy_type_alias)]` to the crate attributes to enable + = help: add `#![feature(checked_type_aliases)]` to the crate attributes to enable error: aborting due to 2 previous errors From 37e12e1d247cbd55fa823b6c299a5f2a5030a1a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 9 Jul 2026 03:19:01 +0000 Subject: [PATCH 11/38] Show sub-parts of types when only interesting part is lifetimes We have a mechanims (`Highlight`) to change the name of inferred lifetimes in types so that we can refer to them by a number. Modify it so that it also avoids printing sub-parts of the type that are irrelevant to the situation at hand. The new behavior will print any sub part that has *any* lifetime (as they might be informative) instead of *just* the lifetimes being replaced. This was found to produce the best effect empirically in the test suite, striking a nice balance between shortening labels and being informative. ``` error: lifetime may not live long enough --> $DIR/wrong-closure-arg-suggestion-125325.rs:46:18 | LL | take(|_| to_fn(|_| self.counter += 1)); | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` | | | | | return type of closure `aux::Map<{closure@...}>` contains a lifetime `'2` | lifetime `'1` represents this closure's body | = note: closure implements `Fn`, so references to captured variables can't escape the closure ``` ``` error: implementation of `FnOnce` is not general enough --> $DIR/higher-ranked-auto-trait-15.rs:20:5 | LL | require_send(future); | ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | = note: closure with signature `fn(&'0 ...) -> std::slice::Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&Vec,)>` ``` Made this change after noticing that the first of the errors above had a corresponding `.stderr` file with lines longer than 150 columns. --- compiler/rustc_middle/src/ty/print/pretty.rs | 27 ++++++++++++++++--- .../nice_region_error/placeholder_error.rs | 21 ++++++++++++--- ...ranked-auto-trait-15.no_assumptions.stderr | 4 +-- ...ted-closure-outlives-borrowed-value.stderr | 2 +- ...5079-missing-move-in-nested-closure.stderr | 2 +- ...n-with-leaking-placeholders.current.stderr | 2 +- ...wrong-closure-arg-suggestion-125325.stderr | 4 +-- .../higher-ranked-lifetime-error.stderr | 2 +- .../self-without-lifetime-constraint.stderr | 8 +++--- 9 files changed, 54 insertions(+), 18 deletions(-) diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 69def782bb67b..830eacc26da9f 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -190,6 +190,10 @@ pub struct RegionHighlightMode<'tcx> { /// instead of the ordinary behavior. highlight_regions: [Option<(ty::Region<'tcx>, usize)>; 3], + /// If set to `true`, types that include regions will always be included in the output, while + /// other types will be free to be trimmed. + pub keep_regions: bool, + /// If enabled, when printing a "free region" that originated from /// the given `ty::BoundRegionKind`, print it as "`'1`". Free regions that would ordinarily /// have names print as normal. @@ -208,6 +212,7 @@ impl<'tcx> RegionHighlightMode<'tcx> { region: Option>, number: Option, ) { + self.keep_regions = true; if let Some(k) = region && let Some(n) = number { @@ -223,6 +228,7 @@ impl<'tcx> RegionHighlightMode<'tcx> { bug!("can only highlight {} placeholders at a time", num_slots,) }); *first_avail_slot = Some((region, number)); + self.keep_regions = true; } /// Convenience wrapper for `highlighting_region`. @@ -2330,12 +2336,27 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> { } fn print_type(&mut self, ty: Ty<'tcx>) -> Result<(), PrintError> { + let has_regions = self.region_highlight_mode.keep_regions + && ty.has_type_flags(ty::TypeFlags::HAS_REGIONS); match ty.kind() { - ty::Tuple(tys) if tys.len() == 0 && self.should_truncate() => { + ty::Tuple(tys) if tys.len() == 0 => { // Don't truncate `()`. + self.pretty_print_type(ty) + } + + ty::Adt(def, args) + if args.types().next().is_none() + && args.consts().next().is_none() + && args.types().count() < 2 + && self.should_truncate() + && self.tcx.item_name(def.did()).as_str().len() < 5 => + { + // Don't fully truncate types that have "short names" and at most one type param. + // FIXME: only mention the name instead of the path? self.printed_type_count += 1; self.pretty_print_type(ty) } + ty::Adt(..) | ty::Foreign(_) | ty::Pat(..) @@ -2351,17 +2372,17 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> { | ty::CoroutineWitness(..) | ty::Tuple(_) | ty::Alias(..) - | ty::Param(_) | ty::Bound(..) | ty::Placeholder(_) | ty::Error(_) - if self.should_truncate() => + if self.should_truncate() && !has_regions => { // We only truncate types that we know are likely to be much longer than 3 chars. // There's no point in replacing `i32` or `!`. write!(self, "_")?; Ok(()) } + ty::Ref(r, ..) if self.should_truncate() && has_regions => self.pretty_print_type(ty), _ => { self.printed_type_count += 1; self.pretty_print_type(ty) diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs index f6887c18075a4..7a10b178cd588 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs @@ -5,6 +5,7 @@ use rustc_errors::{Applicability, Diag, IntoDiagArg}; use rustc_hir as hir; use rustc_hir::def::Namespace; use rustc_hir::def_id::{CRATE_DEF_ID, DefId}; +use rustc_hir::limit::Limit; use rustc_middle::bug; use rustc_middle::ty::error::ExpectedFound; use rustc_middle::ty::print::{FmtPrinter, Print, PrintTraitRefExt as _, RegionHighlightMode}; @@ -29,7 +30,7 @@ pub(crate) struct Highlighted<'tcx, T> { impl<'tcx, T> IntoDiagArg for Highlighted<'tcx, T> where - T: for<'a> Print>, + T: for<'a> Print> + Copy, { fn into_diag_arg(self, _: &mut Option) -> rustc_errors::DiagArgValue { rustc_errors::DiagArgValue::Str(self.to_string().into()) @@ -44,14 +45,28 @@ impl<'tcx, T> Highlighted<'tcx, T> { impl<'tcx, T> fmt::Display for Highlighted<'tcx, T> where - T: for<'a> Print>, + T: for<'a> Print> + Copy, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let mut p = ty::print::FmtPrinter::new(self.tcx, self.ns); p.region_highlight_mode = self.highlight; self.value.print(&mut p)?; - f.write_str(&p.into_buffer()) + let b = p.into_buffer(); + if b.len() <= 40 || !self.highlight.keep_regions { + // This is a short enough type that can be safely be printed to the user, or we aren't + // showing the type with a particular interest in its lifetimes. + f.write_str(&b)?; + } else { + // We are highlighting lifetimes in the output, we will print out the smallest possible + // portion of the type while keeping the lifetimes visible. + let mut p = FmtPrinter::new_with_limit(self.tcx, self.ns, Limit(0)); + p.region_highlight_mode = self.highlight; + self.value.print(&mut p).expect("could not print type"); + let x = p.into_buffer(); + f.write_str(&x)?; + } + Ok(()) } } diff --git a/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr index 461b065d55ad3..3773068f46a2a 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr @@ -4,7 +4,7 @@ error: implementation of `FnOnce` is not general enough LL | require_send(future); | ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | - = note: closure with signature `fn(&'0 Vec) -> std::slice::Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... + = note: closure with signature `fn(&'0 ...) -> std::slice::Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&Vec,)>` help: consider adding an explicit type annotation to the closure's argument | @@ -17,7 +17,7 @@ error: implementation of `FnOnce` is not general enough LL | require_send(future); | ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | - = note: closure with signature `fn(&'0 Vec) -> std::slice::Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... + = note: closure with signature `fn(&'0 ...) -> std::slice::Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&Vec,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument diff --git a/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr b/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr index 5887752800b55..2fd84517a61bd 100644 --- a/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr +++ b/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr @@ -4,7 +4,7 @@ error: lifetime may not live long enough LL | let _action = move || { | ------- | | | - | | return type of closure `{closure@$DIR/issue-53432-nested-closure-outlives-borrowed-value.rs:4:9: 4:11}` contains a lifetime `'2` + | | return type of closure `{closure@...}` contains a lifetime `'2` | lifetime `'1` represents this closure's body LL | || f() // The `nested` closure | ^^^^^^ returning this value requires that `'1` must outlive `'2` diff --git a/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr index d7762621cc5c7..c43a983cbf365 100644 --- a/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr +++ b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr @@ -24,7 +24,7 @@ error: lifetime may not live long enough LL | move |()| s.chars().map(|c| format!("{}{}", c, s)) | --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` | | | - | | return type of closure `Map, {closure@$DIR/issue-95079-missing-move-in-nested-closure.rs:11:29: 11:32}>` contains a lifetime `'2` + | | return type of closure `Map, {closure@...}>` contains a lifetime `'2` | lifetime `'1` represents this closure's body | = note: closure implements `Fn`, so references to captured variables can't escape the closure diff --git a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr index eaa0d32e75dff..cdaa16ac9e807 100644 --- a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr +++ b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr @@ -8,7 +8,7 @@ LL | | x.to_string(); LL | | }); | |______^ implementation of `Foo` is not general enough | - = note: `Wrap<{closure@$DIR/obligation-with-leaking-placeholders.rs:18:15: 18:18}>` must implement `Foo<'0>`, for any lifetime `'0`... + = note: `Wrap<{closure@...}>` must implement `Foo<'0>`, for any lifetime `'0`... = note: ...but it actually implements `Foo<'1>`, for some specific lifetime `'1` error: aborting due to 1 previous error diff --git a/tests/ui/closures/wrong-closure-arg-suggestion-125325.stderr b/tests/ui/closures/wrong-closure-arg-suggestion-125325.stderr index 80da4e7145f95..1b94d59901d22 100644 --- a/tests/ui/closures/wrong-closure-arg-suggestion-125325.stderr +++ b/tests/ui/closures/wrong-closure-arg-suggestion-125325.stderr @@ -43,7 +43,7 @@ error: lifetime may not live long enough LL | take(|_| to_fn(|_| self.counter += 1)); | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` | | | - | | return type of closure `aux::Map<{closure@$DIR/wrong-closure-arg-suggestion-125325.rs:46:24: 46:27}>` contains a lifetime `'2` + | | return type of closure `aux::Map<{closure@...}>` contains a lifetime `'2` | lifetime `'1` represents this closure's body | = note: closure implements `Fn`, so references to captured variables can't escape the closure @@ -77,7 +77,7 @@ error: lifetime may not live long enough LL | P.flat_map(|_| P.map(|_| self.counter += 1)); | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` | | | - | | return type of closure `aux::Map<{closure@$DIR/wrong-closure-arg-suggestion-125325.rs:54:30: 54:33}>` contains a lifetime `'2` + | | return type of closure `aux::Map<{closure@...}>` contains a lifetime `'2` | lifetime `'1` represents this closure's body | = note: closure implements `Fn`, so references to captured variables can't escape the closure diff --git a/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr b/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr index 2e3fd6123346f..e8a9869e3671a 100644 --- a/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr +++ b/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr @@ -4,7 +4,7 @@ error: implementation of `FnMut` is not general enough LL | assert_all::<_, &String>(id); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnMut` is not general enough | - = note: `for<'a> fn(&'a String) -> &'a String {id}` must implement `FnMut<(&String,)>` + = note: `for<'a> fn(&'a ...) -> &'a ... {id}` must implement `FnMut<(&String,)>` = note: ...but it actually implements `FnMut<(&'0 String,)>`, for some specific lifetime `'0` error: aborting due to 1 previous error diff --git a/tests/ui/traits/self-without-lifetime-constraint.stderr b/tests/ui/traits/self-without-lifetime-constraint.stderr index 8997d2a98b323..1c949c14afa44 100644 --- a/tests/ui/traits/self-without-lifetime-constraint.stderr +++ b/tests/ui/traits/self-without-lifetime-constraint.stderr @@ -2,13 +2,13 @@ error: `impl` item signature doesn't match `trait` item signature --> $DIR/self-without-lifetime-constraint.rs:46:5 | LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult; - | -------------------------------------------------------------------- expected `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), FromSqlError>` + | -------------------------------------------------------------------- expected `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), ...>` ... LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<&str, &&str> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), FromSqlError>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), ...>` | - = note: expected signature `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), FromSqlError>` - found signature `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), FromSqlError>` + = note: expected signature `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), ...>` + found signature `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), ...>` help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` --> $DIR/self-without-lifetime-constraint.rs:42:60 | From a85f928f3d6d8fba954d077d4aea985d31b97a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 9 Jul 2026 03:38:51 +0000 Subject: [PATCH 12/38] Teach async closures and coroutines to print short types --- compiler/rustc_middle/src/ty/print/pretty.rs | 10 ++++++++-- .../higher-ranked-auto-trait-15.no_assumptions.stderr | 4 ++-- .../higher-ranked-auto-trait-16.assumptions.stderr | 4 ++-- .../higher-ranked-auto-trait-16.no_assumptions.stderr | 4 ++-- tests/ui/coroutine/resume-arg-late-bound.stderr | 2 +- .../higher-ranked/higher-ranked-lifetime-error.stderr | 2 +- .../dont-suggest-boxing-async-closure-body.stderr | 2 +- .../ui/traits/self-without-lifetime-constraint.stderr | 8 ++++---- 8 files changed, 21 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 830eacc26da9f..3a9e0e169f27c 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -899,7 +899,10 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { if !self.should_print_verbose() { write!(self, "{coroutine_kind}")?; - if coroutine_kind.is_fn_like() { + if self.should_truncate() { + write!(self, "@...}}")?; + return Ok(()); + } else if coroutine_kind.is_fn_like() { // If we are printing an `async fn` coroutine type, then give the path // of the fn, instead of its span, because that will in most cases be // more helpful for the reader than just a source location. @@ -1028,7 +1031,10 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { "coroutine from coroutine-closure should have CoroutineSource::Closure" ), } - if let Some(did) = did.as_local() { + if self.should_truncate() { + write!(self, "@...}}")?; + return Ok(()); + } else if let Some(did) = did.as_local() { if self.tcx().sess.opts.unstable_opts.span_free_formats { write!(self, "@")?; self.print_def_path(did.to_def_id(), args)?; diff --git a/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr index 3773068f46a2a..8f282b128c456 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr @@ -4,7 +4,7 @@ error: implementation of `FnOnce` is not general enough LL | require_send(future); | ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | - = note: closure with signature `fn(&'0 ...) -> std::slice::Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... + = note: closure with signature `fn(&'0 _) -> std::slice::Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&Vec,)>` help: consider adding an explicit type annotation to the closure's argument | @@ -17,7 +17,7 @@ error: implementation of `FnOnce` is not general enough LL | require_send(future); | ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | - = note: closure with signature `fn(&'0 ...) -> std::slice::Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... + = note: closure with signature `fn(&'0 _) -> std::slice::Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&Vec,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument diff --git a/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr index 412c31b1bd843..dc6183a45cef5 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr @@ -6,7 +6,7 @@ LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ implementation of `AsyncFnOnce` is not general enough | - = note: `{async closure@$DIR/higher-ranked-auto-trait-16.rs:19:33: 19:42}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... + = note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` error: implementation of `AsyncFnOnce` is not general enough @@ -17,7 +17,7 @@ LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ implementation of `AsyncFnOnce` is not general enough | - = note: `{async closure@$DIR/higher-ranked-auto-trait-16.rs:19:33: 19:42}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... + = note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr index 412c31b1bd843..dc6183a45cef5 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr @@ -6,7 +6,7 @@ LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ implementation of `AsyncFnOnce` is not general enough | - = note: `{async closure@$DIR/higher-ranked-auto-trait-16.rs:19:33: 19:42}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... + = note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` error: implementation of `AsyncFnOnce` is not general enough @@ -17,7 +17,7 @@ LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ implementation of `AsyncFnOnce` is not general enough | - = note: `{async closure@$DIR/higher-ranked-auto-trait-16.rs:19:33: 19:42}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... + = note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/coroutine/resume-arg-late-bound.stderr b/tests/ui/coroutine/resume-arg-late-bound.stderr index 646abaf4f7bde..0a6fb8dfcbb6c 100644 --- a/tests/ui/coroutine/resume-arg-late-bound.stderr +++ b/tests/ui/coroutine/resume-arg-late-bound.stderr @@ -4,7 +4,7 @@ error: implementation of `Coroutine` is not general enough LL | test(gen); | ^^^^^^^^^ implementation of `Coroutine` is not general enough | - = note: `{coroutine@$DIR/resume-arg-late-bound.rs:11:28: 11:44}` must implement `Coroutine<&'1 mut bool>`, for any lifetime `'1`... + = note: `{coroutine@...}` must implement `Coroutine<&'1 mut bool>`, for any lifetime `'1`... = note: ...but it actually implements `Coroutine<&'2 mut bool>`, for some specific lifetime `'2` error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr b/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr index e8a9869e3671a..85d95405745e8 100644 --- a/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr +++ b/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr @@ -4,7 +4,7 @@ error: implementation of `FnMut` is not general enough LL | assert_all::<_, &String>(id); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnMut` is not general enough | - = note: `for<'a> fn(&'a ...) -> &'a ... {id}` must implement `FnMut<(&String,)>` + = note: `for<'a> fn(&'a _) -> &'a _ {id}` must implement `FnMut<(&String,)>` = note: ...but it actually implements `FnMut<(&'0 String,)>`, for some specific lifetime `'0` error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr b/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr index abf8e2d824b5d..430432b99901e 100644 --- a/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr +++ b/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr @@ -18,7 +18,7 @@ error[E0308]: mismatched types --> $DIR/dont-suggest-boxing-async-closure-body.rs:11:9 | LL | bar(async move || {}); - | --- ^^^^^^^^^^^^^^^^ expected `Box _>`, found `{async closure@dont-suggest-boxing-async-closure-body.rs:11:9}` + | --- ^^^^^^^^^^^^^^^^ expected `Box _>`, found `{async closure@...}` | | | arguments to this function are incorrect | diff --git a/tests/ui/traits/self-without-lifetime-constraint.stderr b/tests/ui/traits/self-without-lifetime-constraint.stderr index 1c949c14afa44..a7376e6cf9dc5 100644 --- a/tests/ui/traits/self-without-lifetime-constraint.stderr +++ b/tests/ui/traits/self-without-lifetime-constraint.stderr @@ -2,13 +2,13 @@ error: `impl` item signature doesn't match `trait` item signature --> $DIR/self-without-lifetime-constraint.rs:46:5 | LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult; - | -------------------------------------------------------------------- expected `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), ...>` + | -------------------------------------------------------------------- expected `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), _>` ... LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<&str, &&str> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), ...>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), _>` | - = note: expected signature `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), ...>` - found signature `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), ...>` + = note: expected signature `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), _>` + found signature `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), _>` help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` --> $DIR/self-without-lifetime-constraint.rs:42:60 | From 00d1b3fee67b8ab351375692036be5d208f46f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 9 Jul 2026 23:13:10 +0000 Subject: [PATCH 13/38] Use `Highlight` when naming hidden type in return type ``` error[E0700]: hidden type for `impl Iterator` captures lifetime that does not appear in bounds --> $DIR/static-return-lifetime-infered.rs:11:9 | LL | fn iter_values<'a>(&'a self) -> impl Iterator { | -- ----------------------- opaque type defined here | | | hidden type `Map, {closure@...}>` captures the lifetime `'a` as defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` --- .../src/error_reporting/infer/region.rs | 7 ++++++- tests/ui/borrowck/closure-upvar-named-lifetime.stderr | 4 ++-- tests/ui/c-variadic/not-async.stderr | 2 +- .../impl-trait/must_outlive_least_region_or_bound.stderr | 2 +- tests/ui/impl-trait/nested-return-type4.stderr | 2 +- tests/ui/impl-trait/static-return-lifetime-infered.stderr | 4 ++-- tests/ui/inference/note-and-explain-ReVar-124973.stderr | 2 +- tests/ui/iterators/generator_returned_from_fn.stderr | 4 ++-- tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.stderr | 2 +- ...-lifetime-suggestion-in-proper-span-issue-121267.stderr | 2 +- .../lifetimes/missing-lifetimes-in-signature.stderr | 2 +- 11 files changed, 19 insertions(+), 14 deletions(-) diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs index 7e706a9838306..5e906c17c0756 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/region.rs @@ -4,13 +4,14 @@ use rustc_data_structures::fx::FxIndexSet; use rustc_errors::{ Applicability, Diag, E0309, E0310, E0311, E0803, Subdiagnostic, msg, struct_span_code_err, }; -use rustc_hir::def::DefKind; +use rustc_hir::def::{DefKind, Namespace}; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::intravisit::Visitor; use rustc_hir::{self as hir, ParamName}; use rustc_middle::bug; use rustc_middle::traits::ObligationCauseCode; use rustc_middle::ty::error::TypeError; +use rustc_middle::ty::print::RegionHighlightMode; use rustc_middle::ty::{ self, IsSuggestable, Region, Ty, TyCtxt, TypeVisitableExt as _, Upcast as _, }; @@ -25,6 +26,7 @@ use crate::diagnostics::{ }; use crate::error_reporting::TypeErrCtxt; use crate::error_reporting::infer::ObligationCauseExt; +use crate::error_reporting::infer::nice_region_error::placeholder_error::Highlighted; use crate::infer::region_constraints::GenericKind; use crate::infer::{ BoundRegionConversionTime, InferCtxt, RegionResolutionError, RegionVariableOrigin, @@ -1286,6 +1288,9 @@ pub fn unexpected_hidden_region_diagnostic<'a, 'tcx>( ), opaque_ty_span: tcx.def_span(opaque_ty_key.def_id), }); + let mut highlight = RegionHighlightMode::default(); + highlight.keep_regions = true; + let hidden_ty = Highlighted { highlight, ns: Namespace::TypeNS, tcx, value: hidden_ty }; // Explain the region we are capturing. match hidden_region.kind() { diff --git a/tests/ui/borrowck/closure-upvar-named-lifetime.stderr b/tests/ui/borrowck/closure-upvar-named-lifetime.stderr index fc7c59fa97c89..7b90b07b2f985 100644 --- a/tests/ui/borrowck/closure-upvar-named-lifetime.stderr +++ b/tests/ui/borrowck/closure-upvar-named-lifetime.stderr @@ -39,7 +39,7 @@ error[E0700]: hidden type for `impl Fn(RefCell>)` captur --> $DIR/closure-upvar-named-lifetime.rs:17:5 | LL | fn apply<'a>( - | -- hidden type `{closure@$DIR/closure-upvar-named-lifetime.rs:17:5: 17:15}` captures the lifetime `'a` as defined here + | -- hidden type `{closure@...}` captures the lifetime `'a` as defined here LL | f: Arc) + 'a>, LL | ) -> impl Fn(RefCell>) | ----------------------------------------- opaque type defined here @@ -92,7 +92,7 @@ error[E0700]: hidden type for `impl Fn(RefCell>)` captur --> $DIR/closure-upvar-named-lifetime.rs:32:5 | LL | fn apply_box<'a>( - | -- hidden type `{closure@$DIR/closure-upvar-named-lifetime.rs:32:5: 32:15}` captures the lifetime `'a` as defined here + | -- hidden type `{closure@...}` captures the lifetime `'a` as defined here LL | f: Box) + 'a>, LL | ) -> impl Fn(RefCell>) | ----------------------------------------- opaque type defined here diff --git a/tests/ui/c-variadic/not-async.stderr b/tests/ui/c-variadic/not-async.stderr index bb8cc64e15fa4..c6929b3676230 100644 --- a/tests/ui/c-variadic/not-async.stderr +++ b/tests/ui/c-variadic/not-async.stderr @@ -28,7 +28,7 @@ LL | async unsafe extern "C" fn method_cannot_be_async(x: isize, _: ...) {} | | | opaque type defined here | - = note: hidden type `{async fn body of S::method_cannot_be_async()}` captures lifetime `'_` + = note: hidden type `{async fn body@...}` captures lifetime `'_` error: aborting due to 4 previous errors diff --git a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr index 53c5568660417..4a364c9eb0c6d 100644 --- a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr +++ b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr @@ -112,7 +112,7 @@ error[E0700]: hidden type for `impl Fn(&'a u32)` captures lifetime that does not LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) { | -- ---------------- opaque type defined here | | - | hidden type `{closure@$DIR/must_outlive_least_region_or_bound.rs:42:5: 42:13}` captures the lifetime `'b` as defined here + | hidden type `{closure@...}` captures the lifetime `'b` as defined here LL | move |_| println!("{}", y) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/impl-trait/nested-return-type4.stderr b/tests/ui/impl-trait/nested-return-type4.stderr index 407800eff1894..63f3bfcdda950 100644 --- a/tests/ui/impl-trait/nested-return-type4.stderr +++ b/tests/ui/impl-trait/nested-return-type4.stderr @@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Future` captures lifeti LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future { | -- --------------------------------------------- opaque type defined here | | - | hidden type `{async block@$DIR/nested-return-type4.rs:4:5: 4:15}` captures the lifetime `'s` as defined here + | hidden type `{async block@...}` captures the lifetime `'s` as defined here LL | async move { let _s = s; } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/impl-trait/static-return-lifetime-infered.stderr b/tests/ui/impl-trait/static-return-lifetime-infered.stderr index 21e3187d01912..7bdab1da26560 100644 --- a/tests/ui/impl-trait/static-return-lifetime-infered.stderr +++ b/tests/ui/impl-trait/static-return-lifetime-infered.stderr @@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn iter_values_anon(&self) -> impl Iterator { | ----- ----------------------- opaque type defined here | | - | hidden type `Map, {closure@$DIR/static-return-lifetime-infered.rs:7:27: 7:30}>` captures the anonymous lifetime defined here + | hidden type `Map, {closure@...}>` captures the anonymous lifetime defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -19,7 +19,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn iter_values<'a>(&'a self) -> impl Iterator { | -- ----------------------- opaque type defined here | | - | hidden type `Map, {closure@$DIR/static-return-lifetime-infered.rs:11:27: 11:30}>` captures the lifetime `'a` as defined here + | hidden type `Map, {closure@...}>` captures the lifetime `'a` as defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/inference/note-and-explain-ReVar-124973.stderr b/tests/ui/inference/note-and-explain-ReVar-124973.stderr index 2b5e79e9a1c64..fa5ba771980f4 100644 --- a/tests/ui/inference/note-and-explain-ReVar-124973.stderr +++ b/tests/ui/inference/note-and-explain-ReVar-124973.stderr @@ -12,7 +12,7 @@ LL | async unsafe extern "C" fn multiple_named_lifetimes<'a, 'b>(_: u8, _: ...) | | | opaque type defined here | - = note: hidden type `{async fn body of multiple_named_lifetimes<'a, 'b>()}` captures lifetime `'_` + = note: hidden type `{async fn body@...}` captures lifetime `'_` error: aborting due to 2 previous errors diff --git a/tests/ui/iterators/generator_returned_from_fn.stderr b/tests/ui/iterators/generator_returned_from_fn.stderr index 8bec119ddbc01..f4620b958f0c6 100644 --- a/tests/ui/iterators/generator_returned_from_fn.stderr +++ b/tests/ui/iterators/generator_returned_from_fn.stderr @@ -28,7 +28,7 @@ error[E0700]: hidden type for `impl FnOnce() -> impl Iterator` captu LL | fn capture_move_once(a: &u32) -> impl FnOnce() -> impl Iterator { | ---- ------------------------------------------ opaque type defined here | | - | hidden type `{gen closure@$DIR/generator_returned_from_fn.rs:43:13: 43:20}` captures the anonymous lifetime defined here + | hidden type `{gen closure@...}` captures the anonymous lifetime defined here LL | iter! { move || { | _____________^ LL | | @@ -49,7 +49,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn capture_move_once(a: &u32) -> impl FnOnce() -> impl Iterator { | ---- ------------------------- opaque type defined here | | - | hidden type `{gen closure body@$DIR/generator_returned_from_fn.rs:43:21: 50:6}` captures the anonymous lifetime defined here + | hidden type `{gen closure body@...}` captures the anonymous lifetime defined here LL | iter! { move || { | _____________^ LL | | diff --git a/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.stderr b/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.stderr index c177c3bbf00be..7333c3b3bbaf0 100644 --- a/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.stderr +++ b/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.stderr @@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Sized` captures lifetime that does not appea LL | fn bar() -> impl for<'a> Trait<&'a (), Assoc = impl Sized> { | -- ---------- opaque type defined here | | - | hidden type ` Trait<&'a ()> as Trait<&'a ()>>::Assoc` captures the lifetime `'a` as defined here + | hidden type `<... as Trait<&'a ()>>::Assoc` captures the lifetime `'a` as defined here LL | foo() | ^^^^^ diff --git a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr index a9b0931499d95..78a84f5f5da66 100644 --- a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr +++ b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr @@ -8,7 +8,7 @@ LL | | LL | | .filter_map(|_| foo(src)) | |_________________________________^ | - = note: hidden type `FilterMap, {closure@$DIR/explicit-lifetime-suggestion-in-proper-span-issue-121267.rs:10:21: 10:24}>` captures lifetime `'_` + = note: hidden type `FilterMap, {closure@...}>` captures lifetime `'_` error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr index ab067f2439c67..ac4ba68aa36a6 100644 --- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr +++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr @@ -15,7 +15,7 @@ error[E0700]: hidden type for `impl FnOnce()` captures lifetime that does not ap LL | fn foo(g: G, dest: &mut T) -> impl FnOnce() | ------ ------------- opaque type defined here | | - | hidden type `{closure@$DIR/missing-lifetimes-in-signature.rs:19:5: 19:12}` captures the anonymous lifetime defined here + | hidden type `{closure@...}` captures the anonymous lifetime defined here ... LL | / move || { LL | | From 76519dc82370fe95af24c431fd4ea898f3203eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 9 Jul 2026 23:14:29 +0000 Subject: [PATCH 14/38] Make `Highlighted` take heed of `--verbose` --- .../infer/nice_region_error/placeholder_error.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs index 7a10b178cd588..7f452a578778d 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs @@ -53,7 +53,7 @@ where self.value.print(&mut p)?; let b = p.into_buffer(); - if b.len() <= 40 || !self.highlight.keep_regions { + if b.len() <= 40 || !self.highlight.keep_regions || self.tcx.sess.opts.verbose { // This is a short enough type that can be safely be printed to the user, or we aren't // showing the type with a particular interest in its lifetimes. f.write_str(&b)?; From 24c30fb0cec99cce808ed22582b403db1e4b20fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 10 Jul 2026 03:24:43 +0000 Subject: [PATCH 15/38] Account for `for<'a>` in ` Trait as Trait>` when shortening types --- compiler/rustc_middle/src/ty/print/pretty.rs | 18 +++++++++++++++++- .../higher-ranked-regions-diag.stderr | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 3a9e0e169f27c..30eb545835709 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -2363,6 +2363,22 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> { self.pretty_print_type(ty) } + ty::Alias(_, alias) + if self.should_truncate() + && let ty::AliasTyKind::Opaque { def_id } = alias.kind + && self.region_highlight_mode.keep_regions + && self + .tcx + .explicit_item_bounds(def_id) + .iter_instantiated_copied(self.tcx, alias.args) + .map(Unnormalized::skip_norm_wip) + .any(|(value, _)| value.has_bound_vars()) => + { + // ` Trait as Trait>` + self.printed_type_count += 1; + self.pretty_print_type(ty) + } + ty::Adt(..) | ty::Foreign(_) | ty::Pat(..) @@ -2388,7 +2404,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> { write!(self, "_")?; Ok(()) } - ty::Ref(r, ..) if self.should_truncate() && has_regions => self.pretty_print_type(ty), + ty::Ref(..) if self.should_truncate() && has_regions => self.pretty_print_type(ty), _ => { self.printed_type_count += 1; self.pretty_print_type(ty) diff --git a/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.stderr b/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.stderr index 7333c3b3bbaf0..c177c3bbf00be 100644 --- a/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.stderr +++ b/tests/ui/rfcs/impl-trait/higher-ranked-regions-diag.stderr @@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Sized` captures lifetime that does not appea LL | fn bar() -> impl for<'a> Trait<&'a (), Assoc = impl Sized> { | -- ---------- opaque type defined here | | - | hidden type `<... as Trait<&'a ()>>::Assoc` captures the lifetime `'a` as defined here + | hidden type ` Trait<&'a ()> as Trait<&'a ()>>::Assoc` captures the lifetime `'a` as defined here LL | foo() | ^^^^^ From e94c07ccc63de75090132248b8adb400fa2b5d59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 10 Jul 2026 03:57:21 +0000 Subject: [PATCH 16/38] Always show full signature on "`impl` doesn't match `trait`" error --- .../rustc_trait_selection/src/diagnostics.rs | 6 ++++-- .../nice_region_error/trait_impl_difference.rs | 18 ++++++++++++++++-- .../static-return-lifetime-infered.stderr | 4 ++-- .../self-without-lifetime-constraint.stderr | 4 ++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_trait_selection/src/diagnostics.rs b/compiler/rustc_trait_selection/src/diagnostics.rs index bb2614992adf2..44b5e669d5251 100644 --- a/compiler/rustc_trait_selection/src/diagnostics.rs +++ b/compiler/rustc_trait_selection/src/diagnostics.rs @@ -1203,9 +1203,9 @@ impl Subdiagnostic for ConsiderBorrowingParamHelp { #[diag("`impl` item signature doesn't match `trait` item signature")] pub(crate) struct TraitImplDiff { #[primary_span] - #[label("found `{$found}`")] + #[label("found `{$found_short}`")] pub sp: Span, - #[label("expected `{$expected}`")] + #[label("expected `{$expected_short}`")] pub trait_sp: Span, #[note( "expected signature `{$expected}` @@ -1218,6 +1218,8 @@ pub(crate) struct TraitImplDiff { "verify the lifetime relationships in the `trait` and `impl` between the `self` argument, the other inputs and its output" )] pub rel_help: bool, + pub expected_short: String, + pub found_short: String, pub expected: String, pub found: String, } diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs index eb0b9a0234275..f1be118896b01 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs @@ -84,7 +84,15 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { } let tcx = self.cx.tcx; - let expected_highlight = HighlightBuilder::build(tcx, expected); + let mut expected_highlight = HighlightBuilder::build(tcx, expected); + let expected_short = Highlighted { + highlight: expected_highlight, + ns: Namespace::TypeNS, + tcx, + value: expected, + } + .to_string(); + expected_highlight.keep_regions = false; let expected = Highlighted { highlight: expected_highlight, ns: Namespace::TypeNS, @@ -92,7 +100,11 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { value: expected, } .to_string(); - let found_highlight = HighlightBuilder::build(tcx, found); + let mut found_highlight = HighlightBuilder::build(tcx, found); + let found_short = + Highlighted { highlight: found_highlight, ns: Namespace::TypeNS, tcx, value: found } + .to_string(); + found_highlight.keep_regions = false; let found = Highlighted { highlight: found_highlight, ns: Namespace::TypeNS, tcx, value: found } .to_string(); @@ -121,6 +133,8 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { rel_help: visitor.types.is_empty(), expected, found, + expected_short, + found_short, }; let mut diag = self.tcx().dcx().create_err(diag); diff --git a/tests/ui/impl-trait/static-return-lifetime-infered.stderr b/tests/ui/impl-trait/static-return-lifetime-infered.stderr index 7bdab1da26560..8f2b4c7d26616 100644 --- a/tests/ui/impl-trait/static-return-lifetime-infered.stderr +++ b/tests/ui/impl-trait/static-return-lifetime-infered.stderr @@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn iter_values_anon(&self) -> impl Iterator { | ----- ----------------------- opaque type defined here | | - | hidden type `Map, {closure@...}>` captures the anonymous lifetime defined here + | hidden type `Map, {closure@...}>` captures the anonymous lifetime defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -19,7 +19,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn iter_values<'a>(&'a self) -> impl Iterator { | -- ----------------------- opaque type defined here | | - | hidden type `Map, {closure@...}>` captures the lifetime `'a` as defined here + | hidden type `Map, {closure@...}>` captures the lifetime `'a` as defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/traits/self-without-lifetime-constraint.stderr b/tests/ui/traits/self-without-lifetime-constraint.stderr index a7376e6cf9dc5..a82ff8eb0c269 100644 --- a/tests/ui/traits/self-without-lifetime-constraint.stderr +++ b/tests/ui/traits/self-without-lifetime-constraint.stderr @@ -7,8 +7,8 @@ LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult; LL | fn column_result(value: ValueRef<'_>) -> FromSqlResult<&str, &&str> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), _>` | - = note: expected signature `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), _>` - found signature `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), _>` + = note: expected signature `fn(ValueRef<'1>) -> Result<(&'2 str, &'1 &'2 str), FromSqlError>` + found signature `fn(ValueRef<'1>) -> Result<(&'1 str, &'1 &'1 str), FromSqlError>` help: the lifetime requirements from the `impl` do not correspond to the requirements in the `trait` --> $DIR/self-without-lifetime-constraint.rs:42:60 | From d228a8992d10c5bc4b1a3c5480f1baf4499e6df1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 10 Jul 2026 17:32:12 +0000 Subject: [PATCH 17/38] Tweak logic to refer to items by their name instead of path when shortening --- compiler/rustc_middle/src/ty/print/pretty.rs | 43 +++++++++++++++---- ...olved-typeck-results.no_assumptions.stderr | 4 +- ...ranked-auto-trait-15.no_assumptions.stderr | 4 +- .../higher-ranked-lifetime-error.stderr | 2 +- .../static-return-lifetime-infered.stderr | 4 +- ...ismatch-elided-lifetime-issue-65866.stderr | 8 ++-- ...gestion-in-proper-span-issue-121267.stderr | 2 +- 7 files changed, 47 insertions(+), 20 deletions(-) diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 30eb545835709..2d62c36c93376 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -2351,16 +2351,43 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> { } ty::Adt(def, args) - if args.types().next().is_none() - && args.consts().next().is_none() + if self.should_truncate() + && args.consts().count() < 2 && args.types().count() < 2 - && self.should_truncate() - && self.tcx.item_name(def.did()).as_str().len() < 5 => + && { + // We ensure that if there's at most a single type parameter and that type + // *doesn't* have any parameters, to avoid printing all the names in cases + // like `Foo>>`, instead truncating those always to + // `Foo<...>`. + if let Some(arg) = args.types().next() { + if let ty::Adt(_, arg_args) = arg.kind() { + if arg_args.consts().next().is_none() + && arg_args.types().next().is_none() + { + // Single param type with no type or const parameters: + // `Foo>`. + true + } else { + // Single param type with multiple type or const parameters: + // `Foo>`. We don't want to recurse into those, + // we'll replace the whole thing with `...`. + false + } + } else { + // Single type param that *isn't* a type with parameters, like a + // primitive: `Foo`. + true + } + } else { + // No type param: `Foo`. + true + } + } + && self.tcx.item_name(def.did()).as_str().len() < 7 => { - // Don't fully truncate types that have "short names" and at most one type param. - // FIXME: only mention the name instead of the path? - self.printed_type_count += 1; - self.pretty_print_type(ty) + // Don't fully truncate types that have "short names" and at most one type or const + // param. We do use the short path for them (only item name instad of full path). + with_forced_trimmed_paths!(self.pretty_print_type(ty)) } ty::Alias(_, alias) diff --git a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr index d5560bf892032..5a5bba352c69b 100644 --- a/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr +++ b/tests/ui/async-await/drop-tracking-unresolved-typeck-results.no_assumptions.stderr @@ -6,7 +6,7 @@ LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrde LL | | }); | |______^ implementation of `FnOnce` is not general enough | - = note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... + = note: `fn(&'0 ()) -> Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&(),)>` error: implementation of `FnOnce` is not general enough @@ -17,7 +17,7 @@ LL | | Next(&Buffered(Map(Empty(PhantomData), ready::<&()>), FuturesOrde LL | | }); | |______^ implementation of `FnOnce` is not general enough | - = note: `fn(&'0 ()) -> std::future::Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... + = note: `fn(&'0 ()) -> Ready<&'0 ()> {std::future::ready::<&'0 ()>}` must implement `FnOnce<(&'1 (),)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&(),)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr index 8f282b128c456..e8d1f585f0256 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr @@ -4,7 +4,7 @@ error: implementation of `FnOnce` is not general enough LL | require_send(future); | ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | - = note: closure with signature `fn(&'0 _) -> std::slice::Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... + = note: closure with signature `fn(&'0 _) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&Vec,)>` help: consider adding an explicit type annotation to the closure's argument | @@ -17,7 +17,7 @@ error: implementation of `FnOnce` is not general enough LL | require_send(future); | ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | - = note: closure with signature `fn(&'0 _) -> std::slice::Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... + = note: closure with signature `fn(&'0 _) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&Vec,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument diff --git a/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr b/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr index 85d95405745e8..2e3fd6123346f 100644 --- a/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr +++ b/tests/ui/higher-ranked/higher-ranked-lifetime-error.stderr @@ -4,7 +4,7 @@ error: implementation of `FnMut` is not general enough LL | assert_all::<_, &String>(id); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `FnMut` is not general enough | - = note: `for<'a> fn(&'a _) -> &'a _ {id}` must implement `FnMut<(&String,)>` + = note: `for<'a> fn(&'a String) -> &'a String {id}` must implement `FnMut<(&String,)>` = note: ...but it actually implements `FnMut<(&'0 String,)>`, for some specific lifetime `'0` error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/static-return-lifetime-infered.stderr b/tests/ui/impl-trait/static-return-lifetime-infered.stderr index 8f2b4c7d26616..093bd3d227527 100644 --- a/tests/ui/impl-trait/static-return-lifetime-infered.stderr +++ b/tests/ui/impl-trait/static-return-lifetime-infered.stderr @@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn iter_values_anon(&self) -> impl Iterator { | ----- ----------------------- opaque type defined here | | - | hidden type `Map, {closure@...}>` captures the anonymous lifetime defined here + | hidden type `Map, {closure@...}>` captures the anonymous lifetime defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -19,7 +19,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn iter_values<'a>(&'a self) -> impl Iterator { | -- ----------------------- opaque type defined here | | - | hidden type `Map, {closure@...}>` captures the lifetime `'a` as defined here + | hidden type `Map, {closure@...}>` captures the lifetime `'a` as defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr b/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr index db69b4f3656e6..4c4f6032b0f7b 100644 --- a/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr +++ b/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr @@ -2,10 +2,10 @@ error: `impl` item signature doesn't match `trait` item signature --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:17:9 | LL | fn bar(&self, r: &mut Re); - | -------------------------- expected `fn(&'1 plain::Foo, &'2 mut plain::Re<'3>)` + | -------------------------- expected `fn(&'1 Foo, &'2 mut Re<'3>)` ... LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 plain::Foo, &'2 mut plain::Re<'1>)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Foo, &'2 mut Re<'1>)` | = note: expected signature `fn(&'1 plain::Foo, &'2 mut plain::Re<'3>)` found signature `fn(&'1 plain::Foo, &'2 mut plain::Re<'1>)` @@ -21,10 +21,10 @@ error: `impl` item signature doesn't match `trait` item signature --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:40:9 | LL | fn bar(&self, r: &mut Re); - | ------------------------------ expected `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'3, u8>)` + | ------------------------------ expected `fn(&'1 Foo, &'2 mut Re<'3, u8>)` ... LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a, u8>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'1, u8>)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Foo, &'2 mut Re<'1, u8>)` | = note: expected signature `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'3, u8>)` found signature `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'1, u8>)` diff --git a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr index 78a84f5f5da66..e7751de6f51ab 100644 --- a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr +++ b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr @@ -8,7 +8,7 @@ LL | | LL | | .filter_map(|_| foo(src)) | |_________________________________^ | - = note: hidden type `FilterMap, {closure@...}>` captures lifetime `'_` + = note: hidden type `FilterMap, {closure@...}>` captures lifetime `'_` error: aborting due to 1 previous error From b8c0562ee14be2d8fc62cf49958647ace28594f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 12 Jul 2026 19:32:15 +0000 Subject: [PATCH 18/38] Fix typo --- compiler/rustc_middle/src/ty/print/pretty.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 2d62c36c93376..360708960c6ca 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -2386,7 +2386,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> { && self.tcx.item_name(def.did()).as_str().len() < 7 => { // Don't fully truncate types that have "short names" and at most one type or const - // param. We do use the short path for them (only item name instad of full path). + // param. We do use the short path for them (only item name instaed of full path). with_forced_trimmed_paths!(self.pretty_print_type(ty)) } From 23204b1e6e424e8784c3d6a345f7fa51a996ce9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 12 Jul 2026 19:49:45 +0000 Subject: [PATCH 19/38] address review comments --- compiler/rustc_middle/src/ty/print/pretty.rs | 6 +++--- .../higher-ranked-auto-trait-16.assumptions.stderr | 4 ++-- .../higher-ranked-auto-trait-16.no_assumptions.stderr | 4 ++-- tests/ui/borrowck/closure-upvar-named-lifetime.stderr | 4 ++-- ...ue-53432-nested-closure-outlives-borrowed-value.stderr | 2 +- .../issue-95079-missing-move-in-nested-closure.stderr | 2 +- tests/ui/c-variadic/not-async.stderr | 2 +- .../obligation-with-leaking-placeholders.current.stderr | 2 +- .../closures/wrong-closure-arg-suggestion-125325.stderr | 4 ++-- tests/ui/coercion/coerce-expect-unsized-ascribed.stderr | 6 +++--- tests/ui/coroutine/resume-arg-late-bound.stderr | 2 +- .../higher-ranked/relate-bound-region-ice-144033.stderr | 2 +- .../trait-bounds/hrtb-doesnt-borrow-self-2.stderr | 2 +- .../impl-trait/must_outlive_least_region_or_bound.stderr | 2 +- tests/ui/impl-trait/nested-return-type4.stderr | 2 +- tests/ui/impl-trait/static-return-lifetime-infered.stderr | 4 ++-- tests/ui/inference/note-and-explain-ReVar-124973.stderr | 2 +- tests/ui/iterators/generator_returned_from_fn.stderr | 4 ++-- tests/ui/limits/type-length-limit-enforcement.stderr | 2 +- .../dont-suggest-boxing-async-closure-body.stderr | 2 +- ...lifetime-suggestion-in-proper-span-issue-121267.stderr | 2 +- .../lifetimes/missing-lifetimes-in-signature.stderr | 2 +- tests/ui/suggestions/suggest-collect.stderr | 8 ++++---- tests/ui/typeck/return_type_containing_closure.rs | 2 +- tests/ui/typeck/return_type_containing_closure.stderr | 2 +- 25 files changed, 38 insertions(+), 38 deletions(-) diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 360708960c6ca..05bf4ab293229 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -900,7 +900,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { if !self.should_print_verbose() { write!(self, "{coroutine_kind}")?; if self.should_truncate() { - write!(self, "@...}}")?; + write!(self, "}}")?; return Ok(()); } else if coroutine_kind.is_fn_like() { // If we are printing an `async fn` coroutine type, then give the path @@ -968,7 +968,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { if !self.should_print_verbose() { write!(self, "closure")?; if self.should_truncate() { - write!(self, "@...}}")?; + write!(self, "}}")?; return Ok(()); } else { if let Some(did) = did.as_local() { @@ -1032,7 +1032,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { ), } if self.should_truncate() { - write!(self, "@...}}")?; + write!(self, "}}")?; return Ok(()); } else if let Some(did) = did.as_local() { if self.tcx().sess.opts.unstable_opts.span_free_formats { diff --git a/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr index dc6183a45cef5..5915d0d77b679 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr @@ -6,7 +6,7 @@ LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ implementation of `AsyncFnOnce` is not general enough | - = note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... + = note: `{async closure}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` error: implementation of `AsyncFnOnce` is not general enough @@ -17,7 +17,7 @@ LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ implementation of `AsyncFnOnce` is not general enough | - = note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... + = note: `{async closure}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr index dc6183a45cef5..5915d0d77b679 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr @@ -6,7 +6,7 @@ LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ implementation of `AsyncFnOnce` is not general enough | - = note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... + = note: `{async closure}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` error: implementation of `AsyncFnOnce` is not general enough @@ -17,7 +17,7 @@ LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ implementation of `AsyncFnOnce` is not general enough | - = note: `{async closure@...}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... + = note: `{async closure}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/borrowck/closure-upvar-named-lifetime.stderr b/tests/ui/borrowck/closure-upvar-named-lifetime.stderr index 7b90b07b2f985..a7e9f101fd6ec 100644 --- a/tests/ui/borrowck/closure-upvar-named-lifetime.stderr +++ b/tests/ui/borrowck/closure-upvar-named-lifetime.stderr @@ -39,7 +39,7 @@ error[E0700]: hidden type for `impl Fn(RefCell>)` captur --> $DIR/closure-upvar-named-lifetime.rs:17:5 | LL | fn apply<'a>( - | -- hidden type `{closure@...}` captures the lifetime `'a` as defined here + | -- hidden type `{closure}` captures the lifetime `'a` as defined here LL | f: Arc) + 'a>, LL | ) -> impl Fn(RefCell>) | ----------------------------------------- opaque type defined here @@ -92,7 +92,7 @@ error[E0700]: hidden type for `impl Fn(RefCell>)` captur --> $DIR/closure-upvar-named-lifetime.rs:32:5 | LL | fn apply_box<'a>( - | -- hidden type `{closure@...}` captures the lifetime `'a` as defined here + | -- hidden type `{closure}` captures the lifetime `'a` as defined here LL | f: Box) + 'a>, LL | ) -> impl Fn(RefCell>) | ----------------------------------------- opaque type defined here diff --git a/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr b/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr index 2fd84517a61bd..2204a4e449618 100644 --- a/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr +++ b/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr @@ -4,7 +4,7 @@ error: lifetime may not live long enough LL | let _action = move || { | ------- | | | - | | return type of closure `{closure@...}` contains a lifetime `'2` + | | return type of closure `{closure}` contains a lifetime `'2` | lifetime `'1` represents this closure's body LL | || f() // The `nested` closure | ^^^^^^ returning this value requires that `'1` must outlive `'2` diff --git a/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr index c43a983cbf365..a0ba7ba0c4877 100644 --- a/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr +++ b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr @@ -24,7 +24,7 @@ error: lifetime may not live long enough LL | move |()| s.chars().map(|c| format!("{}{}", c, s)) | --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` | | | - | | return type of closure `Map, {closure@...}>` contains a lifetime `'2` + | | return type of closure `Map, {closure}>` contains a lifetime `'2` | lifetime `'1` represents this closure's body | = note: closure implements `Fn`, so references to captured variables can't escape the closure diff --git a/tests/ui/c-variadic/not-async.stderr b/tests/ui/c-variadic/not-async.stderr index c6929b3676230..7f0b3e89cdb81 100644 --- a/tests/ui/c-variadic/not-async.stderr +++ b/tests/ui/c-variadic/not-async.stderr @@ -28,7 +28,7 @@ LL | async unsafe extern "C" fn method_cannot_be_async(x: isize, _: ...) {} | | | opaque type defined here | - = note: hidden type `{async fn body@...}` captures lifetime `'_` + = note: hidden type `{async fn body}` captures lifetime `'_` error: aborting due to 4 previous errors diff --git a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr index cdaa16ac9e807..af20c6b350cc2 100644 --- a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr +++ b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr @@ -8,7 +8,7 @@ LL | | x.to_string(); LL | | }); | |______^ implementation of `Foo` is not general enough | - = note: `Wrap<{closure@...}>` must implement `Foo<'0>`, for any lifetime `'0`... + = note: `Wrap<{closure}>` must implement `Foo<'0>`, for any lifetime `'0`... = note: ...but it actually implements `Foo<'1>`, for some specific lifetime `'1` error: aborting due to 1 previous error diff --git a/tests/ui/closures/wrong-closure-arg-suggestion-125325.stderr b/tests/ui/closures/wrong-closure-arg-suggestion-125325.stderr index 1b94d59901d22..7961efbdda8bf 100644 --- a/tests/ui/closures/wrong-closure-arg-suggestion-125325.stderr +++ b/tests/ui/closures/wrong-closure-arg-suggestion-125325.stderr @@ -43,7 +43,7 @@ error: lifetime may not live long enough LL | take(|_| to_fn(|_| self.counter += 1)); | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` | | | - | | return type of closure `aux::Map<{closure@...}>` contains a lifetime `'2` + | | return type of closure `aux::Map<{closure}>` contains a lifetime `'2` | lifetime `'1` represents this closure's body | = note: closure implements `Fn`, so references to captured variables can't escape the closure @@ -77,7 +77,7 @@ error: lifetime may not live long enough LL | P.flat_map(|_| P.map(|_| self.counter += 1)); | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` | | | - | | return type of closure `aux::Map<{closure@...}>` contains a lifetime `'2` + | | return type of closure `aux::Map<{closure}>` contains a lifetime `'2` | lifetime `'1` represents this closure's body | = note: closure implements `Fn`, so references to captured variables can't escape the closure diff --git a/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr b/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr index b682bdac0341d..9927bcf7b2072 100644 --- a/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr +++ b/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr @@ -29,7 +29,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:14:27 | LL | let _ = type_ascribe!(Box::new( { |x| (x as u8) }), Box _>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box u8>`, found `Box<{closure@...}>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box u8>`, found `Box<{closure}>` | = note: expected struct `Box u8>` found struct `Box<{closure@$DIR/coerce-expect-unsized-ascribed.rs:14:39: 14:42}>` @@ -85,7 +85,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:22:27 | LL | let _ = type_ascribe!(&{ |x| (x as u8) }, &dyn Fn(i32) -> _); - | ^^^^^^^^^^^^^^^^^^ expected `&dyn Fn(i32) -> u8`, found `&{closure@...}` + | ^^^^^^^^^^^^^^^^^^ expected `&dyn Fn(i32) -> u8`, found `&{closure}` | = note: expected reference `&dyn Fn(i32) -> u8` found reference `&{closure@$DIR/coerce-expect-unsized-ascribed.rs:22:30: 22:33}` @@ -123,7 +123,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:27:27 | LL | let _ = type_ascribe!(Box::new(|x| (x as u8)), Box _>); - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box u8>`, found `Box<{closure@...}>` + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box u8>`, found `Box<{closure}>` | = note: expected struct `Box u8>` found struct `Box<{closure@$DIR/coerce-expect-unsized-ascribed.rs:27:36: 27:39}>` diff --git a/tests/ui/coroutine/resume-arg-late-bound.stderr b/tests/ui/coroutine/resume-arg-late-bound.stderr index 0a6fb8dfcbb6c..dcd812ae4388b 100644 --- a/tests/ui/coroutine/resume-arg-late-bound.stderr +++ b/tests/ui/coroutine/resume-arg-late-bound.stderr @@ -4,7 +4,7 @@ error: implementation of `Coroutine` is not general enough LL | test(gen); | ^^^^^^^^^ implementation of `Coroutine` is not general enough | - = note: `{coroutine@...}` must implement `Coroutine<&'1 mut bool>`, for any lifetime `'1`... + = note: `{coroutine}` must implement `Coroutine<&'1 mut bool>`, for any lifetime `'1`... = note: ...but it actually implements `Coroutine<&'2 mut bool>`, for some specific lifetime `'2` error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/relate-bound-region-ice-144033.stderr b/tests/ui/higher-ranked/relate-bound-region-ice-144033.stderr index e9ec3e9dc0707..ec8cff940ac5b 100644 --- a/tests/ui/higher-ranked/relate-bound-region-ice-144033.stderr +++ b/tests/ui/higher-ranked/relate-bound-region-ice-144033.stderr @@ -35,7 +35,7 @@ LL | fn bar(self, _: I) LL | let collection = std::iter::empty::<()>().map(|_| &()); | --- the found closure LL | self.bar(collection) - | --- ^^^^^^^^^^ expected type parameter `I`, found `Map, {closure@...}>` + | --- ^^^^^^^^^^ expected type parameter `I`, found `Map, {closure}>` | | | arguments to this method are incorrect | diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr index 91e65b2b07318..886e102c6452f 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr @@ -1,4 +1,4 @@ -error[E0599]: the method `countx` exists for struct `Filter &u64 {identity::}>, {closure@...}>`, but its trait bounds were not satisfied +error[E0599]: the method `countx` exists for struct `Filter &u64 {identity::}>, {closure}>`, but its trait bounds were not satisfied --> $DIR/hrtb-doesnt-borrow-self-2.rs:112:24 | LL | pub struct Filter { diff --git a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr index 4a364c9eb0c6d..5fcbe2f557580 100644 --- a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr +++ b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr @@ -112,7 +112,7 @@ error[E0700]: hidden type for `impl Fn(&'a u32)` captures lifetime that does not LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) { | -- ---------------- opaque type defined here | | - | hidden type `{closure@...}` captures the lifetime `'b` as defined here + | hidden type `{closure}` captures the lifetime `'b` as defined here LL | move |_| println!("{}", y) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/impl-trait/nested-return-type4.stderr b/tests/ui/impl-trait/nested-return-type4.stderr index 63f3bfcdda950..cc35e1c8c4a31 100644 --- a/tests/ui/impl-trait/nested-return-type4.stderr +++ b/tests/ui/impl-trait/nested-return-type4.stderr @@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Future` captures lifeti LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future { | -- --------------------------------------------- opaque type defined here | | - | hidden type `{async block@...}` captures the lifetime `'s` as defined here + | hidden type `{async block}` captures the lifetime `'s` as defined here LL | async move { let _s = s; } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/impl-trait/static-return-lifetime-infered.stderr b/tests/ui/impl-trait/static-return-lifetime-infered.stderr index 093bd3d227527..17e975f9d19bf 100644 --- a/tests/ui/impl-trait/static-return-lifetime-infered.stderr +++ b/tests/ui/impl-trait/static-return-lifetime-infered.stderr @@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn iter_values_anon(&self) -> impl Iterator { | ----- ----------------------- opaque type defined here | | - | hidden type `Map, {closure@...}>` captures the anonymous lifetime defined here + | hidden type `Map, {closure}>` captures the anonymous lifetime defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -19,7 +19,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn iter_values<'a>(&'a self) -> impl Iterator { | -- ----------------------- opaque type defined here | | - | hidden type `Map, {closure@...}>` captures the lifetime `'a` as defined here + | hidden type `Map, {closure}>` captures the lifetime `'a` as defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/inference/note-and-explain-ReVar-124973.stderr b/tests/ui/inference/note-and-explain-ReVar-124973.stderr index fa5ba771980f4..d9a049eaa424e 100644 --- a/tests/ui/inference/note-and-explain-ReVar-124973.stderr +++ b/tests/ui/inference/note-and-explain-ReVar-124973.stderr @@ -12,7 +12,7 @@ LL | async unsafe extern "C" fn multiple_named_lifetimes<'a, 'b>(_: u8, _: ...) | | | opaque type defined here | - = note: hidden type `{async fn body@...}` captures lifetime `'_` + = note: hidden type `{async fn body}` captures lifetime `'_` error: aborting due to 2 previous errors diff --git a/tests/ui/iterators/generator_returned_from_fn.stderr b/tests/ui/iterators/generator_returned_from_fn.stderr index f4620b958f0c6..8b62790102e5c 100644 --- a/tests/ui/iterators/generator_returned_from_fn.stderr +++ b/tests/ui/iterators/generator_returned_from_fn.stderr @@ -28,7 +28,7 @@ error[E0700]: hidden type for `impl FnOnce() -> impl Iterator` captu LL | fn capture_move_once(a: &u32) -> impl FnOnce() -> impl Iterator { | ---- ------------------------------------------ opaque type defined here | | - | hidden type `{gen closure@...}` captures the anonymous lifetime defined here + | hidden type `{gen closure}` captures the anonymous lifetime defined here LL | iter! { move || { | _____________^ LL | | @@ -49,7 +49,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn capture_move_once(a: &u32) -> impl FnOnce() -> impl Iterator { | ---- ------------------------- opaque type defined here | | - | hidden type `{gen closure body@...}` captures the anonymous lifetime defined here + | hidden type `{gen closure body}` captures the anonymous lifetime defined here LL | iter! { move || { | _____________^ LL | | diff --git a/tests/ui/limits/type-length-limit-enforcement.stderr b/tests/ui/limits/type-length-limit-enforcement.stderr index 0313f212d3f7e..8ceca20c6abe0 100644 --- a/tests/ui/limits/type-length-limit-enforcement.stderr +++ b/tests/ui/limits/type-length-limit-enforcement.stderr @@ -8,7 +8,7 @@ LL | drop::>(None); = note: the full name for the type has been written to '$TEST_BUILD_DIR/type-length-limit-enforcement.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console -error: reached the type-length limit while instantiating `<{closure@...} as FnMut<()>>::call_mut` +error: reached the type-length limit while instantiating `<{closure} as FnMut<()>>::call_mut` | = help: consider adding a `#![type_length_limit="10"]` attribute to your crate = note: the full name for the type has been written to '$TEST_BUILD_DIR/type-length-limit-enforcement.long-type-$LONG_TYPE_HASH.txt' diff --git a/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr b/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr index 430432b99901e..50bc92c85b179 100644 --- a/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr +++ b/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr @@ -18,7 +18,7 @@ error[E0308]: mismatched types --> $DIR/dont-suggest-boxing-async-closure-body.rs:11:9 | LL | bar(async move || {}); - | --- ^^^^^^^^^^^^^^^^ expected `Box _>`, found `{async closure@...}` + | --- ^^^^^^^^^^^^^^^^ expected `Box _>`, found `{async closure}` | | | arguments to this function are incorrect | diff --git a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr index e7751de6f51ab..6d1bc74e4bd66 100644 --- a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr +++ b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr @@ -8,7 +8,7 @@ LL | | LL | | .filter_map(|_| foo(src)) | |_________________________________^ | - = note: hidden type `FilterMap, {closure@...}>` captures lifetime `'_` + = note: hidden type `FilterMap, {closure}>` captures lifetime `'_` error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr index ac4ba68aa36a6..26115c749383f 100644 --- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr +++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr @@ -15,7 +15,7 @@ error[E0700]: hidden type for `impl FnOnce()` captures lifetime that does not ap LL | fn foo(g: G, dest: &mut T) -> impl FnOnce() | ------ ------------- opaque type defined here | | - | hidden type `{closure@...}` captures the anonymous lifetime defined here + | hidden type `{closure}` captures the anonymous lifetime defined here ... LL | / move || { LL | | diff --git a/tests/ui/suggestions/suggest-collect.stderr b/tests/ui/suggestions/suggest-collect.stderr index a7bca2bbcaa7b..d053166817072 100644 --- a/tests/ui/suggestions/suggest-collect.stderr +++ b/tests/ui/suggestions/suggest-collect.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/suggest-collect.rs:2:22 | LL | let _x: String = "hello".chars().map(|c| c); - | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `String`, found `Map, {closure@...}>` + | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `String`, found `Map, {closure}>` | | | expected due to this | @@ -17,7 +17,7 @@ error[E0308]: mismatched types --> $DIR/suggest-collect.rs:6:24 | LL | let _y: Vec = vec![1, 2, 3].into_iter().map(|x| x); - | -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Vec`, found `Map, {closure@...}>` + | -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Vec`, found `Map, {closure}>` | | | expected due to this | @@ -32,7 +32,7 @@ error[E0308]: mismatched types --> $DIR/suggest-collect.rs:10:36 | LL | let res: Result, _> = ["1", "2"].into_iter().map(|s| s.parse::()); - | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Result, _>`, found `Map, {closure@...}>` + | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Result, _>`, found `Map, {closure}>` | | | expected due to this | @@ -47,7 +47,7 @@ error[E0308]: mismatched types --> $DIR/suggest-collect.rs:13:40 | LL | let (a, b): (Vec, Vec) = vec![1, 2].into_iter().map(|x| (x, x)); - | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(Vec, Vec)`, found `Map, {closure@...}>` + | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(Vec, Vec)`, found `Map, {closure}>` | | | expected due to this | diff --git a/tests/ui/typeck/return_type_containing_closure.rs b/tests/ui/typeck/return_type_containing_closure.rs index a9bb89bae2d6a..6ac7ca2296001 100644 --- a/tests/ui/typeck/return_type_containing_closure.rs +++ b/tests/ui/typeck/return_type_containing_closure.rs @@ -2,7 +2,7 @@ fn foo() { //~ HELP try adding a return type vec!['a'].iter().map(|c| c) //~^ ERROR mismatched types [E0308] - //~| NOTE expected `()`, found `Map, {closure@...}>` + //~| NOTE expected `()`, found `Map, {closure}>` //~| NOTE expected unit type `()` //~| HELP consider using a semicolon here } diff --git a/tests/ui/typeck/return_type_containing_closure.stderr b/tests/ui/typeck/return_type_containing_closure.stderr index a60bf79a57b8a..075f131dcdf19 100644 --- a/tests/ui/typeck/return_type_containing_closure.stderr +++ b/tests/ui/typeck/return_type_containing_closure.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/return_type_containing_closure.rs:3:5 | LL | vec!['a'].iter().map(|c| c) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Map, {closure@...}>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Map, {closure}>` | = note: expected unit type `()` found struct `Map, {closure@$DIR/return_type_containing_closure.rs:3:26: 3:29}>` From ec430cbf951955236999e8243cb595339f154b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 12 Jul 2026 22:00:38 +0000 Subject: [PATCH 20/38] tidy --- compiler/rustc_middle/src/ty/print/pretty.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 05bf4ab293229..6fd3255b46b54 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -2386,7 +2386,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> { && self.tcx.item_name(def.did()).as_str().len() < 7 => { // Don't fully truncate types that have "short names" and at most one type or const - // param. We do use the short path for them (only item name instaed of full path). + // param. We do use the short path for them (only item name instead of full path). with_forced_trimmed_paths!(self.pretty_print_type(ty)) } From fa69dbd44b810e312df4f613a48e052bf10d5c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 13 Jul 2026 17:06:19 +0000 Subject: [PATCH 21/38] Do not change closure short type rendering --- compiler/rustc_middle/src/ty/print/pretty.rs | 12 +++--------- .../higher-ranked-auto-trait-16.assumptions.stderr | 4 ++-- ...higher-ranked-auto-trait-16.no_assumptions.stderr | 4 ++-- .../ui/borrowck/closure-upvar-named-lifetime.stderr | 4 ++-- ...432-nested-closure-outlives-borrowed-value.stderr | 2 +- ...issue-95079-missing-move-in-nested-closure.stderr | 2 +- tests/ui/c-variadic/not-async.stderr | 2 +- ...ligation-with-leaking-placeholders.current.stderr | 2 +- .../wrong-closure-arg-suggestion-125325.stderr | 4 ++-- .../coercion/coerce-expect-unsized-ascribed.stderr | 6 +++--- tests/ui/coroutine/resume-arg-late-bound.stderr | 2 +- .../relate-bound-region-ice-144033.stderr | 2 +- .../trait-bounds/hrtb-doesnt-borrow-self-2.stderr | 2 +- .../must_outlive_least_region_or_bound.stderr | 2 +- tests/ui/impl-trait/nested-return-type4.stderr | 2 +- .../impl-trait/static-return-lifetime-infered.stderr | 4 ++-- .../inference/note-and-explain-ReVar-124973.stderr | 2 +- tests/ui/iterators/generator_returned_from_fn.stderr | 4 ++-- tests/ui/limits/type-length-limit-enforcement.stderr | 2 +- .../dont-suggest-boxing-async-closure-body.stderr | 2 +- ...ime-suggestion-in-proper-span-issue-121267.stderr | 2 +- .../lifetimes/missing-lifetimes-in-signature.stderr | 2 +- tests/ui/suggestions/suggest-collect.stderr | 8 ++++---- tests/ui/typeck/return_type_containing_closure.rs | 2 +- .../ui/typeck/return_type_containing_closure.stderr | 2 +- 25 files changed, 38 insertions(+), 44 deletions(-) diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 6fd3255b46b54..f336e4ce9af24 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -899,10 +899,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { if !self.should_print_verbose() { write!(self, "{coroutine_kind}")?; - if self.should_truncate() { - write!(self, "}}")?; - return Ok(()); - } else if coroutine_kind.is_fn_like() { + if coroutine_kind.is_fn_like() { // If we are printing an `async fn` coroutine type, then give the path // of the fn, instead of its span, because that will in most cases be // more helpful for the reader than just a source location. @@ -968,7 +965,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { if !self.should_print_verbose() { write!(self, "closure")?; if self.should_truncate() { - write!(self, "}}")?; + write!(self, "@...}}")?; return Ok(()); } else { if let Some(did) = did.as_local() { @@ -1031,10 +1028,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { "coroutine from coroutine-closure should have CoroutineSource::Closure" ), } - if self.should_truncate() { - write!(self, "}}")?; - return Ok(()); - } else if let Some(did) = did.as_local() { + if let Some(did) = did.as_local() { if self.tcx().sess.opts.unstable_opts.span_free_formats { write!(self, "@")?; self.print_def_path(did.to_def_id(), args)?; diff --git a/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr index 5915d0d77b679..412c31b1bd843 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-16.assumptions.stderr @@ -6,7 +6,7 @@ LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ implementation of `AsyncFnOnce` is not general enough | - = note: `{async closure}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... + = note: `{async closure@$DIR/higher-ranked-auto-trait-16.rs:19:33: 19:42}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` error: implementation of `AsyncFnOnce` is not general enough @@ -17,7 +17,7 @@ LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ implementation of `AsyncFnOnce` is not general enough | - = note: `{async closure}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... + = note: `{async closure@$DIR/higher-ranked-auto-trait-16.rs:19:33: 19:42}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr index 5915d0d77b679..412c31b1bd843 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-16.no_assumptions.stderr @@ -6,7 +6,7 @@ LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ implementation of `AsyncFnOnce` is not general enough | - = note: `{async closure}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... + = note: `{async closure@$DIR/higher-ranked-auto-trait-16.rs:19:33: 19:42}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` error: implementation of `AsyncFnOnce` is not general enough @@ -17,7 +17,7 @@ LL | | commit_if_ok(&mut ctxt, async |_| todo!()).await; LL | | }); | |______^ implementation of `AsyncFnOnce` is not general enough | - = note: `{async closure}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... + = note: `{async closure@$DIR/higher-ranked-auto-trait-16.rs:19:33: 19:42}` must implement `AsyncFnOnce<(&mut Ctxt<'1>,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `AsyncFnOnce<(&mut Ctxt<'_>,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` diff --git a/tests/ui/borrowck/closure-upvar-named-lifetime.stderr b/tests/ui/borrowck/closure-upvar-named-lifetime.stderr index a7e9f101fd6ec..7b90b07b2f985 100644 --- a/tests/ui/borrowck/closure-upvar-named-lifetime.stderr +++ b/tests/ui/borrowck/closure-upvar-named-lifetime.stderr @@ -39,7 +39,7 @@ error[E0700]: hidden type for `impl Fn(RefCell>)` captur --> $DIR/closure-upvar-named-lifetime.rs:17:5 | LL | fn apply<'a>( - | -- hidden type `{closure}` captures the lifetime `'a` as defined here + | -- hidden type `{closure@...}` captures the lifetime `'a` as defined here LL | f: Arc) + 'a>, LL | ) -> impl Fn(RefCell>) | ----------------------------------------- opaque type defined here @@ -92,7 +92,7 @@ error[E0700]: hidden type for `impl Fn(RefCell>)` captur --> $DIR/closure-upvar-named-lifetime.rs:32:5 | LL | fn apply_box<'a>( - | -- hidden type `{closure}` captures the lifetime `'a` as defined here + | -- hidden type `{closure@...}` captures the lifetime `'a` as defined here LL | f: Box) + 'a>, LL | ) -> impl Fn(RefCell>) | ----------------------------------------- opaque type defined here diff --git a/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr b/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr index 2204a4e449618..2fd84517a61bd 100644 --- a/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr +++ b/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr @@ -4,7 +4,7 @@ error: lifetime may not live long enough LL | let _action = move || { | ------- | | | - | | return type of closure `{closure}` contains a lifetime `'2` + | | return type of closure `{closure@...}` contains a lifetime `'2` | lifetime `'1` represents this closure's body LL | || f() // The `nested` closure | ^^^^^^ returning this value requires that `'1` must outlive `'2` diff --git a/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr index a0ba7ba0c4877..c43a983cbf365 100644 --- a/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr +++ b/tests/ui/borrowck/issue-95079-missing-move-in-nested-closure.stderr @@ -24,7 +24,7 @@ error: lifetime may not live long enough LL | move |()| s.chars().map(|c| format!("{}{}", c, s)) | --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` | | | - | | return type of closure `Map, {closure}>` contains a lifetime `'2` + | | return type of closure `Map, {closure@...}>` contains a lifetime `'2` | lifetime `'1` represents this closure's body | = note: closure implements `Fn`, so references to captured variables can't escape the closure diff --git a/tests/ui/c-variadic/not-async.stderr b/tests/ui/c-variadic/not-async.stderr index 7f0b3e89cdb81..bb8cc64e15fa4 100644 --- a/tests/ui/c-variadic/not-async.stderr +++ b/tests/ui/c-variadic/not-async.stderr @@ -28,7 +28,7 @@ LL | async unsafe extern "C" fn method_cannot_be_async(x: isize, _: ...) {} | | | opaque type defined here | - = note: hidden type `{async fn body}` captures lifetime `'_` + = note: hidden type `{async fn body of S::method_cannot_be_async()}` captures lifetime `'_` error: aborting due to 4 previous errors diff --git a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr index af20c6b350cc2..cdaa16ac9e807 100644 --- a/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr +++ b/tests/ui/closures/deduce-signature/obligation-with-leaking-placeholders.current.stderr @@ -8,7 +8,7 @@ LL | | x.to_string(); LL | | }); | |______^ implementation of `Foo` is not general enough | - = note: `Wrap<{closure}>` must implement `Foo<'0>`, for any lifetime `'0`... + = note: `Wrap<{closure@...}>` must implement `Foo<'0>`, for any lifetime `'0`... = note: ...but it actually implements `Foo<'1>`, for some specific lifetime `'1` error: aborting due to 1 previous error diff --git a/tests/ui/closures/wrong-closure-arg-suggestion-125325.stderr b/tests/ui/closures/wrong-closure-arg-suggestion-125325.stderr index 7961efbdda8bf..1b94d59901d22 100644 --- a/tests/ui/closures/wrong-closure-arg-suggestion-125325.stderr +++ b/tests/ui/closures/wrong-closure-arg-suggestion-125325.stderr @@ -43,7 +43,7 @@ error: lifetime may not live long enough LL | take(|_| to_fn(|_| self.counter += 1)); | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` | | | - | | return type of closure `aux::Map<{closure}>` contains a lifetime `'2` + | | return type of closure `aux::Map<{closure@...}>` contains a lifetime `'2` | lifetime `'1` represents this closure's body | = note: closure implements `Fn`, so references to captured variables can't escape the closure @@ -77,7 +77,7 @@ error: lifetime may not live long enough LL | P.flat_map(|_| P.map(|_| self.counter += 1)); | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` | | | - | | return type of closure `aux::Map<{closure}>` contains a lifetime `'2` + | | return type of closure `aux::Map<{closure@...}>` contains a lifetime `'2` | lifetime `'1` represents this closure's body | = note: closure implements `Fn`, so references to captured variables can't escape the closure diff --git a/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr b/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr index 9927bcf7b2072..b682bdac0341d 100644 --- a/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr +++ b/tests/ui/coercion/coerce-expect-unsized-ascribed.stderr @@ -29,7 +29,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:14:27 | LL | let _ = type_ascribe!(Box::new( { |x| (x as u8) }), Box _>); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box u8>`, found `Box<{closure}>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box u8>`, found `Box<{closure@...}>` | = note: expected struct `Box u8>` found struct `Box<{closure@$DIR/coerce-expect-unsized-ascribed.rs:14:39: 14:42}>` @@ -85,7 +85,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:22:27 | LL | let _ = type_ascribe!(&{ |x| (x as u8) }, &dyn Fn(i32) -> _); - | ^^^^^^^^^^^^^^^^^^ expected `&dyn Fn(i32) -> u8`, found `&{closure}` + | ^^^^^^^^^^^^^^^^^^ expected `&dyn Fn(i32) -> u8`, found `&{closure@...}` | = note: expected reference `&dyn Fn(i32) -> u8` found reference `&{closure@$DIR/coerce-expect-unsized-ascribed.rs:22:30: 22:33}` @@ -123,7 +123,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:27:27 | LL | let _ = type_ascribe!(Box::new(|x| (x as u8)), Box _>); - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box u8>`, found `Box<{closure}>` + | ^^^^^^^^^^^^^^^^^^^^^^^ expected `Box u8>`, found `Box<{closure@...}>` | = note: expected struct `Box u8>` found struct `Box<{closure@$DIR/coerce-expect-unsized-ascribed.rs:27:36: 27:39}>` diff --git a/tests/ui/coroutine/resume-arg-late-bound.stderr b/tests/ui/coroutine/resume-arg-late-bound.stderr index dcd812ae4388b..646abaf4f7bde 100644 --- a/tests/ui/coroutine/resume-arg-late-bound.stderr +++ b/tests/ui/coroutine/resume-arg-late-bound.stderr @@ -4,7 +4,7 @@ error: implementation of `Coroutine` is not general enough LL | test(gen); | ^^^^^^^^^ implementation of `Coroutine` is not general enough | - = note: `{coroutine}` must implement `Coroutine<&'1 mut bool>`, for any lifetime `'1`... + = note: `{coroutine@$DIR/resume-arg-late-bound.rs:11:28: 11:44}` must implement `Coroutine<&'1 mut bool>`, for any lifetime `'1`... = note: ...but it actually implements `Coroutine<&'2 mut bool>`, for some specific lifetime `'2` error: aborting due to 1 previous error diff --git a/tests/ui/higher-ranked/relate-bound-region-ice-144033.stderr b/tests/ui/higher-ranked/relate-bound-region-ice-144033.stderr index ec8cff940ac5b..e9ec3e9dc0707 100644 --- a/tests/ui/higher-ranked/relate-bound-region-ice-144033.stderr +++ b/tests/ui/higher-ranked/relate-bound-region-ice-144033.stderr @@ -35,7 +35,7 @@ LL | fn bar(self, _: I) LL | let collection = std::iter::empty::<()>().map(|_| &()); | --- the found closure LL | self.bar(collection) - | --- ^^^^^^^^^^ expected type parameter `I`, found `Map, {closure}>` + | --- ^^^^^^^^^^ expected type parameter `I`, found `Map, {closure@...}>` | | | arguments to this method are incorrect | diff --git a/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr index 886e102c6452f..91e65b2b07318 100644 --- a/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr +++ b/tests/ui/higher-ranked/trait-bounds/hrtb-doesnt-borrow-self-2.stderr @@ -1,4 +1,4 @@ -error[E0599]: the method `countx` exists for struct `Filter &u64 {identity::}>, {closure}>`, but its trait bounds were not satisfied +error[E0599]: the method `countx` exists for struct `Filter &u64 {identity::}>, {closure@...}>`, but its trait bounds were not satisfied --> $DIR/hrtb-doesnt-borrow-self-2.rs:112:24 | LL | pub struct Filter { diff --git a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr index 5fcbe2f557580..4a364c9eb0c6d 100644 --- a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr +++ b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr @@ -112,7 +112,7 @@ error[E0700]: hidden type for `impl Fn(&'a u32)` captures lifetime that does not LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) { | -- ---------------- opaque type defined here | | - | hidden type `{closure}` captures the lifetime `'b` as defined here + | hidden type `{closure@...}` captures the lifetime `'b` as defined here LL | move |_| println!("{}", y) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/impl-trait/nested-return-type4.stderr b/tests/ui/impl-trait/nested-return-type4.stderr index cc35e1c8c4a31..407800eff1894 100644 --- a/tests/ui/impl-trait/nested-return-type4.stderr +++ b/tests/ui/impl-trait/nested-return-type4.stderr @@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Future` captures lifeti LL | fn test<'s: 's>(s: &'s str) -> impl std::future::Future { | -- --------------------------------------------- opaque type defined here | | - | hidden type `{async block}` captures the lifetime `'s` as defined here + | hidden type `{async block@$DIR/nested-return-type4.rs:4:5: 4:15}` captures the lifetime `'s` as defined here LL | async move { let _s = s; } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/impl-trait/static-return-lifetime-infered.stderr b/tests/ui/impl-trait/static-return-lifetime-infered.stderr index 17e975f9d19bf..093bd3d227527 100644 --- a/tests/ui/impl-trait/static-return-lifetime-infered.stderr +++ b/tests/ui/impl-trait/static-return-lifetime-infered.stderr @@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn iter_values_anon(&self) -> impl Iterator { | ----- ----------------------- opaque type defined here | | - | hidden type `Map, {closure}>` captures the anonymous lifetime defined here + | hidden type `Map, {closure@...}>` captures the anonymous lifetime defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -19,7 +19,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn iter_values<'a>(&'a self) -> impl Iterator { | -- ----------------------- opaque type defined here | | - | hidden type `Map, {closure}>` captures the lifetime `'a` as defined here + | hidden type `Map, {closure@...}>` captures the lifetime `'a` as defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/inference/note-and-explain-ReVar-124973.stderr b/tests/ui/inference/note-and-explain-ReVar-124973.stderr index d9a049eaa424e..2b5e79e9a1c64 100644 --- a/tests/ui/inference/note-and-explain-ReVar-124973.stderr +++ b/tests/ui/inference/note-and-explain-ReVar-124973.stderr @@ -12,7 +12,7 @@ LL | async unsafe extern "C" fn multiple_named_lifetimes<'a, 'b>(_: u8, _: ...) | | | opaque type defined here | - = note: hidden type `{async fn body}` captures lifetime `'_` + = note: hidden type `{async fn body of multiple_named_lifetimes<'a, 'b>()}` captures lifetime `'_` error: aborting due to 2 previous errors diff --git a/tests/ui/iterators/generator_returned_from_fn.stderr b/tests/ui/iterators/generator_returned_from_fn.stderr index 8b62790102e5c..8bec119ddbc01 100644 --- a/tests/ui/iterators/generator_returned_from_fn.stderr +++ b/tests/ui/iterators/generator_returned_from_fn.stderr @@ -28,7 +28,7 @@ error[E0700]: hidden type for `impl FnOnce() -> impl Iterator` captu LL | fn capture_move_once(a: &u32) -> impl FnOnce() -> impl Iterator { | ---- ------------------------------------------ opaque type defined here | | - | hidden type `{gen closure}` captures the anonymous lifetime defined here + | hidden type `{gen closure@$DIR/generator_returned_from_fn.rs:43:13: 43:20}` captures the anonymous lifetime defined here LL | iter! { move || { | _____________^ LL | | @@ -49,7 +49,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn capture_move_once(a: &u32) -> impl FnOnce() -> impl Iterator { | ---- ------------------------- opaque type defined here | | - | hidden type `{gen closure body}` captures the anonymous lifetime defined here + | hidden type `{gen closure body@$DIR/generator_returned_from_fn.rs:43:21: 50:6}` captures the anonymous lifetime defined here LL | iter! { move || { | _____________^ LL | | diff --git a/tests/ui/limits/type-length-limit-enforcement.stderr b/tests/ui/limits/type-length-limit-enforcement.stderr index 8ceca20c6abe0..0313f212d3f7e 100644 --- a/tests/ui/limits/type-length-limit-enforcement.stderr +++ b/tests/ui/limits/type-length-limit-enforcement.stderr @@ -8,7 +8,7 @@ LL | drop::>(None); = note: the full name for the type has been written to '$TEST_BUILD_DIR/type-length-limit-enforcement.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console -error: reached the type-length limit while instantiating `<{closure} as FnMut<()>>::call_mut` +error: reached the type-length limit while instantiating `<{closure@...} as FnMut<()>>::call_mut` | = help: consider adding a `#![type_length_limit="10"]` attribute to your crate = note: the full name for the type has been written to '$TEST_BUILD_DIR/type-length-limit-enforcement.long-type-$LONG_TYPE_HASH.txt' diff --git a/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr b/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr index 50bc92c85b179..abf8e2d824b5d 100644 --- a/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr +++ b/tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr @@ -18,7 +18,7 @@ error[E0308]: mismatched types --> $DIR/dont-suggest-boxing-async-closure-body.rs:11:9 | LL | bar(async move || {}); - | --- ^^^^^^^^^^^^^^^^ expected `Box _>`, found `{async closure}` + | --- ^^^^^^^^^^^^^^^^ expected `Box _>`, found `{async closure@dont-suggest-boxing-async-closure-body.rs:11:9}` | | | arguments to this function are incorrect | diff --git a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr index 6d1bc74e4bd66..e7751de6f51ab 100644 --- a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr +++ b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr @@ -8,7 +8,7 @@ LL | | LL | | .filter_map(|_| foo(src)) | |_________________________________^ | - = note: hidden type `FilterMap, {closure}>` captures lifetime `'_` + = note: hidden type `FilterMap, {closure@...}>` captures lifetime `'_` error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr index 26115c749383f..ac4ba68aa36a6 100644 --- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr +++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr @@ -15,7 +15,7 @@ error[E0700]: hidden type for `impl FnOnce()` captures lifetime that does not ap LL | fn foo(g: G, dest: &mut T) -> impl FnOnce() | ------ ------------- opaque type defined here | | - | hidden type `{closure}` captures the anonymous lifetime defined here + | hidden type `{closure@...}` captures the anonymous lifetime defined here ... LL | / move || { LL | | diff --git a/tests/ui/suggestions/suggest-collect.stderr b/tests/ui/suggestions/suggest-collect.stderr index d053166817072..a7bca2bbcaa7b 100644 --- a/tests/ui/suggestions/suggest-collect.stderr +++ b/tests/ui/suggestions/suggest-collect.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/suggest-collect.rs:2:22 | LL | let _x: String = "hello".chars().map(|c| c); - | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `String`, found `Map, {closure}>` + | ------ ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `String`, found `Map, {closure@...}>` | | | expected due to this | @@ -17,7 +17,7 @@ error[E0308]: mismatched types --> $DIR/suggest-collect.rs:6:24 | LL | let _y: Vec = vec![1, 2, 3].into_iter().map(|x| x); - | -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Vec`, found `Map, {closure}>` + | -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Vec`, found `Map, {closure@...}>` | | | expected due to this | @@ -32,7 +32,7 @@ error[E0308]: mismatched types --> $DIR/suggest-collect.rs:10:36 | LL | let res: Result, _> = ["1", "2"].into_iter().map(|s| s.parse::()); - | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Result, _>`, found `Map, {closure}>` + | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Result, _>`, found `Map, {closure@...}>` | | | expected due to this | @@ -47,7 +47,7 @@ error[E0308]: mismatched types --> $DIR/suggest-collect.rs:13:40 | LL | let (a, b): (Vec, Vec) = vec![1, 2].into_iter().map(|x| (x, x)); - | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(Vec, Vec)`, found `Map, {closure}>` + | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(Vec, Vec)`, found `Map, {closure@...}>` | | | expected due to this | diff --git a/tests/ui/typeck/return_type_containing_closure.rs b/tests/ui/typeck/return_type_containing_closure.rs index 6ac7ca2296001..a9bb89bae2d6a 100644 --- a/tests/ui/typeck/return_type_containing_closure.rs +++ b/tests/ui/typeck/return_type_containing_closure.rs @@ -2,7 +2,7 @@ fn foo() { //~ HELP try adding a return type vec!['a'].iter().map(|c| c) //~^ ERROR mismatched types [E0308] - //~| NOTE expected `()`, found `Map, {closure}>` + //~| NOTE expected `()`, found `Map, {closure@...}>` //~| NOTE expected unit type `()` //~| HELP consider using a semicolon here } diff --git a/tests/ui/typeck/return_type_containing_closure.stderr b/tests/ui/typeck/return_type_containing_closure.stderr index 075f131dcdf19..a60bf79a57b8a 100644 --- a/tests/ui/typeck/return_type_containing_closure.stderr +++ b/tests/ui/typeck/return_type_containing_closure.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/return_type_containing_closure.rs:3:5 | LL | vec!['a'].iter().map(|c| c) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Map, {closure}>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Map, {closure@...}>` | = note: expected unit type `()` found struct `Map, {closure@$DIR/return_type_containing_closure.rs:3:26: 3:29}>` From 247cf33cfad65ac56d9bd85678569cce6c227398 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 13 Jul 2026 18:25:58 +0000 Subject: [PATCH 22/38] Add missing backticks --- compiler/rustc_borrowck/src/diagnostics/region_name.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/region_name.rs b/compiler/rustc_borrowck/src/diagnostics/region_name.rs index 0e07de31c2baa..57fd18107a414 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_name.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_name.rs @@ -147,7 +147,7 @@ impl RegionName { )) => { diag.span_label( *span, - format!("lifetime `{self}` appears in the type {type_name}"), + format!("lifetime `{self}` appears in the type `{type_name}`"), ); } RegionNameSource::AnonRegionFromOutput( From f43dbc203811e7e934def76dc1c966d76f44f96a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 13 Jul 2026 18:36:36 +0000 Subject: [PATCH 23/38] Shorten `Highlighted` types when looking at regions, but never shorten the *root* type This means that when we encounter a closure, we never hide it's path from the rendering, but if the closure is in a type parameter, it will get shortened. This should be fine for most lifetime errors to be understandable. --- .../infer/nice_region_error/placeholder_error.rs | 2 +- .../higher-ranked-auto-trait-15.no_assumptions.stderr | 4 ++-- tests/ui/borrowck/closure-upvar-named-lifetime.stderr | 4 ++-- ...ue-53432-nested-closure-outlives-borrowed-value.stderr | 2 +- .../impl-trait/must_outlive_least_region_or_bound.stderr | 2 +- tests/ui/impl-trait/static-return-lifetime-infered.stderr | 4 ++-- ...trait-impl-mismatch-elided-lifetime-issue-65866.stderr | 8 ++++---- ...lifetime-suggestion-in-proper-span-issue-121267.stderr | 2 +- .../lifetimes/missing-lifetimes-in-signature.stderr | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs index 7f452a578778d..caa109d9e1d66 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs @@ -60,7 +60,7 @@ where } else { // We are highlighting lifetimes in the output, we will print out the smallest possible // portion of the type while keeping the lifetimes visible. - let mut p = FmtPrinter::new_with_limit(self.tcx, self.ns, Limit(0)); + let mut p = FmtPrinter::new_with_limit(self.tcx, self.ns, Limit(1)); p.region_highlight_mode = self.highlight; self.value.print(&mut p).expect("could not print type"); let x = p.into_buffer(); diff --git a/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr index e8d1f585f0256..274108ef503d4 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr @@ -4,7 +4,7 @@ error: implementation of `FnOnce` is not general enough LL | require_send(future); | ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | - = note: closure with signature `fn(&'0 _) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... + = note: closure with signature `fn(&'0 Vec) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&Vec,)>` help: consider adding an explicit type annotation to the closure's argument | @@ -17,7 +17,7 @@ error: implementation of `FnOnce` is not general enough LL | require_send(future); | ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | - = note: closure with signature `fn(&'0 _) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... + = note: closure with signature `fn(&'0 Vec) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&Vec,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument diff --git a/tests/ui/borrowck/closure-upvar-named-lifetime.stderr b/tests/ui/borrowck/closure-upvar-named-lifetime.stderr index 7b90b07b2f985..fc7c59fa97c89 100644 --- a/tests/ui/borrowck/closure-upvar-named-lifetime.stderr +++ b/tests/ui/borrowck/closure-upvar-named-lifetime.stderr @@ -39,7 +39,7 @@ error[E0700]: hidden type for `impl Fn(RefCell>)` captur --> $DIR/closure-upvar-named-lifetime.rs:17:5 | LL | fn apply<'a>( - | -- hidden type `{closure@...}` captures the lifetime `'a` as defined here + | -- hidden type `{closure@$DIR/closure-upvar-named-lifetime.rs:17:5: 17:15}` captures the lifetime `'a` as defined here LL | f: Arc) + 'a>, LL | ) -> impl Fn(RefCell>) | ----------------------------------------- opaque type defined here @@ -92,7 +92,7 @@ error[E0700]: hidden type for `impl Fn(RefCell>)` captur --> $DIR/closure-upvar-named-lifetime.rs:32:5 | LL | fn apply_box<'a>( - | -- hidden type `{closure@...}` captures the lifetime `'a` as defined here + | -- hidden type `{closure@$DIR/closure-upvar-named-lifetime.rs:32:5: 32:15}` captures the lifetime `'a` as defined here LL | f: Box) + 'a>, LL | ) -> impl Fn(RefCell>) | ----------------------------------------- opaque type defined here diff --git a/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr b/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr index 2fd84517a61bd..5887752800b55 100644 --- a/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr +++ b/tests/ui/borrowck/issue-53432-nested-closure-outlives-borrowed-value.stderr @@ -4,7 +4,7 @@ error: lifetime may not live long enough LL | let _action = move || { | ------- | | | - | | return type of closure `{closure@...}` contains a lifetime `'2` + | | return type of closure `{closure@$DIR/issue-53432-nested-closure-outlives-borrowed-value.rs:4:9: 4:11}` contains a lifetime `'2` | lifetime `'1` represents this closure's body LL | || f() // The `nested` closure | ^^^^^^ returning this value requires that `'1` must outlive `'2` diff --git a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr index 4a364c9eb0c6d..53c5568660417 100644 --- a/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr +++ b/tests/ui/impl-trait/must_outlive_least_region_or_bound.stderr @@ -112,7 +112,7 @@ error[E0700]: hidden type for `impl Fn(&'a u32)` captures lifetime that does not LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) { | -- ---------------- opaque type defined here | | - | hidden type `{closure@...}` captures the lifetime `'b` as defined here + | hidden type `{closure@$DIR/must_outlive_least_region_or_bound.rs:42:5: 42:13}` captures the lifetime `'b` as defined here LL | move |_| println!("{}", y) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/impl-trait/static-return-lifetime-infered.stderr b/tests/ui/impl-trait/static-return-lifetime-infered.stderr index 093bd3d227527..8f2b4c7d26616 100644 --- a/tests/ui/impl-trait/static-return-lifetime-infered.stderr +++ b/tests/ui/impl-trait/static-return-lifetime-infered.stderr @@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn iter_values_anon(&self) -> impl Iterator { | ----- ----------------------- opaque type defined here | | - | hidden type `Map, {closure@...}>` captures the anonymous lifetime defined here + | hidden type `Map, {closure@...}>` captures the anonymous lifetime defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -19,7 +19,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn iter_values<'a>(&'a self) -> impl Iterator { | -- ----------------------- opaque type defined here | | - | hidden type `Map, {closure@...}>` captures the lifetime `'a` as defined here + | hidden type `Map, {closure@...}>` captures the lifetime `'a` as defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr b/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr index 4c4f6032b0f7b..25dee68a80e67 100644 --- a/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr +++ b/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr @@ -2,10 +2,10 @@ error: `impl` item signature doesn't match `trait` item signature --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:17:9 | LL | fn bar(&self, r: &mut Re); - | -------------------------- expected `fn(&'1 Foo, &'2 mut Re<'3>)` + | -------------------------- expected `fn(&'1 plain::Foo, &'2 mut Re<'3>)` ... LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Foo, &'2 mut Re<'1>)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 plain::Foo, &'2 mut Re<'1>)` | = note: expected signature `fn(&'1 plain::Foo, &'2 mut plain::Re<'3>)` found signature `fn(&'1 plain::Foo, &'2 mut plain::Re<'1>)` @@ -21,10 +21,10 @@ error: `impl` item signature doesn't match `trait` item signature --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:40:9 | LL | fn bar(&self, r: &mut Re); - | ------------------------------ expected `fn(&'1 Foo, &'2 mut Re<'3, u8>)` + | ------------------------------ expected `fn(&'1 with_type_args::Foo, &'2 mut Re<'3, u8>)` ... LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a, u8>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Foo, &'2 mut Re<'1, u8>)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 with_type_args::Foo, &'2 mut Re<'1, u8>)` | = note: expected signature `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'3, u8>)` found signature `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'1, u8>)` diff --git a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr index e7751de6f51ab..78a84f5f5da66 100644 --- a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr +++ b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr @@ -8,7 +8,7 @@ LL | | LL | | .filter_map(|_| foo(src)) | |_________________________________^ | - = note: hidden type `FilterMap, {closure@...}>` captures lifetime `'_` + = note: hidden type `FilterMap, {closure@...}>` captures lifetime `'_` error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr index ac4ba68aa36a6..ab067f2439c67 100644 --- a/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr +++ b/tests/ui/suggestions/lifetimes/missing-lifetimes-in-signature.stderr @@ -15,7 +15,7 @@ error[E0700]: hidden type for `impl FnOnce()` captures lifetime that does not ap LL | fn foo(g: G, dest: &mut T) -> impl FnOnce() | ------ ------------- opaque type defined here | | - | hidden type `{closure@...}` captures the anonymous lifetime defined here + | hidden type `{closure@$DIR/missing-lifetimes-in-signature.rs:19:5: 19:12}` captures the anonymous lifetime defined here ... LL | / move || { LL | | From c6f56924a338772736607e45ac706b0a71635036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 13 Jul 2026 19:34:04 +0000 Subject: [PATCH 24/38] Tweak shortened closure logic --- compiler/rustc_middle/src/ty/print/pretty.rs | 2 +- .../infer/nice_region_error/placeholder_error.rs | 2 +- .../higher-ranked-auto-trait-15.no_assumptions.stderr | 4 ++-- tests/ui/codegen/overflow-during-mono.stderr | 4 ++-- tests/ui/impl-trait/static-return-lifetime-infered.stderr | 4 ++-- ...trait-impl-mismatch-elided-lifetime-issue-65866.stderr | 8 ++++---- tests/ui/limits/type-length-limit-enforcement.stderr | 2 +- tests/ui/recursion/issue-83150.stderr | 2 +- ...lifetime-suggestion-in-proper-span-issue-121267.stderr | 2 +- tests/ui/traits/issue-91949-hangs-on-recursion.stderr | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index f336e4ce9af24..21ba71333ec36 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -2409,7 +2409,6 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> { | ty::FnPtr(..) | ty::UnsafeBinder(..) | ty::Dynamic(..) - | ty::Closure(..) | ty::CoroutineClosure(..) | ty::Coroutine(..) | ty::CoroutineWitness(..) @@ -2426,6 +2425,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> { Ok(()) } ty::Ref(..) if self.should_truncate() && has_regions => self.pretty_print_type(ty), + ty::Closure(..) => self.pretty_print_type(ty), _ => { self.printed_type_count += 1; self.pretty_print_type(ty) diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs index caa109d9e1d66..7f452a578778d 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs @@ -60,7 +60,7 @@ where } else { // We are highlighting lifetimes in the output, we will print out the smallest possible // portion of the type while keeping the lifetimes visible. - let mut p = FmtPrinter::new_with_limit(self.tcx, self.ns, Limit(1)); + let mut p = FmtPrinter::new_with_limit(self.tcx, self.ns, Limit(0)); p.region_highlight_mode = self.highlight; self.value.print(&mut p).expect("could not print type"); let x = p.into_buffer(); diff --git a/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr b/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr index 274108ef503d4..e8d1f585f0256 100644 --- a/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr +++ b/tests/ui/async-await/higher-ranked-auto-trait-15.no_assumptions.stderr @@ -4,7 +4,7 @@ error: implementation of `FnOnce` is not general enough LL | require_send(future); | ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | - = note: closure with signature `fn(&'0 Vec) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... + = note: closure with signature `fn(&'0 _) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&Vec,)>` help: consider adding an explicit type annotation to the closure's argument | @@ -17,7 +17,7 @@ error: implementation of `FnOnce` is not general enough LL | require_send(future); | ^^^^^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | - = note: closure with signature `fn(&'0 Vec) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... + = note: closure with signature `fn(&'0 _) -> Iter<'_, i32>` must implement `FnOnce<(&'1 Vec,)>`, for any two lifetimes `'0` and `'1`... = note: ...but it actually implements `FnOnce<(&Vec,)>` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` help: consider adding an explicit type annotation to the closure's argument diff --git a/tests/ui/codegen/overflow-during-mono.stderr b/tests/ui/codegen/overflow-during-mono.stderr index 4d631e255afe5..a5f5aafb7c7c2 100644 --- a/tests/ui/codegen/overflow-during-mono.stderr +++ b/tests/ui/codegen/overflow-during-mono.stderr @@ -3,8 +3,8 @@ error[E0275]: overflow evaluating the requirement `for<'a> {closure@$DIR/overflo = help: consider increasing the recursion limit by adding a `#![recursion_limit = "64"]` attribute to your crate (`overflow_during_mono`) = note: required for `Filter, {closure@overflow-during-mono.rs:14:41}>` to implement `Iterator` = note: 31 redundant requirements hidden - = note: required for `Filter, _>, _>, _>, _>, _>` to implement `Iterator` - = note: required for `Filter, _>, _>, _>, _>, _>` to implement `IntoIterator` + = note: required for `Filter, {closure@...}>, {closure@...}>` to implement `Iterator` + = note: required for `Filter, {closure@...}>, {closure@...}>` to implement `IntoIterator` = note: the full name for the type has been written to '$TEST_BUILD_DIR/overflow-during-mono.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console diff --git a/tests/ui/impl-trait/static-return-lifetime-infered.stderr b/tests/ui/impl-trait/static-return-lifetime-infered.stderr index 8f2b4c7d26616..093bd3d227527 100644 --- a/tests/ui/impl-trait/static-return-lifetime-infered.stderr +++ b/tests/ui/impl-trait/static-return-lifetime-infered.stderr @@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn iter_values_anon(&self) -> impl Iterator { | ----- ----------------------- opaque type defined here | | - | hidden type `Map, {closure@...}>` captures the anonymous lifetime defined here + | hidden type `Map, {closure@...}>` captures the anonymous lifetime defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | @@ -19,7 +19,7 @@ error[E0700]: hidden type for `impl Iterator` captures lifetime that LL | fn iter_values<'a>(&'a self) -> impl Iterator { | -- ----------------------- opaque type defined here | | - | hidden type `Map, {closure@...}>` captures the lifetime `'a` as defined here + | hidden type `Map, {closure@...}>` captures the lifetime `'a` as defined here LL | self.x.iter().map(|a| a.0) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr b/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr index 25dee68a80e67..4c4f6032b0f7b 100644 --- a/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr +++ b/tests/ui/lifetimes/trait-impl-mismatch-elided-lifetime-issue-65866.stderr @@ -2,10 +2,10 @@ error: `impl` item signature doesn't match `trait` item signature --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:17:9 | LL | fn bar(&self, r: &mut Re); - | -------------------------- expected `fn(&'1 plain::Foo, &'2 mut Re<'3>)` + | -------------------------- expected `fn(&'1 Foo, &'2 mut Re<'3>)` ... LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 plain::Foo, &'2 mut Re<'1>)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Foo, &'2 mut Re<'1>)` | = note: expected signature `fn(&'1 plain::Foo, &'2 mut plain::Re<'3>)` found signature `fn(&'1 plain::Foo, &'2 mut plain::Re<'1>)` @@ -21,10 +21,10 @@ error: `impl` item signature doesn't match `trait` item signature --> $DIR/trait-impl-mismatch-elided-lifetime-issue-65866.rs:40:9 | LL | fn bar(&self, r: &mut Re); - | ------------------------------ expected `fn(&'1 with_type_args::Foo, &'2 mut Re<'3, u8>)` + | ------------------------------ expected `fn(&'1 Foo, &'2 mut Re<'3, u8>)` ... LL | fn bar<'a, 'b>(&'a self, _r: &'b mut Re<'a, u8>) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 with_type_args::Foo, &'2 mut Re<'1, u8>)` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found `fn(&'1 Foo, &'2 mut Re<'1, u8>)` | = note: expected signature `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'3, u8>)` found signature `fn(&'1 with_type_args::Foo, &'2 mut with_type_args::Re<'1, u8>)` diff --git a/tests/ui/limits/type-length-limit-enforcement.stderr b/tests/ui/limits/type-length-limit-enforcement.stderr index 0313f212d3f7e..637a626fc4e7e 100644 --- a/tests/ui/limits/type-length-limit-enforcement.stderr +++ b/tests/ui/limits/type-length-limit-enforcement.stderr @@ -8,7 +8,7 @@ LL | drop::>(None); = note: the full name for the type has been written to '$TEST_BUILD_DIR/type-length-limit-enforcement.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console -error: reached the type-length limit while instantiating `<{closure@...} as FnMut<()>>::call_mut` +error: reached the type-length limit while instantiating `<{closure@lang_start<()>::{closure#0}} as FnMut<()>>::call_mut` | = help: consider adding a `#![type_length_limit="10"]` attribute to your crate = note: the full name for the type has been written to '$TEST_BUILD_DIR/type-length-limit-enforcement.long-type-$LONG_TYPE_HASH.txt' diff --git a/tests/ui/recursion/issue-83150.stderr b/tests/ui/recursion/issue-83150.stderr index 9ec187f055018..a01f14b66794c 100644 --- a/tests/ui/recursion/issue-83150.stderr +++ b/tests/ui/recursion/issue-83150.stderr @@ -15,7 +15,7 @@ error[E0275]: overflow evaluating the requirement `Map<&mut std::ops::Range, = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_83150`) = note: required for `&mut Map<&mut Range, {closure@issue-83150.rs:12:24}>` to implement `Iterator` = note: 65 redundant requirements hidden - = note: required for `&mut Map<&mut Map<&mut Map<&mut Map<&mut Map<_, _>, _>, _>, _>, _>` to implement `Iterator` + = note: required for `&mut Map<&mut Map<&mut _, {closure@...}>, {closure@...}>` to implement `Iterator` = note: the full name for the type has been written to '$TEST_BUILD_DIR/issue-83150.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console diff --git a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr index 78a84f5f5da66..e7751de6f51ab 100644 --- a/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr +++ b/tests/ui/suggestions/lifetimes/explicit-lifetime-suggestion-in-proper-span-issue-121267.stderr @@ -8,7 +8,7 @@ LL | | LL | | .filter_map(|_| foo(src)) | |_________________________________^ | - = note: hidden type `FilterMap, {closure@...}>` captures lifetime `'_` + = note: hidden type `FilterMap, {closure@...}>` captures lifetime `'_` error: aborting due to 1 previous error diff --git a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr index 3eff2944b472f..de16865629f89 100644 --- a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr +++ b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr @@ -24,7 +24,7 @@ LL | impl> Iterator for IteratorOfWrapped { | | | unsatisfied trait bound introduced here = note: 256 redundant requirements hidden - = note: required for `IteratorOfWrapped<(), Map>, _>>` to implement `Iterator` + = note: required for `IteratorOfWrapped<(), Map, {closure@...}>>` to implement `Iterator` = note: the full name for the type has been written to '$TEST_BUILD_DIR/issue-91949-hangs-on-recursion.long-type-$LONG_TYPE_HASH.txt' = note: consider using `--verbose` to print the full type name to the console From 05d7d3bd7a551d513ceaae945201354e7b132278 Mon Sep 17 00:00:00 2001 From: Jacob Adam Date: Thu, 16 Jul 2026 00:15:48 +0100 Subject: [PATCH 25/38] Add a regression test for an associated const equality region variable hashing ICE --- ...ssoc-const-equality-region-var-hash-ice.rs | 17 ++++++++ ...-const-equality-region-var-hash-ice.stderr | 41 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 tests/ui/associated-consts/assoc-const-equality-region-var-hash-ice.rs create mode 100644 tests/ui/associated-consts/assoc-const-equality-region-var-hash-ice.stderr diff --git a/tests/ui/associated-consts/assoc-const-equality-region-var-hash-ice.rs b/tests/ui/associated-consts/assoc-const-equality-region-var-hash-ice.rs new file mode 100644 index 0000000000000..9939be7b3554e --- /dev/null +++ b/tests/ui/associated-consts/assoc-const-equality-region-var-hash-ice.rs @@ -0,0 +1,17 @@ +//! Regression test for . + +trait Trait<'a> { + const K: &'a (); +} + +fn foo() -> dyn Trait<'r, K = {}> { + //~^ ERROR use of undeclared lifetime name `'r` + //~| ERROR associated const equality is incomplete + { + 6 + //~^ ERROR mismatched types + } + 5 +} + +fn main() {} diff --git a/tests/ui/associated-consts/assoc-const-equality-region-var-hash-ice.stderr b/tests/ui/associated-consts/assoc-const-equality-region-var-hash-ice.stderr new file mode 100644 index 0000000000000..d70cb19a95523 --- /dev/null +++ b/tests/ui/associated-consts/assoc-const-equality-region-var-hash-ice.stderr @@ -0,0 +1,41 @@ +error[E0261]: use of undeclared lifetime name `'r` + --> $DIR/assoc-const-equality-region-var-hash-ice.rs:7:23 + | +LL | fn foo() -> dyn Trait<'r, K = {}> { + | ^^ undeclared lifetime + | + = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html +help: consider making the bound lifetime-generic with a new `'r` lifetime + | +LL | fn foo() -> dyn for<'r> Trait<'r, K = {}> { + | +++++++ +help: consider introducing lifetime `'r` here + | +LL | fn foo<'r>() -> dyn Trait<'r, K = {}> { + | ++++ + +error[E0658]: associated const equality is incomplete + --> $DIR/assoc-const-equality-region-var-hash-ice.rs:7:27 + | +LL | fn foo() -> dyn Trait<'r, K = {}> { + | ^^^^^^ + | + = note: see issue #132980 for more information + = help: add `#![feature(min_generic_const_args)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0308]: mismatched types + --> $DIR/assoc-const-equality-region-var-hash-ice.rs:11:9 + | +LL | 6 + | ^ expected `()`, found integer + | +help: you might have meant to return this value + | +LL | return 6; + | ++++++ + + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0261, E0308, E0658. +For more information about an error, try `rustc --explain E0261`. From 2329d130bab3f7a36ef3980bb40ba8d6010b578e Mon Sep 17 00:00:00 2001 From: Jacob Adam Date: Thu, 16 Jul 2026 00:18:16 +0100 Subject: [PATCH 26/38] Add a regression test for a const parameter default body param-env ICE --- .../const-param-default-body-param-env-ice.rs | 15 ++++++ ...st-param-default-body-param-env-ice.stderr | 50 +++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 tests/ui/const-generics/defaults/const-param-default-body-param-env-ice.rs create mode 100644 tests/ui/const-generics/defaults/const-param-default-body-param-env-ice.stderr diff --git a/tests/ui/const-generics/defaults/const-param-default-body-param-env-ice.rs b/tests/ui/const-generics/defaults/const-param-default-body-param-env-ice.rs new file mode 100644 index 0000000000000..932e354861352 --- /dev/null +++ b/tests/ui/const-generics/defaults/const-param-default-body-param-env-ice.rs @@ -0,0 +1,15 @@ +//! Regression test for . + +impl dyn PartialEq {} +//~^ ERROR generic parameters with a default must be trailing +//~| ERROR generic parameter defaults cannot reference parameters before they are declared +//~| ERROR defaults for generic parameters are not allowed here +//~| ERROR the const parameter `N` is not constrained by the impl trait, self type, or predicates +//~| ERROR cannot define inherent `impl` for a type outside of the crate where the type is defined + +fn foo() {} + +pub struct S; +//~^ ERROR mismatched types + +fn main() {} diff --git a/tests/ui/const-generics/defaults/const-param-default-body-param-env-ice.stderr b/tests/ui/const-generics/defaults/const-param-default-body-param-env-ice.stderr new file mode 100644 index 0000000000000..9341e0e280f81 --- /dev/null +++ b/tests/ui/const-generics/defaults/const-param-default-body-param-env-ice.stderr @@ -0,0 +1,50 @@ +error: generic parameters with a default must be trailing + --> $DIR/const-param-default-body-param-env-ice.rs:3:12 + | +LL | impl dyn PartialEq {} + | ^ + +error[E0128]: generic parameter defaults cannot reference parameters before they are declared + --> $DIR/const-param-default-body-param-env-ice.rs:3:32 + | +LL | impl dyn PartialEq {} + | ^ cannot reference `X` before it is declared + +error: defaults for generic parameters are not allowed here + --> $DIR/const-param-default-body-param-env-ice.rs:3:6 + | +LL | impl dyn PartialEq {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates + --> $DIR/const-param-default-body-param-env-ice.rs:3:6 + | +LL | impl dyn PartialEq {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unconstrained const parameter + | + = note: expressions using a const parameter must map each value to a distinct output value + = note: proving the result of expressions other than the parameter are unique is not supported + +error[E0308]: mismatched types + --> $DIR/const-param-default-body-param-env-ice.rs:12:45 + | +LL | pub struct S; + | ^^^ expected `usize`, found fn item + | + = note: expected type `usize` + found fn item `fn() {foo}` + = note: array length can only be `usize` + +error[E0116]: cannot define inherent `impl` for a type outside of the crate where the type is defined + --> $DIR/const-param-default-body-param-env-ice.rs:3:1 + | +LL | impl dyn PartialEq {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl for type defined outside of crate + | + = help: consider defining a trait and implementing it for the type or using a newtype wrapper like `struct MyType(ExternalType);` and implement it + = note: for more details about the orphan rules, see + +error: aborting due to 6 previous errors + +Some errors have detailed explanations: E0116, E0128, E0207, E0308. +For more information about an error, try `rustc --explain E0116`. From 26d2eda0016021b61881488a19b60dca6cd7b01f Mon Sep 17 00:00:00 2001 From: "Tim (Theemathas) Chirananthavat" Date: Thu, 16 Jul 2026 11:52:09 +0700 Subject: [PATCH 27/38] Delete `lint-unknown-feature{,-default}.rs` These tests, as currently written, make no sense. Relevant functionality is already tested in: * `tests/ui/feature-gates/unknown-feature.rs` * `tests/ui/feature-gates/stable-features.rs` * `tests/ui/lint/unused-features/unused-language-features.rs` --- tests/ui/lint/lint-unknown-feature-default.rs | 9 --------- tests/ui/lint/lint-unknown-feature.rs | 8 -------- 2 files changed, 17 deletions(-) delete mode 100644 tests/ui/lint/lint-unknown-feature-default.rs delete mode 100644 tests/ui/lint/lint-unknown-feature.rs diff --git a/tests/ui/lint/lint-unknown-feature-default.rs b/tests/ui/lint/lint-unknown-feature-default.rs deleted file mode 100644 index c1614e0f7ac68..0000000000000 --- a/tests/ui/lint/lint-unknown-feature-default.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ check-pass - -// Tests the default for the unused_features lint - -#![allow(stable_features)] -// FIXME(#44232) we should warn that this isn't used. -#![feature(rust1)] - -fn main() {} diff --git a/tests/ui/lint/lint-unknown-feature.rs b/tests/ui/lint/lint-unknown-feature.rs deleted file mode 100644 index b598f0d0106b1..0000000000000 --- a/tests/ui/lint/lint-unknown-feature.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ check-pass - -#![warn(unused_features)] - -#![allow(stable_features)] -// FIXME(#44232) we should warn that this isn't used. - -fn main() {} From 4b1bfb5a9a6bc99ea17b726a9a04bd38cdc762ef Mon Sep 17 00:00:00 2001 From: "Tim (Theemathas) Chirananthavat" Date: Thu, 16 Jul 2026 12:00:24 +0700 Subject: [PATCH 28/38] Delete FIXMEs about issue 44232. --- compiler/rustc_passes/src/stability.rs | 3 - .../issue-43106-gating-of-builtin-attrs.rs | 1 - ...issue-43106-gating-of-builtin-attrs.stderr | 404 +++++++++--------- 3 files changed, 202 insertions(+), 206 deletions(-) diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 86e3e57b34bf0..3482e7320ef96 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -1147,9 +1147,6 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) { .1; tcx.dcx().emit_err(diagnostics::ImpliedFeatureNotExist { span, feature, implied_by }); } - - // FIXME(#44232): the `used_features` table no longer exists, so we - // don't lint about unused features. We should re-enable this one day! } fn unnecessary_partially_stable_feature_lint( diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs index 180e44d365add..7d98b9f9982a7 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs @@ -98,7 +98,6 @@ #![crate_name = "0900"] #![crate_type = "bin"] // cannot pass "0800" here -// FIXME(#44232) we should warn that this isn't used. #![feature(rust1)] //~^ WARN no longer requires an attribute to enable //~| NOTE `#[warn(stable_features)]` on by default diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr index 520ddd531b1d1..8c94bbcb2e027 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr @@ -1,5 +1,5 @@ warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:475:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:474:17 | LL | mod inner { #![macro_escape] } | ^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | mod inner { #![macro_escape] } = help: try an outer attribute: `#[macro_use]` warning: `#[macro_escape]` is a deprecated synonym for `#[macro_use]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:472:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:471:1 | LL | #[macro_escape] | ^^^^^^^^^^^^^^^ @@ -43,151 +43,151 @@ LL | #![deny(x5100)] | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:113:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:112:8 | LL | #[warn(x5400)] | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:116:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:115:25 | LL | mod inner { #![warn(x5400)] } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:119:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:118:12 | LL | #[warn(x5400)] fn f() { } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:122:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:121:12 | LL | #[warn(x5400)] struct S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:125:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:124:12 | LL | #[warn(x5400)] type T = S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:128:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:127:12 | LL | #[warn(x5400)] impl S { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:132:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:131:9 | LL | #[allow(x5300)] | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:135:26 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:134:26 | LL | mod inner { #![allow(x5300)] } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:138:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:137:13 | LL | #[allow(x5300)] fn f() { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:141:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:140:13 | LL | #[allow(x5300)] struct S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:144:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:143:13 | LL | #[allow(x5300)] type T = S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:147:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:146:13 | LL | #[allow(x5300)] impl S { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:151:10 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:150:10 | LL | #[forbid(x5200)] | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:154:27 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:153:27 | LL | mod inner { #![forbid(x5200)] } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:157:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:156:14 | LL | #[forbid(x5200)] fn f() { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:160:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:159:14 | LL | #[forbid(x5200)] struct S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:163:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:162:14 | LL | #[forbid(x5200)] type T = S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:166:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:165:14 | LL | #[forbid(x5200)] impl S { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:170:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:169:8 | LL | #[deny(x5100)] | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:173:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:172:25 | LL | mod inner { #![deny(x5100)] } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:176:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:175:12 | LL | #[deny(x5100)] fn f() { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:179:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:178:12 | LL | #[deny(x5100)] struct S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:182:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:181:12 | LL | #[deny(x5100)] type T = S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:185:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:184:12 | LL | #[deny(x5100)] impl S { } | ^^^^^ warning: the feature `rust1` has been stable since 1.0.0 and no longer requires an attribute to enable - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:102:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:101:12 | LL | #![feature(rust1)] | ^^^^^ @@ -195,7 +195,7 @@ LL | #![feature(rust1)] = note: `#[warn(stable_features)]` on by default warning: attribute should be applied to an `extern` block with non-Rust ABI - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:725:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:724:5 | LL | #[link(name = "x")] extern "Rust" {} | ^^^^^^^^^^^^^^^^^^^ @@ -289,7 +289,7 @@ LL | #![must_use] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[macro_use]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:193:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:192:5 | LL | #[macro_use] fn f() { } | ^^^^^^^^^^^^ @@ -298,7 +298,7 @@ LL | #[macro_use] fn f() { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[macro_use]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:199:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:198:5 | LL | #[macro_use] struct S; | ^^^^^^^^^^^^ @@ -307,7 +307,7 @@ LL | #[macro_use] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[macro_use]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:205:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:204:5 | LL | #[macro_use] type T = S; | ^^^^^^^^^^^^ @@ -316,7 +316,7 @@ LL | #[macro_use] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[macro_use]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:211:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:210:5 | LL | #[macro_use] impl S { } | ^^^^^^^^^^^^ @@ -325,7 +325,7 @@ LL | #[macro_use] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[macro_export]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:218:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:217:1 | LL | #[macro_export] | ^^^^^^^^^^^^^^^ @@ -334,7 +334,7 @@ LL | #[macro_export] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[macro_export]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:224:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:223:17 | LL | mod inner { #![macro_export] } | ^^^^^^^^^^^^^^^^ @@ -343,7 +343,7 @@ LL | mod inner { #![macro_export] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[macro_export]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:230:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:229:5 | LL | #[macro_export] fn f() { } | ^^^^^^^^^^^^^^^ @@ -352,7 +352,7 @@ LL | #[macro_export] fn f() { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[macro_export]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:236:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:235:5 | LL | #[macro_export] struct S; | ^^^^^^^^^^^^^^^ @@ -361,7 +361,7 @@ LL | #[macro_export] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[macro_export]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:242:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:241:5 | LL | #[macro_export] type T = S; | ^^^^^^^^^^^^^^^ @@ -370,7 +370,7 @@ LL | #[macro_export] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[macro_export]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:248:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:247:5 | LL | #[macro_export] impl S { } | ^^^^^^^^^^^^^^^ @@ -379,7 +379,7 @@ LL | #[macro_export] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[path]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:259:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:258:5 | LL | #[path = "3800"] fn f() { } | ^^^^^^^^^^^^^^^^ @@ -388,7 +388,7 @@ LL | #[path = "3800"] fn f() { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[path]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:265:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:264:5 | LL | #[path = "3800"] struct S; | ^^^^^^^^^^^^^^^^ @@ -397,7 +397,7 @@ LL | #[path = "3800"] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[path]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:271:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:270:5 | LL | #[path = "3800"] type T = S; | ^^^^^^^^^^^^^^^^ @@ -406,7 +406,7 @@ LL | #[path = "3800"] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[path]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:277:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:276:5 | LL | #[path = "3800"] impl S { } | ^^^^^^^^^^^^^^^^ @@ -415,7 +415,7 @@ LL | #[path = "3800"] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[automatically_derived]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:284:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:283:1 | LL | #[automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -424,7 +424,7 @@ LL | #[automatically_derived] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[automatically_derived]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:290:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:289:17 | LL | mod inner { #![automatically_derived] } | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -433,7 +433,7 @@ LL | mod inner { #![automatically_derived] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[automatically_derived]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:296:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:295:5 | LL | #[automatically_derived] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -442,7 +442,7 @@ LL | #[automatically_derived] fn f() { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[automatically_derived]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:302:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:301:5 | LL | #[automatically_derived] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -451,7 +451,7 @@ LL | #[automatically_derived] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[automatically_derived]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:308:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:307:5 | LL | #[automatically_derived] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -460,7 +460,7 @@ LL | #[automatically_derived] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[automatically_derived]` attribute cannot be used on traits - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:314:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:313:5 | LL | #[automatically_derived] trait W { } | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -469,7 +469,7 @@ LL | #[automatically_derived] trait W { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[automatically_derived]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:320:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:319:5 | LL | #[automatically_derived] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -478,7 +478,7 @@ LL | #[automatically_derived] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[no_mangle]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:329:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:328:1 | LL | #[no_mangle] | ^^^^^^^^^^^^ @@ -487,7 +487,7 @@ LL | #[no_mangle] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[no_mangle]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:335:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:334:17 | LL | mod inner { #![no_mangle] } | ^^^^^^^^^^^^^ @@ -496,7 +496,7 @@ LL | mod inner { #![no_mangle] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[no_mangle]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:343:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:342:5 | LL | #[no_mangle] struct S; | ^^^^^^^^^^^^ @@ -505,7 +505,7 @@ LL | #[no_mangle] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[no_mangle]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:349:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:348:5 | LL | #[no_mangle] type T = S; | ^^^^^^^^^^^^ @@ -514,7 +514,7 @@ LL | #[no_mangle] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[no_mangle]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:355:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:354:5 | LL | #[no_mangle] impl S { } | ^^^^^^^^^^^^ @@ -523,7 +523,7 @@ LL | #[no_mangle] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[should_panic]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:376:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:375:1 | LL | #[should_panic] | ^^^^^^^^^^^^^^^ @@ -532,7 +532,7 @@ LL | #[should_panic] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[should_panic]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:382:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:381:17 | LL | mod inner { #![should_panic] } | ^^^^^^^^^^^^^^^^ @@ -541,7 +541,7 @@ LL | mod inner { #![should_panic] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[should_panic]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:390:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:389:5 | LL | #[should_panic] struct S; | ^^^^^^^^^^^^^^^ @@ -550,7 +550,7 @@ LL | #[should_panic] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[should_panic]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:396:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:395:5 | LL | #[should_panic] type T = S; | ^^^^^^^^^^^^^^^ @@ -559,7 +559,7 @@ LL | #[should_panic] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[should_panic]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:402:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:401:5 | LL | #[should_panic] impl S { } | ^^^^^^^^^^^^^^^ @@ -568,7 +568,7 @@ LL | #[should_panic] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[ignore]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:409:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:408:1 | LL | #[ignore] | ^^^^^^^^^ @@ -577,7 +577,7 @@ LL | #[ignore] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[ignore]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:415:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:414:17 | LL | mod inner { #![ignore] } | ^^^^^^^^^^ @@ -586,7 +586,7 @@ LL | mod inner { #![ignore] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[ignore]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:423:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:422:5 | LL | #[ignore] struct S; | ^^^^^^^^^ @@ -595,7 +595,7 @@ LL | #[ignore] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[ignore]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:429:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:428:5 | LL | #[ignore] type T = S; | ^^^^^^^^^ @@ -604,7 +604,7 @@ LL | #[ignore] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[ignore]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:435:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:434:5 | LL | #[ignore] impl S { } | ^^^^^^^^^ @@ -613,7 +613,7 @@ LL | #[ignore] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[no_implicit_prelude]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:446:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:445:5 | LL | #[no_implicit_prelude] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ @@ -622,7 +622,7 @@ LL | #[no_implicit_prelude] fn f() { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[no_implicit_prelude]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:452:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:451:5 | LL | #[no_implicit_prelude] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ @@ -631,7 +631,7 @@ LL | #[no_implicit_prelude] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[no_implicit_prelude]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:458:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:457:5 | LL | #[no_implicit_prelude] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ @@ -640,7 +640,7 @@ LL | #[no_implicit_prelude] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[no_implicit_prelude]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:464:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:463:5 | LL | #[no_implicit_prelude] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ @@ -649,7 +649,7 @@ LL | #[no_implicit_prelude] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[macro_escape]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:479:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:478:5 | LL | #[macro_escape] fn f() { } | ^^^^^^^^^^^^^^^ @@ -658,7 +658,7 @@ LL | #[macro_escape] fn f() { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[macro_escape]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:485:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:484:5 | LL | #[macro_escape] struct S; | ^^^^^^^^^^^^^^^ @@ -667,7 +667,7 @@ LL | #[macro_escape] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[macro_escape]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:491:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:490:5 | LL | #[macro_escape] type T = S; | ^^^^^^^^^^^^^^^ @@ -676,7 +676,7 @@ LL | #[macro_escape] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[macro_escape]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:497:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:496:5 | LL | #[macro_escape] impl S { } | ^^^^^^^^^^^^^^^ @@ -685,13 +685,13 @@ LL | #[macro_escape] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_std]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:504:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:503:1 | LL | #[no_std] | ^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:506:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:505:1 | LL | / mod no_std { LL | | @@ -701,61 +701,61 @@ LL | | } | |_^ warning: the `#![no_std]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:508:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:507:17 | LL | mod inner { #![no_std] } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_std]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:511:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:510:5 | LL | #[no_std] fn f() { } | ^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:511:15 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:510:15 | LL | #[no_std] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_std]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:515:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:514:5 | LL | #[no_std] struct S; | ^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:515:15 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:514:15 | LL | #[no_std] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_std]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:519:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:518:5 | LL | #[no_std] type T = S; | ^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:519:15 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:518:15 | LL | #[no_std] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_std]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:523:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:522:5 | LL | #[no_std] impl S { } | ^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:523:15 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:522:15 | LL | #[no_std] impl S { } | ^^^^^^^^^^ warning: `#[cold]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:545:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:544:1 | LL | #[cold] | ^^^^^^^ @@ -764,7 +764,7 @@ LL | #[cold] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[cold]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:552:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:551:17 | LL | mod inner { #![cold] } | ^^^^^^^^ @@ -773,7 +773,7 @@ LL | mod inner { #![cold] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[cold]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:560:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:559:5 | LL | #[cold] struct S; | ^^^^^^^ @@ -782,7 +782,7 @@ LL | #[cold] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[cold]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:566:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:565:5 | LL | #[cold] type T = S; | ^^^^^^^ @@ -791,7 +791,7 @@ LL | #[cold] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[cold]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:572:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:571:5 | LL | #[cold] impl S { } | ^^^^^^^ @@ -800,7 +800,7 @@ LL | #[cold] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link_name]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:579:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:578:1 | LL | #[link_name = "1900"] | ^^^^^^^^^^^^^^^^^^^^^ @@ -809,7 +809,7 @@ LL | #[link_name = "1900"] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link_name]` attribute cannot be used on foreign modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:585:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:584:5 | LL | #[link_name = "1900"] | ^^^^^^^^^^^^^^^^^^^^^ @@ -818,7 +818,7 @@ LL | #[link_name = "1900"] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link_name]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:592:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:591:17 | LL | mod inner { #![link_name="1900"] } | ^^^^^^^^^^^^^^^^^^^^ @@ -827,7 +827,7 @@ LL | mod inner { #![link_name="1900"] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link_name]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:598:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:597:5 | LL | #[link_name = "1900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^ @@ -836,7 +836,7 @@ LL | #[link_name = "1900"] fn f() { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link_name]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:604:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:603:5 | LL | #[link_name = "1900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^ @@ -845,7 +845,7 @@ LL | #[link_name = "1900"] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link_name]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:610:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:609:5 | LL | #[link_name = "1900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^ @@ -854,7 +854,7 @@ LL | #[link_name = "1900"] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link_name]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:616:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:615:5 | LL | #[link_name = "1900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^ @@ -863,7 +863,7 @@ LL | #[link_name = "1900"] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link_section]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:623:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:622:1 | LL | #[link_section = ",1800"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -872,7 +872,7 @@ LL | #[link_section = ",1800"] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link_section]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:629:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:628:17 | LL | mod inner { #![link_section=",1800"] } | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -881,7 +881,7 @@ LL | mod inner { #![link_section=",1800"] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link_section]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:637:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:636:5 | LL | #[link_section = ",1800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -890,7 +890,7 @@ LL | #[link_section = ",1800"] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link_section]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:643:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:642:5 | LL | #[link_section = ",1800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -899,7 +899,7 @@ LL | #[link_section = ",1800"] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link_section]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:649:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:648:5 | LL | #[link_section = ",1800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -908,7 +908,7 @@ LL | #[link_section = ",1800"] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link_section]` attribute cannot be used on traits - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:655:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:654:5 | LL | #[link_section = ",1800"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -917,7 +917,7 @@ LL | #[link_section = ",1800"] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:689:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:688:1 | LL | #[link(name = "x")] | ^^^^^^^^^^^^^^^^^^^ @@ -926,7 +926,7 @@ LL | #[link(name = "x")] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:695:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:694:17 | LL | mod inner { #![link(name = "x")] } | ^^^^^^^^^^^^^^^^^^^^ @@ -935,7 +935,7 @@ LL | mod inner { #![link(name = "x")] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link]` attribute cannot be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:701:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:700:5 | LL | #[link(name = "x")] fn f() { } | ^^^^^^^^^^^^^^^^^^^ @@ -944,7 +944,7 @@ LL | #[link(name = "x")] fn f() { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link]` attribute cannot be used on structs - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:706:5 | LL | #[link(name = "x")] struct S; | ^^^^^^^^^^^^^^^^^^^ @@ -953,7 +953,7 @@ LL | #[link(name = "x")] struct S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:713:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:712:5 | LL | #[link(name = "x")] type T = S; | ^^^^^^^^^^^^^^^^^^^ @@ -962,7 +962,7 @@ LL | #[link(name = "x")] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:718:5 | LL | #[link(name = "x")] impl S { } | ^^^^^^^^^^^^^^^^^^^ @@ -971,7 +971,7 @@ LL | #[link(name = "x")] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[must_use]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:745:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:744:1 | LL | #[must_use] | ^^^^^^^^^^^ @@ -980,7 +980,7 @@ LL | #[must_use] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[must_use]` attribute cannot be used on modules - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:750:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:749:17 | LL | mod inner { #![must_use] } | ^^^^^^^^^^^^ @@ -989,7 +989,7 @@ LL | mod inner { #![must_use] } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[must_use]` attribute cannot be used on type aliases - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:759:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:758:5 | LL | #[must_use] type T = S; | ^^^^^^^^^^^ @@ -998,7 +998,7 @@ LL | #[must_use] type T = S; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[must_use]` attribute cannot be used on inherent impl blocks - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:764:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:763:5 | LL | #[must_use] impl S { } | ^^^^^^^^^^^ @@ -1007,13 +1007,13 @@ LL | #[must_use] impl S { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![windows_subsystem]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:769:1 | LL | #[windows_subsystem = "windows"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:772:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:771:1 | LL | / mod windows_subsystem { LL | | @@ -1023,67 +1023,67 @@ LL | | } | |_^ warning: the `#![windows_subsystem]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:774:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:773:17 | LL | mod inner { #![windows_subsystem="windows"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![windows_subsystem]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:777:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:776:5 | LL | #[windows_subsystem = "windows"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:777:38 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:776:38 | LL | #[windows_subsystem = "windows"] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![windows_subsystem]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:781:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:780:5 | LL | #[windows_subsystem = "windows"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:781:38 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:780:38 | LL | #[windows_subsystem = "windows"] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![windows_subsystem]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:785:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:784:5 | LL | #[windows_subsystem = "windows"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:785:38 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:784:38 | LL | #[windows_subsystem = "windows"] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![windows_subsystem]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:788:5 | LL | #[windows_subsystem = "windows"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:38 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:788:38 | LL | #[windows_subsystem = "windows"] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:796:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:795:1 | LL | #[crate_name = "0900"] | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:798:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:797:1 | LL | / mod crate_name { LL | | @@ -1093,67 +1093,67 @@ LL | | } | |_^ warning: the `#![crate_name]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:800:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:799:17 | LL | mod inner { #![crate_name="0900"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:803:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:802:5 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:803:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:802:28 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:807:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:806:5 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:807:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:806:28 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:811:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:810:5 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:811:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:810:28 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:815:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:814:5 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:815:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:814:28 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_type]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:820:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:819:1 | LL | #[crate_type = "0800"] | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:822:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:821:1 | LL | / mod crate_type { LL | | @@ -1163,67 +1163,67 @@ LL | | } | |_^ warning: the `#![crate_type]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:824:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:823:17 | LL | mod inner { #![crate_type="0800"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_type]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:827:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:826:5 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:827:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:826:28 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_type]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:831:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:830:5 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:831:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:830:28 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_type]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:835:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:834:5 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:835:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:834:28 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_type]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:839:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:838:5 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:839:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:838:28 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![feature]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:844:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:843:1 | LL | #[feature(x0600)] | ^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:846:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:845:1 | LL | / mod feature { LL | | @@ -1233,67 +1233,67 @@ LL | | } | |_^ warning: the `#![feature]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:848:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:847:17 | LL | mod inner { #![feature(x0600)] } | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![feature]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:851:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:850:5 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:851:23 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:850:23 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![feature]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:855:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:854:5 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:855:23 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:854:23 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![feature]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:859:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:858:5 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:859:23 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:858:23 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![feature]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:863:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:862:5 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:863:23 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:862:23 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_main]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:869:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:868:1 | LL | #[no_main] | ^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:871:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:870:1 | LL | / mod no_main_1 { LL | | @@ -1303,67 +1303,67 @@ LL | | } | |_^ warning: the `#![no_main]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:873:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:872:17 | LL | mod inner { #![no_main] } | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_main]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:876:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:875:5 | LL | #[no_main] fn f() { } | ^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:876:16 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:875:16 | LL | #[no_main] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_main]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:880:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:879:5 | LL | #[no_main] struct S; | ^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:880:16 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:879:16 | LL | #[no_main] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_main]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:884:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:883:5 | LL | #[no_main] type T = S; | ^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:884:16 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:883:16 | LL | #[no_main] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_main]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:888:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:887:5 | LL | #[no_main] impl S { } | ^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:888:16 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:887:16 | LL | #[no_main] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_builtins]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:893:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:892:1 | LL | #[no_builtins] | ^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:895:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:894:1 | LL | / mod no_builtins { LL | | @@ -1373,67 +1373,67 @@ LL | | } | |_^ warning: the `#![no_builtins]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:897:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:896:17 | LL | mod inner { #![no_builtins] } | ^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_builtins]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:900:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:899:5 | LL | #[no_builtins] fn f() { } | ^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:900:20 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:899:20 | LL | #[no_builtins] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_builtins]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:904:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:903:5 | LL | #[no_builtins] struct S; | ^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:904:20 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:903:20 | LL | #[no_builtins] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_builtins]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:908:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:907:5 | LL | #[no_builtins] type T = S; | ^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:908:20 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:907:20 | LL | #[no_builtins] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![no_builtins]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:912:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:911:5 | LL | #[no_builtins] impl S { } | ^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:912:20 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:911:20 | LL | #[no_builtins] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![recursion_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:917:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:916:1 | LL | #[recursion_limit="0200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:919:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:918:1 | LL | / mod recursion_limit { LL | | @@ -1443,67 +1443,67 @@ LL | | } | |_^ warning: the `#![recursion_limit]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:921:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:920:17 | LL | mod inner { #![recursion_limit="0200"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![recursion_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:924:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:923:5 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:924:31 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:923:31 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![recursion_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:928:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:927:5 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:928:31 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:927:31 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![recursion_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:932:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:931:5 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:932:31 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:931:31 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![recursion_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:936:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:935:5 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:936:31 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:935:31 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![type_length_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:941:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:940:1 | LL | #[type_length_limit="0100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:943:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:942:1 | LL | / mod type_length_limit { LL | | @@ -1513,61 +1513,61 @@ LL | | } | |_^ warning: the `#![type_length_limit]` attribute can only be used at the crate root - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:945:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:944:17 | LL | mod inner { #![type_length_limit="0100"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![type_length_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:948:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:947:5 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:948:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:947:33 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![type_length_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:952:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:951:5 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this struct - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:952:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:951:33 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![type_length_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:956:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:955:5 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this type alias - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:956:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:955:33 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![type_length_limit]` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:960:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:959:5 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this implementation block - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:960:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:959:33 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^ warning: `#[no_mangle]` attribute cannot be used on required trait methods - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:362:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:361:9 | LL | #[no_mangle] fn foo(); | ^^^^^^^^^^^^ @@ -1576,7 +1576,7 @@ LL | #[no_mangle] fn foo(); = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[no_mangle]` attribute cannot be used on provided trait methods - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:368:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:367:9 | LL | #[no_mangle] fn bar() {} | ^^^^^^^^^^^^ @@ -1585,7 +1585,7 @@ LL | #[no_mangle] fn bar() {} = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: `#[link_section]` attribute cannot be used on required trait methods - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:661:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:660:9 | LL | #[link_section = ",1800"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ From 5ccf44c02c1d4107cd451a2b6e397a00e4123bf1 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Wed, 27 May 2026 13:10:26 +0200 Subject: [PATCH 29/38] Track extra_lifetime_params_map per-owner --- compiler/rustc_ast_lowering/src/item.rs | 4 ++-- compiler/rustc_ast_lowering/src/lib.rs | 13 +------------ compiler/rustc_middle/src/ty/mod.rs | 17 ++++++++++++++--- compiler/rustc_resolve/src/late.rs | 1 + compiler/rustc_resolve/src/lib.rs | 5 +---- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 56abe72e0319f..7e9827c4e494c 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -24,7 +24,7 @@ use super::diagnostics::{ use super::stability::{enabled_names, gate_unstable_abi}; use super::{ FnDeclKind, GenericArgsMode, ImplTraitContext, ImplTraitPosition, LoweringContext, ParamMode, - RelaxedBoundForbiddenReason, RelaxedBoundPolicy, ResolverAstLoweringExt, + RelaxedBoundForbiddenReason, RelaxedBoundPolicy, }; use crate::diagnostics::ConstComptimeFn; @@ -1878,7 +1878,7 @@ impl<'hir> LoweringContext<'_, 'hir> { .collect(); // Introduce extra lifetimes if late resolution tells us to. - let extra_lifetimes = self.resolver.extra_lifetime_params(self.owner.id); + let extra_lifetimes = self.owner.extra_lifetime_params(self.owner.id); params.extend(extra_lifetimes.into_iter().map(|&(ident, node_id, kind)| { self.lifetime_res_to_generic_param( ident, diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index c6cd3fe5f5922..b30774318dee7 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -351,17 +351,6 @@ impl<'tcx> ResolverAstLowering<'tcx> { ) .map(|fn_indexes| fn_indexes.iter().map(|(num, _)| *num).collect()) } - - /// Obtain the list of lifetimes parameters to add to an item. - /// - /// Extra lifetime parameters should only be added in places that can appear - /// as a `binder` in `LifetimeRes`. - /// - /// The extra lifetimes that appear from the parenthesized `Fn`-trait desugaring - /// should appear at the enclosing `PolyTraitRef`. - fn extra_lifetime_params(&self, id: NodeId) -> &[(Ident, NodeId, MissingLifetimeKind)] { - self.extra_lifetime_params_map.get(&id).map_or(&[], |v| &v[..]) - } } /// How relaxed bounds `?Trait` should be treated. @@ -1129,7 +1118,7 @@ impl<'hir> LoweringContext<'_, 'hir> { ) -> &'hir [hir::GenericParam<'hir>] { // Start by creating params for extra lifetimes params, as this creates the definitions // that may be referred to by the AST inside `generic_params`. - let extra_lifetimes = self.resolver.extra_lifetime_params(binder); + let extra_lifetimes = self.owner.extra_lifetime_params(binder); debug!(?extra_lifetimes); let extra_lifetimes: Vec<_> = extra_lifetimes .iter() diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index d90a709ffcd41..f1133cc52671c 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -28,7 +28,7 @@ use rustc_abi::{ Align, FieldIdx, Integer, IntegerType, ReprFlags, ReprOptions, ScalableElt, VariantIdx, }; use rustc_ast::node_id::NodeMap; -use rustc_ast::{self as ast}; +use rustc_ast::{self as ast, NodeId}; pub use rustc_ast_ir::{Movability, Mutability, try_visit}; use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; use rustc_data_structures::intern::Interned; @@ -224,6 +224,8 @@ pub struct PerOwnerResolverData<'tcx> { /// Resolution for import nodes, which have multiple resolutions in different namespaces. pub import_res: hir::def::PerNS>> = Default::default(), + /// Lifetime parameters that lowering will have to introduce. + pub extra_lifetime_params_map: NodeMap> = Default::default(), /// The id of the owner pub id: ast::NodeId, @@ -245,6 +247,17 @@ impl<'tcx> PerOwnerResolverData<'tcx> { pub fn get_lifetime_res(&self, id: ast::NodeId) -> Option { self.lifetimes_res_map.get(&id).copied() } + + /// Obtain the list of lifetimes parameters to add to an item. + /// + /// Extra lifetime parameters should only be added in places that can appear + /// as a `binder` in `LifetimeRes`. + /// + /// The extra lifetimes that appear from the parenthesized `Fn`-trait desugaring + /// should appear at the enclosing `PolyTraitRef`. + pub fn extra_lifetime_params(&self, id: NodeId) -> &[(Ident, NodeId, MissingLifetimeKind)] { + self.extra_lifetime_params_map.get(&id).map_or(&[], |v| &v[..]) + } } /// Resolutions that should only be used for lowering. @@ -253,8 +266,6 @@ impl<'tcx> PerOwnerResolverData<'tcx> { pub struct ResolverAstLowering<'tcx> { /// Resolutions for nodes that have a single resolution. pub partial_res_map: NodeMap, - /// Lifetime parameters that lowering will have to introduce. - pub extra_lifetime_params_map: NodeMap>, pub next_node_id: ast::NodeId, diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 5cc8d5af4655a..ea55d1cb9a471 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -2170,6 +2170,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { // Record the created lifetime parameter so lowering can pick it up and add it to HIR. self.r + .current_owner .extra_lifetime_params_map .entry(binder) .or_insert_with(Vec::new) diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 40cad4241e5a3..35d6984d76ade 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -58,7 +58,7 @@ use rustc_hir::def::{ }; use rustc_hir::def_id::{CRATE_DEF_ID, CrateNum, DefId, LOCAL_CRATE, LocalDefId, LocalDefIdMap}; use rustc_hir::definitions::{PerParentDisambiguatorState, PerParentDisambiguatorsMap}; -use rustc_hir::{MissingLifetimeKind, PrimTy, TraitCandidate, find_attr}; +use rustc_hir::{PrimTy, TraitCandidate, find_attr}; use rustc_index::bit_set::DenseBitSet; use rustc_metadata::creader::CStore; use rustc_middle::metadata::{AmbigModChild, ModChild, Reexport}; @@ -1336,8 +1336,6 @@ pub struct Resolver<'ra, 'tcx> { partial_res_map: NodeMap = Default::default(), /// An import will be inserted into this map if it has been used. import_use_map: FxHashMap, Used> = default::fx_hash_map(), - /// Lifetime parameters that lowering will have to introduce. - extra_lifetime_params_map: NodeMap> = Default::default(), /// `CrateNum` resolutions of `extern crate` items. extern_crate_map: UnordMap = Default::default(), @@ -1975,7 +1973,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { }; let ast_lowering = ty::ResolverAstLowering { partial_res_map: self.partial_res_map, - extra_lifetime_params_map: self.extra_lifetime_params_map, next_node_id: self.next_node_id, owners: self.owners, lint_buffer: Steal::new(self.lint_buffer), From 38591d2d77c9fadf4d199ec6a6e937ec80d1796d Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Thu, 16 Jul 2026 07:05:06 +0000 Subject: [PATCH 30/38] Add #[inline] to core::io methods with simple logic or forwarding --- library/core/src/io/error.rs | 8 ++++++++ library/core/src/io/error/os_functions_atomic.rs | 1 + library/core/src/io/error/repr_bitpacked.rs | 1 + library/core/src/io/io_slice.rs | 2 ++ library/core/src/net/ip_addr.rs | 1 + 5 files changed, 13 insertions(+) diff --git a/library/core/src/io/error.rs b/library/core/src/io/error.rs index 61abdb16d07da..0df8b2d05cf48 100644 --- a/library/core/src/io/error.rs +++ b/library/core/src/io/error.rs @@ -534,6 +534,7 @@ impl fmt::Display for Error { #[stable(feature = "rust1", since = "1.0.0")] impl error::Error for Error { #[allow(deprecated)] + #[inline] fn cause(&self) -> Option<&dyn error::Error> { match self.repr.data() { ErrorData::Os(..) => None, @@ -543,6 +544,7 @@ impl error::Error for Error { } } + #[inline] fn source(&self) -> Option<&(dyn error::Error + 'static)> { match self.repr.data() { ErrorData::Os(..) => None, @@ -605,6 +607,7 @@ impl fmt::Debug for Custom { #[unstable(feature = "core_io_internals", reason = "exposed only for libstd", issue = "none")] impl Drop for Custom { + #[inline] fn drop(&mut self) { // SAFETY: `Custom::from_raw` ensures this call is safe. unsafe { @@ -631,12 +634,14 @@ impl Custom { } #[unstable(feature = "core_io_internals", reason = "exposed only for libstd", issue = "none")] + #[inline] pub fn into_raw(self) -> crate::ptr::NonNull { let ptr = self.error; core::mem::forget(self); ptr } + #[inline] fn error_ref(&self) -> &(dyn error::Error + Send + Sync + 'static) { // SAFETY: // `from_raw` ensures `error` is a valid pointer up to a static lifetime @@ -644,6 +649,7 @@ impl Custom { unsafe { self.error.as_ref() } } + #[inline] fn error_mut(&mut self) -> &mut (dyn error::Error + Send + Sync + 'static) { // SAFETY: // `from_raw` ensures `error` is a valid pointer up to a static lifetime @@ -668,6 +674,7 @@ unsafe impl Sync for CustomOwner {} #[unstable(feature = "core_io_internals", reason = "exposed only for libstd", issue = "none")] impl Drop for CustomOwner { + #[inline] fn drop(&mut self) { // SAFETY: `CustomOwner::from_raw` ensures this call is safe. unsafe { @@ -687,6 +694,7 @@ impl CustomOwner { } #[unstable(feature = "core_io_internals", reason = "exposed only for libstd", issue = "none")] + #[inline] pub fn into_raw(self) -> crate::ptr::NonNull { let ptr = self.0; core::mem::forget(self); diff --git a/library/core/src/io/error/os_functions_atomic.rs b/library/core/src/io/error/os_functions_atomic.rs index dfaf59ae742de..d4d77ced59187 100644 --- a/library/core/src/io/error/os_functions_atomic.rs +++ b/library/core/src/io/error/os_functions_atomic.rs @@ -15,6 +15,7 @@ use crate::sync::atomic; static OS_FUNCTIONS: atomic::AtomicPtr = atomic::AtomicPtr::new(OsFunctions::DEFAULT as *const _ as *mut _); +#[inline] fn get_os_functions() -> &'static OsFunctions { // SAFETY: // * `OS_FUNCTIONS` is initially a pointer to `OsFunctions::DEFAULT`, which is valid for a static lifetime. diff --git a/library/core/src/io/error/repr_bitpacked.rs b/library/core/src/io/error/repr_bitpacked.rs index 22cb331924081..8758e5543762a 100644 --- a/library/core/src/io/error/repr_bitpacked.rs +++ b/library/core/src/io/error/repr_bitpacked.rs @@ -133,6 +133,7 @@ unsafe impl Send for Repr {} unsafe impl Sync for Repr {} impl Repr { + #[inline] pub(super) fn new_custom(b: CustomOwner) -> Self { let p = b.into_raw().as_ptr().cast::(); // Should only be possible if an allocator handed out a pointer with diff --git a/library/core/src/io/io_slice.rs b/library/core/src/io/io_slice.rs index 0bdd410d3e964..807bbfcd36225 100644 --- a/library/core/src/io/io_slice.rs +++ b/library/core/src/io/io_slice.rs @@ -155,6 +155,7 @@ impl<'a> IoSliceMut<'a> { /// assert_eq!(&data, b"Abcdef"); /// ``` #[unstable(feature = "io_slice_as_bytes", issue = "132818")] + #[inline] pub const fn into_slice(self) -> &'a mut [u8] { self.0.into_slice() } @@ -323,6 +324,7 @@ impl<'a> IoSlice<'a> { /// assert_eq!(io_slice.as_slice(), b"def"); /// ``` #[unstable(feature = "io_slice_as_bytes", issue = "132818")] + #[inline] pub const fn as_slice(self) -> &'a [u8] { self.0.as_slice() } diff --git a/library/core/src/net/ip_addr.rs b/library/core/src/net/ip_addr.rs index 4e380a93972e7..3fe98eba22358 100644 --- a/library/core/src/net/ip_addr.rs +++ b/library/core/src/net/ip_addr.rs @@ -2480,6 +2480,7 @@ macro_rules! bitop_impls { $(#[$attr])* const impl $BitOpAssign<&'_ $ty> for $ty { + #[inline] fn $bitop_assign(&mut self, rhs: &'_ $ty) { self.$bitop_assign(*rhs); } From 4b0cd8edd9831d84c20d1b25eeca28f264442de9 Mon Sep 17 00:00:00 2001 From: jyn Date: Wed, 15 Jul 2026 10:00:47 +0000 Subject: [PATCH 31/38] make a couple codegen-llvm tests compatible with 2021 edition previously they failed for simple syntax reasons. --- tests/codegen-llvm/fatptr.rs | 2 +- tests/codegen-llvm/reg-struct-return.rs | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/tests/codegen-llvm/fatptr.rs b/tests/codegen-llvm/fatptr.rs index 041807202b841..91efe04efc8f5 100644 --- a/tests/codegen-llvm/fatptr.rs +++ b/tests/codegen-llvm/fatptr.rs @@ -6,7 +6,7 @@ pub trait T {} // CHECK-LABEL: @copy_fat_ptr #[no_mangle] -pub fn copy_fat_ptr(x: &T) { +pub fn copy_fat_ptr(x: &dyn T) { // CHECK-NOT: extractvalue let x2 = x; } diff --git a/tests/codegen-llvm/reg-struct-return.rs b/tests/codegen-llvm/reg-struct-return.rs index f45e66c96d630..52a1e174dfe6b 100644 --- a/tests/codegen-llvm/reg-struct-return.rs +++ b/tests/codegen-llvm/reg-struct-return.rs @@ -90,17 +90,7 @@ pub struct FooFloat3 { } pub mod tests { - use Foo; - use Foo1; - use Foo2; - use Foo3; - use Foo4; - use Foo5; - use FooFloat1; - use FooFloat2; - use FooFloat3; - use FooOversize1; - use FooOversize2; + use super::*; // ENABLED: i64 @f1() // DISABLED: void @f1(ptr {{.*}}sret From 2c38aed99158806a69e319450c490b50ad39f50f Mon Sep 17 00:00:00 2001 From: Walnut <39544927+Walnut356@users.noreply.github.com> Date: Thu, 16 Jul 2026 06:55:51 -0500 Subject: [PATCH 32/38] emit (lldb) prefix to make commands more distinct --- src/etc/lldb_batchmode/runner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/etc/lldb_batchmode/runner.py b/src/etc/lldb_batchmode/runner.py index cdc5458606858..8b226b3349cb1 100644 --- a/src/etc/lldb_batchmode/runner.py +++ b/src/etc/lldb_batchmode/runner.py @@ -74,7 +74,7 @@ def execute_command(command_interpreter, command): global registered_breakpoints res = lldb.SBCommandReturnObject() - print(command) + print(f"(lldb) {command}") command_interpreter.HandleCommand(command, res) if res.Succeeded(): From b6849b3c0e7cd1697e2de557dd013213c09f890a Mon Sep 17 00:00:00 2001 From: Jeremy Smart Date: Thu, 16 Jul 2026 12:24:24 +0000 Subject: [PATCH 33/38] add file operations to std dirfd --- library/std/src/fs.rs | 105 +++++++++++++++- library/std/src/fs/tests.rs | 45 ++++++- library/std/src/sys/fs/common.rs | 9 ++ library/std/src/sys/fs/unix/dir.rs | 32 ++++- library/std/src/sys/fs/windows/dir.rs | 119 ++++++++++++++++-- .../std/src/sys/pal/windows/c/bindings.txt | 4 + .../std/src/sys/pal/windows/c/windows_sys.rs | 28 +++++ 7 files changed, 322 insertions(+), 20 deletions(-) diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 77be07b097b03..3574855e04dc9 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -1547,6 +1547,8 @@ impl crate::io::IoHandle for File {} impl Dir { /// Attempts to open a directory at `path` in read-only mode. /// + /// This function opens a directory. To open a file instead, see [`File::open`]. + /// /// # Errors /// /// This function will return an error if `path` does not point to an existing directory. @@ -1572,8 +1574,30 @@ impl Dir { .map(|inner| Self { inner }) } + /// Queries metadata about the underlying directory. + /// + /// # Examples + /// + /// ```no_run + /// #![feature(dirfd)] + /// use std::fs::Dir; + /// + /// fn main() -> std::io::Result<()> { + /// let dir = Dir::open("foo")?; + /// let metadata = dir.metadata()?; + /// Ok(()) + /// } + /// ``` + #[unstable(feature = "dirfd", issue = "120426")] + pub fn metadata(&self) -> io::Result { + self.inner.metadata().map(Metadata) + } + /// Attempts to open a file in read-only mode relative to this directory. /// + /// This function interprets `path` relative to the directory provided by `self`. To open a file + /// relative to the current working directory, or at an absolute path, see [`File::open`]. + /// /// # Errors /// /// This function will return an error if `path` does not point to an existing file. @@ -1600,7 +1624,47 @@ impl Dir { .map(|f| File { inner: f }) } - /// Queries metadata about the underlying directory. + /// Attempts to open a file according to `opts` relative to this directory. + /// + /// This function interprets `path` relative to the directory provided by `self`. To open a file + /// relative to the current working directory, or at an absolute path, see [`File::open`]. + /// + /// # Errors + /// + /// This function will return an error if `path` does not point to an existing file. + /// Other errors may also be returned according to [`OpenOptions::open`]. + /// + /// # Examples + /// + /// ```no_run + /// #![feature(dirfd)] + /// use std::{fs::{Dir, OpenOptions}, io::{self, Write}}; + /// + /// fn main() -> io::Result<()> { + /// let dir = Dir::open("foo")?; + /// let mut opts = OpenOptions::new(); + /// opts.read(true).write(true); + /// let mut f = dir.open_file_with("bar.txt", &opts)?; + /// f.write_all(b"Hello, world!")?; + /// let contents = io::read_to_string(f)?; + /// assert_eq!(contents, "Hello, world!"); + /// Ok(()) + /// } + /// ``` + #[unstable(feature = "dirfd", issue = "120426")] + pub fn open_file_with>(&self, path: P, opts: &OpenOptions) -> io::Result { + self.inner.open_file(path.as_ref(), &opts.0).map(|f| File { inner: f }) + } + + /// Attempts to remove a file relative to this directory. + /// + /// This function interprets `path` relative to the directory provided by `self`. To remove a file + /// relative to the current working directory, or at an absolute path, see [`fs::remove_file`][remove_file]. + /// + /// # Errors + /// + /// This function will return an error if `path` does not point to an existing file. + /// Other errors may also be returned according to [`OpenOptions::open`]. /// /// # Examples /// @@ -1610,13 +1674,46 @@ impl Dir { /// /// fn main() -> std::io::Result<()> { /// let dir = Dir::open("foo")?; - /// let metadata = dir.metadata()?; + /// dir.remove_file("bar.txt")?; /// Ok(()) /// } /// ``` #[unstable(feature = "dirfd", issue = "120426")] - pub fn metadata(&self) -> io::Result { - self.inner.metadata().map(Metadata) + pub fn remove_file>(&self, path: P) -> io::Result<()> { + self.inner.remove_file(path.as_ref()) + } + + /// Attempts to rename a file or directory relative to this directory to a new name, replacing + /// the destination file if present. + /// + /// This function interprets `from` relative to the directory provided by `self` and `to` relative to the directory + /// provided by `to_dir`. To rename a file relative to the current working directory, or at an absolute path, see [`fs::rename`][rename]. + /// + /// # Errors + /// + /// This function will return an error if `from` does not point to an existing file or directory. + /// Other errors may also be returned according to [`OpenOptions::open`]. + /// + /// # Examples + /// + /// ```no_run + /// #![feature(dirfd)] + /// use std::fs::Dir; + /// + /// fn main() -> std::io::Result<()> { + /// let dir = Dir::open("foo")?; + /// dir.rename("bar.txt", &dir, "quux.txt")?; + /// Ok(()) + /// } + /// ``` + #[unstable(feature = "dirfd", issue = "120426")] + pub fn rename, Q: AsRef>( + &self, + from: P, + to_dir: &Self, + to: Q, + ) -> io::Result<()> { + self.inner.rename(from.as_ref(), &to_dir.inner, to.as_ref()) } } diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs index eb619aa4884c5..4f2fa7fbc591e 100644 --- a/library/std/src/fs/tests.rs +++ b/library/std/src/fs/tests.rs @@ -1,7 +1,7 @@ use rand::RngCore; use super::Dir; -use crate::fs::{self, File, FileTimes, OpenOptions, TryLockError}; +use crate::fs::{self, File, FileTimes, OpenOptions, TryLockError, exists}; use crate::io::prelude::*; use crate::io::{BorrowedBuf, ErrorKind, SeekFrom}; use crate::mem::MaybeUninit; @@ -2546,8 +2546,7 @@ fn test_dir_smoke_test() { fn test_dir_read_file() { let tmpdir = tmpdir(); let mut f = check!(File::create(tmpdir.join("foo.txt"))); - check!(f.write(b"bar")); - check!(f.flush()); + check!(f.write_all(b"bar")); drop(f); let dir = check!(Dir::open(tmpdir.path())); let f = check!(dir.open_file("foo.txt")); @@ -2565,3 +2564,43 @@ fn test_dir_metadata() { let metadata = check!(dir.metadata()); assert!(metadata.is_dir()); } + +#[test] +fn test_dir_write_file() { + let tmpdir = tmpdir(); + let dir = check!(Dir::open(tmpdir.path())); + let mut f = check!(dir.open_file_with("foo.txt", &OpenOptions::new().write(true).create(true))); + check!(f.write(b"bar")); + check!(f.flush()); + drop(f); + let mut f = check!(File::open(tmpdir.join("foo.txt"))); + let mut buf = [0u8; 3]; + check!(f.read_exact(&mut buf)); + assert_eq!(b"bar", &buf); +} + +#[test] +fn test_dir_remove_file() { + let tmpdir = tmpdir(); + let mut f = check!(File::create(tmpdir.join("foo.txt"))); + check!(f.write(b"bar")); + check!(f.flush()); + drop(f); + let dir = check!(Dir::open(tmpdir.path())); + check!(dir.remove_file("foo.txt")); + assert!(!matches!(exists(tmpdir.join("foo.txt")), Ok(true))); +} + +#[test] +fn test_dir_rename_file() { + let tmpdir = tmpdir(); + let mut f = check!(File::create(tmpdir.join("foo.txt"))); + check!(f.write_all(b"bar")); + drop(f); + let dir = check!(Dir::open(tmpdir.path())); + check!(dir.rename("foo.txt", &dir, "baz.txt")); + let mut f = check!(File::open(tmpdir.join("baz.txt"))); + let mut buf = [0u8; 3]; + check!(f.read_exact(&mut buf)); + assert_eq!(b"bar", &buf); +} diff --git a/library/std/src/sys/fs/common.rs b/library/std/src/sys/fs/common.rs index 0df91d56b8a19..68aed39d1dcdf 100644 --- a/library/std/src/sys/fs/common.rs +++ b/library/std/src/sys/fs/common.rs @@ -1,5 +1,6 @@ #![allow(dead_code)] // not used on all platforms +use crate::fs::{remove_file, rename}; use crate::io::{self, Error, ErrorKind}; use crate::path::{Path, PathBuf}; use crate::sys::IntoInner; @@ -77,6 +78,14 @@ impl Dir { pub fn metadata(&self) -> io::Result { self.path.metadata().map(|m| m.into_inner()) } + + pub fn remove_file(&self, path: &Path) -> io::Result<()> { + remove_file(self.path.join(path)) + } + + pub fn rename(&self, from: &Path, to_dir: &Self, to: &Path) -> io::Result<()> { + rename(self.path.join(from), to_dir.path.join(to)) + } } impl fmt::Debug for Dir { diff --git a/library/std/src/sys/fs/unix/dir.rs b/library/std/src/sys/fs/unix/dir.rs index b3b4d25b27a84..f3f612a225ed1 100644 --- a/library/std/src/sys/fs/unix/dir.rs +++ b/library/std/src/sys/fs/unix/dir.rs @@ -1,4 +1,4 @@ -use libc::c_int; +use libc::{c_int, renameat, unlinkat}; cfg_select! { not( @@ -27,7 +27,7 @@ use crate::sys::fd::FileDesc; use crate::sys::fs::OpenOptions; use crate::sys::fs::unix::{File, FileAttr, debug_path_fd}; use crate::sys::helpers::run_path_with_cstr; -use crate::sys::{AsInner, FromInner, IntoInner, cvt_r}; +use crate::sys::{AsInner, FromInner, IntoInner, cvt, cvt_r}; use crate::{fmt, fs, io}; pub struct Dir(OwnedFd); @@ -51,6 +51,16 @@ impl Dir { f.file_attr() } + pub fn remove_file(&self, path: &Path) -> io::Result<()> { + run_path_with_cstr(path, &|path| self.remove_c(path, false)) + } + + pub fn rename(&self, from: &Path, to_dir: &Self, to: &Path) -> io::Result<()> { + run_path_with_cstr(from, &|from| { + run_path_with_cstr(to, &|to| self.rename_c(from, to_dir, to)) + }) + } + pub fn open_with_c(path: &CStr, opts: &OpenOptions) -> io::Result { let flags = libc::O_CLOEXEC | libc::O_DIRECTORY @@ -71,6 +81,24 @@ impl Dir { })?; Ok(File(unsafe { FileDesc::from_raw_fd(fd) })) } + + fn remove_c(&self, path: &CStr, remove_dir: bool) -> io::Result<()> { + cvt(unsafe { + unlinkat( + self.0.as_raw_fd(), + path.as_ptr(), + if remove_dir { libc::AT_REMOVEDIR } else { 0 }, + ) + }) + .map(|_| ()) + } + + fn rename_c(&self, from: &CStr, to_dir: &Self, to: &CStr) -> io::Result<()> { + cvt(unsafe { + renameat(self.0.as_raw_fd(), from.as_ptr(), to_dir.0.as_raw_fd(), to.as_ptr()) + }) + .map(|_| ()) + } } impl fmt::Debug for Dir { diff --git a/library/std/src/sys/fs/windows/dir.rs b/library/std/src/sys/fs/windows/dir.rs index d8203cfcc82b5..cd86f76bbcf83 100644 --- a/library/std/src/sys/fs/windows/dir.rs +++ b/library/std/src/sys/fs/windows/dir.rs @@ -1,9 +1,12 @@ +use crate::alloc::{Layout, alloc, dealloc}; +use crate::ffi::c_void; +use crate::mem::offset_of; use crate::os::windows::io::{ AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, HandleOrInvalid, IntoRawHandle, OwnedHandle, RawHandle, }; use crate::path::Path; -use crate::sys::api::{UnicodeStrRef, WinError}; +use crate::sys::api::{self, SetFileInformation, UnicodeStrRef, WinError}; use crate::sys::fs::windows::debug_path_handle; use crate::sys::fs::{File, FileAttr, OpenOptions}; use crate::sys::handle::Handle; @@ -15,6 +18,12 @@ pub struct Dir { handle: Handle, } +fn to_u16s_without_nul(path: &Path) -> io::Result> { + let mut path = to_u16s(path)?; + path.pop(); + Ok(path) +} + /// A wrapper around a raw NtCreateFile call. /// /// This isn't completely safe because `OBJECT_ATTRIBUTES` contains raw pointers. @@ -62,9 +71,20 @@ impl Dir { if path.is_absolute() { return File::open(path, opts); } - let path = to_u16s(path)?; - let path = &path[..path.len() - 1]; // trim 0 byte - self.open_file_native(&path, opts).map(|handle| File { handle }) + let path = to_u16s_without_nul(path)?; + self.open_file_native(&path, opts, false).map(|handle| File { handle }) + } + + pub fn remove_file(&self, path: &Path) -> io::Result<()> { + let path = to_u16s_without_nul(path)?; + self.remove_native(&path, false) + } + + pub fn rename(&self, from: &Path, to_dir: &Self, to: &Path) -> io::Result<()> { + let is_dir = from.is_dir(); + let from = to_u16s_without_nul(from)?; + let to = to_u16s_without_nul(to)?; + self.rename_native(&from, to_dir, &to, is_dir) } fn open_with_native(path: &WCStr, opts: &OpenOptions) -> io::Result { @@ -92,14 +112,91 @@ impl Dir { } } - fn open_file_native(&self, path: &[u16], opts: &OpenOptions) -> io::Result { + fn open_file_native(&self, path: &[u16], opts: &OpenOptions, dir: bool) -> io::Result { let name = UnicodeStrRef::from_slice(path); let object_attributes = c::OBJECT_ATTRIBUTES { RootDirectory: self.handle.as_raw_handle(), ObjectName: name.as_ptr(), ..c::OBJECT_ATTRIBUTES::with_length() }; - unsafe { nt_create_file(opts, &object_attributes, c::FILE_NON_DIRECTORY_FILE) } + let create_opt = if dir { c::FILE_DIRECTORY_FILE } else { c::FILE_NON_DIRECTORY_FILE }; + unsafe { nt_create_file(opts, &object_attributes, create_opt) } + } + + fn remove_native(&self, path: &[u16], dir: bool) -> io::Result<()> { + let mut opts = OpenOptions::new(); + opts.access_mode(c::DELETE); + let handle = self.open_file_native(path, &opts, dir)?; + let info = c::FILE_DISPOSITION_INFO_EX { Flags: c::FILE_DISPOSITION_FLAG_DELETE }; + let result = unsafe { + c::SetFileInformationByHandle( + handle.as_raw_handle(), + c::FileDispositionInfoEx, + (&info).as_ptr(), + size_of::() as _, + ) + }; + if result == 0 { Err(api::get_last_error()).io_result() } else { Ok(()) } + } + + fn rename_native(&self, from: &[u16], to_dir: &Self, to: &[u16], dir: bool) -> io::Result<()> { + let mut opts = OpenOptions::new(); + opts.access_mode(c::DELETE); + opts.custom_flags(c::FILE_FLAG_OPEN_REPARSE_POINT | c::FILE_FLAG_BACKUP_SEMANTICS); + let handle = self.open_file_native(from, &opts, dir)?; + // Calculate the layout of the `FILE_RENAME_INFORMATION` we pass to `NtSetInformationFile` + // This is a dynamically sized struct so we need to get the position of the last field to calculate the actual size. + const too_long_err: io::Error = + io::const_error!(io::ErrorKind::InvalidFilename, "Filename too long"); + let struct_size = to + .len() + .checked_mul(2) + .and_then(|x| x.checked_add(offset_of!(c::FILE_RENAME_INFORMATION, FileName))) + .ok_or(too_long_err)?; + let layout = Layout::from_size_align(struct_size, align_of::()) + .map_err(|_| too_long_err)?; + let struct_size = u32::try_from(struct_size).map_err(|_| too_long_err)?; + let to_byte_len = u32::try_from(to.len() * 2).map_err(|_| too_long_err)?; + + let file_rename_info; + // SAFETY: We allocate enough memory for a full FILE_RENAME_INFORMATION struct and the filename. + unsafe { + file_rename_info = alloc(layout).cast::(); + if file_rename_info.is_null() { + return Err(io::ErrorKind::OutOfMemory.into()); + } + + (&raw mut (*file_rename_info).Anonymous).write(c::FILE_RENAME_INFORMATION_0 { + Flags: c::FILE_RENAME_FLAG_REPLACE_IF_EXISTS | c::FILE_RENAME_FLAG_POSIX_SEMANTICS, + }); + + (&raw mut (*file_rename_info).RootDirectory).write(to_dir.handle.as_raw_handle()); + // Don't include the NULL in the size + (&raw mut (*file_rename_info).FileNameLength).write(to_byte_len); + + to.as_ptr().copy_to_nonoverlapping( + (&raw mut (*file_rename_info).FileName).cast::(), + to.len(), + ); + } + + let status = unsafe { + c::NtSetInformationFile( + handle.as_raw_handle(), + &mut c::IO_STATUS_BLOCK::default(), + file_rename_info.cast::(), + struct_size, + c::FileRenameInformation, + ) + }; + unsafe { dealloc(file_rename_info.cast::(), layout) }; + if c::nt_success(status) { + // SAFETY: nt_success guarantees that handle is no longer null + Ok(()) + } else { + Err(WinError::new(unsafe { c::RtlNtStatusToDosError(status) })) + } + .io_result() } pub fn metadata(&self) -> io::Result { @@ -127,35 +224,35 @@ impl AsRawHandle for fs::Dir { } } -#[unstable(feature = "dirhandle", issue = "120426")] +#[unstable(feature = "dirfd", issue = "120426")] impl IntoRawHandle for fs::Dir { fn into_raw_handle(self) -> RawHandle { self.into_inner().handle.into_raw_handle() } } -#[unstable(feature = "dirhandle", issue = "120426")] +#[unstable(feature = "dirfd", issue = "120426")] impl FromRawHandle for fs::Dir { unsafe fn from_raw_handle(handle: RawHandle) -> Self { Self::from_inner(Dir { handle: unsafe { FromRawHandle::from_raw_handle(handle) } }) } } -#[unstable(feature = "dirhandle", issue = "120426")] +#[unstable(feature = "dirfd", issue = "120426")] impl AsHandle for fs::Dir { fn as_handle(&self) -> BorrowedHandle<'_> { self.as_inner().handle.as_handle() } } -#[unstable(feature = "dirhandle", issue = "120426")] +#[unstable(feature = "dirfd", issue = "120426")] impl From for OwnedHandle { fn from(value: fs::Dir) -> Self { value.into_inner().handle.into_inner() } } -#[unstable(feature = "dirhandle", issue = "120426")] +#[unstable(feature = "dirfd", issue = "120426")] impl From for fs::Dir { fn from(value: OwnedHandle) -> Self { Self::from_inner(Dir { handle: Handle::from_inner(value) }) diff --git a/library/std/src/sys/pal/windows/c/bindings.txt b/library/std/src/sys/pal/windows/c/bindings.txt index ac1603020312f..71379202874ae 100644 --- a/library/std/src/sys/pal/windows/c/bindings.txt +++ b/library/std/src/sys/pal/windows/c/bindings.txt @@ -2075,6 +2075,7 @@ FILE_READ_EA FILE_RENAME_FLAG_POSIX_SEMANTICS FILE_RENAME_FLAG_REPLACE_IF_EXISTS FILE_RENAME_INFO +FILE_RENAME_INFORMATION FILE_RESERVE_OPFILTER FILE_SEQUENTIAL_ONLY FILE_SESSION_AWARE @@ -2120,6 +2121,8 @@ FileNormalizedNameInfo FileRemoteProtocolInfo FileRenameInfo FileRenameInfoEx +FileRenameInformation +FileRenameInformationEx FileStandardInfo FileStorageInfo FileStreamInfo @@ -2311,6 +2314,7 @@ NTCREATEFILE_CREATE_DISPOSITION NTCREATEFILE_CREATE_OPTIONS NtOpenFile NtReadFile +NtSetInformationFile NTSTATUS NtWriteFile OBJ_CASE_INSENSITIVE diff --git a/library/std/src/sys/pal/windows/c/windows_sys.rs b/library/std/src/sys/pal/windows/c/windows_sys.rs index 411df70967cd5..9e867ec9dfae7 100644 --- a/library/std/src/sys/pal/windows/c/windows_sys.rs +++ b/library/std/src/sys/pal/windows/c/windows_sys.rs @@ -80,6 +80,7 @@ windows_link::link!("kernel32.dll" "system" fn MultiByteToWideChar(codepage : u3 windows_link::link!("ntdll.dll" "system" fn NtCreateFile(filehandle : *mut HANDLE, desiredaccess : FILE_ACCESS_RIGHTS, objectattributes : *const OBJECT_ATTRIBUTES, iostatusblock : *mut IO_STATUS_BLOCK, allocationsize : *const i64, fileattributes : FILE_FLAGS_AND_ATTRIBUTES, shareaccess : FILE_SHARE_MODE, createdisposition : NTCREATEFILE_CREATE_DISPOSITION, createoptions : NTCREATEFILE_CREATE_OPTIONS, eabuffer : *const core::ffi::c_void, ealength : u32) -> NTSTATUS); windows_link::link!("ntdll.dll" "system" fn NtOpenFile(filehandle : *mut HANDLE, desiredaccess : u32, objectattributes : *const OBJECT_ATTRIBUTES, iostatusblock : *mut IO_STATUS_BLOCK, shareaccess : u32, openoptions : u32) -> NTSTATUS); windows_link::link!("ntdll.dll" "system" fn NtReadFile(filehandle : HANDLE, event : HANDLE, apcroutine : PIO_APC_ROUTINE, apccontext : *const core::ffi::c_void, iostatusblock : *mut IO_STATUS_BLOCK, buffer : *mut core::ffi::c_void, length : u32, byteoffset : *const i64, key : *const u32) -> NTSTATUS); +windows_link::link!("ntdll.dll" "system" fn NtSetInformationFile(filehandle : HANDLE, iostatusblock : *mut IO_STATUS_BLOCK, fileinformation : *const core::ffi::c_void, length : u32, fileinformationclass : FILE_INFORMATION_CLASS) -> NTSTATUS); windows_link::link!("ntdll.dll" "system" fn NtWriteFile(filehandle : HANDLE, event : HANDLE, apcroutine : PIO_APC_ROUTINE, apccontext : *const core::ffi::c_void, iostatusblock : *mut IO_STATUS_BLOCK, buffer : *const core::ffi::c_void, length : u32, byteoffset : *const i64, key : *const u32) -> NTSTATUS); windows_link::link!("advapi32.dll" "system" fn OpenProcessToken(processhandle : HANDLE, desiredaccess : TOKEN_ACCESS_MASK, tokenhandle : *mut HANDLE) -> BOOL); windows_link::link!("kernel32.dll" "system" fn QueryPerformanceCounter(lpperformancecount : *mut i64) -> BOOL); @@ -2537,6 +2538,7 @@ impl Default for FILE_ID_BOTH_DIR_INFO { unsafe { core::mem::zeroed() } } } +pub type FILE_INFORMATION_CLASS = i32; pub type FILE_INFO_BY_HANDLE_CLASS = i32; #[repr(C)] #[derive(Clone, Copy, Default)] @@ -2598,6 +2600,30 @@ impl Default for FILE_RENAME_INFO_0 { unsafe { core::mem::zeroed() } } } +#[repr(C)] +#[derive(Clone, Copy)] +pub struct FILE_RENAME_INFORMATION { + pub Anonymous: FILE_RENAME_INFORMATION_0, + pub RootDirectory: HANDLE, + pub FileNameLength: u32, + pub FileName: [u16; 1], +} +impl Default for FILE_RENAME_INFORMATION { + fn default() -> Self { + unsafe { core::mem::zeroed() } + } +} +#[repr(C)] +#[derive(Clone, Copy)] +pub union FILE_RENAME_INFORMATION_0 { + pub ReplaceIfExists: bool, + pub Flags: u32, +} +impl Default for FILE_RENAME_INFORMATION_0 { + fn default() -> Self { + unsafe { core::mem::zeroed() } + } +} pub const FILE_RESERVE_OPFILTER: NTCREATEFILE_CREATE_OPTIONS = 1048576u32; pub const FILE_SEQUENTIAL_ONLY: NTCREATEFILE_CREATE_OPTIONS = 4u32; pub const FILE_SESSION_AWARE: NTCREATEFILE_CREATE_OPTIONS = 262144u32; @@ -2706,6 +2732,8 @@ pub const FileNormalizedNameInfo: FILE_INFO_BY_HANDLE_CLASS = 24i32; pub const FileRemoteProtocolInfo: FILE_INFO_BY_HANDLE_CLASS = 13i32; pub const FileRenameInfo: FILE_INFO_BY_HANDLE_CLASS = 3i32; pub const FileRenameInfoEx: FILE_INFO_BY_HANDLE_CLASS = 22i32; +pub const FileRenameInformation: FILE_INFORMATION_CLASS = 10i32; +pub const FileRenameInformationEx: FILE_INFORMATION_CLASS = 65i32; pub const FileStandardInfo: FILE_INFO_BY_HANDLE_CLASS = 1i32; pub const FileStorageInfo: FILE_INFO_BY_HANDLE_CLASS = 16i32; pub const FileStreamInfo: FILE_INFO_BY_HANDLE_CLASS = 7i32; From 4946081a94d98cd6fa3a0a6eb7d1c44d7d909aba Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 16 Jul 2026 14:39:53 +0000 Subject: [PATCH 34/38] Update Rust crate rand to v0.9.3 [SECURITY] --- Cargo.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4f65c39bc204c..b9c5248476ae3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2105,7 +2105,7 @@ dependencies = [ "libc", "mio", "postcard", - "rand 0.9.2", + "rand 0.9.3", "rustc-hash 2.1.1", "serde_core", "tempfile", @@ -3317,9 +3317,9 @@ dependencies = [ [[package]] name = "rand" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +checksum = "7ec095654a25171c2124e9e3393a930bddbffdc939556c914957a4c3e0a87166" dependencies = [ "rand_chacha", "rand_core 0.9.3", @@ -3636,7 +3636,7 @@ name = "rustc_abi" version = "0.0.0" dependencies = [ "bitflags", - "rand 0.9.2", + "rand 0.9.3", "rand_xoshiro", "rustc_data_structures", "rustc_error_messages", @@ -4215,7 +4215,7 @@ dependencies = [ name = "rustc_incremental" version = "0.0.0" dependencies = [ - "rand 0.9.2", + "rand 0.9.3", "rustc_data_structures", "rustc_errors", "rustc_fs_util", @@ -4270,7 +4270,7 @@ dependencies = [ name = "rustc_interface" version = "0.0.0" dependencies = [ - "rand 0.9.2", + "rand 0.9.3", "rustc_abi", "rustc_ast", "rustc_ast_lowering", @@ -4859,7 +4859,7 @@ dependencies = [ "crossbeam-deque", "crossbeam-utils", "libc", - "rand 0.9.2", + "rand 0.9.3", "rand_xorshift", "scoped-tls", "smallvec", @@ -5604,7 +5604,7 @@ version = "0.1.0" dependencies = [ "indicatif", "num", - "rand 0.9.2", + "rand 0.9.3", "rand_chacha", "rayon", ] From 458cc7fc7fae13aefe50d481b8fdc97c0d8ac590 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 16 Jul 2026 14:40:04 +0000 Subject: [PATCH 35/38] Update Rust crate rkyv to v0.8.16 [SECURITY] --- Cargo.lock | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4f65c39bc204c..d148d932a2f0c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1724,12 +1724,6 @@ dependencies = [ "foldhash 0.1.5", ] -[[package]] -name = "hashbrown" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" - [[package]] name = "hashbrown" version = "0.17.0" @@ -3510,13 +3504,13 @@ dependencies = [ [[package]] name = "rkyv" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a30e631b7f4a03dee9056b8ef6982e8ba371dd5bedb74d3ec86df4499132c70" +checksum = "73389e0c99e664f919275ab5b5b0471391fe9a8de61e1dff9b1eaf56a90f16e3" dependencies = [ "bytecheck", "bytes", - "hashbrown 0.16.1", + "hashbrown 0.17.0", "indexmap", "munge", "ptr_meta", @@ -3529,9 +3523,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8100bb34c0a1d0f907143db3149e6b4eea3c33b9ee8b189720168e818303986f" +checksum = "5d2ed0b54125315fb36bd021e82d314d1c126548f871634b483f46b31d13cac6" dependencies = [ "proc-macro2", "quote", From e4ed50d0d3cdaa0388f7e9e7651ceb287e7eee38 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 16 Jul 2026 14:40:18 +0000 Subject: [PATCH 36/38] Update Rust crate tar to v0.4.46 [SECURITY] --- Cargo.lock | 22 +++++++++++----------- src/bootstrap/Cargo.lock | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4f65c39bc204c..f2ce74e74669b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -871,7 +871,7 @@ version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -1284,7 +1284,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -1411,7 +1411,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -2204,7 +2204,7 @@ dependencies = [ "portable-atomic", "portable-atomic-util", "serde_core", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -2691,7 +2691,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5119,7 +5119,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5532,9 +5532,9 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.45" +version = "0.4.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22692a6476a21fa75fdfc11d452fda482af402c008cdbaf3476414e122040973" +checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840" dependencies = [ "filetime", "libc", @@ -5551,7 +5551,7 @@ dependencies = [ "getrandom 0.3.3", "once_cell", "rustix", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5570,7 +5570,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8c27177b12a6399ffc08b98f76f7c9a1f4fe9fc967c784c5a071fa8d93cf7e1" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -6548,7 +6548,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] diff --git a/src/bootstrap/Cargo.lock b/src/bootstrap/Cargo.lock index f988d207529b6..d8406c464d014 100644 --- a/src/bootstrap/Cargo.lock +++ b/src/bootstrap/Cargo.lock @@ -757,9 +757,9 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.45" +version = "0.4.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22692a6476a21fa75fdfc11d452fda482af402c008cdbaf3476414e122040973" +checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840" dependencies = [ "filetime", "libc", From 663d082bd9b963e2aef95a5c57d5f04229022ee6 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 16 Jul 2026 14:40:35 +0000 Subject: [PATCH 37/38] Update Rust crate tracing-subscriber [SECURITY] --- Cargo.lock | 34 +++++++++++----------- src/bootstrap/Cargo.lock | 62 +++++++++------------------------------- 2 files changed, 31 insertions(+), 65 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4f65c39bc204c..d9f6a0fcdc54b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -871,7 +871,7 @@ version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -1284,7 +1284,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -1411,7 +1411,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -2204,7 +2204,7 @@ dependencies = [ "portable-atomic", "portable-atomic-util", "serde_core", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -2691,7 +2691,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5119,7 +5119,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5551,7 +5551,7 @@ dependencies = [ "getrandom 0.3.3", "once_cell", "rustix", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5570,7 +5570,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8c27177b12a6399ffc08b98f76f7c9a1f4fe9fc967c784c5a071fa8d93cf7e1" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5877,9 +5877,9 @@ checksum = "d282ade6016312faf3e41e57ebbba0c073e4056dab1232ab1cb624199648f8ed" [[package]] name = "tracing" -version = "0.1.41" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -5888,9 +5888,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", @@ -5899,9 +5899,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.34" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", "valuable", @@ -5940,9 +5940,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.20" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" +checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" dependencies = [ "matchers", "nu-ansi-term", @@ -6548,7 +6548,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] diff --git a/src/bootstrap/Cargo.lock b/src/bootstrap/Cargo.lock index f988d207529b6..89322d9d53249 100644 --- a/src/bootstrap/Cargo.lock +++ b/src/bootstrap/Cargo.lock @@ -82,7 +82,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" dependencies = [ "memchr", - "regex-automata 0.4.9", + "regex-automata", "serde", ] @@ -309,8 +309,8 @@ dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", + "regex-automata", + "regex-syntax", ] [[package]] @@ -338,7 +338,7 @@ dependencies = [ "globset", "log", "memchr", - "regex-automata 0.4.9", + "regex-automata", "same-file", "walkdir", "winapi-util", @@ -420,11 +420,11 @@ dependencies = [ [[package]] name = "matchers" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" dependencies = [ - "regex-automata 0.1.10", + "regex-automata", ] [[package]] @@ -453,12 +453,11 @@ dependencies = [ [[package]] name = "nu-ansi-term" -version = "0.46.0" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "overload", - "winapi", + "windows-sys", ] [[package]] @@ -515,12 +514,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "pin-project-lite" version = "0.2.16" @@ -576,27 +569,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "regex" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", -] - [[package]] name = "regex-automata" version = "0.4.9" @@ -605,15 +577,9 @@ checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.5", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.8.5" @@ -862,14 +828,14 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.19" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" dependencies = [ "matchers", "nu-ansi-term", "once_cell", - "regex", + "regex-automata", "sharded-slab", "smallvec", "thread_local", From 73e371b47cad6701b44751617d1e33977fe0ee8f Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 16 Jul 2026 15:02:32 +0000 Subject: [PATCH 38/38] Update actions/checkout action to v7 --- .github/workflows/ci.yml | 6 +++--- .github/workflows/dependencies.yml | 4 ++-- .github/workflows/ghcr.yml | 2 +- .github/workflows/post-merge.yml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8747d77b46648..ca7210006fcaa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,7 +52,7 @@ jobs: run_type: ${{ steps.jobs.outputs.run_type }} steps: - name: Checkout the source code - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - name: Test citool # Only test citool on the auto branch, to reduce latency of the calculate matrix job # on PR/try builds. @@ -117,7 +117,7 @@ jobs: run: git config --global core.autocrlf false - name: checkout the source code - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: fetch-depth: 2 @@ -315,7 +315,7 @@ jobs: environment: ${{ (github.repository == 'rust-lang/rust' && 'bors') || '' }} steps: - name: checkout the source code - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: fetch-depth: 2 # Publish the toolstate if an auto build succeeds (just before push to the default branch) diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index f62b8e542652b..94b8aa1b599d1 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -51,7 +51,7 @@ jobs: runs-on: ubuntu-24.04 steps: - name: checkout the source code - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: submodules: recursive - name: install the bootstrap toolchain @@ -91,7 +91,7 @@ jobs: pull-requests: write steps: - name: checkout the source code - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - name: download Cargo.lock from update job uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.yml index 60deb90542607..9abb5f1929281 100644 --- a/.github/workflows/ghcr.yml +++ b/.github/workflows/ghcr.yml @@ -29,7 +29,7 @@ jobs: # Needed to write to the ghcr.io registry packages: write steps: - - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false diff --git a/.github/workflows/post-merge.yml b/.github/workflows/post-merge.yml index cbe92f1b52d9a..ac90e1a2b3da5 100644 --- a/.github/workflows/post-merge.yml +++ b/.github/workflows/post-merge.yml @@ -15,7 +15,7 @@ jobs: permissions: pull-requests: write steps: - - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: # Make sure that we have enough commits to find the parent merge commit. # Since all merges should be through merge commits, fetching two commits