From 7ae198b08dc422662136c5158b482859b159ec50 Mon Sep 17 00:00:00 2001 From: Yotam Ofek Date: Sat, 18 Jan 2025 07:43:31 +0000 Subject: [PATCH 001/128] don't use partial ordering on types that support total ordering --- compiler/rustc_resolve/src/diagnostics.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index ba217b7c88a8..66a04eb0617a 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -1139,7 +1139,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { }); // Make sure error reporting is deterministic. - suggestions.sort_by(|a, b| a.candidate.as_str().partial_cmp(b.candidate.as_str()).unwrap()); + suggestions.sort_by(|a, b| a.candidate.as_str().cmp(b.candidate.as_str())); match find_best_match_for_name( &suggestions.iter().map(|suggestion| suggestion.candidate).collect::>(), @@ -2360,7 +2360,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { // 2) `std` suggestions before `core` suggestions. let mut extern_crate_names = self.extern_prelude.keys().map(|ident| ident.name).collect::>(); - extern_crate_names.sort_by(|a, b| b.as_str().partial_cmp(a.as_str()).unwrap()); + extern_crate_names.sort_by(|a, b| b.as_str().cmp(a.as_str())); for name in extern_crate_names.into_iter() { // Replace first ident with a crate name and check if that is valid. From ce0b72a99c4c71c3b72c85549fafe5d0beb4cee4 Mon Sep 17 00:00:00 2001 From: Yotam Ofek Date: Sat, 18 Jan 2025 07:44:37 +0000 Subject: [PATCH 002/128] use slice patterns for checking for elements of slice --- compiler/rustc_resolve/src/diagnostics.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 66a04eb0617a..0da27a9c0717 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -2242,14 +2242,15 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { mut path: Vec, parent_scope: &ParentScope<'ra>, ) -> Option<(Vec, Option)> { - match (path.get(0), path.get(1)) { + match path[..] { // `{{root}}::ident::...` on both editions. // On 2015 `{{root}}` is usually added implicitly. - (Some(fst), Some(snd)) - if fst.ident.name == kw::PathRoot && !snd.ident.is_path_segment_keyword() => {} + [first, second, ..] + if first.ident.name == kw::PathRoot && !second.ident.is_path_segment_keyword() => {} // `ident::...` on 2018. - (Some(fst), _) - if fst.ident.span.at_least_rust_2018() && !fst.ident.is_path_segment_keyword() => + [first, ..] + if first.ident.span.at_least_rust_2018() + && !first.ident.is_path_segment_keyword() => { // Insert a placeholder that's later replaced by `self`/`super`/etc. path.insert(0, Segment::from_ident(Ident::empty())); From 1ba2153a056dd16d001ce8e56c9acad5536556d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Mon, 27 Jan 2025 19:44:25 +0100 Subject: [PATCH 003/128] Enable sanitizers on MSVC CI jobs Previously MSVC CI would ignore all tests annotated with needs-sanitizer-support header. --- src/ci/github-actions/jobs.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 7730d29d28f6..65b9b6f5abce 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -452,26 +452,26 @@ auto: - name: x86_64-msvc-1 env: - RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler + RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-sanitizers --enable-profiler SCRIPT: make ci-msvc-py <<: *job-windows-25 - name: x86_64-msvc-2 env: - RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-profiler + RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-sanitizers --enable-profiler SCRIPT: make ci-msvc-ps1 <<: *job-windows-25 # i686-msvc is split into two jobs to run tests in parallel. - name: i686-msvc-1 env: - RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc + RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc --enable-sanitizers SCRIPT: make ci-msvc-py <<: *job-windows - name: i686-msvc-2 env: - RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc + RUST_CONFIGURE_ARGS: --build=i686-pc-windows-msvc --enable-sanitizers SCRIPT: make ci-msvc-ps1 <<: *job-windows From fbd30ea35fb79d73faa9d5b3feae391fed5336c8 Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Wed, 29 Jan 2025 11:57:37 +0100 Subject: [PATCH 004/128] show supported register classes in inline assembly, show the supported register classes when an invalid one is found --- compiler/rustc_ast_lowering/messages.ftl | 3 ++- compiler/rustc_ast_lowering/src/asm.rs | 9 +++++++-- compiler/rustc_ast_lowering/src/errors.rs | 5 +++-- compiler/rustc_target/src/asm/mod.rs | 6 +++--- tests/ui/asm/aarch64/bad-reg.stderr | 2 ++ tests/ui/asm/x86_64/bad-reg.stderr | 2 ++ tests/ui/asm/x86_64/issue-82869.stderr | 4 ++++ 7 files changed, 23 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_ast_lowering/messages.ftl b/compiler/rustc_ast_lowering/messages.ftl index f96c9fe8e327..1b91c33742d8 100644 --- a/compiler/rustc_ast_lowering/messages.ftl +++ b/compiler/rustc_ast_lowering/messages.ftl @@ -112,7 +112,8 @@ ast_lowering_invalid_register = invalid register `{$reg}`: {$error} ast_lowering_invalid_register_class = - invalid register class `{$reg_class}`: {$error} + invalid register class `{$reg_class}`: unknown register class + .note = the following register classes are supported on this target: {$supported_register_classes} ast_lowering_match_arm_with_no_body = `match` arm with no body diff --git a/compiler/rustc_ast_lowering/src/asm.rs b/compiler/rustc_ast_lowering/src/asm.rs index 2f1f1269ece5..96c230ec243a 100644 --- a/compiler/rustc_ast_lowering/src/asm.rs +++ b/compiler/rustc_ast_lowering/src/asm.rs @@ -152,11 +152,16 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { InlineAsmRegOrRegClass::RegClass(reg_class) => { asm::InlineAsmRegOrRegClass::RegClass(if let Some(asm_arch) = asm_arch { asm::InlineAsmRegClass::parse(asm_arch, reg_class).unwrap_or_else( - |error| { + |supported_register_classes| { + let mut register_classes = + format!("`{}`", supported_register_classes[0]); + for m in &supported_register_classes[1..] { + let _ = write!(register_classes, ", `{m}`"); + } self.dcx().emit_err(InvalidRegisterClass { op_span: *op_sp, reg_class, - error, + supported_register_classes: register_classes, }); asm::InlineAsmRegClass::Err }, diff --git a/compiler/rustc_ast_lowering/src/errors.rs b/compiler/rustc_ast_lowering/src/errors.rs index f727691bf479..953057681ab2 100644 --- a/compiler/rustc_ast_lowering/src/errors.rs +++ b/compiler/rustc_ast_lowering/src/errors.rs @@ -212,12 +212,13 @@ pub(crate) struct InvalidRegister<'a> { } #[derive(Diagnostic)] +#[note] #[diag(ast_lowering_invalid_register_class)] -pub(crate) struct InvalidRegisterClass<'a> { +pub(crate) struct InvalidRegisterClass { #[primary_span] pub op_span: Span, pub reg_class: Symbol, - pub error: &'a str, + pub supported_register_classes: String, } #[derive(Diagnostic)] diff --git a/compiler/rustc_target/src/asm/mod.rs b/compiler/rustc_target/src/asm/mod.rs index 1292f46f0c91..45a67b10b633 100644 --- a/compiler/rustc_target/src/asm/mod.rs +++ b/compiler/rustc_target/src/asm/mod.rs @@ -39,12 +39,12 @@ macro_rules! def_reg_class { } } - pub fn parse(name: rustc_span::Symbol) -> Result { + pub fn parse(name: rustc_span::Symbol) -> Result { match name { $( rustc_span::sym::$class => Ok(Self::$class), )* - _ => Err("unknown register class"), + _ => Err(&[$(rustc_span::sym::$class),*]), } } } @@ -635,7 +635,7 @@ impl InlineAsmRegClass { } } - pub fn parse(arch: InlineAsmArch, name: Symbol) -> Result { + pub fn parse(arch: InlineAsmArch, name: Symbol) -> Result { Ok(match arch { InlineAsmArch::X86 | InlineAsmArch::X86_64 => { Self::X86(X86InlineAsmRegClass::parse(name)?) diff --git a/tests/ui/asm/aarch64/bad-reg.stderr b/tests/ui/asm/aarch64/bad-reg.stderr index 370752ad0f11..c76722f32a74 100644 --- a/tests/ui/asm/aarch64/bad-reg.stderr +++ b/tests/ui/asm/aarch64/bad-reg.stderr @@ -3,6 +3,8 @@ error: invalid register class `foo`: unknown register class | LL | asm!("{}", in(foo) foo); | ^^^^^^^^^^^ + | + = note: the following register classes are supported on this target: `reg`, `vreg`, `vreg_low16`, `preg` error: invalid register `foo`: unknown register --> $DIR/bad-reg.rs:14:18 diff --git a/tests/ui/asm/x86_64/bad-reg.stderr b/tests/ui/asm/x86_64/bad-reg.stderr index 3df1f7b22086..6a02957210bb 100644 --- a/tests/ui/asm/x86_64/bad-reg.stderr +++ b/tests/ui/asm/x86_64/bad-reg.stderr @@ -3,6 +3,8 @@ error: invalid register class `foo`: unknown register class | LL | asm!("{}", in(foo) foo); | ^^^^^^^^^^^ + | + = note: the following register classes are supported on this target: `reg`, `reg_abcd`, `reg_byte`, `xmm_reg`, `ymm_reg`, `zmm_reg`, `kreg`, `kreg0`, `mmx_reg`, `x87_reg`, `tmm_reg` error: invalid register `foo`: unknown register --> $DIR/bad-reg.rs:14:18 diff --git a/tests/ui/asm/x86_64/issue-82869.stderr b/tests/ui/asm/x86_64/issue-82869.stderr index 3cf9d6d1c1c0..56e490995691 100644 --- a/tests/ui/asm/x86_64/issue-82869.stderr +++ b/tests/ui/asm/x86_64/issue-82869.stderr @@ -3,12 +3,16 @@ error: invalid register class `vreg`: unknown register class | LL | asm!("add {:d}, {:d}, d0", out(vreg) c, in(vreg) a, in("d0") { | ^^^^^^^^^^^ + | + = note: the following register classes are supported on this target: `reg`, `reg_abcd`, `reg_byte`, `xmm_reg`, `ymm_reg`, `zmm_reg`, `kreg`, `kreg0`, `mmx_reg`, `x87_reg`, `tmm_reg` error: invalid register class `vreg`: unknown register class --> $DIR/issue-82869.rs:11:45 | LL | asm!("add {:d}, {:d}, d0", out(vreg) c, in(vreg) a, in("d0") { | ^^^^^^^^^^ + | + = note: the following register classes are supported on this target: `reg`, `reg_abcd`, `reg_byte`, `xmm_reg`, `ymm_reg`, `zmm_reg`, `kreg`, `kreg0`, `mmx_reg`, `x87_reg`, `tmm_reg` error: invalid register `d0`: unknown register --> $DIR/issue-82869.rs:11:57 From 00cb12a5210c631213889f5196de572db05bf3f7 Mon Sep 17 00:00:00 2001 From: chiichen Date: Thu, 30 Jan 2025 17:38:46 +0800 Subject: [PATCH 005/128] chore: discard padding white space --- src/doc/rustc-dev-guide/src/building/suggested.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/building/suggested.md b/src/doc/rustc-dev-guide/src/building/suggested.md index bf5ffbc00afd..f498875ce1b7 100644 --- a/src/doc/rustc-dev-guide/src/building/suggested.md +++ b/src/doc/rustc-dev-guide/src/building/suggested.md @@ -135,24 +135,24 @@ and follow the same instructions as above. ### Emacs Emacs provides support for rust-analyzer with project-local configuration -through [Eglot](https://www.gnu.org/software/emacs/manual/html_node/eglot/). +through [Eglot](https://www.gnu.org/software/emacs/manual/html_node/eglot/). Steps for setting up Eglot with rust-analyzer can be [found -here](https://rust-analyzer.github.io/manual.html#eglot). +here](https://rust-analyzer.github.io/manual.html#eglot). Having set up Emacs & Eglot for Rust development in general, you can run `./x setup editor` and select `emacs`, which will prompt you to create `.dir-locals.el` with the recommended configuration for Eglot. -The recommended settings live at [`src/etc/rust_analyzer_eglot.el`]. +The recommended settings live at [`src/etc/rust_analyzer_eglot.el`]. For more information on project-specific Eglot configuration, consult [the manual](https://www.gnu.org/software/emacs/manual/html_node/eglot/Project_002dspecific-configuration.html). ### Helix -Helix comes with built-in LSP and rust-analyzer support. +Helix comes with built-in LSP and rust-analyzer support. It can be configured through `languages.toml`, as described -[here](https://docs.helix-editor.com/languages.html). +[here](https://docs.helix-editor.com/languages.html). You can run `./x setup editor` and select `helix`, which will prompt you to create `languages.toml` with the recommended configuration for Helix. The -recommended settings live at [`src/etc/rust_analyzer_helix.toml`]. +recommended settings live at [`src/etc/rust_analyzer_helix.toml`]. ## Check, check, and check again @@ -181,7 +181,7 @@ example, running `tidy` and `linkchecker` is useful when editing Markdown files, whereas UI tests are much less likely to be helpful. While `x suggest` is a useful tool, it does not guarantee perfect coverage (just as PR CI isn't a substitute for bors). See the [dedicated chapter](../tests/suggest-tests.md) for -more information and contribution instructions. +more information and contribution instructions. Please note that `x suggest` is in a beta state currently and the tests that it will suggest are limited. From fd911ea65a50c838f4334ef353c80ec46358c9e6 Mon Sep 17 00:00:00 2001 From: chiichen Date: Thu, 30 Jan 2025 17:56:31 +0800 Subject: [PATCH 006/128] feat: modify developing with nix section --- .../rustc-dev-guide/src/building/suggested.md | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/building/suggested.md b/src/doc/rustc-dev-guide/src/building/suggested.md index f498875ce1b7..2c6c3fe1df84 100644 --- a/src/doc/rustc-dev-guide/src/building/suggested.md +++ b/src/doc/rustc-dev-guide/src/building/suggested.md @@ -332,28 +332,21 @@ git worktree add -b my-feature ../rust2 master You can then use that rust2 folder as a separate workspace for modifying and building `rustc`! -## Using nix-shell +## Working with nix -If you're using nix, you can use the following nix-shell to work on Rust: +Several nix configurations are defined in `src/tools/nix-dev-shell`. -```nix -{ pkgs ? import {} }: -pkgs.mkShell { - name = "rustc"; - nativeBuildInputs = with pkgs; [ - binutils cmake ninja pkg-config python3 git curl cacert patchelf nix - ]; - buildInputs = with pkgs; [ - openssl glibc.out glibc.static - ]; - # Avoid creating text files for ICEs. - RUSTC_ICE = "0"; - # Provide `libstdc++.so.6` for the self-contained lld. - LD_LIBRARY_PATH = "${with pkgs; lib.makeLibraryPath [ - stdenv.cc.cc.lib - ]}"; -} +If you're using direnv, you can create a symbol link to `src/tools/nix-dev-shell/envrc-flake` or `src/tools/nix-dev-shell/envrc-shell` + +```bash +ln -s ./src/tools/nix-dev-shell/envrc-flake ./.envrc # Use flake ``` +or +```bash +ln -s ./src/tools/nix-dev-shell/envrc-shell ./.envrc # Use nix-shell +``` + +### Note Note that when using nix on a not-NixOS distribution, it may be necessary to set **`patch-binaries-for-nix = true` in `config.toml`**. Bootstrap tries to detect From 7306e2b10ff46c7d013e4698ff6b4541fd4bb8a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Thu, 30 Jan 2025 16:24:39 +0100 Subject: [PATCH 007/128] Distinguish between "nothing to pull" and "pull error" in josh-sync --- src/doc/rustc-dev-guide/josh-sync/src/main.rs | 15 ++++++++++-- src/doc/rustc-dev-guide/josh-sync/src/sync.rs | 24 +++++++++++++++---- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/doc/rustc-dev-guide/josh-sync/src/main.rs b/src/doc/rustc-dev-guide/josh-sync/src/main.rs index 84613ad86890..175f016f7390 100644 --- a/src/doc/rustc-dev-guide/josh-sync/src/main.rs +++ b/src/doc/rustc-dev-guide/josh-sync/src/main.rs @@ -1,5 +1,5 @@ use clap::Parser; -use crate::sync::GitSync; +use crate::sync::{GitSync, RustcPullError}; mod sync; @@ -22,7 +22,18 @@ fn main() -> anyhow::Result<()> { let sync = GitSync::from_current_dir()?; match args { Args::RustcPull => { - sync.rustc_pull(None)?; + if let Err(error) = sync.rustc_pull(None) { + match error { + RustcPullError::NothingToPull => { + eprintln!("Nothing to pull"); + std::process::exit(2); + } + RustcPullError::PullFailed(error) => { + eprintln!("Pull failure: {error:?}"); + std::process::exit(1); + } + } + } } Args::RustcPush { github_username, branch } => { sync.rustc_push(github_username, branch)?; diff --git a/src/doc/rustc-dev-guide/josh-sync/src/sync.rs b/src/doc/rustc-dev-guide/josh-sync/src/sync.rs index eff80b1091d3..cd64be636703 100644 --- a/src/doc/rustc-dev-guide/josh-sync/src/sync.rs +++ b/src/doc/rustc-dev-guide/josh-sync/src/sync.rs @@ -11,6 +11,19 @@ const JOSH_FILTER: &str = ":/src/doc/rustc-dev-guide"; const JOSH_PORT: u16 = 42042; const UPSTREAM_REPO: &str = "rust-lang/rust"; +pub enum RustcPullError { + /// No changes are available to be pulled. + NothingToPull, + /// A rustc-pull has failed, probably a git operation error has occurred. + PullFailed(anyhow::Error) +} + +impl From for RustcPullError where E: Into { + fn from(error: E) -> Self { + Self::PullFailed(error.into()) + } +} + pub struct GitSync { dir: PathBuf, } @@ -24,7 +37,7 @@ impl GitSync { }) } - pub fn rustc_pull(&self, commit: Option) -> anyhow::Result<()> { + pub fn rustc_pull(&self, commit: Option) -> Result<(), RustcPullError> { let sh = Shell::new()?; sh.change_dir(&self.dir); let commit = commit.map(Ok).unwrap_or_else(|| { @@ -38,7 +51,7 @@ impl GitSync { })?; // Make sure the repo is clean. if cmd!(sh, "git status --untracked-files=no --porcelain").read()?.is_empty().not() { - bail!("working directory must be clean before performing rustc pull"); + return Err(anyhow::anyhow!("working directory must be clean before performing rustc pull").into()); } // Make sure josh is running. let josh = Self::start_josh()?; @@ -47,7 +60,7 @@ impl GitSync { let previous_base_commit = sh.read_file("rust-version")?.trim().to_string(); if previous_base_commit == commit { - return Err(anyhow::anyhow!("No changes since last pull")); + return Err(RustcPullError::NothingToPull); } // Update rust-version file. As a separate commit, since making it part of @@ -94,12 +107,13 @@ impl GitSync { cmd!(sh, "git reset --hard HEAD^") .run() .expect("FAILED to clean up after creating the preparation commit"); - return Err(anyhow::anyhow!("No merge was performed, nothing to pull. Rolled back the preparation commit.")); + eprintln!("No merge was performed, no changes to pull were found. Rolled back the preparation commit."); + return Err(RustcPullError::NothingToPull); } // Check that the number of roots did not increase. if num_roots()? != num_roots_before { - bail!("Josh created a new root commit. This is probably not the history you want."); + return Err(anyhow::anyhow!("Josh created a new root commit. This is probably not the history you want.").into()); } drop(josh); From a7d35e12e2cf9813641cf5547f386cf5d7de4140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Thu, 30 Jan 2025 18:33:34 +0100 Subject: [PATCH 008/128] Rewrite section on executing Docker tests --- src/doc/rustc-dev-guide/src/tests/docker.md | 61 ++++++++++----------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/tests/docker.md b/src/doc/rustc-dev-guide/src/tests/docker.md index a0aa8bd3e77b..8327e5ce67c9 100644 --- a/src/doc/rustc-dev-guide/src/tests/docker.md +++ b/src/doc/rustc-dev-guide/src/tests/docker.md @@ -1,36 +1,44 @@ # Testing with Docker -The Rust tree includes [Docker] image definitions for the platforms used on -GitHub Actions in [`src/ci/docker`]. -The script [`src/ci/docker/run.sh`] is used to build the Docker image, run it, -build Rust within the image, and run the tests. - -You can run these images on your local development machine. This can be -helpful to test environments different from your local system. First you will +The [`src/ci/docker`] directory includes [Docker] image definitions for Linux-based jobs executed on GitHub Actions (non-Linux jobs run outside Docker). You can run these jobs on your local development machine, which can be +helpful to test environments different from your local system. You will need to install Docker on a Linux, Windows, or macOS system (typically Linux will be much faster than Windows or macOS because the latter use virtual -machines to emulate a Linux environment). To enter interactive mode which will -start a bash shell in the container, run `src/ci/docker/run.sh --dev ` -where `` is one of the directory names in `src/ci/docker` (for example -`x86_64-gnu` is a fairly standard Ubuntu environment). +machines to emulate a Linux environment). -The docker script will mount your local Rust source tree in read-only mode, -and an `obj` directory in read-write mode. All of the compiler artifacts will -be stored in the `obj` directory. The shell will start out in the `obj` -directory. From there, you can run `../src/ci/run.sh` which will run the build -as defined by the image. +Jobs running in CI are configured through a set of bash scripts, and it is not always trivial to reproduce their behavior locally. If you want to run a CI job locally in the simplest way possible, you can use a provided helper Python script that tries to replicate what happens on CI as closely as possible: -Alternatively, you can run individual commands to do specific tasks. For -example, you can run `../x test tests/ui` to just run UI tests. -Note that there is some configuration in the [`src/ci/run.sh`] script that you -may need to recreate. Particularly, set `submodules = false` in your -`config.toml` so that it doesn't attempt to modify the read-only directory. +```bash +python3 src/ci/github-actions/ci.py run-local +# For example: +python3 src/ci/github-actions/ci.py run-local dist-x86_64-linux-alt +``` -Some additional notes about using the Docker images: +If the above script does not work for you, you would like to have more control of the Docker image execution, or you want to understand what exactly happens during Docker job execution, then continue reading below. +## The `run.sh` script +The [`src/ci/docker/run.sh`] script is used to build a specific Docker image, run it, +build Rust within the image, and either run tests or prepare a set of archives designed for distribution. The script will mount your local Rust source tree in read-only mode, and an `obj` directory in read-write mode. All the compiler artifacts will be stored in the `obj` directory. The shell will start out in the `obj`directory. From there, it will execute `../src/ci/run.sh` which starts the build as defined by the Docker image. + +You can run `src/ci/docker/run.sh ` directly. A few important notes regarding the `run.sh` script: +- There is some configuration used on CI that you may need to recreate. In particular, set `submodules = false` in your `config.toml` so that it doesn't attempt to modify the read-only directory. +- `` corresponds to a single directory located in one of the `src/ci/docker/host-*` directories. Note that image name does not necessarily correspond to a job name, as some jobs execute the same image, but with different environment variables or Docker build arguments (this is a part of the complexity that makes it difficult to run CI jobs locally). +- If you are executing a "dist" job (job beginning with `dist-`), you should set the `DEPLOY=1` environment variable. +- If you are executing an "alternative dist" job (job beginning with `dist-` and ending with `-alt`), you should set the `DEPLOY_ALT=1` environment variable. - Some of the std tests require IPv6 support. Docker on Linux seems to have it disabled by default. Run the commands in [`enable-docker-ipv6.sh`] to enable IPv6 before creating the container. This only needs to be done once. + +### Interactive mode + +Sometimes, it can be useful to build a specific Docker image, and then run custom commands inside it, so that you can experiment with how the given system behaves. You can do that using an interactive mode, which will +start a bash shell in the container, using `src/ci/docker/run.sh --dev `. + +When inside the Docker container, you can run individual commands to do specific tasks. For +example, you can run `../x test tests/ui` to just run UI tests. + +Some additional notes about using the interactive mode: + - The container will be deleted automatically when you exit the shell, however the build artifacts persist in the `obj` directory. If you are switching between different Docker images, the artifacts from previous environments @@ -45,15 +53,6 @@ Some additional notes about using the Docker images: containers. With the container name, run `docker exec -it /bin/bash` where `` is the container name like `4ba195e95cef`. -The approach described above is a relatively low-level interface for running the Docker images -directly. If you want to run a full CI Linux job locally with Docker, in a way that is as close to CI as possible, you can use the following command: - -```bash -python3 src/ci/github-actions/ci.py run-local -# For example: -python3 src/ci/github-actions/ci.py run-local dist-x86_64-linux-alt -``` - [Docker]: https://www.docker.com/ [`src/ci/docker`]: https://github.com/rust-lang/rust/tree/master/src/ci/docker [`src/ci/docker/run.sh`]: https://github.com/rust-lang/rust/blob/master/src/ci/docker/run.sh From 40713cb4515404e26c13b16270942acfef4ccf28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Thu, 30 Jan 2025 17:29:01 +0100 Subject: [PATCH 009/128] Run rustc-pull CI every day, don't notify when there is nothing to update --- .../.github/workflows/rustc-pull.yml | 40 +++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml b/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml index 615927d55e59..5d5b145c9434 100644 --- a/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml +++ b/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml @@ -3,8 +3,8 @@ name: rustc-pull on: workflow_dispatch: schedule: - # Run at 04:00 UTC every Monday - - cron: '0 4 * * 1' + # Run at 04:00 UTC every day + - cron: '0 4 * * *' jobs: pull: @@ -34,8 +34,25 @@ jobs: git config --global user.name 'The rustc-dev-guide Cronjob Bot' git config --global user.email 'github-actions@github.com' - name: Perform rustc-pull - run: cargo run --manifest-path josh-sync/Cargo.toml -- rustc-pull + id: rustc-pull + # Turn off -e to disable early exit + shell: bash {0} + run: | + cargo run --manifest-path josh-sync/Cargo.toml -- rustc-pull + exitcode=$? + + # If no pull was performed, we want to mark this job as successful, + # but we do not want to perform the follow-up steps. + if [ $exitcode -eq 0 ]; then + echo "pull_result=pull-finished" >> $GITHUB_OUTPUT + elif [ $exitcode -eq 2 ]; then + echo "pull_result=skipped" >> $GITHUB_OUTPUT + exitcode=0 + fi + + exit ${exitcode} - name: Push changes to a branch + if: ${{ steps.rustc-pull.outputs.pull_result == 'pull-finished' }} run: | # Update a sticky branch that is used only for rustc pulls BRANCH="rustc-pull" @@ -43,6 +60,7 @@ jobs: git push -u origin $BRANCH --force - name: Create pull request id: update-pr + if: ${{ steps.rustc-pull.outputs.pull_result == 'pull-finished' }} run: | # Check if an open pull request for an rustc pull update already exists # If it does, the previous push has just updated it @@ -54,6 +72,7 @@ jobs: echo "pr_url=$PR_URL" >> $GITHUB_OUTPUT else PR_URL=`gh pr list --author github-actions[bot] --state open -q 'map(select(.title=="Rustc pull update")) | .[0].url' --json url,title` + echo "Updating pull request ${PR_URL}" echo "pr_url=$PR_URL" >> $GITHUB_OUTPUT fi env: @@ -64,16 +83,23 @@ jobs: runs-on: ubuntu-latest steps: - name: Compute message - id: message + id: create-message run: | - if [ "${{ needs.pull.result }}" == "failure" ]; - then + if [ "${{ needs.pull.result }}" == "failure" ]; then WORKFLOW_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" echo "message=Rustc pull sync failed. Check out the [workflow URL]($WORKFLOW_URL)." >> $GITHUB_OUTPUT else - echo "message=Rustc pull sync succeeded. Check out the [PR](${{ needs.pull.outputs.pr_url }})." >> $GITHUB_OUTPUT + CREATED_AT=`gh pr list --author github-actions[bot] --state open -q 'map(select(.title=="Rustc pull update")) | .[0].createdAt' --json createdAt,title` + PR_URL=`gh pr list --author github-actions[bot] --state open -q 'map(select(.title=="Rustc pull update")) | .[0].url' --json url,title` + week_ago=$(date +%F -d '7 days ago') + + # If there is an open PR that is at least a week old, post a message about it + if [[ -n $DATE_GH && $DATE_GH < $week_ago ]]; then + echo "message=A PR with a Rustc pull has been opened for more a week. Check out the [PR](${PR_URL})." >> $GITHUB_OUTPUT + fi fi - name: Send a Zulip message about updated PR + if: ${{ steps.create-message.outputs.message != '' }} uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 with: api-key: ${{ secrets.ZULIP_API_TOKEN }} From 2e4391218476c0ffe092e4e32c9b6ae5057e5a0a Mon Sep 17 00:00:00 2001 From: Tobias Bucher Date: Thu, 9 Jan 2025 13:52:18 +0100 Subject: [PATCH 010/128] =?UTF-8?q?it-self=20=E2=86=92=20itself,=20build-s?= =?UTF-8?q?ystem=20=E2=86=92=20build=20system,=20type-alias=20=E2=86=92=20?= =?UTF-8?q?type=20alias?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compiler/rustc_session/src/config/cfg.rs | 2 +- src/doc/rustc/src/check-cfg.md | 2 +- src/librustdoc/passes/strip_aliased_non_local.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_session/src/config/cfg.rs b/compiler/rustc_session/src/config/cfg.rs index d586f913335e..5defcf4ee946 100644 --- a/compiler/rustc_session/src/config/cfg.rs +++ b/compiler/rustc_session/src/config/cfg.rs @@ -9,7 +9,7 @@ //! //! ## Adding a new cfg //! -//! Adding a new feature requires two new symbols one for the cfg it-self +//! Adding a new feature requires two new symbols one for the cfg itself //! and the second one for the unstable feature gate, those are defined in //! `rustc_span::symbol`. //! diff --git a/src/doc/rustc/src/check-cfg.md b/src/doc/rustc/src/check-cfg.md index c62ca9fd9ad6..00add2651ae8 100644 --- a/src/doc/rustc/src/check-cfg.md +++ b/src/doc/rustc/src/check-cfg.md @@ -135,7 +135,7 @@ As of `2025-01-02T`, the list of known names is as follows: - `windows` > Starting with 1.85.0, the `test` cfg is consider to be a "userspace" config -> despite being also set by `rustc` and should be managed by the build-system it-self. +> despite being also set by `rustc` and should be managed by the build system itself. Like with `values(any())`, well known names checking can be disabled by passing `cfg(any())` as argument to `--check-cfg`. diff --git a/src/librustdoc/passes/strip_aliased_non_local.rs b/src/librustdoc/passes/strip_aliased_non_local.rs index fa7737bc1438..7f5c7da36342 100644 --- a/src/librustdoc/passes/strip_aliased_non_local.rs +++ b/src/librustdoc/passes/strip_aliased_non_local.rs @@ -26,7 +26,7 @@ impl DocFolder for AliasedNonLocalStripper<'_> { Some(match i.kind { clean::TypeAliasItem(..) => { let mut stripper = NonLocalStripper { tcx: self.tcx }; - // don't call `fold_item` as that could strip the type-alias it-self + // don't call `fold_item` as that could strip the type alias itself // which we don't want to strip out stripper.fold_item_recur(i) } From 179a2f8a5389dc910602c352d4b98f2dd96d8ca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Fri, 31 Jan 2025 17:01:38 +0100 Subject: [PATCH 011/128] Pass `GITHUB_TOKEN` to Zulip CI step --- src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml b/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml index 5d5b145c9434..2a9f56fd6504 100644 --- a/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml +++ b/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml @@ -61,6 +61,8 @@ jobs: - name: Create pull request id: update-pr if: ${{ steps.rustc-pull.outputs.pull_result == 'pull-finished' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | # Check if an open pull request for an rustc pull update already exists # If it does, the previous push has just updated it @@ -75,8 +77,6 @@ jobs: echo "Updating pull request ${PR_URL}" echo "pr_url=$PR_URL" >> $GITHUB_OUTPUT fi - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} send-zulip-message: needs: [pull] if: ${{ !cancelled() }} @@ -84,6 +84,8 @@ jobs: steps: - name: Compute message id: create-message + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | if [ "${{ needs.pull.result }}" == "failure" ]; then WORKFLOW_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" From 97edb7a7c2f93451b2b6efa18b630117cce17847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sat, 1 Feb 2025 15:50:00 +0100 Subject: [PATCH 012/128] Checkout repository sources in rustc-pull CI action This is needed for the `gh` command to work. --- src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml b/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml index 2a9f56fd6504..5bfcf47d7034 100644 --- a/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml +++ b/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml @@ -82,6 +82,7 @@ jobs: if: ${{ !cancelled() }} runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - name: Compute message id: create-message env: From 48c7202b021c2bf759439a18b85a41e7ab4b4a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sat, 1 Feb 2025 16:42:28 +0100 Subject: [PATCH 013/128] Reword submodule handling --- src/doc/rustc-dev-guide/src/tests/docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/rustc-dev-guide/src/tests/docker.md b/src/doc/rustc-dev-guide/src/tests/docker.md index 8327e5ce67c9..2ca08d42130a 100644 --- a/src/doc/rustc-dev-guide/src/tests/docker.md +++ b/src/doc/rustc-dev-guide/src/tests/docker.md @@ -21,7 +21,7 @@ The [`src/ci/docker/run.sh`] script is used to build a specific Docker image, ru build Rust within the image, and either run tests or prepare a set of archives designed for distribution. The script will mount your local Rust source tree in read-only mode, and an `obj` directory in read-write mode. All the compiler artifacts will be stored in the `obj` directory. The shell will start out in the `obj`directory. From there, it will execute `../src/ci/run.sh` which starts the build as defined by the Docker image. You can run `src/ci/docker/run.sh ` directly. A few important notes regarding the `run.sh` script: -- There is some configuration used on CI that you may need to recreate. In particular, set `submodules = false` in your `config.toml` so that it doesn't attempt to modify the read-only directory. +- When executed on CI, the script expects that all submodules are checked out. If some submodule that is accessed by the job is not available, the build will result in an error. You should thus make sure that you have all required submodules checked out locally. You can either do that manually through git, or set `submodules = true` in your `config.toml` and run a command such as `x build` to let bootstrap download the most important submodules (this might not be enough for the given CI job that you are trying to execute though). - `` corresponds to a single directory located in one of the `src/ci/docker/host-*` directories. Note that image name does not necessarily correspond to a job name, as some jobs execute the same image, but with different environment variables or Docker build arguments (this is a part of the complexity that makes it difficult to run CI jobs locally). - If you are executing a "dist" job (job beginning with `dist-`), you should set the `DEPLOY=1` environment variable. - If you are executing an "alternative dist" job (job beginning with `dist-` and ending with `-alt`), you should set the `DEPLOY_ALT=1` environment variable. From f09de673565b88dd0c9f416e171f5c099073270e Mon Sep 17 00:00:00 2001 From: The rustc-dev-guide Cronjob Bot Date: Sun, 2 Feb 2025 04:02:19 +0000 Subject: [PATCH 014/128] Preparing for merge from rustc --- src/doc/rustc-dev-guide/rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/rustc-dev-guide/rust-version b/src/doc/rustc-dev-guide/rust-version index 183d26b29384..fa65931bdc52 100644 --- a/src/doc/rustc-dev-guide/rust-version +++ b/src/doc/rustc-dev-guide/rust-version @@ -1 +1 @@ -66d6064f9eb888018775e08f84747ee6f39ba28e +8239a37f9c0951a037cfc51763ea52a20e71e6bd From 3827ff028971a6ec6ef18fd80f44c1cc05c898bb Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sun, 2 Feb 2025 17:30:30 +0900 Subject: [PATCH 015/128] Apply suggestions from code review --- src/doc/rustc-dev-guide/src/traits/implied-bounds.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/traits/implied-bounds.md b/src/doc/rustc-dev-guide/src/traits/implied-bounds.md index 05693dcd5a18..cdcb90d3e2ed 100644 --- a/src/doc/rustc-dev-guide/src/traits/implied-bounds.md +++ b/src/doc/rustc-dev-guide/src/traits/implied-bounds.md @@ -40,7 +40,7 @@ requirements of impls and functions as explicit predicates. ### using implicit implied bounds as assumptions These bounds are not added to the `ParamEnv` of the affected item itself. For lexical -region resolution they are added using [`fn OutlivesEnvironment::new`]. +region resolution they are added using [`fn OutlivesEnvironment::from_normalized_bounds`]. Similarly, during MIR borrowck we add them using [`fn UniversalRegionRelationsBuilder::add_implied_bounds`]. @@ -55,7 +55,7 @@ The assumed outlives constraints for implicit bounds are computed using the MIR borrowck adds the outlives constraints for both the normalized and unnormalized types, lexical region resolution [only uses the unnormalized types][notnorm]. -[`fn OutlivesEnvironment::new`]: TODO +[`fn OutlivesEnvironment::from_normalized_bounds`]: https://github.com/rust-lang/rust/blob/8239a37f9c0951a037cfc51763ea52a20e71e6bd/compiler/rustc_infer/src/infer/outlives/env.rs#L50-L55 [`fn UniversalRegionRelationsBuilder::add_implied_bounds`]: https://github.com/rust-lang/rust/blob/5b8bc568d28b2e922290c9a966b3231d0ce9398b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs#L316 [mir]: https://github.com/rust-lang/rust/blob/91cae1dcdcf1a31bd8a92e4a63793d65cfe289bb/compiler/rustc_borrowck/src/type_check/free_region_relations.rs#L258-L332 [`fn assumed_wf_types`]: https://github.com/rust-lang/rust/blob/5b8bc568d28b2e922290c9a966b3231d0ce9398b/compiler/rustc_ty_utils/src/implied_bounds.rs#L21 From d47b46df6aef42fc714a993db376e0a64236f52d Mon Sep 17 00:00:00 2001 From: The rustc-dev-guide Cronjob Bot Date: Mon, 3 Feb 2025 04:02:09 +0000 Subject: [PATCH 016/128] Preparing for merge from rustc --- src/doc/rustc-dev-guide/rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/rustc-dev-guide/rust-version b/src/doc/rustc-dev-guide/rust-version index fa65931bdc52..b62959720764 100644 --- a/src/doc/rustc-dev-guide/rust-version +++ b/src/doc/rustc-dev-guide/rust-version @@ -1 +1 @@ -8239a37f9c0951a037cfc51763ea52a20e71e6bd +613bdd49978298648ed05ace086bd1ecad54b44a From 6005619bde6abacfdce096d1f67437323b63d8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 24 Jan 2025 01:06:14 +0000 Subject: [PATCH 017/128] In "specify type" suggestion, skip type params that are already known When we suggest specifying a type for an expression or pattern, like in a `let` binding, we previously would print the entire type as the type system knew it. We now look at the params that have *no* inference variables, so they are fully known to the type system which means that they don't need to be specified. This helps in suggestions for types that are really long, because we can usually skip most of the type params and make the annotation as short as possible: ``` error[E0282]: type annotations needed for `Result<_, ((..., ..., ..., ...), ..., ..., ...)>` --> $DIR/really-long-type-in-let-binding-without-sufficient-type-info.rs:7:9 | LL | let y = Err(x); | ^ ------ type must be known at this point | help: consider giving `y` an explicit type, where the type for type parameter `T` is specified | LL | let y: Result = Err(x); | ++++++++++++++ ``` --- .../error_reporting/infer/need_type_info.rs | 84 ++++++++++++++++--- .../cannot-infer-closure-circular.stderr | 4 +- .../erase-type-params-in-label.stderr | 8 +- tests/ui/inference/issue-104649.stderr | 4 +- tests/ui/inference/issue-83606.stderr | 4 +- ...et-binding-without-sufficient-type-info.rs | 10 +++ ...inding-without-sufficient-type-info.stderr | 14 ++++ .../or_else-multiple-type-params.stderr | 4 +- 8 files changed, 108 insertions(+), 24 deletions(-) create mode 100644 tests/ui/inference/really-long-type-in-let-binding-without-sufficient-type-info.rs create mode 100644 tests/ui/inference/really-long-type-in-let-binding-without-sufficient-type-info.stderr diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs index 99b70c87ccd1..61fb7bcbc9aa 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs @@ -18,6 +18,7 @@ use rustc_middle::ty::{ TypeFoldable, TypeFolder, TypeSuperFoldable, TypeckResults, }; use rustc_span::{BytePos, DUMMY_SP, FileName, Ident, Span, sym}; +use rustc_type_ir::visit::TypeVisitableExt; use tracing::{debug, instrument, warn}; use super::nice_region_error::placeholder_error::Highlighted; @@ -155,26 +156,85 @@ impl UnderspecifiedArgKind { } } -struct ClosureEraser<'tcx> { - tcx: TyCtxt<'tcx>, +struct ClosureEraser<'a, 'tcx> { + infcx: &'a InferCtxt<'tcx>, + // When recursing into types, if an ADT has type parameters with a default type we do *not* + // want to replace that type parameter with `_`, as it will cause the normally hidden type + // parameter to be rendered. The best example of this is `Vec`, which we want to + // render as `Vec` and not `Vec` when `T` is unknown. + do_not_hide_nested_type: bool, } -impl<'tcx> TypeFolder> for ClosureEraser<'tcx> { +impl<'a, 'tcx> ClosureEraser<'a, 'tcx> { + fn new_infer(&mut self) -> Ty<'tcx> { + self.infcx.next_ty_var(DUMMY_SP) + } +} + +impl<'a, 'tcx> TypeFolder> for ClosureEraser<'a, 'tcx> { fn cx(&self) -> TyCtxt<'tcx> { - self.tcx + self.infcx.tcx } fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { - match ty.kind() { + let prev = self.do_not_hide_nested_type; + let ty = match ty.kind() { ty::Closure(_, args) => { + // For a closure type, we turn it into a function pointer so that it gets rendered + // as `fn(args) -> Ret`. let closure_sig = args.as_closure().sig(); Ty::new_fn_ptr( - self.tcx, - self.tcx.signature_unclosure(closure_sig, hir::Safety::Safe), + self.cx(), + self.cx().signature_unclosure(closure_sig, hir::Safety::Safe), ) } - _ => ty.super_fold_with(self), - } + ty::Adt(def, _) => { + let generics = self.cx().generics_of(def.did()); + if generics.own_params.iter().any(|param| param.default_value(self.cx()).is_some()) + { + // We have a type that has default types, like the allocator in Vec. We decided + // to show `Vec` itself, because it hasn't yet been replaced by an `_` `Infer`, + // but we want to ensure that the type parameter with default types does *not* + // get replaced with `_` because then we'd end up with `Vec<_, _>`, instead of + // `Vec<_>`. + self.do_not_hide_nested_type = true; + ty.super_fold_with(self) + } else if ty.has_infer() || self.do_not_hide_nested_type { + // This type has an unsubstituted type variable, meaning that this type has a + // (potentially deeply nested) type parameter from the corresponding type's + // definition. We have explicitly asked this type to not be hidden. In either + // case, we keep the type and don't substitute with `_` just yet. + ty.super_fold_with(self) + } else { + // When we have a type that doesn't have any inference variables, so we replace + // the whole thing with `_`. The type system already knows about this type in + // its entirety and it is redundant to specify it for the user. The user only + // needs to specify the type parameters that we *couldn't* figure out. + self.new_infer() + } + } + _ if ty.has_infer() || self.do_not_hide_nested_type => { + // This type has a (potentially nested) type parameter that we couldn't figure out. + // We will print this depth of type, so at least the type name and at least one of + // its type parameters. We unset `do_not_hide_nested_type` because this type can't + // have type parameter defaults until next type we hit an ADT. + self.do_not_hide_nested_type = false; + ty.super_fold_with(self) + } + // We don't have an unknown type parameter anywhere, replace with `_`. + _ => self.new_infer(), + }; + self.do_not_hide_nested_type = prev; + ty + } + + fn fold_const(&mut self, c: ty::Const<'tcx>) -> ty::Const<'tcx> { + let prev = self.do_not_hide_nested_type; + // Avoid accidentally erasing the type of the const. + self.do_not_hide_nested_type = true; + let c = c.super_fold_with(self); + self.do_not_hide_nested_type = prev; + c } } @@ -219,9 +279,9 @@ fn ty_to_string<'tcx>( ) -> String { let mut printer = fmt_printer(infcx, Namespace::TypeNS); let ty = infcx.resolve_vars_if_possible(ty); - // We use `fn` ptr syntax for closures, but this only works when the closure - // does not capture anything. - let ty = ty.fold_with(&mut ClosureEraser { tcx: infcx.tcx }); + // We use `fn` ptr syntax for closures, but this only works when the closure does not capture + // anything. We also remove all type parameters that are fully known to the type system. + let ty = ty.fold_with(&mut ClosureEraser { infcx, do_not_hide_nested_type: false }); match (ty.kind(), called_method_def_id) { // We don't want the regular output for `fn`s because it includes its path in diff --git a/tests/ui/inference/cannot-infer-closure-circular.stderr b/tests/ui/inference/cannot-infer-closure-circular.stderr index a16e832f8ef9..ee17f7737cf3 100644 --- a/tests/ui/inference/cannot-infer-closure-circular.stderr +++ b/tests/ui/inference/cannot-infer-closure-circular.stderr @@ -9,8 +9,8 @@ LL | Ok(v) | help: consider giving this closure parameter an explicit type, where the type for type parameter `E` is specified | -LL | let x = |r: Result<(), E>| { - | +++++++++++++++ +LL | let x = |r: Result<_, E>| { + | ++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/inference/erase-type-params-in-label.stderr b/tests/ui/inference/erase-type-params-in-label.stderr index 4e9a74c1e403..1ec8a33eb820 100644 --- a/tests/ui/inference/erase-type-params-in-label.stderr +++ b/tests/ui/inference/erase-type-params-in-label.stderr @@ -12,8 +12,8 @@ LL | fn foo(t: T, k: K) -> Foo { | ^^^^^^^ required by this bound in `foo` help: consider giving `foo` an explicit type, where the type for type parameter `W` is specified | -LL | let foo: Foo = foo(1, ""); - | ++++++++++++++++++++++ +LL | let foo: Foo<_, &_, W, Z> = foo(1, ""); + | ++++++++++++++++++ error[E0283]: type annotations needed for `Bar` --> $DIR/erase-type-params-in-label.rs:5:9 @@ -29,8 +29,8 @@ LL | fn bar(t: T, k: K) -> Bar { | ^^^^^^^ required by this bound in `bar` help: consider giving `bar` an explicit type, where the type for type parameter `Z` is specified | -LL | let bar: Bar = bar(1, ""); - | +++++++++++++++++++ +LL | let bar: Bar<_, &_, Z> = bar(1, ""); + | +++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/inference/issue-104649.stderr b/tests/ui/inference/issue-104649.stderr index 391ed16f349d..27382e301341 100644 --- a/tests/ui/inference/issue-104649.stderr +++ b/tests/ui/inference/issue-104649.stderr @@ -6,8 +6,8 @@ LL | let a = A(Result::Ok(Result::Ok(()))); | help: consider giving `a` an explicit type, where the type for type parameter `E` is specified | -LL | let a: A, Error>> = A(Result::Ok(Result::Ok(()))); - | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +LL | let a: A, _>> = A(Result::Ok(Result::Ok(()))); + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/inference/issue-83606.stderr b/tests/ui/inference/issue-83606.stderr index 69d1d71ef3cc..97ccad9e785e 100644 --- a/tests/ui/inference/issue-83606.stderr +++ b/tests/ui/inference/issue-83606.stderr @@ -11,8 +11,8 @@ LL | fn foo(_: impl std::fmt::Display) -> [usize; N] { | ^^^^^^^^^^^^^^ required by this const generic parameter in `foo` help: consider giving this pattern a type, where the value of const parameter `N` is specified | -LL | let _: [usize; N] = foo("foo"); - | ++++++++++++ +LL | let _: [_; N] = foo("foo"); + | ++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/inference/really-long-type-in-let-binding-without-sufficient-type-info.rs b/tests/ui/inference/really-long-type-in-let-binding-without-sufficient-type-info.rs new file mode 100644 index 000000000000..4fd15eea9e0f --- /dev/null +++ b/tests/ui/inference/really-long-type-in-let-binding-without-sufficient-type-info.rs @@ -0,0 +1,10 @@ +type A = (i32, i32, i32, i32); +type B = (A, A, A, A); +type C = (B, B, B, B); +type D = (C, C, C, C); + +fn foo(x: D) { + let y = Err(x); //~ ERROR type annotations needed for `Result<_ +} + +fn main() {} diff --git a/tests/ui/inference/really-long-type-in-let-binding-without-sufficient-type-info.stderr b/tests/ui/inference/really-long-type-in-let-binding-without-sufficient-type-info.stderr new file mode 100644 index 000000000000..65fe2ffcb7f1 --- /dev/null +++ b/tests/ui/inference/really-long-type-in-let-binding-without-sufficient-type-info.stderr @@ -0,0 +1,14 @@ +error[E0282]: type annotations needed for `Result<_, ((((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32))), (((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32))), (((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32))), (((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32)), ((i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32), (i32, i32, i32, i32))))>` + --> $DIR/really-long-type-in-let-binding-without-sufficient-type-info.rs:7:9 + | +LL | let y = Err(x); + | ^ ------ type must be known at this point + | +help: consider giving `y` an explicit type, where the type for type parameter `T` is specified + | +LL | let y: Result = Err(x); + | ++++++++++++++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0282`. diff --git a/tests/ui/type-inference/or_else-multiple-type-params.stderr b/tests/ui/type-inference/or_else-multiple-type-params.stderr index 3176a2d490eb..9bcd07f8bf16 100644 --- a/tests/ui/type-inference/or_else-multiple-type-params.stderr +++ b/tests/ui/type-inference/or_else-multiple-type-params.stderr @@ -6,8 +6,8 @@ LL | .or_else(|err| { | help: try giving this closure an explicit return type | -LL | .or_else(|err| -> Result { - | +++++++++++++++++++ +LL | .or_else(|err| -> Result<_, F> { + | +++++++++++++++ error: aborting due to 1 previous error From 56a5b59db217833ccb0ca9d52416512f3b0f65f0 Mon Sep 17 00:00:00 2001 From: Rehmatpal Singh <91879372+DuskyElf@users.noreply.github.com> Date: Tue, 4 Feb 2025 01:26:15 +0530 Subject: [PATCH 018/128] Remove "Port run-make tests from Make to Rust" tracking issue from Recurring work --- src/doc/rustc-dev-guide/src/getting-started.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/doc/rustc-dev-guide/src/getting-started.md b/src/doc/rustc-dev-guide/src/getting-started.md index 4cb1d0b31ebd..8bf14bef2a03 100644 --- a/src/doc/rustc-dev-guide/src/getting-started.md +++ b/src/doc/rustc-dev-guide/src/getting-started.md @@ -101,7 +101,6 @@ it's easy to pick up work without a large time commitment: - [Rustdoc Askama Migration](https://github.com/rust-lang/rust/issues/108868) - [Diagnostic Translation](https://github.com/rust-lang/rust/issues/100717) - [Move UI tests to subdirectories](https://github.com/rust-lang/rust/issues/73494) -- [Port run-make tests from Make to Rust](https://github.com/rust-lang/rust/issues/121876) If you find more recurring work, please feel free to add it here! From 99d2b3a996b8852122a07a9a06c416ec7a0f0b90 Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Mon, 3 Feb 2025 22:07:10 +0200 Subject: [PATCH 019/128] overlong line --- src/doc/rustc-dev-guide/src/diagnostics.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/diagnostics.md b/src/doc/rustc-dev-guide/src/diagnostics.md index 8f389640d271..972309b5cd34 100644 --- a/src/doc/rustc-dev-guide/src/diagnostics.md +++ b/src/doc/rustc-dev-guide/src/diagnostics.md @@ -601,8 +601,8 @@ The trait implementation allows you to check certain syntactic constructs as the linter walks the AST. You can then choose to emit lints in a very similar way to compile errors. -You also declare the metadata of a particular lint via the `declare_lint!` -macro. [This macro](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/macro.declare_lint.html) includes the name, the default level, a short description, and some +You also declare the metadata of a particular lint via the [`declare_lint!`] +macro. This macro includes the name, the default level, a short description, and some more details. Note that the lint and the lint pass must be registered with the compiler. @@ -671,6 +671,8 @@ example-use-loop = denote infinite loops with `loop {"{"} ... {"}"}` .suggestion = use `loop` ``` +[`declare_lint!`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/macro.declare_lint.html + ### Edition-gated lints Sometimes we want to change the behavior of a lint in a new edition. To do this, From 576db131a38ccb53f9fbbe314e6bce37503c0050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 30 Jan 2025 18:26:31 +0000 Subject: [PATCH 020/128] Simplify recursive logic --- .../error_reporting/infer/need_type_info.rs | 93 ++++++++++--------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs index 61fb7bcbc9aa..9e7e96dddd7c 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs @@ -18,6 +18,7 @@ use rustc_middle::ty::{ TypeFoldable, TypeFolder, TypeSuperFoldable, TypeckResults, }; use rustc_span::{BytePos, DUMMY_SP, FileName, Ident, Span, sym}; +use rustc_type_ir::inherent::*; use rustc_type_ir::visit::TypeVisitableExt; use tracing::{debug, instrument, warn}; @@ -158,11 +159,6 @@ impl UnderspecifiedArgKind { struct ClosureEraser<'a, 'tcx> { infcx: &'a InferCtxt<'tcx>, - // When recursing into types, if an ADT has type parameters with a default type we do *not* - // want to replace that type parameter with `_`, as it will cause the normally hidden type - // parameter to be rendered. The best example of this is `Vec`, which we want to - // render as `Vec` and not `Vec` when `T` is unknown. - do_not_hide_nested_type: bool, } impl<'a, 'tcx> ClosureEraser<'a, 'tcx> { @@ -177,8 +173,7 @@ impl<'a, 'tcx> TypeFolder> for ClosureEraser<'a, 'tcx> { } fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { - let prev = self.do_not_hide_nested_type; - let ty = match ty.kind() { + match ty.kind() { ty::Closure(_, args) => { // For a closure type, we turn it into a function pointer so that it gets rendered // as `fn(args) -> Ret`. @@ -188,52 +183,64 @@ impl<'a, 'tcx> TypeFolder> for ClosureEraser<'a, 'tcx> { self.cx().signature_unclosure(closure_sig, hir::Safety::Safe), ) } - ty::Adt(def, _) => { - let generics = self.cx().generics_of(def.did()); - if generics.own_params.iter().any(|param| param.default_value(self.cx()).is_some()) - { - // We have a type that has default types, like the allocator in Vec. We decided - // to show `Vec` itself, because it hasn't yet been replaced by an `_` `Infer`, - // but we want to ensure that the type parameter with default types does *not* - // get replaced with `_` because then we'd end up with `Vec<_, _>`, instead of - // `Vec<_>`. - self.do_not_hide_nested_type = true; - ty.super_fold_with(self) - } else if ty.has_infer() || self.do_not_hide_nested_type { - // This type has an unsubstituted type variable, meaning that this type has a - // (potentially deeply nested) type parameter from the corresponding type's - // definition. We have explicitly asked this type to not be hidden. In either - // case, we keep the type and don't substitute with `_` just yet. - ty.super_fold_with(self) - } else { - // When we have a type that doesn't have any inference variables, so we replace - // the whole thing with `_`. The type system already knows about this type in - // its entirety and it is redundant to specify it for the user. The user only - // needs to specify the type parameters that we *couldn't* figure out. - self.new_infer() - } + ty::Adt(_, args) if !args.iter().any(|a| a.has_infer()) => { + // We have a type that doesn't have any inference variables, so we replace + // the whole thing with `_`. The type system already knows about this type in + // its entirety and it is redundant to specify it for the user. The user only + // needs to specify the type parameters that we *couldn't* figure out. + self.new_infer() } - _ if ty.has_infer() || self.do_not_hide_nested_type => { + ty::Adt(def, args) => { + let generics = self.cx().generics_of(def.did()); + let generics: Vec = generics + .own_params + .iter() + .map(|param| param.default_value(self.cx()).is_some()) + .collect(); + let ty = Ty::new_adt( + self.cx(), + *def, + self.cx().mk_args_from_iter(generics.into_iter().zip(args.iter()).map( + |(has_default, arg)| { + if arg.has_infer() { + // This param has an unsubstituted type variable, meaning that this + // type has a (potentially deeply nested) type parameter from the + // corresponding type's definition. We have explicitly asked this + // type to not be hidden. In either case, we keep the type and don't + // substitute with `_` just yet. + arg.fold_with(self) + } else if has_default { + // We have a type param that has a default type, like the allocator + // in Vec. We decided to show `Vec` itself, because it hasn't yet + // been replaced by an `_` `Infer`, but we want to ensure that the + // type parameter with default types does *not* get replaced with + // `_` because then we'd end up with `Vec<_, _>`, instead of + // `Vec<_>`. + arg + } else if let GenericArgKind::Type(_) = arg.kind() { + // We don't replace lifetime or const params, only type params. + self.new_infer().into() + } else { + arg.fold_with(self) + } + }, + )), + ); + ty + } + _ if ty.has_infer() => { // This type has a (potentially nested) type parameter that we couldn't figure out. // We will print this depth of type, so at least the type name and at least one of - // its type parameters. We unset `do_not_hide_nested_type` because this type can't - // have type parameter defaults until next type we hit an ADT. - self.do_not_hide_nested_type = false; + // its type parameters. ty.super_fold_with(self) } // We don't have an unknown type parameter anywhere, replace with `_`. _ => self.new_infer(), - }; - self.do_not_hide_nested_type = prev; - ty + } } fn fold_const(&mut self, c: ty::Const<'tcx>) -> ty::Const<'tcx> { - let prev = self.do_not_hide_nested_type; // Avoid accidentally erasing the type of the const. - self.do_not_hide_nested_type = true; - let c = c.super_fold_with(self); - self.do_not_hide_nested_type = prev; c } } @@ -281,7 +288,7 @@ fn ty_to_string<'tcx>( let ty = infcx.resolve_vars_if_possible(ty); // We use `fn` ptr syntax for closures, but this only works when the closure does not capture // anything. We also remove all type parameters that are fully known to the type system. - let ty = ty.fold_with(&mut ClosureEraser { infcx, do_not_hide_nested_type: false }); + let ty = ty.fold_with(&mut ClosureEraser { infcx }); match (ty.kind(), called_method_def_id) { // We don't want the regular output for `fn`s because it includes its path in From 3e5b413dc47c75dd36cac61d6d028feddc413f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Mon, 3 Feb 2025 22:06:13 +0100 Subject: [PATCH 021/128] Make the rustc-pull workflow run less often --- src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml b/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml index 5bfcf47d7034..dc5395a19dd0 100644 --- a/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml +++ b/src/doc/rustc-dev-guide/.github/workflows/rustc-pull.yml @@ -3,8 +3,8 @@ name: rustc-pull on: workflow_dispatch: schedule: - # Run at 04:00 UTC every day - - cron: '0 4 * * *' + # Run at 04:00 UTC every Monday and Thursday + - cron: '0 4 * * 1,4' jobs: pull: From aa884da1e7e1f7d08a3c66ca25a824a907f43258 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Tue, 4 Feb 2025 04:22:50 +0000 Subject: [PATCH 022/128] Delay bug when method confirmation cannot upcast object pick of self --- .../rustc_hir_typeck/src/method/confirm.rs | 24 ++++++++++++------- tests/ui/self/invalid-self-dyn-receiver.rs | 20 ++++++++++++++++ .../ui/self/invalid-self-dyn-receiver.stderr | 12 ++++++++++ 3 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 tests/ui/self/invalid-self-dyn-receiver.rs create mode 100644 tests/ui/self/invalid-self-dyn-receiver.stderr diff --git a/compiler/rustc_hir_typeck/src/method/confirm.rs b/compiler/rustc_hir_typeck/src/method/confirm.rs index 5c1c38aeb953..dadebc6eff4d 100644 --- a/compiler/rustc_hir_typeck/src/method/confirm.rs +++ b/compiler/rustc_hir_typeck/src/method/confirm.rs @@ -673,17 +673,23 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { traits::upcast_choices(self.tcx, source_trait_ref, target_trait_def_id); // must be exactly one trait ref or we'd get an ambig error etc - let [upcast_trait_ref] = upcast_trait_refs.as_slice() else { - span_bug!( + if let &[upcast_trait_ref] = upcast_trait_refs.as_slice() { + upcast_trait_ref + } else { + self.dcx().span_delayed_bug( self.span, - "cannot uniquely upcast `{:?}` to `{:?}`: `{:?}`", - source_trait_ref, - target_trait_def_id, - upcast_trait_refs - ) - }; + format!( + "cannot uniquely upcast `{:?}` to `{:?}`: `{:?}`", + source_trait_ref, target_trait_def_id, upcast_trait_refs + ), + ); - *upcast_trait_ref + ty::Binder::dummy(ty::TraitRef::new_from_args( + self.tcx, + target_trait_def_id, + ty::GenericArgs::extend_with_error(self.tcx, target_trait_def_id, &[]), + )) + } } fn instantiate_binder_with_fresh_vars(&self, value: ty::Binder<'tcx, T>) -> T diff --git a/tests/ui/self/invalid-self-dyn-receiver.rs b/tests/ui/self/invalid-self-dyn-receiver.rs new file mode 100644 index 000000000000..a989b331b5e0 --- /dev/null +++ b/tests/ui/self/invalid-self-dyn-receiver.rs @@ -0,0 +1,20 @@ +// Makes sure we don't ICE when encountering a receiver that is *ostensibly* dyn safe, +// because it satisfies `&dyn Bar: DispatchFromDyn<&dyn Bar>`, but is not a valid receiver +// in wfcheck. + +#![feature(arbitrary_self_types)] + +use std::ops::Deref; + +trait Foo: Deref { + fn method(self: &dyn Bar) {} + //~^ ERROR invalid `self` parameter type: `&dyn Bar` +} + +trait Bar {} + +fn test(x: &dyn Foo) { + x.method(); +} + +fn main() {} diff --git a/tests/ui/self/invalid-self-dyn-receiver.stderr b/tests/ui/self/invalid-self-dyn-receiver.stderr new file mode 100644 index 000000000000..f77f5686ad28 --- /dev/null +++ b/tests/ui/self/invalid-self-dyn-receiver.stderr @@ -0,0 +1,12 @@ +error[E0307]: invalid `self` parameter type: `&dyn Bar` + --> $DIR/invalid-self-dyn-receiver.rs:10:22 + | +LL | fn method(self: &dyn Bar) {} + | ^^^^^^^^ + | + = note: type of `self` must be `Self` or some type implementing `Receiver` + = help: consider changing to `self`, `&self`, `&mut self`, or a type implementing `Receiver` such as `self: Box`, `self: Rc`, or `self: Arc` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0307`. From 62c2f65ccde6d5ab26ca0181ee6ec3b24f163eae Mon Sep 17 00:00:00 2001 From: Lucas Sunsi Abreu Date: Wed, 5 Feb 2025 17:13:02 -0300 Subject: [PATCH 023/128] chore: update rustc-hash 2.1.0 to 2.1.1 --- Cargo.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7c8f06a02396..298ef772dcbe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2007,7 +2007,7 @@ dependencies = [ "anyhow", "clap", "fs-err", - "rustc-hash 2.1.0", + "rustc-hash 2.1.1", "rustdoc-json-types", "serde", "serde_json", @@ -3207,7 +3207,7 @@ dependencies = [ "proc-macro2", "quote", "rinja_parser", - "rustc-hash 2.1.0", + "rustc-hash 2.1.1", "serde", "syn 2.0.96", ] @@ -3271,9 +3271,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc-hash" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustc-main" @@ -3678,7 +3678,7 @@ dependencies = [ "memmap2", "parking_lot", "portable-atomic", - "rustc-hash 2.1.0", + "rustc-hash 2.1.1", "rustc-rayon", "rustc-stable-hash", "rustc_arena", @@ -4383,7 +4383,7 @@ dependencies = [ name = "rustc_pattern_analysis" version = "0.0.0" dependencies = [ - "rustc-hash 2.1.0", + "rustc-hash 2.1.1", "rustc_abi", "rustc_apfloat", "rustc_arena", @@ -4779,7 +4779,7 @@ name = "rustdoc-json-types" version = "0.1.0" dependencies = [ "bincode", - "rustc-hash 2.1.0", + "rustc-hash 2.1.1", "serde", "serde_json", ] @@ -5430,7 +5430,7 @@ dependencies = [ "ignore", "miropt-test-tools", "regex", - "rustc-hash 2.1.0", + "rustc-hash 2.1.1", "semver", "serde", "similar", From cfa351895108a5d60237b5549f05911852c40ad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Wed, 5 Feb 2025 16:48:01 +0100 Subject: [PATCH 024/128] Only apply LTO to rustdoc at stage 2 It doesn't make much sense at stage 1, and it was broken anyway. --- src/bootstrap/src/core/build_steps/compile.rs | 9 ++++++--- src/bootstrap/src/core/build_steps/tool.rs | 19 +++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index cd3558ac6a49..dcc587c42ce0 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1064,9 +1064,7 @@ pub fn rustc_cargo( cargo.rustflag("-Zdefault-visibility=protected"); } - // We currently don't support cross-crate LTO in stage0. This also isn't hugely necessary - // and may just be a time sink. - if compiler.stage != 0 { + if is_lto_stage(compiler) { match builder.config.rust_lto { RustcLto::Thin | RustcLto::Fat => { // Since using LTO for optimizing dylibs is currently experimental, @@ -2290,3 +2288,8 @@ pub fn strip_debug(builder: &Builder<'_>, target: TargetSelection, path: &Path) // everything else (standard library, future stages...) to be rebuilt. t!(file.set_modified(previous_mtime)); } + +/// We only use LTO for stage 2+, to speed up build time of intermediate stages. +pub fn is_lto_stage(build_compiler: &Compiler) -> bool { + build_compiler.stage != 0 +} diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs index 75fac88252b1..64e7a555bbbc 100644 --- a/src/bootstrap/src/core/build_steps/tool.rs +++ b/src/bootstrap/src/core/build_steps/tool.rs @@ -1,6 +1,7 @@ use std::path::PathBuf; use std::{env, fs}; +use crate::core::build_steps::compile::is_lto_stage; use crate::core::build_steps::toolstate::ToolState; use crate::core::build_steps::{compile, llvm}; use crate::core::builder; @@ -660,14 +661,16 @@ impl Step for Rustdoc { ); // rustdoc is performance sensitive, so apply LTO to it. - let lto = match builder.config.rust_lto { - RustcLto::Off => Some("off"), - RustcLto::Thin => Some("thin"), - RustcLto::Fat => Some("fat"), - RustcLto::ThinLocal => None, - }; - if let Some(lto) = lto { - cargo.env(cargo_profile_var("LTO", &builder.config), lto); + if is_lto_stage(&build_compiler) { + let lto = match builder.config.rust_lto { + RustcLto::Off => Some("off"), + RustcLto::Thin => Some("thin"), + RustcLto::Fat => Some("fat"), + RustcLto::ThinLocal => None, + }; + if let Some(lto) = lto { + cargo.env(cargo_profile_var("LTO", &builder.config), lto); + } } let _guard = builder.msg_tool( From 299b78e2e3fa43ac283af429e062e58d946c0c7d Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 6 Feb 2025 09:12:42 +0100 Subject: [PATCH 025/128] Replace link with a https based one --- src/doc/rustc-dev-guide/src/appendix/bibliography.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/rustc-dev-guide/src/appendix/bibliography.md b/src/doc/rustc-dev-guide/src/appendix/bibliography.md index 8f6810cbcaea..93426b645a61 100644 --- a/src/doc/rustc-dev-guide/src/appendix/bibliography.md +++ b/src/doc/rustc-dev-guide/src/appendix/bibliography.md @@ -82,7 +82,7 @@ Rust, as well as publications about Rust. * [Ownership is Theft: Experiences Building an Embedded OS in Rust - Amit Levy, et. al.](https://amitlevy.com/papers/tock-plos2015.pdf) * [You can't spell trust without Rust](https://faultlore.com/blah/papers/thesis.pdf). Aria Beingessner's master's thesis. * [Rust-Bio: a fast and safe bioinformatics library](https://rust-bio.github.io/). Johannes Köster -* [Safe, Correct, and Fast Low-Level Networking](https://octarineparrot.com/assets/msci_paper.pdf). Robert Clipsham's master's thesis. +* [Safe, Correct, and Fast Low-Level Networking](https://csperkins.org/research/thesis-msci-clipsham.pdf). Robert Clipsham's master's thesis. * [Formalizing Rust traits](https://open.library.ubc.ca/cIRcle/collections/ubctheses/24/items/1.0220521). Jonatan Milewski's master's thesis. * [Rust as a Language for High Performance GC Implementation](https://dl.acm.org/doi/pdf/10.1145/3241624.2926707) * [Simple Verification of Rust Programs via Functional Purification](https://github.com/Kha/electrolysis). Sebastian Ullrich's master's thesis. From 941e82a4b82918723372d7e575382dc0fe40c51a Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 6 Feb 2025 14:59:43 +0100 Subject: [PATCH 026/128] improve CI cache docs --- src/doc/rustc-dev-guide/src/tests/ci.md | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/tests/ci.md b/src/doc/rustc-dev-guide/src/tests/ci.md index 9dde407895e2..a4b22392f197 100644 --- a/src/doc/rustc-dev-guide/src/tests/ci.md +++ b/src/doc/rustc-dev-guide/src/tests/ci.md @@ -322,7 +322,7 @@ Our CI workflow uses various caching mechanisms, mainly for two things: ### Docker images caching The Docker images we use to run most of the Linux-based builders take a *long* -time to fully build. To speed up the build, we cache it using [Docker registry +time to fully build. To speed up the build, we cache them using [Docker registry caching], with the intermediate artifacts being stored on [ghcr.io]. We also push the built Docker images to ghcr, so that they can be reused by other tools (rustup) or by developers running the Docker build locally (to speed up their @@ -334,6 +334,13 @@ override the cache for the others. Instead, we store the images under different tags, identifying them with a custom hash made from the contents of all the Dockerfiles and related scripts. +The CI calculates a hash key, so that the cache of a Docker image is +invalidated if one of the following changes: + +- Dockerfile +- Files copied into the Docker image in the Dockerfile +- The architecture of the GitHub runner (x86 or ARM) + [ghcr.io]: https://github.com/rust-lang-ci/rust/pkgs/container/rust-ci [Docker registry caching]: https://docs.docker.com/build/cache/backends/registry/ @@ -341,9 +348,18 @@ Dockerfiles and related scripts. We build some C/C++ stuff in various CI jobs, and we rely on [sccache] to cache the intermediate LLVM artifacts. Sccache is a distributed ccache developed by -Mozilla, which can use an object storage bucket as the storage backend. In our -case, the artefacts are uploaded to an S3 bucket that we control -(`rust-lang-ci-sccache2`). +Mozilla, which can use an object storage bucket as the storage backend. + +With sccache there's no need to calculate the hash key ourselves. Sccache +invalidates the cache automatically when it detects changes to relevant inputs, +such as the source code, the version of the compiler, and important environment +variables. +So we just pass the sccache wrapper on top of cargo and sccache does the rest. + +We store the persistent artifacts on the S3 bucket `rust-lang-ci-sccache2`. So +when the CI runs, if sccache sees that LLVM is being compiled with the same C/C++ +compiler and the LLVM source code is the same, sccache retrieves the individual +compiled translation units from S3. [sccache]: https://github.com/mozilla/sccache From 0d9cb9c01da0eeca152524e5428398eebf5c9bc9 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Thu, 6 Feb 2025 15:13:40 +0100 Subject: [PATCH 027/128] ci: use ubuntu 24 for x86 large runners --- src/ci/github-actions/jobs.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 58a9eb696665..6d7607bb8f86 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -12,15 +12,15 @@ runners: # Large runner used mainly for its bigger disk capacity - &job-linux-4c-largedisk - os: ubuntu-22.04-4core-16gb + os: ubuntu-24.04-4core-16gb <<: *base-job - &job-linux-8c - os: ubuntu-22.04-8core-32gb + os: ubuntu-24.04-8core-32gb <<: *base-job - &job-linux-16c - os: ubuntu-22.04-16core-64gb + os: ubuntu-24.04-16core-64gb <<: *base-job - &job-macos-xl From 11f64f1eb45d5e7005dc880441758d0b9162fb8f Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 6 Feb 2025 08:29:10 -0700 Subject: [PATCH 028/128] Update links to type schemas What used to be in externs.js is now in rustdoc.d.ts. --- src/doc/rustc-dev-guide/src/rustdoc-internals/search.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/rustdoc-internals/search.md b/src/doc/rustc-dev-guide/src/rustdoc-internals/search.md index ddf8ec405f81..3506431118ba 100644 --- a/src/doc/rustc-dev-guide/src/rustdoc-internals/search.md +++ b/src/doc/rustc-dev-guide/src/rustdoc-internals/search.md @@ -46,8 +46,8 @@ For space savings, it's also written without newlines or spaces. ] ``` -[`src/librustdoc/html/static/js/externs.js`] -defines an actual schema in a Closure `@typedef`. +[`src/librustdoc/html/static/js/rustdoc.d.ts`] +defines an actual schema in a TypeScript `type`. | Key | Name | Description | | --- | -------------------- | ------------ | @@ -68,7 +68,7 @@ with a free function called `function_name` and a struct called `Data`, with the type signature `Data, i32 -> str`, and an alias, `get_name`, that equivalently refers to `function_name`. -[`src/librustdoc/html/static/js/externs.js`]: https://github.com/rust-lang/rust/blob/79b710c13968a1a48d94431d024d2b1677940866/src/librustdoc/html/static/js/externs.js#L204-L258 +[`src/librustdoc/html/static/js/rustdoc.d.ts`]: https://github.com/rust-lang/rust/blob/2f92f050e83bf3312ce4ba73c31fe843ad3cbc60/src/librustdoc/html/static/js/rustdoc.d.ts#L344-L390 The search index needs to fit the needs of the `rustdoc` compiler, the `search.js` frontend, @@ -469,7 +469,7 @@ want the libs team to be able to add new items without causing unrelated tests to fail, but standalone tests will use it more often. The `ResultsTable` and `ParsedQuery` types are specified in -[`externs.js`](https://github.com/rust-lang/rust/blob/master/src/librustdoc/html/static/js/externs.js). +[`rustdoc.d.ts`](https://github.com/rust-lang/rust/blob/master/src/librustdoc/html/static/js/rustdoc.d.ts). For example, imagine we needed to fix a bug where a function named `constructor` couldn't be found. To do this, write two files: From 82b32ba03d5c94d3a9530d252edb27e38f5b8176 Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Thu, 6 Feb 2025 22:38:24 +0100 Subject: [PATCH 029/128] stabilize `NonZero::count_ones` --- library/core/src/num/nonzero.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index a115acf42b12..21bad6705ab8 100644 --- a/library/core/src/num/nonzero.rs +++ b/library/core/src/num/nonzero.rs @@ -612,8 +612,6 @@ macro_rules! nonzero_integer { /// Basic usage: /// /// ``` - /// #![feature(non_zero_count_ones)] - /// /// # use std::num::NonZero; /// # /// # fn main() { test().unwrap(); } @@ -627,7 +625,8 @@ macro_rules! nonzero_integer { /// # } /// ``` /// - #[unstable(feature = "non_zero_count_ones", issue = "120287")] + #[stable(feature = "non_zero_count_ones", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable(feature = "non_zero_count_ones", since = "CURRENT_RUSTC_VERSION")] #[doc(alias = "popcount")] #[doc(alias = "popcnt")] #[must_use = "this returns the result of the operation, \ From ac31e9572bba91d704a800833e2060390380c60c Mon Sep 17 00:00:00 2001 From: Askar Safin Date: Fri, 7 Feb 2025 09:14:17 +0300 Subject: [PATCH 030/128] library: doc: core::alloc::Allocator: trivial typo fix --- library/core/src/alloc/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/alloc/mod.rs b/library/core/src/alloc/mod.rs index dcab6136ae8a..9805cee1c331 100644 --- a/library/core/src/alloc/mod.rs +++ b/library/core/src/alloc/mod.rs @@ -94,7 +94,7 @@ impl fmt::Display for AllocError { /// - the memory block is deallocated, or /// - the allocator is dropped. /// -/// Copying, cloning, or moving the allocator must not invalidate memory blocks returned from it +/// Copying, cloning, or moving the allocator must not invalidate memory blocks returned from it. /// A copied or cloned allocator must behave like the original allocator. /// /// A memory block which is [*currently allocated*] may be passed to From 515bd9f70f089c527e49fea0aced74debf98f771 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 7 Feb 2025 09:03:22 +0100 Subject: [PATCH 031/128] Remove reference to enum.Reveal --- src/doc/rustc-dev-guide/src/param_env/param_env_acquisition.md | 3 +-- src/doc/rustc-dev-guide/src/param_env/param_env_what_is_it.md | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/param_env/param_env_acquisition.md b/src/doc/rustc-dev-guide/src/param_env/param_env_acquisition.md index 391e562910fa..f6cff2d6c63c 100644 --- a/src/doc/rustc-dev-guide/src/param_env/param_env_acquisition.md +++ b/src/doc/rustc-dev-guide/src/param_env/param_env_acquisition.md @@ -21,7 +21,7 @@ Creating an env from an arbitrary set of where clauses is usually unnecessary an Creating an empty environment via `ParamEnv::empty` is almost always wrong. There are very few places where we actually know that the environment should be empty. One of the only places where we do actually know this is after monomorphization, however the `ParamEnv` there should be constructed via `ParamEnv::reveal_all` instead as at this point we should be able to determine the hidden type of opaque types. Codegen/Post-mono is one of the only places that should be using `ParamEnv::reveal_all`. -An additional piece of complexity here is specifying the [`Reveal`][reveal] (see linked docs for explanation of what reveal does) used for the `ParamEnv`. When constructing a param env using the `param_env` query it will have `Reveal::UserFacing`, if `Reveal::All` is desired then the [`tcx.param_env_reveal_all_normalized`][env_reveal_all_normalized] query can be used instead. +An additional piece of complexity here is specifying the `Reveal` (see linked docs for explanation of what reveal does) used for the `ParamEnv`. When constructing a param env using the `param_env` query it will have `Reveal::UserFacing`, if `Reveal::All` is desired then the [`tcx.param_env_reveal_all_normalized`][env_reveal_all_normalized] query can be used instead. The `ParamEnv` type has a method [`ParamEnv::with_reveal_all_normalized`][with_reveal_all] which converts an existing `ParamEnv` into one with `Reveal::All` specified. Where possible the previously mentioned query should be preferred as it is more efficient. @@ -38,7 +38,6 @@ The `ParamEnv` type has a method [`ParamEnv::with_reveal_all_normalized`][with_r [with_reveal_all]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.ParamEnv.html#method.with_reveal_all_normalized [env_reveal_all]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.ParamEnv.html#method.reveal_all [env_empty]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.ParamEnv.html#method.empty -[reveal]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/traits/enum.Reveal.html [pe]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.ParamEnv.html [param_env_query]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_typeck/fn_ctxt/struct.FnCtxt.html#structfield.param_env [method_pred_entailment]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/check/compare_impl_item/fn.compare_method_predicate_entailment.html diff --git a/src/doc/rustc-dev-guide/src/param_env/param_env_what_is_it.md b/src/doc/rustc-dev-guide/src/param_env/param_env_what_is_it.md index ca09518d99f4..5c2f4d594052 100644 --- a/src/doc/rustc-dev-guide/src/param_env/param_env_what_is_it.md +++ b/src/doc/rustc-dev-guide/src/param_env/param_env_what_is_it.md @@ -3,7 +3,7 @@ The type system relies on information in the environment in order for it to function correctly. This information is stored in the [`ParamEnv`][pe] type and it is important to use the correct `ParamEnv` when interacting with the type system. -The information represented by `ParamEnv` is a list of in-scope where-clauses, and a [`Reveal`][reveal] (see linked docs for more information). A `ParamEnv` typically corresponds to a specific item's where clauses, some clauses are not explicitly written bounds and instead are implicitly added in [`predicates_of`][predicates_of] such as `ConstArgHasType` or some implied bounds. +The information represented by `ParamEnv` is a list of in-scope where-clauses, and a `Reveal` (see linked docs for more information). A `ParamEnv` typically corresponds to a specific item's where clauses, some clauses are not explicitly written bounds and instead are implicitly added in [`predicates_of`][predicates_of] such as `ConstArgHasType` or some implied bounds. A `ParamEnv` can also be created with arbitrary data that is not derived from a specific item such as in [`compare_method_predicate_entailment`][method_pred_entailment] which creates a hybrid `ParamEnv` consisting of the impl's where clauses and the trait definition's function's where clauses. In most cases `ParamEnv`s are initially created via the [`param_env` query][query] which returns a `ParamEnv` derived from the provided item's where clauses. @@ -57,4 +57,3 @@ It's very important to use the correct `ParamEnv` when interacting with the type [method_pred_entailment]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/check/compare_impl_item/fn.compare_method_predicate_entailment.html [pe]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.ParamEnv.html [query]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.param_env -[reveal]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/traits/enum.Reveal.html \ No newline at end of file From ea54b5e2444cc1da08e2c4dfa720115cd1edb4a8 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Fri, 7 Feb 2025 10:34:23 -0700 Subject: [PATCH 032/128] Replace i686-unknown-redox target with i586-unknown-redox --- compiler/rustc_target/src/spec/mod.rs | 2 +- .../{i686_unknown_redox.rs => i586_unknown_redox.rs} | 4 ++-- src/doc/rustc/src/platform-support.md | 2 +- src/doc/rustc/src/platform-support/redox.md | 4 ++-- src/tools/build-manifest/src/main.rs | 2 +- tests/assembly/targets/targets-elf.rs | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) rename compiler/rustc_target/src/spec/targets/{i686_unknown_redox.rs => i586_unknown_redox.rs} (90%) diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index e95c4dbd2cff..7455813c48a5 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -1797,7 +1797,7 @@ supported_targets! { ("x86_64-unknown-l4re-uclibc", x86_64_unknown_l4re_uclibc), ("aarch64-unknown-redox", aarch64_unknown_redox), - ("i686-unknown-redox", i686_unknown_redox), + ("i586-unknown-redox", i586_unknown_redox), ("x86_64-unknown-redox", x86_64_unknown_redox), ("i386-apple-ios", i386_apple_ios), diff --git a/compiler/rustc_target/src/spec/targets/i686_unknown_redox.rs b/compiler/rustc_target/src/spec/targets/i586_unknown_redox.rs similarity index 90% rename from compiler/rustc_target/src/spec/targets/i686_unknown_redox.rs rename to compiler/rustc_target/src/spec/targets/i586_unknown_redox.rs index bfe52a330d30..67dfc42103b6 100644 --- a/compiler/rustc_target/src/spec/targets/i686_unknown_redox.rs +++ b/compiler/rustc_target/src/spec/targets/i586_unknown_redox.rs @@ -2,7 +2,7 @@ use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base}; pub(crate) fn target() -> Target { let mut base = base::redox::opts(); - base.cpu = "pentiumpro".into(); + base.cpu = "pentium".into(); base.plt_by_default = false; base.max_atomic_width = Some(64); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]); @@ -10,7 +10,7 @@ pub(crate) fn target() -> Target { base.stack_probes = StackProbeType::Call; Target { - llvm_target: "i686-unknown-redox".into(), + llvm_target: "i586-unknown-redox".into(), metadata: crate::spec::TargetMetadata { description: None, tier: None, diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index 3b6abdd84832..d9c0e6a13270 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -310,12 +310,12 @@ target | std | host | notes [`i386-apple-ios`](platform-support/apple-ios.md) | ✓ | | 32-bit x86 iOS (Penryn) [^x86_32-floats-return-ABI] [`i586-pc-nto-qnx700`](platform-support/nto-qnx.md) | * | | 32-bit x86 QNX Neutrino 7.0 RTOS (Pentium 4) [^x86_32-floats-return-ABI] [`i586-unknown-netbsd`](platform-support/netbsd.md) | ✓ | | 32-bit x86 (original Pentium) [^x86_32-floats-x87] +[`i586-unknown-redox`](platform-support/redox.md) | ✓ | | 32-bit x86 Redox OS (original Pentium) [^x86_32-floats-x87] [`i686-apple-darwin`](platform-support/apple-darwin.md) | ✓ | ✓ | 32-bit macOS (10.12+, Sierra+, Penryn) [^x86_32-floats-return-ABI] `i686-unknown-haiku` | ✓ | ✓ | 32-bit Haiku (Pentium 4) [^x86_32-floats-return-ABI] [`i686-unknown-hurd-gnu`](platform-support/hurd.md) | ✓ | ✓ | 32-bit GNU/Hurd (PentiumPro) [^x86_32-floats-x87] [`i686-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD/i386 (Pentium 4) [^x86_32-floats-return-ABI] [`i686-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | 32-bit OpenBSD (Pentium 4) [^x86_32-floats-return-ABI] -[`i686-unknown-redox`](platform-support/redox.md) | ✓ | | i686 Redox OS (PentiumPro) [^x86_32-floats-x87] `i686-uwp-windows-gnu` | ✓ | | [^x86_32-floats-return-ABI] [`i686-uwp-windows-msvc`](platform-support/uwp-windows-msvc.md) | ✓ | | [^x86_32-floats-return-ABI] [`i686-win7-windows-gnu`](platform-support/win7-windows-gnu.md) | ✓ | | 32-bit Windows 7 support [^x86_32-floats-return-ABI] diff --git a/src/doc/rustc/src/platform-support/redox.md b/src/doc/rustc/src/platform-support/redox.md index 1b3321956ef7..2bba92d504c4 100644 --- a/src/doc/rustc/src/platform-support/redox.md +++ b/src/doc/rustc/src/platform-support/redox.md @@ -9,7 +9,7 @@ Target triplets available so far: - `x86_64-unknown-redox` (tier 2) - `aarch64-unknown-redox` (tier 3) -- `i686-unknown-redox` (tier 3) +- `i586-unknown-redox` (tier 3) ## Target maintainers @@ -36,7 +36,7 @@ target = [ "", "x86_64-unknown-redox", "aarch64-unknown-redox", - "i686-unknown-redox", + "i586-unknown-redox", ] ``` diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index feec2a7444f8..22ce88f9f28a 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -99,6 +99,7 @@ static TARGETS: &[&str] = &[ "i586-pc-windows-msvc", "i586-unknown-linux-gnu", "i586-unknown-linux-musl", + "i586-unknown-redox", "i686-apple-darwin", "i686-linux-android", "i686-pc-windows-gnu", @@ -107,7 +108,6 @@ static TARGETS: &[&str] = &[ "i686-unknown-freebsd", "i686-unknown-linux-gnu", "i686-unknown-linux-musl", - "i686-unknown-redox", "i686-unknown-uefi", "loongarch64-unknown-linux-gnu", "loongarch64-unknown-linux-musl", diff --git a/tests/assembly/targets/targets-elf.rs b/tests/assembly/targets/targets-elf.rs index 0ff886653a47..b5c0ee5a1074 100644 --- a/tests/assembly/targets/targets-elf.rs +++ b/tests/assembly/targets/targets-elf.rs @@ -228,6 +228,9 @@ //@ revisions: i586_unknown_netbsd //@ [i586_unknown_netbsd] compile-flags: --target i586-unknown-netbsd //@ [i586_unknown_netbsd] needs-llvm-components: x86 +//@ revisions: i586_unknown_redox +//@ [i586_unknown_redox] compile-flags: --target i586-unknown-redox +//@ [i586_unknown_redox] needs-llvm-components: x86 //@ revisions: i686_linux_android //@ [i686_linux_android] compile-flags: --target i686-linux-android //@ [i686_linux_android] needs-llvm-components: x86 @@ -252,9 +255,6 @@ //@ revisions: i686_unknown_openbsd //@ [i686_unknown_openbsd] compile-flags: --target i686-unknown-openbsd //@ [i686_unknown_openbsd] needs-llvm-components: x86 -//@ revisions: i686_unknown_redox -//@ [i686_unknown_redox] compile-flags: --target i686-unknown-redox -//@ [i686_unknown_redox] needs-llvm-components: x86 //@ revisions: i686_wrs_vxworks //@ [i686_wrs_vxworks] compile-flags: --target i686-wrs-vxworks //@ [i686_wrs_vxworks] needs-llvm-components: x86 From 53f9852224e6e54141e55bed86dbdb966e215d22 Mon Sep 17 00:00:00 2001 From: Kajetan Puchalski Date: Fri, 7 Feb 2025 18:08:19 +0000 Subject: [PATCH 033/128] rustc_target: Add the fp16 target feature for AArch32 --- compiler/rustc_codegen_llvm/src/llvm_util.rs | 1 + compiler/rustc_target/src/target_features.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 53611c746a72..ee8c59015e66 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -271,6 +271,7 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option Some(LLVMFeature::new("fullfp16")), // Filter out features that are not supported by the current LLVM version ("aarch64", "fpmr") if get_version().0 != 18 => None, + ("arm", "fp16") => Some(LLVMFeature::new("fullfp16")), // In LLVM 18, `unaligned-scalar-mem` was merged with `unaligned-vector-mem` into a single // feature called `fast-unaligned-access`. In LLVM 19, it was split back out. ("riscv32" | "riscv64", "unaligned-scalar-mem") if get_version().0 == 18 => { diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs index eb2417e0a20a..e1efbe9cba50 100644 --- a/compiler/rustc_target/src/target_features.rs +++ b/compiler/rustc_target/src/target_features.rs @@ -145,6 +145,7 @@ const ARM_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[ ("dotprod", Unstable(sym::arm_target_feature), &["neon"]), ("dsp", Unstable(sym::arm_target_feature), &[]), ("fp-armv8", Unstable(sym::arm_target_feature), &["vfp4"]), + ("fp16", Unstable(sym::arm_target_feature), &["neon"]), ("fpregs", Unstable(sym::arm_target_feature), &[]), ("i8mm", Unstable(sym::arm_target_feature), &["neon"]), ("mclass", Unstable(sym::arm_target_feature), &[]), From 8ea20c82bbb5ac7040fe8dab326849a47f851c97 Mon Sep 17 00:00:00 2001 From: Ben Schulz Date: Fri, 7 Feb 2025 20:36:32 +0100 Subject: [PATCH 034/128] Improve examples for file locking --- library/std/src/fs.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index a5b0111adfb4..9e9e8ddb3c0a 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -664,7 +664,7 @@ impl File { /// use std::fs::File; /// /// fn main() -> std::io::Result<()> { - /// let f = File::open("foo.txt")?; + /// let f = File::create("foo.txt")?; /// f.lock()?; /// Ok(()) /// } @@ -767,7 +767,7 @@ impl File { /// use std::fs::File; /// /// fn main() -> std::io::Result<()> { - /// let f = File::open("foo.txt")?; + /// let f = File::create("foo.txt")?; /// f.try_lock()?; /// Ok(()) /// } From 5932b2fe9cd9735749ef3b141f3782edc815f4e6 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sat, 8 Feb 2025 18:56:25 -0800 Subject: [PATCH 035/128] tests/assembly: make windows ABI test cross-compile --- tests/assembly/x86_64-windows-float-abi.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/assembly/x86_64-windows-float-abi.rs b/tests/assembly/x86_64-windows-float-abi.rs index 1381d492fa59..e8900be1aaee 100644 --- a/tests/assembly/x86_64-windows-float-abi.rs +++ b/tests/assembly/x86_64-windows-float-abi.rs @@ -1,11 +1,17 @@ //@ assembly-output: emit-asm -//@ compile-flags: -O -//@ only-windows -//@ only-x86_64 +//@ compile-flags: -Copt-level=3 +//@ compile-flags: --target x86_64-pc-windows-msvc +//@ needs-llvm-components: x86 +//@ add-core-stubs #![feature(f16, f128)] +#![feature(no_core)] +#![no_core] #![crate_type = "lib"] +extern crate minicore; +use minicore::*; + // CHECK-LABEL: second_f16 // CHECK: movaps %xmm1, %xmm0 // CHECK-NEXT: retq From b3464fa65ff4486b20589e0e7486657ba0ea533d Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sat, 8 Feb 2025 19:00:27 -0800 Subject: [PATCH 036/128] tests/assembly: make typed-swap test much less fragile --- tests/assembly/x86_64-typed-swap.rs | 40 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/assembly/x86_64-typed-swap.rs b/tests/assembly/x86_64-typed-swap.rs index 95e87519e6c4..dfd6ee565bcc 100644 --- a/tests/assembly/x86_64-typed-swap.rs +++ b/tests/assembly/x86_64-typed-swap.rs @@ -3,7 +3,7 @@ //@ [LIN] only-linux //@ only-x86_64 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O +//@ compile-flags: --crate-type=lib -Copt-level=3 use std::arch::x86_64::__m128; use std::mem::swap; @@ -12,42 +12,42 @@ use std::mem::swap; #[no_mangle] pub fn swap_i32(x: &mut i32, y: &mut i32) { // CHECK: movl (%[[ARG1:.+]]), %[[T1:.+]] - // CHECK: movl (%[[ARG2:.+]]), %[[T2:.+]] - // CHECK: movl %[[T2]], (%[[ARG1]]) - // CHECK: movl %[[T1]], (%[[ARG2]]) - // CHECK: retq + // CHECK-NEXT: movl (%[[ARG2:.+]]), %[[T2:.+]] + // CHECK-DAG: movl %[[T2]], (%[[ARG1]]) + // CHECK-DAG: movl %[[T1]], (%[[ARG2]]) + // CHECK-NEXT: retq swap(x, y) } // CHECK-LABEL: swap_pair: #[no_mangle] pub fn swap_pair(x: &mut (i32, u32), y: &mut (i32, u32)) { - // CHECK: movq (%[[ARG1]]), %[[T1:.+]] - // CHECK: movq (%[[ARG2]]), %[[T2:.+]] - // CHECK: movq %[[T2]], (%[[ARG1]]) - // CHECK: movq %[[T1]], (%[[ARG2]]) - // CHECK: retq + // CHECK: movq (%[[ARG1:r..?]]), %[[T1:.+]] + // CHECK-NEXT: movq (%[[ARG2:r..?]]), %[[T2:.+]] + // CHECK-DAG: movq %[[T2]], (%[[ARG1]]) + // CHECK-DAG: movq %[[T1]], (%[[ARG2]]) + // CHECK-NEXT: retq swap(x, y) } // CHECK-LABEL: swap_str: #[no_mangle] pub fn swap_str<'a>(x: &mut &'a str, y: &mut &'a str) { - // CHECK: movups (%[[ARG1]]), %[[T1:xmm.]] - // CHECK: movups (%[[ARG2]]), %[[T2:xmm.]] - // CHECK: movups %[[T2]], (%[[ARG1]]) - // CHECK: movups %[[T1]], (%[[ARG2]]) - // CHECK: retq + // CHECK: movups (%[[ARG1:r..?]]), %[[T1:xmm.]] + // CHECK-NEXT: movups (%[[ARG2:r..?]]), %[[T2:xmm.]] + // CHECK-DAG: movups %[[T2]], (%[[ARG1]]) + // CHECK-DAG: movups %[[T1]], (%[[ARG2]]) + // CHECK-NEXT: retq swap(x, y) } // CHECK-LABEL: swap_simd: #[no_mangle] pub fn swap_simd(x: &mut __m128, y: &mut __m128) { - // CHECK: movaps (%[[ARG1]]), %[[T1:xmm.]] - // CHECK: movaps (%[[ARG2]]), %[[T2:xmm.]] - // CHECK: movaps %[[T2]], (%[[ARG1]]) - // CHECK: movaps %[[T1]], (%[[ARG2]]) - // CHECK: retq + // CHECK: movaps (%[[ARG1:r..?]]), %[[T1:xmm.]] + // CHECK-NEXT: movaps (%[[ARG2:r..?]]), %[[T2:xmm.]] + // CHECK-DAG: movaps %[[T2]], (%[[ARG1]]) + // CHECK-DAG: movaps %[[T1]], (%[[ARG2]]) + // CHECK-NEXT: retq swap(x, y) } From ee111b24e35c32b251a0879e590af3da8d5015b0 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sat, 8 Feb 2025 18:56:57 -0800 Subject: [PATCH 037/128] tests/assembly: use -Copt-level=3 instead of -O --- tests/assembly/asm/aarch64-modifiers.rs | 4 ++-- tests/assembly/asm/aarch64-outline-atomics.rs | 2 +- tests/assembly/asm/arm-modifiers.rs | 4 ++-- tests/assembly/asm/x86-modifiers.rs | 4 ++-- tests/assembly/libs/issue-115339-zip-arrays.rs | 2 +- tests/assembly/manual-eq-efficient.rs | 2 +- tests/assembly/panic-no-unwind-no-uwtable.rs | 2 +- tests/assembly/powerpc64-struct-abi.rs | 2 +- tests/assembly/s390x-backchain-toggle.rs | 2 +- tests/assembly/s390x-vector-abi.rs | 2 +- tests/assembly/simd-bitmask.rs | 2 +- tests/assembly/simd-intrinsic-gather.rs | 2 +- tests/assembly/simd-intrinsic-mask-load.rs | 2 +- tests/assembly/simd-intrinsic-mask-reduce.rs | 2 +- tests/assembly/simd-intrinsic-mask-store.rs | 2 +- tests/assembly/simd-intrinsic-scatter.rs | 2 +- tests/assembly/simd-intrinsic-select.rs | 2 +- tests/assembly/simd/reduce-fadd-unordered.rs | 3 ++- tests/assembly/slice-is_ascii.rs | 2 +- tests/assembly/x86-return-float.rs | 2 +- tests/assembly/x86_64-array-pair-load-store-merge.rs | 2 +- tests/assembly/x86_64-bigint-helpers.rs | 2 +- tests/assembly/x86_64-floating-point-clamp.rs | 2 +- tests/assembly/x86_64-function-return.rs | 2 +- tests/assembly/x86_64-no-jump-tables.rs | 2 +- 25 files changed, 29 insertions(+), 28 deletions(-) diff --git a/tests/assembly/asm/aarch64-modifiers.rs b/tests/assembly/asm/aarch64-modifiers.rs index a3956d21a067..58f7c114d3a6 100644 --- a/tests/assembly/asm/aarch64-modifiers.rs +++ b/tests/assembly/asm/aarch64-modifiers.rs @@ -1,6 +1,6 @@ //@ add-core-stubs //@ assembly-output: emit-asm -//@ compile-flags: -O -C panic=abort +//@ compile-flags: -Copt-level=3 -C panic=abort //@ compile-flags: --target aarch64-unknown-linux-gnu //@ compile-flags: -Zmerge-functions=disabled //@ needs-llvm-components: aarch64 @@ -15,7 +15,7 @@ use minicore::*; macro_rules! check { ($func:ident $reg:ident $code:literal) => { - // -O and extern "C" guarantee that the selected register is always r0/s0/d0/q0 + // -Copt-level=3 and extern "C" guarantee that the selected register is always r0/s0/d0/q0 #[no_mangle] pub unsafe extern "C" fn $func() -> i32 { let y; diff --git a/tests/assembly/asm/aarch64-outline-atomics.rs b/tests/assembly/asm/aarch64-outline-atomics.rs index 46586f0f31c0..5990fb849421 100644 --- a/tests/assembly/asm/aarch64-outline-atomics.rs +++ b/tests/assembly/asm/aarch64-outline-atomics.rs @@ -1,5 +1,5 @@ //@ assembly-output: emit-asm -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ compile-flags: --target aarch64-unknown-linux-gnu //@ needs-llvm-components: aarch64 //@ only-aarch64 diff --git a/tests/assembly/asm/arm-modifiers.rs b/tests/assembly/asm/arm-modifiers.rs index 562b6bed74c3..32a368404924 100644 --- a/tests/assembly/asm/arm-modifiers.rs +++ b/tests/assembly/asm/arm-modifiers.rs @@ -1,6 +1,6 @@ //@ add-core-stubs //@ assembly-output: emit-asm -//@ compile-flags: -O -C panic=abort +//@ compile-flags: -Copt-level=3 -C panic=abort //@ compile-flags: --target armv7-unknown-linux-gnueabihf //@ compile-flags: -C target-feature=+neon //@ compile-flags: -Zmerge-functions=disabled @@ -21,7 +21,7 @@ impl Copy for f32x4 {} macro_rules! check { ($func:ident $modifier:literal $reg:ident $ty:ident $mov:literal) => { - // -O and extern "C" guarantee that the selected register is always r0/s0/d0/q0 + // -Copt-level=3 and extern "C" guarantee that the selected register is always r0/s0/d0/q0 #[no_mangle] pub unsafe extern "C" fn $func() -> $ty { let y; diff --git a/tests/assembly/asm/x86-modifiers.rs b/tests/assembly/asm/x86-modifiers.rs index 53e4b92f84ac..5f68e5c7317f 100644 --- a/tests/assembly/asm/x86-modifiers.rs +++ b/tests/assembly/asm/x86-modifiers.rs @@ -1,7 +1,7 @@ //@ add-core-stubs //@ revisions: x86_64 i686 //@ assembly-output: emit-asm -//@ compile-flags: -O -C panic=abort +//@ compile-flags: -Copt-level=3 -C panic=abort //@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu //@[x86_64] needs-llvm-components: x86 //@[i686] compile-flags: --target i686-unknown-linux-gnu @@ -20,7 +20,7 @@ use minicore::*; macro_rules! check { ($func:ident $modifier:literal $reg:ident $mov:literal) => { - // -O and extern "C" guarantee that the selected register is always ax/xmm0 + // -Copt-level=3 and extern "C" guarantee that the selected register is always ax/xmm0 #[no_mangle] pub unsafe extern "C" fn $func() -> i32 { let y; diff --git a/tests/assembly/libs/issue-115339-zip-arrays.rs b/tests/assembly/libs/issue-115339-zip-arrays.rs index 956459b2c773..098382502e8a 100644 --- a/tests/assembly/libs/issue-115339-zip-arrays.rs +++ b/tests/assembly/libs/issue-115339-zip-arrays.rs @@ -1,6 +1,6 @@ //@ assembly-output: emit-asm // # zen3 previously exhibited odd vectorization -//@ compile-flags: --crate-type=lib -Ctarget-cpu=znver3 -O +//@ compile-flags: --crate-type=lib -Ctarget-cpu=znver3 -Copt-level=3 //@ only-x86_64 //@ ignore-sgx diff --git a/tests/assembly/manual-eq-efficient.rs b/tests/assembly/manual-eq-efficient.rs index 817ce94f476a..8dafed354beb 100644 --- a/tests/assembly/manual-eq-efficient.rs +++ b/tests/assembly/manual-eq-efficient.rs @@ -1,6 +1,6 @@ // Regression test for #106269 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel +//@ compile-flags: --crate-type=lib -Copt-level=3 -C llvm-args=-x86-asm-syntax=intel //@ only-x86_64 //@ ignore-sgx diff --git a/tests/assembly/panic-no-unwind-no-uwtable.rs b/tests/assembly/panic-no-unwind-no-uwtable.rs index 24626280155a..b51b173e9616 100644 --- a/tests/assembly/panic-no-unwind-no-uwtable.rs +++ b/tests/assembly/panic-no-unwind-no-uwtable.rs @@ -1,6 +1,6 @@ //@ assembly-output: emit-asm //@ only-x86_64-unknown-linux-gnu -//@ compile-flags: -C panic=unwind -C force-unwind-tables=n -O +//@ compile-flags: -C panic=unwind -C force-unwind-tables=n -Copt-level=3 #![crate_type = "lib"] diff --git a/tests/assembly/powerpc64-struct-abi.rs b/tests/assembly/powerpc64-struct-abi.rs index db08a5148196..0332eb94d8a7 100644 --- a/tests/assembly/powerpc64-struct-abi.rs +++ b/tests/assembly/powerpc64-struct-abi.rs @@ -1,6 +1,6 @@ //@ revisions: elfv1-be elfv2-be elfv2-le aix //@ assembly-output: emit-asm -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@[elfv1-be] compile-flags: --target powerpc64-unknown-linux-gnu //@[elfv1-be] needs-llvm-components: powerpc //@[elfv2-be] compile-flags: --target powerpc64-unknown-linux-musl diff --git a/tests/assembly/s390x-backchain-toggle.rs b/tests/assembly/s390x-backchain-toggle.rs index 8b6d0cf21232..7ef0292d911e 100644 --- a/tests/assembly/s390x-backchain-toggle.rs +++ b/tests/assembly/s390x-backchain-toggle.rs @@ -1,6 +1,6 @@ //@ revisions: enable-backchain disable-backchain //@ assembly-output: emit-asm -//@ compile-flags: -O --crate-type=lib --target=s390x-unknown-linux-gnu +//@ compile-flags: -Copt-level=3 --crate-type=lib --target=s390x-unknown-linux-gnu //@ needs-llvm-components: systemz //@[enable-backchain] compile-flags: -Ctarget-feature=+backchain //@[disable-backchain] compile-flags: -Ctarget-feature=-backchain diff --git a/tests/assembly/s390x-vector-abi.rs b/tests/assembly/s390x-vector-abi.rs index c1935582561f..7d86559c0026 100644 --- a/tests/assembly/s390x-vector-abi.rs +++ b/tests/assembly/s390x-vector-abi.rs @@ -1,7 +1,7 @@ //@ revisions: z10 z10_vector z13 z13_no_vector // ignore-tidy-linelength //@ assembly-output: emit-asm -//@ compile-flags: -O -Z merge-functions=disabled +//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled //@[z10] compile-flags: --target s390x-unknown-linux-gnu --cfg no_vector //@[z10] needs-llvm-components: systemz //@[z10_vector] compile-flags: --target s390x-unknown-linux-gnu -C target-feature=+vector diff --git a/tests/assembly/simd-bitmask.rs b/tests/assembly/simd-bitmask.rs index 9a355cc162f6..4a829c4dd98b 100644 --- a/tests/assembly/simd-bitmask.rs +++ b/tests/assembly/simd-bitmask.rs @@ -10,7 +10,7 @@ //@ [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu //@ [aarch64] needs-llvm-components: aarch64 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C panic=abort +//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort #![feature(no_core, lang_items, repr_simd, intrinsics)] #![no_core] diff --git a/tests/assembly/simd-intrinsic-gather.rs b/tests/assembly/simd-intrinsic-gather.rs index 29b0df640655..3152de35f295 100644 --- a/tests/assembly/simd-intrinsic-gather.rs +++ b/tests/assembly/simd-intrinsic-gather.rs @@ -3,7 +3,7 @@ //@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq //@ [x86-avx512] needs-llvm-components: x86 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C panic=abort +//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort #![feature(no_core, lang_items, repr_simd, intrinsics)] #![no_core] diff --git a/tests/assembly/simd-intrinsic-mask-load.rs b/tests/assembly/simd-intrinsic-mask-load.rs index 89b35ed7734e..efe3e3752fab 100644 --- a/tests/assembly/simd-intrinsic-mask-load.rs +++ b/tests/assembly/simd-intrinsic-mask-load.rs @@ -6,7 +6,7 @@ //@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq //@ [x86-avx512] needs-llvm-components: x86 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C panic=abort +//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort #![feature(no_core, lang_items, repr_simd, intrinsics)] #![no_core] diff --git a/tests/assembly/simd-intrinsic-mask-reduce.rs b/tests/assembly/simd-intrinsic-mask-reduce.rs index 8ac55990c734..4d4adda6c24f 100644 --- a/tests/assembly/simd-intrinsic-mask-reduce.rs +++ b/tests/assembly/simd-intrinsic-mask-reduce.rs @@ -7,7 +7,7 @@ //@ [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu //@ [aarch64] needs-llvm-components: aarch64 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C panic=abort +//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort #![feature(no_core, lang_items, repr_simd, intrinsics)] #![no_core] diff --git a/tests/assembly/simd-intrinsic-mask-store.rs b/tests/assembly/simd-intrinsic-mask-store.rs index 1686fd5dd883..f5d924f24a76 100644 --- a/tests/assembly/simd-intrinsic-mask-store.rs +++ b/tests/assembly/simd-intrinsic-mask-store.rs @@ -6,7 +6,7 @@ //@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq //@ [x86-avx512] needs-llvm-components: x86 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C panic=abort +//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort #![feature(no_core, lang_items, repr_simd, intrinsics)] #![no_core] diff --git a/tests/assembly/simd-intrinsic-scatter.rs b/tests/assembly/simd-intrinsic-scatter.rs index 3f4d7569c59f..5f52ababd19c 100644 --- a/tests/assembly/simd-intrinsic-scatter.rs +++ b/tests/assembly/simd-intrinsic-scatter.rs @@ -3,7 +3,7 @@ //@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq //@ [x86-avx512] needs-llvm-components: x86 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C panic=abort +//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort #![feature(no_core, lang_items, repr_simd, intrinsics)] #![no_core] diff --git a/tests/assembly/simd-intrinsic-select.rs b/tests/assembly/simd-intrinsic-select.rs index 803abf2eeb30..74784a772133 100644 --- a/tests/assembly/simd-intrinsic-select.rs +++ b/tests/assembly/simd-intrinsic-select.rs @@ -8,7 +8,7 @@ //@ [aarch64] compile-flags: --target=aarch64-unknown-linux-gnu //@ [aarch64] needs-llvm-components: aarch64 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C panic=abort +//@ compile-flags: --crate-type=lib -Copt-level=3 -C panic=abort #![feature(no_core, lang_items, repr_simd, intrinsics)] #![no_core] diff --git a/tests/assembly/simd/reduce-fadd-unordered.rs b/tests/assembly/simd/reduce-fadd-unordered.rs index ade60ba184c5..e872826f6ef7 100644 --- a/tests/assembly/simd/reduce-fadd-unordered.rs +++ b/tests/assembly/simd/reduce-fadd-unordered.rs @@ -1,6 +1,7 @@ //@ revisions: x86_64 aarch64 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O +//@ compile-flags: --crate-type=lib -Copt-level=3 + //@[aarch64] only-aarch64 //@[x86_64] only-x86_64 //@[x86_64] compile-flags: -Ctarget-feature=+sse3 diff --git a/tests/assembly/slice-is_ascii.rs b/tests/assembly/slice-is_ascii.rs index 3a050347d898..e53cd5160cf5 100644 --- a/tests/assembly/slice-is_ascii.rs +++ b/tests/assembly/slice-is_ascii.rs @@ -2,7 +2,7 @@ //@ [WIN] only-windows //@ [LIN] only-linux //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel +//@ compile-flags: --crate-type=lib -Copt-level=3 -C llvm-args=-x86-asm-syntax=intel //@ only-x86_64 //@ ignore-sgx diff --git a/tests/assembly/x86-return-float.rs b/tests/assembly/x86-return-float.rs index acd1af8d38af..423263c96732 100644 --- a/tests/assembly/x86-return-float.rs +++ b/tests/assembly/x86-return-float.rs @@ -6,7 +6,7 @@ // Use the same target CPU as `i686` so that LLVM orders the instructions in the same order. //@ compile-flags: -Ctarget-feature=+sse2 -Ctarget-cpu=pentium4 // Force frame pointers to make ASM more consistent between targets -//@ compile-flags: -O -C force-frame-pointers +//@ compile-flags: -Copt-level=3 -C force-frame-pointers //@ filecheck-flags: --implicit-check-not fld --implicit-check-not fst //@ revisions: normal win //@[normal] ignore-windows diff --git a/tests/assembly/x86_64-array-pair-load-store-merge.rs b/tests/assembly/x86_64-array-pair-load-store-merge.rs index 849f34e72e51..56a1a9e82062 100644 --- a/tests/assembly/x86_64-array-pair-load-store-merge.rs +++ b/tests/assembly/x86_64-array-pair-load-store-merge.rs @@ -1,5 +1,5 @@ //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel +//@ compile-flags: --crate-type=lib -Copt-level=3 -C llvm-args=-x86-asm-syntax=intel //@ only-x86_64 //@ ignore-sgx //@ ignore-apple (manipulates rsp too) diff --git a/tests/assembly/x86_64-bigint-helpers.rs b/tests/assembly/x86_64-bigint-helpers.rs index 3ad253a2bd0f..58785932bc2f 100644 --- a/tests/assembly/x86_64-bigint-helpers.rs +++ b/tests/assembly/x86_64-bigint-helpers.rs @@ -1,6 +1,6 @@ //@ only-x86_64 //@ assembly-output: emit-asm -//@ compile-flags: --crate-type=lib -O -C target-cpu=x86-64-v4 +//@ compile-flags: --crate-type=lib -Copt-level=3 -C target-cpu=x86-64-v4 //@ compile-flags: -C llvm-args=-x86-asm-syntax=intel //@ revisions: llvm-pre-20 llvm-20 //@ [llvm-20] min-llvm-version: 20 diff --git a/tests/assembly/x86_64-floating-point-clamp.rs b/tests/assembly/x86_64-floating-point-clamp.rs index c05afadff645..6b0c29c5f214 100644 --- a/tests/assembly/x86_64-floating-point-clamp.rs +++ b/tests/assembly/x86_64-floating-point-clamp.rs @@ -3,7 +3,7 @@ //@ assembly-output: emit-asm // Set the base cpu explicitly, in case the default has been changed. -//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel -C target-cpu=x86-64 +//@ compile-flags: --crate-type=lib -Copt-level=3 -C llvm-args=-x86-asm-syntax=intel -C target-cpu=x86-64 //@ only-x86_64 //@ ignore-sgx diff --git a/tests/assembly/x86_64-function-return.rs b/tests/assembly/x86_64-function-return.rs index 7cfdf5bce0c1..7fd57200a9ee 100644 --- a/tests/assembly/x86_64-function-return.rs +++ b/tests/assembly/x86_64-function-return.rs @@ -3,7 +3,7 @@ //@ revisions: unset keep thunk-extern keep-thunk-extern thunk-extern-keep //@ assembly-output: emit-asm -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ [keep] compile-flags: -Zfunction-return=keep //@ [thunk-extern] compile-flags: -Zfunction-return=thunk-extern //@ [keep-thunk-extern] compile-flags: -Zfunction-return=keep -Zfunction-return=thunk-extern diff --git a/tests/assembly/x86_64-no-jump-tables.rs b/tests/assembly/x86_64-no-jump-tables.rs index 9b7812262326..bb10042d8f62 100644 --- a/tests/assembly/x86_64-no-jump-tables.rs +++ b/tests/assembly/x86_64-no-jump-tables.rs @@ -3,7 +3,7 @@ //@ revisions: unset set //@ assembly-output: emit-asm -//@ compile-flags: -O +//@ compile-flags: -Copt-level=3 //@ [set] compile-flags: -Zno-jump-tables //@ only-x86_64 //@ ignore-sgx From de405dcb8fbcd0add1e60c75800dac9b8fbe4884 Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Mon, 27 Jan 2025 06:06:06 +0800 Subject: [PATCH 038/128] introduce CoercePointeeWellformed for coherence checks at typeck stage --- .../src/deriving/coerce_pointee.rs | 64 ++++++++++++--- .../src/error_codes/E0802.md | 80 +++++++++++++++++++ compiler/rustc_error_codes/src/lib.rs | 1 + compiler/rustc_expand/src/build.rs | 39 ++++++++- compiler/rustc_hir/src/lang_items.rs | 6 ++ compiler/rustc_hir_analysis/messages.ftl | 6 ++ .../src/coherence/builtin.rs | 28 +++++++ compiler/rustc_hir_analysis/src/errors.rs | 22 +++++ compiler/rustc_span/src/symbol.rs | 2 + library/core/src/marker.rs | 6 ++ .../ui/deriving/auxiliary/malicious-macro.rs | 31 +++++++ .../deriving/built-in-proc-macro-scope.stdout | 2 + .../deriving-coerce-pointee-expanded.stdout | 13 +++ .../deriving/deriving-coerce-pointee-neg.rs | 11 +++ .../deriving-coerce-pointee-neg.stderr | 62 ++++++++------ 15 files changed, 337 insertions(+), 36 deletions(-) create mode 100644 compiler/rustc_error_codes/src/error_codes/E0802.md create mode 100644 tests/ui/deriving/auxiliary/malicious-macro.rs diff --git a/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs b/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs index 82417a86dd9e..7e30cf327fc8 100644 --- a/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs +++ b/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs @@ -3,11 +3,12 @@ use ast::ptr::P; use rustc_ast::mut_visit::MutVisitor; use rustc_ast::visit::BoundKind; use rustc_ast::{ - self as ast, GenericArg, GenericBound, GenericParamKind, ItemKind, MetaItem, + self as ast, GenericArg, GenericBound, GenericParamKind, Generics, ItemKind, MetaItem, TraitBoundModifiers, VariantData, WherePredicate, }; use rustc_attr_parsing as attr; use rustc_data_structures::flat_map_in_place::FlatMapInPlace; +use rustc_errors::E0802; use rustc_expand::base::{Annotatable, ExtCtxt}; use rustc_macros::Diagnostic; use rustc_span::{Ident, Span, Symbol, sym}; @@ -88,8 +89,7 @@ pub(crate) fn expand_deriving_coerce_pointee( } else { let mut pointees = type_params .iter() - .filter_map(|&(idx, span, is_pointee)| is_pointee.then_some((idx, span))) - .fuse(); + .filter_map(|&(idx, span, is_pointee)| is_pointee.then_some((idx, span))); match (pointees.next(), pointees.next()) { (Some((idx, _span)), None) => idx, (None, _) => { @@ -110,6 +110,52 @@ pub(crate) fn expand_deriving_coerce_pointee( // Declare helper function that adds implementation blocks. // FIXME(dingxiangfei2009): Investigate the set of attributes on target struct to be propagated to impls let attrs = thin_vec![cx.attr_word(sym::automatically_derived, span),]; + // # Wellformed-ness assertion + { + let trait_path = + cx.path_all(span, true, path!(span, core::marker::CoercePointeeWellformed), vec![]); + let trait_ref = cx.trait_ref(trait_path); + push(Annotatable::Item( + cx.item( + span, + Ident::empty(), + attrs.clone(), + ast::ItemKind::Impl(Box::new(ast::Impl { + safety: ast::Safety::Default, + polarity: ast::ImplPolarity::Positive, + defaultness: ast::Defaultness::Final, + constness: ast::Const::No, + generics: Generics { + params: generics + .params + .iter() + .map(|p| match &p.kind { + GenericParamKind::Lifetime => { + cx.lifetime_param(p.span(), p.ident, p.bounds.clone()) + } + GenericParamKind::Type { default: _ } => { + cx.typaram(p.span(), p.ident, p.bounds.clone(), None) + } + GenericParamKind::Const { ty, kw_span: _, default: _ } => cx + .const_param( + p.span(), + p.ident, + p.bounds.clone(), + ty.clone(), + None, + ), + }) + .collect(), + where_clause: generics.where_clause.clone(), + span: generics.span, + }, + of_trait: Some(trait_ref), + self_ty: self_type.clone(), + items: ThinVec::new(), + })), + ), + )); + } let mut add_impl_block = |generics, trait_symbol, trait_args| { let mut parts = path!(span, core::ops); parts.push(Ident::new(trait_symbol, span)); @@ -430,35 +476,35 @@ impl<'a, 'b> rustc_ast::visit::Visitor<'a> for AlwaysErrorOnGenericParam<'a, 'b> } #[derive(Diagnostic)] -#[diag(builtin_macros_coerce_pointee_requires_transparent)] +#[diag(builtin_macros_coerce_pointee_requires_transparent, code = E0802)] struct RequireTransparent { #[primary_span] span: Span, } #[derive(Diagnostic)] -#[diag(builtin_macros_coerce_pointee_requires_one_field)] +#[diag(builtin_macros_coerce_pointee_requires_one_field, code = E0802)] struct RequireOneField { #[primary_span] span: Span, } #[derive(Diagnostic)] -#[diag(builtin_macros_coerce_pointee_requires_one_generic)] +#[diag(builtin_macros_coerce_pointee_requires_one_generic, code = E0802)] struct RequireOneGeneric { #[primary_span] span: Span, } #[derive(Diagnostic)] -#[diag(builtin_macros_coerce_pointee_requires_one_pointee)] +#[diag(builtin_macros_coerce_pointee_requires_one_pointee, code = E0802)] struct RequireOnePointee { #[primary_span] span: Span, } #[derive(Diagnostic)] -#[diag(builtin_macros_coerce_pointee_too_many_pointees)] +#[diag(builtin_macros_coerce_pointee_too_many_pointees, code = E0802)] struct TooManyPointees { #[primary_span] one: Span, @@ -467,7 +513,7 @@ struct TooManyPointees { } #[derive(Diagnostic)] -#[diag(builtin_macros_coerce_pointee_requires_maybe_sized)] +#[diag(builtin_macros_coerce_pointee_requires_maybe_sized, code = E0802)] struct RequiresMaybeSized { #[primary_span] span: Span, diff --git a/compiler/rustc_error_codes/src/error_codes/E0802.md b/compiler/rustc_error_codes/src/error_codes/E0802.md new file mode 100644 index 000000000000..9088b100886d --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0802.md @@ -0,0 +1,80 @@ +The target of `derive(CoercePointee)` macro has inadmissible specification for +a meaningful use. + +Erroneous code examples: + +The target data is not a `struct`. + +```compile_fail,E0802 +#[derive(CoercePointee)] +enum NotStruct<'a, T: ?Sized> { + Variant(&'a T), +} +``` + +The target data has a layout that is not transparent, or `repr(transparent)` +in other words. + +```compile_fail,E0802 +#[derive(CoercePointee)] +struct NotTransparent<'a, #[pointee] T: ?Sized> { + ptr: &'a T, +} +``` + +The target data has no data field. + +```compile_fail,E0802 +#[derive(CoercePointee)] +#[repr(transparent)] +struct NoField<'a, #[pointee] T: ?Sized> {} +``` + +The target data is not generic over any data, or has no generic type parameter. + +```compile_fail,E0802 +#[derive(CoercePointee)] +#[repr(transparent)] +struct NoGeneric<'a>(&'a u8); +``` + +The target data has multiple generic type parameters, but none is designated as +a pointee for coercion. + +```compile_fail,E0802 +#[derive(CoercePointee)] +#[repr(transparent)] +struct AmbiguousPointee<'a, T1: ?Sized, T2: ?Sized> { + a: (&'a T1, &'a T2), +} +``` + +The target data has multiple generic type parameters that are designated as +pointees for coercion. + +```compile_fail,E0802 +#[derive(CoercePointee)] +#[repr(transparent)] +struct TooManyPointees< + 'a, + #[pointee] A: ?Sized, + #[pointee] B: ?Sized> +((&'a A, &'a B)); +``` + +The type parameter that is designated as a pointee is not marked `?Sized`. + +```compile_fail,E0802 +#[derive(CoercePointee)] +#[repr(transparent)] +struct NoMaybeSized<'a, #[pointee] T> { + ptr: &'a T, +} +``` + +In summary, the `CoercePointee` macro demands the type to be a `struct` that is +generic over at least one type or over more types, one of which is marked with +`#[pointee]`, and has at least one data field and adopts a `repr(transparent)` +layout. +The only generic type or the type marked with `#[pointee]` has to be also +marked as `?Sized`. diff --git a/compiler/rustc_error_codes/src/lib.rs b/compiler/rustc_error_codes/src/lib.rs index 0a30bdb48a09..e970b16f6106 100644 --- a/compiler/rustc_error_codes/src/lib.rs +++ b/compiler/rustc_error_codes/src/lib.rs @@ -545,6 +545,7 @@ E0798: 0798, E0799: 0799, E0800: 0800, E0801: 0801, +E0802: 0802, ); ) } diff --git a/compiler/rustc_expand/src/build.rs b/compiler/rustc_expand/src/build.rs index 8bf09cf96b3f..df4a0031e310 100644 --- a/compiler/rustc_expand/src/build.rs +++ b/compiler/rustc_expand/src/build.rs @@ -1,7 +1,8 @@ use rustc_ast::ptr::P; use rustc_ast::util::literal; use rustc_ast::{ - self as ast, AttrVec, BlockCheckMode, Expr, LocalKind, MatchKind, PatKind, UnOp, attr, token, + self as ast, AnonConst, AttrVec, BlockCheckMode, Expr, LocalKind, MatchKind, PatKind, UnOp, + attr, token, }; use rustc_span::source_map::Spanned; use rustc_span::{DUMMY_SP, Ident, Span, Symbol, kw, sym}; @@ -138,6 +139,42 @@ impl<'a> ExtCtxt<'a> { } } + pub fn lifetime_param( + &self, + span: Span, + ident: Ident, + bounds: ast::GenericBounds, + ) -> ast::GenericParam { + ast::GenericParam { + id: ast::DUMMY_NODE_ID, + ident: ident.with_span_pos(span), + attrs: AttrVec::new(), + bounds, + is_placeholder: false, + kind: ast::GenericParamKind::Lifetime, + colon_span: None, + } + } + + pub fn const_param( + &self, + span: Span, + ident: Ident, + bounds: ast::GenericBounds, + ty: P, + default: Option, + ) -> ast::GenericParam { + ast::GenericParam { + id: ast::DUMMY_NODE_ID, + ident: ident.with_span_pos(span), + attrs: AttrVec::new(), + bounds, + is_placeholder: false, + kind: ast::GenericParamKind::Const { ty, kw_span: DUMMY_SP, default }, + colon_span: None, + } + } + pub fn trait_ref(&self, path: ast::Path) -> ast::TraitRef { ast::TraitRef { path, ref_id: ast::DUMMY_NODE_ID } } diff --git a/compiler/rustc_hir/src/lang_items.rs b/compiler/rustc_hir/src/lang_items.rs index b6689c95c4bb..b18e96646b18 100644 --- a/compiler/rustc_hir/src/lang_items.rs +++ b/compiler/rustc_hir/src/lang_items.rs @@ -370,6 +370,8 @@ language_item_table! { PointerLike, sym::pointer_like, pointer_like, Target::Trait, GenericRequirement::Exact(0); + CoercePointeeWellformed, sym::coerce_pointee_wellformed, coerce_pointee_wellformed_trait, Target::Trait, GenericRequirement::Exact(0); + ConstParamTy, sym::const_param_ty, const_param_ty_trait, Target::Trait, GenericRequirement::Exact(0); UnsizedConstParamTy, sym::unsized_const_param_ty, unsized_const_param_ty_trait, Target::Trait, GenericRequirement::Exact(0); @@ -429,9 +431,13 @@ language_item_table! { ContractCheckRequires, sym::contract_check_requires, contract_check_requires_fn, Target::Fn, GenericRequirement::None; } +/// The requirement imposed on the generics of a lang item pub enum GenericRequirement { + /// No restriction on the generics None, + /// A minimum number of generics that is demanded on a lang item Minimum(usize), + /// The number of generics must match precisely as stipulated Exact(usize), } diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl index c28c1afcfe66..2417ff3bb1a1 100644 --- a/compiler/rustc_hir_analysis/messages.ftl +++ b/compiler/rustc_hir_analysis/messages.ftl @@ -85,6 +85,12 @@ hir_analysis_cmse_output_stack_spill = .note1 = functions with the `"{$abi_name}"` ABI must pass their result via the available return registers .note2 = the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size +hir_analysis_coerce_pointee_not_concrete_ty = `derive(CoercePointee)` is only applicable to `struct` + +hir_analysis_coerce_pointee_not_struct = `derive(CoercePointee)` is only applicable to `struct`, instead of `{$kind}` + +hir_analysis_coerce_pointee_not_transparent = `derive(CoercePointee)` is only applicable to `struct` with `repr(transparent)` layout + hir_analysis_coerce_unsized_may = the trait `{$trait_name}` may only be implemented for a coercion between structures hir_analysis_coerce_unsized_multi = implementing the trait `CoerceUnsized` requires multiple coercions diff --git a/compiler/rustc_hir_analysis/src/coherence/builtin.rs b/compiler/rustc_hir_analysis/src/coherence/builtin.rs index 3511dbc62529..a872bb72bef1 100644 --- a/compiler/rustc_hir_analysis/src/coherence/builtin.rs +++ b/compiler/rustc_hir_analysis/src/coherence/builtin.rs @@ -48,6 +48,10 @@ pub(super) fn check_trait<'tcx>( checker .check(lang_items.dispatch_from_dyn_trait(), visit_implementation_of_dispatch_from_dyn)?; checker.check(lang_items.pointer_like(), visit_implementation_of_pointer_like)?; + checker.check( + lang_items.coerce_pointee_wellformed_trait(), + visit_implementation_of_coerce_pointee_wellformed, + )?; Ok(()) } @@ -782,3 +786,27 @@ fn visit_implementation_of_pointer_like(checker: &Checker<'_>) -> Result<(), Err .with_note(why_disqualified) .emit()) } + +fn visit_implementation_of_coerce_pointee_wellformed( + checker: &Checker<'_>, +) -> Result<(), ErrorGuaranteed> { + let tcx = checker.tcx; + let self_ty = tcx.impl_trait_ref(checker.impl_def_id).unwrap().instantiate_identity().self_ty(); + let ty::Adt(def, _args) = self_ty.kind() else { + return Err(tcx.dcx().emit_err(errors::CoercePointeeNotConcreteType { + span: tcx.def_span(checker.impl_def_id), + })); + }; + let did = def.did(); + let span = + if let Some(local) = did.as_local() { tcx.source_span(local) } else { tcx.def_span(did) }; + if !def.is_struct() { + return Err(tcx + .dcx() + .emit_err(errors::CoercePointeeNotStruct { span, kind: def.descr().into() })); + } + if !def.repr().transparent() { + return Err(tcx.dcx().emit_err(errors::CoercePointeeNotTransparent { span })); + } + Ok(()) +} diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index 9769be302264..a921022a1124 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -1180,6 +1180,28 @@ pub(crate) struct DispatchFromDynRepr { pub span: Span, } +#[derive(Diagnostic)] +#[diag(hir_analysis_coerce_pointee_not_struct, code = E0802)] +pub(crate) struct CoercePointeeNotStruct { + #[primary_span] + pub span: Span, + pub kind: String, +} + +#[derive(Diagnostic)] +#[diag(hir_analysis_coerce_pointee_not_concrete_ty, code = E0802)] +pub(crate) struct CoercePointeeNotConcreteType { + #[primary_span] + pub span: Span, +} + +#[derive(Diagnostic)] +#[diag(hir_analysis_coerce_pointee_not_transparent, code = E0802)] +pub(crate) struct CoercePointeeNotTransparent { + #[primary_span] + pub span: Span, +} + #[derive(Diagnostic)] #[diag(hir_analysis_inherent_ty_outside_relevant, code = E0390)] #[help] diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index c819d4332358..096a438906ce 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -193,6 +193,7 @@ symbols! { Cleanup, Clone, CoercePointee, + CoercePointeeWellformed, CoerceUnsized, Command, ConstParamTy, @@ -619,6 +620,7 @@ symbols! { cmp_partialord_lt, cmpxchg16b_target_feature, cmse_nonsecure_entry, + coerce_pointee_wellformed, coerce_unsized, cold, cold_path, diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index 1a8ef20dd7b9..62f569d37df0 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -1289,3 +1289,9 @@ pub trait FnPtr: Copy + Clone { pub macro CoercePointee($item:item) { /* compiler built-in */ } + +#[cfg(not(bootstrap))] +#[lang = "coerce_pointee_wellformed"] +#[unstable(feature = "derive_coerce_pointee", issue = "123430")] +#[doc(hidden)] +pub trait CoercePointeeWellformed {} diff --git a/tests/ui/deriving/auxiliary/malicious-macro.rs b/tests/ui/deriving/auxiliary/malicious-macro.rs new file mode 100644 index 000000000000..6665b40a14f2 --- /dev/null +++ b/tests/ui/deriving/auxiliary/malicious-macro.rs @@ -0,0 +1,31 @@ +#![feature(let_chains)] + +extern crate proc_macro; + +use proc_macro::{Delimiter, TokenStream, TokenTree}; + +#[proc_macro_attribute] +pub fn norepr(_: TokenStream, input: TokenStream) -> TokenStream { + let mut tokens = vec![]; + let mut tts = input.into_iter().fuse().peekable(); + loop { + let Some(token) = tts.next() else { break }; + if let TokenTree::Punct(punct) = &token + && punct.as_char() == '#' + { + if let Some(TokenTree::Group(group)) = tts.peek() + && let Delimiter::Bracket = group.delimiter() + && let Some(TokenTree::Ident(ident)) = group.stream().into_iter().next() + && ident.to_string() == "repr" + { + let _ = tts.next(); + // skip '#' and '[repr(..)] + } else { + tokens.push(token); + } + } else { + tokens.push(token); + } + } + tokens.into_iter().collect() +} diff --git a/tests/ui/deriving/built-in-proc-macro-scope.stdout b/tests/ui/deriving/built-in-proc-macro-scope.stdout index db97c7145ea0..aa989ed23175 100644 --- a/tests/ui/deriving/built-in-proc-macro-scope.stdout +++ b/tests/ui/deriving/built-in-proc-macro-scope.stdout @@ -20,6 +20,8 @@ pub struct Ptr<'a, #[pointee] T: ?Sized> { data: &'a mut T, } #[automatically_derived] +impl<'a, T: ?Sized> ::core::marker::CoercePointeeWellformed for Ptr<'a, T> { } +#[automatically_derived] impl<'a, T: ?Sized + ::core::marker::Unsize<__S>, __S: ?Sized> ::core::ops::DispatchFromDyn> for Ptr<'a, T> { } diff --git a/tests/ui/deriving/deriving-coerce-pointee-expanded.stdout b/tests/ui/deriving/deriving-coerce-pointee-expanded.stdout index d6eaca5cba18..ea5ee60a0bb4 100644 --- a/tests/ui/deriving/deriving-coerce-pointee-expanded.stdout +++ b/tests/ui/deriving/deriving-coerce-pointee-expanded.stdout @@ -16,6 +16,10 @@ struct MyPointer<'a, #[pointee] T: ?Sized> { ptr: &'a T, } #[automatically_derived] +impl<'a, T: ?Sized> ::core::marker::CoercePointeeWellformed for + MyPointer<'a, T> { +} +#[automatically_derived] impl<'a, T: ?Sized + ::core::marker::Unsize<__S>, __S: ?Sized> ::core::ops::DispatchFromDyn> for MyPointer<'a, T> { } @@ -31,6 +35,11 @@ pub struct MyPointer2<'a, Y, Z: MyTrait, #[pointee] T: ?Sized + MyTrait, x: core::marker::PhantomData, } #[automatically_derived] +impl<'a, Y, Z: MyTrait, T: ?Sized + MyTrait, X: MyTrait> + ::core::marker::CoercePointeeWellformed for MyPointer2<'a, Y, Z, T, X> + where Y: MyTrait { +} +#[automatically_derived] impl<'a, Y, Z: MyTrait + MyTrait<__S>, T: ?Sized + MyTrait + ::core::marker::Unsize<__S>, __S: ?Sized + MyTrait<__S>, X: MyTrait + MyTrait<__S>> ::core::ops::DispatchFromDyn> @@ -48,6 +57,10 @@ struct MyPointerWithoutPointee<'a, T: ?Sized> { ptr: &'a T, } #[automatically_derived] +impl<'a, T: ?Sized> ::core::marker::CoercePointeeWellformed for + MyPointerWithoutPointee<'a, T> { +} +#[automatically_derived] impl<'a, T: ?Sized + ::core::marker::Unsize<__S>, __S: ?Sized> ::core::ops::DispatchFromDyn> for MyPointerWithoutPointee<'a, T> { diff --git a/tests/ui/deriving/deriving-coerce-pointee-neg.rs b/tests/ui/deriving/deriving-coerce-pointee-neg.rs index da25c854c546..0a23538cd4a6 100644 --- a/tests/ui/deriving/deriving-coerce-pointee-neg.rs +++ b/tests/ui/deriving/deriving-coerce-pointee-neg.rs @@ -1,6 +1,9 @@ +//@ proc-macro: malicious-macro.rs #![feature(derive_coerce_pointee, arbitrary_self_types)] extern crate core; +extern crate malicious_macro; + use std::marker::CoercePointee; #[derive(CoercePointee)] @@ -131,4 +134,12 @@ struct GlobalCoreSized<'a, #[pointee] T: ?::core::marker::Sized> { ptr: &'a T, } +#[derive(CoercePointee)] +#[malicious_macro::norepr] +#[repr(transparent)] +struct TryToWipeRepr<'a, #[pointee] T: ?Sized> { + //~^ ERROR: `derive(CoercePointee)` is only applicable to `struct` with `repr(transparent)` layout [E0802] + ptr: &'a T, +} + fn main() {} diff --git a/tests/ui/deriving/deriving-coerce-pointee-neg.stderr b/tests/ui/deriving/deriving-coerce-pointee-neg.stderr index c1e8be49d37d..2400a48456f5 100644 --- a/tests/ui/deriving/deriving-coerce-pointee-neg.stderr +++ b/tests/ui/deriving/deriving-coerce-pointee-neg.stderr @@ -1,89 +1,89 @@ -error: `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]` - --> $DIR/deriving-coerce-pointee-neg.rs:6:10 +error[E0802]: `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]` + --> $DIR/deriving-coerce-pointee-neg.rs:9:10 | LL | #[derive(CoercePointee)] | ^^^^^^^^^^^^^ | = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) -error: `CoercePointee` can only be derived on `struct`s with at least one field - --> $DIR/deriving-coerce-pointee-neg.rs:12:10 +error[E0802]: `CoercePointee` can only be derived on `struct`s with at least one field + --> $DIR/deriving-coerce-pointee-neg.rs:15:10 | LL | #[derive(CoercePointee)] | ^^^^^^^^^^^^^ | = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) -error: `CoercePointee` can only be derived on `struct`s with at least one field - --> $DIR/deriving-coerce-pointee-neg.rs:19:10 +error[E0802]: `CoercePointee` can only be derived on `struct`s with at least one field + --> $DIR/deriving-coerce-pointee-neg.rs:22:10 | LL | #[derive(CoercePointee)] | ^^^^^^^^^^^^^ | = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) -error: `CoercePointee` can only be derived on `struct`s that are generic over at least one type - --> $DIR/deriving-coerce-pointee-neg.rs:26:10 +error[E0802]: `CoercePointee` can only be derived on `struct`s that are generic over at least one type + --> $DIR/deriving-coerce-pointee-neg.rs:29:10 | LL | #[derive(CoercePointee)] | ^^^^^^^^^^^^^ | = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) -error: exactly one generic type parameter must be marked as `#[pointee]` to derive `CoercePointee` traits - --> $DIR/deriving-coerce-pointee-neg.rs:31:10 +error[E0802]: exactly one generic type parameter must be marked as `#[pointee]` to derive `CoercePointee` traits + --> $DIR/deriving-coerce-pointee-neg.rs:34:10 | LL | #[derive(CoercePointee)] | ^^^^^^^^^^^^^ | = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) -error: only one type parameter can be marked as `#[pointee]` when deriving `CoercePointee` traits - --> $DIR/deriving-coerce-pointee-neg.rs:40:39 +error[E0802]: only one type parameter can be marked as `#[pointee]` when deriving `CoercePointee` traits + --> $DIR/deriving-coerce-pointee-neg.rs:43:39 | LL | struct TooManyPointees<'a, #[pointee] A: ?Sized, #[pointee] B: ?Sized>((&'a A, &'a B)); | ^ - here another type parameter is marked as `#[pointee]` -error: `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]` - --> $DIR/deriving-coerce-pointee-neg.rs:43:10 +error[E0802]: `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]` + --> $DIR/deriving-coerce-pointee-neg.rs:46:10 | LL | #[derive(CoercePointee)] | ^^^^^^^^^^^^^ | = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) -error: `derive(CoercePointee)` requires `T` to be marked `?Sized` - --> $DIR/deriving-coerce-pointee-neg.rs:51:36 +error[E0802]: `derive(CoercePointee)` requires `T` to be marked `?Sized` + --> $DIR/deriving-coerce-pointee-neg.rs:54:36 | LL | struct NoMaybeSized<'a, #[pointee] T> { | ^ error: the `#[pointee]` attribute may only be used on generic parameters - --> $DIR/deriving-coerce-pointee-neg.rs:59:5 + --> $DIR/deriving-coerce-pointee-neg.rs:62:5 | LL | #[pointee] | ^^^^^^^^^^ error: the `#[pointee]` attribute may only be used on generic parameters - --> $DIR/deriving-coerce-pointee-neg.rs:69:33 + --> $DIR/deriving-coerce-pointee-neg.rs:72:33 | LL | struct UhOh<#[pointee] T>(T); | ^^^^^^^^^^ error: the `#[pointee]` attribute may only be used on generic parameters - --> $DIR/deriving-coerce-pointee-neg.rs:83:21 + --> $DIR/deriving-coerce-pointee-neg.rs:86:21 | LL | struct UhOh<#[pointee] T>(T); | ^^^^^^^^^^ error: the `#[pointee]` attribute may only be used on generic parameters - --> $DIR/deriving-coerce-pointee-neg.rs:98:25 + --> $DIR/deriving-coerce-pointee-neg.rs:101:25 | LL | struct UhOh<#[pointee] T>(T); | ^^^^^^^^^^ error[E0392]: lifetime parameter `'a` is never used - --> $DIR/deriving-coerce-pointee-neg.rs:15:16 + --> $DIR/deriving-coerce-pointee-neg.rs:18:16 | LL | struct NoField<'a, #[pointee] T: ?Sized> {} | ^^ unused lifetime parameter @@ -91,7 +91,7 @@ LL | struct NoField<'a, #[pointee] T: ?Sized> {} = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: type parameter `T` is never used - --> $DIR/deriving-coerce-pointee-neg.rs:15:31 + --> $DIR/deriving-coerce-pointee-neg.rs:18:31 | LL | struct NoField<'a, #[pointee] T: ?Sized> {} | ^ unused type parameter @@ -99,7 +99,7 @@ LL | struct NoField<'a, #[pointee] T: ?Sized> {} = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: lifetime parameter `'a` is never used - --> $DIR/deriving-coerce-pointee-neg.rs:22:20 + --> $DIR/deriving-coerce-pointee-neg.rs:25:20 | LL | struct NoFieldUnit<'a, #[pointee] T: ?Sized>(); | ^^ unused lifetime parameter @@ -107,13 +107,23 @@ LL | struct NoFieldUnit<'a, #[pointee] T: ?Sized>(); = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData` error[E0392]: type parameter `T` is never used - --> $DIR/deriving-coerce-pointee-neg.rs:22:35 + --> $DIR/deriving-coerce-pointee-neg.rs:25:35 | LL | struct NoFieldUnit<'a, #[pointee] T: ?Sized>(); | ^ unused type parameter | = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` -error: aborting due to 16 previous errors +error[E0802]: `derive(CoercePointee)` is only applicable to `struct` with `repr(transparent)` layout + --> $DIR/deriving-coerce-pointee-neg.rs:140:1 + | +LL | / struct TryToWipeRepr<'a, #[pointee] T: ?Sized> { +LL | | +LL | | ptr: &'a T, +LL | | } + | |_^ -For more information about this error, try `rustc --explain E0392`. +error: aborting due to 17 previous errors + +Some errors have detailed explanations: E0392, E0802. +For more information about an error, try `rustc --explain E0392`. From c0673246371b1a5ecac940f1ea6418857f932d7c Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Wed, 29 Jan 2025 06:15:56 +0800 Subject: [PATCH 039/128] rename the trait to validity and place a feature gate afront --- .../src/deriving/coerce_pointee.rs | 4 ++-- compiler/rustc_hir/src/lang_items.rs | 2 +- compiler/rustc_hir_analysis/messages.ftl | 2 ++ .../src/coherence/builtin.rs | 18 ++++++++++-------- compiler/rustc_hir_analysis/src/errors.rs | 7 +++++++ compiler/rustc_span/src/symbol.rs | 4 ++-- library/core/src/marker.rs | 17 +++++++++++++---- .../deriving/built-in-proc-macro-scope.stdout | 2 +- .../deriving-coerce-pointee-expanded.stdout | 6 +++--- .../deriving-coerce-pointee-neg.stderr | 7 ++----- 10 files changed, 43 insertions(+), 26 deletions(-) diff --git a/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs b/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs index 7e30cf327fc8..e228095c97f7 100644 --- a/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs +++ b/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs @@ -110,10 +110,10 @@ pub(crate) fn expand_deriving_coerce_pointee( // Declare helper function that adds implementation blocks. // FIXME(dingxiangfei2009): Investigate the set of attributes on target struct to be propagated to impls let attrs = thin_vec![cx.attr_word(sym::automatically_derived, span),]; - // # Wellformed-ness assertion + // # Validity assertion which will be checked later in `rustc_hir_analysis::coherence::builtins`. { let trait_path = - cx.path_all(span, true, path!(span, core::marker::CoercePointeeWellformed), vec![]); + cx.path_all(span, true, path!(span, core::marker::CoercePointeeValidated), vec![]); let trait_ref = cx.trait_ref(trait_path); push(Annotatable::Item( cx.item( diff --git a/compiler/rustc_hir/src/lang_items.rs b/compiler/rustc_hir/src/lang_items.rs index b18e96646b18..1852987b1677 100644 --- a/compiler/rustc_hir/src/lang_items.rs +++ b/compiler/rustc_hir/src/lang_items.rs @@ -370,7 +370,7 @@ language_item_table! { PointerLike, sym::pointer_like, pointer_like, Target::Trait, GenericRequirement::Exact(0); - CoercePointeeWellformed, sym::coerce_pointee_wellformed, coerce_pointee_wellformed_trait, Target::Trait, GenericRequirement::Exact(0); + CoercePointeeValidated, sym::coerce_pointee_validated, coerce_pointee_validated_trait, Target::Trait, GenericRequirement::Exact(0); ConstParamTy, sym::const_param_ty, const_param_ty_trait, Target::Trait, GenericRequirement::Exact(0); UnsizedConstParamTy, sym::unsized_const_param_ty, unsized_const_param_ty_trait, Target::Trait, GenericRequirement::Exact(0); diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl index 2417ff3bb1a1..9c38193c84e3 100644 --- a/compiler/rustc_hir_analysis/messages.ftl +++ b/compiler/rustc_hir_analysis/messages.ftl @@ -85,6 +85,8 @@ hir_analysis_cmse_output_stack_spill = .note1 = functions with the `"{$abi_name}"` ABI must pass their result via the available return registers .note2 = the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size +hir_analysis_coerce_pointee_no_user_validity_assertion = asserting applicability of `derive(CoercePointee)` on a target data is forbidden + hir_analysis_coerce_pointee_not_concrete_ty = `derive(CoercePointee)` is only applicable to `struct` hir_analysis_coerce_pointee_not_struct = `derive(CoercePointee)` is only applicable to `struct`, instead of `{$kind}` diff --git a/compiler/rustc_hir_analysis/src/coherence/builtin.rs b/compiler/rustc_hir_analysis/src/coherence/builtin.rs index a872bb72bef1..c21576a5e7ca 100644 --- a/compiler/rustc_hir_analysis/src/coherence/builtin.rs +++ b/compiler/rustc_hir_analysis/src/coherence/builtin.rs @@ -49,8 +49,8 @@ pub(super) fn check_trait<'tcx>( .check(lang_items.dispatch_from_dyn_trait(), visit_implementation_of_dispatch_from_dyn)?; checker.check(lang_items.pointer_like(), visit_implementation_of_pointer_like)?; checker.check( - lang_items.coerce_pointee_wellformed_trait(), - visit_implementation_of_coerce_pointee_wellformed, + lang_items.coerce_pointee_validated_trait(), + visit_implementation_of_coerce_pointee_validity, )?; Ok(()) } @@ -787,19 +787,21 @@ fn visit_implementation_of_pointer_like(checker: &Checker<'_>) -> Result<(), Err .emit()) } -fn visit_implementation_of_coerce_pointee_wellformed( +fn visit_implementation_of_coerce_pointee_validity( checker: &Checker<'_>, ) -> Result<(), ErrorGuaranteed> { let tcx = checker.tcx; let self_ty = tcx.impl_trait_ref(checker.impl_def_id).unwrap().instantiate_identity().self_ty(); + let span = tcx.def_span(checker.impl_def_id); + if !tcx.is_builtin_derived(checker.impl_def_id.into()) { + return Err(tcx.dcx().emit_err(errors::CoercePointeeNoUserValidityAssertion { span })); + } let ty::Adt(def, _args) = self_ty.kind() else { - return Err(tcx.dcx().emit_err(errors::CoercePointeeNotConcreteType { - span: tcx.def_span(checker.impl_def_id), - })); + return Err(tcx.dcx().emit_err(errors::CoercePointeeNotConcreteType { span })); }; let did = def.did(); - let span = - if let Some(local) = did.as_local() { tcx.source_span(local) } else { tcx.def_span(did) }; + // Now get a more precise span of the `struct`. + let span = tcx.def_span(did); if !def.is_struct() { return Err(tcx .dcx() diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index a921022a1124..c49e06d7448e 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -1195,6 +1195,13 @@ pub(crate) struct CoercePointeeNotConcreteType { pub span: Span, } +#[derive(Diagnostic)] +#[diag(hir_analysis_coerce_pointee_no_user_validity_assertion, code = E0802)] +pub(crate) struct CoercePointeeNoUserValidityAssertion { + #[primary_span] + pub span: Span, +} + #[derive(Diagnostic)] #[diag(hir_analysis_coerce_pointee_not_transparent, code = E0802)] pub(crate) struct CoercePointeeNotTransparent { diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 096a438906ce..160157766971 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -193,7 +193,7 @@ symbols! { Cleanup, Clone, CoercePointee, - CoercePointeeWellformed, + CoercePointeeValidated, CoerceUnsized, Command, ConstParamTy, @@ -620,7 +620,7 @@ symbols! { cmp_partialord_lt, cmpxchg16b_target_feature, cmse_nonsecure_entry, - coerce_pointee_wellformed, + coerce_pointee_validated, coerce_unsized, cold, cold_path, diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index 62f569d37df0..163c80ffe1d1 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -1284,14 +1284,23 @@ pub trait FnPtr: Copy + Clone { /// } /// ``` #[rustc_builtin_macro(CoercePointee, attributes(pointee))] -#[allow_internal_unstable(dispatch_from_dyn, coerce_unsized, unsize)] +#[allow_internal_unstable(dispatch_from_dyn, coerce_unsized, unsize, coerce_pointee_validated)] #[unstable(feature = "derive_coerce_pointee", issue = "123430")] pub macro CoercePointee($item:item) { /* compiler built-in */ } +/// A validation trait that is implemented on data with `derive(CoercePointee)` +/// so that the compiler can enforce a set of rules that the target data must +/// conform to in order for the derived behaviours are safe and useful for +/// the purpose of the said macro. +/// +/// This trait will not ever be exposed for use as public part of the library +/// and shall not ever be stabilised. #[cfg(not(bootstrap))] -#[lang = "coerce_pointee_wellformed"] -#[unstable(feature = "derive_coerce_pointee", issue = "123430")] +#[lang = "coerce_pointee_validated"] +#[unstable(feature = "coerce_pointee_validated", issue = "123430")] #[doc(hidden)] -pub trait CoercePointeeWellformed {} +pub trait CoercePointeeValidated { + /* compiler built-in */ +} diff --git a/tests/ui/deriving/built-in-proc-macro-scope.stdout b/tests/ui/deriving/built-in-proc-macro-scope.stdout index aa989ed23175..fa4e50968f4d 100644 --- a/tests/ui/deriving/built-in-proc-macro-scope.stdout +++ b/tests/ui/deriving/built-in-proc-macro-scope.stdout @@ -20,7 +20,7 @@ pub struct Ptr<'a, #[pointee] T: ?Sized> { data: &'a mut T, } #[automatically_derived] -impl<'a, T: ?Sized> ::core::marker::CoercePointeeWellformed for Ptr<'a, T> { } +impl<'a, T: ?Sized> ::core::marker::CoercePointeeValidated for Ptr<'a, T> { } #[automatically_derived] impl<'a, T: ?Sized + ::core::marker::Unsize<__S>, __S: ?Sized> ::core::ops::DispatchFromDyn> for Ptr<'a, T> { diff --git a/tests/ui/deriving/deriving-coerce-pointee-expanded.stdout b/tests/ui/deriving/deriving-coerce-pointee-expanded.stdout index ea5ee60a0bb4..a774efbbe354 100644 --- a/tests/ui/deriving/deriving-coerce-pointee-expanded.stdout +++ b/tests/ui/deriving/deriving-coerce-pointee-expanded.stdout @@ -16,7 +16,7 @@ struct MyPointer<'a, #[pointee] T: ?Sized> { ptr: &'a T, } #[automatically_derived] -impl<'a, T: ?Sized> ::core::marker::CoercePointeeWellformed for +impl<'a, T: ?Sized> ::core::marker::CoercePointeeValidated for MyPointer<'a, T> { } #[automatically_derived] @@ -36,7 +36,7 @@ pub struct MyPointer2<'a, Y, Z: MyTrait, #[pointee] T: ?Sized + MyTrait, } #[automatically_derived] impl<'a, Y, Z: MyTrait, T: ?Sized + MyTrait, X: MyTrait> - ::core::marker::CoercePointeeWellformed for MyPointer2<'a, Y, Z, T, X> + ::core::marker::CoercePointeeValidated for MyPointer2<'a, Y, Z, T, X> where Y: MyTrait { } #[automatically_derived] @@ -57,7 +57,7 @@ struct MyPointerWithoutPointee<'a, T: ?Sized> { ptr: &'a T, } #[automatically_derived] -impl<'a, T: ?Sized> ::core::marker::CoercePointeeWellformed for +impl<'a, T: ?Sized> ::core::marker::CoercePointeeValidated for MyPointerWithoutPointee<'a, T> { } #[automatically_derived] diff --git a/tests/ui/deriving/deriving-coerce-pointee-neg.stderr b/tests/ui/deriving/deriving-coerce-pointee-neg.stderr index 2400a48456f5..9e4d36572247 100644 --- a/tests/ui/deriving/deriving-coerce-pointee-neg.stderr +++ b/tests/ui/deriving/deriving-coerce-pointee-neg.stderr @@ -117,11 +117,8 @@ LL | struct NoFieldUnit<'a, #[pointee] T: ?Sized>(); error[E0802]: `derive(CoercePointee)` is only applicable to `struct` with `repr(transparent)` layout --> $DIR/deriving-coerce-pointee-neg.rs:140:1 | -LL | / struct TryToWipeRepr<'a, #[pointee] T: ?Sized> { -LL | | -LL | | ptr: &'a T, -LL | | } - | |_^ +LL | struct TryToWipeRepr<'a, #[pointee] T: ?Sized> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 17 previous errors From b9435056a7e152e1d455b404061240b964a39584 Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Wed, 29 Jan 2025 06:48:28 +0800 Subject: [PATCH 040/128] move repr(transparent) checks to coherence --- .../src/deriving/coerce_pointee.rs | 10 ---------- compiler/rustc_hir_analysis/messages.ftl | 2 ++ .../rustc_hir_analysis/src/coherence/builtin.rs | 3 +++ compiler/rustc_hir_analysis/src/errors.rs | 7 +++++++ tests/ui/deriving/deriving-coerce-pointee-neg.rs | 2 +- .../ui/deriving/deriving-coerce-pointee-neg.stderr | 14 ++++++-------- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs b/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs index e228095c97f7..5aed9f76f144 100644 --- a/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs +++ b/compiler/rustc_builtin_macros/src/deriving/coerce_pointee.rs @@ -6,7 +6,6 @@ use rustc_ast::{ self as ast, GenericArg, GenericBound, GenericParamKind, Generics, ItemKind, MetaItem, TraitBoundModifiers, VariantData, WherePredicate, }; -use rustc_attr_parsing as attr; use rustc_data_structures::flat_map_in_place::FlatMapInPlace; use rustc_errors::E0802; use rustc_expand::base::{Annotatable, ExtCtxt}; @@ -33,15 +32,6 @@ pub(crate) fn expand_deriving_coerce_pointee( let (name_ident, generics) = if let Annotatable::Item(aitem) = item && let ItemKind::Struct(struct_data, g) = &aitem.kind { - let is_transparent = aitem.attrs.iter().any(|attr| { - attr::find_repr_attrs(cx.sess, attr) - .into_iter() - .any(|r| matches!(r, attr::ReprTransparent)) - }); - if !is_transparent { - cx.dcx().emit_err(RequireTransparent { span }); - return; - } if !matches!( struct_data, VariantData::Struct { fields, recovered: _ } | VariantData::Tuple(fields, _) diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl index 9c38193c84e3..258267c5ca92 100644 --- a/compiler/rustc_hir_analysis/messages.ftl +++ b/compiler/rustc_hir_analysis/messages.ftl @@ -85,6 +85,8 @@ hir_analysis_cmse_output_stack_spill = .note1 = functions with the `"{$abi_name}"` ABI must pass their result via the available return registers .note2 = the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size +hir_analysis_coerce_pointee_no_field = `CoercePointee` can only be derived on `struct`s with at least one field + hir_analysis_coerce_pointee_no_user_validity_assertion = asserting applicability of `derive(CoercePointee)` on a target data is forbidden hir_analysis_coerce_pointee_not_concrete_ty = `derive(CoercePointee)` is only applicable to `struct` diff --git a/compiler/rustc_hir_analysis/src/coherence/builtin.rs b/compiler/rustc_hir_analysis/src/coherence/builtin.rs index c21576a5e7ca..c5aee60117b9 100644 --- a/compiler/rustc_hir_analysis/src/coherence/builtin.rs +++ b/compiler/rustc_hir_analysis/src/coherence/builtin.rs @@ -810,5 +810,8 @@ fn visit_implementation_of_coerce_pointee_validity( if !def.repr().transparent() { return Err(tcx.dcx().emit_err(errors::CoercePointeeNotTransparent { span })); } + if def.all_fields().next().is_none() { + return Err(tcx.dcx().emit_err(errors::CoercePointeeNoField { span })); + } Ok(()) } diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index c49e06d7448e..12750543f4bf 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -1209,6 +1209,13 @@ pub(crate) struct CoercePointeeNotTransparent { pub span: Span, } +#[derive(Diagnostic)] +#[diag(hir_analysis_coerce_pointee_no_field, code = E0802)] +pub(crate) struct CoercePointeeNoField { + #[primary_span] + pub span: Span, +} + #[derive(Diagnostic)] #[diag(hir_analysis_inherent_ty_outside_relevant, code = E0390)] #[help] diff --git a/tests/ui/deriving/deriving-coerce-pointee-neg.rs b/tests/ui/deriving/deriving-coerce-pointee-neg.rs index 0a23538cd4a6..6577500d8eb0 100644 --- a/tests/ui/deriving/deriving-coerce-pointee-neg.rs +++ b/tests/ui/deriving/deriving-coerce-pointee-neg.rs @@ -44,8 +44,8 @@ struct TooManyPointees<'a, #[pointee] A: ?Sized, #[pointee] B: ?Sized>((&'a A, & //~^ ERROR: only one type parameter can be marked as `#[pointee]` when deriving `CoercePointee` traits #[derive(CoercePointee)] -//~^ ERROR: `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]` struct NotTransparent<'a, #[pointee] T: ?Sized> { + //~^ ERROR: `derive(CoercePointee)` is only applicable to `struct` with `repr(transparent)` layout ptr: &'a T, } diff --git a/tests/ui/deriving/deriving-coerce-pointee-neg.stderr b/tests/ui/deriving/deriving-coerce-pointee-neg.stderr index 9e4d36572247..999214bfa9fe 100644 --- a/tests/ui/deriving/deriving-coerce-pointee-neg.stderr +++ b/tests/ui/deriving/deriving-coerce-pointee-neg.stderr @@ -44,14 +44,6 @@ error[E0802]: only one type parameter can be marked as `#[pointee]` when derivin LL | struct TooManyPointees<'a, #[pointee] A: ?Sized, #[pointee] B: ?Sized>((&'a A, &'a B)); | ^ - here another type parameter is marked as `#[pointee]` -error[E0802]: `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]` - --> $DIR/deriving-coerce-pointee-neg.rs:46:10 - | -LL | #[derive(CoercePointee)] - | ^^^^^^^^^^^^^ - | - = note: this error originates in the derive macro `CoercePointee` (in Nightly builds, run with -Z macro-backtrace for more info) - error[E0802]: `derive(CoercePointee)` requires `T` to be marked `?Sized` --> $DIR/deriving-coerce-pointee-neg.rs:54:36 | @@ -114,6 +106,12 @@ LL | struct NoFieldUnit<'a, #[pointee] T: ?Sized>(); | = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` +error[E0802]: `derive(CoercePointee)` is only applicable to `struct` with `repr(transparent)` layout + --> $DIR/deriving-coerce-pointee-neg.rs:47:1 + | +LL | struct NotTransparent<'a, #[pointee] T: ?Sized> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error[E0802]: `derive(CoercePointee)` is only applicable to `struct` with `repr(transparent)` layout --> $DIR/deriving-coerce-pointee-neg.rs:140:1 | From a6dcfe3af43dce6762d0569e0effe1a9d8719d07 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sun, 9 Feb 2025 18:57:22 +0000 Subject: [PATCH 041/128] Remove the deduplicate_blocks pass --- .../src/deduplicate_blocks.rs | 195 ------------------ compiler/rustc_mir_transform/src/lib.rs | 2 - ...mment_2.DeduplicateBlocks.panic-abort.diff | 100 --------- ...ment_2.DeduplicateBlocks.panic-unwind.diff | 100 --------- tests/mir-opt/deduplicate_blocks.rs | 17 -- 5 files changed, 414 deletions(-) delete mode 100644 compiler/rustc_mir_transform/src/deduplicate_blocks.rs delete mode 100644 tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff delete mode 100644 tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff delete mode 100644 tests/mir-opt/deduplicate_blocks.rs diff --git a/compiler/rustc_mir_transform/src/deduplicate_blocks.rs b/compiler/rustc_mir_transform/src/deduplicate_blocks.rs deleted file mode 100644 index 63257df66fb9..000000000000 --- a/compiler/rustc_mir_transform/src/deduplicate_blocks.rs +++ /dev/null @@ -1,195 +0,0 @@ -//! This pass finds basic blocks that are completely equal, -//! and replaces all uses with just one of them. - -use std::collections::hash_map::Entry; -use std::hash::{Hash, Hasher}; -use std::iter; - -use rustc_data_structures::fx::FxHashMap; -use rustc_middle::mir::visit::MutVisitor; -use rustc_middle::mir::*; -use rustc_middle::ty::TyCtxt; -use tracing::debug; - -use super::simplify::simplify_cfg; - -pub(super) struct DeduplicateBlocks; - -impl<'tcx> crate::MirPass<'tcx> for DeduplicateBlocks { - fn is_enabled(&self, sess: &rustc_session::Session) -> bool { - sess.mir_opt_level() >= 4 - } - - fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - debug!("Running DeduplicateBlocks on `{:?}`", body.source); - let duplicates = find_duplicates(body); - let has_opts_to_apply = !duplicates.is_empty(); - - if has_opts_to_apply { - let mut opt_applier = OptApplier { tcx, duplicates }; - opt_applier.visit_body(body); - simplify_cfg(body); - } - } - - fn is_required(&self) -> bool { - false - } -} - -struct OptApplier<'tcx> { - tcx: TyCtxt<'tcx>, - duplicates: FxHashMap, -} - -impl<'tcx> MutVisitor<'tcx> for OptApplier<'tcx> { - fn tcx(&self) -> TyCtxt<'tcx> { - self.tcx - } - - fn visit_terminator(&mut self, terminator: &mut Terminator<'tcx>, location: Location) { - for target in terminator.successors_mut() { - if let Some(replacement) = self.duplicates.get(target) { - debug!("SUCCESS: Replacing: `{:?}` with `{:?}`", target, replacement); - *target = *replacement; - } - } - - self.super_terminator(terminator, location); - } -} - -fn find_duplicates(body: &Body<'_>) -> FxHashMap { - let mut duplicates = FxHashMap::default(); - - let bbs_to_go_through = - body.basic_blocks.iter_enumerated().filter(|(_, bbd)| !bbd.is_cleanup).count(); - - let mut same_hashes = - FxHashMap::with_capacity_and_hasher(bbs_to_go_through, Default::default()); - - // Go through the basic blocks backwards. This means that in case of duplicates, - // we can use the basic block with the highest index as the replacement for all lower ones. - // For example, if bb1, bb2 and bb3 are duplicates, we will first insert bb3 in same_hashes. - // Then we will see that bb2 is a duplicate of bb3, - // and insert bb2 with the replacement bb3 in the duplicates list. - // When we see bb1, we see that it is a duplicate of bb3, and therefore insert it in the - // duplicates list with replacement bb3. - // When the duplicates are removed, we will end up with only bb3. - for (bb, bbd) in body.basic_blocks.iter_enumerated().rev().filter(|(_, bbd)| !bbd.is_cleanup) { - // Basic blocks can get really big, so to avoid checking for duplicates in basic blocks - // that are unlikely to have duplicates, we stop early. The early bail number has been - // found experimentally by eprintln while compiling the crates in the rustc-perf suite. - if bbd.statements.len() > 10 { - continue; - } - - let to_hash = BasicBlockHashable { basic_block_data: bbd }; - let entry = same_hashes.entry(to_hash); - match entry { - Entry::Occupied(occupied) => { - // The basic block was already in the hashmap, which means we have a duplicate - let value = *occupied.get(); - debug!("Inserting {:?} -> {:?}", bb, value); - duplicates.try_insert(bb, value).expect("key was already inserted"); - } - Entry::Vacant(vacant) => { - vacant.insert(bb); - } - } - } - - duplicates -} - -struct BasicBlockHashable<'a, 'tcx> { - basic_block_data: &'a BasicBlockData<'tcx>, -} - -impl Hash for BasicBlockHashable<'_, '_> { - fn hash(&self, state: &mut H) { - hash_statements(state, self.basic_block_data.statements.iter()); - // Note that since we only hash the kind, we lose span information if we deduplicate the - // blocks. - self.basic_block_data.terminator().kind.hash(state); - } -} - -impl Eq for BasicBlockHashable<'_, '_> {} - -impl PartialEq for BasicBlockHashable<'_, '_> { - fn eq(&self, other: &Self) -> bool { - self.basic_block_data.statements.len() == other.basic_block_data.statements.len() - && &self.basic_block_data.terminator().kind == &other.basic_block_data.terminator().kind - && iter::zip(&self.basic_block_data.statements, &other.basic_block_data.statements) - .all(|(x, y)| statement_eq(&x.kind, &y.kind)) - } -} - -fn hash_statements<'a, 'tcx, H: Hasher>( - hasher: &mut H, - iter: impl Iterator>, -) where - 'tcx: 'a, -{ - for stmt in iter { - statement_hash(hasher, &stmt.kind); - } -} - -fn statement_hash(hasher: &mut H, stmt: &StatementKind<'_>) { - match stmt { - StatementKind::Assign(box (place, rvalue)) => { - place.hash(hasher); - rvalue_hash(hasher, rvalue) - } - x => x.hash(hasher), - }; -} - -fn rvalue_hash(hasher: &mut H, rvalue: &Rvalue<'_>) { - match rvalue { - Rvalue::Use(op) => operand_hash(hasher, op), - x => x.hash(hasher), - }; -} - -fn operand_hash(hasher: &mut H, operand: &Operand<'_>) { - match operand { - Operand::Constant(box ConstOperand { user_ty: _, const_, span: _ }) => const_.hash(hasher), - x => x.hash(hasher), - }; -} - -fn statement_eq<'tcx>(lhs: &StatementKind<'tcx>, rhs: &StatementKind<'tcx>) -> bool { - let res = match (lhs, rhs) { - ( - StatementKind::Assign(box (place, rvalue)), - StatementKind::Assign(box (place2, rvalue2)), - ) => place == place2 && rvalue_eq(rvalue, rvalue2), - (x, y) => x == y, - }; - debug!("statement_eq lhs: `{:?}` rhs: `{:?}` result: {:?}", lhs, rhs, res); - res -} - -fn rvalue_eq<'tcx>(lhs: &Rvalue<'tcx>, rhs: &Rvalue<'tcx>) -> bool { - let res = match (lhs, rhs) { - (Rvalue::Use(op1), Rvalue::Use(op2)) => operand_eq(op1, op2), - (x, y) => x == y, - }; - debug!("rvalue_eq lhs: `{:?}` rhs: `{:?}` result: {:?}", lhs, rhs, res); - res -} - -fn operand_eq<'tcx>(lhs: &Operand<'tcx>, rhs: &Operand<'tcx>) -> bool { - let res = match (lhs, rhs) { - ( - Operand::Constant(box ConstOperand { user_ty: _, const_, span: _ }), - Operand::Constant(box ConstOperand { user_ty: _, const_: const2, span: _ }), - ) => const_ == const2, - (x, y) => x == y, - }; - debug!("operand_eq lhs: `{:?}` rhs: `{:?}` result: {:?}", lhs, rhs, res); - res -} diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index b572f6ca0b36..397d21a857f0 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -135,7 +135,6 @@ declare_passes! { Initial, Final }; - mod deduplicate_blocks : DeduplicateBlocks; mod deref_separator : Derefer; mod dest_prop : DestinationPropagation; pub mod dump_mir : Marker; @@ -700,7 +699,6 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { &nrvo::RenameReturnPlace, &simplify::SimplifyLocals::Final, &multiple_return_terminators::MultipleReturnTerminators, - &deduplicate_blocks::DeduplicateBlocks, &large_enums::EnumSizeOpt { discrepancy: 128 }, // Some cleanup necessary at least for LLVM and potentially other codegen backends. &add_call_guards::CriticalCallEdges, diff --git a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff deleted file mode 100644 index 60742ef0e9a9..000000000000 --- a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-abort.diff +++ /dev/null @@ -1,100 +0,0 @@ -- // MIR for `is_line_doc_comment_2` before DeduplicateBlocks -+ // MIR for `is_line_doc_comment_2` after DeduplicateBlocks - - fn is_line_doc_comment_2(_1: &str) -> bool { - debug s => _1; - let mut _0: bool; - let mut _2: &[u8]; - let mut _3: &str; - let mut _4: usize; - let mut _5: usize; - let mut _6: bool; - let mut _7: usize; - let mut _8: usize; - let mut _9: bool; - - bb0: { - StorageLive(_2); - StorageLive(_3); - _3 = &(*_1); - _2 = core::str::::as_bytes(move _3) -> [return: bb1, unwind unreachable]; - } - - bb1: { - StorageDead(_3); - _4 = Len((*_2)); - _5 = const 4_usize; - _6 = Ge(move _4, move _5); - switchInt(move _6) -> [0: bb2, otherwise: bb3]; - } - - bb2: { - _7 = Len((*_2)); - _8 = const 3_usize; - _9 = Ge(move _7, move _8); -- switchInt(move _9) -> [0: bb7, otherwise: bb8]; -+ switchInt(move _9) -> [0: bb11, otherwise: bb7]; - } - - bb3: { - switchInt(copy (*_2)[0 of 4]) -> [47: bb4, otherwise: bb2]; - } - - bb4: { - switchInt(copy (*_2)[1 of 4]) -> [47: bb5, otherwise: bb2]; - } - - bb5: { - switchInt(copy (*_2)[2 of 4]) -> [47: bb6, otherwise: bb2]; - } - - bb6: { -- switchInt(copy (*_2)[3 of 4]) -> [47: bb13, otherwise: bb2]; -+ switchInt(copy (*_2)[3 of 4]) -> [47: bb11, otherwise: bb2]; - } - - bb7: { -- _0 = const false; -- goto -> bb14; -+ switchInt(copy (*_2)[0 of 3]) -> [47: bb8, otherwise: bb11]; - } - - bb8: { -- switchInt(copy (*_2)[0 of 3]) -> [47: bb9, otherwise: bb7]; -+ switchInt(copy (*_2)[1 of 3]) -> [47: bb9, otherwise: bb11]; - } - - bb9: { -- switchInt(copy (*_2)[1 of 3]) -> [47: bb10, otherwise: bb7]; -+ switchInt(copy (*_2)[2 of 3]) -> [47: bb10, 33: bb10, otherwise: bb11]; - } - - bb10: { -- switchInt(copy (*_2)[2 of 3]) -> [47: bb12, 33: bb11, otherwise: bb7]; -- } -- -- bb11: { - _0 = const true; -- goto -> bb14; -+ goto -> bb12; - } - -- bb12: { -- _0 = const true; -- goto -> bb14; -- } -- -- bb13: { -+ bb11: { - _0 = const false; -- goto -> bb14; -+ goto -> bb12; - } - -- bb14: { -+ bb12: { - StorageDead(_2); - return; - } - } - diff --git a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff b/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff deleted file mode 100644 index 7337a32f525f..000000000000 --- a/tests/mir-opt/deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.panic-unwind.diff +++ /dev/null @@ -1,100 +0,0 @@ -- // MIR for `is_line_doc_comment_2` before DeduplicateBlocks -+ // MIR for `is_line_doc_comment_2` after DeduplicateBlocks - - fn is_line_doc_comment_2(_1: &str) -> bool { - debug s => _1; - let mut _0: bool; - let mut _2: &[u8]; - let mut _3: &str; - let mut _4: usize; - let mut _5: usize; - let mut _6: bool; - let mut _7: usize; - let mut _8: usize; - let mut _9: bool; - - bb0: { - StorageLive(_2); - StorageLive(_3); - _3 = &(*_1); - _2 = core::str::::as_bytes(move _3) -> [return: bb1, unwind continue]; - } - - bb1: { - StorageDead(_3); - _4 = Len((*_2)); - _5 = const 4_usize; - _6 = Ge(move _4, move _5); - switchInt(move _6) -> [0: bb2, otherwise: bb3]; - } - - bb2: { - _7 = Len((*_2)); - _8 = const 3_usize; - _9 = Ge(move _7, move _8); -- switchInt(move _9) -> [0: bb7, otherwise: bb8]; -+ switchInt(move _9) -> [0: bb11, otherwise: bb7]; - } - - bb3: { - switchInt(copy (*_2)[0 of 4]) -> [47: bb4, otherwise: bb2]; - } - - bb4: { - switchInt(copy (*_2)[1 of 4]) -> [47: bb5, otherwise: bb2]; - } - - bb5: { - switchInt(copy (*_2)[2 of 4]) -> [47: bb6, otherwise: bb2]; - } - - bb6: { -- switchInt(copy (*_2)[3 of 4]) -> [47: bb13, otherwise: bb2]; -+ switchInt(copy (*_2)[3 of 4]) -> [47: bb11, otherwise: bb2]; - } - - bb7: { -- _0 = const false; -- goto -> bb14; -+ switchInt(copy (*_2)[0 of 3]) -> [47: bb8, otherwise: bb11]; - } - - bb8: { -- switchInt(copy (*_2)[0 of 3]) -> [47: bb9, otherwise: bb7]; -+ switchInt(copy (*_2)[1 of 3]) -> [47: bb9, otherwise: bb11]; - } - - bb9: { -- switchInt(copy (*_2)[1 of 3]) -> [47: bb10, otherwise: bb7]; -+ switchInt(copy (*_2)[2 of 3]) -> [47: bb10, 33: bb10, otherwise: bb11]; - } - - bb10: { -- switchInt(copy (*_2)[2 of 3]) -> [47: bb12, 33: bb11, otherwise: bb7]; -- } -- -- bb11: { - _0 = const true; -- goto -> bb14; -+ goto -> bb12; - } - -- bb12: { -- _0 = const true; -- goto -> bb14; -- } -- -- bb13: { -+ bb11: { - _0 = const false; -- goto -> bb14; -+ goto -> bb12; - } - -- bb14: { -+ bb12: { - StorageDead(_2); - return; - } - } - diff --git a/tests/mir-opt/deduplicate_blocks.rs b/tests/mir-opt/deduplicate_blocks.rs deleted file mode 100644 index 3a164cb09a09..000000000000 --- a/tests/mir-opt/deduplicate_blocks.rs +++ /dev/null @@ -1,17 +0,0 @@ -// skip-filecheck -// EMIT_MIR_FOR_EACH_PANIC_STRATEGY -//@ test-mir-pass: DeduplicateBlocks - -// EMIT_MIR deduplicate_blocks.is_line_doc_comment_2.DeduplicateBlocks.diff -pub const fn is_line_doc_comment_2(s: &str) -> bool { - match s.as_bytes() { - [b'/', b'/', b'/', b'/', ..] => false, - [b'/', b'/', b'/', ..] => true, - [b'/', b'/', b'!', ..] => true, - _ => false, - } -} - -fn main() { - is_line_doc_comment_2("asd"); -} From 18483434ae377d215fa87c890cbf26884f3fae5c Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Mon, 10 Feb 2025 04:36:43 +0800 Subject: [PATCH 042/128] block coerce_pointee_validated for stabilization --- library/core/src/marker.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index 163c80ffe1d1..3dbedac166be 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -1299,7 +1299,7 @@ pub macro CoercePointee($item:item) { /// and shall not ever be stabilised. #[cfg(not(bootstrap))] #[lang = "coerce_pointee_validated"] -#[unstable(feature = "coerce_pointee_validated", issue = "123430")] +#[unstable(feature = "coerce_pointee_validated", issue = "none")] #[doc(hidden)] pub trait CoercePointeeValidated { /* compiler built-in */ From aea5595c8613425c74791586b4c7fcff017fc14e Mon Sep 17 00:00:00 2001 From: Ding Xiang Fei Date: Mon, 10 Feb 2025 03:02:13 +0800 Subject: [PATCH 043/128] fix the error code document --- .../rustc_error_codes/src/error_codes/E0802.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/compiler/rustc_error_codes/src/error_codes/E0802.md b/compiler/rustc_error_codes/src/error_codes/E0802.md index 9088b100886d..59061ff04359 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0802.md +++ b/compiler/rustc_error_codes/src/error_codes/E0802.md @@ -6,6 +6,8 @@ Erroneous code examples: The target data is not a `struct`. ```compile_fail,E0802 +#![feature(coerce_pointee)] +use std::marker::CoercePointee; #[derive(CoercePointee)] enum NotStruct<'a, T: ?Sized> { Variant(&'a T), @@ -16,6 +18,8 @@ The target data has a layout that is not transparent, or `repr(transparent)` in other words. ```compile_fail,E0802 +#![feature(coerce_pointee)] +use std::marker::CoercePointee; #[derive(CoercePointee)] struct NotTransparent<'a, #[pointee] T: ?Sized> { ptr: &'a T, @@ -25,6 +29,8 @@ struct NotTransparent<'a, #[pointee] T: ?Sized> { The target data has no data field. ```compile_fail,E0802 +#![feature(coerce_pointee)] +use std::marker::CoercePointee; #[derive(CoercePointee)] #[repr(transparent)] struct NoField<'a, #[pointee] T: ?Sized> {} @@ -33,6 +39,8 @@ struct NoField<'a, #[pointee] T: ?Sized> {} The target data is not generic over any data, or has no generic type parameter. ```compile_fail,E0802 +#![feature(coerce_pointee)] +use std::marker::CoercePointee; #[derive(CoercePointee)] #[repr(transparent)] struct NoGeneric<'a>(&'a u8); @@ -42,6 +50,8 @@ The target data has multiple generic type parameters, but none is designated as a pointee for coercion. ```compile_fail,E0802 +#![feature(coerce_pointee)] +use std::marker::CoercePointee; #[derive(CoercePointee)] #[repr(transparent)] struct AmbiguousPointee<'a, T1: ?Sized, T2: ?Sized> { @@ -53,6 +63,8 @@ The target data has multiple generic type parameters that are designated as pointees for coercion. ```compile_fail,E0802 +#![feature(coerce_pointee)] +use std::marker::CoercePointee; #[derive(CoercePointee)] #[repr(transparent)] struct TooManyPointees< @@ -65,6 +77,8 @@ struct TooManyPointees< The type parameter that is designated as a pointee is not marked `?Sized`. ```compile_fail,E0802 +#![feature(coerce_pointee)] +use std::marker::CoercePointee; #[derive(CoercePointee)] #[repr(transparent)] struct NoMaybeSized<'a, #[pointee] T> { From 833f07021465b7d34b13fd7d6e5aadf2c35b61a0 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sat, 8 Feb 2025 21:16:31 -0800 Subject: [PATCH 044/128] tests/assembly: cross-compile x86-return-float We choose to test for Linux and Windows instead of random other targets. --- tests/assembly/x86-return-float.rs | 43 ++++++++++++++++++------------ 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/tests/assembly/x86-return-float.rs b/tests/assembly/x86-return-float.rs index 423263c96732..ad760627b3a3 100644 --- a/tests/assembly/x86-return-float.rs +++ b/tests/assembly/x86-return-float.rs @@ -1,19 +1,28 @@ //@ assembly-output: emit-asm -//@ only-x86 // FIXME(#114479): LLVM miscompiles loading and storing `f32` and `f64` when SSE is disabled. // There's no compiletest directive to ignore a test on i586 only, so just always explicitly enable // SSE2. // Use the same target CPU as `i686` so that LLVM orders the instructions in the same order. //@ compile-flags: -Ctarget-feature=+sse2 -Ctarget-cpu=pentium4 // Force frame pointers to make ASM more consistent between targets -//@ compile-flags: -Copt-level=3 -C force-frame-pointers +//@ compile-flags: -C force-frame-pointers +// At opt-level=3, LLVM can merge two movss into one movsd, and we aren't testing for that. +//@ compile-flags: -Copt-level=2 //@ filecheck-flags: --implicit-check-not fld --implicit-check-not fst -//@ revisions: normal win -//@[normal] ignore-windows -//@[win] only-windows +//@ revisions: linux win +//@ add-core-stubs +//@[linux] needs-llvm-components: x86 +//@[win] needs-llvm-components: x86 +//@[linux] compile-flags: --target i686-unknown-linux-gnu +//@[win] compile-flags: --target i686-pc-windows-msvc #![crate_type = "lib"] #![feature(f16, f128)] +#![feature(no_core)] +#![no_core] + +extern crate minicore; +use minicore::*; // Tests that returning `f32` and `f64` with the "Rust" ABI on 32-bit x86 doesn't use the x87 // floating point stack, as loading and storing `f32`s and `f64`s to and from the x87 stack quietens @@ -190,8 +199,8 @@ pub unsafe fn call_f64_f64(x: &mut (f64, f64)) { } // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]] // CHECK: calll {{()|_}}get_f64_f64 - // normal: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] - // normal-NEXT: movsd [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] + // linux: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] + // linux-NEXT: movsd [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] // win: movsd (%esp), %[[VAL1:.*]] // win-NEXT: movsd 8(%esp), %[[VAL2:.*]] // CHECK-NEXT: movsd %[[VAL1]], (%[[PTR]]) @@ -207,12 +216,12 @@ pub unsafe fn call_f32_f64(x: &mut (f32, f64)) { } // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]] // CHECK: calll {{()|_}}get_f32_f64 - // normal: movss [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] - // normal-NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]] + // linux: movss [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] + // linux-NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]] // win: movss (%esp), %[[VAL1:.*]] // win-NEXT: movsd 8(%esp), %[[VAL2:.*]] // CHECK-NEXT: movss %[[VAL1]], (%[[PTR]]) - // normal-NEXT: movsd %[[VAL2]], 4(%[[PTR]]) + // linux-NEXT: movsd %[[VAL2]], 4(%[[PTR]]) // win-NEXT: movsd %[[VAL2]], 8(%[[PTR]]) *x = get_f32_f64(); } @@ -225,8 +234,8 @@ pub unsafe fn call_f64_f32(x: &mut (f64, f32)) { } // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]] // CHECK: calll {{()|_}}get_f64_f32 - // normal: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] - // normal-NEXT: movss [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] + // linux: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] + // linux-NEXT: movss [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] // win: movsd (%esp), %[[VAL1:.*]] // win-NEXT: movss 8(%esp), %[[VAL2:.*]] // CHECK-NEXT: movsd %[[VAL1]], (%[[PTR]]) @@ -257,8 +266,8 @@ pub unsafe fn call_f64_other(x: &mut (f64, usize)) { } // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]] // CHECK: calll {{()|_}}get_f64_other - // normal: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] - // normal-NEXT: movl [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] + // linux: movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] + // linux-NEXT: movl [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]] // win: movsd (%esp), %[[VAL1:.*]] // win-NEXT: movl 8(%esp), %[[VAL2:.*]] // CHECK-NEXT: movsd %[[VAL1]], (%[[PTR]]) @@ -289,12 +298,12 @@ pub unsafe fn call_other_f64(x: &mut (usize, f64)) { } // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]] // CHECK: calll {{()|_}}get_other_f64 - // normal: movl [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] - // normal-NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]] + // linux: movl [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]] + // linux-NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]] // win: movl (%esp), %[[VAL1:.*]] // win-NEXT: movsd 8(%esp), %[[VAL2:.*]] // CHECK-NEXT: movl %[[VAL1]], (%[[PTR]]) - // normal-NEXT: movsd %[[VAL2]], 4(%[[PTR]]) + // linux-NEXT: movsd %[[VAL2]], 4(%[[PTR]]) // win-NEXT: movsd %[[VAL2]], 8(%[[PTR]]) *x = get_other_f64(); } From 3580698996f6da6f006477809d7959bffcfd3bf0 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sun, 9 Feb 2025 16:54:02 -0800 Subject: [PATCH 045/128] tests: issue-122805 -> dont-shuffle-bswaps --- tests/codegen/{issues/issue-122805.rs => dont-shuffle-bswaps.rs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/codegen/{issues/issue-122805.rs => dont-shuffle-bswaps.rs} (100%) diff --git a/tests/codegen/issues/issue-122805.rs b/tests/codegen/dont-shuffle-bswaps.rs similarity index 100% rename from tests/codegen/issues/issue-122805.rs rename to tests/codegen/dont-shuffle-bswaps.rs From c2ff52afbd2bbc53e5f83fbce034c805c2c1b3f6 Mon Sep 17 00:00:00 2001 From: The rustc-dev-guide Cronjob Bot Date: Mon, 10 Feb 2025 04:02:33 +0000 Subject: [PATCH 046/128] Preparing for merge from rustc --- src/doc/rustc-dev-guide/rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/rustc-dev-guide/rust-version b/src/doc/rustc-dev-guide/rust-version index b62959720764..78e9ecdf174b 100644 --- a/src/doc/rustc-dev-guide/rust-version +++ b/src/doc/rustc-dev-guide/rust-version @@ -1 +1 @@ -613bdd49978298648ed05ace086bd1ecad54b44a +124cc92199ffa924f6b4c7cc819a85b65e0c3984 From 3f50076fb3166b3f71b4a52e8ebc4cd59572ac74 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Mon, 4 Nov 2024 12:53:02 -0800 Subject: [PATCH 047/128] compiler: gate `extern "{abi}"` in ast_lowering By moving this stability check into AST lowering, we effectively make it impossible to accidentally miss, as it must happen to generate HIR. Also, we put the ABI-stability code next to code that actually uses it! This allows code that wants to reason about backend ABI implementations to stop worrying about high-level concerns like syntax stability, while still leaving it as the authority on what ABIs actually exist. It also makes it easy to refactor things to have more consistent errors. For now, we only apply this to generalize the existing messages a bit. --- Cargo.lock | 2 +- compiler/rustc_abi/Cargo.toml | 2 - compiler/rustc_abi/src/callconv.rs | 3 +- compiler/rustc_abi/src/extern_abi.rs | 105 +------------ compiler/rustc_abi/src/lib.rs | 4 +- compiler/rustc_ast_lowering/Cargo.toml | 1 + compiler/rustc_ast_lowering/src/item.rs | 16 +- compiler/rustc_ast_lowering/src/lib.rs | 1 + compiler/rustc_ast_lowering/src/stability.rs | 147 ++++++++++++++++++ compiler/rustc_ast_passes/src/feature_gate.rs | 44 +----- compiler/rustc_target/src/spec/mod.rs | 5 +- tests/ui/extern/fictional-abi.rs | 3 + tests/ui/extern/fictional-abi.stderr | 11 ++ 13 files changed, 186 insertions(+), 158 deletions(-) create mode 100644 compiler/rustc_ast_lowering/src/stability.rs create mode 100644 tests/ui/extern/fictional-abi.rs create mode 100644 tests/ui/extern/fictional-abi.stderr diff --git a/Cargo.lock b/Cargo.lock index dce991816658..14634fe3b463 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3336,7 +3336,6 @@ dependencies = [ "rand 0.8.5", "rand_xoshiro", "rustc_data_structures", - "rustc_feature", "rustc_index", "rustc_macros", "rustc_serialize", @@ -3398,6 +3397,7 @@ dependencies = [ "rustc_ast_pretty", "rustc_data_structures", "rustc_errors", + "rustc_feature", "rustc_fluent_macro", "rustc_hir", "rustc_index", diff --git a/compiler/rustc_abi/Cargo.toml b/compiler/rustc_abi/Cargo.toml index 3acd25e54611..1013f1d3958d 100644 --- a/compiler/rustc_abi/Cargo.toml +++ b/compiler/rustc_abi/Cargo.toml @@ -9,7 +9,6 @@ bitflags = "2.4.1" rand = { version = "0.8.4", default-features = false, optional = true } rand_xoshiro = { version = "0.6.0", optional = true } rustc_data_structures = { path = "../rustc_data_structures", optional = true } -rustc_feature = { path = "../rustc_feature", optional = true } rustc_index = { path = "../rustc_index", default-features = false } rustc_macros = { path = "../rustc_macros", optional = true } rustc_serialize = { path = "../rustc_serialize", optional = true } @@ -24,7 +23,6 @@ default = ["nightly", "randomize"] # without depending on rustc_data_structures, rustc_macros and rustc_serialize nightly = [ "dep:rustc_data_structures", - "dep:rustc_feature", "dep:rustc_macros", "dep:rustc_serialize", "dep:rustc_span", diff --git a/compiler/rustc_abi/src/callconv.rs b/compiler/rustc_abi/src/callconv.rs index daa365bf6e1d..9fb70b80c9ef 100644 --- a/compiler/rustc_abi/src/callconv.rs +++ b/compiler/rustc_abi/src/callconv.rs @@ -1,6 +1,5 @@ #[cfg(feature = "nightly")] -use crate::{BackendRepr, FieldsShape, TyAbiInterface, TyAndLayout}; -use crate::{Primitive, Size, Variants}; +use crate::{BackendRepr, FieldsShape, Primitive, Size, TyAbiInterface, TyAndLayout, Variants}; mod reg; diff --git a/compiler/rustc_abi/src/extern_abi.rs b/compiler/rustc_abi/src/extern_abi.rs index 130834d560f7..faa952b6e2cf 100644 --- a/compiler/rustc_abi/src/extern_abi.rs +++ b/compiler/rustc_abi/src/extern_abi.rs @@ -1,7 +1,6 @@ use std::fmt; use rustc_macros::{Decodable, Encodable, HashStable_Generic}; -use rustc_span::{Span, Symbol, sym}; #[cfg(test)] mod tests; @@ -95,14 +94,14 @@ impl Abi { #[derive(Copy, Clone)] pub struct AbiData { - abi: Abi, + pub abi: Abi, /// Name of this ABI as we like it called. - name: &'static str, + pub name: &'static str, } #[allow(non_upper_case_globals)] -const AbiDatas: &[AbiData] = &[ +pub const AbiDatas: &[AbiData] = &[ AbiData { abi: Abi::Rust, name: "Rust" }, AbiData { abi: Abi::C { unwind: false }, name: "C" }, AbiData { abi: Abi::C { unwind: true }, name: "C-unwind" }, @@ -169,104 +168,6 @@ pub fn all_names() -> Vec<&'static str> { AbiDatas.iter().map(|d| d.name).collect() } -pub fn enabled_names(features: &rustc_feature::Features, span: Span) -> Vec<&'static str> { - AbiDatas - .iter() - .map(|d| d.name) - .filter(|name| is_enabled(features, span, name).is_ok()) - .collect() -} - -pub enum AbiDisabled { - Unstable { feature: Symbol, explain: &'static str }, - Unrecognized, -} - -pub fn is_enabled( - features: &rustc_feature::Features, - span: Span, - name: &str, -) -> Result<(), AbiDisabled> { - let s = is_stable(name); - if let Err(AbiDisabled::Unstable { feature, .. }) = s { - if features.enabled(feature) || span.allows_unstable(feature) { - return Ok(()); - } - } - s -} - -/// Returns whether the ABI is stable to use. -/// -/// Note that there is a separate check determining whether the ABI is even supported -/// on the current target; see `fn is_abi_supported` in `rustc_target::spec`. -pub fn is_stable(name: &str) -> Result<(), AbiDisabled> { - match name { - // Stable - "Rust" | "C" | "C-unwind" | "cdecl" | "cdecl-unwind" | "stdcall" | "stdcall-unwind" - | "fastcall" | "fastcall-unwind" | "aapcs" | "aapcs-unwind" | "win64" | "win64-unwind" - | "sysv64" | "sysv64-unwind" | "system" | "system-unwind" | "efiapi" | "thiscall" - | "thiscall-unwind" => Ok(()), - "rust-intrinsic" => Err(AbiDisabled::Unstable { - feature: sym::intrinsics, - explain: "intrinsics are subject to change", - }), - "vectorcall" => Err(AbiDisabled::Unstable { - feature: sym::abi_vectorcall, - explain: "vectorcall is experimental and subject to change", - }), - "vectorcall-unwind" => Err(AbiDisabled::Unstable { - feature: sym::abi_vectorcall, - explain: "vectorcall-unwind ABI is experimental and subject to change", - }), - "rust-call" => Err(AbiDisabled::Unstable { - feature: sym::unboxed_closures, - explain: "rust-call ABI is subject to change", - }), - "rust-cold" => Err(AbiDisabled::Unstable { - feature: sym::rust_cold_cc, - explain: "rust-cold is experimental and subject to change", - }), - "ptx-kernel" => Err(AbiDisabled::Unstable { - feature: sym::abi_ptx, - explain: "PTX ABIs are experimental and subject to change", - }), - "unadjusted" => Err(AbiDisabled::Unstable { - feature: sym::abi_unadjusted, - explain: "unadjusted ABI is an implementation detail and perma-unstable", - }), - "msp430-interrupt" => Err(AbiDisabled::Unstable { - feature: sym::abi_msp430_interrupt, - explain: "msp430-interrupt ABI is experimental and subject to change", - }), - "x86-interrupt" => Err(AbiDisabled::Unstable { - feature: sym::abi_x86_interrupt, - explain: "x86-interrupt ABI is experimental and subject to change", - }), - "gpu-kernel" => Err(AbiDisabled::Unstable { - feature: sym::abi_gpu_kernel, - explain: "gpu-kernel ABI is experimental and subject to change", - }), - "avr-interrupt" | "avr-non-blocking-interrupt" => Err(AbiDisabled::Unstable { - feature: sym::abi_avr_interrupt, - explain: "avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change", - }), - "riscv-interrupt-m" | "riscv-interrupt-s" => Err(AbiDisabled::Unstable { - feature: sym::abi_riscv_interrupt, - explain: "riscv-interrupt ABIs are experimental and subject to change", - }), - "C-cmse-nonsecure-call" => Err(AbiDisabled::Unstable { - feature: sym::abi_c_cmse_nonsecure_call, - explain: "C-cmse-nonsecure-call ABI is experimental and subject to change", - }), - "C-cmse-nonsecure-entry" => Err(AbiDisabled::Unstable { - feature: sym::cmse_nonsecure_entry, - explain: "C-cmse-nonsecure-entry ABI is experimental and subject to change", - }), - _ => Err(AbiDisabled::Unrecognized), - } -} - impl Abi { /// Default ABI chosen for `extern fn` declarations without an explicit ABI. pub const FALLBACK: Abi = Abi::C { unwind: false }; diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index fc34b2889330..259f1c18ea8e 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -66,9 +66,7 @@ mod extern_abi; pub use callconv::{Heterogeneous, HomogeneousAggregate, Reg, RegKind}; #[cfg(feature = "nightly")] -pub use extern_abi::{ - AbiDisabled, AbiUnsupported, ExternAbi, all_names, enabled_names, is_enabled, is_stable, lookup, -}; +pub use extern_abi::{AbiDatas, AbiUnsupported, ExternAbi, all_names, lookup}; #[cfg(feature = "nightly")] pub use layout::{FIRST_VARIANT, FieldIdx, Layout, TyAbiInterface, TyAndLayout, VariantIdx}; pub use layout::{LayoutCalculator, LayoutCalculatorError}; diff --git a/compiler/rustc_ast_lowering/Cargo.toml b/compiler/rustc_ast_lowering/Cargo.toml index 754f3c1a6e9a..ce95f4dfa1b8 100644 --- a/compiler/rustc_ast_lowering/Cargo.toml +++ b/compiler/rustc_ast_lowering/Cargo.toml @@ -13,6 +13,7 @@ rustc_ast = { path = "../rustc_ast" } rustc_ast_pretty = { path = "../rustc_ast_pretty" } rustc_data_structures = { path = "../rustc_data_structures" } rustc_errors = { path = "../rustc_errors" } +rustc_feature = { path = "../rustc_feature" } rustc_fluent_macro = { path = "../rustc_fluent_macro" } rustc_hir = { path = "../rustc_hir" } rustc_index = { path = "../rustc_index" } diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 7379a3d2cde6..a77ebb7e9906 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -20,6 +20,7 @@ use super::errors::{ InvalidAbi, InvalidAbiReason, InvalidAbiSuggestion, MisplacedRelaxTraitBound, TupleStructWithDefault, }; +use super::stability::{enabled_names, gate_unstable_abi}; use super::{ AstOwner, FnDeclKind, ImplTraitContext, ImplTraitPosition, LoweringContext, ParamMode, ResolverAstLoweringExt, @@ -1479,11 +1480,16 @@ impl<'hir> LoweringContext<'_, 'hir> { } } - pub(super) fn lower_abi(&mut self, abi: StrLit) -> ExternAbi { - rustc_abi::lookup(abi.symbol_unescaped.as_str()).unwrap_or_else(|err| { - self.error_on_invalid_abi(abi, err); + pub(super) fn lower_abi(&mut self, abi_str: StrLit) -> ExternAbi { + let ast::StrLit { symbol_unescaped, span, .. } = abi_str; + let extern_abi = rustc_abi::lookup(symbol_unescaped.as_str()).unwrap_or_else(|err| { + self.error_on_invalid_abi(abi_str, err); ExternAbi::Rust - }) + }); + let sess = self.tcx.sess; + let features = self.tcx.features(); + gate_unstable_abi(sess, features, span, extern_abi); + extern_abi } pub(super) fn lower_extern(&mut self, ext: Extern) -> ExternAbi { @@ -1495,7 +1501,7 @@ impl<'hir> LoweringContext<'_, 'hir> { } fn error_on_invalid_abi(&self, abi: StrLit, err: rustc_abi::AbiUnsupported) { - let abi_names = rustc_abi::enabled_names(self.tcx.features(), abi.span) + let abi_names = enabled_names(self.tcx.features(), abi.span) .iter() .map(|s| Symbol::intern(s)) .collect::>(); diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 127b7e3684e9..8997fe24c1fa 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -84,6 +84,7 @@ mod index; mod item; mod pat; mod path; +mod stability; rustc_fluent_macro::fluent_messages! { "../messages.ftl" } diff --git a/compiler/rustc_ast_lowering/src/stability.rs b/compiler/rustc_ast_lowering/src/stability.rs new file mode 100644 index 000000000000..5fd26a29abac --- /dev/null +++ b/compiler/rustc_ast_lowering/src/stability.rs @@ -0,0 +1,147 @@ +use std::fmt; + +use rustc_abi::ExternAbi; +use rustc_feature::Features; +use rustc_session::Session; +use rustc_session::parse::feature_err; +use rustc_span::symbol::sym; +use rustc_span::{Span, Symbol}; + +pub(crate) fn enabled_names(features: &rustc_feature::Features, span: Span) -> Vec<&'static str> { + rustc_abi::AbiDatas + .iter() + .filter(|data| extern_abi_enabled(features, span, data.abi).is_ok()) + .map(|d| d.name) + .collect() +} + +pub(crate) fn extern_abi_enabled( + features: &rustc_feature::Features, + span: Span, + abi: ExternAbi, +) -> Result<(), UnstableAbi> { + extern_abi_stability(abi).or_else(|unstable @ UnstableAbi { feature, .. }| { + if features.enabled(feature) || span.allows_unstable(feature) { + Ok(()) + } else { + Err(unstable) + } + }) +} + +#[allow(rustc::untranslatable_diagnostic)] +pub(crate) fn gate_unstable_abi(sess: &Session, features: &Features, span: Span, abi: ExternAbi) { + match extern_abi_enabled(features, span, abi) { + Ok(_) => (), + Err(unstable_abi) => { + let explain = unstable_abi.to_string(); + feature_err(sess, unstable_abi.feature, span, explain).emit(); + } + } +} + +pub(crate) struct UnstableAbi { + abi: ExternAbi, + feature: Symbol, + explain: GateReason, +} + +enum GateReason { + Experimental, + ImplDetail, +} + +impl fmt::Display for UnstableAbi { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let Self { abi, .. } = self; + let name = abi.to_string(); + let name = name.trim_matches('"'); + match self.explain { + GateReason::Experimental => { + write!(f, r#"the extern "{name}" ABI is experimental and subject to change"#) + } + GateReason::ImplDetail => { + write!( + f, + r#"the extern "{name}" ABI is an implementation detail and perma-unstable"# + ) + } + } + } +} + +pub(crate) fn extern_abi_stability(abi: ExternAbi) -> Result<(), UnstableAbi> { + match abi { + // stable ABIs + ExternAbi::Rust + | ExternAbi::C { .. } + | ExternAbi::Cdecl { .. } + | ExternAbi::Stdcall { .. } + | ExternAbi::Fastcall { .. } + | ExternAbi::Thiscall { .. } + | ExternAbi::Aapcs { .. } + | ExternAbi::Win64 { .. } + | ExternAbi::SysV64 { .. } + | ExternAbi::System { .. } + | ExternAbi::EfiApi => Ok(()), + // implementation details + ExternAbi::RustIntrinsic => { + Err(UnstableAbi { abi, feature: sym::intrinsics, explain: GateReason::ImplDetail }) + } + ExternAbi::Unadjusted => { + Err(UnstableAbi { abi, feature: sym::abi_unadjusted, explain: GateReason::ImplDetail }) + } + // experimental + ExternAbi::Vectorcall { .. } => Err(UnstableAbi { + abi, + feature: sym::abi_vectorcall, + explain: GateReason::Experimental, + }), + ExternAbi::RustCall => Err(UnstableAbi { + abi, + feature: sym::unboxed_closures, + explain: GateReason::Experimental, + }), + ExternAbi::RustCold => { + Err(UnstableAbi { abi, feature: sym::rust_cold_cc, explain: GateReason::Experimental }) + } + ExternAbi::GpuKernel => Err(UnstableAbi { + abi, + feature: sym::abi_gpu_kernel, + explain: GateReason::Experimental, + }), + ExternAbi::PtxKernel => { + Err(UnstableAbi { abi, feature: sym::abi_ptx, explain: GateReason::Experimental }) + } + ExternAbi::Msp430Interrupt => Err(UnstableAbi { + abi, + feature: sym::abi_msp430_interrupt, + explain: GateReason::Experimental, + }), + ExternAbi::X86Interrupt => Err(UnstableAbi { + abi, + feature: sym::abi_x86_interrupt, + explain: GateReason::Experimental, + }), + ExternAbi::AvrInterrupt | ExternAbi::AvrNonBlockingInterrupt => Err(UnstableAbi { + abi, + feature: sym::abi_avr_interrupt, + explain: GateReason::Experimental, + }), + ExternAbi::RiscvInterruptM | ExternAbi::RiscvInterruptS => Err(UnstableAbi { + abi, + feature: sym::abi_riscv_interrupt, + explain: GateReason::Experimental, + }), + ExternAbi::CCmseNonSecureCall => Err(UnstableAbi { + abi, + feature: sym::abi_c_cmse_nonsecure_call, + explain: GateReason::Experimental, + }), + ExternAbi::CCmseNonSecureEntry => Err(UnstableAbi { + abi, + feature: sym::cmse_nonsecure_entry, + explain: GateReason::Experimental, + }), + } +} diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 13294efdaf6f..e5d8013058f6 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -1,9 +1,9 @@ use rustc_ast as ast; use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor}; use rustc_ast::{NodeId, PatKind, attr, token}; -use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP, BuiltinAttribute, Features, GateIssue}; +use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP, BuiltinAttribute, Features}; use rustc_session::Session; -use rustc_session::parse::{feature_err, feature_err_issue, feature_warn}; +use rustc_session::parse::{feature_err, feature_warn}; use rustc_span::source_map::Spanned; use rustc_span::{Span, Symbol, sym}; use thin_vec::ThinVec; @@ -72,35 +72,6 @@ struct PostExpansionVisitor<'a> { } impl<'a> PostExpansionVisitor<'a> { - #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable - fn check_abi(&self, abi: ast::StrLit) { - let ast::StrLit { symbol_unescaped, span, .. } = abi; - - match rustc_abi::is_enabled(self.features, span, symbol_unescaped.as_str()) { - Ok(()) => (), - Err(rustc_abi::AbiDisabled::Unstable { feature, explain }) => { - feature_err_issue(&self.sess, feature, span, GateIssue::Language, explain).emit(); - } - Err(rustc_abi::AbiDisabled::Unrecognized) => { - if self.sess.opts.pretty.is_none_or(|ppm| ppm.needs_hir()) { - self.sess.dcx().span_delayed_bug( - span, - format!( - "unrecognized ABI not caught in lowering: {}", - symbol_unescaped.as_str() - ), - ); - } - } - } - } - - fn check_extern(&self, ext: ast::Extern) { - if let ast::Extern::Explicit(abi, _) = ext { - self.check_abi(abi); - } - } - /// Feature gate `impl Trait` inside `type Alias = $type_expr;`. fn check_impl_trait(&self, ty: &ast::Ty, in_associated_ty: bool) { struct ImplTraitVisitor<'a> { @@ -223,12 +194,9 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { fn visit_item(&mut self, i: &'a ast::Item) { match &i.kind { - ast::ItemKind::ForeignMod(foreign_module) => { - if let Some(abi) = foreign_module.abi { - self.check_abi(abi); - } + ast::ItemKind::ForeignMod(_foreign_module) => { + // handled during lowering } - ast::ItemKind::Struct(..) | ast::ItemKind::Enum(..) | ast::ItemKind::Union(..) => { for attr in attr::filter_by_name(&i.attrs, sym::repr) { for item in attr.meta_item_list().unwrap_or_else(ThinVec::new) { @@ -315,7 +283,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { match &ty.kind { ast::TyKind::BareFn(bare_fn_ty) => { // Function pointers cannot be `const` - self.check_extern(bare_fn_ty.ext); self.check_late_bound_lifetime_defs(&bare_fn_ty.generic_params); } ast::TyKind::Never => { @@ -418,9 +385,8 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { } fn visit_fn(&mut self, fn_kind: FnKind<'a>, span: Span, _: NodeId) { - if let Some(header) = fn_kind.header() { + if let Some(_header) = fn_kind.header() { // Stability of const fn methods are covered in `visit_assoc_item` below. - self.check_extern(header.ext); } if let FnKind::Closure(ast::ClosureBinder::For { generic_params, .. }, ..) = fn_kind { diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 03b3426fcec0..b243d9a28793 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -58,10 +58,7 @@ use crate::spec::crt_objects::CrtObjects; pub mod crt_objects; pub mod abi { - pub use rustc_abi::{ - AbiDisabled, AbiUnsupported, ExternAbi as Abi, all_names, enabled_names, is_enabled, - is_stable, lookup, - }; + pub use rustc_abi::{AbiUnsupported, ExternAbi as Abi, all_names, lookup}; } mod base; diff --git a/tests/ui/extern/fictional-abi.rs b/tests/ui/extern/fictional-abi.rs new file mode 100644 index 000000000000..60b24f8856ef --- /dev/null +++ b/tests/ui/extern/fictional-abi.rs @@ -0,0 +1,3 @@ +#![crate_type = "lib"] + +pub extern "fictional" fn lol() {} //~ ERROR: invalid ABI diff --git a/tests/ui/extern/fictional-abi.stderr b/tests/ui/extern/fictional-abi.stderr new file mode 100644 index 000000000000..9784a57776fc --- /dev/null +++ b/tests/ui/extern/fictional-abi.stderr @@ -0,0 +1,11 @@ +error[E0703]: invalid ABI: found `fictional` + --> $DIR/fictional-abi.rs:3:12 + | +LL | pub extern "fictional" fn lol() {} + | ^^^^^^^^^^^ invalid ABI + | + = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0703`. From 90c50f0164d07945fdac83a316a5ebaf9e86d7a7 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Wed, 5 Feb 2025 11:18:18 -0800 Subject: [PATCH 048/128] compiler: start using rustc_ast_lowering in rustc_passes --- Cargo.lock | 1 + compiler/rustc_ast_lowering/src/lib.rs | 2 +- compiler/rustc_ast_lowering/src/stability.rs | 4 ++-- compiler/rustc_passes/Cargo.toml | 1 + compiler/rustc_passes/src/stability.rs | 5 +++-- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 14634fe3b463..15feae4b1932 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4357,6 +4357,7 @@ version = "0.0.0" dependencies = [ "rustc_abi", "rustc_ast", + "rustc_ast_lowering", "rustc_ast_pretty", "rustc_attr_parsing", "rustc_data_structures", diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 8997fe24c1fa..3fecb9e9c7ea 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -84,7 +84,7 @@ mod index; mod item; mod pat; mod path; -mod stability; +pub mod stability; rustc_fluent_macro::fluent_messages! { "../messages.ftl" } diff --git a/compiler/rustc_ast_lowering/src/stability.rs b/compiler/rustc_ast_lowering/src/stability.rs index 5fd26a29abac..e7c166850a46 100644 --- a/compiler/rustc_ast_lowering/src/stability.rs +++ b/compiler/rustc_ast_lowering/src/stability.rs @@ -40,7 +40,7 @@ pub(crate) fn gate_unstable_abi(sess: &Session, features: &Features, span: Span, } } -pub(crate) struct UnstableAbi { +pub struct UnstableAbi { abi: ExternAbi, feature: Symbol, explain: GateReason, @@ -70,7 +70,7 @@ impl fmt::Display for UnstableAbi { } } -pub(crate) fn extern_abi_stability(abi: ExternAbi) -> Result<(), UnstableAbi> { +pub fn extern_abi_stability(abi: ExternAbi) -> Result<(), UnstableAbi> { match abi { // stable ABIs ExternAbi::Rust diff --git a/compiler/rustc_passes/Cargo.toml b/compiler/rustc_passes/Cargo.toml index 2b8a3b9ce235..f592a12ab75c 100644 --- a/compiler/rustc_passes/Cargo.toml +++ b/compiler/rustc_passes/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" # tidy-alphabetical-start rustc_abi = { path = "../rustc_abi" } rustc_ast = { path = "../rustc_ast" } +rustc_ast_lowering = { path = "../rustc_ast_lowering" } rustc_ast_pretty = { path = "../rustc_ast_pretty" } rustc_attr_parsing = { path = "../rustc_attr_parsing" } rustc_data_structures = { path = "../rustc_data_structures" } diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 34f1ca55c787..fd30d0d4867f 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -4,6 +4,7 @@ use std::mem::replace; use std::num::NonZero; +use rustc_ast_lowering::stability::extern_abi_stability; use rustc_attr_parsing::{ self as attr, ConstStability, DeprecatedSince, Stability, StabilityLevel, StableSince, UnstableReason, VERSION_PLACEHOLDER, @@ -1027,8 +1028,8 @@ impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> { if let TyKind::Never = t.kind { self.fully_stable = false; } - if let TyKind::BareFn(f) = t.kind { - if rustc_target::spec::abi::is_stable(f.abi.name()).is_err() { + if let TyKind::BareFn(function) = t.kind { + if extern_abi_stability(function.abi).is_err() { self.fully_stable = false; } } From ca193471b52ad3158a49217e66d08064ed91f0cf Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Wed, 5 Feb 2025 11:15:27 -0800 Subject: [PATCH 049/128] tests: error strings for ABI stability now match --- tests/incremental/feature_gate.rs | 2 +- .../cmse-nonsecure-call/gate_test.stderr | 2 +- .../cmse-nonsecure-entry/gate_test.stderr | 2 +- .../feature-gate-abi-avr-interrupt.rs | 28 +++++++------- .../feature-gate-abi-avr-interrupt.stderr | 28 +++++++------- .../feature-gate-abi-msp430-interrupt.rs | 14 +++---- .../feature-gate-abi-msp430-interrupt.stderr | 14 +++---- .../feature-gate-abi-riscv-interrupt.rs | 12 +++--- .../feature-gate-abi-riscv-interrupt.stderr | 12 +++--- .../feature-gate-abi-x86-interrupt.rs | 14 +++---- .../feature-gate-abi-x86-interrupt.stderr | 14 +++---- tests/ui/feature-gates/feature-gate-abi.rs | 38 +++++++++---------- .../ui/feature-gates/feature-gate-abi.stderr | 38 +++++++++---------- .../feature-gate-abi_gpu_kernel.rs | 14 +++---- .../feature-gate-abi_gpu_kernel.stderr | 14 +++---- .../ui/feature-gates/feature-gate-abi_ptx.rs | 14 +++---- .../feature-gates/feature-gate-abi_ptx.stderr | 14 +++---- .../feature-gate-abi_unadjusted.rs | 2 +- .../feature-gate-abi_unadjusted.stderr | 2 +- .../feature-gates/feature-gate-intrinsics.rs | 4 +- .../feature-gate-intrinsics.stderr | 4 +- .../feature-gate-rust_cold_cc.rs | 14 +++---- .../feature-gate-rust_cold_cc.stderr | 14 +++---- ...ture-gate-unboxed-closures-manual-impls.rs | 8 ++-- ...-gate-unboxed-closures-manual-impls.stderr | 8 ++-- .../feature-gate-unboxed-closures.rs | 2 +- .../feature-gate-unboxed-closures.stderr | 2 +- .../feature-gates/feature-gate-vectorcall.rs | 14 +++---- .../feature-gate-vectorcall.stderr | 14 +++---- .../feature-gated-feature-in-macro-arg.rs | 2 +- .../feature-gated-feature-in-macro-arg.stderr | 2 +- .../incorrect-read_via_copy-defn.rs | 2 +- .../incorrect-read_via_copy-defn.stderr | 2 +- tests/ui/intrinsics/incorrect-transmute.rs | 2 +- .../ui/intrinsics/incorrect-transmute.stderr | 2 +- 35 files changed, 187 insertions(+), 187 deletions(-) diff --git a/tests/incremental/feature_gate.rs b/tests/incremental/feature_gate.rs index 54c2dbb352e1..332cf944b5d6 100644 --- a/tests/incremental/feature_gate.rs +++ b/tests/incremental/feature_gate.rs @@ -10,4 +10,4 @@ fn main() { } extern "unadjusted" fn foo() {} -//[cfail2]~^ ERROR: unadjusted ABI is an implementation detail and perma-unstable +//[cfail2]~^ ERROR: "unadjusted" ABI is an implementation detail and perma-unstable diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.stderr index 120d5cc5293b..63260b5c78fd 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.stderr @@ -1,4 +1,4 @@ -error[E0658]: C-cmse-nonsecure-call ABI is experimental and subject to change +error[E0658]: the extern "C-cmse-nonsecure-call" ABI is experimental and subject to change --> $DIR/gate_test.rs:5:46 | LL | core::mem::transmute:: i32>( diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.stderr index dabf16cab309..0afbbe647af0 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/gate_test.stderr @@ -1,4 +1,4 @@ -error[E0658]: C-cmse-nonsecure-entry ABI is experimental and subject to change +error[E0658]: the extern "C-cmse-nonsecure-entry" ABI is experimental and subject to change --> $DIR/gate_test.rs:4:12 | LL | pub extern "C-cmse-nonsecure-entry" fn entry_function(input: u32) -> u32 { diff --git a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs index f37c5335deb0..5386628a8e06 100644 --- a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs @@ -9,43 +9,43 @@ trait Sized { } // feature gate is not used. extern "avr-non-blocking-interrupt" fn fu() {} -//~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental +//~^ ERROR extern "avr-non-blocking-interrupt" ABI is experimental extern "avr-interrupt" fn f() {} -//~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental +//~^ ERROR extern "avr-interrupt" ABI is experimental trait T { extern "avr-interrupt" fn m(); - //~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental + //~^ ERROR extern "avr-interrupt" ABI is experimental extern "avr-non-blocking-interrupt" fn mu(); - //~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental + //~^ ERROR extern "avr-non-blocking-interrupt" ABI is experimental extern "avr-interrupt" fn dm() {} - //~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental + //~^ ERROR extern "avr-interrupt" ABI is experimental extern "avr-non-blocking-interrupt" fn dmu() {} - //~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental + //~^ ERROR extern "avr-non-blocking-interrupt" ABI is experimental } struct S; impl T for S { extern "avr-interrupt" fn m() {} - //~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental + //~^ ERROR extern "avr-interrupt" ABI is experimental extern "avr-non-blocking-interrupt" fn mu() {} - //~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental + //~^ ERROR extern "avr-non-blocking-interrupt" ABI is experimental } impl S { extern "avr-interrupt" fn im() {} - //~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental + //~^ ERROR extern "avr-interrupt" ABI is experimental extern "avr-non-blocking-interrupt" fn imu() {} - //~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental + //~^ ERROR extern "avr-non-blocking-interrupt" ABI is experimental } type TA = extern "avr-interrupt" fn(); -//~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental +//~^ ERROR extern "avr-interrupt" ABI is experimental type TAU = extern "avr-non-blocking-interrupt" fn(); -//~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental +//~^ ERROR extern "avr-non-blocking-interrupt" ABI is experimental extern "avr-interrupt" {} -//~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental +//~^ ERROR extern "avr-interrupt" ABI is experimental extern "avr-non-blocking-interrupt" {} -//~^ ERROR avr-interrupt and avr-non-blocking-interrupt ABIs are experimental +//~^ ERROR extern "avr-non-blocking-interrupt" ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr index c6786699de1b..d9f3c3adc7f0 100644 --- a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr +++ b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr @@ -1,4 +1,4 @@ -error[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:11:8 | LL | extern "avr-non-blocking-interrupt" fn fu() {} @@ -8,7 +8,7 @@ LL | extern "avr-non-blocking-interrupt" fn fu() {} = help: add `#![feature(abi_avr_interrupt)]` 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[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:13:8 | LL | extern "avr-interrupt" fn f() {} @@ -18,7 +18,7 @@ LL | extern "avr-interrupt" fn f() {} = help: add `#![feature(abi_avr_interrupt)]` 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[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:17:12 | LL | extern "avr-interrupt" fn m(); @@ -28,7 +28,7 @@ LL | extern "avr-interrupt" fn m(); = help: add `#![feature(abi_avr_interrupt)]` 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[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:19:12 | LL | extern "avr-non-blocking-interrupt" fn mu(); @@ -38,7 +38,7 @@ LL | extern "avr-non-blocking-interrupt" fn mu(); = help: add `#![feature(abi_avr_interrupt)]` 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[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:22:12 | LL | extern "avr-interrupt" fn dm() {} @@ -48,7 +48,7 @@ LL | extern "avr-interrupt" fn dm() {} = help: add `#![feature(abi_avr_interrupt)]` 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[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:24:12 | LL | extern "avr-non-blocking-interrupt" fn dmu() {} @@ -58,7 +58,7 @@ LL | extern "avr-non-blocking-interrupt" fn dmu() {} = help: add `#![feature(abi_avr_interrupt)]` 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[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:30:12 | LL | extern "avr-interrupt" fn m() {} @@ -68,7 +68,7 @@ LL | extern "avr-interrupt" fn m() {} = help: add `#![feature(abi_avr_interrupt)]` 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[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:32:12 | LL | extern "avr-non-blocking-interrupt" fn mu() {} @@ -78,7 +78,7 @@ LL | extern "avr-non-blocking-interrupt" fn mu() {} = help: add `#![feature(abi_avr_interrupt)]` 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[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:37:12 | LL | extern "avr-interrupt" fn im() {} @@ -88,7 +88,7 @@ LL | extern "avr-interrupt" fn im() {} = help: add `#![feature(abi_avr_interrupt)]` 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[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:39:12 | LL | extern "avr-non-blocking-interrupt" fn imu() {} @@ -98,7 +98,7 @@ LL | extern "avr-non-blocking-interrupt" fn imu() {} = help: add `#![feature(abi_avr_interrupt)]` 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[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:43:18 | LL | type TA = extern "avr-interrupt" fn(); @@ -108,7 +108,7 @@ LL | type TA = extern "avr-interrupt" fn(); = help: add `#![feature(abi_avr_interrupt)]` 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[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:45:19 | LL | type TAU = extern "avr-non-blocking-interrupt" fn(); @@ -118,7 +118,7 @@ LL | type TAU = extern "avr-non-blocking-interrupt" fn(); = help: add `#![feature(abi_avr_interrupt)]` 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[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:48:8 | LL | extern "avr-interrupt" {} @@ -128,7 +128,7 @@ LL | extern "avr-interrupt" {} = help: add `#![feature(abi_avr_interrupt)]` 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[E0658]: avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-avr-interrupt.rs:50:8 | LL | extern "avr-non-blocking-interrupt" {} diff --git a/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs index b0fb4c414d40..bb69a638ceea 100644 --- a/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs @@ -6,29 +6,29 @@ trait Sized { } extern "msp430-interrupt" fn f() {} -//~^ ERROR msp430-interrupt ABI is experimental +//~^ ERROR "msp430-interrupt" ABI is experimental trait T { extern "msp430-interrupt" fn m(); - //~^ ERROR msp430-interrupt ABI is experimental + //~^ ERROR "msp430-interrupt" ABI is experimental extern "msp430-interrupt" fn dm() {} - //~^ ERROR msp430-interrupt ABI is experimental + //~^ ERROR "msp430-interrupt" ABI is experimental } struct S; impl T for S { extern "msp430-interrupt" fn m() {} - //~^ ERROR msp430-interrupt ABI is experimental + //~^ ERROR "msp430-interrupt" ABI is experimental } impl S { extern "msp430-interrupt" fn im() {} - //~^ ERROR msp430-interrupt ABI is experimental + //~^ ERROR "msp430-interrupt" ABI is experimental } type TA = extern "msp430-interrupt" fn(); -//~^ ERROR msp430-interrupt ABI is experimental +//~^ ERROR "msp430-interrupt" ABI is experimental extern "msp430-interrupt" {} -//~^ ERROR msp430-interrupt ABI is experimental +//~^ ERROR "msp430-interrupt" ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr b/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr index 5dacc86dcc59..21ddbf7a86df 100644 --- a/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr +++ b/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr @@ -1,4 +1,4 @@ -error[E0658]: msp430-interrupt ABI is experimental and subject to change +error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-msp430-interrupt.rs:8:8 | LL | extern "msp430-interrupt" fn f() {} @@ -8,7 +8,7 @@ LL | extern "msp430-interrupt" fn f() {} = help: add `#![feature(abi_msp430_interrupt)]` 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[E0658]: msp430-interrupt ABI is experimental and subject to change +error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-msp430-interrupt.rs:12:12 | LL | extern "msp430-interrupt" fn m(); @@ -18,7 +18,7 @@ LL | extern "msp430-interrupt" fn m(); = help: add `#![feature(abi_msp430_interrupt)]` 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[E0658]: msp430-interrupt ABI is experimental and subject to change +error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-msp430-interrupt.rs:15:12 | LL | extern "msp430-interrupt" fn dm() {} @@ -28,7 +28,7 @@ LL | extern "msp430-interrupt" fn dm() {} = help: add `#![feature(abi_msp430_interrupt)]` 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[E0658]: msp430-interrupt ABI is experimental and subject to change +error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-msp430-interrupt.rs:21:12 | LL | extern "msp430-interrupt" fn m() {} @@ -38,7 +38,7 @@ LL | extern "msp430-interrupt" fn m() {} = help: add `#![feature(abi_msp430_interrupt)]` 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[E0658]: msp430-interrupt ABI is experimental and subject to change +error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-msp430-interrupt.rs:26:12 | LL | extern "msp430-interrupt" fn im() {} @@ -48,7 +48,7 @@ LL | extern "msp430-interrupt" fn im() {} = help: add `#![feature(abi_msp430_interrupt)]` 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[E0658]: msp430-interrupt ABI is experimental and subject to change +error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-msp430-interrupt.rs:30:18 | LL | type TA = extern "msp430-interrupt" fn(); @@ -58,7 +58,7 @@ LL | type TA = extern "msp430-interrupt" fn(); = help: add `#![feature(abi_msp430_interrupt)]` 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[E0658]: msp430-interrupt ABI is experimental and subject to change +error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-msp430-interrupt.rs:33:8 | LL | extern "msp430-interrupt" {} diff --git a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs index 29820f8877d3..6f4989fbd9fe 100644 --- a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs @@ -9,25 +9,25 @@ trait Sized {} // feature gate is not used. extern "riscv-interrupt-m" fn f() {} -//~^ ERROR riscv-interrupt ABIs are experimental +//~^ ERROR "riscv-interrupt-m" ABI is experimental extern "riscv-interrupt-s" fn f_s() {} -//~^ ERROR riscv-interrupt ABIs are experimental +//~^ ERROR "riscv-interrupt-s" ABI is experimental trait T { extern "riscv-interrupt-m" fn m(); - //~^ ERROR riscv-interrupt ABIs are experimental + //~^ ERROR "riscv-interrupt-m" ABI is experimental } struct S; impl T for S { extern "riscv-interrupt-m" fn m() {} - //~^ ERROR riscv-interrupt ABIs are experimental + //~^ ERROR "riscv-interrupt-m" ABI is experimental } impl S { extern "riscv-interrupt-m" fn im() {} - //~^ ERROR riscv-interrupt ABIs are experimental + //~^ ERROR "riscv-interrupt-m" ABI is experimental } type TA = extern "riscv-interrupt-m" fn(); -//~^ ERROR riscv-interrupt ABIs are experimental +//~^ ERROR "riscv-interrupt-m" ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr index 6b7853a320b0..3c9e99aa1b9b 100644 --- a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr +++ b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr @@ -1,4 +1,4 @@ -error[E0658]: riscv-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change --> $DIR/feature-gate-abi-riscv-interrupt.rs:11:8 | LL | extern "riscv-interrupt-m" fn f() {} @@ -8,7 +8,7 @@ LL | extern "riscv-interrupt-m" fn f() {} = help: add `#![feature(abi_riscv_interrupt)]` 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[E0658]: riscv-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "riscv-interrupt-s" ABI is experimental and subject to change --> $DIR/feature-gate-abi-riscv-interrupt.rs:13:8 | LL | extern "riscv-interrupt-s" fn f_s() {} @@ -18,7 +18,7 @@ LL | extern "riscv-interrupt-s" fn f_s() {} = help: add `#![feature(abi_riscv_interrupt)]` 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[E0658]: riscv-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change --> $DIR/feature-gate-abi-riscv-interrupt.rs:17:12 | LL | extern "riscv-interrupt-m" fn m(); @@ -28,7 +28,7 @@ LL | extern "riscv-interrupt-m" fn m(); = help: add `#![feature(abi_riscv_interrupt)]` 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[E0658]: riscv-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change --> $DIR/feature-gate-abi-riscv-interrupt.rs:23:12 | LL | extern "riscv-interrupt-m" fn m() {} @@ -38,7 +38,7 @@ LL | extern "riscv-interrupt-m" fn m() {} = help: add `#![feature(abi_riscv_interrupt)]` 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[E0658]: riscv-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change --> $DIR/feature-gate-abi-riscv-interrupt.rs:28:12 | LL | extern "riscv-interrupt-m" fn im() {} @@ -48,7 +48,7 @@ LL | extern "riscv-interrupt-m" fn im() {} = help: add `#![feature(abi_riscv_interrupt)]` 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[E0658]: riscv-interrupt ABIs are experimental and subject to change +error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change --> $DIR/feature-gate-abi-riscv-interrupt.rs:32:18 | LL | type TA = extern "riscv-interrupt-m" fn(); diff --git a/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs index 812ca12c7c37..93c59364f10b 100644 --- a/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs @@ -5,24 +5,24 @@ #[lang="sized"] trait Sized { } -extern "x86-interrupt" fn f7() {} //~ ERROR x86-interrupt ABI is experimental +extern "x86-interrupt" fn f7() {} //~ ERROR "x86-interrupt" ABI is experimental trait Tr { - extern "x86-interrupt" fn m7(); //~ ERROR x86-interrupt ABI is experimental - extern "x86-interrupt" fn dm7() {} //~ ERROR x86-interrupt ABI is experimental + extern "x86-interrupt" fn m7(); //~ ERROR "x86-interrupt" ABI is experimental + extern "x86-interrupt" fn dm7() {} //~ ERROR "x86-interrupt" ABI is experimental } struct S; // Methods in trait impl impl Tr for S { - extern "x86-interrupt" fn m7() {} //~ ERROR x86-interrupt ABI is experimental + extern "x86-interrupt" fn m7() {} //~ ERROR "x86-interrupt" ABI is experimental } // Methods in inherent impl impl S { - extern "x86-interrupt" fn im7() {} //~ ERROR x86-interrupt ABI is experimental + extern "x86-interrupt" fn im7() {} //~ ERROR "x86-interrupt" ABI is experimental } -type A7 = extern "x86-interrupt" fn(); //~ ERROR x86-interrupt ABI is experimental +type A7 = extern "x86-interrupt" fn(); //~ ERROR "x86-interrupt" ABI is experimental -extern "x86-interrupt" {} //~ ERROR x86-interrupt ABI is experimental +extern "x86-interrupt" {} //~ ERROR "x86-interrupt" ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.stderr b/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.stderr index 860005cac341..231cf207c862 100644 --- a/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.stderr +++ b/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.stderr @@ -1,4 +1,4 @@ -error[E0658]: x86-interrupt ABI is experimental and subject to change +error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:8:8 | LL | extern "x86-interrupt" fn f7() {} @@ -8,7 +8,7 @@ LL | extern "x86-interrupt" fn f7() {} = help: add `#![feature(abi_x86_interrupt)]` 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[E0658]: x86-interrupt ABI is experimental and subject to change +error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:10:12 | LL | extern "x86-interrupt" fn m7(); @@ -18,7 +18,7 @@ LL | extern "x86-interrupt" fn m7(); = help: add `#![feature(abi_x86_interrupt)]` 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[E0658]: x86-interrupt ABI is experimental and subject to change +error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:11:12 | LL | extern "x86-interrupt" fn dm7() {} @@ -28,7 +28,7 @@ LL | extern "x86-interrupt" fn dm7() {} = help: add `#![feature(abi_x86_interrupt)]` 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[E0658]: x86-interrupt ABI is experimental and subject to change +error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:18:12 | LL | extern "x86-interrupt" fn m7() {} @@ -38,7 +38,7 @@ LL | extern "x86-interrupt" fn m7() {} = help: add `#![feature(abi_x86_interrupt)]` 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[E0658]: x86-interrupt ABI is experimental and subject to change +error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:23:12 | LL | extern "x86-interrupt" fn im7() {} @@ -48,7 +48,7 @@ LL | extern "x86-interrupt" fn im7() {} = help: add `#![feature(abi_x86_interrupt)]` 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[E0658]: x86-interrupt ABI is experimental and subject to change +error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:26:18 | LL | type A7 = extern "x86-interrupt" fn(); @@ -58,7 +58,7 @@ LL | type A7 = extern "x86-interrupt" fn(); = help: add `#![feature(abi_x86_interrupt)]` 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[E0658]: x86-interrupt ABI is experimental and subject to change +error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change --> $DIR/feature-gate-abi-x86-interrupt.rs:28:8 | LL | extern "x86-interrupt" {} diff --git a/tests/ui/feature-gates/feature-gate-abi.rs b/tests/ui/feature-gates/feature-gate-abi.rs index 3aa430e736f0..7ab05889c20a 100644 --- a/tests/ui/feature-gates/feature-gate-abi.rs +++ b/tests/ui/feature-gates/feature-gate-abi.rs @@ -11,49 +11,49 @@ trait Sized { } trait Tuple { } // Functions -extern "rust-intrinsic" fn f1() {} //~ ERROR intrinsics are subject to change +extern "rust-intrinsic" fn f1() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in -extern "rust-intrinsic" fn f2() {} //~ ERROR intrinsics are subject to change +extern "rust-intrinsic" fn f2() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in -extern "rust-call" fn f4(_: ()) {} //~ ERROR rust-call ABI is subject to change +extern "rust-call" fn f4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change // Methods in trait definition trait Tr { - extern "rust-intrinsic" fn m1(); //~ ERROR intrinsics are subject to change + extern "rust-intrinsic" fn m1(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in - extern "rust-intrinsic" fn m2(); //~ ERROR intrinsics are subject to change + extern "rust-intrinsic" fn m2(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in - extern "rust-call" fn m4(_: ()); //~ ERROR rust-call ABI is subject to change + extern "rust-call" fn m4(_: ()); //~ ERROR extern "rust-call" ABI is experimental and subject to change - extern "rust-call" fn dm4(_: ()) {} //~ ERROR rust-call ABI is subject to change + extern "rust-call" fn dm4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change } struct S; // Methods in trait impl impl Tr for S { - extern "rust-intrinsic" fn m1() {} //~ ERROR intrinsics are subject to change + extern "rust-intrinsic" fn m1() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in - extern "rust-intrinsic" fn m2() {} //~ ERROR intrinsics are subject to change + extern "rust-intrinsic" fn m2() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in - extern "rust-call" fn m4(_: ()) {} //~ ERROR rust-call ABI is subject to change + extern "rust-call" fn m4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change } // Methods in inherent impl impl S { - extern "rust-intrinsic" fn im1() {} //~ ERROR intrinsics are subject to change + extern "rust-intrinsic" fn im1() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in - extern "rust-intrinsic" fn im2() {} //~ ERROR intrinsics are subject to change + extern "rust-intrinsic" fn im2() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in - extern "rust-call" fn im4(_: ()) {} //~ ERROR rust-call ABI is subject to change + extern "rust-call" fn im4(_: ()) {} //~ ERROR extern "rust-call" ABI is experimental and subject to change } // Function pointer types -type A1 = extern "rust-intrinsic" fn(); //~ ERROR intrinsics are subject to change -type A2 = extern "rust-intrinsic" fn(); //~ ERROR intrinsics are subject to change -type A4 = extern "rust-call" fn(_: ()); //~ ERROR rust-call ABI is subject to change +type A1 = extern "rust-intrinsic" fn(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail +type A2 = extern "rust-intrinsic" fn(); //~ ERROR extern "rust-intrinsic" ABI is an implementation detail +type A4 = extern "rust-call" fn(_: ()); //~ ERROR extern "rust-call" ABI is experimental and subject to change // Foreign modules -extern "rust-intrinsic" {} //~ ERROR intrinsics are subject to change -extern "rust-intrinsic" {} //~ ERROR intrinsics are subject to change -extern "rust-call" {} //~ ERROR rust-call ABI is subject to change +extern "rust-intrinsic" {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail +extern "rust-intrinsic" {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail +extern "rust-call" {} //~ ERROR extern "rust-call" ABI is experimental and subject to change diff --git a/tests/ui/feature-gates/feature-gate-abi.stderr b/tests/ui/feature-gates/feature-gate-abi.stderr index dbdfa7b275d4..70ec64e5135e 100644 --- a/tests/ui/feature-gates/feature-gate-abi.stderr +++ b/tests/ui/feature-gates/feature-gate-abi.stderr @@ -1,4 +1,4 @@ -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:14:8 | LL | extern "rust-intrinsic" fn f1() {} @@ -7,7 +7,7 @@ LL | extern "rust-intrinsic" fn f1() {} = help: add `#![feature(intrinsics)]` 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[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:16:8 | LL | extern "rust-intrinsic" fn f2() {} @@ -16,7 +16,7 @@ LL | extern "rust-intrinsic" fn f2() {} = help: add `#![feature(intrinsics)]` 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[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-abi.rs:18:8 | LL | extern "rust-call" fn f4(_: ()) {} @@ -26,7 +26,7 @@ LL | extern "rust-call" fn f4(_: ()) {} = help: add `#![feature(unboxed_closures)]` 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[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:22:12 | LL | extern "rust-intrinsic" fn m1(); @@ -35,7 +35,7 @@ LL | extern "rust-intrinsic" fn m1(); = help: add `#![feature(intrinsics)]` 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[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:24:12 | LL | extern "rust-intrinsic" fn m2(); @@ -44,7 +44,7 @@ LL | extern "rust-intrinsic" fn m2(); = help: add `#![feature(intrinsics)]` 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[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-abi.rs:26:12 | LL | extern "rust-call" fn m4(_: ()); @@ -54,7 +54,7 @@ LL | extern "rust-call" fn m4(_: ()); = help: add `#![feature(unboxed_closures)]` 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[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-abi.rs:28:12 | LL | extern "rust-call" fn dm4(_: ()) {} @@ -64,7 +64,7 @@ LL | extern "rust-call" fn dm4(_: ()) {} = help: add `#![feature(unboxed_closures)]` 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[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:35:12 | LL | extern "rust-intrinsic" fn m1() {} @@ -73,7 +73,7 @@ LL | extern "rust-intrinsic" fn m1() {} = help: add `#![feature(intrinsics)]` 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[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:37:12 | LL | extern "rust-intrinsic" fn m2() {} @@ -82,7 +82,7 @@ LL | extern "rust-intrinsic" fn m2() {} = help: add `#![feature(intrinsics)]` 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[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-abi.rs:39:12 | LL | extern "rust-call" fn m4(_: ()) {} @@ -92,7 +92,7 @@ LL | extern "rust-call" fn m4(_: ()) {} = help: add `#![feature(unboxed_closures)]` 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[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:44:12 | LL | extern "rust-intrinsic" fn im1() {} @@ -101,7 +101,7 @@ LL | extern "rust-intrinsic" fn im1() {} = help: add `#![feature(intrinsics)]` 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[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:46:12 | LL | extern "rust-intrinsic" fn im2() {} @@ -110,7 +110,7 @@ LL | extern "rust-intrinsic" fn im2() {} = help: add `#![feature(intrinsics)]` 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[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-abi.rs:48:12 | LL | extern "rust-call" fn im4(_: ()) {} @@ -120,7 +120,7 @@ LL | extern "rust-call" fn im4(_: ()) {} = help: add `#![feature(unboxed_closures)]` 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[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:52:18 | LL | type A1 = extern "rust-intrinsic" fn(); @@ -129,7 +129,7 @@ LL | type A1 = extern "rust-intrinsic" fn(); = help: add `#![feature(intrinsics)]` 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[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:53:18 | LL | type A2 = extern "rust-intrinsic" fn(); @@ -138,7 +138,7 @@ LL | type A2 = extern "rust-intrinsic" fn(); = help: add `#![feature(intrinsics)]` 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[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-abi.rs:54:18 | LL | type A4 = extern "rust-call" fn(_: ()); @@ -148,7 +148,7 @@ LL | type A4 = extern "rust-call" fn(_: ()); = help: add `#![feature(unboxed_closures)]` 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[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:57:8 | LL | extern "rust-intrinsic" {} @@ -157,7 +157,7 @@ LL | extern "rust-intrinsic" {} = help: add `#![feature(intrinsics)]` 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[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi.rs:58:8 | LL | extern "rust-intrinsic" {} @@ -166,7 +166,7 @@ LL | extern "rust-intrinsic" {} = help: add `#![feature(intrinsics)]` 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[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-abi.rs:59:8 | LL | extern "rust-call" {} diff --git a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs index 7d39820f086e..fb04906dafe9 100644 --- a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs +++ b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs @@ -10,14 +10,14 @@ trait Sized { } trait Tuple { } // Functions -extern "gpu-kernel" fn f1(_: ()) {} //~ ERROR gpu-kernel ABI is experimental and subject to change +extern "gpu-kernel" fn f1(_: ()) {} //~ ERROR "gpu-kernel" ABI is experimental and subject to change //~^ ERROR is not a supported ABI // Methods in trait definition trait Tr { - extern "gpu-kernel" fn m1(_: ()); //~ ERROR gpu-kernel ABI is experimental and subject to change + extern "gpu-kernel" fn m1(_: ()); //~ ERROR "gpu-kernel" ABI is experimental and subject to change - extern "gpu-kernel" fn dm1(_: ()) {} //~ ERROR gpu-kernel ABI is experimental and subject to change + extern "gpu-kernel" fn dm1(_: ()) {} //~ ERROR "gpu-kernel" ABI is experimental and subject to change //~^ ERROR is not a supported ABI } @@ -25,21 +25,21 @@ struct S; // Methods in trait impl impl Tr for S { - extern "gpu-kernel" fn m1(_: ()) {} //~ ERROR gpu-kernel ABI is experimental and subject to change + extern "gpu-kernel" fn m1(_: ()) {} //~ ERROR "gpu-kernel" ABI is experimental and subject to change //~^ ERROR is not a supported ABI } // Methods in inherent impl impl S { - extern "gpu-kernel" fn im1(_: ()) {} //~ ERROR gpu-kernel ABI is experimental and subject to change + extern "gpu-kernel" fn im1(_: ()) {} //~ ERROR "gpu-kernel" ABI is experimental and subject to change //~^ ERROR is not a supported ABI } // Function pointer types -type A1 = extern "gpu-kernel" fn(_: ()); //~ ERROR gpu-kernel ABI is experimental and subject to change +type A1 = extern "gpu-kernel" fn(_: ()); //~ ERROR "gpu-kernel" ABI is experimental and subject to change //~^ WARN the calling convention "gpu-kernel" is not supported on this target //~^^ WARN this was previously accepted by the compiler but is being phased out // Foreign modules -extern "gpu-kernel" {} //~ ERROR gpu-kernel ABI is experimental and subject to change +extern "gpu-kernel" {} //~ ERROR "gpu-kernel" ABI is experimental and subject to change //~^ ERROR is not a supported ABI diff --git a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.stderr b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.stderr index 771c49acb97a..b05c16e3d9ee 100644 --- a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.stderr +++ b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.stderr @@ -1,4 +1,4 @@ -error[E0658]: gpu-kernel ABI is experimental and subject to change +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_gpu_kernel.rs:13:8 | LL | extern "gpu-kernel" fn f1(_: ()) {} @@ -8,7 +8,7 @@ LL | extern "gpu-kernel" fn f1(_: ()) {} = help: add `#![feature(abi_gpu_kernel)]` 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[E0658]: gpu-kernel ABI is experimental and subject to change +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_gpu_kernel.rs:18:12 | LL | extern "gpu-kernel" fn m1(_: ()); @@ -18,7 +18,7 @@ LL | extern "gpu-kernel" fn m1(_: ()); = help: add `#![feature(abi_gpu_kernel)]` 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[E0658]: gpu-kernel ABI is experimental and subject to change +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_gpu_kernel.rs:20:12 | LL | extern "gpu-kernel" fn dm1(_: ()) {} @@ -28,7 +28,7 @@ LL | extern "gpu-kernel" fn dm1(_: ()) {} = help: add `#![feature(abi_gpu_kernel)]` 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[E0658]: gpu-kernel ABI is experimental and subject to change +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_gpu_kernel.rs:28:12 | LL | extern "gpu-kernel" fn m1(_: ()) {} @@ -38,7 +38,7 @@ LL | extern "gpu-kernel" fn m1(_: ()) {} = help: add `#![feature(abi_gpu_kernel)]` 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[E0658]: gpu-kernel ABI is experimental and subject to change +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_gpu_kernel.rs:34:12 | LL | extern "gpu-kernel" fn im1(_: ()) {} @@ -48,7 +48,7 @@ LL | extern "gpu-kernel" fn im1(_: ()) {} = help: add `#![feature(abi_gpu_kernel)]` 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[E0658]: gpu-kernel ABI is experimental and subject to change +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_gpu_kernel.rs:39:18 | LL | type A1 = extern "gpu-kernel" fn(_: ()); @@ -58,7 +58,7 @@ LL | type A1 = extern "gpu-kernel" fn(_: ()); = help: add `#![feature(abi_gpu_kernel)]` 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[E0658]: gpu-kernel ABI is experimental and subject to change +error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_gpu_kernel.rs:44:8 | LL | extern "gpu-kernel" {} diff --git a/tests/ui/feature-gates/feature-gate-abi_ptx.rs b/tests/ui/feature-gates/feature-gate-abi_ptx.rs index 83f48430281a..e742492303ad 100644 --- a/tests/ui/feature-gates/feature-gate-abi_ptx.rs +++ b/tests/ui/feature-gates/feature-gate-abi_ptx.rs @@ -5,22 +5,22 @@ #[lang="sized"] trait Sized { } -extern "ptx-kernel" fn fu() {} //~ ERROR PTX ABIs are experimental +extern "ptx-kernel" fn fu() {} //~ ERROR extern "ptx-kernel" ABI is experimental trait T { - extern "ptx-kernel" fn mu(); //~ ERROR PTX ABIs are experimental - extern "ptx-kernel" fn dmu() {} //~ ERROR PTX ABIs are experimental + extern "ptx-kernel" fn mu(); //~ ERROR extern "ptx-kernel" ABI is experimental + extern "ptx-kernel" fn dmu() {} //~ ERROR extern "ptx-kernel" ABI is experimental } struct S; impl T for S { - extern "ptx-kernel" fn mu() {} //~ ERROR PTX ABIs are experimental + extern "ptx-kernel" fn mu() {} //~ ERROR extern "ptx-kernel" ABI is experimental } impl S { - extern "ptx-kernel" fn imu() {} //~ ERROR PTX ABIs are experimental + extern "ptx-kernel" fn imu() {} //~ ERROR extern "ptx-kernel" ABI is experimental } -type TAU = extern "ptx-kernel" fn(); //~ ERROR PTX ABIs are experimental +type TAU = extern "ptx-kernel" fn(); //~ ERROR extern "ptx-kernel" ABI is experimental -extern "ptx-kernel" {} //~ ERROR PTX ABIs are experimental +extern "ptx-kernel" {} //~ ERROR extern "ptx-kernel" ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-abi_ptx.stderr b/tests/ui/feature-gates/feature-gate-abi_ptx.stderr index 22b493e577dd..d128075919b0 100644 --- a/tests/ui/feature-gates/feature-gate-abi_ptx.stderr +++ b/tests/ui/feature-gates/feature-gate-abi_ptx.stderr @@ -1,4 +1,4 @@ -error[E0658]: PTX ABIs are experimental and subject to change +error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_ptx.rs:8:8 | LL | extern "ptx-kernel" fn fu() {} @@ -8,7 +8,7 @@ LL | extern "ptx-kernel" fn fu() {} = help: add `#![feature(abi_ptx)]` 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[E0658]: PTX ABIs are experimental and subject to change +error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_ptx.rs:11:12 | LL | extern "ptx-kernel" fn mu(); @@ -18,7 +18,7 @@ LL | extern "ptx-kernel" fn mu(); = help: add `#![feature(abi_ptx)]` 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[E0658]: PTX ABIs are experimental and subject to change +error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_ptx.rs:12:12 | LL | extern "ptx-kernel" fn dmu() {} @@ -28,7 +28,7 @@ LL | extern "ptx-kernel" fn dmu() {} = help: add `#![feature(abi_ptx)]` 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[E0658]: PTX ABIs are experimental and subject to change +error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_ptx.rs:17:12 | LL | extern "ptx-kernel" fn mu() {} @@ -38,7 +38,7 @@ LL | extern "ptx-kernel" fn mu() {} = help: add `#![feature(abi_ptx)]` 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[E0658]: PTX ABIs are experimental and subject to change +error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_ptx.rs:21:12 | LL | extern "ptx-kernel" fn imu() {} @@ -48,7 +48,7 @@ LL | extern "ptx-kernel" fn imu() {} = help: add `#![feature(abi_ptx)]` 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[E0658]: PTX ABIs are experimental and subject to change +error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_ptx.rs:24:19 | LL | type TAU = extern "ptx-kernel" fn(); @@ -58,7 +58,7 @@ LL | type TAU = extern "ptx-kernel" fn(); = help: add `#![feature(abi_ptx)]` 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[E0658]: PTX ABIs are experimental and subject to change +error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change --> $DIR/feature-gate-abi_ptx.rs:26:8 | LL | extern "ptx-kernel" {} diff --git a/tests/ui/feature-gates/feature-gate-abi_unadjusted.rs b/tests/ui/feature-gates/feature-gate-abi_unadjusted.rs index 35a7d73288b5..1dc6adc0e149 100644 --- a/tests/ui/feature-gates/feature-gate-abi_unadjusted.rs +++ b/tests/ui/feature-gates/feature-gate-abi_unadjusted.rs @@ -1,5 +1,5 @@ extern "unadjusted" fn foo() { -//~^ ERROR: unadjusted ABI is an implementation detail and perma-unstable +//~^ ERROR: "unadjusted" ABI is an implementation detail and perma-unstable } fn main() { diff --git a/tests/ui/feature-gates/feature-gate-abi_unadjusted.stderr b/tests/ui/feature-gates/feature-gate-abi_unadjusted.stderr index 1d5fb11cd3d2..462fb79d5570 100644 --- a/tests/ui/feature-gates/feature-gate-abi_unadjusted.stderr +++ b/tests/ui/feature-gates/feature-gate-abi_unadjusted.stderr @@ -1,4 +1,4 @@ -error[E0658]: unadjusted ABI is an implementation detail and perma-unstable +error[E0658]: the extern "unadjusted" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi_unadjusted.rs:1:8 | LL | extern "unadjusted" fn foo() { diff --git a/tests/ui/feature-gates/feature-gate-intrinsics.rs b/tests/ui/feature-gates/feature-gate-intrinsics.rs index e0dc3cc579d7..65806a0223e7 100644 --- a/tests/ui/feature-gates/feature-gate-intrinsics.rs +++ b/tests/ui/feature-gates/feature-gate-intrinsics.rs @@ -1,8 +1,8 @@ -extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change +extern "rust-intrinsic" { //~ ERROR "rust-intrinsic" ABI is an implementation detail fn bar(); //~ ERROR unrecognized intrinsic function: `bar` } -extern "rust-intrinsic" fn baz() {} //~ ERROR intrinsics are subject to change +extern "rust-intrinsic" fn baz() {} //~ ERROR "rust-intrinsic" ABI is an implementation detail //~^ ERROR intrinsic must be in fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-intrinsics.stderr b/tests/ui/feature-gates/feature-gate-intrinsics.stderr index 577a620e2d2c..97246f05258f 100644 --- a/tests/ui/feature-gates/feature-gate-intrinsics.stderr +++ b/tests/ui/feature-gates/feature-gate-intrinsics.stderr @@ -1,4 +1,4 @@ -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-intrinsics.rs:1:8 | LL | extern "rust-intrinsic" { @@ -7,7 +7,7 @@ LL | extern "rust-intrinsic" { = help: add `#![feature(intrinsics)]` 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[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-intrinsics.rs:5:8 | LL | extern "rust-intrinsic" fn baz() {} diff --git a/tests/ui/feature-gates/feature-gate-rust_cold_cc.rs b/tests/ui/feature-gates/feature-gate-rust_cold_cc.rs index 9ba8e32ac07a..4f47eb55b395 100644 --- a/tests/ui/feature-gates/feature-gate-rust_cold_cc.rs +++ b/tests/ui/feature-gates/feature-gate-rust_cold_cc.rs @@ -1,21 +1,21 @@ #![crate_type = "lib"] -extern "rust-cold" fn fu() {} //~ ERROR rust-cold is experimental +extern "rust-cold" fn fu() {} //~ ERROR "rust-cold" ABI is experimental trait T { - extern "rust-cold" fn mu(); //~ ERROR rust-cold is experimental - extern "rust-cold" fn dmu() {} //~ ERROR rust-cold is experimental + extern "rust-cold" fn mu(); //~ ERROR "rust-cold" ABI is experimental + extern "rust-cold" fn dmu() {} //~ ERROR "rust-cold" ABI is experimental } struct S; impl T for S { - extern "rust-cold" fn mu() {} //~ ERROR rust-cold is experimental + extern "rust-cold" fn mu() {} //~ ERROR "rust-cold" ABI is experimental } impl S { - extern "rust-cold" fn imu() {} //~ ERROR rust-cold is experimental + extern "rust-cold" fn imu() {} //~ ERROR "rust-cold" ABI is experimental } -type TAU = extern "rust-cold" fn(); //~ ERROR rust-cold is experimental +type TAU = extern "rust-cold" fn(); //~ ERROR "rust-cold" ABI is experimental -extern "rust-cold" {} //~ ERROR rust-cold is experimental +extern "rust-cold" {} //~ ERROR "rust-cold" ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-rust_cold_cc.stderr b/tests/ui/feature-gates/feature-gate-rust_cold_cc.stderr index eeff9534d528..9547c64f2b2e 100644 --- a/tests/ui/feature-gates/feature-gate-rust_cold_cc.stderr +++ b/tests/ui/feature-gates/feature-gate-rust_cold_cc.stderr @@ -1,4 +1,4 @@ -error[E0658]: rust-cold is experimental and subject to change +error[E0658]: the extern "rust-cold" ABI is experimental and subject to change --> $DIR/feature-gate-rust_cold_cc.rs:3:8 | LL | extern "rust-cold" fn fu() {} @@ -8,7 +8,7 @@ LL | extern "rust-cold" fn fu() {} = help: add `#![feature(rust_cold_cc)]` 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[E0658]: rust-cold is experimental and subject to change +error[E0658]: the extern "rust-cold" ABI is experimental and subject to change --> $DIR/feature-gate-rust_cold_cc.rs:6:12 | LL | extern "rust-cold" fn mu(); @@ -18,7 +18,7 @@ LL | extern "rust-cold" fn mu(); = help: add `#![feature(rust_cold_cc)]` 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[E0658]: rust-cold is experimental and subject to change +error[E0658]: the extern "rust-cold" ABI is experimental and subject to change --> $DIR/feature-gate-rust_cold_cc.rs:7:12 | LL | extern "rust-cold" fn dmu() {} @@ -28,7 +28,7 @@ LL | extern "rust-cold" fn dmu() {} = help: add `#![feature(rust_cold_cc)]` 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[E0658]: rust-cold is experimental and subject to change +error[E0658]: the extern "rust-cold" ABI is experimental and subject to change --> $DIR/feature-gate-rust_cold_cc.rs:12:12 | LL | extern "rust-cold" fn mu() {} @@ -38,7 +38,7 @@ LL | extern "rust-cold" fn mu() {} = help: add `#![feature(rust_cold_cc)]` 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[E0658]: rust-cold is experimental and subject to change +error[E0658]: the extern "rust-cold" ABI is experimental and subject to change --> $DIR/feature-gate-rust_cold_cc.rs:16:12 | LL | extern "rust-cold" fn imu() {} @@ -48,7 +48,7 @@ LL | extern "rust-cold" fn imu() {} = help: add `#![feature(rust_cold_cc)]` 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[E0658]: rust-cold is experimental and subject to change +error[E0658]: the extern "rust-cold" ABI is experimental and subject to change --> $DIR/feature-gate-rust_cold_cc.rs:19:19 | LL | type TAU = extern "rust-cold" fn(); @@ -58,7 +58,7 @@ LL | type TAU = extern "rust-cold" fn(); = help: add `#![feature(rust_cold_cc)]` 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[E0658]: rust-cold is experimental and subject to change +error[E0658]: the extern "rust-cold" ABI is experimental and subject to change --> $DIR/feature-gate-rust_cold_cc.rs:21:8 | LL | extern "rust-cold" {} diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs index ff528274c59b..7b40c8760e36 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs @@ -11,7 +11,7 @@ impl Fn<()> for Foo { //~| ERROR manual implementations of `Fn` are experimental //~| ERROR expected a `FnMut()` closure, found `Foo` extern "rust-call" fn call(self, args: ()) -> () {} - //~^ ERROR rust-call ABI is subject to change + //~^ ERROR "rust-call" ABI is experimental and subject to change //~| ERROR `call` has an incompatible type for trait } struct Foo1; @@ -20,7 +20,7 @@ impl FnOnce() for Foo1 { //~| ERROR manual implementations of `FnOnce` are experimental //~| ERROR not all trait items implemented extern "rust-call" fn call_once(self, args: ()) -> () {} - //~^ ERROR rust-call ABI is subject to change + //~^ ERROR "rust-call" ABI is experimental and subject to change } struct Bar; impl FnMut<()> for Bar { @@ -28,7 +28,7 @@ impl FnMut<()> for Bar { //~| ERROR manual implementations of `FnMut` are experimental //~| ERROR expected a `FnOnce()` closure, found `Bar` extern "rust-call" fn call_mut(&self, args: ()) -> () {} - //~^ ERROR rust-call ABI is subject to change + //~^ ERROR "rust-call" ABI is experimental and subject to change //~| ERROR incompatible type for trait } struct Baz; @@ -37,7 +37,7 @@ impl FnOnce<()> for Baz { //~| ERROR manual implementations of `FnOnce` are experimental //~| ERROR not all trait items implemented extern "rust-call" fn call_once(&self, args: ()) -> () {} - //~^ ERROR rust-call ABI is subject to change + //~^ ERROR "rust-call" ABI is experimental and subject to change } fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr index 584724dfe59c..f9d231dc78f7 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr @@ -1,4 +1,4 @@ -error[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:13:12 | LL | extern "rust-call" fn call(self, args: ()) -> () {} @@ -8,7 +8,7 @@ LL | extern "rust-call" fn call(self, args: ()) -> () {} = help: add `#![feature(unboxed_closures)]` 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[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:22:12 | LL | extern "rust-call" fn call_once(self, args: ()) -> () {} @@ -18,7 +18,7 @@ LL | extern "rust-call" fn call_once(self, args: ()) -> () {} = help: add `#![feature(unboxed_closures)]` 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[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:30:12 | LL | extern "rust-call" fn call_mut(&self, args: ()) -> () {} @@ -28,7 +28,7 @@ LL | extern "rust-call" fn call_mut(&self, args: ()) -> () {} = help: add `#![feature(unboxed_closures)]` 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[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:39:12 | LL | extern "rust-call" fn call_once(&self, args: ()) -> () {} diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures.rs b/tests/ui/feature-gates/feature-gate-unboxed-closures.rs index ebc5a2536f67..74cc20c581cb 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures.rs +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures.rs @@ -10,7 +10,7 @@ impl FnOnce<(u32, u32)> for Test { extern "rust-call" fn call_once(self, (a, b): (u32, u32)) -> u32 { a + b } - //~^^^ ERROR rust-call ABI is subject to change + //~^^^ ERROR "rust-call" ABI is experimental and subject to change } fn main() { diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures.stderr index 52c18ec34c56..36932c1f86f9 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures.stderr @@ -1,4 +1,4 @@ -error[E0658]: rust-call ABI is subject to change +error[E0658]: the extern "rust-call" ABI is experimental and subject to change --> $DIR/feature-gate-unboxed-closures.rs:10:12 | LL | extern "rust-call" fn call_once(self, (a, b): (u32, u32)) -> u32 { diff --git a/tests/ui/feature-gates/feature-gate-vectorcall.rs b/tests/ui/feature-gates/feature-gate-vectorcall.rs index 73a11a842f37..aafa6a2ed629 100644 --- a/tests/ui/feature-gates/feature-gate-vectorcall.rs +++ b/tests/ui/feature-gates/feature-gate-vectorcall.rs @@ -9,23 +9,23 @@ trait Sized { } // Test that the "vectorcall" ABI is feature-gated, and cannot be used when // the `vectorcall` feature gate is not used. -extern "vectorcall" fn f() {} //~ ERROR vectorcall is experimental +extern "vectorcall" fn f() {} //~ ERROR "vectorcall" ABI is experimental trait T { - extern "vectorcall" fn m(); //~ ERROR vectorcall is experimental + extern "vectorcall" fn m(); //~ ERROR "vectorcall" ABI is experimental - extern "vectorcall" fn dm() {} //~ ERROR vectorcall is experimental + extern "vectorcall" fn dm() {} //~ ERROR "vectorcall" ABI is experimental } struct S; impl T for S { - extern "vectorcall" fn m() {} //~ ERROR vectorcall is experimental + extern "vectorcall" fn m() {} //~ ERROR "vectorcall" ABI is experimental } impl S { - extern "vectorcall" fn im() {} //~ ERROR vectorcall is experimental + extern "vectorcall" fn im() {} //~ ERROR "vectorcall" ABI is experimental } -type TA = extern "vectorcall" fn(); //~ ERROR vectorcall is experimental +type TA = extern "vectorcall" fn(); //~ ERROR "vectorcall" ABI is experimental -extern "vectorcall" {} //~ ERROR vectorcall is experimental +extern "vectorcall" {} //~ ERROR "vectorcall" ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-vectorcall.stderr b/tests/ui/feature-gates/feature-gate-vectorcall.stderr index b20e41887b9b..8f3f47a3d488 100644 --- a/tests/ui/feature-gates/feature-gate-vectorcall.stderr +++ b/tests/ui/feature-gates/feature-gate-vectorcall.stderr @@ -1,4 +1,4 @@ -error[E0658]: vectorcall is experimental and subject to change +error[E0658]: the extern "vectorcall" ABI is experimental and subject to change --> $DIR/feature-gate-vectorcall.rs:12:8 | LL | extern "vectorcall" fn f() {} @@ -8,7 +8,7 @@ LL | extern "vectorcall" fn f() {} = help: add `#![feature(abi_vectorcall)]` 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[E0658]: vectorcall is experimental and subject to change +error[E0658]: the extern "vectorcall" ABI is experimental and subject to change --> $DIR/feature-gate-vectorcall.rs:15:12 | LL | extern "vectorcall" fn m(); @@ -18,7 +18,7 @@ LL | extern "vectorcall" fn m(); = help: add `#![feature(abi_vectorcall)]` 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[E0658]: vectorcall is experimental and subject to change +error[E0658]: the extern "vectorcall" ABI is experimental and subject to change --> $DIR/feature-gate-vectorcall.rs:17:12 | LL | extern "vectorcall" fn dm() {} @@ -28,7 +28,7 @@ LL | extern "vectorcall" fn dm() {} = help: add `#![feature(abi_vectorcall)]` 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[E0658]: vectorcall is experimental and subject to change +error[E0658]: the extern "vectorcall" ABI is experimental and subject to change --> $DIR/feature-gate-vectorcall.rs:22:12 | LL | extern "vectorcall" fn m() {} @@ -38,7 +38,7 @@ LL | extern "vectorcall" fn m() {} = help: add `#![feature(abi_vectorcall)]` 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[E0658]: vectorcall is experimental and subject to change +error[E0658]: the extern "vectorcall" ABI is experimental and subject to change --> $DIR/feature-gate-vectorcall.rs:26:12 | LL | extern "vectorcall" fn im() {} @@ -48,7 +48,7 @@ LL | extern "vectorcall" fn im() {} = help: add `#![feature(abi_vectorcall)]` 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[E0658]: vectorcall is experimental and subject to change +error[E0658]: the extern "vectorcall" ABI is experimental and subject to change --> $DIR/feature-gate-vectorcall.rs:29:18 | LL | type TA = extern "vectorcall" fn(); @@ -58,7 +58,7 @@ LL | type TA = extern "vectorcall" fn(); = help: add `#![feature(abi_vectorcall)]` 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[E0658]: vectorcall is experimental and subject to change +error[E0658]: the extern "vectorcall" ABI is experimental and subject to change --> $DIR/feature-gate-vectorcall.rs:31:8 | LL | extern "vectorcall" {} diff --git a/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.rs b/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.rs index 37b7d52fafca..2328798d74c3 100644 --- a/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.rs +++ b/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.rs @@ -5,7 +5,7 @@ fn main() { let a = &[1, 2, 3]; println!("{}", { - extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change + extern "rust-intrinsic" { //~ ERROR "rust-intrinsic" ABI is an implementation detail fn atomic_fence(); } atomic_fence(); //~ ERROR: is unsafe diff --git a/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.stderr b/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.stderr index 3dc11b5612ca..86f88fdff5fc 100644 --- a/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.stderr +++ b/tests/ui/feature-gates/feature-gated-feature-in-macro-arg.stderr @@ -1,4 +1,4 @@ -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/feature-gated-feature-in-macro-arg.rs:8:16 | LL | extern "rust-intrinsic" { diff --git a/tests/ui/intrinsics/incorrect-read_via_copy-defn.rs b/tests/ui/intrinsics/incorrect-read_via_copy-defn.rs index 66de1f60ed9b..5520430e140b 100644 --- a/tests/ui/intrinsics/incorrect-read_via_copy-defn.rs +++ b/tests/ui/intrinsics/incorrect-read_via_copy-defn.rs @@ -3,5 +3,5 @@ fn main() { } extern "rust-intrinsic" fn read_via_copy() {} -//~^ ERROR intrinsics are subject to change +//~^ ERROR "rust-intrinsic" ABI is an implementation detail //~| ERROR intrinsic must be in `extern "rust-intrinsic" { ... }` block diff --git a/tests/ui/intrinsics/incorrect-read_via_copy-defn.stderr b/tests/ui/intrinsics/incorrect-read_via_copy-defn.stderr index 362ee185b7b1..c6682693f740 100644 --- a/tests/ui/intrinsics/incorrect-read_via_copy-defn.stderr +++ b/tests/ui/intrinsics/incorrect-read_via_copy-defn.stderr @@ -1,4 +1,4 @@ -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/incorrect-read_via_copy-defn.rs:5:8 | LL | extern "rust-intrinsic" fn read_via_copy() {} diff --git a/tests/ui/intrinsics/incorrect-transmute.rs b/tests/ui/intrinsics/incorrect-transmute.rs index eed524ae8a8a..15d1ab939ed0 100644 --- a/tests/ui/intrinsics/incorrect-transmute.rs +++ b/tests/ui/intrinsics/incorrect-transmute.rs @@ -3,5 +3,5 @@ fn main() { } extern "rust-intrinsic" fn transmute() {} -//~^ ERROR intrinsics are subject to change +//~^ ERROR "rust-intrinsic" ABI is an implementation detail //~| ERROR intrinsic must be in `extern "rust-intrinsic" { ... }` block diff --git a/tests/ui/intrinsics/incorrect-transmute.stderr b/tests/ui/intrinsics/incorrect-transmute.stderr index 8123f3d71a29..99dfb9847ff2 100644 --- a/tests/ui/intrinsics/incorrect-transmute.stderr +++ b/tests/ui/intrinsics/incorrect-transmute.stderr @@ -1,4 +1,4 @@ -error[E0658]: intrinsics are subject to change +error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable --> $DIR/incorrect-transmute.rs:5:8 | LL | extern "rust-intrinsic" fn transmute() {} From 54ff6e0ad5bd93120954384da137152be5eed1d5 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Wed, 5 Feb 2025 12:22:28 -0800 Subject: [PATCH 050/128] compiler: remove rustc_target::spec::abi reexports --- Cargo.lock | 1 + compiler/rustc_ast_lowering/src/delegation.rs | 4 ++-- compiler/rustc_ast_passes/src/ast_validation.rs | 4 ++-- compiler/rustc_codegen_ssa/src/codegen_attrs.rs | 5 +++-- compiler/rustc_driver_impl/Cargo.toml | 1 + compiler/rustc_driver_impl/src/lib.rs | 2 +- compiler/rustc_passes/src/naked_functions.rs | 6 +++--- compiler/rustc_target/src/spec/mod.rs | 4 ---- 8 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 15feae4b1932..afd56d8a7341 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3702,6 +3702,7 @@ version = "0.0.0" dependencies = [ "ctrlc", "libc", + "rustc_abi", "rustc_ast", "rustc_ast_lowering", "rustc_ast_passes", diff --git a/compiler/rustc_ast_lowering/src/delegation.rs b/compiler/rustc_ast_lowering/src/delegation.rs index f9fe4938ca8b..d8b7cb0c3225 100644 --- a/compiler/rustc_ast_lowering/src/delegation.rs +++ b/compiler/rustc_ast_lowering/src/delegation.rs @@ -41,13 +41,13 @@ use std::iter; use ast::visit::Visitor; use hir::def::{DefKind, PartialRes, Res}; use hir::{BodyId, HirId}; +use rustc_abi::ExternAbi; use rustc_ast::*; use rustc_errors::ErrorGuaranteed; use rustc_hir::def_id::DefId; use rustc_middle::span_bug; use rustc_middle::ty::{Asyncness, ResolverAstLowering}; use rustc_span::{Ident, Span}; -use rustc_target::spec::abi; use {rustc_ast as ast, rustc_hir as hir}; use super::{GenericArgsMode, ImplTraitContext, LoweringContext, ParamMode}; @@ -398,7 +398,7 @@ impl<'hir> LoweringContext<'_, 'hir> { safety: hir::Safety::Safe.into(), constness: hir::Constness::NotConst, asyncness: hir::IsAsync::NotAsync, - abi: abi::Abi::Rust, + abi: ExternAbi::Rust, } } diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index 0049c5b4823c..f9f4035cb22f 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -20,6 +20,7 @@ use std::mem; use std::ops::{Deref, DerefMut}; use itertools::{Either, Itertools}; +use rustc_abi::ExternAbi; use rustc_ast::ptr::P; use rustc_ast::visit::{AssocCtxt, BoundKind, FnCtxt, FnKind, Visitor, walk_list}; use rustc_ast::*; @@ -35,7 +36,6 @@ use rustc_session::lint::builtin::{ }; use rustc_session::lint::{BuiltinLintDiag, LintBuffer}; use rustc_span::{Ident, Span, kw, sym}; -use rustc_target::spec::abi; use thin_vec::thin_vec; use crate::errors::{self, TildeConstReason}; @@ -723,7 +723,7 @@ impl<'a> AstValidator<'a> { MISSING_ABI, id, span, - BuiltinLintDiag::MissingAbi(span, abi::Abi::FALLBACK), + BuiltinLintDiag::MissingAbi(span, ExternAbi::FALLBACK), ) } } diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs index 7acdbd19993d..2888cd92c245 100644 --- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs +++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs @@ -1,5 +1,6 @@ use std::str::FromStr; +use rustc_abi::ExternAbi; use rustc_ast::attr::list_contains_name; use rustc_ast::expand::autodiff_attrs::{ AutoDiffAttrs, DiffActivity, DiffMode, valid_input_activity, valid_ret_activity, @@ -23,7 +24,7 @@ use rustc_middle::ty::{self as ty, TyCtxt}; use rustc_session::parse::feature_err; use rustc_session::{Session, lint}; use rustc_span::{Ident, Span, sym}; -use rustc_target::spec::{SanitizerSet, abi}; +use rustc_target::spec::SanitizerSet; use tracing::debug; use crate::errors; @@ -219,7 +220,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { if !is_closure && let Some(fn_sig) = fn_sig() - && fn_sig.skip_binder().abi() != abi::Abi::Rust + && fn_sig.skip_binder().abi() != ExternAbi::Rust { struct_span_code_err!( tcx.dcx(), diff --git a/compiler/rustc_driver_impl/Cargo.toml b/compiler/rustc_driver_impl/Cargo.toml index 07b88e59723d..0b45e5786e83 100644 --- a/compiler/rustc_driver_impl/Cargo.toml +++ b/compiler/rustc_driver_impl/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" [dependencies] # tidy-alphabetical-start +rustc_abi = { path = "../rustc_abi" } rustc_ast = { path = "../rustc_ast" } rustc_ast_lowering = { path = "../rustc_ast_lowering" } rustc_ast_passes = { path = "../rustc_ast_passes" } diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 4c47ce93dd56..6efd11a8c3c0 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -747,7 +747,7 @@ fn print_crate_info( } } CallingConventions => { - let mut calling_conventions = rustc_target::spec::abi::all_names(); + let mut calling_conventions = rustc_abi::all_names(); calling_conventions.sort_unstable(); println_info!("{}", calling_conventions.join("\n")); } diff --git a/compiler/rustc_passes/src/naked_functions.rs b/compiler/rustc_passes/src/naked_functions.rs index 1e165b22e51c..875b6edb58cb 100644 --- a/compiler/rustc_passes/src/naked_functions.rs +++ b/compiler/rustc_passes/src/naked_functions.rs @@ -1,5 +1,6 @@ //! Checks validity of naked functions. +use rustc_abi::ExternAbi; use rustc_hir as hir; use rustc_hir::def::DefKind; use rustc_hir::def_id::{LocalDefId, LocalModDefId}; @@ -11,7 +12,6 @@ use rustc_middle::span_bug; use rustc_middle::ty::TyCtxt; use rustc_session::lint::builtin::UNDEFINED_NAKED_FUNCTION_ABI; use rustc_span::{Span, sym}; -use rustc_target::spec::abi::Abi; use crate::errors::{ NakedAsmOutsideNakedFn, NakedFunctionsAsmBlock, NakedFunctionsMustNakedAsm, NoPatterns, @@ -61,8 +61,8 @@ fn check_mod_naked_functions(tcx: TyCtxt<'_>, module_def_id: LocalModDefId) { } /// Checks that function uses non-Rust ABI. -fn check_abi(tcx: TyCtxt<'_>, def_id: LocalDefId, abi: Abi) { - if abi == Abi::Rust { +fn check_abi(tcx: TyCtxt<'_>, def_id: LocalDefId, abi: ExternAbi) { + if abi == ExternAbi::Rust { let hir_id = tcx.local_def_id_to_hir_id(def_id); let span = tcx.def_span(def_id); tcx.emit_node_span_lint( diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index b243d9a28793..411c7af87263 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -57,10 +57,6 @@ use crate::spec::crt_objects::CrtObjects; pub mod crt_objects; -pub mod abi { - pub use rustc_abi::{AbiUnsupported, ExternAbi as Abi, all_names, lookup}; -} - mod base; mod json; From cd9d39e3604680db58acbe409590d495e883d053 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Fri, 7 Feb 2025 12:18:15 -0800 Subject: [PATCH 051/128] compiler: remove `abi`-specific `extern "{abi}"` suggestions These are either residue of a long-term migration away from something, or are simply trying too hard to be specifically useful: nearest-match suggestions for ABI strings should handle this. --- compiler/rustc_abi/src/extern_abi.rs | 25 +++++-------------- compiler/rustc_abi/src/extern_abi/tests.rs | 2 +- compiler/rustc_ast_lowering/src/errors.rs | 17 +------------ compiler/rustc_ast_lowering/src/item.rs | 13 +++------- tests/ui/abi/removed-wasm-abi.rs | 4 --- tests/ui/abi/removed-wasm-abi.stderr | 12 --------- ...cv-discoverability-guidance.riscv32.stderr | 4 +-- ...cv-discoverability-guidance.riscv64.stderr | 4 +-- .../ui/abi/riscv-discoverability-guidance.rs | 2 -- 9 files changed, 14 insertions(+), 69 deletions(-) delete mode 100644 tests/ui/abi/removed-wasm-abi.rs delete mode 100644 tests/ui/abi/removed-wasm-abi.stderr diff --git a/compiler/rustc_abi/src/extern_abi.rs b/compiler/rustc_abi/src/extern_abi.rs index faa952b6e2cf..f3cf7f583ceb 100644 --- a/compiler/rustc_abi/src/extern_abi.rs +++ b/compiler/rustc_abi/src/extern_abi.rs @@ -141,27 +141,14 @@ pub const AbiDatas: &[AbiData] = &[ ]; #[derive(Copy, Clone, Debug)] -pub enum AbiUnsupported { - Unrecognized, - Reason { explain: &'static str }, -} - +pub struct AbiUnsupported {} /// Returns the ABI with the given name (if any). pub fn lookup(name: &str) -> Result { - AbiDatas.iter().find(|abi_data| name == abi_data.name).map(|&x| x.abi).ok_or_else(|| match name { - "riscv-interrupt" => AbiUnsupported::Reason { - explain: "please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively", - }, - "riscv-interrupt-u" => AbiUnsupported::Reason { - explain: "user-mode interrupt handlers have been removed from LLVM pending standardization, see: https://reviews.llvm.org/D149314", - }, - "wasm" => AbiUnsupported::Reason { - explain: "non-standard wasm ABI is no longer supported", - }, - - _ => AbiUnsupported::Unrecognized, - - }) + AbiDatas + .iter() + .find(|abi_data| name == abi_data.name) + .map(|&x| x.abi) + .ok_or_else(|| AbiUnsupported {}) } pub fn all_names() -> Vec<&'static str> { diff --git a/compiler/rustc_abi/src/extern_abi/tests.rs b/compiler/rustc_abi/src/extern_abi/tests.rs index 4823058dd697..72c0f183d50c 100644 --- a/compiler/rustc_abi/src/extern_abi/tests.rs +++ b/compiler/rustc_abi/src/extern_abi/tests.rs @@ -18,7 +18,7 @@ fn lookup_cdecl() { #[test] fn lookup_baz() { let abi = lookup("baz"); - assert_matches!(abi, Err(AbiUnsupported::Unrecognized)); + assert_matches!(abi, Err(AbiUnsupported {})); } #[test] diff --git a/compiler/rustc_ast_lowering/src/errors.rs b/compiler/rustc_ast_lowering/src/errors.rs index f727691bf479..9f69387b7b71 100644 --- a/compiler/rustc_ast_lowering/src/errors.rs +++ b/compiler/rustc_ast_lowering/src/errors.rs @@ -1,5 +1,5 @@ +use rustc_errors::DiagArgFromDisplay; use rustc_errors::codes::*; -use rustc_errors::{Diag, DiagArgFromDisplay, EmissionGuarantee, SubdiagMessageOp, Subdiagnostic}; use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_span::{Ident, Span, Symbol}; @@ -32,8 +32,6 @@ pub(crate) struct InvalidAbi { pub abi: Symbol, pub command: String, #[subdiagnostic] - pub explain: Option, - #[subdiagnostic] pub suggestion: Option, } @@ -45,19 +43,6 @@ pub(crate) struct TupleStructWithDefault { pub span: Span, } -pub(crate) struct InvalidAbiReason(pub &'static str); - -impl Subdiagnostic for InvalidAbiReason { - fn add_to_diag_with>( - self, - diag: &mut Diag<'_, G>, - _: &F, - ) { - #[allow(rustc::untranslatable_diagnostic)] - diag.note(self.0); - } -} - #[derive(Subdiagnostic)] #[suggestion( ast_lowering_invalid_abi_suggestion, diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index a77ebb7e9906..75b08e16cdbd 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -17,8 +17,7 @@ use thin_vec::ThinVec; use tracing::instrument; use super::errors::{ - InvalidAbi, InvalidAbiReason, InvalidAbiSuggestion, MisplacedRelaxTraitBound, - TupleStructWithDefault, + InvalidAbi, InvalidAbiSuggestion, MisplacedRelaxTraitBound, TupleStructWithDefault, }; use super::stability::{enabled_names, gate_unstable_abi}; use super::{ @@ -1482,8 +1481,8 @@ impl<'hir> LoweringContext<'_, 'hir> { pub(super) fn lower_abi(&mut self, abi_str: StrLit) -> ExternAbi { let ast::StrLit { symbol_unescaped, span, .. } = abi_str; - let extern_abi = rustc_abi::lookup(symbol_unescaped.as_str()).unwrap_or_else(|err| { - self.error_on_invalid_abi(abi_str, err); + let extern_abi = rustc_abi::lookup(symbol_unescaped.as_str()).unwrap_or_else(|_| { + self.error_on_invalid_abi(abi_str); ExternAbi::Rust }); let sess = self.tcx.sess; @@ -1500,7 +1499,7 @@ impl<'hir> LoweringContext<'_, 'hir> { } } - fn error_on_invalid_abi(&self, abi: StrLit, err: rustc_abi::AbiUnsupported) { + fn error_on_invalid_abi(&self, abi: StrLit) { let abi_names = enabled_names(self.tcx.features(), abi.span) .iter() .map(|s| Symbol::intern(s)) @@ -1509,10 +1508,6 @@ impl<'hir> LoweringContext<'_, 'hir> { self.dcx().emit_err(InvalidAbi { abi: abi.symbol_unescaped, span: abi.span, - explain: match err { - rustc_abi::AbiUnsupported::Reason { explain } => Some(InvalidAbiReason(explain)), - _ => None, - }, suggestion: suggested_name.map(|suggested_name| InvalidAbiSuggestion { span: abi.span, suggestion: format!("\"{suggested_name}\""), diff --git a/tests/ui/abi/removed-wasm-abi.rs b/tests/ui/abi/removed-wasm-abi.rs deleted file mode 100644 index a45e42bfe020..000000000000 --- a/tests/ui/abi/removed-wasm-abi.rs +++ /dev/null @@ -1,4 +0,0 @@ -extern "wasm" fn test() {} -//~^ ERROR invalid ABI: found `wasm` - -fn main() {} diff --git a/tests/ui/abi/removed-wasm-abi.stderr b/tests/ui/abi/removed-wasm-abi.stderr deleted file mode 100644 index 6007c4e25801..000000000000 --- a/tests/ui/abi/removed-wasm-abi.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0703]: invalid ABI: found `wasm` - --> $DIR/removed-wasm-abi.rs:1:8 - | -LL | extern "wasm" fn test() {} - | ^^^^^^ invalid ABI - | - = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions - = note: non-standard wasm ABI is no longer supported - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0703`. diff --git a/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr b/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr index e80411fda344..e1f433479857 100644 --- a/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr +++ b/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr @@ -8,10 +8,9 @@ LL | extern "riscv-interrupt" fn isr() {} | help: did you mean: `"riscv-interrupt-m"` | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions - = note: please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively error[E0703]: invalid ABI: found `riscv-interrupt-u` - --> $DIR/riscv-discoverability-guidance.rs:23:8 + --> $DIR/riscv-discoverability-guidance.rs:22:8 | LL | extern "riscv-interrupt-u" fn isr_U() {} | ^^^^^^^^^^^^^^^^^^^ @@ -20,7 +19,6 @@ LL | extern "riscv-interrupt-u" fn isr_U() {} | help: did you mean: `"riscv-interrupt-m"` | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions - = note: user-mode interrupt handlers have been removed from LLVM pending standardization, see: https://reviews.llvm.org/D149314 error: aborting due to 2 previous errors diff --git a/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr b/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr index e80411fda344..e1f433479857 100644 --- a/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr +++ b/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr @@ -8,10 +8,9 @@ LL | extern "riscv-interrupt" fn isr() {} | help: did you mean: `"riscv-interrupt-m"` | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions - = note: please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively error[E0703]: invalid ABI: found `riscv-interrupt-u` - --> $DIR/riscv-discoverability-guidance.rs:23:8 + --> $DIR/riscv-discoverability-guidance.rs:22:8 | LL | extern "riscv-interrupt-u" fn isr_U() {} | ^^^^^^^^^^^^^^^^^^^ @@ -20,7 +19,6 @@ LL | extern "riscv-interrupt-u" fn isr_U() {} | help: did you mean: `"riscv-interrupt-m"` | = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions - = note: user-mode interrupt handlers have been removed from LLVM pending standardization, see: https://reviews.llvm.org/D149314 error: aborting due to 2 previous errors diff --git a/tests/ui/abi/riscv-discoverability-guidance.rs b/tests/ui/abi/riscv-discoverability-guidance.rs index 1b189d907baf..dec5059b0a7f 100644 --- a/tests/ui/abi/riscv-discoverability-guidance.rs +++ b/tests/ui/abi/riscv-discoverability-guidance.rs @@ -18,10 +18,8 @@ extern "riscv-interrupt" fn isr() {} //~^ ERROR invalid ABI //~^^ NOTE invalid ABI //~^^^ NOTE invoke `rustc --print=calling-conventions` for a full list of supported calling conventions -//~^^^^ NOTE please use one of riscv-interrupt-m or riscv-interrupt-s extern "riscv-interrupt-u" fn isr_U() {} //~^ ERROR invalid ABI //~^^ NOTE invalid ABI //~^^^ NOTE invoke `rustc --print=calling-conventions` for a full list of supported calling conventions -//~^^^^ NOTE user-mode interrupt handlers have been removed from LLVM pending standardization From f842ee824534e2dbf3c2976f8007890b2238e3c5 Mon Sep 17 00:00:00 2001 From: Bastian Kersting Date: Fri, 24 Jan 2025 14:08:30 +0000 Subject: [PATCH 052/128] Rename rustc_middle::Ty::is_unsafe_ptr to is_raw_ptr The wording unsafe pointer is less common and not mentioned in a lot of places, instead this is usually called a "raw pointer". For the sake of uniformity, we rename this method. This came up during the review of https://github.com/rust-lang/rust/pull/134424. --- compiler/rustc_borrowck/src/diagnostics/mod.rs | 2 +- compiler/rustc_codegen_ssa/src/mir/block.rs | 4 ++-- compiler/rustc_codegen_ssa/src/mir/intrinsic.rs | 8 ++++---- compiler/rustc_codegen_ssa/src/mir/rvalue.rs | 2 +- compiler/rustc_const_eval/src/check_consts/check.rs | 2 +- compiler/rustc_const_eval/src/interpret/cast.rs | 4 ++-- compiler/rustc_const_eval/src/interpret/step.rs | 2 +- compiler/rustc_hir_typeck/src/cast.rs | 2 +- compiler/rustc_hir_typeck/src/expr.rs | 2 +- compiler/rustc_hir_typeck/src/method/probe.rs | 4 ++-- compiler/rustc_hir_typeck/src/op.rs | 6 +++--- compiler/rustc_hir_typeck/src/upvar.rs | 6 +++--- compiler/rustc_lint/src/builtin.rs | 2 +- compiler/rustc_middle/src/ty/layout.rs | 4 ++-- compiler/rustc_middle/src/ty/sty.rs | 4 ++-- compiler/rustc_mir_build/src/check_unsafety.rs | 2 +- compiler/rustc_mir_transform/src/check_pointers.rs | 2 +- .../rustc_mir_transform/src/check_undefined_transmutes.rs | 2 +- compiler/rustc_mir_transform/src/gvn.rs | 4 ++-- compiler/rustc_ty_utils/src/abi.rs | 2 +- compiler/rustc_ty_utils/src/layout.rs | 2 +- .../clippy/clippy_lints/src/casts/cast_ptr_alignment.rs | 2 +- src/tools/clippy/clippy_lints/src/dereference.rs | 2 +- .../clippy_lints/src/multiple_unsafe_ops_per_block.rs | 2 +- src/tools/clippy/clippy_lints/src/pass_by_ref_or_value.rs | 6 +++--- src/tools/clippy/clippy_lints/src/ptr_offset_with_cast.rs | 2 +- src/tools/clippy/clippy_utils/src/eager_or_lazy.rs | 2 +- src/tools/clippy/clippy_utils/src/visitors.rs | 2 +- 28 files changed, 43 insertions(+), 43 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index 860c7c267ea9..df83ac985c65 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -570,7 +570,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { // If we didn't find an overloaded deref or index, then assume it's a // built in deref and check the type of the base. let base_ty = deref_base.ty(self.body, tcx).ty; - if base_ty.is_unsafe_ptr() { + if base_ty.is_raw_ptr() { BorrowedContentSource::DerefRawPointer } else if base_ty.is_mutable_ptr() { BorrowedContentSource::DerefMutableRef diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index 8c571558717e..4630ed48c520 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs @@ -1013,7 +1013,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // // This is also relevant for `Pin<&mut Self>`, where we need to peel the // `Pin`. - while !op.layout.ty.is_unsafe_ptr() && !op.layout.ty.is_ref() { + while !op.layout.ty.is_raw_ptr() && !op.layout.ty.is_ref() { let (idx, _) = op.layout.non_1zst_field(bx).expect( "not exactly one non-1-ZST field in a `DispatchFromDyn` type", ); @@ -1045,7 +1045,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } Immediate(_) => { // See comment above explaining why we peel these newtypes - while !op.layout.ty.is_unsafe_ptr() && !op.layout.ty.is_ref() { + while !op.layout.ty.is_raw_ptr() && !op.layout.ty.is_ref() { let (idx, _) = op.layout.non_1zst_field(bx).expect( "not exactly one non-1-ZST field in a `DispatchFromDyn` type", ); diff --git a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs index 6e7fbe62c8df..b34e966ba6ce 100644 --- a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs +++ b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs @@ -367,7 +367,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { bx.sess().dcx().emit_fatal(errors::AtomicCompareExchange); }; let ty = fn_args.type_at(0); - if int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_unsafe_ptr() { + if int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_raw_ptr() { let weak = instruction == "cxchgweak"; let dst = args[0].immediate(); let cmp = args[1].immediate(); @@ -395,7 +395,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { "load" => { let ty = fn_args.type_at(0); - if int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_unsafe_ptr() { + if int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_raw_ptr() { let layout = bx.layout_of(ty); let size = layout.size; let source = args[0].immediate(); @@ -413,7 +413,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { "store" => { let ty = fn_args.type_at(0); - if int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_unsafe_ptr() { + if int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_raw_ptr() { let size = bx.layout_of(ty).size; let val = args[1].immediate(); let ptr = args[0].immediate(); @@ -458,7 +458,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { }; let ty = fn_args.type_at(0); - if int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_unsafe_ptr() { + if int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_raw_ptr() { let ptr = args[0].immediate(); let val = args[1].immediate(); bx.atomic_rmw(atom_op, ptr, val, parse_ordering(bx, ordering)) diff --git a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs index 27cb7883b9a6..3b7fefee80a3 100644 --- a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs +++ b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs @@ -689,7 +689,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { (OperandValue::Immediate(llval), operand.layout) } mir::UnOp::PtrMetadata => { - assert!(operand.layout.ty.is_unsafe_ptr() || operand.layout.ty.is_ref(),); + assert!(operand.layout.ty.is_raw_ptr() || operand.layout.ty.is_ref(),); let (_, meta) = operand.val.pointer_parts(); assert_eq!(operand.layout.fields.count() > 1, meta.is_some()); if let Some(meta) = meta { diff --git a/compiler/rustc_const_eval/src/check_consts/check.rs b/compiler/rustc_const_eval/src/check_consts/check.rs index d0ce027ec2b7..90002d3f1090 100644 --- a/compiler/rustc_const_eval/src/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/check_consts/check.rs @@ -710,7 +710,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { if is_int_bool_float_or_char(lhs_ty) && is_int_bool_float_or_char(rhs_ty) { // Int, bool, float, and char operations are fine. - } else if lhs_ty.is_fn_ptr() || lhs_ty.is_unsafe_ptr() { + } else if lhs_ty.is_fn_ptr() || lhs_ty.is_raw_ptr() { assert_matches!( op, BinOp::Eq diff --git a/compiler/rustc_const_eval/src/interpret/cast.rs b/compiler/rustc_const_eval/src/interpret/cast.rs index e110c155da08..b53c1505f6b1 100644 --- a/compiler/rustc_const_eval/src/interpret/cast.rs +++ b/compiler/rustc_const_eval/src/interpret/cast.rs @@ -203,7 +203,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { cast_to: TyAndLayout<'tcx>, ) -> InterpResult<'tcx, ImmTy<'tcx, M::Provenance>> { assert!(src.layout.ty.is_any_ptr()); - assert!(cast_to.ty.is_unsafe_ptr()); + assert!(cast_to.ty.is_raw_ptr()); // Handle casting any ptr to raw ptr (might be a wide ptr). if cast_to.size == src.layout.size { // Thin or wide pointer that just has the ptr kind of target type changed. @@ -212,7 +212,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { // Casting the metadata away from a wide ptr. assert_eq!(src.layout.size, 2 * self.pointer_size()); assert_eq!(cast_to.size, self.pointer_size()); - assert!(src.layout.ty.is_unsafe_ptr()); + assert!(src.layout.ty.is_raw_ptr()); return match **src { Immediate::ScalarPair(data, _) => interp_ok(ImmTy::from_scalar(data, cast_to)), Immediate::Scalar(..) => span_bug!( diff --git a/compiler/rustc_const_eval/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs index abe73c43d8a9..6a17da61c8b7 100644 --- a/compiler/rustc_const_eval/src/interpret/step.rs +++ b/compiler/rustc_const_eval/src/interpret/step.rs @@ -241,7 +241,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { // Figure out whether this is an addr_of of an already raw place. let place_base_raw = if place.is_indirect_first_projection() { let ty = self.frame().body.local_decls[place.local].ty; - ty.is_unsafe_ptr() + ty.is_raw_ptr() } else { // Not a deref, and thus not raw. false diff --git a/compiler/rustc_hir_typeck/src/cast.rs b/compiler/rustc_hir_typeck/src/cast.rs index d8015bcc9142..f5f6ada12c3c 100644 --- a/compiler/rustc_hir_typeck/src/cast.rs +++ b/compiler/rustc_hir_typeck/src/cast.rs @@ -690,7 +690,7 @@ impl<'a, 'tcx> CastCheck<'tcx> { } else { match self.try_coercion_cast(fcx) { Ok(()) => { - if self.expr_ty.is_unsafe_ptr() && self.cast_ty.is_unsafe_ptr() { + if self.expr_ty.is_raw_ptr() && self.cast_ty.is_raw_ptr() { // When casting a raw pointer to another raw pointer, we cannot convert the cast into // a coercion because the pointee types might only differ in regions, which HIR typeck // cannot distinguish. This would cause us to erroneously discard a cast which will diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index 9dd965a4dcbb..9ccd67460874 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -3556,7 +3556,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - if base_t.is_unsafe_ptr() && idx_t.is_integral() { + if base_t.is_raw_ptr() && idx_t.is_integral() { err.multipart_suggestion( "consider using `wrapping_add` or `add` for indexing into raw pointer", vec![ diff --git a/compiler/rustc_hir_typeck/src/method/probe.rs b/compiler/rustc_hir_typeck/src/method/probe.rs index b9d1f93bfb8e..9394fcafd767 100644 --- a/compiler/rustc_hir_typeck/src/method/probe.rs +++ b/compiler/rustc_hir_typeck/src/method/probe.rs @@ -598,7 +598,7 @@ fn method_autoderef_steps<'tcx>( unsize: false, reachable_via_deref, }; - if ty.is_unsafe_ptr() { + if ty.is_raw_ptr() { // all the subsequent steps will be from_unsafe_deref reached_raw_pointer = true; } @@ -618,7 +618,7 @@ fn method_autoderef_steps<'tcx>( unsize: false, reachable_via_deref: true, }; - if ty.is_unsafe_ptr() { + if ty.is_raw_ptr() { // all the subsequent steps will be from_unsafe_deref reached_raw_pointer = true; } diff --git a/compiler/rustc_hir_typeck/src/op.rs b/compiler/rustc_hir_typeck/src/op.rs index fc07c9858494..1750c2af1c7f 100644 --- a/compiler/rustc_hir_typeck/src/op.rs +++ b/compiler/rustc_hir_typeck/src/op.rs @@ -645,7 +645,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // pointer + {integer} or pointer - pointer. if op.span.can_be_used_for_suggestions() { match op.node { - hir::BinOpKind::Add if lhs_ty.is_unsafe_ptr() && rhs_ty.is_integral() => { + hir::BinOpKind::Add if lhs_ty.is_raw_ptr() && rhs_ty.is_integral() => { err.multipart_suggestion( "consider using `wrapping_add` or `add` for pointer + {integer}", vec![ @@ -659,7 +659,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); } hir::BinOpKind::Sub => { - if lhs_ty.is_unsafe_ptr() && rhs_ty.is_integral() { + if lhs_ty.is_raw_ptr() && rhs_ty.is_integral() { err.multipart_suggestion( "consider using `wrapping_sub` or `sub` for \ pointer - {integer}", @@ -674,7 +674,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); } - if lhs_ty.is_unsafe_ptr() && rhs_ty.is_unsafe_ptr() { + if lhs_ty.is_raw_ptr() && rhs_ty.is_raw_ptr() { err.multipart_suggestion( "consider using `offset_from` for pointer - pointer if the \ pointers point to the same allocation", diff --git a/compiler/rustc_hir_typeck/src/upvar.rs b/compiler/rustc_hir_typeck/src/upvar.rs index c986429c1b24..9a5ce555d58e 100644 --- a/compiler/rustc_hir_typeck/src/upvar.rs +++ b/compiler/rustc_hir_typeck/src/upvar.rs @@ -2042,7 +2042,7 @@ impl<'tcx> euv::Delegate<'tcx> for InferBorrowKind<'tcx> { restrict_repr_packed_field_ref_capture(place_with_id.place.clone(), capture_kind); // Raw pointers don't inherit mutability - if place_with_id.place.deref_tys().any(Ty::is_unsafe_ptr) { + if place_with_id.place.deref_tys().any(Ty::is_raw_ptr) { capture_kind = ty::UpvarCapture::ByRef(ty::BorrowKind::Immutable); } @@ -2093,7 +2093,7 @@ fn restrict_precision_for_unsafe( mut place: Place<'_>, mut curr_mode: ty::UpvarCapture, ) -> (Place<'_>, ty::UpvarCapture) { - if place.base_ty.is_unsafe_ptr() { + if place.base_ty.is_raw_ptr() { truncate_place_to_len_and_update_capture_kind(&mut place, &mut curr_mode, 0); } @@ -2102,7 +2102,7 @@ fn restrict_precision_for_unsafe( } for (i, proj) in place.projections.iter().enumerate() { - if proj.ty.is_unsafe_ptr() { + if proj.ty.is_raw_ptr() { // Don't apply any projections on top of an unsafe ptr. truncate_place_to_len_and_update_capture_kind(&mut place, &mut curr_mode, i + 1); break; diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index 5e6b854ff52e..ecd40a52e75f 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -576,7 +576,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations { // and recommending Copy might be a bad idea. for field in def.all_fields() { let did = field.did; - if cx.tcx.type_of(did).instantiate_identity().is_unsafe_ptr() { + if cx.tcx.type_of(did).instantiate_identity().is_raw_ptr() { return; } } diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index e5015ea3c3d1..c28826dab72a 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -369,7 +369,7 @@ impl<'tcx> SizeSkeleton<'tcx> { match *ty.kind() { ty::Ref(_, pointee, _) | ty::RawPtr(pointee, _) => { - let non_zero = !ty.is_unsafe_ptr(); + let non_zero = !ty.is_raw_ptr(); let tail = tcx.struct_tail_raw( pointee, @@ -841,7 +841,7 @@ where // as the `Abi` or `FieldsShape` is checked by users. if i == 0 { let nil = tcx.types.unit; - let unit_ptr_ty = if this.ty.is_unsafe_ptr() { + let unit_ptr_ty = if this.ty.is_raw_ptr() { Ty::new_mut_ptr(tcx, nil) } else { Ty::new_mut_ref(tcx, tcx.lifetimes.re_static, nil) diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index a9a47c87a388..a3e845c79aab 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -1199,7 +1199,7 @@ impl<'tcx> Ty<'tcx> { } #[inline] - pub fn is_unsafe_ptr(self) -> bool { + pub fn is_raw_ptr(self) -> bool { matches!(self.kind(), RawPtr(_, _)) } @@ -1207,7 +1207,7 @@ impl<'tcx> Ty<'tcx> { /// `Box` is *not* considered a pointer here! #[inline] pub fn is_any_ptr(self) -> bool { - self.is_ref() || self.is_unsafe_ptr() || self.is_fn_ptr() + self.is_ref() || self.is_raw_ptr() || self.is_fn_ptr() } #[inline] diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs index 2b9b948763f9..1bd33475e607 100644 --- a/compiler/rustc_mir_build/src/check_unsafety.rs +++ b/compiler/rustc_mir_build/src/check_unsafety.rs @@ -554,7 +554,7 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> { _ => self.requires_unsafe(expr.span, UseOfExternStatic), } } - } else if self.thir[arg].ty.is_unsafe_ptr() { + } else if self.thir[arg].ty.is_raw_ptr() { self.requires_unsafe(expr.span, DerefOfRawPointer); } } diff --git a/compiler/rustc_mir_transform/src/check_pointers.rs b/compiler/rustc_mir_transform/src/check_pointers.rs index ccaa83fd9e27..d693f739180f 100644 --- a/compiler/rustc_mir_transform/src/check_pointers.rs +++ b/compiler/rustc_mir_transform/src/check_pointers.rs @@ -190,7 +190,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PointerFinder<'a, 'tcx> { let pointer_ty = self.local_decls[place.local].ty; // We only want to check places based on raw pointers - if !pointer_ty.is_unsafe_ptr() { + if !pointer_ty.is_raw_ptr() { trace!("Indirect, but not based on an raw ptr, not checking {:?}", place); return; } diff --git a/compiler/rustc_mir_transform/src/check_undefined_transmutes.rs b/compiler/rustc_mir_transform/src/check_undefined_transmutes.rs index 8ba14a1158ef..ed3b1ae4f42f 100644 --- a/compiler/rustc_mir_transform/src/check_undefined_transmutes.rs +++ b/compiler/rustc_mir_transform/src/check_undefined_transmutes.rs @@ -47,7 +47,7 @@ impl<'a, 'tcx> UndefinedTransmutesChecker<'a, 'tcx> { { let fn_sig = function.ty(self.body, self.tcx).fn_sig(self.tcx).skip_binder(); if let [input] = fn_sig.inputs() { - return input.is_unsafe_ptr() && fn_sig.output().is_integral(); + return input.is_raw_ptr() && fn_sig.output().is_integral(); } } false diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs index 1a2120ecd710..77a3854ebdef 100644 --- a/compiler/rustc_mir_transform/src/gvn.rs +++ b/compiler/rustc_mir_transform/src/gvn.rs @@ -1397,8 +1397,8 @@ impl<'body, 'tcx> VnState<'body, 'tcx> { // or `*mut [i32]` <=> `*const [u64]`), including the common special // case of `*const T` <=> `*mut T`. if let Transmute = kind - && from.is_unsafe_ptr() - && to.is_unsafe_ptr() + && from.is_raw_ptr() + && to.is_raw_ptr() && self.pointers_have_same_metadata(from, to) { kind = PtrToPtr; diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs index 169f3a78c26a..86dbe9877906 100644 --- a/compiler/rustc_ty_utils/src/abi.rs +++ b/compiler/rustc_ty_utils/src/abi.rs @@ -753,7 +753,7 @@ fn make_thin_self_ptr<'tcx>( // To get the type `*mut RcInner`, we just keep unwrapping newtypes until we // get a built-in pointer type let mut wide_pointer_layout = layout; - while !wide_pointer_layout.ty.is_unsafe_ptr() && !wide_pointer_layout.ty.is_ref() { + while !wide_pointer_layout.ty.is_raw_ptr() && !wide_pointer_layout.ty.is_ref() { wide_pointer_layout = wide_pointer_layout .non_1zst_field(cx) .expect("not exactly one non-1-ZST field in a `DispatchFromDyn` type") diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs index ce8dc3a2515d..ee271048fc17 100644 --- a/compiler/rustc_ty_utils/src/layout.rs +++ b/compiler/rustc_ty_utils/src/layout.rs @@ -269,7 +269,7 @@ fn layout_of_uncached<'tcx>( // Potentially-wide pointers. ty::Ref(_, pointee, _) | ty::RawPtr(pointee, _) => { let mut data_ptr = scalar_unit(Pointer(AddressSpace::DATA)); - if !ty.is_unsafe_ptr() { + if !ty.is_raw_ptr() { data_ptr.valid_range_mut().start = 1; } diff --git a/src/tools/clippy/clippy_lints/src/casts/cast_ptr_alignment.rs b/src/tools/clippy/clippy_lints/src/casts/cast_ptr_alignment.rs index e4c0db5d9ef0..57a135abc2e2 100644 --- a/src/tools/clippy/clippy_lints/src/casts/cast_ptr_alignment.rs +++ b/src/tools/clippy/clippy_lints/src/casts/cast_ptr_alignment.rs @@ -66,7 +66,7 @@ fn is_used_as_unaligned(cx: &LateContext<'_>, e: &Expr<'_>) -> bool { if matches!(name.ident.as_str(), "read_unaligned" | "write_unaligned") && let Some(def_id) = cx.typeck_results().type_dependent_def_id(parent.hir_id) && let Some(def_id) = cx.tcx.impl_of_method(def_id) - && cx.tcx.type_of(def_id).instantiate_identity().is_unsafe_ptr() + && cx.tcx.type_of(def_id).instantiate_identity().is_raw_ptr() { true } else { diff --git a/src/tools/clippy/clippy_lints/src/dereference.rs b/src/tools/clippy/clippy_lints/src/dereference.rs index 233ebe00d8e7..849c60b89b97 100644 --- a/src/tools/clippy/clippy_lints/src/dereference.rs +++ b/src/tools/clippy/clippy_lints/src/dereference.rs @@ -682,7 +682,7 @@ fn try_parse_ref_op<'tcx>( }, [arg], ) => (true, typeck.qpath_res(path, *hir_id).opt_def_id()?, arg), - ExprKind::Unary(UnOp::Deref, sub_expr) if !typeck.expr_ty(sub_expr).is_unsafe_ptr() => { + ExprKind::Unary(UnOp::Deref, sub_expr) if !typeck.expr_ty(sub_expr).is_raw_ptr() => { return Some((RefOp::Deref, sub_expr)); }, ExprKind::AddrOf(BorrowKind::Ref, mutability, sub_expr) => return Some((RefOp::AddrOf(mutability), sub_expr)), diff --git a/src/tools/clippy/clippy_lints/src/multiple_unsafe_ops_per_block.rs b/src/tools/clippy/clippy_lints/src/multiple_unsafe_ops_per_block.rs index 9acede4f32d6..2adc27c0b709 100644 --- a/src/tools/clippy/clippy_lints/src/multiple_unsafe_ops_per_block.rs +++ b/src/tools/clippy/clippy_lints/src/multiple_unsafe_ops_per_block.rs @@ -122,7 +122,7 @@ fn collect_unsafe_exprs<'tcx>( unsafe_ops.push(("access of a mutable static occurs here", expr.span)); }, - ExprKind::Unary(UnOp::Deref, e) if cx.typeck_results().expr_ty_adjusted(e).is_unsafe_ptr() => { + ExprKind::Unary(UnOp::Deref, e) if cx.typeck_results().expr_ty_adjusted(e).is_raw_ptr() => { unsafe_ops.push(("raw pointer dereference occurs here", expr.span)); }, diff --git a/src/tools/clippy/clippy_lints/src/pass_by_ref_or_value.rs b/src/tools/clippy/clippy_lints/src/pass_by_ref_or_value.rs index a3e89671eecd..95403403217a 100644 --- a/src/tools/clippy/clippy_lints/src/pass_by_ref_or_value.rs +++ b/src/tools/clippy/clippy_lints/src/pass_by_ref_or_value.rs @@ -179,10 +179,10 @@ impl PassByRefOrValue { && let hir::TyKind::Ref(_, MutTy { ty: decl_ty, .. }) = input.kind { if let Some(typeck) = cx.maybe_typeck_results() { - // Don't lint if an unsafe pointer is created. - // TODO: Limit the check only to unsafe pointers to the argument (or part of the argument) + // Don't lint if a raw pointer is created. + // TODO: Limit the check only to raw pointers to the argument (or part of the argument) // which escape the current function. - if typeck.node_types().items().any(|(_, &ty)| ty.is_unsafe_ptr()) + if typeck.node_types().items().any(|(_, &ty)| ty.is_raw_ptr()) || typeck .adjustments() .items() diff --git a/src/tools/clippy/clippy_lints/src/ptr_offset_with_cast.rs b/src/tools/clippy/clippy_lints/src/ptr_offset_with_cast.rs index 808a7e005c67..68ae575c9063 100644 --- a/src/tools/clippy/clippy_lints/src/ptr_offset_with_cast.rs +++ b/src/tools/clippy/clippy_lints/src/ptr_offset_with_cast.rs @@ -111,7 +111,7 @@ fn is_expr_ty_usize(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { // Is the type of the expression a raw pointer? fn is_expr_ty_raw_ptr(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool { - cx.typeck_results().expr_ty(expr).is_unsafe_ptr() + cx.typeck_results().expr_ty(expr).is_raw_ptr() } fn build_suggestion( diff --git a/src/tools/clippy/clippy_utils/src/eager_or_lazy.rs b/src/tools/clippy/clippy_utils/src/eager_or_lazy.rs index b5bb174e737a..aaea8d71efbe 100644 --- a/src/tools/clippy/clippy_utils/src/eager_or_lazy.rs +++ b/src/tools/clippy/clippy_utils/src/eager_or_lazy.rs @@ -217,7 +217,7 @@ fn expr_eagerness<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) -> EagernessS self.eagerness |= NoChange; }, // Dereferences should be cheap, but dereferencing a raw pointer earlier may not be safe. - ExprKind::Unary(UnOp::Deref, e) if !self.cx.typeck_results().expr_ty(e).is_unsafe_ptr() => (), + ExprKind::Unary(UnOp::Deref, e) if !self.cx.typeck_results().expr_ty(e).is_raw_ptr() => (), ExprKind::Unary(UnOp::Deref, _) => self.eagerness |= NoChange, ExprKind::Unary(_, e) if matches!( diff --git a/src/tools/clippy/clippy_utils/src/visitors.rs b/src/tools/clippy/clippy_utils/src/visitors.rs index 99984c41714b..70910f5bf52d 100644 --- a/src/tools/clippy/clippy_utils/src/visitors.rs +++ b/src/tools/clippy/clippy_utils/src/visitors.rs @@ -417,7 +417,7 @@ pub fn is_expr_unsafe<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) -> bool { } fn visit_expr(&mut self, e: &'tcx Expr<'_>) -> Self::Result { match e.kind { - ExprKind::Unary(UnOp::Deref, e) if self.cx.typeck_results().expr_ty(e).is_unsafe_ptr() => { + ExprKind::Unary(UnOp::Deref, e) if self.cx.typeck_results().expr_ty(e).is_raw_ptr() => { ControlFlow::Break(()) }, ExprKind::MethodCall(..) From 432ff5e5599d7d2de01db6a2d66c3a6e18e2c7ba Mon Sep 17 00:00:00 2001 From: Bastian Kersting Date: Fri, 24 Jan 2025 14:58:33 +0000 Subject: [PATCH 053/128] Extend the renaming to coerce_unsafe_ptr --- compiler/rustc_codegen_cranelift/src/base.rs | 4 ++-- compiler/rustc_codegen_cranelift/src/vtable.rs | 2 +- compiler/rustc_hir_typeck/src/coercion.rs | 16 ++++++++-------- compiler/rustc_hir_typeck/src/upvar.rs | 2 +- compiler/rustc_middle/src/ty/sty.rs | 2 +- compiler/stable_mir/src/ty.rs | 2 +- .../crates/hir-ty/src/infer/coerce.rs | 2 +- tests/ui/kindck/kindck-copy.rs | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/src/base.rs b/compiler/rustc_codegen_cranelift/src/base.rs index a2b9e5712e50..125a9201831c 100644 --- a/compiler/rustc_codegen_cranelift/src/base.rs +++ b/compiler/rustc_codegen_cranelift/src/base.rs @@ -900,8 +900,8 @@ fn codegen_stmt<'tcx>( }; let data = codegen_operand(fx, data); let meta = codegen_operand(fx, meta); - assert!(data.layout().ty.is_unsafe_ptr()); - assert!(layout.ty.is_unsafe_ptr()); + assert!(data.layout().ty.is_raw_ptr()); + assert!(layout.ty.is_raw_ptr()); let ptr_val = if meta.layout().is_zst() { data.cast_pointer_to(layout) } else { diff --git a/compiler/rustc_codegen_cranelift/src/vtable.rs b/compiler/rustc_codegen_cranelift/src/vtable.rs index a460023b59cb..9d9e0462a9b7 100644 --- a/compiler/rustc_codegen_cranelift/src/vtable.rs +++ b/compiler/rustc_codegen_cranelift/src/vtable.rs @@ -48,7 +48,7 @@ pub(crate) fn get_ptr_and_method_ref<'tcx>( ) -> (Pointer, Value) { let (ptr, vtable) = 'block: { if let BackendRepr::Scalar(_) = arg.layout().backend_repr { - while !arg.layout().ty.is_unsafe_ptr() && !arg.layout().ty.is_ref() { + while !arg.layout().ty.is_raw_ptr() && !arg.layout().ty.is_ref() { let (idx, _) = arg .layout() .non_1zst_field(fx) diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs index 14dd0f32d820..ad378367e305 100644 --- a/compiler/rustc_hir_typeck/src/coercion.rs +++ b/compiler/rustc_hir_typeck/src/coercion.rs @@ -219,7 +219,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { // or pin-ergonomics. match *b.kind() { ty::RawPtr(_, b_mutbl) => { - return self.coerce_unsafe_ptr(a, b, b_mutbl); + return self.coerce_raw_ptr(a, b, b_mutbl); } ty::Ref(r_b, _, mutbl_b) => { return self.coerce_borrowed_pointer(a, b, r_b, mutbl_b); @@ -1017,13 +1017,13 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { } } - fn coerce_unsafe_ptr( + fn coerce_raw_ptr( &self, a: Ty<'tcx>, b: Ty<'tcx>, mutbl_b: hir::Mutability, ) -> CoerceResult<'tcx> { - debug!("coerce_unsafe_ptr(a={:?}, b={:?})", a, b); + debug!("coerce_raw_ptr(a={:?}, b={:?})", a, b); let (is_ref, mt_a) = match *a.kind() { ty::Ref(_, ty, mutbl) => (true, ty::TypeAndMut { ty, mutbl }), @@ -1033,21 +1033,21 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { coerce_mutbls(mt_a.mutbl, mutbl_b)?; // Check that the types which they point at are compatible. - let a_unsafe = Ty::new_ptr(self.tcx, mt_a.ty, mutbl_b); - // Although references and unsafe ptrs have the same + let a_raw = Ty::new_ptr(self.tcx, mt_a.ty, mutbl_b); + // Although references and raw ptrs have the same // representation, we still register an Adjust::DerefRef so that // regionck knows that the region for `a` must be valid here. if is_ref { - self.unify_and(a_unsafe, b, |target| { + self.unify_and(a_raw, b, |target| { vec![ Adjustment { kind: Adjust::Deref(None), target: mt_a.ty }, Adjustment { kind: Adjust::Borrow(AutoBorrow::RawPtr(mutbl_b)), target }, ] }) } else if mt_a.mutbl != mutbl_b { - self.unify_and(a_unsafe, b, simple(Adjust::Pointer(PointerCoercion::MutToConstPointer))) + self.unify_and(a_raw, b, simple(Adjust::Pointer(PointerCoercion::MutToConstPointer))) } else { - self.unify_and(a_unsafe, b, identity) + self.unify_and(a_raw, b, identity) } } } diff --git a/compiler/rustc_hir_typeck/src/upvar.rs b/compiler/rustc_hir_typeck/src/upvar.rs index 9a5ce555d58e..dacbadbcd005 100644 --- a/compiler/rustc_hir_typeck/src/upvar.rs +++ b/compiler/rustc_hir_typeck/src/upvar.rs @@ -2103,7 +2103,7 @@ fn restrict_precision_for_unsafe( for (i, proj) in place.projections.iter().enumerate() { if proj.ty.is_raw_ptr() { - // Don't apply any projections on top of an unsafe ptr. + // Don't apply any projections on top of a raw ptr. truncate_place_to_len_and_update_capture_kind(&mut place, &mut curr_mode, i + 1); break; } diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index a3e845c79aab..8a31b2960188 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -1394,7 +1394,7 @@ impl<'tcx> Ty<'tcx> { /// Returns the type and mutability of `*ty`. /// /// The parameter `explicit` indicates if this is an *explicit* dereference. - /// Some types -- notably unsafe ptrs -- can only be dereferenced explicitly. + /// Some types -- notably raw ptrs -- can only be dereferenced explicitly. pub fn builtin_deref(self, explicit: bool) -> Option> { match *self.kind() { _ if let Some(boxed) = self.boxed_ty() => Some(boxed), diff --git a/compiler/stable_mir/src/ty.rs b/compiler/stable_mir/src/ty.rs index 3434597e7b05..9ef80edb82a6 100644 --- a/compiler/stable_mir/src/ty.rs +++ b/compiler/stable_mir/src/ty.rs @@ -489,7 +489,7 @@ impl TyKind { /// Returns the type and mutability of `*ty` for builtin types. /// /// The parameter `explicit` indicates if this is an *explicit* dereference. - /// Some types -- notably unsafe ptrs -- can only be dereferenced explicitly. + /// Some types -- notably raw ptrs -- can only be dereferenced explicitly. pub fn builtin_deref(&self, explicit: bool) -> Option { match self.rigid()? { RigidTy::Adt(def, args) if def.is_box() => { diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/infer/coerce.rs b/src/tools/rust-analyzer/crates/hir-ty/src/infer/coerce.rs index d40816ba8ced..956d4de07150 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/infer/coerce.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer/coerce.rs @@ -373,7 +373,7 @@ impl InferenceTable<'_> { // Check that the types which they point at are compatible. let from_raw = TyKind::Raw(to_mt, from_inner.clone()).intern(Interner); - // Although references and unsafe ptrs have the same + // Although references and raw ptrs have the same // representation, we still register an Adjust::DerefRef so that // regionck knows that the region for `a` must be valid here. if is_ref { diff --git a/tests/ui/kindck/kindck-copy.rs b/tests/ui/kindck/kindck-copy.rs index 6df98c230ea7..36bf0d2b785f 100644 --- a/tests/ui/kindck/kindck-copy.rs +++ b/tests/ui/kindck/kindck-copy.rs @@ -45,7 +45,7 @@ fn test<'a,T,U:Copy>(_: &'a isize) { // mutable object types are not ok assert_copy::<&'a mut (dyn Dummy + Send)>(); //~ ERROR : Copy` is not satisfied - // unsafe ptrs are ok + // raw ptrs are ok assert_copy::<*const isize>(); assert_copy::<*const &'a mut isize>(); From 854948a4ab86e59648f235e1ba58562f7aa6ade7 Mon Sep 17 00:00:00 2001 From: Bastian Kersting Date: Fri, 24 Jan 2025 15:13:37 +0000 Subject: [PATCH 054/128] Convert two missed places --- src/tools/clippy/clippy_lints/src/operators/ptr_eq.rs | 2 +- src/tools/clippy/clippy_lints/src/swap_ptr_to_ref.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/clippy/clippy_lints/src/operators/ptr_eq.rs b/src/tools/clippy/clippy_lints/src/operators/ptr_eq.rs index 861564d54569..8118ad59bb71 100644 --- a/src/tools/clippy/clippy_lints/src/operators/ptr_eq.rs +++ b/src/tools/clippy/clippy_lints/src/operators/ptr_eq.rs @@ -53,7 +53,7 @@ fn expr_as_cast_to_usize<'tcx>(cx: &LateContext<'tcx>, cast_expr: &'tcx Expr<'_> // If the given expression is a cast to a `*const` pointer, return the lhs of the cast // E.g., `foo as *const _` returns `foo`. fn expr_as_cast_to_raw_pointer<'tcx>(cx: &LateContext<'tcx>, cast_expr: &'tcx Expr<'_>) -> Option<&'tcx Expr<'tcx>> { - if cx.typeck_results().expr_ty(cast_expr).is_unsafe_ptr() { + if cx.typeck_results().expr_ty(cast_expr).is_raw_ptr() { if let ExprKind::Cast(expr, _) = cast_expr.kind { return Some(expr); } diff --git a/src/tools/clippy/clippy_lints/src/swap_ptr_to_ref.rs b/src/tools/clippy/clippy_lints/src/swap_ptr_to_ref.rs index 8c5cf93ab6e8..ff196355a2e3 100644 --- a/src/tools/clippy/clippy_lints/src/swap_ptr_to_ref.rs +++ b/src/tools/clippy/clippy_lints/src/swap_ptr_to_ref.rs @@ -76,7 +76,7 @@ impl LateLintPass<'_> for SwapPtrToRef { fn is_ptr_to_ref(cx: &LateContext<'_>, e: &Expr<'_>, ctxt: SyntaxContext) -> (bool, Option) { if let ExprKind::AddrOf(BorrowKind::Ref, Mutability::Mut, borrowed_expr) = e.kind && let ExprKind::Unary(UnOp::Deref, derefed_expr) = borrowed_expr.kind - && cx.typeck_results().expr_ty(derefed_expr).is_unsafe_ptr() + && cx.typeck_results().expr_ty(derefed_expr).is_raw_ptr() { ( true, From 0c7d5e2873ac4a167c8b1c0235267630267298bd Mon Sep 17 00:00:00 2001 From: Bastian Kersting Date: Fri, 24 Jan 2025 15:29:42 +0000 Subject: [PATCH 055/128] Convert more missed places --- src/tools/miri/src/intrinsics/atomic.rs | 2 +- src/tools/miri/src/operator.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools/miri/src/intrinsics/atomic.rs b/src/tools/miri/src/intrinsics/atomic.rs index 8507b0f49ded..6d2a575ed765 100644 --- a/src/tools/miri/src/intrinsics/atomic.rs +++ b/src/tools/miri/src/intrinsics/atomic.rs @@ -189,7 +189,7 @@ trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> { let place = this.deref_pointer(place)?; let rhs = this.read_immediate(rhs)?; - if !place.layout.ty.is_integral() && !place.layout.ty.is_unsafe_ptr() { + if !place.layout.ty.is_integral() && !place.layout.ty.is_raw_ptr() { span_bug!( this.cur_span(), "atomic arithmetic operations only work on integer and raw pointer types", diff --git a/src/tools/miri/src/operator.rs b/src/tools/miri/src/operator.rs index c588b6fc7f15..81f22b2d0b2a 100644 --- a/src/tools/miri/src/operator.rs +++ b/src/tools/miri/src/operator.rs @@ -52,8 +52,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { // Some more operations are possible with atomics. // The return value always has the provenance of the *left* operand. Add | Sub | BitOr | BitAnd | BitXor => { - assert!(left.layout.ty.is_unsafe_ptr()); - assert!(right.layout.ty.is_unsafe_ptr()); + assert!(left.layout.ty.is_raw_ptr()); + assert!(right.layout.ty.is_raw_ptr()); let ptr = left.to_scalar().to_pointer(this)?; // We do the actual operation with usize-typed scalars. let left = ImmTy::from_uint(ptr.addr().bytes(), this.machine.layouts.usize); From 1dc575ca2b33667295342c81abb1d0c4e9a9d3e1 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Mon, 10 Feb 2025 16:28:57 +0100 Subject: [PATCH 056/128] assign marcoieni and jdno to infra-ci PRs --- triagebot.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/triagebot.toml b/triagebot.toml index efd694994f9f..169a6121615a 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -1096,6 +1096,8 @@ bootstrap = [ infra-ci = [ "@Mark-Simulacrum", "@Kobzol", + "@marcoieni", + "@jdno", ] rustdoc = [ "@GuillaumeGomez", From b8e135a79fa604e595b7d0419ff353700d87587e Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Mon, 10 Feb 2025 09:09:56 -0700 Subject: [PATCH 057/128] Change CPU target back to pentiumpro --- compiler/rustc_target/src/spec/targets/i586_unknown_redox.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_target/src/spec/targets/i586_unknown_redox.rs b/compiler/rustc_target/src/spec/targets/i586_unknown_redox.rs index 67dfc42103b6..29ef8b883a11 100644 --- a/compiler/rustc_target/src/spec/targets/i586_unknown_redox.rs +++ b/compiler/rustc_target/src/spec/targets/i586_unknown_redox.rs @@ -2,7 +2,7 @@ use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base}; pub(crate) fn target() -> Target { let mut base = base::redox::opts(); - base.cpu = "pentium".into(); + base.cpu = "pentiumpro".into(); base.plt_by_default = false; base.max_atomic_width = Some(64); base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32"]); From 54c15ebd5a53ad4796fcca7199ef620f7fc49662 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Mon, 10 Feb 2025 09:10:48 -0700 Subject: [PATCH 058/128] Update platform-support.md --- src/doc/rustc/src/platform-support.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index d9c0e6a13270..d3d063c0c8b6 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -310,7 +310,7 @@ target | std | host | notes [`i386-apple-ios`](platform-support/apple-ios.md) | ✓ | | 32-bit x86 iOS (Penryn) [^x86_32-floats-return-ABI] [`i586-pc-nto-qnx700`](platform-support/nto-qnx.md) | * | | 32-bit x86 QNX Neutrino 7.0 RTOS (Pentium 4) [^x86_32-floats-return-ABI] [`i586-unknown-netbsd`](platform-support/netbsd.md) | ✓ | | 32-bit x86 (original Pentium) [^x86_32-floats-x87] -[`i586-unknown-redox`](platform-support/redox.md) | ✓ | | 32-bit x86 Redox OS (original Pentium) [^x86_32-floats-x87] +[`i586-unknown-redox`](platform-support/redox.md) | ✓ | | 32-bit x86 Redox OS (PentiumPro) [^x86_32-floats-x87] [`i686-apple-darwin`](platform-support/apple-darwin.md) | ✓ | ✓ | 32-bit macOS (10.12+, Sierra+, Penryn) [^x86_32-floats-return-ABI] `i686-unknown-haiku` | ✓ | ✓ | 32-bit Haiku (Pentium 4) [^x86_32-floats-return-ABI] [`i686-unknown-hurd-gnu`](platform-support/hurd.md) | ✓ | ✓ | 32-bit GNU/Hurd (PentiumPro) [^x86_32-floats-x87] From 17026e24120a8c958b2d742b498fdb83d1314d59 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 10 Feb 2025 11:50:02 -0500 Subject: [PATCH 059/128] Reword doc comment on `CoercePointeeValidated` --- library/core/src/marker.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index 3dbedac166be..029c8b356d07 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -1290,13 +1290,12 @@ pub macro CoercePointee($item:item) { /* compiler built-in */ } -/// A validation trait that is implemented on data with `derive(CoercePointee)` -/// so that the compiler can enforce a set of rules that the target data must -/// conform to in order for the derived behaviours are safe and useful for -/// the purpose of the said macro. +/// A trait that is implemented for ADTs with `derive(CoercePointee)` so that +/// the compiler can enforce the derive impls are valid post-expansion, since +/// the derive has stricter requirements than if the impls were written by hand. /// -/// This trait will not ever be exposed for use as public part of the library -/// and shall not ever be stabilised. +/// This trait is not intended to be implemented by users or used other than +/// validation, so it should never be stabilized. #[cfg(not(bootstrap))] #[lang = "coerce_pointee_validated"] #[unstable(feature = "coerce_pointee_validated", issue = "none")] From 387099b74112556034b85d27a739ccffe777ac10 Mon Sep 17 00:00:00 2001 From: rustbot <47979223+rustbot@users.noreply.github.com> Date: Mon, 10 Feb 2025 18:00:41 +0100 Subject: [PATCH 060/128] Update books --- src/doc/edition-guide | 2 +- src/doc/embedded-book | 2 +- src/doc/reference | 2 +- src/doc/rust-by-example | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/doc/edition-guide b/src/doc/edition-guide index f56aecc3b036..8dbdda7cae4f 160000 --- a/src/doc/edition-guide +++ b/src/doc/edition-guide @@ -1 +1 @@ -Subproject commit f56aecc3b036dff16404b525a83b00f911b9bbea +Subproject commit 8dbdda7cae4fa030f09f8f5b63994d4d1dde74b9 diff --git a/src/doc/embedded-book b/src/doc/embedded-book index ddbf1b4e2858..0b8219ac23a3 160000 --- a/src/doc/embedded-book +++ b/src/doc/embedded-book @@ -1 +1 @@ -Subproject commit ddbf1b4e2858fedb71b7c42eb15c4576517dc125 +Subproject commit 0b8219ac23a3e09464e4e0166c768cf1c4bba0d5 diff --git a/src/doc/reference b/src/doc/reference index 4249fb411dd2..de2d5289e455 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 4249fb411dd27f945e2881eb0378044b94cee06f +Subproject commit de2d5289e45506b11dd652bef4f99de64be70e1c diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example index 743766929f1e..66543bbc5b7d 160000 --- a/src/doc/rust-by-example +++ b/src/doc/rust-by-example @@ -1 +1 @@ -Subproject commit 743766929f1e53e72fab74394ae259bbfb4a7619 +Subproject commit 66543bbc5b7dbd4e679092c07ae06ba6c73fd912 From 0395fc2242c2b04f3a0a330e2e1f6eeaf5939777 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 7 Feb 2025 17:50:08 +0100 Subject: [PATCH 061/128] Move line numbers into the `` directly --- src/librustdoc/html/highlight.rs | 112 ++++++++++++++++-- src/librustdoc/html/sources.rs | 24 ++-- src/librustdoc/html/static/css/rustdoc.css | 58 ++++++--- .../html/static/js/scrape-examples.js | 10 +- src/librustdoc/html/static/js/src-script.js | 8 +- .../html/templates/scraped_source.html | 12 +- src/librustdoc/html/templates/source.html | 10 +- 7 files changed, 168 insertions(+), 66 deletions(-) diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 8c91cae49310..fbe3a8d5ba4f 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -54,7 +54,7 @@ pub(crate) fn render_example_with_highlighting( extra_classes: &[String], ) { write_header(out, "rust-example-rendered", None, tooltip, extra_classes); - write_code(out, src, None, None); + write_code(out, src, None, None, None); write_footer(out, playground_button); } @@ -150,6 +150,7 @@ struct TokenHandler<'a, 'tcx, F: Write> { /// used to generate links. pending_elems: Vec<(&'a str, Option)>, href_context: Option>, + write_line_number: fn(&mut F, u32, &'static str), } impl TokenHandler<'_, '_, F> { @@ -182,7 +183,14 @@ impl TokenHandler<'_, '_, F> { && can_merge(current_class, Some(*parent_class), "") { for (text, class) in self.pending_elems.iter() { - string(self.out, EscapeBodyText(text), *class, &self.href_context, false); + string( + self.out, + EscapeBodyText(text), + *class, + &self.href_context, + false, + self.write_line_number, + ); } } else { // We only want to "open" the tag ourselves if we have more than one pending and if the @@ -204,6 +212,7 @@ impl TokenHandler<'_, '_, F> { *class, &self.href_context, close_tag.is_none(), + self.write_line_number, ); } if let Some(close_tag) = close_tag { @@ -213,6 +222,11 @@ impl TokenHandler<'_, '_, F> { self.pending_elems.clear(); true } + + #[inline] + fn write_line_number(&mut self, line: u32, extra: &'static str) { + (self.write_line_number)(&mut self.out, line, extra); + } } impl Drop for TokenHandler<'_, '_, F> { @@ -226,6 +240,43 @@ impl Drop for TokenHandler<'_, '_, F> { } } +fn write_scraped_line_number(out: &mut impl Write, line: u32, extra: &'static str) { + // https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag#data-nosnippet-attr + // Do not show "1 2 3 4 5 ..." in web search results. + write!(out, "{extra}{line}",).unwrap(); +} + +fn write_line_number(out: &mut impl Write, line: u32, extra: &'static str) { + // https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag#data-nosnippet-attr + // Do not show "1 2 3 4 5 ..." in web search results. + write!(out, "{extra}{line}",).unwrap(); +} + +fn empty_line_number(out: &mut impl Write, _: u32, extra: &'static str) { + out.write_str(extra).unwrap(); +} + +#[derive(Clone, Copy)] +pub(super) struct LineInfo { + pub(super) start_line: u32, + max_lines: u32, + pub(super) is_scraped_example: bool, +} + +impl LineInfo { + pub(super) fn new(max_lines: u32) -> Self { + Self { start_line: 1, max_lines: max_lines + 1, is_scraped_example: false } + } + + pub(super) fn new_scraped(max_lines: u32, start_line: u32) -> Self { + Self { + start_line: start_line + 1, + max_lines: max_lines + start_line + 1, + is_scraped_example: true, + } + } +} + /// Convert the given `src` source code into HTML by adding classes for highlighting. /// /// This code is used to render code blocks (in the documentation) as well as the source code pages. @@ -242,6 +293,7 @@ pub(super) fn write_code( src: &str, href_context: Option>, decoration_info: Option<&DecorationInfo>, + line_info: Option, ) { // This replace allows to fix how the code source with DOS backline characters is displayed. let src = src.replace("\r\n", "\n"); @@ -252,6 +304,23 @@ pub(super) fn write_code( current_class: None, pending_elems: Vec::new(), href_context, + write_line_number: match line_info { + Some(line_info) => { + if line_info.is_scraped_example { + write_scraped_line_number + } else { + write_line_number + } + } + None => empty_line_number, + }, + }; + + let (mut line, max_lines) = if let Some(line_info) = line_info { + token_handler.write_line_number(line_info.start_line, ""); + (line_info.start_line, line_info.max_lines) + } else { + (0, u32::MAX) }; Classifier::new( @@ -282,7 +351,14 @@ pub(super) fn write_code( if need_current_class_update { token_handler.current_class = class.map(Class::dummy); } - token_handler.pending_elems.push((text, class)); + if text == "\n" { + line += 1; + if line < max_lines { + token_handler.pending_elems.push((text, Some(Class::Backline(line)))); + } + } else { + token_handler.pending_elems.push((text, class)); + } } Highlight::EnterSpan { class } => { let mut should_add = true; @@ -348,6 +424,7 @@ enum Class { PreludeVal(Span), QuestionMark, Decoration(&'static str), + Backline(u32), } impl Class { @@ -396,6 +473,7 @@ impl Class { Class::PreludeVal(_) => "prelude-val", Class::QuestionMark => "question-mark", Class::Decoration(kind) => kind, + Class::Backline(_) => "", } } @@ -419,7 +497,8 @@ impl Class { | Self::Bool | Self::Lifetime | Self::QuestionMark - | Self::Decoration(_) => None, + | Self::Decoration(_) + | Self::Backline(_) => None, } } } @@ -694,8 +773,13 @@ impl<'src> Classifier<'src> { ) { let lookahead = self.peek(); let no_highlight = |sink: &mut dyn FnMut(_)| sink(Highlight::Token { text, class: None }); + let whitespace = |sink: &mut dyn FnMut(_)| { + for part in text.split('\n').intersperse("\n").filter(|s| !s.is_empty()) { + sink(Highlight::Token { text: part, class: None }); + } + }; let class = match token { - TokenKind::Whitespace => return no_highlight(sink), + TokenKind::Whitespace => return whitespace(sink), TokenKind::LineComment { doc_style } | TokenKind::BlockComment { doc_style, .. } => { if doc_style.is_some() { Class::DocComment @@ -716,7 +800,7 @@ impl<'src> Classifier<'src> { // or a reference or pointer type. Unless, of course, it looks like // a logical and or a multiplication operator: `&&` or `* `. TokenKind::Star => match self.tokens.peek() { - Some((TokenKind::Whitespace, _)) => return no_highlight(sink), + Some((TokenKind::Whitespace, _)) => return whitespace(sink), Some((TokenKind::Ident, "mut")) => { self.next(); sink(Highlight::Token { text: "*mut", class: Some(Class::RefKeyWord) }); @@ -740,7 +824,7 @@ impl<'src> Classifier<'src> { sink(Highlight::Token { text: "&=", class: None }); return; } - Some((TokenKind::Whitespace, _)) => return no_highlight(sink), + Some((TokenKind::Whitespace, _)) => return whitespace(sink), Some((TokenKind::Ident, "mut")) => { self.next(); sink(Highlight::Token { text: "&mut", class: Some(Class::RefKeyWord) }); @@ -887,7 +971,9 @@ impl<'src> Classifier<'src> { }; // Anything that didn't return above is the simple case where we the // class just spans a single token, so we can use the `string` method. - sink(Highlight::Token { text, class: Some(class) }); + for part in text.split('\n').intersperse("\n").filter(|s| !s.is_empty()) { + sink(Highlight::Token { text: part, class: Some(class) }); + } } fn peek(&mut self) -> Option { @@ -939,14 +1025,18 @@ fn exit_span(out: &mut impl Write, closing_tag: &str) { /// Note that if `context` is not `None` and that the given `klass` contains a `Span`, the function /// will then try to find this `span` in the `span_correspondence_map`. If found, it'll then /// generate a link for this element (which corresponds to where its definition is located). -fn string( - out: &mut impl Write, +fn string( + out: &mut W, text: T, klass: Option, href_context: &Option>, open_tag: bool, + write_line_number_callback: fn(&mut W, u32, &'static str), ) { - if let Some(closing_tag) = string_without_closing_tag(out, text, klass, href_context, open_tag) + if let Some(Class::Backline(line)) = klass { + write_line_number_callback(out, line, "\n"); + } else if let Some(closing_tag) = + string_without_closing_tag(out, text, klass, href_context, open_tag) { out.write_str(closing_tag).unwrap(); } diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs index 1ac0c10c6124..7839ba9ac832 100644 --- a/src/librustdoc/html/sources.rs +++ b/src/librustdoc/html/sources.rs @@ -1,6 +1,5 @@ use std::cell::RefCell; use std::ffi::OsStr; -use std::ops::RangeInclusive; use std::path::{Component, Path, PathBuf}; use std::{fmt, fs}; @@ -303,16 +302,16 @@ pub(crate) struct ScrapedInfo<'a> { #[template(path = "scraped_source.html")] struct ScrapedSource<'a, Code: std::fmt::Display> { info: ScrapedInfo<'a>, - lines: RangeInclusive, code_html: Code, + max_nb_digits: u32, } #[derive(Template)] #[template(path = "source.html")] struct Source { - lines: RangeInclusive, code_html: Code, file_path: Option<(String, String)>, + max_nb_digits: u32, } pub(crate) enum SourceContext<'a> { @@ -331,6 +330,15 @@ pub(crate) fn print_src( decoration_info: &highlight::DecorationInfo, source_context: SourceContext<'_>, ) { + let mut lines = s.lines().count(); + let line_info = if let SourceContext::Embedded(ref info) = source_context { + highlight::LineInfo::new_scraped(lines as u32, info.offset as u32) + } else { + highlight::LineInfo::new(lines as u32) + }; + if line_info.is_scraped_example { + lines += line_info.start_line as usize; + } let code = fmt::from_fn(move |fmt| { let current_href = context .href_from_span(clean::Span::new(file_span), false) @@ -340,13 +348,13 @@ pub(crate) fn print_src( s, Some(highlight::HrefContext { context, file_span, root_path, current_href }), Some(decoration_info), + Some(line_info), ); Ok(()) }); - let lines = s.lines().count(); + let max_nb_digits = if lines > 0 { lines.ilog(10) + 1 } else { 1 }; match source_context { SourceContext::Standalone { file_path } => Source { - lines: (1..=lines), code_html: code, file_path: if let Some(file_name) = file_path.file_name() && let Some(file_path) = file_path.parent() @@ -355,12 +363,14 @@ pub(crate) fn print_src( } else { None }, + max_nb_digits, } .render_into(&mut writer) .unwrap(), SourceContext::Embedded(info) => { - let lines = (1 + info.offset)..=(lines + info.offset); - ScrapedSource { info, lines, code_html: code }.render_into(&mut writer).unwrap(); + ScrapedSource { info, code_html: code, max_nb_digits } + .render_into(&mut writer) + .unwrap(); } }; } diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index d0612e997fd7..613407cbe1f1 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -40,6 +40,7 @@ xmlns="http://www.w3.org/2000/svg" fill="black" height="18px">\ --docblock-indent: 24px; --font-family: "Source Serif 4", NanumBarunGothic, serif; --font-family-code: "Source Code Pro", monospace; + --line-number-padding: 4px; } :root.sans-serif { @@ -450,9 +451,7 @@ pre.item-decl { .src .content pre { padding: 20px; -} -.rustdoc.src .example-wrap .src-line-numbers { - padding: 20px 0 20px 4px; + padding-left: 16px; } img { @@ -908,22 +907,46 @@ both the code example and the line numbers, so we need to remove the radius in t color: var(--src-line-numbers-span-color); } -.rustdoc .scraped-example .example-wrap .src-line-numbers { - padding: 0; +.example-wrap.digits-1 [data-nosnippet] { + width: calc(1ch + var(--line-number-padding) * 2); } -.rustdoc .src-line-numbers pre { - padding: 14px 0; +.example-wrap.digits-2 [data-nosnippet] { + width: calc(2ch + var(--line-number-padding) * 2); } -.src-line-numbers a, .src-line-numbers span { +.example-wrap.digits-3 [data-nosnippet] { + width: calc(3ch + var(--line-number-padding) * 2); +} +.example-wrap.digits-4 [data-nosnippet] { + width: calc(4ch + var(--line-number-padding) * 2); +} +.example-wrap.digits-5 [data-nosnippet] { + width: calc(5ch + var(--line-number-padding) * 2); +} +.example-wrap.digits-6 [data-nosnippet] { + width: calc(6ch + var(--line-number-padding) * 2); +} +.example-wrap.digits-7 [data-nosnippet] { + width: calc(7ch + var(--line-number-padding) * 2); +} +.example-wrap.digits-8 [data-nosnippet] { + width: calc(8ch + var(--line-number-padding) * 2); +} +.example-wrap.digits-9 [data-nosnippet] { + width: calc(9ch + var(--line-number-padding) * 2); +} + +.example-wrap [data-nosnippet] { color: var(--src-line-numbers-span-color); - padding: 0 8px; + text-align: right; + display: inline-block; + margin-right: 20px; + user-select: none; + padding: 0 4px; } -.src-line-numbers :target { - background-color: transparent; +.example-wrap [data-nosnippet]:target { border-right: none; - padding: 0 8px; } -.src-line-numbers .line-highlighted { +.example-wrap .line-highlighted[data-nosnippet] { background-color: var(--src-line-number-highlighted-background-color); } @@ -1110,7 +1133,7 @@ because of the `[-]` element which would overlap with it. */ } .main-heading a:hover, -.example-wrap .rust a:hover, +.example-wrap .rust a:hover:not([data-nosnippet]), .all-items a:hover, .docblock a:not(.scrape-help):not(.tooltip):hover:not(.doc-anchor), .item-table dd a:not(.scrape-help):not(.tooltip):hover, @@ -1568,7 +1591,7 @@ pre.rust .doccomment { color: var(--code-highlight-doc-comment-color); } -.rustdoc.src .example-wrap pre.rust a { +.rustdoc.src .example-wrap pre.rust a:not([data-nosnippet]) { background: var(--codeblock-link-background); } @@ -1759,8 +1782,7 @@ instead, we check that it's not a "finger" cursor. } } -:target { - padding-right: 3px; +:target:not([data-nosnippet]) { background-color: var(--target-background-color); border-right: 3px solid var(--target-border-color); } @@ -3153,7 +3175,7 @@ Original by Dempfi (https://github.com/dempfi/ayu) color: #ff7733; } -:root[data-theme="ayu"] .src-line-numbers .line-highlighted { +:root[data-theme="ayu"] a[data-nosnippet].line-highlighted { color: #708090; padding-right: 7px; border-right: 1px solid #ffb44c; diff --git a/src/librustdoc/html/static/js/scrape-examples.js b/src/librustdoc/html/static/js/scrape-examples.js index d08f15a5bfa8..99cbe6daf317 100644 --- a/src/librustdoc/html/static/js/scrape-examples.js +++ b/src/librustdoc/html/static/js/scrape-examples.js @@ -16,7 +16,7 @@ // Scroll code block to the given code location function scrollToLoc(elt, loc, isHidden) { - const lines = elt.querySelector(".src-line-numbers > pre"); + const lines = elt.querySelectorAll("[data-nosnippet]"); let scrollOffset; // If the block is greater than the size of the viewer, @@ -25,17 +25,17 @@ const maxLines = isHidden ? HIDDEN_MAX_LINES : DEFAULT_MAX_LINES; if (loc[1] - loc[0] > maxLines) { const line = Math.max(0, loc[0] - 1); - scrollOffset = lines.children[line].offsetTop; + scrollOffset = lines[line].offsetTop; } else { const halfHeight = elt.offsetHeight / 2; - const offsetTop = lines.children[loc[0]].offsetTop; - const lastLine = lines.children[loc[1]]; + const offsetTop = lines[loc[0]].offsetTop; + const lastLine = lines[loc[1]]; const offsetBot = lastLine.offsetTop + lastLine.offsetHeight; const offsetMid = (offsetTop + offsetBot) / 2; scrollOffset = offsetMid - halfHeight; } - lines.parentElement.scrollTo(0, scrollOffset); + lines[0].parentElement.scrollTo(0, scrollOffset); elt.querySelector(".rust").scrollTo(0, scrollOffset); } diff --git a/src/librustdoc/html/static/js/src-script.js b/src/librustdoc/html/static/js/src-script.js index 8f712f4c20c7..fc27241334bf 100644 --- a/src/librustdoc/html/static/js/src-script.js +++ b/src/librustdoc/html/static/js/src-script.js @@ -138,10 +138,8 @@ function highlightSrcLines() { if (x) { x.scrollIntoView(); } - onEachLazy(document.getElementsByClassName("src-line-numbers"), e => { - onEachLazy(e.getElementsByTagName("a"), i_e => { - removeClass(i_e, "line-highlighted"); - }); + onEachLazy(document.querySelectorAll("a[data-nosnippet]"), e => { + removeClass(e, "line-highlighted"); }); for (let i = from; i <= to; ++i) { elem = document.getElementById(i); @@ -200,7 +198,7 @@ const handleSrcHighlight = (function() { window.addEventListener("hashchange", highlightSrcLines); -onEachLazy(document.getElementsByClassName("src-line-numbers"), el => { +onEachLazy(document.querySelectorAll("a[data-nosnippet]"), el => { el.addEventListener("click", handleSrcHighlight); }); diff --git a/src/librustdoc/html/templates/scraped_source.html b/src/librustdoc/html/templates/scraped_source.html index bd54bbf58d50..3e69f1c8cad7 100644 --- a/src/librustdoc/html/templates/scraped_source.html +++ b/src/librustdoc/html/templates/scraped_source.html @@ -2,17 +2,7 @@
{{info.name +}} ({{info.title}}) {# #}
{# #} -
- {# https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag#data-nosnippet-attr - Do not show "1 2 3 4 5 ..." in web search results. #} -
{# #} -
-                {% for line in lines.clone() %}
-                    {# ~#}
-                    {{line|safe}}
-                {% endfor %}
-            
{# #} -
{# #} +
{# #}
 {# #}
             
                 {{code_html|safe}}
diff --git a/src/librustdoc/html/templates/source.html b/src/librustdoc/html/templates/source.html
index ea530087e6f0..454d4c27f1ad 100644
--- a/src/librustdoc/html/templates/source.html
+++ b/src/librustdoc/html/templates/source.html
@@ -9,15 +9,7 @@
 
{% else %} {% endmatch %} -
- {# https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag#data-nosnippet-attr - Do not show "1 2 3 4 5 ..." in web search results. #} -
-        {% for line in lines.clone() %}
-            {# ~#}
-            {{line|safe}}
-        {% endfor %}
-    
{# #} +
{# #}
 {# #}
         
             {{code_html|safe}}

From 5f29273921f2a15a440e373c640d5525756fdf41 Mon Sep 17 00:00:00 2001
From: Daniel Paoliello 
Date: Fri, 7 Feb 2025 16:42:55 -0800
Subject: [PATCH 062/128] rustc_codegen_llvm: Mark items as pub(crate) outside
 of the llvm module

---
 compiler/rustc_codegen_llvm/src/abi.rs                       | 2 +-
 compiler/rustc_codegen_llvm/src/back/lto.rs                  | 4 ++--
 compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs | 2 +-
 compiler/rustc_codegen_llvm/src/lib.rs                       | 2 +-
 compiler/rustc_codegen_llvm/src/llvm_util.rs                 | 2 +-
 compiler/rustc_codegen_llvm/src/type_.rs                     | 4 ++--
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs
index 31ee0eeca11f..bde80124a4bb 100644
--- a/compiler/rustc_codegen_llvm/src/abi.rs
+++ b/compiler/rustc_codegen_llvm/src/abi.rs
@@ -657,7 +657,7 @@ impl<'tcx> AbiBuilderMethods<'tcx> for Builder<'_, '_, 'tcx> {
 }
 
 impl llvm::CallConv {
-    pub fn from_conv(conv: Conv, arch: &str) -> Self {
+    pub(crate) fn from_conv(conv: Conv, arch: &str) -> Self {
         match conv {
             Conv::C
             | Conv::Rust
diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs
index 78c759bbe8c0..98d04a54e914 100644
--- a/compiler/rustc_codegen_llvm/src/back/lto.rs
+++ b/compiler/rustc_codegen_llvm/src/back/lto.rs
@@ -621,7 +621,7 @@ unsafe impl Send for ModuleBuffer {}
 unsafe impl Sync for ModuleBuffer {}
 
 impl ModuleBuffer {
-    pub fn new(m: &llvm::Module) -> ModuleBuffer {
+    pub(crate) fn new(m: &llvm::Module) -> ModuleBuffer {
         ModuleBuffer(unsafe { llvm::LLVMRustModuleBufferCreate(m) })
     }
 }
@@ -663,7 +663,7 @@ unsafe impl Send for ThinBuffer {}
 unsafe impl Sync for ThinBuffer {}
 
 impl ThinBuffer {
-    pub fn new(m: &llvm::Module, is_thin: bool, emit_summary: bool) -> ThinBuffer {
+    pub(crate) fn new(m: &llvm::Module, is_thin: bool, emit_summary: bool) -> ThinBuffer {
         unsafe {
             let buffer = llvm::LLVMRustThinLTOBufferCreate(m, is_thin, emit_summary);
             ThinBuffer(buffer)
diff --git a/compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs b/compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs
index 4cbd49aa44d4..f075f332462f 100644
--- a/compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs
+++ b/compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs
@@ -17,7 +17,7 @@ pub struct OwnedTargetMachine {
 }
 
 impl OwnedTargetMachine {
-    pub fn new(
+    pub(crate) fn new(
         triple: &CStr,
         cpu: &CStr,
         features: &CStr,
diff --git a/compiler/rustc_codegen_llvm/src/lib.rs b/compiler/rustc_codegen_llvm/src/lib.rs
index 14346795fda6..57a5bd43446b 100644
--- a/compiler/rustc_codegen_llvm/src/lib.rs
+++ b/compiler/rustc_codegen_llvm/src/lib.rs
@@ -29,7 +29,7 @@ use std::mem::ManuallyDrop;
 use back::owned_target_machine::OwnedTargetMachine;
 use back::write::{create_informational_target_machine, create_target_machine};
 use errors::{AutoDiffWithoutLTO, ParseTargetMachineConfig};
-pub use llvm_util::target_features_cfg;
+pub(crate) use llvm_util::target_features_cfg;
 use rustc_ast::expand::allocator::AllocatorKind;
 use rustc_ast::expand::autodiff_attrs::AutoDiffItem;
 use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModule};
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index 53611c746a72..e72f8bdff841 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -303,7 +303,7 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option Vec {
+pub(crate) fn target_features_cfg(sess: &Session, allow_unstable: bool) -> Vec {
     let mut features: FxHashSet = Default::default();
 
     // Add base features for the target.
diff --git a/compiler/rustc_codegen_llvm/src/type_.rs b/compiler/rustc_codegen_llvm/src/type_.rs
index c56ad886120f..13dc2df3b0dc 100644
--- a/compiler/rustc_codegen_llvm/src/type_.rs
+++ b/compiler/rustc_codegen_llvm/src/type_.rs
@@ -237,11 +237,11 @@ impl<'ll, 'tcx> BaseTypeCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
 
 impl Type {
     /// Creates an integer type with the given number of bits, e.g., i24
-    pub fn ix_llcx(llcx: &llvm::Context, num_bits: u64) -> &Type {
+    pub(crate) fn ix_llcx(llcx: &llvm::Context, num_bits: u64) -> &Type {
         unsafe { llvm::LLVMIntTypeInContext(llcx, num_bits as c_uint) }
     }
 
-    pub fn ptr_llcx(llcx: &llvm::Context) -> &Type {
+    pub(crate) fn ptr_llcx(llcx: &llvm::Context) -> &Type {
         unsafe { llvm::LLVMPointerTypeInContext(llcx, AddressSpace::DATA.0) }
     }
 }

From bce3d64fca58478c873af97eccdf81113671e7d3 Mon Sep 17 00:00:00 2001
From: Ralf Jung 
Date: Mon, 10 Feb 2025 19:39:03 +0100
Subject: [PATCH 063/128] fix i686-unknown-hurd-gnu x87 footnote

---
 src/doc/rustc/src/platform-support.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md
index bb89d97a7984..6384957e36f3 100644
--- a/src/doc/rustc/src/platform-support.md
+++ b/src/doc/rustc/src/platform-support.md
@@ -313,7 +313,7 @@ target | std | host | notes
 [`i586-unknown-netbsd`](platform-support/netbsd.md) | ✓ |  | 32-bit x86 (original Pentium) [^x86_32-floats-x87]
 [`i686-apple-darwin`](platform-support/apple-darwin.md) | ✓ | ✓ | 32-bit macOS (10.12+, Sierra+, Penryn) [^x86_32-floats-return-ABI]
 `i686-unknown-haiku` | ✓ | ✓ | 32-bit Haiku (Pentium 4) [^x86_32-floats-return-ABI]
-[`i686-unknown-hurd-gnu`](platform-support/hurd.md) | ✓ | ✓ | 32-bit GNU/Hurd (Pentium 4) [^x86_32-floats-x87]
+[`i686-unknown-hurd-gnu`](platform-support/hurd.md) | ✓ | ✓ | 32-bit GNU/Hurd (Pentium 4) [^x86_32-floats-return-ABI]
 [`i686-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | NetBSD/i386 (Pentium 4) [^x86_32-floats-return-ABI]
 [`i686-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | 32-bit OpenBSD (Pentium 4) [^x86_32-floats-return-ABI]
 [`i686-unknown-redox`](platform-support/redox.md) | ✓ |  | i686 Redox OS (PentiumPro) [^x86_32-floats-x87]

From 17716be86e36720885a9918a1e08da7a5669ceca Mon Sep 17 00:00:00 2001
From: Jubilee Young 
Date: Mon, 10 Feb 2025 10:30:41 -0800
Subject: [PATCH 064/128] compiler: die immediately instead of handling unknown
 target codegen

We cannot produce anything useful if asked to compile unknown targets.
We should handle the error immediately at the point of discovery instead
of propagating it upward, and preferably in the simplest way: Die.

This allows cleaning up our "error-handling" spread across 5 crates.
---
 compiler/rustc_const_eval/src/errors.rs       | 10 --------
 .../src/interpret/eval_context.rs             |  3 ---
 .../rustc_middle/src/mir/interpret/error.rs   |  4 ---
 compiler/rustc_middle/src/ty/layout.rs        |  7 ------
 compiler/rustc_passes/src/abi_test.rs         |  9 -------
 compiler/rustc_target/src/callconv/mod.rs     | 25 +++----------------
 compiler/rustc_ty_utils/src/abi.rs            | 12 +++------
 7 files changed, 7 insertions(+), 63 deletions(-)

diff --git a/compiler/rustc_const_eval/src/errors.rs b/compiler/rustc_const_eval/src/errors.rs
index 8df9877cabca..c08495c012f8 100644
--- a/compiler/rustc_const_eval/src/errors.rs
+++ b/compiler/rustc_const_eval/src/errors.rs
@@ -16,7 +16,6 @@ use rustc_middle::mir::interpret::{
 };
 use rustc_middle::ty::{self, Mutability, Ty};
 use rustc_span::{Span, Symbol};
-use rustc_target::callconv::AdjustForForeignAbiError;
 
 use crate::interpret::InternKind;
 
@@ -936,9 +935,6 @@ impl<'tcx> ReportErrorExt for InvalidProgramInfo<'tcx> {
             InvalidProgramInfo::TooGeneric => const_eval_too_generic,
             InvalidProgramInfo::AlreadyReported(_) => const_eval_already_reported,
             InvalidProgramInfo::Layout(e) => e.diagnostic_message(),
-            InvalidProgramInfo::FnAbiAdjustForForeignAbi(_) => {
-                rustc_middle::error::middle_adjust_for_foreign_abi_error
-            }
         }
     }
     fn add_args(self, diag: &mut Diag<'_, G>) {
@@ -953,12 +949,6 @@ impl<'tcx> ReportErrorExt for InvalidProgramInfo<'tcx> {
                 }
                 dummy_diag.cancel();
             }
-            InvalidProgramInfo::FnAbiAdjustForForeignAbi(
-                AdjustForForeignAbiError::Unsupported { arch, abi },
-            ) => {
-                diag.arg("arch", arch);
-                diag.arg("abi", abi.name());
-            }
         }
     }
 }
diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs
index 95a72d3cbc1d..66a75113652f 100644
--- a/compiler/rustc_const_eval/src/interpret/eval_context.rs
+++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs
@@ -106,9 +106,6 @@ impl<'tcx, M: Machine<'tcx>> FnAbiOfHelpers<'tcx> for InterpCx<'tcx, M> {
     ) -> InterpErrorKind<'tcx> {
         match err {
             FnAbiError::Layout(err) => err_inval!(Layout(err)),
-            FnAbiError::AdjustForForeignAbi(err) => {
-                err_inval!(FnAbiAdjustForForeignAbi(err))
-            }
         }
     }
 }
diff --git a/compiler/rustc_middle/src/mir/interpret/error.rs b/compiler/rustc_middle/src/mir/interpret/error.rs
index 1222ba052cce..8861e31b0991 100644
--- a/compiler/rustc_middle/src/mir/interpret/error.rs
+++ b/compiler/rustc_middle/src/mir/interpret/error.rs
@@ -216,10 +216,6 @@ pub enum InvalidProgramInfo<'tcx> {
     AlreadyReported(ReportedErrorInfo),
     /// An error occurred during layout computation.
     Layout(layout::LayoutError<'tcx>),
-    /// An error occurred during FnAbi computation: the passed --target lacks FFI support
-    /// (which unfortunately typeck does not reject).
-    /// Not using `FnAbiError` as that contains a nested `LayoutError`.
-    FnAbiAdjustForForeignAbi(rustc_target::callconv::AdjustForForeignAbiError),
 }
 
 /// Details of why a pointer had to be in-bounds.
diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs
index e5015ea3c3d1..4b3e29b7c6cc 100644
--- a/compiler/rustc_middle/src/ty/layout.rs
+++ b/compiler/rustc_middle/src/ty/layout.rs
@@ -24,7 +24,6 @@ use rustc_target::spec::{
 use tracing::debug;
 use {rustc_abi as abi, rustc_hir as hir};
 
-use crate::error::UnsupportedFnAbi;
 use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags;
 use crate::query::TyCtxtAt;
 use crate::ty::normalize_erasing_regions::NormalizationError;
@@ -1275,18 +1274,12 @@ pub fn fn_can_unwind(tcx: TyCtxt<'_>, fn_def_id: Option, abi: ExternAbi)
 pub enum FnAbiError<'tcx> {
     /// Error produced by a `layout_of` call, while computing `FnAbi` initially.
     Layout(LayoutError<'tcx>),
-
-    /// Error produced by attempting to adjust a `FnAbi`, for a "foreign" ABI.
-    AdjustForForeignAbi(rustc_target::callconv::AdjustForForeignAbiError),
 }
 
 impl<'a, 'b, G: EmissionGuarantee> Diagnostic<'a, G> for FnAbiError<'b> {
     fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
         match self {
             Self::Layout(e) => e.into_diagnostic().into_diag(dcx, level),
-            Self::AdjustForForeignAbi(
-                rustc_target::callconv::AdjustForForeignAbiError::Unsupported { arch, abi },
-            ) => UnsupportedFnAbi { arch, abi: abi.name() }.into_diag(dcx, level),
         }
     }
 }
diff --git a/compiler/rustc_passes/src/abi_test.rs b/compiler/rustc_passes/src/abi_test.rs
index 4601bb87b76f..671b7d7ad76c 100644
--- a/compiler/rustc_passes/src/abi_test.rs
+++ b/compiler/rustc_passes/src/abi_test.rs
@@ -46,15 +46,6 @@ fn unwrap_fn_abi<'tcx>(
                 span: tcx.def_span(item_def_id),
             });
         }
-        Err(FnAbiError::AdjustForForeignAbi(e)) => {
-            // Sadly there seems to be no `into_diagnostic` for this case... and I am not sure if
-            // this can even be reached. Anyway this is a perma-unstable debug attribute, an ICE
-            // isn't the worst thing. Also this matches what codegen does.
-            span_bug!(
-                tcx.def_span(item_def_id),
-                "error computing fn_abi_of_instance, cannot adjust for foreign ABI: {e:?}",
-            )
-        }
     }
 }
 
diff --git a/compiler/rustc_target/src/callconv/mod.rs b/compiler/rustc_target/src/callconv/mod.rs
index 50ac6c8fcde1..b49dd2588692 100644
--- a/compiler/rustc_target/src/callconv/mod.rs
+++ b/compiler/rustc_target/src/callconv/mod.rs
@@ -6,7 +6,6 @@ use rustc_abi::{
     Size, TyAbiInterface, TyAndLayout,
 };
 use rustc_macros::HashStable_Generic;
-use rustc_span::Symbol;
 
 use crate::spec::{HasTargetSpec, HasWasmCAbiOpt, HasX86AbiOpt, WasmCAbi};
 
@@ -623,19 +622,8 @@ impl<'a, Ty: fmt::Display> fmt::Debug for FnAbi<'a, Ty> {
     }
 }
 
-/// Error produced by attempting to adjust a `FnAbi`, for a "foreign" ABI.
-#[derive(Copy, Clone, Debug, HashStable_Generic)]
-pub enum AdjustForForeignAbiError {
-    /// Target architecture doesn't support "foreign" (i.e. non-Rust) ABIs.
-    Unsupported { arch: Symbol, abi: ExternAbi },
-}
-
 impl<'a, Ty> FnAbi<'a, Ty> {
-    pub fn adjust_for_foreign_abi(
-        &mut self,
-        cx: &C,
-        abi: ExternAbi,
-    ) -> Result<(), AdjustForForeignAbiError>
+    pub fn adjust_for_foreign_abi(&mut self, cx: &C, abi: ExternAbi)
     where
         Ty: TyAbiInterface<'a, C> + Copy,
         C: HasDataLayout + HasTargetSpec + HasWasmCAbiOpt + HasX86AbiOpt,
@@ -644,7 +632,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
             if let Some(arg) = self.args.first_mut() {
                 arg.pass_by_stack_offset(None);
             }
-            return Ok(());
+            return;
         }
 
         let spec = cx.target_spec();
@@ -719,15 +707,8 @@ impl<'a, Ty> FnAbi<'a, Ty> {
             }
             "wasm64" => wasm::compute_c_abi_info(cx, self),
             "bpf" => bpf::compute_abi_info(self),
-            arch => {
-                return Err(AdjustForForeignAbiError::Unsupported {
-                    arch: Symbol::intern(arch),
-                    abi,
-                });
-            }
+            arch => panic!("no lowering implemented for {arch}"),
         }
-
-        Ok(())
     }
 
     pub fn adjust_for_rust_abi(&mut self, cx: &C, abi: ExternAbi)
diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs
index 169f3a78c26a..332b00e8423b 100644
--- a/compiler/rustc_ty_utils/src/abi.rs
+++ b/compiler/rustc_ty_utils/src/abi.rs
@@ -650,7 +650,7 @@ fn fn_abi_new_uncached<'tcx>(
         conv,
         can_unwind: fn_can_unwind(cx.tcx(), fn_def_id, sig.abi),
     };
-    fn_abi_adjust_for_abi(cx, &mut fn_abi, sig.abi, fn_def_id)?;
+    fn_abi_adjust_for_abi(cx, &mut fn_abi, sig.abi, fn_def_id);
     debug!("fn_abi_new_uncached = {:?}", fn_abi);
     fn_abi_sanity_check(cx, &fn_abi, sig.abi);
     Ok(tcx.arena.alloc(fn_abi))
@@ -662,7 +662,7 @@ fn fn_abi_adjust_for_abi<'tcx>(
     fn_abi: &mut FnAbi<'tcx, Ty<'tcx>>,
     abi: ExternAbi,
     fn_def_id: Option,
-) -> Result<(), &'tcx FnAbiError<'tcx>> {
+) {
     if abi == ExternAbi::Unadjusted {
         // The "unadjusted" ABI passes aggregates in "direct" mode. That's fragile but needed for
         // some LLVM intrinsics.
@@ -682,7 +682,7 @@ fn fn_abi_adjust_for_abi<'tcx>(
         for arg in fn_abi.args.iter_mut() {
             unadjust(arg);
         }
-        return Ok(());
+        return;
     }
 
     let tcx = cx.tcx();
@@ -723,12 +723,8 @@ fn fn_abi_adjust_for_abi<'tcx>(
             }
         }
     } else {
-        fn_abi
-            .adjust_for_foreign_abi(cx, abi)
-            .map_err(|err| &*tcx.arena.alloc(FnAbiError::AdjustForForeignAbi(err)))?;
+        fn_abi.adjust_for_foreign_abi(cx, abi);
     }
-
-    Ok(())
 }
 
 #[tracing::instrument(level = "debug", skip(cx))]

From d32cd295b30561e465cd1b58b0a646cbaa952c0c Mon Sep 17 00:00:00 2001
From: Eric Huss 
Date: Mon, 10 Feb 2025 11:09:18 -0800
Subject: [PATCH 065/128] Fix platform support table for i686-unknown-uefi

This text was placed in the wrong column.
---
 src/doc/rustc/src/platform-support.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md
index bb89d97a7984..fd1b4bb3b452 100644
--- a/src/doc/rustc/src/platform-support.md
+++ b/src/doc/rustc/src/platform-support.md
@@ -169,7 +169,7 @@ target | std | notes
 [`i686-pc-windows-gnullvm`](platform-support/pc-windows-gnullvm.md) | ✓ | 32-bit x86 MinGW (Windows 10+, Pentium 4), LLVM ABI [^x86_32-floats-return-ABI]
 [`i686-unknown-freebsd`](platform-support/freebsd.md) | ✓ | 32-bit x86 FreeBSD (Pentium 4) [^x86_32-floats-return-ABI]
 `i686-unknown-linux-musl` | ✓ | 32-bit Linux with musl 1.2.3 (Pentium 4) [^x86_32-floats-return-ABI]
-[`i686-unknown-uefi`](platform-support/unknown-uefi.md) | ? (Pentium 4, softfloat) | 32-bit UEFI
+[`i686-unknown-uefi`](platform-support/unknown-uefi.md) | ? | 32-bit UEFI (Pentium 4, softfloat)
 [`loongarch64-unknown-none`](platform-support/loongarch-none.md) | * | LoongArch64 Bare-metal (LP64D ABI)
 [`loongarch64-unknown-none-softfloat`](platform-support/loongarch-none.md) | * | LoongArch64 Bare-metal (LP64S ABI)
 [`nvptx64-nvidia-cuda`](platform-support/nvptx64-nvidia-cuda.md) | * | --emit=asm generates PTX code that [runs on NVIDIA GPUs]

From fd58652a7de3c04ca957dd8fdc580c16ad17a8d3 Mon Sep 17 00:00:00 2001
From: Jubilee Young 
Date: Mon, 10 Feb 2025 11:19:02 -0800
Subject: [PATCH 066/128] cg_gcc: stop caring about compiling for unknown
 targets

---
 compiler/rustc_codegen_gcc/src/int.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler/rustc_codegen_gcc/src/int.rs b/compiler/rustc_codegen_gcc/src/int.rs
index 4a1db8d662a9..f3552d9b12fc 100644
--- a/compiler/rustc_codegen_gcc/src/int.rs
+++ b/compiler/rustc_codegen_gcc/src/int.rs
@@ -400,7 +400,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
             conv: Conv::C,
             can_unwind: false,
         };
-        fn_abi.adjust_for_foreign_abi(self.cx, ExternAbi::C { unwind: false }).unwrap();
+        fn_abi.adjust_for_foreign_abi(self.cx, ExternAbi::C { unwind: false });
 
         let ret_indirect = matches!(fn_abi.ret.mode, PassMode::Indirect { .. });
 

From 28164e3c047991294a3d4e7afd6b820c0c2f86ee Mon Sep 17 00:00:00 2001
From: Michael Goulet 
Date: Mon, 10 Feb 2025 19:47:00 +0000
Subject: [PATCH 067/128] Stop using span hack for contracts feature gating

---
 .../rustc_builtin_macros/src/contracts.rs     | 21 +++++++---------
 compiler/rustc_parse/src/parser/generics.rs   | 14 ++---------
 compiler/rustc_session/src/parse.rs           |  5 ----
 .../internal-feature-gating.stderr            |  8 +++----
 .../feature-gates/feature-gate-contracts.rs   |  2 --
 .../feature-gate-contracts.stderr             | 24 ++-----------------
 6 files changed, 17 insertions(+), 57 deletions(-)

diff --git a/compiler/rustc_builtin_macros/src/contracts.rs b/compiler/rustc_builtin_macros/src/contracts.rs
index 85a30f7bdc9b..0cba29f2b312 100644
--- a/compiler/rustc_builtin_macros/src/contracts.rs
+++ b/compiler/rustc_builtin_macros/src/contracts.rs
@@ -4,8 +4,8 @@ use rustc_ast::token;
 use rustc_ast::tokenstream::{DelimSpacing, DelimSpan, Spacing, TokenStream, TokenTree};
 use rustc_errors::ErrorGuaranteed;
 use rustc_expand::base::{AttrProcMacro, ExtCtxt};
-use rustc_span::Span;
 use rustc_span::symbol::{Ident, Symbol, kw, sym};
+use rustc_span::{DesugaringKind, Span};
 
 pub(crate) struct ExpandRequires;
 
@@ -121,23 +121,19 @@ fn expand_contract_clause(
         }
     }
 
-    // Record the span as a contract attribute expansion.
-    // This is used later to stop users from using the extended syntax directly
-    // which is gated via `contracts_internals`.
-    ecx.psess().contract_attribute_spans.push(attr_span);
-
     Ok(new_tts)
 }
 
 fn expand_requires_tts(
-    _ecx: &mut ExtCtxt<'_>,
+    ecx: &mut ExtCtxt<'_>,
     attr_span: Span,
     annotation: TokenStream,
     annotated: TokenStream,
 ) -> Result {
-    expand_contract_clause(_ecx, attr_span, annotated, |new_tts| {
+    let feature_span = ecx.with_def_site_ctxt(attr_span);
+    expand_contract_clause(ecx, attr_span, annotated, |new_tts| {
         new_tts.push_tree(TokenTree::Token(
-            token::Token::from_ast_ident(Ident::new(kw::ContractRequires, attr_span)),
+            token::Token::from_ast_ident(Ident::new(kw::ContractRequires, feature_span)),
             Spacing::Joint,
         ));
         new_tts.push_tree(TokenTree::Token(
@@ -155,14 +151,15 @@ fn expand_requires_tts(
 }
 
 fn expand_ensures_tts(
-    _ecx: &mut ExtCtxt<'_>,
+    ecx: &mut ExtCtxt<'_>,
     attr_span: Span,
     annotation: TokenStream,
     annotated: TokenStream,
 ) -> Result {
-    expand_contract_clause(_ecx, attr_span, annotated, |new_tts| {
+    let feature_span = ecx.with_def_site_ctxt(attr_span);
+    expand_contract_clause(ecx, attr_span, annotated, |new_tts| {
         new_tts.push_tree(TokenTree::Token(
-            token::Token::from_ast_ident(Ident::new(kw::ContractEnsures, attr_span)),
+            token::Token::from_ast_ident(Ident::new(kw::ContractEnsures, feature_span)),
             Spacing::Joint,
         ));
         new_tts.push_tree(TokenTree::Delimited(
diff --git a/compiler/rustc_parse/src/parser/generics.rs b/compiler/rustc_parse/src/parser/generics.rs
index 86816819be27..11f0e579de5a 100644
--- a/compiler/rustc_parse/src/parser/generics.rs
+++ b/compiler/rustc_parse/src/parser/generics.rs
@@ -302,26 +302,16 @@ impl<'a> Parser<'a> {
     pub(super) fn parse_contract(
         &mut self,
     ) -> PResult<'a, Option>> {
-        let gate = |span| {
-            if self.psess.contract_attribute_spans.contains(span) {
-                // span was generated via a builtin contracts attribute, so gate as end-user visible
-                self.psess.gated_spans.gate(sym::contracts, span);
-            } else {
-                // span was not generated via a builtin contracts attribute, so gate as internal machinery
-                self.psess.gated_spans.gate(sym::contracts_internals, span);
-            }
-        };
-
         let requires = if self.eat_keyword_noexpect(exp!(ContractRequires).kw) {
+            self.psess.gated_spans.gate(sym::contracts_internals, self.prev_token.span);
             let precond = self.parse_expr()?;
-            gate(precond.span);
             Some(precond)
         } else {
             None
         };
         let ensures = if self.eat_keyword_noexpect(exp!(ContractEnsures).kw) {
+            self.psess.gated_spans.gate(sym::contracts_internals, self.prev_token.span);
             let postcond = self.parse_expr()?;
-            gate(postcond.span);
             Some(postcond)
         } else {
             None
diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs
index d4db05ce139f..e0405a71f65a 100644
--- a/compiler/rustc_session/src/parse.rs
+++ b/compiler/rustc_session/src/parse.rs
@@ -208,10 +208,6 @@ pub struct ParseSess {
     pub config: Cfg,
     pub check_config: CheckCfg,
     pub edition: Edition,
-    /// Places where contract attributes were expanded into unstable AST forms.
-    /// This is used to allowlist those spans (so that we only check them against the feature
-    /// gate for the externally visible interface, and not internal implmentation machinery).
-    pub contract_attribute_spans: AppendOnlyVec,
     /// Places where raw identifiers were used. This is used to avoid complaining about idents
     /// clashing with keywords in new editions.
     pub raw_identifier_spans: AppendOnlyVec,
@@ -260,7 +256,6 @@ impl ParseSess {
             config: Cfg::default(),
             check_config: CheckCfg::default(),
             edition: ExpnId::root().expn_data().edition,
-            contract_attribute_spans: Default::default(),
             raw_identifier_spans: Default::default(),
             bad_unicode_identifiers: Lock::new(Default::default()),
             source_map,
diff --git a/tests/ui/contracts/internal_machinery/internal-feature-gating.stderr b/tests/ui/contracts/internal_machinery/internal-feature-gating.stderr
index c0e1522f54c6..7302694a7874 100644
--- a/tests/ui/contracts/internal_machinery/internal-feature-gating.stderr
+++ b/tests/ui/contracts/internal_machinery/internal-feature-gating.stderr
@@ -1,18 +1,18 @@
 error[E0658]: contract internal machinery is for internal use only
-  --> $DIR/internal-feature-gating.rs:16:45
+  --> $DIR/internal-feature-gating.rs:16:28
    |
 LL |     fn identity_1() -> i32 contract_requires(|| true) { 10 }
-   |                                             ^^^^^^^^^
+   |                            ^^^^^^^^^^^^^^^^^
    |
    = note: see issue #128044  for more information
    = help: add `#![feature(contracts_internals)]` 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[E0658]: contract internal machinery is for internal use only
-  --> $DIR/internal-feature-gating.rs:18:44
+  --> $DIR/internal-feature-gating.rs:18:28
    |
 LL |     fn identity_2() -> i32 contract_ensures(|_| true) { 10 }
-   |                                            ^^^^^^^^^^
+   |                            ^^^^^^^^^^^^^^^^
    |
    = note: see issue #128044  for more information
    = help: add `#![feature(contracts_internals)]` to the crate attributes to enable
diff --git a/tests/ui/feature-gates/feature-gate-contracts.rs b/tests/ui/feature-gates/feature-gate-contracts.rs
index 5544f1d82ee4..1759d23077b5 100644
--- a/tests/ui/feature-gates/feature-gate-contracts.rs
+++ b/tests/ui/feature-gates/feature-gate-contracts.rs
@@ -3,9 +3,7 @@
 #[core::contracts::requires(x > 0)]
 pub fn requires_needs_it(x: i32) { }
 //~^^  ERROR use of unstable library feature `contracts`
-//~^^^ ERROR contracts are incomplete
 
 #[core::contracts::ensures(|ret| *ret > 0)]
 pub fn ensures_needs_it() -> i32 { 10 }
 //~^^  ERROR use of unstable library feature `contracts`
-//~^^^ ERROR contracts are incomplete
diff --git a/tests/ui/feature-gates/feature-gate-contracts.stderr b/tests/ui/feature-gates/feature-gate-contracts.stderr
index 4403e7df50b4..4b0f7150973f 100644
--- a/tests/ui/feature-gates/feature-gate-contracts.stderr
+++ b/tests/ui/feature-gates/feature-gate-contracts.stderr
@@ -9,7 +9,7 @@ LL | #[core::contracts::requires(x > 0)]
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: use of unstable library feature `contracts`
-  --> $DIR/feature-gate-contracts.rs:8:3
+  --> $DIR/feature-gate-contracts.rs:7:3
    |
 LL | #[core::contracts::ensures(|ret| *ret > 0)]
    |   ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -18,26 +18,6 @@ LL | #[core::contracts::ensures(|ret| *ret > 0)]
    = help: add `#![feature(contracts)]` 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[E0658]: contracts are incomplete
-  --> $DIR/feature-gate-contracts.rs:3:1
-   |
-LL | #[core::contracts::requires(x > 0)]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #128044  for more information
-   = help: add `#![feature(contracts)]` 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[E0658]: contracts are incomplete
-  --> $DIR/feature-gate-contracts.rs:8:1
-   |
-LL | #[core::contracts::ensures(|ret| *ret > 0)]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #128044  for more information
-   = help: add `#![feature(contracts)]` 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: aborting due to 4 previous errors
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0658`.

From f78099e618a0895619dd7a5a834cd95cfebdefe8 Mon Sep 17 00:00:00 2001
From: Michael Goulet 
Date: Mon, 10 Feb 2025 20:15:30 +0000
Subject: [PATCH 068/128] Fix imports, remove attrs for unused_*

---
 compiler/rustc_builtin_macros/src/contracts.rs | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/compiler/rustc_builtin_macros/src/contracts.rs b/compiler/rustc_builtin_macros/src/contracts.rs
index 0cba29f2b312..6a24af361fe7 100644
--- a/compiler/rustc_builtin_macros/src/contracts.rs
+++ b/compiler/rustc_builtin_macros/src/contracts.rs
@@ -1,11 +1,9 @@
-#![allow(unused_imports, unused_variables)]
-
 use rustc_ast::token;
 use rustc_ast::tokenstream::{DelimSpacing, DelimSpan, Spacing, TokenStream, TokenTree};
 use rustc_errors::ErrorGuaranteed;
 use rustc_expand::base::{AttrProcMacro, ExtCtxt};
-use rustc_span::symbol::{Ident, Symbol, kw, sym};
-use rustc_span::{DesugaringKind, Span};
+use rustc_span::Span;
+use rustc_span::symbol::{Ident, Symbol, kw};
 
 pub(crate) struct ExpandRequires;
 

From f0845adb0c1b7a7fa1bef73e749b2d7e1d7f374d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Esteban=20K=C3=BCber?= 
Date: Tue, 9 Jul 2024 22:30:26 +0000
Subject: [PATCH 069/128] Show diff suggestion format on verbose replacement

```
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
  --> $DIR/attempted-access-non-fatal.rs:7:15
   |
LL |     let _ = 2.l;
   |               ^
   |
help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix
   |
LL -     let _ = 2.l;
LL +     let _ = 2.0f64;
   |
```
---
 compiler/rustc_errors/src/emitter.rs          |   2 +-
 .../tests/ui-toml/dbg_macro/dbg_macro.stderr  |  31 +-
 .../doc_markdown.stderr                       |   5 +-
 .../doc_markdown.stderr                       |  15 +-
 .../enum_variant_size.stderr                  |   5 +-
 .../renamed_function_params.default.stderr    |   5 +-
 .../renamed_function_params.extend.stderr     |   5 +-
 .../ui-toml/unwrap_used/unwrap_used.stderr    |  75 +-
 src/tools/clippy/tests/ui/assign_ops2.stderr  |  90 +-
 .../ui/bind_instead_of_map_multipart.stderr   |  20 +-
 .../ui/borrow_deref_ref_unfixable.stderr      |  10 +-
 src/tools/clippy/tests/ui/cast.stderr         | 103 +-
 .../clippy/tests/ui/cast_lossless_bool.stderr |  75 +-
 .../tests/ui/cast_lossless_float.stderr       |  65 +-
 .../tests/ui/cast_lossless_integer.stderr     | 198 ++--
 .../clippy/tests/ui/cast_size.64bit.stderr    |  45 +-
 src/tools/clippy/tests/ui/create_dir.stderr   |  10 +-
 .../tests/ui/dbg_macro/dbg_macro.stderr       |  81 +-
 .../ui/dbg_macro/dbg_macro_unfixable.stderr   |  25 +-
 .../clippy/tests/ui/doc/doc-fixable.stderr    | 161 +--
 .../ui/doc/doc_markdown-issue_13097.stderr    |   5 +-
 .../clippy/tests/ui/doc/issue_10262.stderr    |   5 +-
 .../clippy/tests/ui/doc/issue_12795.stderr    |  20 +-
 .../clippy/tests/ui/doc/issue_9473.stderr     |   5 +-
 .../tests/ui/doc/unbalanced_ticks.stderr      |  15 +-
 .../clippy/tests/ui/eager_transmute.stderr    |  85 +-
 .../ui/empty_line_after/doc_comments.stderr   |   5 +-
 .../tests/ui/excessive_precision.stderr       |  80 +-
 .../tests/ui/fn_to_numeric_cast_any.stderr    |  81 +-
 src/tools/clippy/tests/ui/for_kv_map.stderr   |  30 +-
 .../tests/ui/four_forward_slashes.stderr      |   8 +
 .../ui/four_forward_slashes_first_line.stderr |   2 +
 src/tools/clippy/tests/ui/get_unwrap.stderr   |  85 +-
 .../clippy/tests/ui/implicit_hasher.stderr    |  15 +-
 .../clippy/tests/ui/implicit_return.stderr    |  67 +-
 src/tools/clippy/tests/ui/iter_nth.stderr     |  40 +-
 .../tests/ui/join_absolute_paths.stderr       |  40 +-
 .../tests/ui/large_enum_variant.64bit.stderr  |  65 +-
 .../tests/ui/legacy_numeric_constants.stderr  |  80 +-
 src/tools/clippy/tests/ui/literals.stderr     |  35 +-
 .../tests/ui/lossy_float_literal.stderr       |  55 +-
 .../tests/ui/manual_assert.edition2018.stderr |  10 +-
 .../tests/ui/manual_assert.edition2021.stderr |  10 +-
 .../clippy/tests/ui/manual_async_fn.stderr    |  60 +-
 .../tests/ui/manual_float_methods.stderr      |  45 +-
 .../tests/ui/manual_ignore_case_cmp.stderr    | 245 +++--
 .../tests/ui/manual_is_ascii_check.stderr     |  20 +-
 .../tests/ui/map_all_any_identity.stderr      |  10 +-
 ...ap_with_unused_argument_over_ranges.stderr |  10 +-
 ...h_unused_argument_over_ranges_nostd.stderr |   5 +-
 .../clippy/tests/ui/match_result_ok.stderr    |  15 +-
 .../tests/ui/match_str_case_mismatch.stderr   |  35 +-
 .../tests/ui/needless_borrow_pat.stderr       |  10 +-
 .../ui/needless_for_each_unfixable.stderr     |   5 +-
 .../tests/ui/needless_pass_by_value.stderr    |  20 +-
 .../tests/ui/needless_range_loop.stderr       |  70 +-
 .../tests/ui/needless_range_loop2.stderr      |  40 +-
 .../clippy/tests/ui/needless_return.stderr    |  50 +-
 src/tools/clippy/tests/ui/never_loop.stderr   |  10 +-
 .../ui/non_canonical_partial_ord_impl.stderr  |   5 +-
 .../non_std_lazy_static_fixable.stderr        |  15 +-
 .../non_std_lazy_static_unfixable.stderr      |  15 +-
 .../clippy/tests/ui/nonminimal_bool.stderr    |  50 +-
 .../clippy/tests/ui/octal_escapes.stderr      | 110 ++-
 src/tools/clippy/tests/ui/op_ref.stderr       |   5 +-
 .../tests/ui/option_as_ref_cloned.stderr      |  15 +-
 .../clippy/tests/ui/redundant_guards.stderr   |   5 +-
 .../tests/ui/ref_binding_to_reference.stderr  |  10 +-
 .../tests/ui/ref_option/ref_option.all.stderr |  10 +-
 .../ui/ref_option/ref_option.private.stderr   |   5 +-
 .../tests/ui/repeat_vec_with_capacity.stderr  |  15 +-
 .../ui/repeat_vec_with_capacity_nostd.stderr  |   5 +-
 .../ui/reversed_empty_ranges_fixable.stderr   |  20 +-
 ...reversed_empty_ranges_loops_fixable.stderr |  30 +-
 .../tests/ui/single_range_in_vec_init.stderr  |  90 +-
 .../tests/ui/string_lit_chars_any.stderr      |  25 +-
 .../ui/suspicious_command_arg_space.stderr    |  10 +-
 .../tests/ui/suspicious_doc_comments.stderr   |  15 +-
 .../tests/ui/suspicious_to_owned.stderr       |  40 +-
 .../ui/suspicious_xor_used_as_pow.stderr      |  35 +-
 .../tests/ui/transmute_ptr_to_ptr.stderr      |  55 +-
 ...transmutes_expressible_as_ptr_casts.stderr |  10 +-
 src/tools/clippy/tests/ui/unit_arg.stderr     |  18 +-
 .../tests/ui/unknown_clippy_lints.stderr      |  10 +-
 .../tests/ui/unnecessary_lazy_eval.stderr     | 315 +++---
 .../ui/unnecessary_lazy_eval_unfixable.stderr |  20 +-
 .../ui/unnecessary_literal_unwrap.stderr      |  50 +-
 .../clippy/tests/ui/unnecessary_map_or.stderr |  48 +-
 .../clippy/tests/ui/unnecessary_wraps.stderr  |  44 +-
 .../tests/ui/unnested_or_patterns.stderr      |  85 +-
 .../tests/ui/unnested_or_patterns2.stderr     |  40 +-
 .../tests/ui/unused_enumerate_index.stderr    |  10 +-
 .../tests/ui/unused_format_specs.stderr       |  20 +-
 .../clippy/tests/ui/unused_result_ok.stderr   |  20 +-
 .../intra-doc/disambiguator-mismatch.stderr   |  55 +-
 ...ncompatible-primitive-disambiguator.stderr |   5 +-
 .../rustdoc-ui/intra-doc/prim-conflict.stderr |  20 +-
 tests/rustdoc-ui/intra-doc/value-ctor.stderr  |  25 +-
 .../rustdoc-ui/intra-doc/weird-syntax.stderr  |  35 +-
 .../ice-generic-type-alias-105742.stderr      |   5 +-
 .../issues/ice-typeof-102986.stderr           |   5 +-
 tests/rustdoc-ui/issues/issue-120444-1.stderr |   5 +-
 tests/rustdoc-ui/issues/issue-120444-2.stderr |   5 +-
 .../lints/redundant_explicit_links.stderr     | 300 +++---
 .../anon-params-denied-2018.stderr            |   5 +-
 tests/ui/argument-suggestions/basic.stderr    |  20 +-
 tests/ui/argument-suggestions/complex.stderr  |   5 +-
 .../display-is-suggestable.stderr             |   5 +-
 .../extern-fn-arg-names.stderr                |   5 +-
 .../argument-suggestions/issue-100478.stderr  |  24 +-
 .../argument-suggestions/issue-101097.stderr  |  25 +-
 .../argument-suggestions/issue-109831.stderr  |   5 +-
 .../argument-suggestions/issue-96638.stderr   |   5 +-
 .../argument-suggestions/issue-97197.stderr   |   5 +-
 .../argument-suggestions/issue-98894.stderr   |   5 +-
 .../argument-suggestions/issue-98897.stderr   |   5 +-
 .../argument-suggestions/issue-99482.stderr   |   5 +-
 .../missing_arguments.stderr                  |  95 +-
 .../argument-suggestions/mixed_cases.stderr   |  25 +-
 .../permuted_arguments.stderr                 |  10 +-
 .../swapped_arguments.stderr                  |  25 +-
 .../suggest-array-length.stderr               |  20 +-
 tests/ui/asm/aarch64/parse-error.stderr       |  40 +-
 tests/ui/asm/invalid-const-operand.stderr     |  15 +-
 tests/ui/asm/parse-error.stderr               |  25 +-
 tests/ui/asm/x86_64/x86_64_parse_error.stderr |  15 +-
 .../associated-const-ambiguity-report.stderr  |  10 +-
 .../dont-select-if-disabled.stderr            |   5 +-
 .../issue-109071.no_gate.stderr               |  10 +-
 .../issue-109768.stderr                       |   5 +-
 .../associated-item-enum.stderr               |  15 +-
 .../assoc-type-eq-with-dyn-atb-fail.stderr    |   5 +-
 .../ui/associated-type-bounds/elision.stderr  |  10 +-
 .../path-ambiguous.stderr                     |  20 +-
 .../path-higher-ranked.stderr                 |  10 +-
 .../return-type-notation/path-no-qself.stderr |   5 +-
 .../suggest-assoc-ty-bound-on-eq-bound.stderr |  15 +-
 ...mbig-between-bound-and-where-clause.stderr |  60 +-
 ...rojection-from-multiple-supertraits.stderr |  20 +-
 .../associated-types-eq-1.stderr              |   5 +-
 .../associated-types-eq-2.stderr              |  23 +-
 ...sociated-types-in-ambiguous-context.stderr |  30 +-
 .../associated-types-path-1.stderr            |  10 +-
 .../associated-types-path-2.stderr            |   5 +-
 ...iated-types-project-from-hrtb-in-fn.stderr |   5 +-
 ...s-project-from-hrtb-in-trait-method.stderr |  10 +-
 .../defaults-specialization.stderr            |  10 +-
 .../defaults-suitability.current.stderr       |   5 +-
 .../defaults-suitability.next.stderr          |   5 +-
 .../associated-types/impl-wf-cycle-3.stderr   |   5 +-
 tests/ui/associated-types/invalid-ctor.stderr |   5 +-
 tests/ui/associated-types/issue-38821.stderr  |  10 +-
 .../issue-54108.current.stderr                |   5 +-
 .../associated-types/issue-54108.next.stderr  |   5 +-
 tests/ui/associated-types/issue-59324.stderr  |   5 +-
 .../async-closures/arg-mismatch.stderr        |   5 +-
 .../async-example-desugared-boxed.stderr      |   5 +-
 .../async-example-desugared-manual.stderr     |   5 +-
 ...orrect-move-async-order-issue-79694.stderr |   5 +-
 ...34-raw-ident-suggestion.edition2015.stderr |  10 +-
 ...34-raw-ident-suggestion.edition2018.stderr |  10 +-
 .../pin-ergonomics/sugar-no-const.stderr      |   5 +-
 ...st-switching-edition-on-await-cargo.stderr |   5 +-
 .../suggest-switching-edition-on-await.stderr |   5 +-
 .../ui/attributes/key-value-non-ascii.stderr  |   5 +-
 tests/ui/attributes/rustc_confusables.stderr  |  15 +-
 .../rustc_confusables_std_cases.stderr        |  45 +-
 tests/ui/binop/placement-syntax.stderr        |   5 +-
 tests/ui/block-result/issue-3563.stderr       |   5 +-
 ...y-borrowed-as-mutable-if-let-133941.stderr |  10 +-
 .../borrowck-struct-update-with-dtor.stderr   |  20 +-
 ...rowck-unsafe-static-mutable-borrows.stderr |   5 +-
 tests/ui/borrowck/index-mut-help.stderr       |  20 +-
 .../issue-115259-suggest-iter-mut.stderr      |   5 +-
 .../issue-62387-suggest-iter-mut-2.stderr     |   5 +-
 .../issue-62387-suggest-iter-mut.stderr       |  10 +-
 tests/ui/borrowck/issue-85765-closure.stderr  |  15 +-
 tests/ui/borrowck/issue-85765.stderr          |  15 +-
 ...estion-for-raw-pointer-issue-127562.stderr |   5 +-
 .../suggest-lt-on-ty-alias-w-generics.stderr  |   5 +-
 ...atched-arg-and-hir-arg-issue-126385.stderr |   5 +-
 tests/ui/btreemap/btreemap-index-mut-2.stderr |  15 +-
 tests/ui/btreemap/btreemap-index-mut.stderr   |  15 +-
 tests/ui/c-variadic/issue-86053-1.stderr      |   5 +-
 tests/ui/c-variadic/variadic-ffi-1.stderr     |  10 +-
 tests/ui/cast/cast-as-bool.stderr             |  25 +-
 tests/ui/cast/cast-rfc0401-2.stderr           |   5 +-
 .../ice-cast-type-with-error-124848.stderr    |   5 +-
 tests/ui/cast/issue-106883-is-empty.stderr    |  20 +-
 tests/ui/cfg/cfg-method-receiver.stderr       |   5 +-
 .../cfg-value-for-cfg-name-multiple.stderr    |  10 +-
 tests/ui/check-cfg/diagnotics.cargo.stderr    |  15 +-
 tests/ui/check-cfg/diagnotics.rustc.stderr    |  15 +-
 tests/ui/check-cfg/well-known-names.stderr    |   5 +-
 .../2229_closure_analysis/bad-pattern.stderr  |   5 +-
 .../2229_closure_analysis/issue-118144.stderr |   5 +-
 tests/ui/closures/issue-78720.stderr          |   5 +-
 tests/ui/closures/multiple-fn-bounds.stderr   |   5 +-
 .../cmse-nonsecure-call/generics.stderr       |   5 +-
 tests/ui/codemap_tests/two_files.stderr       |   3 +-
 tests/ui/compare-method/bad-self-type.stderr  |  10 +-
 tests/ui/compare-method/issue-90444.stderr    |  10 +-
 tests/ui/compare-method/region-extra-2.stderr |   5 +-
 .../reordered-type-param.stderr               |   5 +-
 .../cfg-attr-parse.stderr                     |  15 +-
 .../issue-33784.stderr                        |   5 +-
 .../const_param_ty_dyn_compatibility.stderr   |  10 +-
 .../early/invalid-const-arguments.stderr      |  10 +-
 .../ensure_is_evaluatable.stderr              |   5 +-
 .../fn_with_two_const_inputs.stderr           |   5 +-
 .../forbid-non-structural_match-types.stderr  |   2 +-
 .../generic_arg_infer/in-signature.stderr     |  30 +-
 .../abstract-const-as-cast-3.stderr           |  20 +-
 .../doesnt_unify_evaluatable.stderr           |   5 +-
 .../const_kind_expr/issue_114151.stderr       |   5 +-
 .../const_kind_expr/wf_obligation.stderr      |   5 +-
 ...e-a-closure-or-coroutine-ice-113776.stderr |  15 +-
 .../invalid-const-arg-for-type-param.stderr   |   5 +-
 tests/ui/const-generics/issue-80471.stderr    |   2 +-
 .../const-generics/issues/issue-87493.stderr  |   5 +-
 .../const-generics/issues/issue-97278.stderr  |   2 +-
 .../legacy-const-generics-bad.stderr          |   5 +-
 .../issue-89013-no-kw.stderr                  |   5 +-
 .../parser-error-recovery/issue-89013.stderr  |   5 +-
 .../type-dependent/type-mismatch.full.stderr  |   5 +-
 .../type-dependent/type-mismatch.min.stderr   |   5 +-
 .../consts/assoc-const-elided-lifetime.stderr |   5 +-
 .../const-blocks/fn-call-in-non-const.stderr  |   5 +-
 .../consts/const-pattern-irrefutable.stderr   |  20 +-
 tests/ui/consts/const_let_assign2.stderr      |   5 +-
 .../ice-bad-input-type-for-cast-83056.stderr  |   5 +-
 tests/ui/consts/issue-104768.stderr           |   5 +-
 tests/ui/consts/issue-3521.stderr             |   5 +-
 tests/ui/consts/issue-91560.stderr            |  10 +-
 .../ui/consts/non-const-value-in-const.stderr |  10 +-
 .../refs_check_const_eq-issue-88384.stderr    |   4 +-
 tests/ui/coroutine/issue-102645.stderr        |   5 +-
 tests/ui/coroutine/resume-arg-outlives.stderr |  10 +-
 .../ui/coverage-attr/bad-attr-ice.feat.stderr |   6 +-
 .../coverage-attr/bad-attr-ice.nofeat.stderr  |   6 +-
 tests/ui/coverage-attr/bad-syntax.stderr      |  80 +-
 tests/ui/coverage-attr/name-value.stderr      |  72 +-
 tests/ui/coverage-attr/subword.stderr         |  40 +-
 tests/ui/coverage-attr/word-only.stderr       |  72 +-
 .../ui/deprecation/atomic_initializers.stderr |   5 +-
 tests/ui/deprecation/invalid-literal.stderr   |  15 +-
 ...4637-deprecated-associated-function.stderr |  15 +-
 tests/ui/deprecation/suggestion.stderr        |  10 +-
 tests/ui/deref-patterns/issue-71676-1.stderr  |   5 +-
 tests/ui/derived-errors/issue-30580.stderr    |   5 +-
 .../struct_destructure_fail.stderr            |  15 +-
 .../tuple_struct_destructure_fail.stderr      |  10 +-
 .../diagnostic_namespace/suggest_typos.stderr |  15 +-
 tests/ui/did_you_mean/bad-assoc-ty.stderr     |  90 +-
 .../brackets-to-braces-single-element.stderr  |  15 +-
 .../compatible-variants-in-pat.stderr         |  10 +-
 .../dont-suggest-hygienic-fields.stderr       |   5 +-
 tests/ui/did_you_mean/issue-36798.stderr      |   5 +-
 ...1679-tilde-bitwise-negation-attempt.stderr |  25 +-
 .../issue-42599_available_fields_note.stderr  |  10 +-
 ...ssue-46718-struct-pattern-dotdotdot.stderr |   5 +-
 ...-identifier-not-instead-of-negation.stderr |  25 +-
 ...92-tuple-destructure-missing-parens.stderr |   5 +-
 ...de-confusable-in-float-literal-expt.stderr |   5 +-
 ...sue-54109-and_instead_of_ampersands.stderr |  40 +-
 .../issue-54109-without-witness.stderr        |  40 +-
 ...ssue-56028-there-is-an-enum-variant.stderr |  20 +-
 ...issue-87830-try-brackets-for-arrays.stderr |  10 +-
 tests/ui/did_you_mean/pub-macro-rules.stderr  |   5 +-
 .../replace-impl-infer-ty-from-trait.stderr   |   5 +-
 .../did_you_mean/use_instead_of_import.stderr |  20 +-
 ...if-let-rescope-borrowck-suggestions.stderr |   5 +-
 tests/ui/drop/lint-if-let-rescope.stderr      |  20 +-
 .../dropck/explicit-drop-bounds.bad1.stderr   |  10 +-
 .../issue-90528-unsizing-suggestion-3.stderr  |   5 +-
 .../avoid-ice-on-warning-2.new.stderr         |   5 +-
 .../avoid-ice-on-warning-3.new.stderr         |  10 +-
 .../avoid-ice-on-warning.new.stderr           |   5 +-
 .../avoid-ice-on-warning.old.stderr           |   5 +-
 ...-fn-inputs-and-outputs-issue-125139.stderr | 135 +--
 .../supertrait-mentions-GAT.stderr            |   5 +-
 .../supertrait-mentions-Self.stderr           |   5 +-
 .../dyn-keyword/dyn-2021-edition-error.stderr |   5 +-
 .../misspelled-associated-item.stderr         |   5 +-
 .../ui/empty/empty-struct-braces-expr.stderr  |  60 +-
 .../ui/empty/empty-struct-braces-pat-2.stderr |  40 +-
 .../ui/empty/empty-struct-braces-pat-3.stderr |  20 +-
 tests/ui/empty/empty-struct-tuple-pat.stderr  |  10 +-
 tests/ui/empty/empty-struct-unit-pat.stderr   |  60 +-
 .../discriminant-ill-typed.stderr             |  40 +-
 tests/ui/enum/assoc-fn-call-on-variant.stderr |   5 +-
 .../error-recovery-issue-55897.stderr         |   5 +-
 tests/ui/error-codes/E0027.stderr             |  60 +-
 tests/ui/error-codes/E0034.stderr             |  10 +-
 tests/ui/error-codes/E0040.stderr             |   5 +-
 tests/ui/error-codes/E0054.stderr             |   5 +-
 tests/ui/error-codes/E0057.stderr             |   5 +-
 tests/ui/error-codes/E0060.stderr             |   5 +-
 tests/ui/error-codes/E0061.stderr             |  10 +-
 tests/ui/error-codes/E0121.stderr             |   5 +-
 tests/ui/error-codes/E0214.stderr             |   5 +-
 tests/ui/error-codes/E0221.stderr             |  15 +-
 tests/ui/error-codes/E0259.stderr             |   3 +-
 tests/ui/error-codes/E0260.stderr             |   3 +-
 tests/ui/error-codes/E0283.stderr             |   5 +-
 tests/ui/error-codes/E0423.stderr             |  10 +-
 tests/ui/error-codes/E0435.stderr             |   5 +-
 tests/ui/error-codes/E0516.stderr             |   5 +-
 tests/ui/error-codes/E0637.stderr             |   5 +-
 tests/ui/error-codes/E0642.stderr             |  15 +-
 tests/ui/error-codes/E0746.stderr             |  10 +-
 tests/ui/error-codes/ex-E0612.stderr          |   5 +-
 tests/ui/error-festival.stderr                |  10 +-
 .../become-operator.stderr                    |  15 +-
 .../ui/explicit/explicit-call-to-dtor.stderr  |   5 +-
 .../explicit-call-to-supertrait-dtor.stderr   |   5 +-
 tests/ui/expr/if/if-branch-types.stderr       |   5 +-
 tests/ui/expr/if/if-else-type-mismatch.stderr |  10 +-
 tests/ui/expr/issue-22933-2.stderr            |   5 +-
 tests/ui/extern/extern-const.stderr           |   5 +-
 tests/ui/extern/extern-crate-rename.stderr    |   5 +-
 .../ui/extern/extern-crate-visibility.stderr  |  10 +-
 tests/ui/extern/issue-18819.stderr            |   5 +-
 tests/ui/extern/not-in-block.stderr           |  20 +-
 .../feature-gate-extern_absolute_paths.stderr |   5 +-
 .../feature-gate-negate-unsigned.stderr       |   5 +-
 .../feature-gate-never_patterns.stderr        |   3 +-
 ...-gate-unboxed-closures-manual-impls.stderr |  10 +-
 .../feature-gate-unsized_fn_params.stderr     |   5 +-
 .../feature-gate-unsized_locals.stderr        |   5 +-
 .../issue-43106-gating-of-macro_use.stderr    |  10 +-
 ...mat-args-non-identifier-diagnostics.stderr |   5 +-
 tests/ui/fmt/format-string-error-2.stderr     |   5 +-
 .../no-inline-literals-out-of-range.stderr    |  15 +-
 .../struct-field-as-captured-argument.stderr  |  35 +-
 ...gest-wrongly-order-format-parameter.stderr |  15 +-
 tests/ui/fn/error-recovery-mismatch.stderr    |   5 +-
 tests/ui/fn/fn-pointer-mismatch.stderr        |  10 +-
 tests/ui/fn/fn-recover-return-sign.stderr     |  20 +-
 tests/ui/fn/fn-recover-return-sign2.stderr    |   5 +-
 tests/ui/fn/param-mismatch-foreign.stderr     |   5 +-
 tests/ui/force-inlining/invalid.stderr        |  24 +-
 ...unctional-struct-update-noncopyable.stderr |   5 +-
 .../gat-trait-path-parenthesised-args.stderr  |   5 +-
 .../impl_bounds.stderr                        |   5 +-
 .../issue-70304.stderr                        |   5 +-
 .../mismatched-where-clause-regions.stderr    |   5 +-
 .../missing-bounds.stderr                     |   5 +-
 .../duplicate-where-clause.stderr             |   6 +-
 .../generics/issue-95208-ignore-qself.stderr  |   5 +-
 tests/ui/generics/issue-95208.stderr          |   5 +-
 ...verlapping-errors-span-issue-123861.stderr |   5 +-
 ...pats-inclusive-dotdotdot-bad-syntax.stderr |  25 +-
 ...pen-range-pats-ref-ambiguous-interp.stderr |   5 +-
 tests/ui/hashmap/hashmap-index-mut.stderr     |  15 +-
 .../trait-bounds/issue-58451.stderr           |   5 +-
 tests/ui/hygiene/globs.stderr                 |  10 +-
 ...-trait-in-return-position-dyn-trait.stderr |   5 +-
 ...n-trait-return-should-be-impl-trait.stderr |  30 +-
 tests/ui/impl-trait/equality.stderr           |   5 +-
 .../ui/impl-trait/impl-fn-hrtb-bounds.stderr  |   5 +-
 .../impl-generic-mismatch-ab.stderr           |   5 +-
 .../impl-trait/impl-generic-mismatch.stderr   |  10 +-
 .../in-assoc-type-unconstrained.stderr        |   5 +-
 .../bad-item-bound-within-rpitit.stderr       |  11 +-
 ...e-to-map-to-reearlybound-ice-108580.stderr |   5 +-
 tests/ui/impl-trait/in-trait/foreign.stderr   |  10 +-
 .../method-signature-matches.lt.stderr        |   5 +-
 .../method-signature-matches.mismatch.stderr  |   5 +-
 ...od-signature-matches.mismatch_async.stderr |   5 +-
 .../opaque-and-lifetime-mismatch.stderr       |   5 +-
 .../in-trait/refine-captures.stderr           |  15 +-
 tests/ui/impl-trait/in-trait/refine.stderr    |  25 +-
 ...den-types-self-implied-wf-via-param.stderr |   4 +-
 .../in-trait/specialization-broken.stderr     |   5 +-
 .../must_outlive_least_region_or_bound.stderr |  50 +-
 .../no-method-suggested-traits.stderr         |  30 +-
 .../opaque-used-in-extraneous-argument.stderr |   5 +-
 ...type-err-cause-on-impl-trait-return.stderr |  55 +-
 .../precise-capturing/bad-lifetimes.stderr    |   5 +-
 .../hidden-type-suggestion.stderr             |  10 +-
 .../precise-capturing/migration-note.stderr   |   5 +-
 .../overcaptures-2024.stderr                  |  10 +-
 ...s-impl-trait-declaration-too-subtle.stderr |  10 +-
 tests/ui/impl-trait/trait_type.stderr         |   5 +-
 tests/ui/impl-trait/where-allowed.stderr      |   5 +-
 .../ui/imports/bad-import-with-rename.stderr  |  10 +-
 .../extern-crate-self-fail.stderr             |   5 +-
 tests/ui/imports/glob-resolve1.stderr         |   5 +-
 ...-crate-rename-suggestion-formatting.stderr |   3 +-
 .../ui/imports/issue-45829/import-self.stderr |  15 +-
 .../ui/imports/issue-45829/issue-45829.stderr |   5 +-
 .../issue-45829/rename-extern-vs-use.stderr   |   3 +-
 .../issue-45829/rename-extern-with-tab.stderr |   3 +-
 .../imports/issue-45829/rename-extern.stderr  |   3 +-
 .../issue-45829/rename-use-vs-extern.stderr   |   5 +-
 .../issue-45829/rename-use-with-tabs.stderr   |   5 +-
 .../issue-45829/rename-with-path.stderr       |   5 +-
 tests/ui/imports/issue-45829/rename.stderr    |   5 +-
 tests/ui/imports/issue-56125.stderr           |  20 +-
 tests/ui/imports/issue-57015.stderr           |   5 +-
 tests/ui/imports/issue-59764.stderr           |  10 +-
 ...ultiple-extern-by-macro-for-buitlin.stderr |   3 +-
 ...multiple-extern-by-macro-for-custom.stderr |   3 +-
 ...ultiple-extern-by-macro-for-inexist.stderr |   3 +-
 tests/ui/imports/no-std-inject.stderr         |   5 +-
 ...private-std-reexport-suggest-public.stderr |   5 +-
 ...est-import-issue-120074.edition2015.stderr |   5 +-
 ...est-import-issue-120074.edition2021.stderr |   5 +-
 tests/ui/include-macros/parent_dir.stderr     |  20 +-
 .../inference/ambiguous_type_parameter.stderr |   5 +-
 tests/ui/inference/char-as-str-single.stderr  |  20 +-
 tests/ui/inference/inference_unstable.stderr  |   5 +-
 .../inference_unstable_featured.stderr        |  10 +-
 tests/ui/inference/issue-103587.stderr        |   5 +-
 tests/ui/inference/issue-12028.stderr         |   5 +-
 tests/ui/inference/issue-70082.stderr         |   5 +-
 tests/ui/inference/issue-71584.stderr         |   5 +-
 tests/ui/inference/issue-72616.stderr         |  10 +-
 tests/ui/inference/issue-72690.stderr         |  40 +-
 tests/ui/inference/issue-80816.stderr         |   5 +-
 tests/ui/inference/str-as-char.stderr         |  20 +-
 tests/ui/infinite/infinite-assoc.stderr       |   5 +-
 .../cross-const-control-flow-125846.stderr    |   5 +-
 ..._legacy_const_generics-issue-123077.stderr |  30 +-
 tests/ui/issues/issue-13497.stderr            |   5 +-
 tests/ui/issues/issue-17546.stderr            |  20 +-
 tests/ui/issues/issue-17800.stderr            |   5 +-
 tests/ui/issues/issue-18107.stderr            |   5 +-
 tests/ui/issues/issue-18446.stderr            |   5 +-
 tests/ui/issues/issue-20225.stderr            |  15 +-
 tests/ui/issues/issue-21332.stderr            |   5 +-
 tests/ui/issues/issue-23041.stderr            |   5 +-
 tests/ui/issues/issue-23073.stderr            |   5 +-
 tests/ui/issues/issue-23217.stderr            |   5 +-
 tests/ui/issues/issue-23589.stderr            |  10 +-
 tests/ui/issues/issue-27433.stderr            |   5 +-
 tests/ui/issues/issue-28971.stderr            |   5 +-
 tests/ui/issues/issue-32004.stderr            |  10 +-
 tests/ui/issues/issue-34209.stderr            |   5 +-
 tests/ui/issues/issue-3521-2.stderr           |   5 +-
 .../issue-3668-2.stderr                       |   5 +-
 .../issue-3668.stderr                         |   5 +-
 tests/ui/issues/issue-3702-2.stderr           |  10 +-
 .../ui/issues/issue-41652/issue-41652.stderr  |   5 +-
 tests/ui/issues/issue-41726.stderr            |   5 +-
 tests/ui/issues/issue-42312.stderr            |   5 +-
 tests/ui/issues/issue-44239.stderr            |   5 +-
 ...73-zero-padded-tuple-struct-indices.stderr |   5 +-
 tests/ui/issues/issue-4736.stderr             |   5 +-
 tests/ui/issues/issue-50571.stderr            |   5 +-
 tests/ui/issues/issue-51874.stderr            |   5 +-
 tests/ui/issues/issue-5358-1.stderr           |   5 +-
 tests/ui/issues/issue-56175.stderr            |  10 +-
 .../issue-57741.stderr                        |  20 +-
 tests/ui/issues/issue-5883.stderr             |   5 +-
 tests/ui/issues/issue-69683.stderr            |  10 +-
 .../issue-76077-1.stderr                      |   5 +-
 tests/ui/issues/issue-76191.stderr            |   5 +-
 tests/ui/issues/issue-78622.stderr            |   5 +-
 tests/ui/issues/issue-80607.stderr            |   5 +-
 tests/ui/issues/issue-8761.stderr             |  10 +-
 .../iterators/into-iter-on-arrays-2018.stderr |  15 +-
 .../iterators/into-iter-on-arrays-lint.stderr |  40 +-
 .../into-iter-on-boxed-slices-2021.stderr     |  15 +-
 .../into-iter-on-boxed-slices-lint.stderr     |  10 +-
 tests/ui/label/label_misspelled.stderr        |  30 +-
 .../let-else/let-else-deref-coercion.stderr   |  10 +-
 tests/ui/lexer/lex-bad-char-literals-1.stderr |  10 +-
 tests/ui/lexer/lex-bad-char-literals-2.stderr |   5 +-
 tests/ui/lexer/lex-bad-char-literals-3.stderr |  10 +-
 tests/ui/lexer/lex-bad-char-literals-5.stderr |  10 +-
 tests/ui/lexer/lex-bad-char-literals-6.stderr |  15 +-
 .../lex-bad-str-literal-as-char-1.stderr      |   5 +-
 .../lex-bad-str-literal-as-char-2.stderr      |   5 +-
 ...-bad-str-literal-as-char-3.rust2015.stderr |   5 +-
 ...-bad-str-literal-as-char-3.rust2018.stderr |   5 +-
 ...-bad-str-literal-as-char-3.rust2021.stderr |  10 +-
 .../lex-bad-str-literal-as-char-4.stderr      |  10 +-
 .../lifetimes/borrowck-let-suggestion.stderr  |   5 +-
 tests/ui/lifetimes/fullwidth-ampersand.stderr |   5 +-
 tests/ui/lifetimes/issue-26638.stderr         |  15 +-
 .../issue-90170-elision-mismatch.stderr       |   5 +-
 .../immediately-followed-by-lt.e2021.stderr   |   5 +-
 ...ide_pointer_comparisons_suggestions.stderr |  10 +-
 .../lint/dead-code/tuple-struct-field.stderr  |   5 +-
 .../lint/elided-named-lifetimes/static.stderr |   5 +-
 tests/ui/lint/fn-ptr-comparisons.stderr       |  60 +-
 tests/ui/lint/for_loop_over_fallibles.stderr  | 100 +-
 tests/ui/lint/issue-109152.stderr             |   5 +-
 tests/ui/lint/issue-109529.stderr             |   5 +-
 tests/ui/lint/issue-35075.stderr              |  10 +-
 .../issue-119696-err-on-fn.stderr             |  10 +-
 .../issue-119697-extra-let.stderr             |  20 +-
 .../let_underscore/let_underscore_drop.stderr |  10 +-
 .../let_underscore/let_underscore_lock.stderr |  30 +-
 .../lint-strict-provenance-fuzzy-casts.stderr |   5 +-
 .../lint-strict-provenance-lossy-casts.stderr |  10 +-
 tests/ui/lint/lint_map_unit_fn.stderr         |  15 +-
 ...ase-identifiers-suggestion-reserved.stderr |  15 +-
 tests/ui/lint/recommend-literal.stderr        |  15 +-
 tests/ui/lint/static-mut-refs.e2021.stderr    |  35 +-
 tests/ui/lint/static-mut-refs.e2024.stderr    |  35 +-
 tests/ui/lint/type-overflow.stderr            |  30 +-
 ...ue-67691-unused-field-in-or-pattern.stderr |  30 +-
 tests/ui/lint/wide_pointer_comparisons.stderr | 180 ++--
 .../loops/loop-break-value-no-repeat.stderr   |   5 +-
 tests/ui/loops/loop-break-value.stderr        |  45 +-
 .../macros/expand-full-no-resolution.stderr   |  10 +-
 .../macros/expr_2021_cargo_fix_edition.stderr |  10 +-
 tests/ui/macros/format-foreign.stderr         |  10 +-
 tests/ui/macros/issue-103529.stderr           |  10 +-
 tests/ui/macros/issue-109237.stderr           |   5 +-
 tests/ui/macros/issue-118786.stderr           |   5 +-
 tests/ui/macros/issue-99265.stderr            | 150 +--
 .../macro-backtrace-invalid-internals.stderr  |  10 +-
 tests/ui/macros/macro-inner-attributes.stderr |   5 +-
 tests/ui/macros/macro-use-wrong-name.stderr   |   5 +-
 tests/ui/macros/recovery-allowed.stderr       |   5 +-
 .../ui/malformed/malformed-meta-delim.stderr  |  10 +-
 .../malformed/malformed-special-attrs.stderr  |  10 +-
 tests/ui/match/issue-56685.stderr             |  20 +-
 .../match/match-pattern-field-mismatch.stderr |   5 +-
 .../meta/expected-error-correct-rev.a.stderr  |   5 +-
 .../meta-expected-error-wrong-rev.a.stderr    |   5 +-
 ...guate-associated-function-first-arg.stderr |  25 +-
 .../disambiguate-multiple-blanket-impl.stderr |  30 +-
 .../methods/disambiguate-multiple-impl.stderr |  30 +-
 .../disambiguate-multiple-trait-2.stderr      |  60 +-
 .../disambiguate-multiple-trait.stderr        |  30 +-
 tests/ui/methods/issues/issue-105732.stderr   |   5 +-
 tests/ui/methods/issues/issue-90315.stderr    |   5 +-
 ...od-ambig-one-trait-unknown-int-type.stderr |   5 +-
 ...method-ambig-two-traits-cross-crate.stderr |  10 +-
 ...method-ambig-two-traits-from-bounds.stderr |  10 +-
 .../method-ambig-two-traits-from-impls.stderr |  10 +-
 ...method-ambig-two-traits-from-impls2.stderr |  10 +-
 ...mbig-two-traits-with-default-method.stderr |  10 +-
 .../methods/method-ambiguity-no-rcvr.stderr   |  10 +-
 tests/ui/methods/method-call-err-msg.stderr   |  15 +-
 ...e-trait-object-with-separate-params.stderr |  15 +-
 .../method-not-found-but-doc-alias.stderr     |   5 +-
 .../method-on-ambiguous-numeric-type.stderr   |   5 +-
 .../methods/suggest-convert-ptr-to-ref.stderr |  10 +-
 tests/ui/mir/issue-106062.stderr              |  10 +-
 tests/ui/mir/issue-112269.stderr              |  10 +-
 tests/ui/mismatched_types/E0053.stderr        |  10 +-
 tests/ui/mismatched_types/cast-rfc0401.stderr |   5 +-
 ...arg-count-expected-type-issue-47244.stderr |   5 +-
 .../mismatched_types/closure-arg-count.stderr |  35 +-
 ...loat-literal-inference-restrictions.stderr |   5 +-
 tests/ui/mismatched_types/issue-106182.stderr |   5 +-
 tests/ui/mismatched_types/issue-112036.stderr |   5 +-
 tests/ui/mismatched_types/issue-13033.stderr  |   5 +-
 tests/ui/mismatched_types/issue-1362.stderr   |   5 +-
 tests/ui/mismatched_types/issue-1448-2.stderr |   5 +-
 .../mismatch-args-crash-issue-128848.stderr   |   5 +-
 .../mismatch-args-crash-issue-130400.stderr   |   5 +-
 .../mismatch-args-vargs-issue-130372.stderr   |   5 +-
 .../numeric-literal-cast.stderr               |  15 +-
 .../overloaded-calls-bad.stderr               |   5 +-
 .../ref-pat-suggestions.stderr                |   5 +-
 ...trait-objects-instead-of-impl-trait.stderr |  10 +-
 .../trait-impl-fn-incompatibility.stderr      |  10 +-
 ...ransforming-option-ref-issue-127545.stderr |  15 +-
 tests/ui/missing/missing-block-hint.stderr    |   5 +-
 .../missing-fields-in-struct-pattern.stderr   |   5 +-
 .../missing-const-parameter.stderr            |   5 +-
 .../missing-type-parameter2.stderr            |  25 +-
 .../ui/moves/needs-clone-through-deref.stderr |   5 +-
 ...clone-when-some-obligation-is-unmet.stderr |   5 +-
 ...use_of_moved_value_copy_suggestions.stderr |   5 +-
 tests/ui/namespace/namespace-mix.stderr       |  20 +-
 .../dependency-on-fallback-to-unit.stderr     |   5 +-
 tests/ui/never_type/issue-96335.stderr        |  10 +-
 ...local-static-mut-borrow-outlives-fn.stderr |   5 +-
 .../projection-no-regions-closure.stderr      |  10 +-
 .../projection-no-regions-fn.stderr           |  10 +-
 tests/ui/non-fmt-panic.stderr                 |  40 +-
 tests/ui/not-enough-arguments.stderr          |  10 +-
 tests/ui/numeric/const-scope.stderr           |  15 +-
 tests/ui/numeric/numeric-fields.stderr        |   5 +-
 .../numeric-suffix/numeric-suffix-i32.stderr  |  55 +-
 .../numeric-suffix/numeric-suffix-i64.stderr  |  55 +-
 .../numeric-suffix-isize.stderr               |  55 +-
 .../numeric-suffix/numeric-suffix-u32.stderr  |  55 +-
 .../numeric-suffix/numeric-suffix-u64.stderr  |  55 +-
 .../numeric-suffix-usize.stderr               |  55 +-
 .../numeric-suffix/numeric-suffix.stderr      | 280 +++---
 tests/ui/object-pointer-types.stderr          |   5 +-
 tests/ui/obsolete-in-place/bad.stderr         |   5 +-
 .../ui/on-unimplemented/bad-annotation.stderr |   6 +-
 tests/ui/on-unimplemented/issue-104140.stderr |  10 +-
 .../less-than-greater-than.stderr             |   5 +-
 .../or-patterns/multiple-pattern-typo.stderr  |  35 +-
 .../ui/or-patterns/remove-leading-vert.stderr |  30 +-
 tests/ui/panic-handler/weak-lang-item.stderr  |   3 +-
 tests/ui/parser/bad-char-literals.stderr      |  10 +-
 tests/ui/parser/bad-crate-name.stderr         |   5 +-
 .../bad-escape-suggest-raw-string.stderr      |   5 +-
 tests/ui/parser/bad-let-else-statement.stderr |  10 +-
 tests/ui/parser/bad-lit-suffixes.stderr       |   6 +-
 tests/ui/parser/byte-literals.stderr          |  10 +-
 tests/ui/parser/byte-string-literals.stderr   |   5 +-
 .../char/whitespace-character-literal.stderr  |   5 +-
 ...-param-decl-on-type-instead-of-impl.stderr |   5 +-
 .../parser/default-on-wrong-item-kind.stderr  |   5 +-
 tests/ui/parser/do-catch-suggests-try.stderr  |   5 +-
 tests/ui/parser/dotdotdot-expr.stderr         |  10 +-
 .../ui/parser/duplicate-where-clauses.stderr  |  30 +-
 tests/ui/parser/emoji-identifiers.stderr      |  10 +-
 tests/ui/parser/eq-gt-to-gt-eq.stderr         |  35 +-
 tests/ui/parser/expr-rarrow-call.stderr       |  25 +-
 .../extern-crate-unexpected-token.stderr      |   5 +-
 tests/ui/parser/extern-no-fn.stderr           |   5 +-
 tests/ui/parser/fn-body-eq-expr-semi.stderr   |  40 +-
 tests/ui/parser/fn-colon-return-type.stderr   |   5 +-
 .../parser/foreign-const-semantic-fail.stderr |  10 +-
 .../foreign-const-syntactic-fail.stderr       |  10 +-
 tests/ui/parser/increment-autofix-2.stderr    |  30 +-
 tests/ui/parser/increment-autofix.stderr      |  10 +-
 .../ui/parser/intersection-patterns-1.stderr  |  10 +-
 .../parser/issues/issue-100197-mut-let.stderr |   5 +-
 .../ui/parser/issues/issue-101477-enum.stderr |   5 +-
 .../ui/parser/issues/issue-101477-let.stderr  |   5 +-
 tests/ui/parser/issues/issue-102806.stderr    |  15 +-
 .../issue-103748-ICE-wrong-braces.stderr      |  10 +-
 .../issues/issue-104867-inc-dec-2.stderr      |  45 +-
 .../parser/issues/issue-104867-inc-dec.stderr |  25 +-
 tests/ui/parser/issues/issue-105366.stderr    |   5 +-
 .../ui/parser/issues/issue-108495-dec.stderr  |  25 +-
 tests/ui/parser/issues/issue-110014.stderr    |   5 +-
 tests/ui/parser/issues/issue-111416.stderr    |   5 +-
 .../ui/parser/issues/issue-118530-ice.stderr  |   5 +-
 .../issues/issue-17718-const-mut.stderr       |   3 +-
 .../issues/issue-23620-invalid-escapes.stderr |   5 +-
 tests/ui/parser/issues/issue-24375.stderr     |   5 +-
 tests/ui/parser/issues/issue-30318.stderr     |  10 +-
 tests/ui/parser/issues/issue-32214.stderr     |   5 +-
 tests/ui/parser/issues/issue-34255-1.stderr   |   5 +-
 tests/ui/parser/issues/issue-44406.stderr     |   5 +-
 tests/ui/parser/issues/issue-57684.stderr     |  10 +-
 tests/ui/parser/issues/issue-64732.stderr     |  10 +-
 ...sue-65257-invalid-var-decl-recovery.stderr |  30 +-
 tests/ui/parser/issues/issue-68730.stderr     |  10 +-
 ...9-resolve-after-recovered-self-ctor.stderr |  15 +-
 .../issue-73568-lifetime-after-mut.stderr     |  10 +-
 tests/ui/parser/issues/issue-84117.stderr     |  15 +-
 tests/ui/parser/issues/issue-84148-1.stderr   |   5 +-
 .../issues/issue-87086-colon-path-sep.stderr  |  45 +-
 tests/ui/parser/issues/issue-90993.stderr     |  15 +-
 ...9625-enum-struct-mutually-exclusive.stderr |   5 +-
 ...-99910-const-let-mutually-exclusive.stderr |  10 +-
 .../issues/recover-ge-as-fat-arrow.stderr     |   5 +-
 tests/ui/parser/item-kw-case-mismatch.stderr  |  70 +-
 tests/ui/parser/kw-in-trait-bounds.stderr     |  20 +-
 tests/ui/parser/lifetime-in-pattern.stderr    |   5 +-
 tests/ui/parser/lifetime-semicolon.stderr     |   5 +-
 .../parser/macros-no-semicolon-items.stderr   |   5 +-
 tests/ui/parser/match-arm-without-body.stderr |   3 +-
 .../ui/parser/match-arm-without-braces.stderr |   5 +-
 .../ui/parser/missing-fn-issue-65381-2.stderr |   5 +-
 .../misspelled-keywords/assoc-type.stderr     |   5 +-
 .../misspelled-keywords/async-move.stderr     |   5 +-
 .../misspelled-keywords/const-fn.stderr       |   5 +-
 .../misspelled-keywords/const-generics.stderr |   5 +-
 .../parser/misspelled-keywords/const.stderr   |   5 +-
 .../misspelled-keywords/for-loop.stderr       |   5 +-
 .../ui/parser/misspelled-keywords/hrdt.stderr |   5 +-
 .../misspelled-keywords/impl-block.stderr     |   5 +-
 .../misspelled-keywords/impl-return.stderr    |   5 +-
 .../misspelled-keywords/impl-trait-for.stderr |   5 +-
 .../misspelled-keywords/impl-trait.stderr     |   5 +-
 .../misspelled-keywords/let-else.stderr       |   5 +-
 .../parser/misspelled-keywords/let-mut.stderr |   5 +-
 .../ui/parser/misspelled-keywords/let.stderr  |  10 +-
 .../parser/misspelled-keywords/match.stderr   |   5 +-
 .../ui/parser/misspelled-keywords/mod.stderr  |   5 +-
 .../parser/misspelled-keywords/pub-fn.stderr  |   5 +-
 .../ui/parser/misspelled-keywords/ref.stderr  |   5 +-
 .../parser/misspelled-keywords/return.stderr  |   5 +-
 .../misspelled-keywords/static-mut.stderr     |   5 +-
 .../parser/misspelled-keywords/static.stderr  |   5 +-
 .../parser/misspelled-keywords/struct.stderr  |   5 +-
 .../misspelled-keywords/unsafe-fn.stderr      |   5 +-
 .../ui/parser/misspelled-keywords/use.stderr  |   5 +-
 .../misspelled-keywords/where-clause.stderr   |   3 +-
 .../misspelled-keywords/while-loop.stderr     |   5 +-
 tests/ui/parser/mut-patterns.stderr           |  20 +-
 tests/ui/parser/not-a-pred.stderr             |   5 +-
 .../ui/parser/public-instead-of-pub-1.stderr  |   5 +-
 .../ui/parser/public-instead-of-pub-3.stderr  |   5 +-
 tests/ui/parser/public-instead-of-pub.stderr  |   5 +-
 .../range-inclusive-extra-equals.stderr       |   5 +-
 .../parser/range_inclusive_dotdotdot.stderr   |  40 +-
 .../recover-assoc-lifetime-constraint.stderr  |   5 +-
 .../recover-fn-trait-from-fn-kw.stderr        |  10 +-
 ...recover-for-loop-parens-around-head.stderr |   5 +-
 .../recover/recover-from-bad-variant.stderr   |  15 +-
 .../recover/recover-from-homoglyph.stderr     |   5 +-
 .../parser/recover/recover-pat-exprs.stderr   | 145 +--
 .../parser/recover/recover-pat-issues.stderr  |  15 +-
 .../parser/recover/recover-range-pats.stderr  |  25 +-
 .../parser/recover/recover-ref-dyn-mut.stderr |   5 +-
 .../turbofish-arg-with-stray-colon.stderr     |   5 +-
 .../unicode-double-equals-recovery.stderr     |  10 +-
 .../removed-syntax/removed-syntax-box.stderr  |  25 +-
 tests/ui/parser/suggest-assoc-const.stderr    |   5 +-
 ...gest-remove-compount-assign-let-ice.stderr |   5 +-
 .../parser/trailing-question-in-type.stderr   |  10 +-
 .../parser/type-ascription-in-pattern.stderr  |  10 +-
 .../typod-const-in-const-param-def.stderr     |  20 +-
 .../parser/unicode-character-literal.stderr   |  15 +-
 tests/ui/parser/unicode-chars.stderr          |  10 +-
 .../parser/unicode-control-codepoints.stderr  |  50 +-
 tests/ui/parser/unicode-quote-chars.stderr    |  10 +-
 tests/ui/parser/unnecessary-let.stderr        |   5 +-
 tests/ui/parser/use-colon-as-mod-sep.stderr   |  20 +-
 tests/ui/parser/utf16-be-without-bom.stderr   |   5 +-
 tests/ui/parser/utf16-le-without-bom.stderr   |   5 +-
 ...ld-before-at-syntactically-rejected.stderr |  15 +-
 ...rect-placement-of-pattern-modifiers.stderr |   5 +-
 tests/ui/pattern/issue-72574-1.stderr         |   5 +-
 tests/ui/pattern/issue-72574-2.stderr         |   5 +-
 tests/ui/pattern/issue-74539.stderr           |   5 +-
 tests/ui/pattern/issue-74702.stderr           |   5 +-
 ...e-80186-mut-binding-help-suggestion.stderr |   5 +-
 .../pat-tuple-field-count-cross.stderr        |  50 +-
 tests/ui/pattern/pat-tuple-overfield.stderr   |  70 +-
 tests/ui/pattern/pat-tuple-underfield.stderr  |  15 +-
 .../patkind-ref-binding-issue-114896.stderr   |   5 +-
 .../patkind-ref-binding-issue-122415.stderr   |   5 +-
 .../pattern/pattern-bad-ref-box-order.stderr  |   5 +-
 .../ui/pattern/pattern-error-continue.stderr  |  10 +-
 ...tern-meant-to-be-slice-rest-pattern.stderr |  15 +-
 ...ure-gate-ref_pat_eat_one_layer_2024.stderr |  25 +-
 .../mut-ref-mut.classic2024.stderr            |   5 +-
 .../pattern-errors.classic2024.stderr         |  50 +-
 .../pattern-errors.stable2021.stderr          |   5 +-
 .../pattern-errors.structural2024.stderr      |  85 +-
 ...nding-on-inh-ref-errors.classic2024.stderr |   5 +-
 .../ref_pat_eat_one_layer_2021_fail.stderr    |  25 +-
 .../well-typed-edition-2024.stable2021.stderr |  25 +-
 .../ui/pattern/slice-pattern-refutable.stderr |  15 +-
 .../pattern/slice-patterns-ambiguity.stderr   |  15 +-
 .../usefulness/doc-hidden-fields.stderr       |  45 +-
 .../usefulness/stable-gated-fields.stderr     |  15 +-
 .../usefulness/unstable-gated-fields.stderr   |  30 +-
 tests/ui/pptypedef.stderr                     |  10 +-
 tests/ui/privacy/issue-75907.stderr           |   5 +-
 tests/ui/privacy/privacy-in-paths.stderr      |   5 +-
 tests/ui/privacy/privacy-ns1.stderr           |  15 +-
 tests/ui/privacy/privacy-ns2.stderr           |  10 +-
 tests/ui/privacy/privacy1.stderr              |  10 +-
 tests/ui/privacy/privacy5.stderr              |  50 +-
 .../sealed-traits/re-exported-trait.stderr    |   5 +-
 tests/ui/privacy/suggest-box-new.stderr       | 112 ++-
 .../suggest-making-field-public.stderr        |  10 +-
 .../ui/privacy/sysroot-private.default.stderr |   5 +-
 ...sroot-private.rustc_private_enabled.stderr |   5 +-
 .../proc-macro/disappearing-resolution.stderr |   5 +-
 tests/ui/proc-macro/issue-66286.stderr        |   5 +-
 .../issue-86781-bad-inner-doc.stderr          |   5 +-
 tests/ui/pub/pub-ident-fn-or-struct.stderr    |   5 +-
 tests/ui/pub/pub-restricted.stderr            |  25 +-
 .../qualified/qualified-path-params-2.stderr  |   5 +-
 .../region-object-lifetime-in-coercion.stderr |  20 +-
 .../regions-close-object-into-object-2.stderr |  10 +-
 .../regions-close-object-into-object-4.stderr |  10 +-
 .../regions/regions-proc-bound-capture.stderr |  10 +-
 tests/ui/repeat-expr/repeat_count.stderr      |  10 +-
 .../typo-in-repeat-expr-issue-80173.stderr    |  35 +-
 .../const-with-typo-in-pattern-binding.stderr |  15 +-
 tests/ui/resolve/issue-100365.stderr          |  20 +-
 tests/ui/resolve/issue-101749.stderr          |   5 +-
 tests/ui/resolve/issue-103202.stderr          |   5 +-
 tests/ui/resolve/issue-103474.stderr          |   5 +-
 ...ue-112472-multi-generics-suggestion.stderr |  10 +-
 tests/ui/resolve/issue-18252.stderr           |   5 +-
 tests/ui/resolve/issue-22692.stderr           |  40 +-
 tests/ui/resolve/issue-35675.stderr           |  10 +-
 tests/ui/resolve/issue-3907.stderr            |   3 +-
 tests/ui/resolve/issue-39226.stderr           |  10 +-
 tests/ui/resolve/issue-42944.stderr           |   5 +-
 tests/ui/resolve/issue-5035.stderr            |   8 +-
 tests/ui/resolve/issue-5099.stderr            |  15 +-
 tests/ui/resolve/issue-55673.stderr           |  15 +-
 tests/ui/resolve/issue-73427.stderr           |  60 +-
 tests/ui/resolve/privacy-enum-ctor.stderr     |  55 +-
 tests/ui/resolve/privacy-struct-ctor.stderr   |  10 +-
 ...nflict-extern-crate-vs-extern-crate.stderr |   3 +-
 ...lve-conflict-import-vs-extern-crate.stderr |   5 +-
 .../resolve/resolve-inconsistent-names.stderr |  10 +-
 ...t.import_trait_associated_functions.stderr |   5 +-
 ...lve-issue-135614-assoc-const.normal.stderr |   5 +-
 .../resolve/resolve-variant-assoc-item.stderr |  10 +-
 .../suggest-path-for-tuple-struct.stderr      |  10 +-
 ...uggest-path-instead-of-mod-dot-item.stderr |  50 +-
 ...e-with-name-similar-to-struct-field.stderr |  25 +-
 .../typo-suggestion-mistyped-in-path.stderr   |  10 +-
 ...xed-closure-sugar-nonexistent-trait.stderr |   3 +-
 .../rfc-2008-non-exhaustive/struct.stderr     |  15 +-
 .../rfc-2008-non-exhaustive/variant.stderr    |  10 +-
 .../not-allowed.stderr                        |   5 +-
 tests/ui/rmeta/rmeta_meta_main.stderr         |   5 +-
 tests/ui/rust-2018/remove-extern-crate.stderr |  10 +-
 .../rust-2018/trait-import-suggestions.stderr |  20 +-
 .../future-prelude-collision-shadow.stderr    |   5 +-
 .../ice-return-unsized-can-impl-2.stderr      |  10 +-
 .../ice-return-unsized-can-impl.stderr        |   5 +-
 .../rust-2021/ice-unsized-fn-params-2.stderr  |   5 +-
 .../ui/rust-2021/ice-unsized-fn-params.stderr |  10 +-
 .../arbitrary_self_type_mut_difference.stderr |  10 +-
 ..._types_not_allow_call_with_no_deref.stderr |  10 +-
 tests/ui/self/self-infer.stderr               |  10 +-
 .../portable-intrinsics-arent-exposed.stderr  |   5 +-
 tests/ui/span/issue-35987.stderr              |  10 +-
 tests/ui/span/issue-37767.stderr              |  30 +-
 tests/ui/span/issue-81800.stderr              |   5 +-
 tests/ui/span/missing-unit-argument.stderr    |  30 +-
 ...lity-attribute-implies-using-stable.stderr |   5 +-
 ...ty-attribute-implies-using-unstable.stderr |   5 +-
 ...lity-attribute-implies-using-stable.stderr |   5 +-
 ...ty-attribute-implies-using-unstable.stderr |   5 +-
 .../ui/static/static-reference-to-fn-1.stderr |   5 +-
 tests/ui/statics/issue-15261.stderr           |   5 +-
 .../statics/static-mut-shared-parens.stderr   |  10 +-
 tests/ui/statics/static-mut-xc.stderr         |  10 +-
 tests/ui/statics/static-recursive.stderr      |   5 +-
 ...ut-not-available.alignment_mismatch.stderr |   5 +-
 tests/ui/str/str-as-char.stderr               |   5 +-
 tests/ui/structs-enums/issue-103869.stderr    |   5 +-
 ...enum-ignoring-field-with-underscore.stderr |   5 +-
 .../non-exhaustive-ctor.disabled.stderr       |   5 +-
 .../non-exhaustive-ctor.enabled.stderr        |   5 +-
 tests/ui/structs/struct-field-cfg.stderr      |  15 +-
 .../struct-fields-hints-no-dupe.stderr        |   5 +-
 tests/ui/structs/struct-fields-hints.stderr   |   5 +-
 tests/ui/structs/struct-fields-typo.stderr    |   5 +-
 .../structs/struct-pat-derived-error.stderr   |  20 +-
 .../struct-path-self-type-mismatch.stderr     |   5 +-
 .../structs/struct-tuple-field-names.stderr   |  25 +-
 .../ui/structs/suggest-private-fields.stderr  |  15 +-
 ...ing-field-when-specifying-same-type.stderr |  60 +-
 ...ssoc-type-path-suggest-similar-item.stderr |  60 +-
 .../args-instead-of-tuple-errors.stderr       |   5 +-
 .../suggestions/args-instead-of-tuple.stderr  |   5 +-
 .../suggestions/assoc-const-as-field.stderr   |   5 +-
 .../assoc-ct-for-assoc-method.stderr          |  10 +-
 tests/ui/suggestions/bad-hex-float-lit.stderr |  30 +-
 .../bad-infer-in-trait-impl.stderr            |   5 +-
 .../suggestions/bool_typo_err_suggest.stderr  |  10 +-
 tests/ui/suggestions/bound-suggestions.stderr |   5 +-
 ...const-pat-non-exaustive-let-new-var.stderr |   5 +-
 .../suggestions/crate-or-module-typo.stderr   |  15 +-
 tests/ui/suggestions/deref-path-method.stderr |   5 +-
 .../dont-suggest-try_into-in-macros.stderr    |   5 +-
 ...it-should-use-self-2021-without-dyn.stderr |  30 +-
 ...mpatible-trait-should-use-self-2021.stderr |  10 +-
 ...-incompatible-trait-should-use-self.stderr |  10 +-
 ...atible-trait-should-use-where-sized.stderr |  10 +-
 tests/ui/suggestions/field-access.stderr      |  20 +-
 .../ui/suggestions/fn-to-method.normal.stderr |   5 +-
 .../ui/suggestions/for-loop-missing-in.stderr |   5 +-
 ...ice-unwrap-probe-many-result-125876.stderr |   5 +-
 .../imm-ref-trait-object-literal.stderr       |   5 +-
 .../impl-trait-missing-lifetime-gated.stderr  |  50 +-
 .../impl-trait-missing-lifetime.stderr        |  20 +-
 .../impl-trait-with-missing-bounds.stderr     |  30 +-
 .../suggestions/incorrect-variant-literal.svg | 918 ++++++++++--------
 tests/ui/suggestions/issue-101465.stderr      |   5 +-
 tests/ui/suggestions/issue-102972.stderr      |  10 +-
 tests/ui/suggestions/issue-109291.stderr      |   5 +-
 ...ait-with-missing-bounds-on-async-fn.stderr |  10 +-
 tests/ui/suggestions/issue-84592.stderr       |   5 +-
 tests/ui/suggestions/issue-84700.stderr       |   5 +-
 tests/ui/suggestions/issue-89064.stderr       |   5 +-
 tests/ui/suggestions/issue-89640.stderr       |   5 +-
 tests/ui/suggestions/issue-90974.stderr       |   5 +-
 tests/ui/suggestions/issue-94171.stderr       |   5 +-
 .../suggestions/js-style-comparison-op.stderr |  10 +-
 .../suggestions/lifetimes/issue-105544.stderr |  20 +-
 .../missing-lifetimes-in-signature.stderr     |  15 +-
 .../type-param-missing-lifetime.stderr        |  10 +-
 ...sing-impl-trait-block-but-not-ascii.stderr |   5 +-
 ...eric-to-trait-in-method-with-params.stderr |   5 +-
 tests/ui/suggestions/multibyte-escapes.stderr |  10 +-
 .../nested-non-tuple-tuple-struct.stderr      |  40 +-
 .../parenthesized-deref-suggestion.stderr     |   5 +-
 .../suggestions/partialeq_suggest_swap.stderr |   5 +-
 .../range-index-instead-of-colon.stderr       |   5 +-
 .../suggestions/raw-byte-string-prefix.stderr |   5 +-
 ...-turbofish-surrounding-angle-braket.stderr |  15 +-
 .../shadowed-lplace-method-2.stderr           |   5 +-
 .../suggestions/shadowed-lplace-method.stderr |   5 +-
 .../suggestions/silenced-binding-typo.stderr  |   5 +-
 ...t-field-type-including-single-colon.stderr |  10 +-
 .../suggest-blanket-impl-local-trait.stderr   |  25 +-
 .../ui/suggestions/suggest-change-mut.stderr  |   5 +-
 .../suggest-closure-return-type-1.stderr      |   5 +-
 ...suggest-deref-in-match-issue-132784.stderr |  80 +-
 .../suggest-field-through-deref.stderr        |  20 +-
 .../suggest-let-and-typo-issue-132483.stderr  |   5 +-
 .../suggest-let-for-assignment.stderr         |  10 +-
 tests/ui/suggestions/suggest-methods.stderr   |  15 +-
 .../ui/suggestions/suggest-move-types.stderr  |  40 +-
 tests/ui/suggestions/suggest-null-ptr.stderr  |  20 +-
 .../ui/suggestions/suggest-slice-swap.stderr  |   5 +-
 ...ping-self-ty-and-trait-edition-2021.stderr |  15 +-
 .../suggest-swapping-self-ty-and-trait.stderr |  15 +-
 .../suggest-trait-in-ufcs-in-hrtb.stderr      |  10 +-
 .../suggest-tryinto-edition-change.stderr     |  10 +-
 .../ui/suggestions/suggest-using-chars.stderr |  15 +-
 tests/ui/suggestions/suggest-variants.stderr  |  20 +-
 .../suggest_print_over_printf.stderr          |   5 +-
 .../type-ascription-instead-of-path-2.stderr  |   5 +-
 ...-ascription-instead-of-path-in-type.stderr |   5 +-
 .../type-mismatch-byte-literal.stderr         |  15 +-
 ...e-mismatch-struct-field-shorthand-2.stderr |   5 +-
 tests/ui/suggestions/unnamable-types.stderr   |   5 +-
 ...sary_dot_for_floating_point_literal.stderr |  15 +-
 .../inaccessible-test-modules.stderr          |   5 +-
 tests/ui/test-attrs/issue-109816.stderr       |   3 +-
 .../test-attr-non-associated-functions.stderr |   6 +-
 tests/ui/test-attrs/test-on-not-fn.stderr     |  60 +-
 ...gument-with-unnecessary-method-call.stderr |   5 +-
 tests/ui/traits/alias/ambiguous.stderr        |  10 +-
 .../alias/dont-elaborate-non-self.stderr      |   5 +-
 .../alias/self-in-const-generics.stderr       |   5 +-
 tests/ui/traits/alias/self-in-generics.stderr |   5 +-
 ...suggest-trait-alias-instead-of-type.stderr |   3 +-
 .../assoc_type_bound_with_struct.stderr       |  40 +-
 .../bound/not-on-bare-trait-2021.stderr       |  10 +-
 .../ui/traits/bound/not-on-bare-trait.stderr  |   5 +-
 tests/ui/traits/bound/not-on-struct.stderr    |   5 +-
 .../const-traits/eval-bad-signature.stderr    |   5 +-
 .../ice-119717-constant-lifetime.stderr       |   5 +-
 ...s-by-name-in-suggestion-issue-96292.stderr |   5 +-
 tests/ui/traits/issue-28576.stderr            |   5 +-
 tests/ui/traits/issue-35869.stderr            |  20 +-
 tests/ui/traits/issue-50480.stderr            |   5 +-
 tests/ui/traits/issue-77982.stderr            |   5 +-
 tests/ui/traits/issue-78372.stderr            |   5 +-
 tests/ui/traits/item-privacy.stderr           |  20 +-
 ...gument-mismatch-variance-ice-119867.stderr |   5 +-
 tests/ui/traits/multidispatch-bad.stderr      |   5 +-
 .../diagnostics/coerce-in-may-coerce.stderr   |   5 +-
 .../missing-assoc-item.stderr                 |   5 +-
 .../type-match-with-late-bound.stderr         |  15 +-
 ...t-non-existing-fully-qualified-path.stderr |   5 +-
 .../suggest-fully-qualified-closure.stderr    |   5 +-
 ...ully-qualified-path-with-adjustment.stderr |  45 +-
 ...y-qualified-path-without-adjustment.stderr |  55 +-
 .../trait-upcasting/subtrait-method.stderr    |  25 +-
 .../traits/wrong-mul-method-signature.stderr  |  15 +-
 tests/ui/transmutability/assoc-bound.stderr   |   5 +-
 tests/ui/tuple/tuple-index-not-tuple.stderr   |   5 +-
 .../ui/tuple/tuple-index-out-of-bounds.stderr |   5 +-
 .../enum-variant-generic-args.stderr          |  30 +-
 ...priority-higher-than-other-inherent.stderr |   5 +-
 ...t-variant-form-through-alias-caught.stderr |   5 +-
 .../unnameable_type.stderr                    |   5 +-
 ...solved-assoc-ty-suggest-trait.eager.stderr |   5 +-
 ...esolved-assoc-ty-suggest-trait.lazy.stderr |   5 +-
 tests/ui/type/issue-100584.stderr             |  10 +-
 tests/ui/type/issue-103271.stderr             |  10 +-
 .../pattern_type_mismatch.stderr              |  10 +-
 ...ascription-instead-of-statement-end.stderr |   5 +-
 .../type/type-ascription-with-fn-call.stderr  |   5 +-
 tests/ui/type/type-check/issue-41314.stderr   |   5 +-
 .../type-check/point-at-inference-3.stderr    |   5 +-
 .../type-check/point-at-inference-4.stderr    |  10 +-
 .../type-dependent-def-issue-49241.stderr     |   5 +-
 ...call-return-type-due-to-generic-arg.stderr |  20 +-
 .../typeck/attempted-access-non-fatal.stderr  |  20 +-
 tests/ui/typeck/check-args-on-fn-err-2.stderr |   5 +-
 tests/ui/typeck/cyclic_type_ice.stderr        |   5 +-
 tests/ui/typeck/deref-multi.stderr            |  10 +-
 .../ice-self-mismatch-const-generics.stderr   |  10 +-
 .../ice-unexpected-region-123863.stderr       |   5 +-
 tests/ui/typeck/issue-104582.stderr           |  10 +-
 tests/ui/typeck/issue-110052.stderr           |  10 +-
 .../issue-112252-ptr-arithmetics-help.stderr  |  20 +-
 ...sue-114529-illegal-break-with-value.stderr |  17 +-
 tests/ui/typeck/issue-29181.stderr            |   5 +-
 tests/ui/typeck/issue-53712.stderr            |   5 +-
 ...-missing-inaccessible-field-pattern.stderr |  15 +-
 tests/ui/typeck/method-chain-gats.stderr      |   5 +-
 .../typeck/mismatched-map-under-self.stderr   |   5 +-
 .../ptr-null-mutability-suggestions.stderr    |   5 +-
 .../remove-semi-but-confused-char.stderr      |   5 +-
 tests/ui/typeck/struct-enum-wrong-args.stderr |  20 +-
 .../suggest-arg-comma-delete-ice.stderr       |   5 +-
 .../typeck_type_placeholder_item.stderr       | 165 ++--
 .../typeck_type_placeholder_item_help.stderr  |  20 +-
 tests/ui/typeof/issue-100183.stderr           |   5 +-
 tests/ui/typeof/issue-29184.stderr            |   5 +-
 tests/ui/typeof/issue-42060.stderr            |  10 +-
 tests/ui/typeof/type_mismatch.stderr          |  10 +-
 tests/ui/ufcs/bad-builder.stderr              |   5 +-
 tests/ui/ufcs/ufcs-explicit-self-bad.stderr   |   5 +-
 tests/ui/ufcs/ufcs-partially-resolved.stderr  |  17 +-
 tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr |  10 +-
 ...oxed-closure-sugar-used-on-struct-3.stderr |   5 +-
 .../unboxed-closures-type-mismatch.stderr     |  20 +-
 .../in-fn-return-illegal.stderr               |   5 +-
 .../underscore-lifetime-binders.stderr        |  15 +-
 ...underscore-lifetime-elison-mismatch.stderr |   5 +-
 tests/ui/union/union-suggest-field.stderr     |  10 +-
 .../unresolved/unresolved-candidates.stderr   |   5 +-
 ...import-avoid-suggesting-global-path.stderr |  10 +-
 ...rt-suggest-disambiguated-crate-name.stderr |   5 +-
 tests/ui/unsigned-literal-negation.stderr     |  15 +-
 tests/ui/unsized/box-instead-of-dyn-fn.stderr |   5 +-
 tests/ui/unsized/issue-91803.stderr           |   5 +-
 tests/ui/variants/variant-used-as-type.stderr |  20 +-
 ...ir-wf-check-anon-const-issue-122199.stderr |   5 +-
 1017 files changed, 10364 insertions(+), 6943 deletions(-)

diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs
index 15cf285e7ffc..4824dc098ada 100644
--- a/compiler/rustc_errors/src/emitter.rs
+++ b/compiler/rustc_errors/src/emitter.rs
@@ -1982,7 +1982,7 @@ impl HumanEmitter {
         {
             debug!(?complete, ?parts, ?highlights);
 
-            let has_deletion = parts.iter().any(|p| p.is_deletion(sm));
+            let has_deletion = parts.iter().any(|p| p.is_deletion(sm) || p.is_replacement(sm));
             let is_multiline = complete.lines().count() > 1;
 
             if i == 0 {
diff --git a/src/tools/clippy/tests/ui-toml/dbg_macro/dbg_macro.stderr b/src/tools/clippy/tests/ui-toml/dbg_macro/dbg_macro.stderr
index 129fab5ff97a..f0d7104a57dd 100644
--- a/src/tools/clippy/tests/ui-toml/dbg_macro/dbg_macro.stderr
+++ b/src/tools/clippy/tests/ui-toml/dbg_macro/dbg_macro.stderr
@@ -8,8 +8,9 @@ LL |     if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }
    = help: to override `-D warnings` add `#[allow(clippy::dbg_macro)]`
 help: remove the invocation before committing it to a version control system
    |
-LL |     if let Some(n) = n.checked_sub(4) { n } else { n }
-   |                      ~~~~~~~~~~~~~~~~
+LL -     if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }
+LL +     if let Some(n) = n.checked_sub(4) { n } else { n }
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui-toml/dbg_macro/dbg_macro.rs:10:8
@@ -19,8 +20,9 @@ LL |     if dbg!(n <= 1) {
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     if n <= 1 {
-   |        ~~~~~~
+LL -     if dbg!(n <= 1) {
+LL +     if n <= 1 {
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui-toml/dbg_macro/dbg_macro.rs:11:9
@@ -30,7 +32,8 @@ LL |         dbg!(1)
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |         1
+LL -         dbg!(1)
+LL +         1
    |
 
 error: the `dbg!` macro is intended as a debugging tool
@@ -41,7 +44,8 @@ LL |         dbg!(n * factorial(n - 1))
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |         n * factorial(n - 1)
+LL -         dbg!(n * factorial(n - 1))
+LL +         n * factorial(n - 1)
    |
 
 error: the `dbg!` macro is intended as a debugging tool
@@ -52,8 +56,9 @@ LL |     dbg!(42);
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     42;
-   |     ~~
+LL -     dbg!(42);
+LL +     42;
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui-toml/dbg_macro/dbg_macro.rs:19:14
@@ -63,8 +68,9 @@ LL |     foo(3) + dbg!(factorial(4));
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     foo(3) + factorial(4);
-   |              ~~~~~~~~~~~~
+LL -     foo(3) + dbg!(factorial(4));
+LL +     foo(3) + factorial(4);
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui-toml/dbg_macro/dbg_macro.rs:20:5
@@ -74,8 +80,9 @@ LL |     dbg!(1, 2, 3, 4, 5);
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     (1, 2, 3, 4, 5);
-   |     ~~~~~~~~~~~~~~~
+LL -     dbg!(1, 2, 3, 4, 5);
+LL +     (1, 2, 3, 4, 5);
+   |
 
 error: aborting due to 7 previous errors
 
diff --git a/src/tools/clippy/tests/ui-toml/doc_valid_idents_append/doc_markdown.stderr b/src/tools/clippy/tests/ui-toml/doc_valid_idents_append/doc_markdown.stderr
index a6e0ad0f804c..8ba237ee75cf 100644
--- a/src/tools/clippy/tests/ui-toml/doc_valid_idents_append/doc_markdown.stderr
+++ b/src/tools/clippy/tests/ui-toml/doc_valid_idents_append/doc_markdown.stderr
@@ -8,8 +8,9 @@ LL | /// TestItemThingyOfCoolness might sound cool but is not on the list and sh
    = help: to override `-D warnings` add `#[allow(clippy::doc_markdown)]`
 help: try
    |
-LL | /// `TestItemThingyOfCoolness` might sound cool but is not on the list and should be linted.
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// TestItemThingyOfCoolness might sound cool but is not on the list and should be linted.
+LL + /// `TestItemThingyOfCoolness` might sound cool but is not on the list and should be linted.
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/src/tools/clippy/tests/ui-toml/doc_valid_idents_replace/doc_markdown.stderr b/src/tools/clippy/tests/ui-toml/doc_valid_idents_replace/doc_markdown.stderr
index d4d8a579798c..9f2d7cf54e0d 100644
--- a/src/tools/clippy/tests/ui-toml/doc_valid_idents_replace/doc_markdown.stderr
+++ b/src/tools/clippy/tests/ui-toml/doc_valid_idents_replace/doc_markdown.stderr
@@ -8,8 +8,9 @@ LL | /// OAuth and LaTeX are inside Clippy's default list.
    = help: to override `-D warnings` add `#[allow(clippy::doc_markdown)]`
 help: try
    |
-LL | /// `OAuth` and LaTeX are inside Clippy's default list.
-   |     ~~~~~~~
+LL - /// OAuth and LaTeX are inside Clippy's default list.
+LL + /// `OAuth` and LaTeX are inside Clippy's default list.
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui-toml/doc_valid_idents_replace/doc_markdown.rs:6:15
@@ -19,8 +20,9 @@ LL | /// OAuth and LaTeX are inside Clippy's default list.
    |
 help: try
    |
-LL | /// OAuth and `LaTeX` are inside Clippy's default list.
-   |               ~~~~~~~
+LL - /// OAuth and LaTeX are inside Clippy's default list.
+LL + /// OAuth and `LaTeX` are inside Clippy's default list.
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui-toml/doc_valid_idents_replace/doc_markdown.rs:9:5
@@ -30,8 +32,9 @@ LL | /// TestItemThingyOfCoolness might sound cool but is not on the list and sh
    |
 help: try
    |
-LL | /// `TestItemThingyOfCoolness` might sound cool but is not on the list and should be linted.
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// TestItemThingyOfCoolness might sound cool but is not on the list and should be linted.
+LL + /// `TestItemThingyOfCoolness` might sound cool but is not on the list and should be linted.
+   |
 
 error: aborting due to 3 previous errors
 
diff --git a/src/tools/clippy/tests/ui-toml/enum_variant_size/enum_variant_size.stderr b/src/tools/clippy/tests/ui-toml/enum_variant_size/enum_variant_size.stderr
index 8f7ebbd9546c..020b3cc78782 100644
--- a/src/tools/clippy/tests/ui-toml/enum_variant_size/enum_variant_size.stderr
+++ b/src/tools/clippy/tests/ui-toml/enum_variant_size/enum_variant_size.stderr
@@ -14,8 +14,9 @@ LL | | }
    = help: to override `-D warnings` add `#[allow(clippy::large_enum_variant)]`
 help: consider boxing the large fields to reduce the total size of the enum
    |
-LL |     B(Box<[u8; 501]>),
-   |       ~~~~~~~~~~~~~~
+LL -     B([u8; 501]),
+LL +     B(Box<[u8; 501]>),
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/src/tools/clippy/tests/ui-toml/renamed_function_params/renamed_function_params.default.stderr b/src/tools/clippy/tests/ui-toml/renamed_function_params/renamed_function_params.default.stderr
index 2d700f607592..de9f17520ff7 100644
--- a/src/tools/clippy/tests/ui-toml/renamed_function_params/renamed_function_params.default.stderr
+++ b/src/tools/clippy/tests/ui-toml/renamed_function_params/renamed_function_params.default.stderr
@@ -33,8 +33,9 @@ LL |     fn hash_slice(date: &[Self], states: &mut H) {
    |
 help: consider using the default names
    |
-LL |     fn hash_slice(data: &[Self], state: &mut H) {
-   |                              ~~~~           ~~~~~
+LL -     fn hash_slice(date: &[Self], states: &mut H) {
+LL +     fn hash_slice(data: &[Self], state: &mut H) {
+   |
 
 error: renamed function parameter of trait impl
   --> tests/ui-toml/renamed_function_params/renamed_function_params.rs:80:18
diff --git a/src/tools/clippy/tests/ui-toml/renamed_function_params/renamed_function_params.extend.stderr b/src/tools/clippy/tests/ui-toml/renamed_function_params/renamed_function_params.extend.stderr
index e57554fa613a..bdc4eeaad80f 100644
--- a/src/tools/clippy/tests/ui-toml/renamed_function_params/renamed_function_params.extend.stderr
+++ b/src/tools/clippy/tests/ui-toml/renamed_function_params/renamed_function_params.extend.stderr
@@ -27,8 +27,9 @@ LL |     fn hash_slice(date: &[Self], states: &mut H) {
    |
 help: consider using the default names
    |
-LL |     fn hash_slice(data: &[Self], state: &mut H) {
-   |                              ~~~~           ~~~~~
+LL -     fn hash_slice(date: &[Self], states: &mut H) {
+LL +     fn hash_slice(data: &[Self], state: &mut H) {
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.stderr b/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.stderr
index b58ce9b8af3e..2aff276a4a12 100644
--- a/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.stderr
+++ b/src/tools/clippy/tests/ui-toml/unwrap_used/unwrap_used.stderr
@@ -8,8 +8,9 @@ LL |         let _ = boxed_slice.get(1).unwrap();
    = help: to override `-D warnings` add `#[allow(clippy::get_unwrap)]`
 help: using `[]` is clearer and more concise
    |
-LL |         let _ = &boxed_slice[1];
-   |                 ~~~~~~~~~~~~~~~
+LL -         let _ = boxed_slice.get(1).unwrap();
+LL +         let _ = &boxed_slice[1];
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui-toml/unwrap_used/unwrap_used.rs:38:17
@@ -30,8 +31,9 @@ LL |         let _ = some_slice.get(0).unwrap();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _ = &some_slice[0];
-   |                 ~~~~~~~~~~~~~~
+LL -         let _ = some_slice.get(0).unwrap();
+LL +         let _ = &some_slice[0];
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui-toml/unwrap_used/unwrap_used.rs:39:17
@@ -50,8 +52,9 @@ LL |         let _ = some_vec.get(0).unwrap();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _ = &some_vec[0];
-   |                 ~~~~~~~~~~~~
+LL -         let _ = some_vec.get(0).unwrap();
+LL +         let _ = &some_vec[0];
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui-toml/unwrap_used/unwrap_used.rs:40:17
@@ -70,8 +73,9 @@ LL |         let _ = some_vecdeque.get(0).unwrap();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _ = &some_vecdeque[0];
-   |                 ~~~~~~~~~~~~~~~~~
+LL -         let _ = some_vecdeque.get(0).unwrap();
+LL +         let _ = &some_vecdeque[0];
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui-toml/unwrap_used/unwrap_used.rs:41:17
@@ -90,8 +94,9 @@ LL |         let _ = some_hashmap.get(&1).unwrap();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _ = &some_hashmap[&1];
-   |                 ~~~~~~~~~~~~~~~~~
+LL -         let _ = some_hashmap.get(&1).unwrap();
+LL +         let _ = &some_hashmap[&1];
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui-toml/unwrap_used/unwrap_used.rs:42:17
@@ -110,8 +115,9 @@ LL |         let _ = some_btreemap.get(&1).unwrap();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _ = &some_btreemap[&1];
-   |                 ~~~~~~~~~~~~~~~~~~
+LL -         let _ = some_btreemap.get(&1).unwrap();
+LL +         let _ = &some_btreemap[&1];
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui-toml/unwrap_used/unwrap_used.rs:43:17
@@ -130,8 +136,9 @@ LL |         let _: u8 = *boxed_slice.get(1).unwrap();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _: u8 = boxed_slice[1];
-   |                     ~~~~~~~~~~~~~~
+LL -         let _: u8 = *boxed_slice.get(1).unwrap();
+LL +         let _: u8 = boxed_slice[1];
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui-toml/unwrap_used/unwrap_used.rs:47:22
@@ -150,8 +157,9 @@ LL |         *boxed_slice.get_mut(0).unwrap() = 1;
    |
 help: using `[]` is clearer and more concise
    |
-LL |         boxed_slice[0] = 1;
-   |         ~~~~~~~~~~~~~~
+LL -         *boxed_slice.get_mut(0).unwrap() = 1;
+LL +         boxed_slice[0] = 1;
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui-toml/unwrap_used/unwrap_used.rs:52:10
@@ -170,8 +178,9 @@ LL |         *some_slice.get_mut(0).unwrap() = 1;
    |
 help: using `[]` is clearer and more concise
    |
-LL |         some_slice[0] = 1;
-   |         ~~~~~~~~~~~~~
+LL -         *some_slice.get_mut(0).unwrap() = 1;
+LL +         some_slice[0] = 1;
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui-toml/unwrap_used/unwrap_used.rs:53:10
@@ -190,8 +199,9 @@ LL |         *some_vec.get_mut(0).unwrap() = 1;
    |
 help: using `[]` is clearer and more concise
    |
-LL |         some_vec[0] = 1;
-   |         ~~~~~~~~~~~
+LL -         *some_vec.get_mut(0).unwrap() = 1;
+LL +         some_vec[0] = 1;
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui-toml/unwrap_used/unwrap_used.rs:54:10
@@ -210,8 +220,9 @@ LL |         *some_vecdeque.get_mut(0).unwrap() = 1;
    |
 help: using `[]` is clearer and more concise
    |
-LL |         some_vecdeque[0] = 1;
-   |         ~~~~~~~~~~~~~~~~
+LL -         *some_vecdeque.get_mut(0).unwrap() = 1;
+LL +         some_vecdeque[0] = 1;
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui-toml/unwrap_used/unwrap_used.rs:55:10
@@ -230,8 +241,9 @@ LL |         let _ = some_vec.get(0..1).unwrap().to_vec();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _ = some_vec[0..1].to_vec();
-   |                 ~~~~~~~~~~~~~~
+LL -         let _ = some_vec.get(0..1).unwrap().to_vec();
+LL +         let _ = some_vec[0..1].to_vec();
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui-toml/unwrap_used/unwrap_used.rs:67:17
@@ -250,8 +262,9 @@ LL |         let _ = some_vec.get_mut(0..1).unwrap().to_vec();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _ = some_vec[0..1].to_vec();
-   |                 ~~~~~~~~~~~~~~
+LL -         let _ = some_vec.get_mut(0..1).unwrap().to_vec();
+LL +         let _ = some_vec[0..1].to_vec();
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui-toml/unwrap_used/unwrap_used.rs:68:17
@@ -270,8 +283,9 @@ LL |     let _ = boxed_slice.get(1).unwrap();
    |
 help: using `[]` is clearer and more concise
    |
-LL |     let _ = &boxed_slice[1];
-   |             ~~~~~~~~~~~~~~~
+LL -     let _ = boxed_slice.get(1).unwrap();
+LL +     let _ = &boxed_slice[1];
+   |
 
 error: called `.get().unwrap()` on a slice
   --> tests/ui-toml/unwrap_used/unwrap_used.rs:94:17
@@ -281,8 +295,9 @@ LL |         let _ = Box::new([0]).get(1).unwrap();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _ = &Box::new([0])[1];
-   |                 ~~~~~~~~~~~~~~~~~
+LL -         let _ = Box::new([0]).get(1).unwrap();
+LL +         let _ = &Box::new([0])[1];
+   |
 
 error: aborting due to 28 previous errors
 
diff --git a/src/tools/clippy/tests/ui/assign_ops2.stderr b/src/tools/clippy/tests/ui/assign_ops2.stderr
index ddeba2b2ff8f..09b101b216a5 100644
--- a/src/tools/clippy/tests/ui/assign_ops2.stderr
+++ b/src/tools/clippy/tests/ui/assign_ops2.stderr
@@ -8,12 +8,14 @@ LL |     a += a + 1;
    = help: to override `-D warnings` add `#[allow(clippy::misrefactored_assign_op)]`
 help: did you mean `a = a + 1` or `a = a + a + 1`? Consider replacing it with
    |
-LL |     a += 1;
-   |     ~~~~~~
+LL -     a += a + 1;
+LL +     a += 1;
+   |
 help: or
    |
-LL |     a = a + a + 1;
-   |     ~~~~~~~~~~~~~
+LL -     a += a + 1;
+LL +     a = a + a + 1;
+   |
 
 error: variable appears on both sides of an assignment operation
   --> tests/ui/assign_ops2.rs:11:5
@@ -23,12 +25,14 @@ LL |     a += 1 + a;
    |
 help: did you mean `a = a + 1` or `a = a + 1 + a`? Consider replacing it with
    |
-LL |     a += 1;
-   |     ~~~~~~
+LL -     a += 1 + a;
+LL +     a += 1;
+   |
 help: or
    |
-LL |     a = a + 1 + a;
-   |     ~~~~~~~~~~~~~
+LL -     a += 1 + a;
+LL +     a = a + 1 + a;
+   |
 
 error: variable appears on both sides of an assignment operation
   --> tests/ui/assign_ops2.rs:13:5
@@ -38,12 +42,14 @@ LL |     a -= a - 1;
    |
 help: did you mean `a = a - 1` or `a = a - (a - 1)`? Consider replacing it with
    |
-LL |     a -= 1;
-   |     ~~~~~~
+LL -     a -= a - 1;
+LL +     a -= 1;
+   |
 help: or
    |
-LL |     a = a - (a - 1);
-   |     ~~~~~~~~~~~~~~~
+LL -     a -= a - 1;
+LL +     a = a - (a - 1);
+   |
 
 error: variable appears on both sides of an assignment operation
   --> tests/ui/assign_ops2.rs:15:5
@@ -53,12 +59,14 @@ LL |     a *= a * 99;
    |
 help: did you mean `a = a * 99` or `a = a * a * 99`? Consider replacing it with
    |
-LL |     a *= 99;
-   |     ~~~~~~~
+LL -     a *= a * 99;
+LL +     a *= 99;
+   |
 help: or
    |
-LL |     a = a * a * 99;
-   |     ~~~~~~~~~~~~~~
+LL -     a *= a * 99;
+LL +     a = a * a * 99;
+   |
 
 error: variable appears on both sides of an assignment operation
   --> tests/ui/assign_ops2.rs:17:5
@@ -68,12 +76,14 @@ LL |     a *= 42 * a;
    |
 help: did you mean `a = a * 42` or `a = a * 42 * a`? Consider replacing it with
    |
-LL |     a *= 42;
-   |     ~~~~~~~
+LL -     a *= 42 * a;
+LL +     a *= 42;
+   |
 help: or
    |
-LL |     a = a * 42 * a;
-   |     ~~~~~~~~~~~~~~
+LL -     a *= 42 * a;
+LL +     a = a * 42 * a;
+   |
 
 error: variable appears on both sides of an assignment operation
   --> tests/ui/assign_ops2.rs:19:5
@@ -83,12 +93,14 @@ LL |     a /= a / 2;
    |
 help: did you mean `a = a / 2` or `a = a / (a / 2)`? Consider replacing it with
    |
-LL |     a /= 2;
-   |     ~~~~~~
+LL -     a /= a / 2;
+LL +     a /= 2;
+   |
 help: or
    |
-LL |     a = a / (a / 2);
-   |     ~~~~~~~~~~~~~~~
+LL -     a /= a / 2;
+LL +     a = a / (a / 2);
+   |
 
 error: variable appears on both sides of an assignment operation
   --> tests/ui/assign_ops2.rs:21:5
@@ -98,12 +110,14 @@ LL |     a %= a % 5;
    |
 help: did you mean `a = a % 5` or `a = a % (a % 5)`? Consider replacing it with
    |
-LL |     a %= 5;
-   |     ~~~~~~
+LL -     a %= a % 5;
+LL +     a %= 5;
+   |
 help: or
    |
-LL |     a = a % (a % 5);
-   |     ~~~~~~~~~~~~~~~
+LL -     a %= a % 5;
+LL +     a = a % (a % 5);
+   |
 
 error: variable appears on both sides of an assignment operation
   --> tests/ui/assign_ops2.rs:23:5
@@ -113,12 +127,14 @@ LL |     a &= a & 1;
    |
 help: did you mean `a = a & 1` or `a = a & a & 1`? Consider replacing it with
    |
-LL |     a &= 1;
-   |     ~~~~~~
+LL -     a &= a & 1;
+LL +     a &= 1;
+   |
 help: or
    |
-LL |     a = a & a & 1;
-   |     ~~~~~~~~~~~~~
+LL -     a &= a & 1;
+LL +     a = a & a & 1;
+   |
 
 error: variable appears on both sides of an assignment operation
   --> tests/ui/assign_ops2.rs:25:5
@@ -128,12 +144,14 @@ LL |     a *= a * a;
    |
 help: did you mean `a = a * a` or `a = a * a * a`? Consider replacing it with
    |
-LL |     a *= a;
-   |     ~~~~~~
+LL -     a *= a * a;
+LL +     a *= a;
+   |
 help: or
    |
-LL |     a = a * a * a;
-   |     ~~~~~~~~~~~~~
+LL -     a *= a * a;
+LL +     a = a * a * a;
+   |
 
 error: manual implementation of an assign operation
   --> tests/ui/assign_ops2.rs:63:5
diff --git a/src/tools/clippy/tests/ui/bind_instead_of_map_multipart.stderr b/src/tools/clippy/tests/ui/bind_instead_of_map_multipart.stderr
index d271381adea2..7c5882d4296e 100644
--- a/src/tools/clippy/tests/ui/bind_instead_of_map_multipart.stderr
+++ b/src/tools/clippy/tests/ui/bind_instead_of_map_multipart.stderr
@@ -11,8 +11,9 @@ LL | #![deny(clippy::bind_instead_of_map)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: use `map` instead
    |
-LL |     let _ = Some("42").map(|s| if s.len() < 42 { 0 } else { s.len() });
-   |                        ~~~                       ~          ~~~~~~~
+LL -     let _ = Some("42").and_then(|s| if s.len() < 42 { Some(0) } else { Some(s.len()) });
+LL +     let _ = Some("42").map(|s| if s.len() < 42 { 0 } else { s.len() });
+   |
 
 error: using `Result.and_then(|x| Ok(y))`, which is more succinctly expressed as `map(|x| y)`
   --> tests/ui/bind_instead_of_map_multipart.rs:8:13
@@ -22,8 +23,9 @@ LL |     let _ = Ok::<_, ()>("42").and_then(|s| if s.len() < 42 { Ok(0) } else {
    |
 help: use `map` instead
    |
-LL |     let _ = Ok::<_, ()>("42").map(|s| if s.len() < 42 { 0 } else { s.len() });
-   |                               ~~~                       ~          ~~~~~~~
+LL -     let _ = Ok::<_, ()>("42").and_then(|s| if s.len() < 42 { Ok(0) } else { Ok(s.len()) });
+LL +     let _ = Ok::<_, ()>("42").map(|s| if s.len() < 42 { 0 } else { s.len() });
+   |
 
 error: using `Result.or_else(|x| Err(y))`, which is more succinctly expressed as `map_err(|x| y)`
   --> tests/ui/bind_instead_of_map_multipart.rs:11:13
@@ -33,8 +35,9 @@ LL |     let _ = Err::<(), _>("42").or_else(|s| if s.len() < 42 { Err(s.len() +
    |
 help: use `map_err` instead
    |
-LL |     let _ = Err::<(), _>("42").map_err(|s| if s.len() < 42 { s.len() + 20 } else { s.len() });
-   |                                ~~~~~~~                       ~~~~~~~~~~~~          ~~~~~~~
+LL -     let _ = Err::<(), _>("42").or_else(|s| if s.len() < 42 { Err(s.len() + 20) } else { Err(s.len()) });
+LL +     let _ = Err::<(), _>("42").map_err(|s| if s.len() < 42 { s.len() + 20 } else { s.len() });
+   |
 
 error: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
   --> tests/ui/bind_instead_of_map_multipart.rs:19:5
@@ -83,8 +86,9 @@ LL |     let _ = Some("").and_then(|s| if s.len() == 20 { Some(m!()) } else { So
    |
 help: use `map` instead
    |
-LL |     let _ = Some("").map(|s| if s.len() == 20 { m!() } else { Some(20) });
-   |                      ~~~                        ~~~~          ~~~~~~~~
+LL -     let _ = Some("").and_then(|s| if s.len() == 20 { Some(m!()) } else { Some(Some(20)) });
+LL +     let _ = Some("").map(|s| if s.len() == 20 { m!() } else { Some(20) });
+   |
 
 error: aborting due to 5 previous errors
 
diff --git a/src/tools/clippy/tests/ui/borrow_deref_ref_unfixable.stderr b/src/tools/clippy/tests/ui/borrow_deref_ref_unfixable.stderr
index 7d3a5c84a820..71f43af46c24 100644
--- a/src/tools/clippy/tests/ui/borrow_deref_ref_unfixable.stderr
+++ b/src/tools/clippy/tests/ui/borrow_deref_ref_unfixable.stderr
@@ -8,12 +8,14 @@ LL |         let x: &str = &*s;
    = help: to override `-D warnings` add `#[allow(clippy::borrow_deref_ref)]`
 help: if you would like to reborrow, try removing `&*`
    |
-LL |         let x: &str = s;
-   |                       ~
+LL -         let x: &str = &*s;
+LL +         let x: &str = s;
+   |
 help: if you would like to deref, try using `&**`
    |
-LL |         let x: &str = &**s;
-   |                       ~~~~
+LL -         let x: &str = &*s;
+LL +         let x: &str = &**s;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/src/tools/clippy/tests/ui/cast.stderr b/src/tools/clippy/tests/ui/cast.stderr
index 452482fc88e2..901447c738ed 100644
--- a/src/tools/clippy/tests/ui/cast.stderr
+++ b/src/tools/clippy/tests/ui/cast.stderr
@@ -81,8 +81,9 @@ LL |     1i32 as i8;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     i8::try_from(1i32);
-   |     ~~~~~~~~~~~~~~~~~~
+LL -     1i32 as i8;
+LL +     i8::try_from(1i32);
+   |
 
 error: casting `i32` to `u8` may truncate the value
   --> tests/ui/cast.rs:52:5
@@ -93,8 +94,9 @@ LL |     1i32 as u8;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     u8::try_from(1i32);
-   |     ~~~~~~~~~~~~~~~~~~
+LL -     1i32 as u8;
+LL +     u8::try_from(1i32);
+   |
 
 error: casting `f64` to `isize` may truncate the value
   --> tests/ui/cast.rs:54:5
@@ -127,8 +129,9 @@ LL |     1f32 as u32 as u16;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     u16::try_from(1f32 as u32);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     1f32 as u32 as u16;
+LL +     u16::try_from(1f32 as u32);
+   |
 
 error: casting `f32` to `u32` may truncate the value
   --> tests/ui/cast.rs:59:5
@@ -153,8 +156,9 @@ LL |         let _x: i8 = 1i32 as _;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |         let _x: i8 = 1i32.try_into();
-   |                      ~~~~~~~~~~~~~~~
+LL -         let _x: i8 = 1i32 as _;
+LL +         let _x: i8 = 1i32.try_into();
+   |
 
 error: casting `f32` to `i32` may truncate the value
   --> tests/ui/cast.rs:66:9
@@ -228,8 +232,9 @@ LL |     1usize as i8;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     i8::try_from(1usize);
-   |     ~~~~~~~~~~~~~~~~~~~~
+LL -     1usize as i8;
+LL +     i8::try_from(1usize);
+   |
 
 error: casting `usize` to `i16` may truncate the value
   --> tests/ui/cast.rs:90:5
@@ -240,8 +245,9 @@ LL |     1usize as i16;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     i16::try_from(1usize);
-   |     ~~~~~~~~~~~~~~~~~~~~~
+LL -     1usize as i16;
+LL +     i16::try_from(1usize);
+   |
 
 error: casting `usize` to `i16` may wrap around the value on targets with 16-bit wide pointers
   --> tests/ui/cast.rs:90:5
@@ -261,8 +267,9 @@ LL |     1usize as i32;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     i32::try_from(1usize);
-   |     ~~~~~~~~~~~~~~~~~~~~~
+LL -     1usize as i32;
+LL +     i32::try_from(1usize);
+   |
 
 error: casting `usize` to `i32` may wrap around the value on targets with 32-bit wide pointers
   --> tests/ui/cast.rs:95:5
@@ -300,8 +307,9 @@ LL |     1u64 as isize;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     isize::try_from(1u64);
-   |     ~~~~~~~~~~~~~~~~~~~~~
+LL -     1u64 as isize;
+LL +     isize::try_from(1u64);
+   |
 
 error: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers
   --> tests/ui/cast.rs:111:5
@@ -360,8 +368,9 @@ LL |     (-99999999999i64).min(1) as i8;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     i8::try_from((-99999999999i64).min(1));
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     (-99999999999i64).min(1) as i8;
+LL +     i8::try_from((-99999999999i64).min(1));
+   |
 
 error: casting `u64` to `u8` may truncate the value
   --> tests/ui/cast.rs:222:5
@@ -372,8 +381,9 @@ LL |     999999u64.clamp(0, 256) as u8;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     u8::try_from(999999u64.clamp(0, 256));
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     999999u64.clamp(0, 256) as u8;
+LL +     u8::try_from(999999u64.clamp(0, 256));
+   |
 
 error: casting `main::E2` to `u8` may truncate the value
   --> tests/ui/cast.rs:245:21
@@ -384,8 +394,9 @@ LL |             let _ = self as u8;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |             let _ = u8::try_from(self);
-   |                     ~~~~~~~~~~~~~~~~~~
+LL -             let _ = self as u8;
+LL +             let _ = u8::try_from(self);
+   |
 
 error: casting `main::E2::B` to `u8` will truncate the value
   --> tests/ui/cast.rs:247:21
@@ -405,8 +416,9 @@ LL |             let _ = self as i8;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |             let _ = i8::try_from(self);
-   |                     ~~~~~~~~~~~~~~~~~~
+LL -             let _ = self as i8;
+LL +             let _ = i8::try_from(self);
+   |
 
 error: casting `main::E5::A` to `i8` will truncate the value
   --> tests/ui/cast.rs:291:21
@@ -423,8 +435,9 @@ LL |             let _ = self as i16;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |             let _ = i16::try_from(self);
-   |                     ~~~~~~~~~~~~~~~~~~~
+LL -             let _ = self as i16;
+LL +             let _ = i16::try_from(self);
+   |
 
 error: casting `main::E7` to `usize` may truncate the value on targets with 32-bit wide pointers
   --> tests/ui/cast.rs:327:21
@@ -435,8 +448,9 @@ LL |             let _ = self as usize;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |             let _ = usize::try_from(self);
-   |                     ~~~~~~~~~~~~~~~~~~~~~
+LL -             let _ = self as usize;
+LL +             let _ = usize::try_from(self);
+   |
 
 error: casting `main::E10` to `u16` may truncate the value
   --> tests/ui/cast.rs:374:21
@@ -447,8 +461,9 @@ LL |             let _ = self as u16;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |             let _ = u16::try_from(self);
-   |                     ~~~~~~~~~~~~~~~~~~~
+LL -             let _ = self as u16;
+LL +             let _ = u16::try_from(self);
+   |
 
 error: casting `u32` to `u8` may truncate the value
   --> tests/ui/cast.rs:385:13
@@ -459,8 +474,9 @@ LL |     let c = (q >> 16) as u8;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     let c = u8::try_from(q >> 16);
-   |             ~~~~~~~~~~~~~~~~~~~~~
+LL -     let c = (q >> 16) as u8;
+LL +     let c = u8::try_from(q >> 16);
+   |
 
 error: casting `u32` to `u8` may truncate the value
   --> tests/ui/cast.rs:389:13
@@ -471,8 +487,9 @@ LL |     let c = (q / 1000) as u8;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     let c = u8::try_from(q / 1000);
-   |             ~~~~~~~~~~~~~~~~~~~~~~
+LL -     let c = (q / 1000) as u8;
+LL +     let c = u8::try_from(q / 1000);
+   |
 
 error: casting `i32` to `u32` may lose the sign of the value
   --> tests/ui/cast.rs:401:9
@@ -674,8 +691,9 @@ LL |     m!();
    = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |             let _ = u8::try_from(u32::MAX); // cast_possible_truncation
-   |                     ~~~~~~~~~~~~~~~~~~~~~~
+LL -             let _ = u32::MAX as u8; // cast_possible_truncation
+LL +             let _ = u8::try_from(u32::MAX); // cast_possible_truncation
+   |
 
 error: casting `f64` to `f32` may truncate the value
   --> tests/ui/cast.rs:474:21
@@ -698,7 +716,8 @@ LL |     bar.unwrap().unwrap() as usize
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     usize::try_from(bar.unwrap().unwrap())
+LL -     bar.unwrap().unwrap() as usize
+LL +     usize::try_from(bar.unwrap().unwrap())
    |
 
 error: casting `i64` to `usize` may lose the sign of the value
@@ -716,8 +735,9 @@ LL |     (256 & 999999u64) as u8;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     u8::try_from(256 & 999999u64);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     (256 & 999999u64) as u8;
+LL +     u8::try_from(256 & 999999u64);
+   |
 
 error: casting `u64` to `u8` may truncate the value
   --> tests/ui/cast.rs:500:5
@@ -728,8 +748,9 @@ LL |     (255 % 999999u64) as u8;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     u8::try_from(255 % 999999u64);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     (255 % 999999u64) as u8;
+LL +     u8::try_from(255 % 999999u64);
+   |
 
 error: aborting due to 92 previous errors
 
diff --git a/src/tools/clippy/tests/ui/cast_lossless_bool.stderr b/src/tools/clippy/tests/ui/cast_lossless_bool.stderr
index 82d6b2e4b8e6..689922717623 100644
--- a/src/tools/clippy/tests/ui/cast_lossless_bool.stderr
+++ b/src/tools/clippy/tests/ui/cast_lossless_bool.stderr
@@ -9,8 +9,9 @@ LL |     let _ = true as u8;
    = help: to override `-D warnings` add `#[allow(clippy::cast_lossless)]`
 help: use `u8::from` instead
    |
-LL |     let _ = u8::from(true);
-   |             ~~~~~~~~~~~~~~
+LL -     let _ = true as u8;
+LL +     let _ = u8::from(true);
+   |
 
 error: casts from `bool` to `u16` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_bool.rs:9:13
@@ -21,8 +22,9 @@ LL |     let _ = true as u16;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `u16::from` instead
    |
-LL |     let _ = u16::from(true);
-   |             ~~~~~~~~~~~~~~~
+LL -     let _ = true as u16;
+LL +     let _ = u16::from(true);
+   |
 
 error: casts from `bool` to `u32` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_bool.rs:10:13
@@ -33,8 +35,9 @@ LL |     let _ = true as u32;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `u32::from` instead
    |
-LL |     let _ = u32::from(true);
-   |             ~~~~~~~~~~~~~~~
+LL -     let _ = true as u32;
+LL +     let _ = u32::from(true);
+   |
 
 error: casts from `bool` to `u64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_bool.rs:11:13
@@ -45,8 +48,9 @@ LL |     let _ = true as u64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `u64::from` instead
    |
-LL |     let _ = u64::from(true);
-   |             ~~~~~~~~~~~~~~~
+LL -     let _ = true as u64;
+LL +     let _ = u64::from(true);
+   |
 
 error: casts from `bool` to `u128` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_bool.rs:12:13
@@ -57,8 +61,9 @@ LL |     let _ = true as u128;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `u128::from` instead
    |
-LL |     let _ = u128::from(true);
-   |             ~~~~~~~~~~~~~~~~
+LL -     let _ = true as u128;
+LL +     let _ = u128::from(true);
+   |
 
 error: casts from `bool` to `usize` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_bool.rs:13:13
@@ -69,8 +74,9 @@ LL |     let _ = true as usize;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `usize::from` instead
    |
-LL |     let _ = usize::from(true);
-   |             ~~~~~~~~~~~~~~~~~
+LL -     let _ = true as usize;
+LL +     let _ = usize::from(true);
+   |
 
 error: casts from `bool` to `i8` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_bool.rs:15:13
@@ -81,8 +87,9 @@ LL |     let _ = true as i8;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i8::from` instead
    |
-LL |     let _ = i8::from(true);
-   |             ~~~~~~~~~~~~~~
+LL -     let _ = true as i8;
+LL +     let _ = i8::from(true);
+   |
 
 error: casts from `bool` to `i16` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_bool.rs:16:13
@@ -93,8 +100,9 @@ LL |     let _ = true as i16;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i16::from` instead
    |
-LL |     let _ = i16::from(true);
-   |             ~~~~~~~~~~~~~~~
+LL -     let _ = true as i16;
+LL +     let _ = i16::from(true);
+   |
 
 error: casts from `bool` to `i32` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_bool.rs:17:13
@@ -105,8 +113,9 @@ LL |     let _ = true as i32;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i32::from` instead
    |
-LL |     let _ = i32::from(true);
-   |             ~~~~~~~~~~~~~~~
+LL -     let _ = true as i32;
+LL +     let _ = i32::from(true);
+   |
 
 error: casts from `bool` to `i64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_bool.rs:18:13
@@ -117,8 +126,9 @@ LL |     let _ = true as i64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i64::from` instead
    |
-LL |     let _ = i64::from(true);
-   |             ~~~~~~~~~~~~~~~
+LL -     let _ = true as i64;
+LL +     let _ = i64::from(true);
+   |
 
 error: casts from `bool` to `i128` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_bool.rs:19:13
@@ -129,8 +139,9 @@ LL |     let _ = true as i128;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i128::from` instead
    |
-LL |     let _ = i128::from(true);
-   |             ~~~~~~~~~~~~~~~~
+LL -     let _ = true as i128;
+LL +     let _ = i128::from(true);
+   |
 
 error: casts from `bool` to `isize` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_bool.rs:20:13
@@ -141,8 +152,9 @@ LL |     let _ = true as isize;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `isize::from` instead
    |
-LL |     let _ = isize::from(true);
-   |             ~~~~~~~~~~~~~~~~~
+LL -     let _ = true as isize;
+LL +     let _ = isize::from(true);
+   |
 
 error: casts from `bool` to `u16` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_bool.rs:23:13
@@ -153,8 +165,9 @@ LL |     let _ = (true | false) as u16;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `u16::from` instead
    |
-LL |     let _ = u16::from(true | false);
-   |             ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = (true | false) as u16;
+LL +     let _ = u16::from(true | false);
+   |
 
 error: casts from `bool` to `u8` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_bool.rs:25:13
@@ -165,8 +178,9 @@ LL |     let _ = true as U8;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `U8::from` instead
    |
-LL |     let _ = U8::from(true);
-   |             ~~~~~~~~~~~~~~
+LL -     let _ = true as U8;
+LL +     let _ = U8::from(true);
+   |
 
 error: casts from `bool` to `u8` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_bool.rs:53:13
@@ -177,8 +191,9 @@ LL |     let _ = true as u8;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `u8::from` instead
    |
-LL |     let _ = u8::from(true);
-   |             ~~~~~~~~~~~~~~
+LL -     let _ = true as u8;
+LL +     let _ = u8::from(true);
+   |
 
 error: aborting due to 15 previous errors
 
diff --git a/src/tools/clippy/tests/ui/cast_lossless_float.stderr b/src/tools/clippy/tests/ui/cast_lossless_float.stderr
index b36f8bcecf58..3f405e3f402f 100644
--- a/src/tools/clippy/tests/ui/cast_lossless_float.stderr
+++ b/src/tools/clippy/tests/ui/cast_lossless_float.stderr
@@ -9,8 +9,9 @@ LL |     let _ = x0 as f32;
    = help: to override `-D warnings` add `#[allow(clippy::cast_lossless)]`
 help: use `f32::from` instead
    |
-LL |     let _ = f32::from(x0);
-   |             ~~~~~~~~~~~~~
+LL -     let _ = x0 as f32;
+LL +     let _ = f32::from(x0);
+   |
 
 error: casts from `i8` to `f64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_float.rs:13:13
@@ -21,8 +22,9 @@ LL |     let _ = x0 as f64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `f64::from` instead
    |
-LL |     let _ = f64::from(x0);
-   |             ~~~~~~~~~~~~~
+LL -     let _ = x0 as f64;
+LL +     let _ = f64::from(x0);
+   |
 
 error: casts from `i8` to `f32` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_float.rs:14:13
@@ -33,8 +35,9 @@ LL |     let _ = x0 as F32;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `F32::from` instead
    |
-LL |     let _ = F32::from(x0);
-   |             ~~~~~~~~~~~~~
+LL -     let _ = x0 as F32;
+LL +     let _ = F32::from(x0);
+   |
 
 error: casts from `i8` to `f64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_float.rs:15:13
@@ -45,8 +48,9 @@ LL |     let _ = x0 as F64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `F64::from` instead
    |
-LL |     let _ = F64::from(x0);
-   |             ~~~~~~~~~~~~~
+LL -     let _ = x0 as F64;
+LL +     let _ = F64::from(x0);
+   |
 
 error: casts from `u8` to `f32` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_float.rs:17:13
@@ -57,8 +61,9 @@ LL |     let _ = x1 as f32;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `f32::from` instead
    |
-LL |     let _ = f32::from(x1);
-   |             ~~~~~~~~~~~~~
+LL -     let _ = x1 as f32;
+LL +     let _ = f32::from(x1);
+   |
 
 error: casts from `u8` to `f64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_float.rs:18:13
@@ -69,8 +74,9 @@ LL |     let _ = x1 as f64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `f64::from` instead
    |
-LL |     let _ = f64::from(x1);
-   |             ~~~~~~~~~~~~~
+LL -     let _ = x1 as f64;
+LL +     let _ = f64::from(x1);
+   |
 
 error: casts from `i16` to `f32` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_float.rs:20:13
@@ -81,8 +87,9 @@ LL |     let _ = x2 as f32;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `f32::from` instead
    |
-LL |     let _ = f32::from(x2);
-   |             ~~~~~~~~~~~~~
+LL -     let _ = x2 as f32;
+LL +     let _ = f32::from(x2);
+   |
 
 error: casts from `i16` to `f64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_float.rs:21:13
@@ -93,8 +100,9 @@ LL |     let _ = x2 as f64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `f64::from` instead
    |
-LL |     let _ = f64::from(x2);
-   |             ~~~~~~~~~~~~~
+LL -     let _ = x2 as f64;
+LL +     let _ = f64::from(x2);
+   |
 
 error: casts from `u16` to `f32` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_float.rs:23:13
@@ -105,8 +113,9 @@ LL |     let _ = x3 as f32;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `f32::from` instead
    |
-LL |     let _ = f32::from(x3);
-   |             ~~~~~~~~~~~~~
+LL -     let _ = x3 as f32;
+LL +     let _ = f32::from(x3);
+   |
 
 error: casts from `u16` to `f64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_float.rs:24:13
@@ -117,8 +126,9 @@ LL |     let _ = x3 as f64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `f64::from` instead
    |
-LL |     let _ = f64::from(x3);
-   |             ~~~~~~~~~~~~~
+LL -     let _ = x3 as f64;
+LL +     let _ = f64::from(x3);
+   |
 
 error: casts from `i32` to `f64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_float.rs:26:13
@@ -129,8 +139,9 @@ LL |     let _ = x4 as f64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `f64::from` instead
    |
-LL |     let _ = f64::from(x4);
-   |             ~~~~~~~~~~~~~
+LL -     let _ = x4 as f64;
+LL +     let _ = f64::from(x4);
+   |
 
 error: casts from `u32` to `f64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_float.rs:28:13
@@ -141,8 +152,9 @@ LL |     let _ = x5 as f64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `f64::from` instead
    |
-LL |     let _ = f64::from(x5);
-   |             ~~~~~~~~~~~~~
+LL -     let _ = x5 as f64;
+LL +     let _ = f64::from(x5);
+   |
 
 error: casts from `f32` to `f64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_float.rs:31:13
@@ -153,8 +165,9 @@ LL |     let _ = 1.0f32 as f64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `f64::from` instead
    |
-LL |     let _ = f64::from(1.0f32);
-   |             ~~~~~~~~~~~~~~~~~
+LL -     let _ = 1.0f32 as f64;
+LL +     let _ = f64::from(1.0f32);
+   |
 
 error: aborting due to 13 previous errors
 
diff --git a/src/tools/clippy/tests/ui/cast_lossless_integer.stderr b/src/tools/clippy/tests/ui/cast_lossless_integer.stderr
index c93ecb8fb561..d2580913bb54 100644
--- a/src/tools/clippy/tests/ui/cast_lossless_integer.stderr
+++ b/src/tools/clippy/tests/ui/cast_lossless_integer.stderr
@@ -9,8 +9,9 @@ LL |     0u8 as u16;
    = help: to override `-D warnings` add `#[allow(clippy::cast_lossless)]`
 help: use `u16::from` instead
    |
-LL |     u16::from(0u8);
-   |     ~~~~~~~~~~~~~~
+LL -     0u8 as u16;
+LL +     u16::from(0u8);
+   |
 
 error: casts from `u8` to `i16` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:10:5
@@ -21,8 +22,9 @@ LL |     0u8 as i16;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i16::from` instead
    |
-LL |     i16::from(0u8);
-   |     ~~~~~~~~~~~~~~
+LL -     0u8 as i16;
+LL +     i16::from(0u8);
+   |
 
 error: casts from `u8` to `u32` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:12:5
@@ -33,8 +35,9 @@ LL |     0u8 as u32;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `u32::from` instead
    |
-LL |     u32::from(0u8);
-   |     ~~~~~~~~~~~~~~
+LL -     0u8 as u32;
+LL +     u32::from(0u8);
+   |
 
 error: casts from `u8` to `i32` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:14:5
@@ -45,8 +48,9 @@ LL |     0u8 as i32;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i32::from` instead
    |
-LL |     i32::from(0u8);
-   |     ~~~~~~~~~~~~~~
+LL -     0u8 as i32;
+LL +     i32::from(0u8);
+   |
 
 error: casts from `u8` to `u64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:16:5
@@ -57,8 +61,9 @@ LL |     0u8 as u64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `u64::from` instead
    |
-LL |     u64::from(0u8);
-   |     ~~~~~~~~~~~~~~
+LL -     0u8 as u64;
+LL +     u64::from(0u8);
+   |
 
 error: casts from `u8` to `i64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:18:5
@@ -69,8 +74,9 @@ LL |     0u8 as i64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i64::from` instead
    |
-LL |     i64::from(0u8);
-   |     ~~~~~~~~~~~~~~
+LL -     0u8 as i64;
+LL +     i64::from(0u8);
+   |
 
 error: casts from `u8` to `u128` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:20:5
@@ -81,8 +87,9 @@ LL |     0u8 as u128;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `u128::from` instead
    |
-LL |     u128::from(0u8);
-   |     ~~~~~~~~~~~~~~~
+LL -     0u8 as u128;
+LL +     u128::from(0u8);
+   |
 
 error: casts from `u8` to `i128` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:22:5
@@ -93,8 +100,9 @@ LL |     0u8 as i128;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i128::from` instead
    |
-LL |     i128::from(0u8);
-   |     ~~~~~~~~~~~~~~~
+LL -     0u8 as i128;
+LL +     i128::from(0u8);
+   |
 
 error: casts from `u16` to `u32` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:25:5
@@ -105,8 +113,9 @@ LL |     0u16 as u32;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `u32::from` instead
    |
-LL |     u32::from(0u16);
-   |     ~~~~~~~~~~~~~~~
+LL -     0u16 as u32;
+LL +     u32::from(0u16);
+   |
 
 error: casts from `u16` to `i32` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:27:5
@@ -117,8 +126,9 @@ LL |     0u16 as i32;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i32::from` instead
    |
-LL |     i32::from(0u16);
-   |     ~~~~~~~~~~~~~~~
+LL -     0u16 as i32;
+LL +     i32::from(0u16);
+   |
 
 error: casts from `u16` to `u64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:29:5
@@ -129,8 +139,9 @@ LL |     0u16 as u64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `u64::from` instead
    |
-LL |     u64::from(0u16);
-   |     ~~~~~~~~~~~~~~~
+LL -     0u16 as u64;
+LL +     u64::from(0u16);
+   |
 
 error: casts from `u16` to `i64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:31:5
@@ -141,8 +152,9 @@ LL |     0u16 as i64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i64::from` instead
    |
-LL |     i64::from(0u16);
-   |     ~~~~~~~~~~~~~~~
+LL -     0u16 as i64;
+LL +     i64::from(0u16);
+   |
 
 error: casts from `u16` to `u128` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:33:5
@@ -153,8 +165,9 @@ LL |     0u16 as u128;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `u128::from` instead
    |
-LL |     u128::from(0u16);
-   |     ~~~~~~~~~~~~~~~~
+LL -     0u16 as u128;
+LL +     u128::from(0u16);
+   |
 
 error: casts from `u16` to `i128` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:35:5
@@ -165,8 +178,9 @@ LL |     0u16 as i128;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i128::from` instead
    |
-LL |     i128::from(0u16);
-   |     ~~~~~~~~~~~~~~~~
+LL -     0u16 as i128;
+LL +     i128::from(0u16);
+   |
 
 error: casts from `u32` to `u64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:38:5
@@ -177,8 +191,9 @@ LL |     0u32 as u64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `u64::from` instead
    |
-LL |     u64::from(0u32);
-   |     ~~~~~~~~~~~~~~~
+LL -     0u32 as u64;
+LL +     u64::from(0u32);
+   |
 
 error: casts from `u32` to `i64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:40:5
@@ -189,8 +204,9 @@ LL |     0u32 as i64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i64::from` instead
    |
-LL |     i64::from(0u32);
-   |     ~~~~~~~~~~~~~~~
+LL -     0u32 as i64;
+LL +     i64::from(0u32);
+   |
 
 error: casts from `u32` to `u128` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:42:5
@@ -201,8 +217,9 @@ LL |     0u32 as u128;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `u128::from` instead
    |
-LL |     u128::from(0u32);
-   |     ~~~~~~~~~~~~~~~~
+LL -     0u32 as u128;
+LL +     u128::from(0u32);
+   |
 
 error: casts from `u32` to `i128` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:44:5
@@ -213,8 +230,9 @@ LL |     0u32 as i128;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i128::from` instead
    |
-LL |     i128::from(0u32);
-   |     ~~~~~~~~~~~~~~~~
+LL -     0u32 as i128;
+LL +     i128::from(0u32);
+   |
 
 error: casts from `u64` to `u128` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:47:5
@@ -225,8 +243,9 @@ LL |     0u64 as u128;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `u128::from` instead
    |
-LL |     u128::from(0u64);
-   |     ~~~~~~~~~~~~~~~~
+LL -     0u64 as u128;
+LL +     u128::from(0u64);
+   |
 
 error: casts from `u64` to `i128` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:49:5
@@ -237,8 +256,9 @@ LL |     0u64 as i128;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i128::from` instead
    |
-LL |     i128::from(0u64);
-   |     ~~~~~~~~~~~~~~~~
+LL -     0u64 as i128;
+LL +     i128::from(0u64);
+   |
 
 error: casts from `i8` to `i16` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:52:5
@@ -249,8 +269,9 @@ LL |     0i8 as i16;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i16::from` instead
    |
-LL |     i16::from(0i8);
-   |     ~~~~~~~~~~~~~~
+LL -     0i8 as i16;
+LL +     i16::from(0i8);
+   |
 
 error: casts from `i8` to `i32` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:54:5
@@ -261,8 +282,9 @@ LL |     0i8 as i32;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i32::from` instead
    |
-LL |     i32::from(0i8);
-   |     ~~~~~~~~~~~~~~
+LL -     0i8 as i32;
+LL +     i32::from(0i8);
+   |
 
 error: casts from `i8` to `i64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:56:5
@@ -273,8 +295,9 @@ LL |     0i8 as i64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i64::from` instead
    |
-LL |     i64::from(0i8);
-   |     ~~~~~~~~~~~~~~
+LL -     0i8 as i64;
+LL +     i64::from(0i8);
+   |
 
 error: casts from `i8` to `i128` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:58:5
@@ -285,8 +308,9 @@ LL |     0i8 as i128;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i128::from` instead
    |
-LL |     i128::from(0i8);
-   |     ~~~~~~~~~~~~~~~
+LL -     0i8 as i128;
+LL +     i128::from(0i8);
+   |
 
 error: casts from `i16` to `i32` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:61:5
@@ -297,8 +321,9 @@ LL |     0i16 as i32;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i32::from` instead
    |
-LL |     i32::from(0i16);
-   |     ~~~~~~~~~~~~~~~
+LL -     0i16 as i32;
+LL +     i32::from(0i16);
+   |
 
 error: casts from `i16` to `i64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:63:5
@@ -309,8 +334,9 @@ LL |     0i16 as i64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i64::from` instead
    |
-LL |     i64::from(0i16);
-   |     ~~~~~~~~~~~~~~~
+LL -     0i16 as i64;
+LL +     i64::from(0i16);
+   |
 
 error: casts from `i16` to `i128` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:65:5
@@ -321,8 +347,9 @@ LL |     0i16 as i128;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i128::from` instead
    |
-LL |     i128::from(0i16);
-   |     ~~~~~~~~~~~~~~~~
+LL -     0i16 as i128;
+LL +     i128::from(0i16);
+   |
 
 error: casts from `i32` to `i64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:68:5
@@ -333,8 +360,9 @@ LL |     0i32 as i64;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i64::from` instead
    |
-LL |     i64::from(0i32);
-   |     ~~~~~~~~~~~~~~~
+LL -     0i32 as i64;
+LL +     i64::from(0i32);
+   |
 
 error: casts from `i32` to `i128` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:70:5
@@ -345,8 +373,9 @@ LL |     0i32 as i128;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i128::from` instead
    |
-LL |     i128::from(0i32);
-   |     ~~~~~~~~~~~~~~~~
+LL -     0i32 as i128;
+LL +     i128::from(0i32);
+   |
 
 error: casts from `i64` to `i128` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:73:5
@@ -357,8 +386,9 @@ LL |     0i64 as i128;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i128::from` instead
    |
-LL |     i128::from(0i64);
-   |     ~~~~~~~~~~~~~~~~
+LL -     0i64 as i128;
+LL +     i128::from(0i64);
+   |
 
 error: casts from `u8` to `u16` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:77:13
@@ -369,8 +399,9 @@ LL |     let _ = (1u8 + 1u8) as u16;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `u16::from` instead
    |
-LL |     let _ = u16::from(1u8 + 1u8);
-   |             ~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = (1u8 + 1u8) as u16;
+LL +     let _ = u16::from(1u8 + 1u8);
+   |
 
 error: casts from `i8` to `i64` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:80:13
@@ -381,8 +412,9 @@ LL |     let _ = 1i8 as I64Alias;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `I64Alias::from` instead
    |
-LL |     let _ = I64Alias::from(1i8);
-   |             ~~~~~~~~~~~~~~~~~~~
+LL -     let _ = 1i8 as I64Alias;
+LL +     let _ = I64Alias::from(1i8);
+   |
 
 error: casts from `u8` to `u16` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:83:18
@@ -393,8 +425,9 @@ LL |     let _: u16 = 0u8 as _;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `Into::into` instead
    |
-LL |     let _: u16 = 0u8.into();
-   |                  ~~~~~~~~~~
+LL -     let _: u16 = 0u8 as _;
+LL +     let _: u16 = 0u8.into();
+   |
 
 error: casts from `i8` to `i16` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:85:18
@@ -405,8 +438,9 @@ LL |     let _: i16 = -1i8 as _;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `Into::into` instead
    |
-LL |     let _: i16 = (-1i8).into();
-   |                  ~~~~~~~~~~~~~
+LL -     let _: i16 = -1i8 as _;
+LL +     let _: i16 = (-1i8).into();
+   |
 
 error: casts from `u8` to `u16` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:87:18
@@ -417,8 +451,9 @@ LL |     let _: u16 = (1u8 + 2) as _;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `Into::into` instead
    |
-LL |     let _: u16 = (1u8 + 2).into();
-   |                  ~~~~~~~~~~~~~~~~
+LL -     let _: u16 = (1u8 + 2) as _;
+LL +     let _: u16 = (1u8 + 2).into();
+   |
 
 error: casts from `u16` to `u32` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:89:18
@@ -429,8 +464,9 @@ LL |     let _: u32 = 1i8 as u16 as _;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `Into::into` instead
    |
-LL |     let _: u32 = (1i8 as u16).into();
-   |                  ~~~~~~~~~~~~~~~~~~~
+LL -     let _: u32 = 1i8 as u16 as _;
+LL +     let _: u32 = (1i8 as u16).into();
+   |
 
 error: casts from `i8` to `i32` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:124:13
@@ -441,8 +477,9 @@ LL |     let _ = sign_cast!(x, u8, i8) as i32;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i32::from` instead
    |
-LL |     let _ = i32::from(sign_cast!(x, u8, i8));
-   |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = sign_cast!(x, u8, i8) as i32;
+LL +     let _ = i32::from(sign_cast!(x, u8, i8));
+   |
 
 error: casts from `i8` to `i32` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:126:13
@@ -453,8 +490,9 @@ LL |     let _ = (sign_cast!(x, u8, i8) + 1) as i32;
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `i32::from` instead
    |
-LL |     let _ = i32::from(sign_cast!(x, u8, i8) + 1);
-   |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = (sign_cast!(x, u8, i8) + 1) as i32;
+LL +     let _ = i32::from(sign_cast!(x, u8, i8) + 1);
+   |
 
 error: casts from `u8` to `u32` can be expressed infallibly using `From`
   --> tests/ui/cast_lossless_integer.rs:133:13
@@ -469,7 +507,8 @@ LL |     let _ = in_macro!();
    = note: this error originates in the macro `in_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: use `u32::from` instead
    |
-LL |             u32::from(1u8)
+LL -             1u8 as u32
+LL +             u32::from(1u8)
    |
 
 error: casts from `u8` to `u32` can be expressed infallibly using `From`
@@ -481,8 +520,9 @@ LL |     let _ = 0u8 as ty!();
    = help: an `as` cast can become silently lossy if the types change in the future
 help: use `::from` instead
    |
-LL |     let _ = ::from(0u8);
-   |             ~~~~~~~~~~~~~~~~~~
+LL -     let _ = 0u8 as ty!();
+LL +     let _ = ::from(0u8);
+   |
 
 error: aborting due to 40 previous errors
 
diff --git a/src/tools/clippy/tests/ui/cast_size.64bit.stderr b/src/tools/clippy/tests/ui/cast_size.64bit.stderr
index bc37107d80e3..6b9919f8a105 100644
--- a/src/tools/clippy/tests/ui/cast_size.64bit.stderr
+++ b/src/tools/clippy/tests/ui/cast_size.64bit.stderr
@@ -9,8 +9,9 @@ LL |     1isize as i8;
    = help: to override `-D warnings` add `#[allow(clippy::cast_possible_truncation)]`
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     i8::try_from(1isize);
-   |     ~~~~~~~~~~~~~~~~~~~~
+LL -     1isize as i8;
+LL +     i8::try_from(1isize);
+   |
 
 error: casting `isize` to `f32` causes a loss of precision (`isize` is 32 or 64 bits wide, but `f32`'s mantissa is only 23 bits wide)
   --> tests/ui/cast_size.rs:21:5
@@ -48,8 +49,9 @@ LL |     1isize as i32;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     i32::try_from(1isize);
-   |     ~~~~~~~~~~~~~~~~~~~~~
+LL -     1isize as i32;
+LL +     i32::try_from(1isize);
+   |
 
 error: casting `isize` to `u32` may truncate the value on targets with 64-bit wide pointers
   --> tests/ui/cast_size.rs:29:5
@@ -60,8 +62,9 @@ LL |     1isize as u32;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     u32::try_from(1isize);
-   |     ~~~~~~~~~~~~~~~~~~~~~
+LL -     1isize as u32;
+LL +     u32::try_from(1isize);
+   |
 
 error: casting `usize` to `u32` may truncate the value on targets with 64-bit wide pointers
   --> tests/ui/cast_size.rs:30:5
@@ -72,8 +75,9 @@ LL |     1usize as u32;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     u32::try_from(1usize);
-   |     ~~~~~~~~~~~~~~~~~~~~~
+LL -     1usize as u32;
+LL +     u32::try_from(1usize);
+   |
 
 error: casting `usize` to `i32` may truncate the value on targets with 64-bit wide pointers
   --> tests/ui/cast_size.rs:31:5
@@ -84,8 +88,9 @@ LL |     1usize as i32;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     i32::try_from(1usize);
-   |     ~~~~~~~~~~~~~~~~~~~~~
+LL -     1usize as i32;
+LL +     i32::try_from(1usize);
+   |
 
 error: casting `usize` to `i32` may wrap around the value on targets with 32-bit wide pointers
   --> tests/ui/cast_size.rs:31:5
@@ -105,8 +110,9 @@ LL |     1i64 as isize;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     isize::try_from(1i64);
-   |     ~~~~~~~~~~~~~~~~~~~~~
+LL -     1i64 as isize;
+LL +     isize::try_from(1i64);
+   |
 
 error: casting `i64` to `usize` may truncate the value on targets with 32-bit wide pointers
   --> tests/ui/cast_size.rs:33:5
@@ -117,8 +123,9 @@ LL |     1i64 as usize;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     usize::try_from(1i64);
-   |     ~~~~~~~~~~~~~~~~~~~~~
+LL -     1i64 as usize;
+LL +     usize::try_from(1i64);
+   |
 
 error: casting `u64` to `isize` may truncate the value on targets with 32-bit wide pointers
   --> tests/ui/cast_size.rs:34:5
@@ -129,8 +136,9 @@ LL |     1u64 as isize;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     isize::try_from(1u64);
-   |     ~~~~~~~~~~~~~~~~~~~~~
+LL -     1u64 as isize;
+LL +     isize::try_from(1u64);
+   |
 
 error: casting `u64` to `isize` may wrap around the value on targets with 64-bit wide pointers
   --> tests/ui/cast_size.rs:34:5
@@ -147,8 +155,9 @@ LL |     1u64 as usize;
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
 help: ... or use `try_from` and handle the error accordingly
    |
-LL |     usize::try_from(1u64);
-   |     ~~~~~~~~~~~~~~~~~~~~~
+LL -     1u64 as usize;
+LL +     usize::try_from(1u64);
+   |
 
 error: casting `u32` to `isize` may wrap around the value on targets with 32-bit wide pointers
   --> tests/ui/cast_size.rs:36:5
diff --git a/src/tools/clippy/tests/ui/create_dir.stderr b/src/tools/clippy/tests/ui/create_dir.stderr
index ab51705bb55a..9bb98a2606dd 100644
--- a/src/tools/clippy/tests/ui/create_dir.stderr
+++ b/src/tools/clippy/tests/ui/create_dir.stderr
@@ -8,8 +8,9 @@ LL |     std::fs::create_dir("foo");
    = help: to override `-D warnings` add `#[allow(clippy::create_dir)]`
 help: consider calling `std::fs::create_dir_all` instead
    |
-LL |     create_dir_all("foo");
-   |     ~~~~~~~~~~~~~~~~~~~~~
+LL -     std::fs::create_dir("foo");
+LL +     create_dir_all("foo");
+   |
 
 error: calling `std::fs::create_dir` where there may be a better way
   --> tests/ui/create_dir.rs:11:5
@@ -19,8 +20,9 @@ LL |     std::fs::create_dir("bar").unwrap();
    |
 help: consider calling `std::fs::create_dir_all` instead
    |
-LL |     create_dir_all("bar").unwrap();
-   |     ~~~~~~~~~~~~~~~~~~~~~
+LL -     std::fs::create_dir("bar").unwrap();
+LL +     create_dir_all("bar").unwrap();
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/src/tools/clippy/tests/ui/dbg_macro/dbg_macro.stderr b/src/tools/clippy/tests/ui/dbg_macro/dbg_macro.stderr
index b3d74b9ff617..f218614fdd62 100644
--- a/src/tools/clippy/tests/ui/dbg_macro/dbg_macro.stderr
+++ b/src/tools/clippy/tests/ui/dbg_macro/dbg_macro.stderr
@@ -8,8 +8,9 @@ LL |     if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }
    = help: to override `-D warnings` add `#[allow(clippy::dbg_macro)]`
 help: remove the invocation before committing it to a version control system
    |
-LL |     if let Some(n) = n.checked_sub(4) { n } else { n }
-   |                      ~~~~~~~~~~~~~~~~
+LL -     if let Some(n) = dbg!(n.checked_sub(4)) { n } else { n }
+LL +     if let Some(n) = n.checked_sub(4) { n } else { n }
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro.rs:11:8
@@ -19,8 +20,9 @@ LL |     if dbg!(n <= 1) {
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     if n <= 1 {
-   |        ~~~~~~
+LL -     if dbg!(n <= 1) {
+LL +     if n <= 1 {
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro.rs:13:9
@@ -30,7 +32,8 @@ LL |         dbg!(1)
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |         1
+LL -         dbg!(1)
+LL +         1
    |
 
 error: the `dbg!` macro is intended as a debugging tool
@@ -41,7 +44,8 @@ LL |         dbg!(n * factorial(n - 1))
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |         n * factorial(n - 1)
+LL -         dbg!(n * factorial(n - 1))
+LL +         n * factorial(n - 1)
    |
 
 error: the `dbg!` macro is intended as a debugging tool
@@ -52,8 +56,9 @@ LL |     dbg!(42);
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     42;
-   |     ~~
+LL -     dbg!(42);
+LL +     42;
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro.rs:24:14
@@ -63,8 +68,9 @@ LL |     foo(3) + dbg!(factorial(4));
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     foo(3) + factorial(4);
-   |              ~~~~~~~~~~~~
+LL -     foo(3) + dbg!(factorial(4));
+LL +     foo(3) + factorial(4);
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro.rs:26:5
@@ -74,8 +80,9 @@ LL |     dbg!(1, 2, 3, 4, 5);
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     (1, 2, 3, 4, 5);
-   |     ~~~~~~~~~~~~~~~
+LL -     dbg!(1, 2, 3, 4, 5);
+LL +     (1, 2, 3, 4, 5);
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro.rs:48:5
@@ -96,8 +103,9 @@ LL |     let _ = dbg!();
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     let _ = ();
-   |             ~~
+LL -     let _ = dbg!();
+LL +     let _ = ();
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro.rs:53:9
@@ -107,8 +115,9 @@ LL |     bar(dbg!());
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     bar(());
-   |         ~~
+LL -     bar(dbg!());
+LL +     bar(());
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro.rs:55:10
@@ -118,8 +127,9 @@ LL |     foo!(dbg!());
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     foo!(());
-   |          ~~
+LL -     foo!(dbg!());
+LL +     foo!(());
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro.rs:57:16
@@ -129,8 +139,9 @@ LL |     foo2!(foo!(dbg!()));
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     foo2!(foo!(()));
-   |                ~~
+LL -     foo2!(foo!(dbg!()));
+LL +     foo2!(foo!(()));
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro.rs:43:13
@@ -155,8 +166,9 @@ LL |         dbg!(2);
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |         2;
-   |         ~
+LL -         dbg!(2);
+LL +         2;
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro.rs:86:5
@@ -166,8 +178,9 @@ LL |     dbg!(1);
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     1;
-   |     ~
+LL -     dbg!(1);
+LL +     1;
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro.rs:92:5
@@ -177,8 +190,9 @@ LL |     dbg!(1);
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     1;
-   |     ~
+LL -     dbg!(1);
+LL +     1;
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro.rs:99:9
@@ -188,8 +202,9 @@ LL |         dbg!(1);
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |         1;
-   |         ~
+LL -         dbg!(1);
+LL +         1;
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro.rs:106:31
@@ -199,8 +214,9 @@ LL |         println!("dbg: {:?}", dbg!(s));
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |         println!("dbg: {:?}", s);
-   |                               ~
+LL -         println!("dbg: {:?}", dbg!(s));
+LL +         println!("dbg: {:?}", s);
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro.rs:108:22
@@ -210,8 +226,9 @@ LL |         print!("{}", dbg!(s));
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |         print!("{}", s);
-   |                      ~
+LL -         print!("{}", dbg!(s));
+LL +         print!("{}", s);
+   |
 
 error: aborting due to 19 previous errors
 
diff --git a/src/tools/clippy/tests/ui/dbg_macro/dbg_macro_unfixable.stderr b/src/tools/clippy/tests/ui/dbg_macro/dbg_macro_unfixable.stderr
index b8e91906b931..e8d5f9f2f46f 100644
--- a/src/tools/clippy/tests/ui/dbg_macro/dbg_macro_unfixable.stderr
+++ b/src/tools/clippy/tests/ui/dbg_macro/dbg_macro_unfixable.stderr
@@ -19,8 +19,9 @@ LL |     dbg!(dbg!(dbg!(42)));
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     dbg!(dbg!(42));
-   |     ~~~~~~~~~~~~~~
+LL -     dbg!(dbg!(dbg!(42)));
+LL +     dbg!(dbg!(42));
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro_unfixable.rs:8:10
@@ -30,8 +31,9 @@ LL |     dbg!(dbg!(dbg!(42)));
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     dbg!(dbg!(42));
-   |          ~~~~~~~~
+LL -     dbg!(dbg!(dbg!(42)));
+LL +     dbg!(dbg!(42));
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro_unfixable.rs:8:15
@@ -41,8 +43,9 @@ LL |     dbg!(dbg!(dbg!(42)));
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     dbg!(dbg!(42));
-   |               ~~
+LL -     dbg!(dbg!(dbg!(42)));
+LL +     dbg!(dbg!(42));
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro_unfixable.rs:10:5
@@ -52,8 +55,9 @@ LL |     dbg!(1, 2, dbg!(3, 4));
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     (1, 2, dbg!(3, 4));
-   |     ~~~~~~~~~~~~~~~~~~
+LL -     dbg!(1, 2, dbg!(3, 4));
+LL +     (1, 2, dbg!(3, 4));
+   |
 
 error: the `dbg!` macro is intended as a debugging tool
   --> tests/ui/dbg_macro/dbg_macro_unfixable.rs:10:16
@@ -63,8 +67,9 @@ LL |     dbg!(1, 2, dbg!(3, 4));
    |
 help: remove the invocation before committing it to a version control system
    |
-LL |     dbg!(1, 2, (3, 4));
-   |                ~~~~~~
+LL -     dbg!(1, 2, dbg!(3, 4));
+LL +     dbg!(1, 2, (3, 4));
+   |
 
 error: aborting due to 6 previous errors
 
diff --git a/src/tools/clippy/tests/ui/doc/doc-fixable.stderr b/src/tools/clippy/tests/ui/doc/doc-fixable.stderr
index 27a04e4b5583..54d735814855 100644
--- a/src/tools/clippy/tests/ui/doc/doc-fixable.stderr
+++ b/src/tools/clippy/tests/ui/doc/doc-fixable.stderr
@@ -8,8 +8,9 @@ LL | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot t
    = help: to override `-D warnings` add `#[allow(clippy::doc_markdown)]`
 help: try
    |
-LL | /// The `foo_bar` function does _nothing_. See also foo::bar. (note the dot there)
-   |         ~~~~~~~~~
+LL - /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
+LL + /// The `foo_bar` function does _nothing_. See also foo::bar. (note the dot there)
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:9:51
@@ -19,8 +20,9 @@ LL | /// The foo_bar function does _nothing_. See also foo::bar. (note the dot t
    |
 help: try
    |
-LL | /// The foo_bar function does _nothing_. See also `foo::bar`. (note the dot there)
-   |                                                   ~~~~~~~~~~
+LL - /// The foo_bar function does _nothing_. See also foo::bar. (note the dot there)
+LL + /// The foo_bar function does _nothing_. See also `foo::bar`. (note the dot there)
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:10:83
@@ -30,8 +32,9 @@ LL | /// Markdown is _weird_. I mean _really weird_. This \_ is ok. So is `_`. B
    |
 help: try
    |
-LL | /// Markdown is _weird_. I mean _really weird_. This \_ is ok. So is `_`. But not `Foo::some_fun`
-   |                                                                                   ~~~~~~~~~~~~~~~
+LL - /// Markdown is _weird_. I mean _really weird_. This \_ is ok. So is `_`. But not Foo::some_fun
+LL + /// Markdown is _weird_. I mean _really weird_. This \_ is ok. So is `_`. But not `Foo::some_fun`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:12:13
@@ -41,8 +44,9 @@ LL | /// Here be ::a::global:path, and _::another::global::path_.  :: is not a p
    |
 help: try
    |
-LL | /// Here be `::a::global:path`, and _::another::global::path_.  :: is not a path though.
-   |             ~~~~~~~~~~~~~~~~~~
+LL - /// Here be ::a::global:path, and _::another::global::path_.  :: is not a path though.
+LL + /// Here be `::a::global:path`, and _::another::global::path_.  :: is not a path though.
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:12:36
@@ -52,8 +56,9 @@ LL | /// Here be ::a::global:path, and _::another::global::path_.  :: is not a p
    |
 help: try
    |
-LL | /// Here be ::a::global:path, and _`::another::global::path`_.  :: is not a path though.
-   |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// Here be ::a::global:path, and _::another::global::path_.  :: is not a path though.
+LL + /// Here be ::a::global:path, and _`::another::global::path`_.  :: is not a path though.
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:13:25
@@ -63,8 +68,9 @@ LL | /// Import an item from ::awesome::global::blob:: (Intended postfix)
    |
 help: try
    |
-LL | /// Import an item from `::awesome::global::blob::` (Intended postfix)
-   |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// Import an item from ::awesome::global::blob:: (Intended postfix)
+LL + /// Import an item from `::awesome::global::blob::` (Intended postfix)
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:14:31
@@ -74,8 +80,9 @@ LL | /// These are the options for ::Cat: (Intended trailing single colon, shoul
    |
 help: try
    |
-LL | /// These are the options for `::Cat`: (Intended trailing single colon, shouldn't be linted)
-   |                               ~~~~~~~
+LL - /// These are the options for ::Cat: (Intended trailing single colon, shouldn't be linted)
+LL + /// These are the options for `::Cat`: (Intended trailing single colon, shouldn't be linted)
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:15:22
@@ -85,8 +92,9 @@ LL | /// That's not code ~NotInCodeBlock~.
    |
 help: try
    |
-LL | /// That's not code ~`NotInCodeBlock`~.
-   |                      ~~~~~~~~~~~~~~~~
+LL - /// That's not code ~NotInCodeBlock~.
+LL + /// That's not code ~`NotInCodeBlock`~.
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:16:5
@@ -96,8 +104,9 @@ LL | /// be_sure_we_got_to_the_end_of_it
    |
 help: try
    |
-LL | /// `be_sure_we_got_to_the_end_of_it`
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// be_sure_we_got_to_the_end_of_it
+LL + /// `be_sure_we_got_to_the_end_of_it`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:30:5
@@ -107,8 +116,9 @@ LL | /// be_sure_we_got_to_the_end_of_it
    |
 help: try
    |
-LL | /// `be_sure_we_got_to_the_end_of_it`
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// be_sure_we_got_to_the_end_of_it
+LL + /// `be_sure_we_got_to_the_end_of_it`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:37:5
@@ -118,8 +128,9 @@ LL | /// be_sure_we_got_to_the_end_of_it
    |
 help: try
    |
-LL | /// `be_sure_we_got_to_the_end_of_it`
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// be_sure_we_got_to_the_end_of_it
+LL + /// `be_sure_we_got_to_the_end_of_it`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:51:5
@@ -129,8 +140,9 @@ LL | /// be_sure_we_got_to_the_end_of_it
    |
 help: try
    |
-LL | /// `be_sure_we_got_to_the_end_of_it`
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// be_sure_we_got_to_the_end_of_it
+LL + /// `be_sure_we_got_to_the_end_of_it`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:79:5
@@ -140,8 +152,9 @@ LL | /// be_sure_we_got_to_the_end_of_it
    |
 help: try
    |
-LL | /// `be_sure_we_got_to_the_end_of_it`
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// be_sure_we_got_to_the_end_of_it
+LL + /// `be_sure_we_got_to_the_end_of_it`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:96:5
@@ -151,8 +164,9 @@ LL | /// be_sure_we_got_to_the_end_of_it
    |
 help: try
    |
-LL | /// `be_sure_we_got_to_the_end_of_it`
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// be_sure_we_got_to_the_end_of_it
+LL + /// `be_sure_we_got_to_the_end_of_it`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:104:8
@@ -162,8 +176,9 @@ LL | /// ## CamelCaseThing
    |
 help: try
    |
-LL | /// ## `CamelCaseThing`
-   |        ~~~~~~~~~~~~~~~~
+LL - /// ## CamelCaseThing
+LL + /// ## `CamelCaseThing`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:107:7
@@ -173,8 +188,9 @@ LL | /// # CamelCaseThing
    |
 help: try
    |
-LL | /// # `CamelCaseThing`
-   |       ~~~~~~~~~~~~~~~~
+LL - /// # CamelCaseThing
+LL + /// # `CamelCaseThing`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:109:22
@@ -184,8 +200,9 @@ LL | /// Not a title #897 CamelCaseThing
    |
 help: try
    |
-LL | /// Not a title #897 `CamelCaseThing`
-   |                      ~~~~~~~~~~~~~~~~
+LL - /// Not a title #897 CamelCaseThing
+LL + /// Not a title #897 `CamelCaseThing`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:110:5
@@ -195,8 +212,9 @@ LL | /// be_sure_we_got_to_the_end_of_it
    |
 help: try
    |
-LL | /// `be_sure_we_got_to_the_end_of_it`
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// be_sure_we_got_to_the_end_of_it
+LL + /// `be_sure_we_got_to_the_end_of_it`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:117:5
@@ -206,8 +224,9 @@ LL | /// be_sure_we_got_to_the_end_of_it
    |
 help: try
    |
-LL | /// `be_sure_we_got_to_the_end_of_it`
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// be_sure_we_got_to_the_end_of_it
+LL + /// `be_sure_we_got_to_the_end_of_it`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:130:5
@@ -217,8 +236,9 @@ LL | /// be_sure_we_got_to_the_end_of_it
    |
 help: try
    |
-LL | /// `be_sure_we_got_to_the_end_of_it`
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// be_sure_we_got_to_the_end_of_it
+LL + /// `be_sure_we_got_to_the_end_of_it`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:141:43
@@ -228,8 +248,9 @@ LL | /** E.g., serialization of an empty list: FooBar
    |
 help: try
    |
-LL | /** E.g., serialization of an empty list: `FooBar`
-   |                                           ~~~~~~~~
+LL - /** E.g., serialization of an empty list: FooBar
+LL + /** E.g., serialization of an empty list: `FooBar`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:146:5
@@ -239,8 +260,9 @@ LL | And BarQuz too.
    |
 help: try
    |
-LL | And `BarQuz` too.
-   |     ~~~~~~~~
+LL - And BarQuz too.
+LL + And `BarQuz` too.
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:147:1
@@ -250,7 +272,8 @@ LL | be_sure_we_got_to_the_end_of_it
    |
 help: try
    |
-LL | `be_sure_we_got_to_the_end_of_it`
+LL - be_sure_we_got_to_the_end_of_it
+LL + `be_sure_we_got_to_the_end_of_it`
    |
 
 error: item in documentation is missing backticks
@@ -261,8 +284,9 @@ LL | /** E.g., serialization of an empty list: FooBar
    |
 help: try
    |
-LL | /** E.g., serialization of an empty list: `FooBar`
-   |                                           ~~~~~~~~
+LL - /** E.g., serialization of an empty list: FooBar
+LL + /** E.g., serialization of an empty list: `FooBar`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:157:5
@@ -272,8 +296,9 @@ LL | And BarQuz too.
    |
 help: try
    |
-LL | And `BarQuz` too.
-   |     ~~~~~~~~
+LL - And BarQuz too.
+LL + And `BarQuz` too.
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:158:1
@@ -283,7 +308,8 @@ LL | be_sure_we_got_to_the_end_of_it
    |
 help: try
    |
-LL | `be_sure_we_got_to_the_end_of_it`
+LL - be_sure_we_got_to_the_end_of_it
+LL + `be_sure_we_got_to_the_end_of_it`
    |
 
 error: item in documentation is missing backticks
@@ -294,8 +320,9 @@ LL | /// be_sure_we_got_to_the_end_of_it
    |
 help: try
    |
-LL | /// `be_sure_we_got_to_the_end_of_it`
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// be_sure_we_got_to_the_end_of_it
+LL + /// `be_sure_we_got_to_the_end_of_it`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:188:22
@@ -305,8 +332,9 @@ LL | /// An iterator over mycrate::Collection's values.
    |
 help: try
    |
-LL | /// An iterator over `mycrate::Collection`'s values.
-   |                      ~~~~~~~~~~~~~~~~~~~~~
+LL - /// An iterator over mycrate::Collection's values.
+LL + /// An iterator over `mycrate::Collection`'s values.
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:212:34
@@ -316,8 +344,9 @@ LL | /// Foo \[bar\] \[baz\] \[qux\]. DocMarkdownLint
    |
 help: try
    |
-LL | /// Foo \[bar\] \[baz\] \[qux\]. `DocMarkdownLint`
-   |                                  ~~~~~~~~~~~~~~~~~
+LL - /// Foo \[bar\] \[baz\] \[qux\]. DocMarkdownLint
+LL + /// Foo \[bar\] \[baz\] \[qux\]. `DocMarkdownLint`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:235:22
@@ -327,8 +356,9 @@ LL | /// There is no try (do() or do_not()).
    |
 help: try
    |
-LL | /// There is no try (`do()` or do_not()).
-   |                      ~~~~~~
+LL - /// There is no try (do() or do_not()).
+LL + /// There is no try (`do()` or do_not()).
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:235:30
@@ -338,8 +368,9 @@ LL | /// There is no try (do() or do_not()).
    |
 help: try
    |
-LL | /// There is no try (do() or `do_not()`).
-   |                              ~~~~~~~~~~
+LL - /// There is no try (do() or do_not()).
+LL + /// There is no try (do() or `do_not()`).
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:238:5
@@ -349,8 +380,9 @@ LL | /// ABes
    |
 help: try
    |
-LL | /// `ABes`
-   |     ~~~~~~
+LL - /// ABes
+LL + /// `ABes`
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/doc-fixable.rs:244:9
@@ -360,8 +392,9 @@ LL |     /// foo()
    |
 help: try
    |
-LL |     /// `foo()`
-   |         ~~~~~~~
+LL -     /// foo()
+LL +     /// `foo()`
+   |
 
 error: you should put bare URLs between `<`/`>` or make a proper Markdown link
   --> tests/ui/doc/doc-fixable.rs:248:5
diff --git a/src/tools/clippy/tests/ui/doc/doc_markdown-issue_13097.stderr b/src/tools/clippy/tests/ui/doc/doc_markdown-issue_13097.stderr
index ae68a767ec93..65b8f2ed80b6 100644
--- a/src/tools/clippy/tests/ui/doc/doc_markdown-issue_13097.stderr
+++ b/src/tools/clippy/tests/ui/doc/doc_markdown-issue_13097.stderr
@@ -11,8 +11,9 @@ LL | #![deny(clippy::doc_markdown)]
    |         ^^^^^^^^^^^^^^^^^^^^
 help: try
    |
-LL |     /// `HumaNified`
-   |         ~~~~~~~~~~~~
+LL -     /// HumaNified
+LL +     /// `HumaNified`
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/src/tools/clippy/tests/ui/doc/issue_10262.stderr b/src/tools/clippy/tests/ui/doc/issue_10262.stderr
index f43d9551e94e..f9ecb3de219b 100644
--- a/src/tools/clippy/tests/ui/doc/issue_10262.stderr
+++ b/src/tools/clippy/tests/ui/doc/issue_10262.stderr
@@ -8,8 +8,9 @@ LL | /// AviSynth documentation:
    = help: to override `-D warnings` add `#[allow(clippy::doc_markdown)]`
 help: try
    |
-LL | /// `AviSynth` documentation:
-   |     ~~~~~~~~~~
+LL - /// AviSynth documentation:
+LL + /// `AviSynth` documentation:
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/src/tools/clippy/tests/ui/doc/issue_12795.stderr b/src/tools/clippy/tests/ui/doc/issue_12795.stderr
index 5700145ec8f7..047de915ed4c 100644
--- a/src/tools/clippy/tests/ui/doc/issue_12795.stderr
+++ b/src/tools/clippy/tests/ui/doc/issue_12795.stderr
@@ -8,8 +8,9 @@ LL | //! A comment with a_b(x) and a_c in it and (a_b((c)) ) too and (maybe a_b(
    = help: to override `-D warnings` add `#[allow(clippy::doc_markdown)]`
 help: try
    |
-LL | //! A comment with `a_b(x)` and a_c in it and (a_b((c)) ) too and (maybe a_b((c)))
-   |                    ~~~~~~~~
+LL - //! A comment with a_b(x) and a_c in it and (a_b((c)) ) too and (maybe a_b((c)))
+LL + //! A comment with `a_b(x)` and a_c in it and (a_b((c)) ) too and (maybe a_b((c)))
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/issue_12795.rs:3:31
@@ -19,8 +20,9 @@ LL | //! A comment with a_b(x) and a_c in it and (a_b((c)) ) too and (maybe a_b(
    |
 help: try
    |
-LL | //! A comment with a_b(x) and `a_c` in it and (a_b((c)) ) too and (maybe a_b((c)))
-   |                               ~~~~~
+LL - //! A comment with a_b(x) and a_c in it and (a_b((c)) ) too and (maybe a_b((c)))
+LL + //! A comment with a_b(x) and `a_c` in it and (a_b((c)) ) too and (maybe a_b((c)))
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/issue_12795.rs:3:46
@@ -30,8 +32,9 @@ LL | //! A comment with a_b(x) and a_c in it and (a_b((c)) ) too and (maybe a_b(
    |
 help: try
    |
-LL | //! A comment with a_b(x) and a_c in it and (`a_b((c))` ) too and (maybe a_b((c)))
-   |                                              ~~~~~~~~~~
+LL - //! A comment with a_b(x) and a_c in it and (a_b((c)) ) too and (maybe a_b((c)))
+LL + //! A comment with a_b(x) and a_c in it and (`a_b((c))` ) too and (maybe a_b((c)))
+   |
 
 error: item in documentation is missing backticks
   --> tests/ui/doc/issue_12795.rs:3:72
@@ -41,8 +44,9 @@ LL | //! A comment with a_b(x) and a_c in it and (a_b((c)) ) too and (maybe a_b(
    |
 help: try
    |
-LL | //! A comment with a_b(x) and a_c in it and (a_b((c)) ) too and (maybe `a_b((c))`)
-   |                                                                        ~~~~~~~~~~
+LL - //! A comment with a_b(x) and a_c in it and (a_b((c)) ) too and (maybe a_b((c)))
+LL + //! A comment with a_b(x) and a_c in it and (a_b((c)) ) too and (maybe `a_b((c))`)
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/src/tools/clippy/tests/ui/doc/issue_9473.stderr b/src/tools/clippy/tests/ui/doc/issue_9473.stderr
index 35aa2884cc11..744c8dc8c838 100644
--- a/src/tools/clippy/tests/ui/doc/issue_9473.stderr
+++ b/src/tools/clippy/tests/ui/doc/issue_9473.stderr
@@ -8,8 +8,9 @@ LL | /// Blah blah blah [FooBar]<[FooBar]>[FooBar].
    = help: to override `-D warnings` add `#[allow(clippy::doc_markdown)]`
 help: try
    |
-LL | /// Blah blah blah [FooBar]<[FooBar]>[`FooBar`].
-   |                                                          ~~~~~~~~
+LL - /// Blah blah blah [FooBar]<[FooBar]>[FooBar].
+LL + /// Blah blah blah [FooBar]<[FooBar]>[`FooBar`].
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/src/tools/clippy/tests/ui/doc/unbalanced_ticks.stderr b/src/tools/clippy/tests/ui/doc/unbalanced_ticks.stderr
index c9fd25eb1a1c..4114a823822c 100644
--- a/src/tools/clippy/tests/ui/doc/unbalanced_ticks.stderr
+++ b/src/tools/clippy/tests/ui/doc/unbalanced_ticks.stderr
@@ -29,8 +29,9 @@ LL | /// This paragraph is fine and should_be linted normally.
    |
 help: try
    |
-LL | /// This paragraph is fine and `should_be` linted normally.
-   |                                ~~~~~~~~~~~
+LL - /// This paragraph is fine and should_be linted normally.
+LL + /// This paragraph is fine and `should_be` linted normally.
+   |
 
 error: backticks are unbalanced
   --> tests/ui/doc/unbalanced_ticks.rs:20:5
@@ -48,8 +49,9 @@ LL | /// ## not_fine
    |
 help: try
    |
-LL | /// ## `not_fine`
-   |        ~~~~~~~~~~
+LL - /// ## not_fine
+LL + /// ## `not_fine`
+   |
 
 error: backticks are unbalanced
   --> tests/ui/doc/unbalanced_ticks.rs:37:5
@@ -75,8 +77,9 @@ LL | /// - This item needs backticks_here
    |
 help: try
    |
-LL | /// - This item needs `backticks_here`
-   |                       ~~~~~~~~~~~~~~~~
+LL - /// - This item needs backticks_here
+LL + /// - This item needs `backticks_here`
+   |
 
 error: backticks are unbalanced
   --> tests/ui/doc/unbalanced_ticks.rs:53:5
diff --git a/src/tools/clippy/tests/ui/eager_transmute.stderr b/src/tools/clippy/tests/ui/eager_transmute.stderr
index 5cf7bd49a929..68690c3730d8 100644
--- a/src/tools/clippy/tests/ui/eager_transmute.stderr
+++ b/src/tools/clippy/tests/ui/eager_transmute.stderr
@@ -8,8 +8,9 @@ LL |     (op < 4).then_some(unsafe { std::mem::transmute(op) })
    = help: to override `-D warnings` add `#[allow(clippy::eager_transmute)]`
 help: consider using `bool::then` to only transmute if the condition holds
    |
-LL |     (op < 4).then(|| unsafe { std::mem::transmute(op) })
-   |              ~~~~ ++
+LL -     (op < 4).then_some(unsafe { std::mem::transmute(op) })
+LL +     (op < 4).then(|| unsafe { std::mem::transmute(op) })
+   |
 
 error: this transmute is always evaluated eagerly, even if the condition is false
   --> tests/ui/eager_transmute.rs:27:33
@@ -19,8 +20,9 @@ LL |     (op < 4).then_some(unsafe { std::mem::transmute::<_, Opcode>(op) });
    |
 help: consider using `bool::then` to only transmute if the condition holds
    |
-LL |     (op < 4).then(|| unsafe { std::mem::transmute::<_, Opcode>(op) });
-   |              ~~~~ ++
+LL -     (op < 4).then_some(unsafe { std::mem::transmute::<_, Opcode>(op) });
+LL +     (op < 4).then(|| unsafe { std::mem::transmute::<_, Opcode>(op) });
+   |
 
 error: this transmute is always evaluated eagerly, even if the condition is false
   --> tests/ui/eager_transmute.rs:28:33
@@ -30,8 +32,9 @@ LL |     (op > 4).then_some(unsafe { std::mem::transmute::<_, Opcode>(op) });
    |
 help: consider using `bool::then` to only transmute if the condition holds
    |
-LL |     (op > 4).then(|| unsafe { std::mem::transmute::<_, Opcode>(op) });
-   |              ~~~~ ++
+LL -     (op > 4).then_some(unsafe { std::mem::transmute::<_, Opcode>(op) });
+LL +     (op > 4).then(|| unsafe { std::mem::transmute::<_, Opcode>(op) });
+   |
 
 error: this transmute is always evaluated eagerly, even if the condition is false
   --> tests/ui/eager_transmute.rs:29:34
@@ -41,8 +44,9 @@ LL |     (op == 0).then_some(unsafe { std::mem::transmute::<_, Opcode>(op) });
    |
 help: consider using `bool::then` to only transmute if the condition holds
    |
-LL |     (op == 0).then(|| unsafe { std::mem::transmute::<_, Opcode>(op) });
-   |               ~~~~ ++
+LL -     (op == 0).then_some(unsafe { std::mem::transmute::<_, Opcode>(op) });
+LL +     (op == 0).then(|| unsafe { std::mem::transmute::<_, Opcode>(op) });
+   |
 
 error: this transmute is always evaluated eagerly, even if the condition is false
   --> tests/ui/eager_transmute.rs:31:68
@@ -52,8 +56,9 @@ LL |     let _: Option = (op > 0 && op < 10).then_some(unsafe { std::mem
    |
 help: consider using `bool::then` to only transmute if the condition holds
    |
-LL |     let _: Option = (op > 0 && op < 10).then(|| unsafe { std::mem::transmute(op) });
-   |                                                 ~~~~ ++
+LL -     let _: Option = (op > 0 && op < 10).then_some(unsafe { std::mem::transmute(op) });
+LL +     let _: Option = (op > 0 && op < 10).then(|| unsafe { std::mem::transmute(op) });
+   |
 
 error: this transmute is always evaluated eagerly, even if the condition is false
   --> tests/ui/eager_transmute.rs:32:86
@@ -63,8 +68,9 @@ LL |     let _: Option = (op > 0 && op < 10 && unrelated == 0).then_some
    |
 help: consider using `bool::then` to only transmute if the condition holds
    |
-LL |     let _: Option = (op > 0 && op < 10 && unrelated == 0).then(|| unsafe { std::mem::transmute(op) });
-   |                                                                   ~~~~ ++
+LL -     let _: Option = (op > 0 && op < 10 && unrelated == 0).then_some(unsafe { std::mem::transmute(op) });
+LL +     let _: Option = (op > 0 && op < 10 && unrelated == 0).then(|| unsafe { std::mem::transmute(op) });
+   |
 
 error: this transmute is always evaluated eagerly, even if the condition is false
   --> tests/ui/eager_transmute.rs:35:84
@@ -74,8 +80,9 @@ LL |     let _: Option = (op2.foo[0] > 0 && op2.foo[0] < 10).then_some(u
    |
 help: consider using `bool::then` to only transmute if the condition holds
    |
-LL |     let _: Option = (op2.foo[0] > 0 && op2.foo[0] < 10).then(|| unsafe { std::mem::transmute(op2.foo[0]) });
-   |                                                                 ~~~~ ++
+LL -     let _: Option = (op2.foo[0] > 0 && op2.foo[0] < 10).then_some(unsafe { std::mem::transmute(op2.foo[0]) });
+LL +     let _: Option = (op2.foo[0] > 0 && op2.foo[0] < 10).then(|| unsafe { std::mem::transmute(op2.foo[0]) });
+   |
 
 error: this transmute is always evaluated eagerly, even if the condition is false
   --> tests/ui/eager_transmute.rs:47:70
@@ -85,8 +92,9 @@ LL |     let _: Option = (1..=3).contains(&op).then_some(unsafe { std::m
    |
 help: consider using `bool::then` to only transmute if the condition holds
    |
-LL |     let _: Option = (1..=3).contains(&op).then(|| unsafe { std::mem::transmute(op) });
-   |                                                   ~~~~ ++
+LL -     let _: Option = (1..=3).contains(&op).then_some(unsafe { std::mem::transmute(op) });
+LL +     let _: Option = (1..=3).contains(&op).then(|| unsafe { std::mem::transmute(op) });
+   |
 
 error: this transmute is always evaluated eagerly, even if the condition is false
   --> tests/ui/eager_transmute.rs:48:83
@@ -96,8 +104,9 @@ LL |     let _: Option = ((1..=3).contains(&op) || op == 4).then_some(un
    |
 help: consider using `bool::then` to only transmute if the condition holds
    |
-LL |     let _: Option = ((1..=3).contains(&op) || op == 4).then(|| unsafe { std::mem::transmute(op) });
-   |                                                                ~~~~ ++
+LL -     let _: Option = ((1..=3).contains(&op) || op == 4).then_some(unsafe { std::mem::transmute(op) });
+LL +     let _: Option = ((1..=3).contains(&op) || op == 4).then(|| unsafe { std::mem::transmute(op) });
+   |
 
 error: this transmute is always evaluated eagerly, even if the condition is false
   --> tests/ui/eager_transmute.rs:49:69
@@ -107,8 +116,9 @@ LL |     let _: Option = (1..3).contains(&op).then_some(unsafe { std::me
    |
 help: consider using `bool::then` to only transmute if the condition holds
    |
-LL |     let _: Option = (1..3).contains(&op).then(|| unsafe { std::mem::transmute(op) });
-   |                                                  ~~~~ ++
+LL -     let _: Option = (1..3).contains(&op).then_some(unsafe { std::mem::transmute(op) });
+LL +     let _: Option = (1..3).contains(&op).then(|| unsafe { std::mem::transmute(op) });
+   |
 
 error: this transmute is always evaluated eagerly, even if the condition is false
   --> tests/ui/eager_transmute.rs:50:68
@@ -118,8 +128,9 @@ LL |     let _: Option = (1..).contains(&op).then_some(unsafe { std::mem
    |
 help: consider using `bool::then` to only transmute if the condition holds
    |
-LL |     let _: Option = (1..).contains(&op).then(|| unsafe { std::mem::transmute(op) });
-   |                                                 ~~~~ ++
+LL -     let _: Option = (1..).contains(&op).then_some(unsafe { std::mem::transmute(op) });
+LL +     let _: Option = (1..).contains(&op).then(|| unsafe { std::mem::transmute(op) });
+   |
 
 error: this transmute is always evaluated eagerly, even if the condition is false
   --> tests/ui/eager_transmute.rs:51:68
@@ -129,8 +140,9 @@ LL |     let _: Option = (..3).contains(&op).then_some(unsafe { std::mem
    |
 help: consider using `bool::then` to only transmute if the condition holds
    |
-LL |     let _: Option = (..3).contains(&op).then(|| unsafe { std::mem::transmute(op) });
-   |                                                 ~~~~ ++
+LL -     let _: Option = (..3).contains(&op).then_some(unsafe { std::mem::transmute(op) });
+LL +     let _: Option = (..3).contains(&op).then(|| unsafe { std::mem::transmute(op) });
+   |
 
 error: this transmute is always evaluated eagerly, even if the condition is false
   --> tests/ui/eager_transmute.rs:52:69
@@ -140,8 +152,9 @@ LL |     let _: Option = (..=3).contains(&op).then_some(unsafe { std::me
    |
 help: consider using `bool::then` to only transmute if the condition holds
    |
-LL |     let _: Option = (..=3).contains(&op).then(|| unsafe { std::mem::transmute(op) });
-   |                                                  ~~~~ ++
+LL -     let _: Option = (..=3).contains(&op).then_some(unsafe { std::mem::transmute(op) });
+LL +     let _: Option = (..=3).contains(&op).then(|| unsafe { std::mem::transmute(op) });
+   |
 
 error: this transmute is always evaluated eagerly, even if the condition is false
   --> tests/ui/eager_transmute.rs:61:24
@@ -151,8 +164,9 @@ LL |     (op < 4).then_some(std::mem::transmute::<_, Opcode>(op));
    |
 help: consider using `bool::then` to only transmute if the condition holds
    |
-LL |     (op < 4).then(|| std::mem::transmute::<_, Opcode>(op));
-   |              ~~~~ ++
+LL -     (op < 4).then_some(std::mem::transmute::<_, Opcode>(op));
+LL +     (op < 4).then(|| std::mem::transmute::<_, Opcode>(op));
+   |
 
 error: this transmute is always evaluated eagerly, even if the condition is false
   --> tests/ui/eager_transmute.rs:90:62
@@ -162,8 +176,9 @@ LL |     let _: Option> = (v1 > 0).then_some(unsafe { std::mem::tran
    |
 help: consider using `bool::then` to only transmute if the condition holds
    |
-LL |     let _: Option> = (v1 > 0).then(|| unsafe { std::mem::transmute(v1) });
-   |                                           ~~~~ ++
+LL -     let _: Option> = (v1 > 0).then_some(unsafe { std::mem::transmute(v1) });
+LL +     let _: Option> = (v1 > 0).then(|| unsafe { std::mem::transmute(v1) });
+   |
 
 error: this transmute is always evaluated eagerly, even if the condition is false
   --> tests/ui/eager_transmute.rs:96:86
@@ -173,8 +188,9 @@ LL |     let _: Option = (v2 < NonZero::new(255u8).unwrap()).then_some
    |
 help: consider using `bool::then` to only transmute if the condition holds
    |
-LL |     let _: Option = (v2 < NonZero::new(255u8).unwrap()).then(|| unsafe { std::mem::transmute(v2) });
-   |                                                                   ~~~~ ++
+LL -     let _: Option = (v2 < NonZero::new(255u8).unwrap()).then_some(unsafe { std::mem::transmute(v2) });
+LL +     let _: Option = (v2 < NonZero::new(255u8).unwrap()).then(|| unsafe { std::mem::transmute(v2) });
+   |
 
 error: this transmute is always evaluated eagerly, even if the condition is false
   --> tests/ui/eager_transmute.rs:102:93
@@ -184,8 +200,9 @@ LL |     let _: Option = (v2 < NonZero::new(255u8).unwrap()).th
    |
 help: consider using `bool::then` to only transmute if the condition holds
    |
-LL |     let _: Option = (v2 < NonZero::new(255u8).unwrap()).then(|| unsafe { std::mem::transmute(v2) });
-   |                                                                          ~~~~ ++
+LL -     let _: Option = (v2 < NonZero::new(255u8).unwrap()).then_some(unsafe { std::mem::transmute(v2) });
+LL +     let _: Option = (v2 < NonZero::new(255u8).unwrap()).then(|| unsafe { std::mem::transmute(v2) });
+   |
 
 error: aborting due to 17 previous errors
 
diff --git a/src/tools/clippy/tests/ui/empty_line_after/doc_comments.stderr b/src/tools/clippy/tests/ui/empty_line_after/doc_comments.stderr
index 7b197ae67e00..ca05a1b03eb1 100644
--- a/src/tools/clippy/tests/ui/empty_line_after/doc_comments.stderr
+++ b/src/tools/clippy/tests/ui/empty_line_after/doc_comments.stderr
@@ -131,8 +131,9 @@ LL |       fn first_in_module() {}
    = help: if the empty line is unintentional, remove it
 help: if the comment should document the parent module use an inner doc comment
    |
-LL |     /*!
-   |       ~
+LL -     /**
+LL +     /*!
+   |
 
 error: empty line after doc comment
   --> tests/ui/empty_line_after/doc_comments.rs:85:5
diff --git a/src/tools/clippy/tests/ui/excessive_precision.stderr b/src/tools/clippy/tests/ui/excessive_precision.stderr
index 81e4fb6765d0..b1f12eed4200 100644
--- a/src/tools/clippy/tests/ui/excessive_precision.stderr
+++ b/src/tools/clippy/tests/ui/excessive_precision.stderr
@@ -8,8 +8,9 @@ LL |     const BAD32_1: f32 = 0.123_456_789_f32;
    = help: to override `-D warnings` add `#[allow(clippy::excessive_precision)]`
 help: consider changing the type or truncating it to
    |
-LL |     const BAD32_1: f32 = 0.123_456_79_f32;
-   |                          ~~~~~~~~~~~~~~~~
+LL -     const BAD32_1: f32 = 0.123_456_789_f32;
+LL +     const BAD32_1: f32 = 0.123_456_79_f32;
+   |
 
 error: float has excessive precision
   --> tests/ui/excessive_precision.rs:21:26
@@ -19,8 +20,9 @@ LL |     const BAD32_2: f32 = 0.123_456_789;
    |
 help: consider changing the type or truncating it to
    |
-LL |     const BAD32_2: f32 = 0.123_456_79;
-   |                          ~~~~~~~~~~~~
+LL -     const BAD32_2: f32 = 0.123_456_789;
+LL +     const BAD32_2: f32 = 0.123_456_79;
+   |
 
 error: float has excessive precision
   --> tests/ui/excessive_precision.rs:22:26
@@ -30,8 +32,9 @@ LL |     const BAD32_3: f32 = 0.100_000_000_000_1;
    |
 help: consider changing the type or truncating it to
    |
-LL |     const BAD32_3: f32 = 0.1;
-   |                          ~~~
+LL -     const BAD32_3: f32 = 0.100_000_000_000_1;
+LL +     const BAD32_3: f32 = 0.1;
+   |
 
 error: float has excessive precision
   --> tests/ui/excessive_precision.rs:23:29
@@ -41,8 +44,9 @@ LL |     const BAD32_EDGE: f32 = 1.000_000_9;
    |
 help: consider changing the type or truncating it to
    |
-LL |     const BAD32_EDGE: f32 = 1.000_001;
-   |                             ~~~~~~~~~
+LL -     const BAD32_EDGE: f32 = 1.000_000_9;
+LL +     const BAD32_EDGE: f32 = 1.000_001;
+   |
 
 error: float has excessive precision
   --> tests/ui/excessive_precision.rs:27:26
@@ -52,8 +56,9 @@ LL |     const BAD64_3: f64 = 0.100_000_000_000_000_000_1;
    |
 help: consider changing the type or truncating it to
    |
-LL |     const BAD64_3: f64 = 0.1;
-   |                          ~~~
+LL -     const BAD64_3: f64 = 0.100_000_000_000_000_000_1;
+LL +     const BAD64_3: f64 = 0.1;
+   |
 
 error: float has excessive precision
   --> tests/ui/excessive_precision.rs:30:22
@@ -63,8 +68,9 @@ LL |     println!("{:?}", 8.888_888_888_888_888_888_888);
    |
 help: consider changing the type or truncating it to
    |
-LL |     println!("{:?}", 8.888_888_888_888_89);
-   |                      ~~~~~~~~~~~~~~~~~~~~
+LL -     println!("{:?}", 8.888_888_888_888_888_888_888);
+LL +     println!("{:?}", 8.888_888_888_888_89);
+   |
 
 error: float has excessive precision
   --> tests/ui/excessive_precision.rs:41:22
@@ -74,8 +80,9 @@ LL |     let bad32: f32 = 1.123_456_789;
    |
 help: consider changing the type or truncating it to
    |
-LL |     let bad32: f32 = 1.123_456_8;
-   |                      ~~~~~~~~~~~
+LL -     let bad32: f32 = 1.123_456_789;
+LL +     let bad32: f32 = 1.123_456_8;
+   |
 
 error: float has excessive precision
   --> tests/ui/excessive_precision.rs:42:26
@@ -85,8 +92,9 @@ LL |     let bad32_suf: f32 = 1.123_456_789_f32;
    |
 help: consider changing the type or truncating it to
    |
-LL |     let bad32_suf: f32 = 1.123_456_8_f32;
-   |                          ~~~~~~~~~~~~~~~
+LL -     let bad32_suf: f32 = 1.123_456_789_f32;
+LL +     let bad32_suf: f32 = 1.123_456_8_f32;
+   |
 
 error: float has excessive precision
   --> tests/ui/excessive_precision.rs:43:21
@@ -96,8 +104,9 @@ LL |     let bad32_inf = 1.123_456_789_f32;
    |
 help: consider changing the type or truncating it to
    |
-LL |     let bad32_inf = 1.123_456_8_f32;
-   |                     ~~~~~~~~~~~~~~~
+LL -     let bad32_inf = 1.123_456_789_f32;
+LL +     let bad32_inf = 1.123_456_8_f32;
+   |
 
 error: float has excessive precision
   --> tests/ui/excessive_precision.rs:53:36
@@ -107,8 +116,9 @@ LL |     let bad_vec32: Vec = vec![0.123_456_789];
    |
 help: consider changing the type or truncating it to
    |
-LL |     let bad_vec32: Vec = vec![0.123_456_79];
-   |                                    ~~~~~~~~~~~~
+LL -     let bad_vec32: Vec = vec![0.123_456_789];
+LL +     let bad_vec32: Vec = vec![0.123_456_79];
+   |
 
 error: float has excessive precision
   --> tests/ui/excessive_precision.rs:54:36
@@ -118,8 +128,9 @@ LL |     let bad_vec64: Vec = vec![0.123_456_789_123_456_789];
    |
 help: consider changing the type or truncating it to
    |
-LL |     let bad_vec64: Vec = vec![0.123_456_789_123_456_78];
-   |                                    ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let bad_vec64: Vec = vec![0.123_456_789_123_456_789];
+LL +     let bad_vec64: Vec = vec![0.123_456_789_123_456_78];
+   |
 
 error: float has excessive precision
   --> tests/ui/excessive_precision.rs:58:24
@@ -129,8 +140,9 @@ LL |     let bad_e32: f32 = 1.123_456_788_888e-10;
    |
 help: consider changing the type or truncating it to
    |
-LL |     let bad_e32: f32 = 1.123_456_8e-10;
-   |                        ~~~~~~~~~~~~~~~
+LL -     let bad_e32: f32 = 1.123_456_788_888e-10;
+LL +     let bad_e32: f32 = 1.123_456_8e-10;
+   |
 
 error: float has excessive precision
   --> tests/ui/excessive_precision.rs:61:27
@@ -140,8 +152,9 @@ LL |     let bad_bige32: f32 = 1.123_456_788_888E-10;
    |
 help: consider changing the type or truncating it to
    |
-LL |     let bad_bige32: f32 = 1.123_456_8E-10;
-   |                           ~~~~~~~~~~~~~~~
+LL -     let bad_bige32: f32 = 1.123_456_788_888E-10;
+LL +     let bad_bige32: f32 = 1.123_456_8E-10;
+   |
 
 error: float has excessive precision
   --> tests/ui/excessive_precision.rs:70:13
@@ -151,8 +164,9 @@ LL |     let _ = 2.225_073_858_507_201_1e-308_f64;
    |
 help: consider changing the type or truncating it to
    |
-LL |     let _ = 2.225_073_858_507_201e-308_f64;
-   |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = 2.225_073_858_507_201_1e-308_f64;
+LL +     let _ = 2.225_073_858_507_201e-308_f64;
+   |
 
 error: float has excessive precision
   --> tests/ui/excessive_precision.rs:73:13
@@ -162,8 +176,9 @@ LL |     let _ = 1.000_000_000_000_001e-324_f64;
    |
 help: consider changing the type or truncating it to
    |
-LL |     let _ = 0_f64;
-   |             ~~~~~
+LL -     let _ = 1.000_000_000_000_001e-324_f64;
+LL +     let _ = 0_f64;
+   |
 
 error: float has excessive precision
   --> tests/ui/excessive_precision.rs:83:20
@@ -173,8 +188,9 @@ LL |     const _: f64 = 3.0000000000000000e+00;
    |
 help: consider changing the type or truncating it to
    |
-LL |     const _: f64 = 3.0;
-   |                    ~~~
+LL -     const _: f64 = 3.0000000000000000e+00;
+LL +     const _: f64 = 3.0;
+   |
 
 error: aborting due to 16 previous errors
 
diff --git a/src/tools/clippy/tests/ui/fn_to_numeric_cast_any.stderr b/src/tools/clippy/tests/ui/fn_to_numeric_cast_any.stderr
index a05b7138bc99..c069c9d1672d 100644
--- a/src/tools/clippy/tests/ui/fn_to_numeric_cast_any.stderr
+++ b/src/tools/clippy/tests/ui/fn_to_numeric_cast_any.stderr
@@ -8,8 +8,9 @@ LL |     let _ = foo as i8;
    = help: to override `-D warnings` add `#[allow(clippy::fn_to_numeric_cast_any)]`
 help: did you mean to invoke the function?
    |
-LL |     let _ = foo() as i8;
-   |             ~~~~~~~~~~~
+LL -     let _ = foo as i8;
+LL +     let _ = foo() as i8;
+   |
 
 error: casting function pointer `foo` to `i16`
   --> tests/ui/fn_to_numeric_cast_any.rs:26:13
@@ -19,8 +20,9 @@ LL |     let _ = foo as i16;
    |
 help: did you mean to invoke the function?
    |
-LL |     let _ = foo() as i16;
-   |             ~~~~~~~~~~~~
+LL -     let _ = foo as i16;
+LL +     let _ = foo() as i16;
+   |
 
 error: casting function pointer `foo` to `i32`
   --> tests/ui/fn_to_numeric_cast_any.rs:28:13
@@ -30,8 +32,9 @@ LL |     let _ = foo as i32;
    |
 help: did you mean to invoke the function?
    |
-LL |     let _ = foo() as i32;
-   |             ~~~~~~~~~~~~
+LL -     let _ = foo as i32;
+LL +     let _ = foo() as i32;
+   |
 
 error: casting function pointer `foo` to `i64`
   --> tests/ui/fn_to_numeric_cast_any.rs:30:13
@@ -41,8 +44,9 @@ LL |     let _ = foo as i64;
    |
 help: did you mean to invoke the function?
    |
-LL |     let _ = foo() as i64;
-   |             ~~~~~~~~~~~~
+LL -     let _ = foo as i64;
+LL +     let _ = foo() as i64;
+   |
 
 error: casting function pointer `foo` to `i128`
   --> tests/ui/fn_to_numeric_cast_any.rs:32:13
@@ -52,8 +56,9 @@ LL |     let _ = foo as i128;
    |
 help: did you mean to invoke the function?
    |
-LL |     let _ = foo() as i128;
-   |             ~~~~~~~~~~~~~
+LL -     let _ = foo as i128;
+LL +     let _ = foo() as i128;
+   |
 
 error: casting function pointer `foo` to `isize`
   --> tests/ui/fn_to_numeric_cast_any.rs:34:13
@@ -63,8 +68,9 @@ LL |     let _ = foo as isize;
    |
 help: did you mean to invoke the function?
    |
-LL |     let _ = foo() as isize;
-   |             ~~~~~~~~~~~~~~
+LL -     let _ = foo as isize;
+LL +     let _ = foo() as isize;
+   |
 
 error: casting function pointer `foo` to `u8`
   --> tests/ui/fn_to_numeric_cast_any.rs:37:13
@@ -74,8 +80,9 @@ LL |     let _ = foo as u8;
    |
 help: did you mean to invoke the function?
    |
-LL |     let _ = foo() as u8;
-   |             ~~~~~~~~~~~
+LL -     let _ = foo as u8;
+LL +     let _ = foo() as u8;
+   |
 
 error: casting function pointer `foo` to `u16`
   --> tests/ui/fn_to_numeric_cast_any.rs:39:13
@@ -85,8 +92,9 @@ LL |     let _ = foo as u16;
    |
 help: did you mean to invoke the function?
    |
-LL |     let _ = foo() as u16;
-   |             ~~~~~~~~~~~~
+LL -     let _ = foo as u16;
+LL +     let _ = foo() as u16;
+   |
 
 error: casting function pointer `foo` to `u32`
   --> tests/ui/fn_to_numeric_cast_any.rs:41:13
@@ -96,8 +104,9 @@ LL |     let _ = foo as u32;
    |
 help: did you mean to invoke the function?
    |
-LL |     let _ = foo() as u32;
-   |             ~~~~~~~~~~~~
+LL -     let _ = foo as u32;
+LL +     let _ = foo() as u32;
+   |
 
 error: casting function pointer `foo` to `u64`
   --> tests/ui/fn_to_numeric_cast_any.rs:43:13
@@ -107,8 +116,9 @@ LL |     let _ = foo as u64;
    |
 help: did you mean to invoke the function?
    |
-LL |     let _ = foo() as u64;
-   |             ~~~~~~~~~~~~
+LL -     let _ = foo as u64;
+LL +     let _ = foo() as u64;
+   |
 
 error: casting function pointer `foo` to `u128`
   --> tests/ui/fn_to_numeric_cast_any.rs:45:13
@@ -118,8 +128,9 @@ LL |     let _ = foo as u128;
    |
 help: did you mean to invoke the function?
    |
-LL |     let _ = foo() as u128;
-   |             ~~~~~~~~~~~~~
+LL -     let _ = foo as u128;
+LL +     let _ = foo() as u128;
+   |
 
 error: casting function pointer `foo` to `usize`
   --> tests/ui/fn_to_numeric_cast_any.rs:47:13
@@ -129,8 +140,9 @@ LL |     let _ = foo as usize;
    |
 help: did you mean to invoke the function?
    |
-LL |     let _ = foo() as usize;
-   |             ~~~~~~~~~~~~~~
+LL -     let _ = foo as usize;
+LL +     let _ = foo() as usize;
+   |
 
 error: casting function pointer `Struct::static_method` to `usize`
   --> tests/ui/fn_to_numeric_cast_any.rs:52:13
@@ -140,8 +152,9 @@ LL |     let _ = Struct::static_method as usize;
    |
 help: did you mean to invoke the function?
    |
-LL |     let _ = Struct::static_method() as usize;
-   |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = Struct::static_method as usize;
+LL +     let _ = Struct::static_method() as usize;
+   |
 
 error: casting function pointer `f` to `usize`
   --> tests/ui/fn_to_numeric_cast_any.rs:57:5
@@ -151,7 +164,8 @@ LL |     f as usize
    |
 help: did you mean to invoke the function?
    |
-LL |     f() as usize
+LL -     f as usize
+LL +     f() as usize
    |
 
 error: casting function pointer `T::static_method` to `usize`
@@ -162,7 +176,8 @@ LL |     T::static_method as usize
    |
 help: did you mean to invoke the function?
    |
-LL |     T::static_method() as usize
+LL -     T::static_method as usize
+LL +     T::static_method() as usize
    |
 
 error: casting function pointer `(clos as fn(u32) -> u32)` to `usize`
@@ -173,8 +188,9 @@ LL |     let _ = (clos as fn(u32) -> u32) as usize;
    |
 help: did you mean to invoke the function?
    |
-LL |     let _ = (clos as fn(u32) -> u32)() as usize;
-   |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = (clos as fn(u32) -> u32) as usize;
+LL +     let _ = (clos as fn(u32) -> u32)() as usize;
+   |
 
 error: casting function pointer `foo` to `*const ()`
   --> tests/ui/fn_to_numeric_cast_any.rs:74:13
@@ -184,8 +200,9 @@ LL |     let _ = foo as *const ();
    |
 help: did you mean to invoke the function?
    |
-LL |     let _ = foo() as *const ();
-   |             ~~~~~~~~~~~~~~~~~~
+LL -     let _ = foo as *const ();
+LL +     let _ = foo() as *const ();
+   |
 
 error: aborting due to 17 previous errors
 
diff --git a/src/tools/clippy/tests/ui/for_kv_map.stderr b/src/tools/clippy/tests/ui/for_kv_map.stderr
index adcc3ab8fdb9..11b61c8cbc64 100644
--- a/src/tools/clippy/tests/ui/for_kv_map.stderr
+++ b/src/tools/clippy/tests/ui/for_kv_map.stderr
@@ -8,8 +8,9 @@ LL |     for (_, v) in &m {
    = help: to override `-D warnings` add `#[allow(clippy::for_kv_map)]`
 help: use the corresponding method
    |
-LL |     for v in m.values() {
-   |         ~    ~~~~~~~~~~
+LL -     for (_, v) in &m {
+LL +     for v in m.values() {
+   |
 
 error: you seem to want to iterate on a map's values
   --> tests/ui/for_kv_map.rs:16:19
@@ -19,8 +20,9 @@ LL |     for (_, v) in &*m {
    |
 help: use the corresponding method
    |
-LL |     for v in (*m).values() {
-   |         ~    ~~~~~~~~~~~~~
+LL -     for (_, v) in &*m {
+LL +     for v in (*m).values() {
+   |
 
 error: you seem to want to iterate on a map's values
   --> tests/ui/for_kv_map.rs:25:19
@@ -30,8 +32,9 @@ LL |     for (_, v) in &mut m {
    |
 help: use the corresponding method
    |
-LL |     for v in m.values_mut() {
-   |         ~    ~~~~~~~~~~~~~~
+LL -     for (_, v) in &mut m {
+LL +     for v in m.values_mut() {
+   |
 
 error: you seem to want to iterate on a map's values
   --> tests/ui/for_kv_map.rs:31:19
@@ -41,8 +44,9 @@ LL |     for (_, v) in &mut *m {
    |
 help: use the corresponding method
    |
-LL |     for v in (*m).values_mut() {
-   |         ~    ~~~~~~~~~~~~~~~~~
+LL -     for (_, v) in &mut *m {
+LL +     for v in (*m).values_mut() {
+   |
 
 error: you seem to want to iterate on a map's keys
   --> tests/ui/for_kv_map.rs:38:24
@@ -52,8 +56,9 @@ LL |     for (k, _value) in rm {
    |
 help: use the corresponding method
    |
-LL |     for k in rm.keys() {
-   |         ~    ~~~~~~~~~
+LL -     for (k, _value) in rm {
+LL +     for k in rm.keys() {
+   |
 
 error: you seem to want to iterate on a map's keys
   --> tests/ui/for_kv_map.rs:45:32
@@ -63,8 +68,9 @@ LL |     'label: for (k, _value) in rm {
    |
 help: use the corresponding method
    |
-LL |     'label: for k in rm.keys() {
-   |                 ~    ~~~~~~~~~
+LL -     'label: for (k, _value) in rm {
+LL +     'label: for k in rm.keys() {
+   |
 
 error: aborting due to 6 previous errors
 
diff --git a/src/tools/clippy/tests/ui/four_forward_slashes.stderr b/src/tools/clippy/tests/ui/four_forward_slashes.stderr
index 3606a2227a00..d5bf71fadc7d 100644
--- a/src/tools/clippy/tests/ui/four_forward_slashes.stderr
+++ b/src/tools/clippy/tests/ui/four_forward_slashes.stderr
@@ -9,6 +9,8 @@ LL | | fn a() {}
    = help: to override `-D warnings` add `#[allow(clippy::four_forward_slashes)]`
 help: make this a doc comment by removing one `/`
    |
+LL - //// whoops
+LL - fn a() {}
 LL + /// whoops
    |
 
@@ -22,6 +24,8 @@ LL | | fn b() {}
    |
 help: make this a doc comment by removing one `/`
    |
+LL - //// whoops
+LL - #[allow(dead_code)]
 LL + /// whoops
    |
 
@@ -50,6 +54,8 @@ LL | | fn g() {}
    |
 help: make this a doc comment by removing one `/`
    |
+LL - //// between attributes
+LL - #[allow(dead_code)]
 LL + /// between attributes
    |
 
@@ -62,6 +68,8 @@ LL | | fn h() {}
    |
 help: make this a doc comment by removing one `/`
    |
+LL -     //// not very start of contents
+LL - fn h() {}
 LL + /// not very start of contents
    |
 
diff --git a/src/tools/clippy/tests/ui/four_forward_slashes_first_line.stderr b/src/tools/clippy/tests/ui/four_forward_slashes_first_line.stderr
index 81732346412a..83bfb60eb16f 100644
--- a/src/tools/clippy/tests/ui/four_forward_slashes_first_line.stderr
+++ b/src/tools/clippy/tests/ui/four_forward_slashes_first_line.stderr
@@ -9,6 +9,8 @@ LL | | fn a() {}
    = help: to override `-D warnings` add `#[allow(clippy::four_forward_slashes)]`
 help: make this a doc comment by removing one `/`
    |
+LL - //// borked doc comment on the first line. doesn't combust!
+LL - fn a() {}
 LL + /// borked doc comment on the first line. doesn't combust!
    |
 
diff --git a/src/tools/clippy/tests/ui/get_unwrap.stderr b/src/tools/clippy/tests/ui/get_unwrap.stderr
index 8eacb249c60c..fc6c0b9299c4 100644
--- a/src/tools/clippy/tests/ui/get_unwrap.stderr
+++ b/src/tools/clippy/tests/ui/get_unwrap.stderr
@@ -11,8 +11,9 @@ LL | #![deny(clippy::get_unwrap)]
    |         ^^^^^^^^^^^^^^^^^^
 help: using `[]` is clearer and more concise
    |
-LL |         let _ = &boxed_slice[1];
-   |                 ~~~~~~~~~~~~~~~
+LL -         let _ = boxed_slice.get(1).unwrap();
+LL +         let _ = &boxed_slice[1];
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui/get_unwrap.rs:37:17
@@ -33,8 +34,9 @@ LL |         let _ = some_slice.get(0).unwrap();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _ = &some_slice[0];
-   |                 ~~~~~~~~~~~~~~
+LL -         let _ = some_slice.get(0).unwrap();
+LL +         let _ = &some_slice[0];
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui/get_unwrap.rs:38:17
@@ -53,8 +55,9 @@ LL |         let _ = some_vec.get(0).unwrap();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _ = &some_vec[0];
-   |                 ~~~~~~~~~~~~
+LL -         let _ = some_vec.get(0).unwrap();
+LL +         let _ = &some_vec[0];
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui/get_unwrap.rs:39:17
@@ -73,8 +76,9 @@ LL |         let _ = some_vecdeque.get(0).unwrap();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _ = &some_vecdeque[0];
-   |                 ~~~~~~~~~~~~~~~~~
+LL -         let _ = some_vecdeque.get(0).unwrap();
+LL +         let _ = &some_vecdeque[0];
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui/get_unwrap.rs:40:17
@@ -93,8 +97,9 @@ LL |         let _ = some_hashmap.get(&1).unwrap();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _ = &some_hashmap[&1];
-   |                 ~~~~~~~~~~~~~~~~~
+LL -         let _ = some_hashmap.get(&1).unwrap();
+LL +         let _ = &some_hashmap[&1];
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui/get_unwrap.rs:41:17
@@ -113,8 +118,9 @@ LL |         let _ = some_btreemap.get(&1).unwrap();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _ = &some_btreemap[&1];
-   |                 ~~~~~~~~~~~~~~~~~~
+LL -         let _ = some_btreemap.get(&1).unwrap();
+LL +         let _ = &some_btreemap[&1];
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui/get_unwrap.rs:42:17
@@ -133,8 +139,9 @@ LL |         let _: u8 = *boxed_slice.get(1).unwrap();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _: u8 = boxed_slice[1];
-   |                     ~~~~~~~~~~~~~~
+LL -         let _: u8 = *boxed_slice.get(1).unwrap();
+LL +         let _: u8 = boxed_slice[1];
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui/get_unwrap.rs:46:22
@@ -153,8 +160,9 @@ LL |         *boxed_slice.get_mut(0).unwrap() = 1;
    |
 help: using `[]` is clearer and more concise
    |
-LL |         boxed_slice[0] = 1;
-   |         ~~~~~~~~~~~~~~
+LL -         *boxed_slice.get_mut(0).unwrap() = 1;
+LL +         boxed_slice[0] = 1;
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui/get_unwrap.rs:51:10
@@ -173,8 +181,9 @@ LL |         *some_slice.get_mut(0).unwrap() = 1;
    |
 help: using `[]` is clearer and more concise
    |
-LL |         some_slice[0] = 1;
-   |         ~~~~~~~~~~~~~
+LL -         *some_slice.get_mut(0).unwrap() = 1;
+LL +         some_slice[0] = 1;
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui/get_unwrap.rs:52:10
@@ -193,8 +202,9 @@ LL |         *some_vec.get_mut(0).unwrap() = 1;
    |
 help: using `[]` is clearer and more concise
    |
-LL |         some_vec[0] = 1;
-   |         ~~~~~~~~~~~
+LL -         *some_vec.get_mut(0).unwrap() = 1;
+LL +         some_vec[0] = 1;
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui/get_unwrap.rs:53:10
@@ -213,8 +223,9 @@ LL |         *some_vecdeque.get_mut(0).unwrap() = 1;
    |
 help: using `[]` is clearer and more concise
    |
-LL |         some_vecdeque[0] = 1;
-   |         ~~~~~~~~~~~~~~~~
+LL -         *some_vecdeque.get_mut(0).unwrap() = 1;
+LL +         some_vecdeque[0] = 1;
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui/get_unwrap.rs:54:10
@@ -233,8 +244,9 @@ LL |         let _ = some_vec.get(0..1).unwrap().to_vec();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _ = some_vec[0..1].to_vec();
-   |                 ~~~~~~~~~~~~~~
+LL -         let _ = some_vec.get(0..1).unwrap().to_vec();
+LL +         let _ = some_vec[0..1].to_vec();
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui/get_unwrap.rs:66:17
@@ -253,8 +265,9 @@ LL |         let _ = some_vec.get_mut(0..1).unwrap().to_vec();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _ = some_vec[0..1].to_vec();
-   |                 ~~~~~~~~~~~~~~
+LL -         let _ = some_vec.get_mut(0..1).unwrap().to_vec();
+LL +         let _ = some_vec[0..1].to_vec();
+   |
 
 error: used `unwrap()` on an `Option` value
   --> tests/ui/get_unwrap.rs:67:17
@@ -273,8 +286,9 @@ LL |         let _x: &i32 = f.get(1 + 2).unwrap();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _x: &i32 = &f[1 + 2];
-   |                        ~~~~~~~~~
+LL -         let _x: &i32 = f.get(1 + 2).unwrap();
+LL +         let _x: &i32 = &f[1 + 2];
+   |
 
 error: called `.get().unwrap()` on a slice
   --> tests/ui/get_unwrap.rs:81:18
@@ -284,8 +298,9 @@ LL |         let _x = f.get(1 + 2).unwrap().to_string();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _x = f[1 + 2].to_string();
-   |                  ~~~~~~~~
+LL -         let _x = f.get(1 + 2).unwrap().to_string();
+LL +         let _x = f[1 + 2].to_string();
+   |
 
 error: called `.get().unwrap()` on a slice
   --> tests/ui/get_unwrap.rs:84:18
@@ -295,8 +310,9 @@ LL |         let _x = f.get(1 + 2).unwrap().abs();
    |
 help: using `[]` is clearer and more concise
    |
-LL |         let _x = f[1 + 2].abs();
-   |                  ~~~~~~~~
+LL -         let _x = f.get(1 + 2).unwrap().abs();
+LL +         let _x = f[1 + 2].abs();
+   |
 
 error: called `.get_mut().unwrap()` on a slice
   --> tests/ui/get_unwrap.rs:101:33
@@ -306,8 +322,9 @@ LL |                         let b = rest.get_mut(linidx(j, k) - linidx(i, k) -
    |
 help: using `[]` is clearer and more concise
    |
-LL |                         let b = &mut rest[linidx(j, k) - linidx(i, k) - 1];
-   |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -                         let b = rest.get_mut(linidx(j, k) - linidx(i, k) - 1).unwrap();
+LL +                         let b = &mut rest[linidx(j, k) - linidx(i, k) - 1];
+   |
 
 error: aborting due to 30 previous errors
 
diff --git a/src/tools/clippy/tests/ui/implicit_hasher.stderr b/src/tools/clippy/tests/ui/implicit_hasher.stderr
index 442f4789aacf..6e964c65a2e4 100644
--- a/src/tools/clippy/tests/ui/implicit_hasher.stderr
+++ b/src/tools/clippy/tests/ui/implicit_hasher.stderr
@@ -78,8 +78,9 @@ LL | pub fn map(map: &mut HashMap) {}
    |
 help: add a type parameter for `BuildHasher`
    |
-LL | pub fn map(map: &mut HashMap) {}
-   |           +++++++++++++++++++++++++++++           ~~~~~~~~~~~~~~~~~~~~
+LL - pub fn map(map: &mut HashMap) {}
+LL + pub fn map(map: &mut HashMap) {}
+   |
 
 error: parameter of type `HashSet` should be generalized over different hashers
   --> tests/ui/implicit_hasher.rs:70:22
@@ -89,8 +90,9 @@ LL | pub fn set(set: &mut HashSet) {}
    |
 help: add a type parameter for `BuildHasher`
    |
-LL | pub fn set(set: &mut HashSet) {}
-   |           +++++++++++++++++++++++++++++           ~~~~~~~~~~~~~~~
+LL - pub fn set(set: &mut HashSet) {}
+LL + pub fn set(set: &mut HashSet) {}
+   |
 
 error: impl for `HashMap` should be generalized over different hashers
   --> tests/ui/implicit_hasher.rs:76:43
@@ -114,8 +116,9 @@ LL | pub async fn election_vote(_data: HashMap) {}
    |
 help: add a type parameter for `BuildHasher`
    |
-LL | pub async fn election_vote(_data: HashMap) {}
-   |                           +++++++++++++++++++++++++++++        ~~~~~~~~~~~~~~~~~~~~
+LL - pub async fn election_vote(_data: HashMap) {}
+LL + pub async fn election_vote(_data: HashMap) {}
+   |
 
 error: aborting due to 9 previous errors
 
diff --git a/src/tools/clippy/tests/ui/implicit_return.stderr b/src/tools/clippy/tests/ui/implicit_return.stderr
index 3b06f26f5a05..0d2faa5e067b 100644
--- a/src/tools/clippy/tests/ui/implicit_return.stderr
+++ b/src/tools/clippy/tests/ui/implicit_return.stderr
@@ -8,7 +8,8 @@ LL |     true
    = help: to override `-D warnings` add `#[allow(clippy::implicit_return)]`
 help: add `return` as shown
    |
-LL |     return true
+LL -     true
+LL +     return true
    |
 
 error: missing `return` statement
@@ -19,8 +20,9 @@ LL |     if true { true } else { false }
    |
 help: add `return` as shown
    |
-LL |     if true { return true } else { false }
-   |               ~~~~~~~~~~~
+LL -     if true { true } else { false }
+LL +     if true { return true } else { false }
+   |
 
 error: missing `return` statement
   --> tests/ui/implicit_return.rs:19:29
@@ -30,8 +32,9 @@ LL |     if true { true } else { false }
    |
 help: add `return` as shown
    |
-LL |     if true { true } else { return false }
-   |                             ~~~~~~~~~~~~
+LL -     if true { true } else { false }
+LL +     if true { true } else { return false }
+   |
 
 error: missing `return` statement
   --> tests/ui/implicit_return.rs:25:17
@@ -41,8 +44,9 @@ LL |         true => false,
    |
 help: add `return` as shown
    |
-LL |         true => return false,
-   |                 ~~~~~~~~~~~~
+LL -         true => false,
+LL +         true => return false,
+   |
 
 error: missing `return` statement
   --> tests/ui/implicit_return.rs:26:20
@@ -52,8 +56,9 @@ LL |         false => { true },
    |
 help: add `return` as shown
    |
-LL |         false => { return true },
-   |                    ~~~~~~~~~~~
+LL -         false => { true },
+LL +         false => { return true },
+   |
 
 error: missing `return` statement
   --> tests/ui/implicit_return.rs:39:9
@@ -63,8 +68,9 @@ LL |         break true;
    |
 help: change `break` to `return` as shown
    |
-LL |         return true;
-   |         ~~~~~~~~~~~
+LL -         break true;
+LL +         return true;
+   |
 
 error: missing `return` statement
   --> tests/ui/implicit_return.rs:46:13
@@ -74,8 +80,9 @@ LL |             break true;
    |
 help: change `break` to `return` as shown
    |
-LL |             return true;
-   |             ~~~~~~~~~~~
+LL -             break true;
+LL +             return true;
+   |
 
 error: missing `return` statement
   --> tests/ui/implicit_return.rs:54:13
@@ -85,8 +92,9 @@ LL |             break true;
    |
 help: change `break` to `return` as shown
    |
-LL |             return true;
-   |             ~~~~~~~~~~~
+LL -             break true;
+LL +             return true;
+   |
 
 error: missing `return` statement
   --> tests/ui/implicit_return.rs:72:18
@@ -96,8 +104,9 @@ LL |     let _ = || { true };
    |
 help: add `return` as shown
    |
-LL |     let _ = || { return true };
-   |                  ~~~~~~~~~~~
+LL -     let _ = || { true };
+LL +     let _ = || { return true };
+   |
 
 error: missing `return` statement
   --> tests/ui/implicit_return.rs:73:16
@@ -107,8 +116,9 @@ LL |     let _ = || true;
    |
 help: add `return` as shown
    |
-LL |     let _ = || return true;
-   |                ~~~~~~~~~~~
+LL -     let _ = || true;
+LL +     let _ = || return true;
+   |
 
 error: missing `return` statement
   --> tests/ui/implicit_return.rs:81:5
@@ -118,7 +128,8 @@ LL |     format!("test {}", "test")
    |
 help: add `return` as shown
    |
-LL |     return format!("test {}", "test")
+LL -     format!("test {}", "test")
+LL +     return format!("test {}", "test")
    |
 
 error: missing `return` statement
@@ -129,7 +140,8 @@ LL |     m!(true, false)
    |
 help: add `return` as shown
    |
-LL |     return m!(true, false)
+LL -     m!(true, false)
+LL +     return m!(true, false)
    |
 
 error: missing `return` statement
@@ -140,8 +152,9 @@ LL |             break true;
    |
 help: change `break` to `return` as shown
    |
-LL |             return true;
-   |             ~~~~~~~~~~~
+LL -             break true;
+LL +             return true;
+   |
 
 error: missing `return` statement
   --> tests/ui/implicit_return.rs:101:17
@@ -151,8 +164,9 @@ LL |                 break 'outer false;
    |
 help: change `break` to `return` as shown
    |
-LL |                 return false;
-   |                 ~~~~~~~~~~~~
+LL -                 break 'outer false;
+LL +                 return false;
+   |
 
 error: missing `return` statement
   --> tests/ui/implicit_return.rs:116:5
@@ -177,7 +191,8 @@ LL |     true
    |
 help: add `return` as shown
    |
-LL |     return true
+LL -     true
+LL +     return true
    |
 
 error: aborting due to 16 previous errors
diff --git a/src/tools/clippy/tests/ui/iter_nth.stderr b/src/tools/clippy/tests/ui/iter_nth.stderr
index 178463f53475..1167a604ecdc 100644
--- a/src/tools/clippy/tests/ui/iter_nth.stderr
+++ b/src/tools/clippy/tests/ui/iter_nth.stderr
@@ -8,8 +8,9 @@ LL |         let bad_vec = some_vec.iter().nth(3);
    = help: to override `-D warnings` add `#[allow(clippy::iter_nth)]`
 help: `get` is equivalent but more concise
    |
-LL |         let bad_vec = some_vec.get(3);
-   |                                ~~~
+LL -         let bad_vec = some_vec.iter().nth(3);
+LL +         let bad_vec = some_vec.get(3);
+   |
 
 error: called `.iter().nth()` on a slice
   --> tests/ui/iter_nth.rs:35:26
@@ -19,8 +20,9 @@ LL |         let bad_slice = &some_vec[..].iter().nth(3);
    |
 help: `get` is equivalent but more concise
    |
-LL |         let bad_slice = &some_vec[..].get(3);
-   |                                       ~~~
+LL -         let bad_slice = &some_vec[..].iter().nth(3);
+LL +         let bad_slice = &some_vec[..].get(3);
+   |
 
 error: called `.iter().nth()` on a slice
   --> tests/ui/iter_nth.rs:36:31
@@ -30,8 +32,9 @@ LL |         let bad_boxed_slice = boxed_slice.iter().nth(3);
    |
 help: `get` is equivalent but more concise
    |
-LL |         let bad_boxed_slice = boxed_slice.get(3);
-   |                                           ~~~
+LL -         let bad_boxed_slice = boxed_slice.iter().nth(3);
+LL +         let bad_boxed_slice = boxed_slice.get(3);
+   |
 
 error: called `.iter().nth()` on a `VecDeque`
   --> tests/ui/iter_nth.rs:37:29
@@ -41,8 +44,9 @@ LL |         let bad_vec_deque = some_vec_deque.iter().nth(3);
    |
 help: `get` is equivalent but more concise
    |
-LL |         let bad_vec_deque = some_vec_deque.get(3);
-   |                                            ~~~
+LL -         let bad_vec_deque = some_vec_deque.iter().nth(3);
+LL +         let bad_vec_deque = some_vec_deque.get(3);
+   |
 
 error: called `.iter_mut().nth()` on a `Vec`
   --> tests/ui/iter_nth.rs:42:23
@@ -52,8 +56,9 @@ LL |         let bad_vec = some_vec.iter_mut().nth(3);
    |
 help: `get_mut` is equivalent but more concise
    |
-LL |         let bad_vec = some_vec.get_mut(3);
-   |                                ~~~~~~~
+LL -         let bad_vec = some_vec.iter_mut().nth(3);
+LL +         let bad_vec = some_vec.get_mut(3);
+   |
 
 error: called `.iter_mut().nth()` on a slice
   --> tests/ui/iter_nth.rs:45:26
@@ -63,8 +68,9 @@ LL |         let bad_slice = &some_vec[..].iter_mut().nth(3);
    |
 help: `get_mut` is equivalent but more concise
    |
-LL |         let bad_slice = &some_vec[..].get_mut(3);
-   |                                       ~~~~~~~
+LL -         let bad_slice = &some_vec[..].iter_mut().nth(3);
+LL +         let bad_slice = &some_vec[..].get_mut(3);
+   |
 
 error: called `.iter_mut().nth()` on a `VecDeque`
   --> tests/ui/iter_nth.rs:48:29
@@ -74,8 +80,9 @@ LL |         let bad_vec_deque = some_vec_deque.iter_mut().nth(3);
    |
 help: `get_mut` is equivalent but more concise
    |
-LL |         let bad_vec_deque = some_vec_deque.get_mut(3);
-   |                                            ~~~~~~~
+LL -         let bad_vec_deque = some_vec_deque.iter_mut().nth(3);
+LL +         let bad_vec_deque = some_vec_deque.get_mut(3);
+   |
 
 error: called `.iter().nth()` on a `Vec`
   --> tests/ui/iter_nth.rs:52:5
@@ -85,8 +92,9 @@ LL |     vec_ref.iter().nth(3);
    |
 help: `get` is equivalent but more concise
    |
-LL |     vec_ref.get(3);
-   |             ~~~
+LL -     vec_ref.iter().nth(3);
+LL +     vec_ref.get(3);
+   |
 
 error: aborting due to 8 previous errors
 
diff --git a/src/tools/clippy/tests/ui/join_absolute_paths.stderr b/src/tools/clippy/tests/ui/join_absolute_paths.stderr
index e7fd5508823a..300946bf3b5f 100644
--- a/src/tools/clippy/tests/ui/join_absolute_paths.stderr
+++ b/src/tools/clippy/tests/ui/join_absolute_paths.stderr
@@ -9,12 +9,14 @@ LL |     path.join("/sh");
    = help: to override `-D warnings` add `#[allow(clippy::join_absolute_paths)]`
 help: if this is unintentional, try removing the starting separator
    |
-LL |     path.join("sh");
-   |               ~~~~
+LL -     path.join("/sh");
+LL +     path.join("sh");
+   |
 help: if this is intentional, consider using `Path::new`
    |
-LL |     PathBuf::from("/sh");
-   |     ~~~~~~~~~~~~~~~~~~~~
+LL -     path.join("/sh");
+LL +     PathBuf::from("/sh");
+   |
 
 error: argument to `Path::join` starts with a path separator
   --> tests/ui/join_absolute_paths.rs:14:15
@@ -25,12 +27,14 @@ LL |     path.join("\\user");
    = note: joining a path starting with separator will replace the path instead
 help: if this is unintentional, try removing the starting separator
    |
-LL |     path.join("\user");
-   |               ~~~~~~~
+LL -     path.join("\\user");
+LL +     path.join("\user");
+   |
 help: if this is intentional, consider using `Path::new`
    |
-LL |     PathBuf::from("\\user");
-   |     ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     path.join("\\user");
+LL +     PathBuf::from("\\user");
+   |
 
 error: argument to `Path::join` starts with a path separator
   --> tests/ui/join_absolute_paths.rs:18:15
@@ -41,12 +45,14 @@ LL |     path.join("/sh");
    = note: joining a path starting with separator will replace the path instead
 help: if this is unintentional, try removing the starting separator
    |
-LL |     path.join("sh");
-   |               ~~~~
+LL -     path.join("/sh");
+LL +     path.join("sh");
+   |
 help: if this is intentional, consider using `Path::new`
    |
-LL |     PathBuf::from("/sh");
-   |     ~~~~~~~~~~~~~~~~~~~~
+LL -     path.join("/sh");
+LL +     PathBuf::from("/sh");
+   |
 
 error: argument to `Path::join` starts with a path separator
   --> tests/ui/join_absolute_paths.rs:22:15
@@ -57,12 +63,14 @@ LL |     path.join(r#"/sh"#);
    = note: joining a path starting with separator will replace the path instead
 help: if this is unintentional, try removing the starting separator
    |
-LL |     path.join(r#"sh"#);
-   |               ~~~~~~~
+LL -     path.join(r#"/sh"#);
+LL +     path.join(r#"sh"#);
+   |
 help: if this is intentional, consider using `Path::new`
    |
-LL |     PathBuf::from(r#"/sh"#);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     path.join(r#"/sh"#);
+LL +     PathBuf::from(r#"/sh"#);
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/src/tools/clippy/tests/ui/large_enum_variant.64bit.stderr b/src/tools/clippy/tests/ui/large_enum_variant.64bit.stderr
index 805cb406f834..60653b4abfb5 100644
--- a/src/tools/clippy/tests/ui/large_enum_variant.64bit.stderr
+++ b/src/tools/clippy/tests/ui/large_enum_variant.64bit.stderr
@@ -13,8 +13,9 @@ LL | | }
    = help: to override `-D warnings` add `#[allow(clippy::large_enum_variant)]`
 help: consider boxing the large fields to reduce the total size of the enum
    |
-LL |     B(Box<[i32; 8000]>),
-   |       ~~~~~~~~~~~~~~~~
+LL -     B([i32; 8000]),
+LL +     B(Box<[i32; 8000]>),
+   |
 
 error: large size difference between variants
   --> tests/ui/large_enum_variant.rs:35:1
@@ -29,8 +30,9 @@ LL | | }
    |
 help: consider boxing the large fields to reduce the total size of the enum
    |
-LL |     ContainingLargeEnum(Box),
-   |                         ~~~~~~~~~~~~~~
+LL -     ContainingLargeEnum(LargeEnum),
+LL +     ContainingLargeEnum(Box),
+   |
 
 error: large size difference between variants
   --> tests/ui/large_enum_variant.rs:40:1
@@ -46,8 +48,9 @@ LL | | }
    |
 help: consider boxing the large fields to reduce the total size of the enum
    |
-LL |     ContainingMoreThanOneField(i32, Box<[i32; 8000]>, Box<[i32; 9500]>),
-   |                                     ~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~
+LL -     ContainingMoreThanOneField(i32, [i32; 8000], [i32; 9500]),
+LL +     ContainingMoreThanOneField(i32, Box<[i32; 8000]>, Box<[i32; 9500]>),
+   |
 
 error: large size difference between variants
   --> tests/ui/large_enum_variant.rs:46:1
@@ -62,8 +65,9 @@ LL | | }
    |
 help: consider boxing the large fields to reduce the total size of the enum
    |
-LL |     StructLikeLarge { x: Box<[i32; 8000]>, y: i32 },
-   |                          ~~~~~~~~~~~~~~~~
+LL -     StructLikeLarge { x: [i32; 8000], y: i32 },
+LL +     StructLikeLarge { x: Box<[i32; 8000]>, y: i32 },
+   |
 
 error: large size difference between variants
   --> tests/ui/large_enum_variant.rs:51:1
@@ -78,8 +82,9 @@ LL | | }
    |
 help: consider boxing the large fields to reduce the total size of the enum
    |
-LL |     StructLikeLarge2 { x: Box<[i32; 8000]> },
-   |                           ~~~~~~~~~~~~~~~~
+LL -     StructLikeLarge2 { x: [i32; 8000] },
+LL +     StructLikeLarge2 { x: Box<[i32; 8000]> },
+   |
 
 error: large size difference between variants
   --> tests/ui/large_enum_variant.rs:67:1
@@ -95,8 +100,9 @@ LL | | }
    |
 help: consider boxing the large fields to reduce the total size of the enum
    |
-LL |     B(Box<[u8; 1255]>),
-   |       ~~~~~~~~~~~~~~~
+LL -     B([u8; 1255]),
+LL +     B(Box<[u8; 1255]>),
+   |
 
 error: large size difference between variants
   --> tests/ui/large_enum_variant.rs:73:1
@@ -111,8 +117,9 @@ LL | | }
    |
 help: consider boxing the large fields to reduce the total size of the enum
    |
-LL |     ContainingMoreThanOneField(Box<[i32; 8000]>, [i32; 2], Box<[i32; 9500]>, [i32; 30]),
-   |                                ~~~~~~~~~~~~~~~~            ~~~~~~~~~~~~~~~~
+LL -     ContainingMoreThanOneField([i32; 8000], [i32; 2], [i32; 9500], [i32; 30]),
+LL +     ContainingMoreThanOneField(Box<[i32; 8000]>, [i32; 2], Box<[i32; 9500]>, [i32; 30]),
+   |
 
 error: large size difference between variants
   --> tests/ui/large_enum_variant.rs:78:1
@@ -127,8 +134,9 @@ LL | | }
    |
 help: consider boxing the large fields to reduce the total size of the enum
    |
-LL |     B(Box),
-   |       ~~~~~~~~~~~~
+LL -     B(Struct2),
+LL +     B(Box),
+   |
 
 error: large size difference between variants
   --> tests/ui/large_enum_variant.rs:83:1
@@ -143,8 +151,9 @@ LL | | }
    |
 help: consider boxing the large fields to reduce the total size of the enum
    |
-LL |     B(Box),
-   |       ~~~~~~~~~~~~
+LL -     B(Struct2),
+LL +     B(Box),
+   |
 
 error: large size difference between variants
   --> tests/ui/large_enum_variant.rs:88:1
@@ -159,8 +168,9 @@ LL | | }
    |
 help: consider boxing the large fields to reduce the total size of the enum
    |
-LL |     B(Box),
-   |       ~~~~~~~~~~~~
+LL -     B(Struct2),
+LL +     B(Box),
+   |
 
 error: large size difference between variants
   --> tests/ui/large_enum_variant.rs:103:1
@@ -241,8 +251,9 @@ LL | | }
    |
 help: consider boxing the large fields to reduce the total size of the enum
    |
-LL |     Large(Box<(T, [u8; 512])>),
-   |           ~~~~~~~~~~~~~~~~~~~
+LL -     Large((T, [u8; 512])),
+LL +     Large(Box<(T, [u8; 512])>),
+   |
 
 error: large size difference between variants
   --> tests/ui/large_enum_variant.rs:143:1
@@ -257,8 +268,9 @@ LL | | }
    |
 help: consider boxing the large fields to reduce the total size of the enum
    |
-LL |     Large(Box<[Foo; 64]>),
-   |           ~~~~~~~~~~~~~~~~~~~
+LL -     Large([Foo; 64]),
+LL +     Large(Box<[Foo; 64]>),
+   |
 
 error: large size difference between variants
   --> tests/ui/large_enum_variant.rs:153:1
@@ -273,8 +285,9 @@ LL | | }
    |
 help: consider boxing the large fields to reduce the total size of the enum
    |
-LL |     Error(Box>),
-   |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     Error(PossiblyLargeEnumWithConst<256>),
+LL +     Error(Box>),
+   |
 
 error: aborting due to 16 previous errors
 
diff --git a/src/tools/clippy/tests/ui/legacy_numeric_constants.stderr b/src/tools/clippy/tests/ui/legacy_numeric_constants.stderr
index 267b9ac8e4d1..74fe09e0f5c6 100644
--- a/src/tools/clippy/tests/ui/legacy_numeric_constants.stderr
+++ b/src/tools/clippy/tests/ui/legacy_numeric_constants.stderr
@@ -8,8 +8,9 @@ LL |     std::f32::EPSILON;
    = help: to override `-D warnings` add `#[allow(clippy::legacy_numeric_constants)]`
 help: use the associated constant instead
    |
-LL |     f32::EPSILON;
-   |     ~~~~~~~~~~~~
+LL -     std::f32::EPSILON;
+LL +     f32::EPSILON;
+   |
 
 error: usage of a legacy numeric constant
   --> tests/ui/legacy_numeric_constants.rs:34:5
@@ -19,8 +20,9 @@ LL |     std::u8::MIN;
    |
 help: use the associated constant instead
    |
-LL |     u8::MIN;
-   |     ~~~~~~~
+LL -     std::u8::MIN;
+LL +     u8::MIN;
+   |
 
 error: usage of a legacy numeric constant
   --> tests/ui/legacy_numeric_constants.rs:37:5
@@ -30,8 +32,9 @@ LL |     std::usize::MIN;
    |
 help: use the associated constant instead
    |
-LL |     usize::MIN;
-   |     ~~~~~~~~~~
+LL -     std::usize::MIN;
+LL +     usize::MIN;
+   |
 
 error: usage of a legacy numeric constant
   --> tests/ui/legacy_numeric_constants.rs:40:5
@@ -41,8 +44,9 @@ LL |     std::u32::MAX;
    |
 help: use the associated constant instead
    |
-LL |     u32::MAX;
-   |     ~~~~~~~~
+LL -     std::u32::MAX;
+LL +     u32::MAX;
+   |
 
 error: usage of a legacy numeric constant
   --> tests/ui/legacy_numeric_constants.rs:43:5
@@ -52,8 +56,9 @@ LL |     core::u32::MAX;
    |
 help: use the associated constant instead
    |
-LL |     u32::MAX;
-   |     ~~~~~~~~
+LL -     core::u32::MAX;
+LL +     u32::MAX;
+   |
 
 error: usage of a legacy numeric constant
   --> tests/ui/legacy_numeric_constants.rs:46:5
@@ -63,8 +68,9 @@ LL |     MAX;
    |
 help: use the associated constant instead
    |
-LL |     u32::MAX;
-   |     ~~~~~~~~
+LL -     MAX;
+LL +     u32::MAX;
+   |
 
 error: usage of a legacy numeric method
   --> tests/ui/legacy_numeric_constants.rs:49:10
@@ -74,8 +80,9 @@ LL |     i32::max_value();
    |
 help: use the associated constant instead
    |
-LL |     i32::MAX;
-   |          ~~~
+LL -     i32::max_value();
+LL +     i32::MAX;
+   |
 
 error: usage of a legacy numeric method
   --> tests/ui/legacy_numeric_constants.rs:52:9
@@ -85,8 +92,9 @@ LL |     u8::max_value();
    |
 help: use the associated constant instead
    |
-LL |     u8::MAX;
-   |         ~~~
+LL -     u8::max_value();
+LL +     u8::MAX;
+   |
 
 error: usage of a legacy numeric method
   --> tests/ui/legacy_numeric_constants.rs:55:9
@@ -96,8 +104,9 @@ LL |     u8::min_value();
    |
 help: use the associated constant instead
    |
-LL |     u8::MIN;
-   |         ~~~
+LL -     u8::min_value();
+LL +     u8::MIN;
+   |
 
 error: usage of a legacy numeric constant
   --> tests/ui/legacy_numeric_constants.rs:58:5
@@ -107,8 +116,9 @@ LL |     ::std::u8::MIN;
    |
 help: use the associated constant instead
    |
-LL |     u8::MIN;
-   |     ~~~~~~~
+LL -     ::std::u8::MIN;
+LL +     u8::MIN;
+   |
 
 error: usage of a legacy numeric method
   --> tests/ui/legacy_numeric_constants.rs:61:27
@@ -118,8 +128,9 @@ LL |     ::std::primitive::u8::min_value();
    |
 help: use the associated constant instead
    |
-LL |     ::std::primitive::u8::MIN;
-   |                           ~~~
+LL -     ::std::primitive::u8::min_value();
+LL +     ::std::primitive::u8::MIN;
+   |
 
 error: usage of a legacy numeric method
   --> tests/ui/legacy_numeric_constants.rs:64:26
@@ -129,8 +140,9 @@ LL |     std::primitive::i32::max_value();
    |
 help: use the associated constant instead
    |
-LL |     std::primitive::i32::MAX;
-   |                          ~~~
+LL -     std::primitive::i32::max_value();
+LL +     std::primitive::i32::MAX;
+   |
 
 error: usage of a legacy numeric constant
   --> tests/ui/legacy_numeric_constants.rs:67:5
@@ -140,8 +152,9 @@ LL |     self::a::u128::MAX;
    |
 help: use the associated constant instead
    |
-LL |     u128::MAX;
-   |     ~~~~~~~~~
+LL -     self::a::u128::MAX;
+LL +     u128::MAX;
+   |
 
 error: usage of a legacy numeric constant
   --> tests/ui/legacy_numeric_constants.rs:17:25
@@ -155,8 +168,9 @@ LL |     b!();
    = note: this error originates in the macro `b` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: use the associated constant instead
    |
-LL |                 let x = u64::MAX;
-   |                         ~~~~~~~~
+LL -                 let x = std::u64::MAX;
+LL +                 let x = u64::MAX;
+   |
 
 error: usage of a legacy numeric constant
   --> tests/ui/legacy_numeric_constants.rs:81:14
@@ -166,8 +180,9 @@ LL |     [(0, "", std::i128::MAX)];
    |
 help: use the associated constant instead
    |
-LL |     [(0, "", i128::MAX)];
-   |              ~~~~~~~~~
+LL -     [(0, "", std::i128::MAX)];
+LL +     [(0, "", i128::MAX)];
+   |
 
 error: usage of a legacy numeric constant
   --> tests/ui/legacy_numeric_constants.rs:115:5
@@ -177,8 +192,9 @@ LL |     std::u32::MAX;
    |
 help: use the associated constant instead
    |
-LL |     u32::MAX;
-   |     ~~~~~~~~
+LL -     std::u32::MAX;
+LL +     u32::MAX;
+   |
 
 error: aborting due to 16 previous errors
 
diff --git a/src/tools/clippy/tests/ui/literals.stderr b/src/tools/clippy/tests/ui/literals.stderr
index 564e0bc4f747..a9192825b354 100644
--- a/src/tools/clippy/tests/ui/literals.stderr
+++ b/src/tools/clippy/tests/ui/literals.stderr
@@ -71,12 +71,14 @@ LL |     let fail_multi_zero = 000_123usize;
    = help: to override `-D warnings` add `#[allow(clippy::zero_prefixed_literal)]`
 help: if you mean to use a decimal constant, remove the `0` to avoid confusion
    |
-LL |     let fail_multi_zero = 123usize;
-   |                           ~~~~~~~~
+LL -     let fail_multi_zero = 000_123usize;
+LL +     let fail_multi_zero = 123usize;
+   |
 help: if you mean to use an octal constant, use `0o`
    |
-LL |     let fail_multi_zero = 0o123usize;
-   |                           ~~~~~~~~~~
+LL -     let fail_multi_zero = 000_123usize;
+LL +     let fail_multi_zero = 0o123usize;
+   |
 
 error: integer type suffix should not be separated by an underscore
   --> tests/ui/literals.rs:36:16
@@ -92,12 +94,14 @@ LL |     let fail8 = 0123;
    |
 help: if you mean to use a decimal constant, remove the `0` to avoid confusion
    |
-LL |     let fail8 = 123;
-   |                 ~~~
+LL -     let fail8 = 0123;
+LL +     let fail8 = 123;
+   |
 help: if you mean to use an octal constant, use `0o`
    |
-LL |     let fail8 = 0o123;
-   |                 ~~~~~
+LL -     let fail8 = 0123;
+LL +     let fail8 = 0o123;
+   |
 
 error: integer type suffix should not be separated by an underscore
   --> tests/ui/literals.rs:48:16
@@ -143,8 +147,9 @@ LL |     let _ = 08;
    |
 help: if you mean to use a decimal constant, remove the `0` to avoid confusion
    |
-LL |     let _ = 8;
-   |             ~
+LL -     let _ = 08;
+LL +     let _ = 8;
+   |
 
 error: this is a decimal constant
   --> tests/ui/literals.rs:72:13
@@ -154,8 +159,9 @@ LL |     let _ = 09;
    |
 help: if you mean to use a decimal constant, remove the `0` to avoid confusion
    |
-LL |     let _ = 9;
-   |             ~
+LL -     let _ = 09;
+LL +     let _ = 9;
+   |
 
 error: this is a decimal constant
   --> tests/ui/literals.rs:74:13
@@ -165,8 +171,9 @@ LL |     let _ = 089;
    |
 help: if you mean to use a decimal constant, remove the `0` to avoid confusion
    |
-LL |     let _ = 89;
-   |             ~~
+LL -     let _ = 089;
+LL +     let _ = 89;
+   |
 
 error: aborting due to 20 previous errors
 
diff --git a/src/tools/clippy/tests/ui/lossy_float_literal.stderr b/src/tools/clippy/tests/ui/lossy_float_literal.stderr
index 3026854e317a..118351a62d00 100644
--- a/src/tools/clippy/tests/ui/lossy_float_literal.stderr
+++ b/src/tools/clippy/tests/ui/lossy_float_literal.stderr
@@ -8,8 +8,9 @@ LL |     let _: f32 = 16_777_217.0;
    = help: to override `-D warnings` add `#[allow(clippy::lossy_float_literal)]`
 help: consider changing the type or replacing it with
    |
-LL |     let _: f32 = 16_777_216.0;
-   |                  ~~~~~~~~~~~~
+LL -     let _: f32 = 16_777_217.0;
+LL +     let _: f32 = 16_777_216.0;
+   |
 
 error: literal cannot be represented as the underlying type without loss of precision
   --> tests/ui/lossy_float_literal.rs:15:18
@@ -19,8 +20,9 @@ LL |     let _: f32 = 16_777_219.0;
    |
 help: consider changing the type or replacing it with
    |
-LL |     let _: f32 = 16_777_220.0;
-   |                  ~~~~~~~~~~~~
+LL -     let _: f32 = 16_777_219.0;
+LL +     let _: f32 = 16_777_220.0;
+   |
 
 error: literal cannot be represented as the underlying type without loss of precision
   --> tests/ui/lossy_float_literal.rs:16:18
@@ -30,8 +32,9 @@ LL |     let _: f32 = 16_777_219.;
    |
 help: consider changing the type or replacing it with
    |
-LL |     let _: f32 = 16_777_220.0;
-   |                  ~~~~~~~~~~~~
+LL -     let _: f32 = 16_777_219.;
+LL +     let _: f32 = 16_777_220.0;
+   |
 
 error: literal cannot be represented as the underlying type without loss of precision
   --> tests/ui/lossy_float_literal.rs:17:18
@@ -41,8 +44,9 @@ LL |     let _: f32 = 16_777_219.000;
    |
 help: consider changing the type or replacing it with
    |
-LL |     let _: f32 = 16_777_220.0;
-   |                  ~~~~~~~~~~~~
+LL -     let _: f32 = 16_777_219.000;
+LL +     let _: f32 = 16_777_220.0;
+   |
 
 error: literal cannot be represented as the underlying type without loss of precision
   --> tests/ui/lossy_float_literal.rs:18:13
@@ -52,8 +56,9 @@ LL |     let _ = 16_777_219f32;
    |
 help: consider changing the type or replacing it with
    |
-LL |     let _ = 16_777_220_f32;
-   |             ~~~~~~~~~~~~~~
+LL -     let _ = 16_777_219f32;
+LL +     let _ = 16_777_220_f32;
+   |
 
 error: literal cannot be represented as the underlying type without loss of precision
   --> tests/ui/lossy_float_literal.rs:19:19
@@ -63,8 +68,9 @@ LL |     let _: f32 = -16_777_219.0;
    |
 help: consider changing the type or replacing it with
    |
-LL |     let _: f32 = -16_777_220.0;
-   |                   ~~~~~~~~~~~~
+LL -     let _: f32 = -16_777_219.0;
+LL +     let _: f32 = -16_777_220.0;
+   |
 
 error: literal cannot be represented as the underlying type without loss of precision
   --> tests/ui/lossy_float_literal.rs:21:18
@@ -74,8 +80,9 @@ LL |     let _: f64 = 9_007_199_254_740_993.0;
    |
 help: consider changing the type or replacing it with
    |
-LL |     let _: f64 = 9_007_199_254_740_992.0;
-   |                  ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _: f64 = 9_007_199_254_740_993.0;
+LL +     let _: f64 = 9_007_199_254_740_992.0;
+   |
 
 error: literal cannot be represented as the underlying type without loss of precision
   --> tests/ui/lossy_float_literal.rs:22:18
@@ -85,8 +92,9 @@ LL |     let _: f64 = 9_007_199_254_740_993.;
    |
 help: consider changing the type or replacing it with
    |
-LL |     let _: f64 = 9_007_199_254_740_992.0;
-   |                  ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _: f64 = 9_007_199_254_740_993.;
+LL +     let _: f64 = 9_007_199_254_740_992.0;
+   |
 
 error: literal cannot be represented as the underlying type without loss of precision
   --> tests/ui/lossy_float_literal.rs:23:18
@@ -96,8 +104,9 @@ LL |     let _: f64 = 9_007_199_254_740_993.00;
    |
 help: consider changing the type or replacing it with
    |
-LL |     let _: f64 = 9_007_199_254_740_992.0;
-   |                  ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _: f64 = 9_007_199_254_740_993.00;
+LL +     let _: f64 = 9_007_199_254_740_992.0;
+   |
 
 error: literal cannot be represented as the underlying type without loss of precision
   --> tests/ui/lossy_float_literal.rs:24:13
@@ -107,8 +116,9 @@ LL |     let _ = 9_007_199_254_740_993f64;
    |
 help: consider changing the type or replacing it with
    |
-LL |     let _ = 9_007_199_254_740_992_f64;
-   |             ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = 9_007_199_254_740_993f64;
+LL +     let _ = 9_007_199_254_740_992_f64;
+   |
 
 error: literal cannot be represented as the underlying type without loss of precision
   --> tests/ui/lossy_float_literal.rs:25:19
@@ -118,8 +128,9 @@ LL |     let _: f64 = -9_007_199_254_740_993.0;
    |
 help: consider changing the type or replacing it with
    |
-LL |     let _: f64 = -9_007_199_254_740_992.0;
-   |                   ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _: f64 = -9_007_199_254_740_993.0;
+LL +     let _: f64 = -9_007_199_254_740_992.0;
+   |
 
 error: aborting due to 11 previous errors
 
diff --git a/src/tools/clippy/tests/ui/manual_assert.edition2018.stderr b/src/tools/clippy/tests/ui/manual_assert.edition2018.stderr
index 004463720e26..dfccf7e99396 100644
--- a/src/tools/clippy/tests/ui/manual_assert.edition2018.stderr
+++ b/src/tools/clippy/tests/ui/manual_assert.edition2018.stderr
@@ -79,7 +79,15 @@ LL | |     }
    |
 help: try instead
    |
-LL |     assert!(!(a > 2), "panic with comment");
+LL -     if a > 2 {
+LL -         // comment
+LL -         /* this is a
+LL -         multiline
+LL -         comment */
+LL -         /// Doc comment
+LL -         panic!("panic with comment") // comment after `panic!`
+LL -     }
+LL +     assert!(!(a > 2), "panic with comment");
    |
 
 error: only a `panic!` in `if`-then statement
diff --git a/src/tools/clippy/tests/ui/manual_assert.edition2021.stderr b/src/tools/clippy/tests/ui/manual_assert.edition2021.stderr
index 004463720e26..dfccf7e99396 100644
--- a/src/tools/clippy/tests/ui/manual_assert.edition2021.stderr
+++ b/src/tools/clippy/tests/ui/manual_assert.edition2021.stderr
@@ -79,7 +79,15 @@ LL | |     }
    |
 help: try instead
    |
-LL |     assert!(!(a > 2), "panic with comment");
+LL -     if a > 2 {
+LL -         // comment
+LL -         /* this is a
+LL -         multiline
+LL -         comment */
+LL -         /// Doc comment
+LL -         panic!("panic with comment") // comment after `panic!`
+LL -     }
+LL +     assert!(!(a > 2), "panic with comment");
    |
 
 error: only a `panic!` in `if`-then statement
diff --git a/src/tools/clippy/tests/ui/manual_async_fn.stderr b/src/tools/clippy/tests/ui/manual_async_fn.stderr
index 68a97243436d..a7cfc30fb69c 100644
--- a/src/tools/clippy/tests/ui/manual_async_fn.stderr
+++ b/src/tools/clippy/tests/ui/manual_async_fn.stderr
@@ -8,8 +8,9 @@ LL | fn fut() -> impl Future {
    = help: to override `-D warnings` add `#[allow(clippy::manual_async_fn)]`
 help: make the function `async` and return the output of the future directly
    |
-LL | async fn fut() -> i32 { 42 }
-   | ~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
+LL - fn fut() -> impl Future {
+LL + async fn fut() -> i32 { 42 }
+   |
 
 error: this function can be simplified using the `async fn` syntax
   --> tests/ui/manual_async_fn.rs:11:1
@@ -19,8 +20,9 @@ LL | fn fut2() ->impl Future {
    |
 help: make the function `async` and return the output of the future directly
    |
-LL | async fn fut2() -> i32 { 42 }
-   | ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
+LL - fn fut2() ->impl Future {
+LL + async fn fut2() -> i32 { 42 }
+   |
 
 error: this function can be simplified using the `async fn` syntax
   --> tests/ui/manual_async_fn.rs:16:1
@@ -30,8 +32,9 @@ LL | fn fut3()-> impl Future {
    |
 help: make the function `async` and return the output of the future directly
    |
-LL | async fn fut3() -> i32 { 42 }
-   | ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
+LL - fn fut3()-> impl Future {
+LL + async fn fut3() -> i32 { 42 }
+   |
 
 error: this function can be simplified using the `async fn` syntax
   --> tests/ui/manual_async_fn.rs:20:1
@@ -41,8 +44,9 @@ LL | fn empty_fut() -> impl Future {
    |
 help: make the function `async` and return the output of the future directly
    |
-LL | async fn empty_fut() {}
-   | ~~~~~~~~~~~~~~~~~~~~ ~~
+LL - fn empty_fut() -> impl Future {
+LL + async fn empty_fut() {}
+   |
 
 error: this function can be simplified using the `async fn` syntax
   --> tests/ui/manual_async_fn.rs:25:1
@@ -52,8 +56,9 @@ LL | fn empty_fut2() ->impl Future {
    |
 help: make the function `async` and return the output of the future directly
    |
-LL | async fn empty_fut2() {}
-   | ~~~~~~~~~~~~~~~~~~~~~ ~~
+LL - fn empty_fut2() ->impl Future {
+LL + async fn empty_fut2() {}
+   |
 
 error: this function can be simplified using the `async fn` syntax
   --> tests/ui/manual_async_fn.rs:30:1
@@ -63,8 +68,9 @@ LL | fn empty_fut3()-> impl Future {
    |
 help: make the function `async` and return the output of the future directly
    |
-LL | async fn empty_fut3() {}
-   | ~~~~~~~~~~~~~~~~~~~~~ ~~
+LL - fn empty_fut3()-> impl Future {
+LL + async fn empty_fut3() {}
+   |
 
 error: this function can be simplified using the `async fn` syntax
   --> tests/ui/manual_async_fn.rs:34:1
@@ -74,8 +80,9 @@ LL | fn core_fut() -> impl core::future::Future {
    |
 help: make the function `async` and return the output of the future directly
    |
-LL | async fn core_fut() -> i32 { 42 }
-   | ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
+LL - fn core_fut() -> impl core::future::Future {
+LL + async fn core_fut() -> i32 { 42 }
+   |
 
 error: this function can be simplified using the `async fn` syntax
   --> tests/ui/manual_async_fn.rs:56:5
@@ -108,8 +115,9 @@ LL | fn elided(_: &i32) -> impl Future + '_ {
    |
 help: make the function `async` and return the output of the future directly
    |
-LL | async fn elided(_: &i32) -> i32 { 42 }
-   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
+LL - fn elided(_: &i32) -> impl Future + '_ {
+LL + async fn elided(_: &i32) -> i32 { 42 }
+   |
 
 error: this function can be simplified using the `async fn` syntax
   --> tests/ui/manual_async_fn.rs:101:1
@@ -119,8 +127,9 @@ LL | fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future +
    |
 help: make the function `async` and return the output of the future directly
    |
-LL | async fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> i32 { 42 }
-   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
+LL - fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future + 'a + 'b {
+LL + async fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> i32 { 42 }
+   |
 
 error: this function can be simplified using the `async fn` syntax
   --> tests/ui/manual_async_fn.rs:130:1
@@ -130,8 +139,9 @@ LL | pub fn issue_10450() -> impl Future {
    |
 help: make the function `async` and return the output of the future directly
    |
-LL | pub async fn issue_10450() -> i32 { 42 }
-   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
+LL - pub fn issue_10450() -> impl Future {
+LL + pub async fn issue_10450() -> i32 { 42 }
+   |
 
 error: this function can be simplified using the `async fn` syntax
   --> tests/ui/manual_async_fn.rs:134:1
@@ -141,8 +151,9 @@ LL | pub(crate) fn issue_10450_2() -> impl Future {
    |
 help: make the function `async` and return the output of the future directly
    |
-LL | pub(crate) async fn issue_10450_2() -> i32 { 42 }
-   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
+LL - pub(crate) fn issue_10450_2() -> impl Future {
+LL + pub(crate) async fn issue_10450_2() -> i32 { 42 }
+   |
 
 error: this function can be simplified using the `async fn` syntax
   --> tests/ui/manual_async_fn.rs:138:1
@@ -152,8 +163,9 @@ LL | pub(self) fn issue_10450_3() -> impl Future {
    |
 help: make the function `async` and return the output of the future directly
    |
-LL | pub(self) async fn issue_10450_3() -> i32 { 42 }
-   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
+LL - pub(self) fn issue_10450_3() -> impl Future {
+LL + pub(self) async fn issue_10450_3() -> i32 { 42 }
+   |
 
 error: aborting due to 13 previous errors
 
diff --git a/src/tools/clippy/tests/ui/manual_float_methods.stderr b/src/tools/clippy/tests/ui/manual_float_methods.stderr
index 676a4485ab4d..1352c5e73cab 100644
--- a/src/tools/clippy/tests/ui/manual_float_methods.stderr
+++ b/src/tools/clippy/tests/ui/manual_float_methods.stderr
@@ -17,16 +17,19 @@ LL |     if x != f32::INFINITY && x != f32::NEG_INFINITY {}
    = help: to override `-D warnings` add `#[allow(clippy::manual_is_finite)]`
 help: use the dedicated method instead
    |
-LL |     if x.is_finite() {}
-   |        ~~~~~~~~~~~~~
+LL -     if x != f32::INFINITY && x != f32::NEG_INFINITY {}
+LL +     if x.is_finite() {}
+   |
 help: this will alter how it handles NaN; if that is a problem, use instead
    |
-LL |     if x.is_finite() || x.is_nan() {}
-   |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     if x != f32::INFINITY && x != f32::NEG_INFINITY {}
+LL +     if x.is_finite() || x.is_nan() {}
+   |
 help: or, for conciseness
    |
-LL |     if !x.is_infinite() {}
-   |        ~~~~~~~~~~~~~~~~
+LL -     if x != f32::INFINITY && x != f32::NEG_INFINITY {}
+LL +     if !x.is_infinite() {}
+   |
 
 error: manually checking if a float is infinite
   --> tests/ui/manual_float_methods.rs:26:8
@@ -42,16 +45,19 @@ LL |     if x != INFINITE && x != NEG_INFINITE {}
    |
 help: use the dedicated method instead
    |
-LL |     if x.is_finite() {}
-   |        ~~~~~~~~~~~~~
+LL -     if x != INFINITE && x != NEG_INFINITE {}
+LL +     if x.is_finite() {}
+   |
 help: this will alter how it handles NaN; if that is a problem, use instead
    |
-LL |     if x.is_finite() || x.is_nan() {}
-   |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     if x != INFINITE && x != NEG_INFINITE {}
+LL +     if x.is_finite() || x.is_nan() {}
+   |
 help: or, for conciseness
    |
-LL |     if !x.is_infinite() {}
-   |        ~~~~~~~~~~~~~~~~
+LL -     if x != INFINITE && x != NEG_INFINITE {}
+LL +     if !x.is_infinite() {}
+   |
 
 error: manually checking if a float is infinite
   --> tests/ui/manual_float_methods.rs:29:8
@@ -67,16 +73,19 @@ LL |     if x != f64::INFINITY && x != f64::NEG_INFINITY {}
    |
 help: use the dedicated method instead
    |
-LL |     if x.is_finite() {}
-   |        ~~~~~~~~~~~~~
+LL -     if x != f64::INFINITY && x != f64::NEG_INFINITY {}
+LL +     if x.is_finite() {}
+   |
 help: this will alter how it handles NaN; if that is a problem, use instead
    |
-LL |     if x.is_finite() || x.is_nan() {}
-   |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     if x != f64::INFINITY && x != f64::NEG_INFINITY {}
+LL +     if x.is_finite() || x.is_nan() {}
+   |
 help: or, for conciseness
    |
-LL |     if !x.is_infinite() {}
-   |        ~~~~~~~~~~~~~~~~
+LL -     if x != f64::INFINITY && x != f64::NEG_INFINITY {}
+LL +     if !x.is_infinite() {}
+   |
 
 error: manually checking if a float is infinite
   --> tests/ui/manual_float_methods.rs:44:12
diff --git a/src/tools/clippy/tests/ui/manual_ignore_case_cmp.stderr b/src/tools/clippy/tests/ui/manual_ignore_case_cmp.stderr
index 11e8b8aebb54..bc6393b66d5c 100644
--- a/src/tools/clippy/tests/ui/manual_ignore_case_cmp.stderr
+++ b/src/tools/clippy/tests/ui/manual_ignore_case_cmp.stderr
@@ -11,8 +11,9 @@ LL | #![deny(clippy::manual_ignore_case_cmp)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     if a.eq_ignore_ascii_case(b) {
-   |        ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     if a.to_ascii_lowercase() == b.to_ascii_lowercase() {
+LL +     if a.eq_ignore_ascii_case(b) {
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:12:8
@@ -22,8 +23,9 @@ LL |     if a.to_ascii_uppercase() == b.to_ascii_uppercase() {
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     if a.eq_ignore_ascii_case(b) {
-   |        ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     if a.to_ascii_uppercase() == b.to_ascii_uppercase() {
+LL +     if a.eq_ignore_ascii_case(b) {
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:15:13
@@ -33,8 +35,9 @@ LL |     let r = a.to_ascii_lowercase() == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     let r = a.eq_ignore_ascii_case(b);
-   |             ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let r = a.to_ascii_lowercase() == b.to_ascii_lowercase();
+LL +     let r = a.eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:16:18
@@ -44,8 +47,9 @@ LL |     let r = r || a.to_ascii_uppercase() == b.to_ascii_uppercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     let r = r || a.eq_ignore_ascii_case(b);
-   |                  ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let r = r || a.to_ascii_uppercase() == b.to_ascii_uppercase();
+LL +     let r = r || a.eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:17:10
@@ -55,8 +59,9 @@ LL |     r && a.to_ascii_lowercase() == b.to_uppercase().to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     r && a.eq_ignore_ascii_case(&b.to_uppercase());
-   |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     r && a.to_ascii_lowercase() == b.to_uppercase().to_ascii_lowercase();
+LL +     r && a.eq_ignore_ascii_case(&b.to_uppercase());
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:19:8
@@ -66,8 +71,9 @@ LL |     if a.to_ascii_lowercase() != b.to_ascii_lowercase() {
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     if !a.eq_ignore_ascii_case(b) {
-   |        ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     if a.to_ascii_lowercase() != b.to_ascii_lowercase() {
+LL +     if !a.eq_ignore_ascii_case(b) {
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:22:8
@@ -77,8 +83,9 @@ LL |     if a.to_ascii_uppercase() != b.to_ascii_uppercase() {
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     if !a.eq_ignore_ascii_case(b) {
-   |        ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     if a.to_ascii_uppercase() != b.to_ascii_uppercase() {
+LL +     if !a.eq_ignore_ascii_case(b) {
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:25:13
@@ -88,8 +95,9 @@ LL |     let r = a.to_ascii_lowercase() != b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     let r = !a.eq_ignore_ascii_case(b);
-   |             ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let r = a.to_ascii_lowercase() != b.to_ascii_lowercase();
+LL +     let r = !a.eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:26:18
@@ -99,8 +107,9 @@ LL |     let r = r || a.to_ascii_uppercase() != b.to_ascii_uppercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     let r = r || !a.eq_ignore_ascii_case(b);
-   |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let r = r || a.to_ascii_uppercase() != b.to_ascii_uppercase();
+LL +     let r = r || !a.eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:27:10
@@ -110,8 +119,9 @@ LL |     r && a.to_ascii_lowercase() != b.to_uppercase().to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     r && !a.eq_ignore_ascii_case(&b.to_uppercase());
-   |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     r && a.to_ascii_lowercase() != b.to_uppercase().to_ascii_lowercase();
+LL +     r && !a.eq_ignore_ascii_case(&b.to_uppercase());
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:38:5
@@ -121,8 +131,9 @@ LL |     a.to_ascii_lowercase() == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case(&b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == b.to_ascii_lowercase();
+LL +     a.eq_ignore_ascii_case(&b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:41:5
@@ -132,8 +143,9 @@ LL |     a.to_ascii_lowercase() == 'a';
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case(&'a');
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == 'a';
+LL +     a.eq_ignore_ascii_case(&'a');
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:42:5
@@ -143,8 +155,9 @@ LL |     'a' == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     'a'.eq_ignore_ascii_case(&b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     'a' == b.to_ascii_lowercase();
+LL +     'a'.eq_ignore_ascii_case(&b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:45:5
@@ -154,8 +167,9 @@ LL |     a.to_ascii_lowercase() == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case(&b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == b.to_ascii_lowercase();
+LL +     a.eq_ignore_ascii_case(&b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:46:5
@@ -165,8 +179,9 @@ LL |     a.to_ascii_lowercase() == b'a';
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case(&b'a');
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == b'a';
+LL +     a.eq_ignore_ascii_case(&b'a');
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:47:5
@@ -176,8 +191,9 @@ LL |     b'a' == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     b'a'.eq_ignore_ascii_case(&b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     b'a' == b.to_ascii_lowercase();
+LL +     b'a'.eq_ignore_ascii_case(&b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:50:5
@@ -187,8 +203,9 @@ LL |     a.to_ascii_lowercase() == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case(b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == b.to_ascii_lowercase();
+LL +     a.eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:51:5
@@ -198,8 +215,9 @@ LL |     a.to_uppercase().to_ascii_lowercase() == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.to_uppercase().eq_ignore_ascii_case(b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_uppercase().to_ascii_lowercase() == b.to_ascii_lowercase();
+LL +     a.to_uppercase().eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:52:5
@@ -209,8 +227,9 @@ LL |     a.to_ascii_lowercase() == "a";
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case("a");
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == "a";
+LL +     a.eq_ignore_ascii_case("a");
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:53:5
@@ -220,8 +239,9 @@ LL |     "a" == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     "a".eq_ignore_ascii_case(b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     "a" == b.to_ascii_lowercase();
+LL +     "a".eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:56:5
@@ -231,8 +251,9 @@ LL |     a.to_ascii_lowercase() == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case(b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == b.to_ascii_lowercase();
+LL +     a.eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:57:5
@@ -242,8 +263,9 @@ LL |     a.to_uppercase().to_ascii_lowercase() == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.to_uppercase().eq_ignore_ascii_case(b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_uppercase().to_ascii_lowercase() == b.to_ascii_lowercase();
+LL +     a.to_uppercase().eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:58:5
@@ -253,8 +275,9 @@ LL |     a.to_ascii_lowercase() == "a";
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case("a");
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == "a";
+LL +     a.eq_ignore_ascii_case("a");
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:59:5
@@ -264,8 +287,9 @@ LL |     "a" == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     "a".eq_ignore_ascii_case(b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     "a" == b.to_ascii_lowercase();
+LL +     "a".eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:62:5
@@ -275,8 +299,9 @@ LL |     a.to_ascii_lowercase() == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case(&b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == b.to_ascii_lowercase();
+LL +     a.eq_ignore_ascii_case(&b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:63:5
@@ -286,8 +311,9 @@ LL |     a.to_ascii_lowercase() == "a";
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case("a");
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == "a";
+LL +     a.eq_ignore_ascii_case("a");
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:64:5
@@ -297,8 +323,9 @@ LL |     "a" == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     "a".eq_ignore_ascii_case(&b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     "a" == b.to_ascii_lowercase();
+LL +     "a".eq_ignore_ascii_case(&b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:67:5
@@ -308,8 +335,9 @@ LL |     a.to_ascii_lowercase() == "a";
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case("a");
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == "a";
+LL +     a.eq_ignore_ascii_case("a");
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:68:5
@@ -319,8 +347,9 @@ LL |     "a" == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     "a".eq_ignore_ascii_case(&b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     "a" == b.to_ascii_lowercase();
+LL +     "a".eq_ignore_ascii_case(&b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:71:5
@@ -330,8 +359,9 @@ LL |     a.to_ascii_lowercase() == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case(b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == b.to_ascii_lowercase();
+LL +     a.eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:72:5
@@ -341,8 +371,9 @@ LL |     a.to_ascii_lowercase() == "a";
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case("a");
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == "a";
+LL +     a.eq_ignore_ascii_case("a");
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:73:5
@@ -352,8 +383,9 @@ LL |     "a" == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     "a".eq_ignore_ascii_case(b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     "a" == b.to_ascii_lowercase();
+LL +     "a".eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:75:5
@@ -363,8 +395,9 @@ LL |     b.to_ascii_lowercase() == a.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     b.eq_ignore_ascii_case(&a);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     b.to_ascii_lowercase() == a.to_ascii_lowercase();
+LL +     b.eq_ignore_ascii_case(&a);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:76:5
@@ -374,8 +407,9 @@ LL |     b.to_ascii_lowercase() == "a";
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     b.eq_ignore_ascii_case("a");
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     b.to_ascii_lowercase() == "a";
+LL +     b.eq_ignore_ascii_case("a");
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:77:5
@@ -385,8 +419,9 @@ LL |     "a" == a.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     "a".eq_ignore_ascii_case(&a);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     "a" == a.to_ascii_lowercase();
+LL +     "a".eq_ignore_ascii_case(&a);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:80:5
@@ -396,8 +431,9 @@ LL |     a.to_ascii_lowercase() == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case(b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == b.to_ascii_lowercase();
+LL +     a.eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:81:5
@@ -407,8 +443,9 @@ LL |     a.to_ascii_lowercase() == "a";
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case("a");
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == "a";
+LL +     a.eq_ignore_ascii_case("a");
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:82:5
@@ -418,8 +455,9 @@ LL |     "a" == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     "a".eq_ignore_ascii_case(b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     "a" == b.to_ascii_lowercase();
+LL +     "a".eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:84:5
@@ -429,8 +467,9 @@ LL |     b.to_ascii_lowercase() == a.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     b.eq_ignore_ascii_case(&a);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     b.to_ascii_lowercase() == a.to_ascii_lowercase();
+LL +     b.eq_ignore_ascii_case(&a);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:85:5
@@ -440,8 +479,9 @@ LL |     b.to_ascii_lowercase() == "a";
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     b.eq_ignore_ascii_case("a");
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     b.to_ascii_lowercase() == "a";
+LL +     b.eq_ignore_ascii_case("a");
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:86:5
@@ -451,8 +491,9 @@ LL |     "a" == a.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     "a".eq_ignore_ascii_case(&a);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     "a" == a.to_ascii_lowercase();
+LL +     "a".eq_ignore_ascii_case(&a);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:89:5
@@ -462,8 +503,9 @@ LL |     a.to_ascii_lowercase() == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case(b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == b.to_ascii_lowercase();
+LL +     a.eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:92:5
@@ -473,8 +515,9 @@ LL |     a.to_ascii_lowercase() == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case(&b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == b.to_ascii_lowercase();
+LL +     a.eq_ignore_ascii_case(&b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:95:5
@@ -484,8 +527,9 @@ LL |     a.to_ascii_lowercase() == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case(b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == b.to_ascii_lowercase();
+LL +     a.eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:96:5
@@ -495,8 +539,9 @@ LL |     b.to_ascii_lowercase() == a.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     b.eq_ignore_ascii_case(&a);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     b.to_ascii_lowercase() == a.to_ascii_lowercase();
+LL +     b.eq_ignore_ascii_case(&a);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:99:5
@@ -506,8 +551,9 @@ LL |     a.to_ascii_lowercase() == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case(b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == b.to_ascii_lowercase();
+LL +     a.eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:102:5
@@ -517,8 +563,9 @@ LL |     a.to_ascii_lowercase() == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case(b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == b.to_ascii_lowercase();
+LL +     a.eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:105:5
@@ -528,8 +575,9 @@ LL |     a.to_ascii_lowercase() == b.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     a.eq_ignore_ascii_case(b);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     a.to_ascii_lowercase() == b.to_ascii_lowercase();
+LL +     a.eq_ignore_ascii_case(b);
+   |
 
 error: manual case-insensitive ASCII comparison
   --> tests/ui/manual_ignore_case_cmp.rs:106:5
@@ -539,8 +587,9 @@ LL |     b.to_ascii_lowercase() == a.to_ascii_lowercase();
    |
 help: consider using `.eq_ignore_ascii_case()` instead
    |
-LL |     b.eq_ignore_ascii_case(a);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     b.to_ascii_lowercase() == a.to_ascii_lowercase();
+LL +     b.eq_ignore_ascii_case(a);
+   |
 
 error: aborting due to 49 previous errors
 
diff --git a/src/tools/clippy/tests/ui/manual_is_ascii_check.stderr b/src/tools/clippy/tests/ui/manual_is_ascii_check.stderr
index 92d93208006a..7b3f0c938b0d 100644
--- a/src/tools/clippy/tests/ui/manual_is_ascii_check.stderr
+++ b/src/tools/clippy/tests/ui/manual_is_ascii_check.stderr
@@ -153,8 +153,9 @@ LL |     take_while(|c| ('A'..='Z').contains(&c));
    |
 help: try
    |
-LL |     take_while(|c: char| c.is_ascii_uppercase());
-   |                 ~~~~~~~  ~~~~~~~~~~~~~~~~~~~~~~
+LL -     take_while(|c| ('A'..='Z').contains(&c));
+LL +     take_while(|c: char| c.is_ascii_uppercase());
+   |
 
 error: manual check for common ascii range
   --> tests/ui/manual_is_ascii_check.rs:82:20
@@ -164,8 +165,9 @@ LL |     take_while(|c| (b'A'..=b'Z').contains(&c));
    |
 help: try
    |
-LL |     take_while(|c: u8| c.is_ascii_uppercase());
-   |                 ~~~~~  ~~~~~~~~~~~~~~~~~~~~~~
+LL -     take_while(|c| (b'A'..=b'Z').contains(&c));
+LL +     take_while(|c: u8| c.is_ascii_uppercase());
+   |
 
 error: manual check for common ascii range
   --> tests/ui/manual_is_ascii_check.rs:83:26
@@ -181,8 +183,9 @@ LL |     let digits: Vec<&char> = ['1', 'A'].iter().take_while(|c| ('0'..='9').c
    |
 help: try
    |
-LL |     let digits: Vec<&char> = ['1', 'A'].iter().take_while(|c: &&char| c.is_ascii_digit()).collect();
-   |                                                            ~~~~~~~~~  ~~~~~~~~~~~~~~~~~~
+LL -     let digits: Vec<&char> = ['1', 'A'].iter().take_while(|c| ('0'..='9').contains(c)).collect();
+LL +     let digits: Vec<&char> = ['1', 'A'].iter().take_while(|c: &&char| c.is_ascii_digit()).collect();
+   |
 
 error: manual check for common ascii range
   --> tests/ui/manual_is_ascii_check.rs:88:71
@@ -192,8 +195,9 @@ LL |     let digits: Vec<&mut char> = ['1', 'A'].iter_mut().take_while(|c| ('0'.
    |
 help: try
    |
-LL |     let digits: Vec<&mut char> = ['1', 'A'].iter_mut().take_while(|c: &&mut char| c.is_ascii_digit()).collect();
-   |                                                                    ~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~~
+LL -     let digits: Vec<&mut char> = ['1', 'A'].iter_mut().take_while(|c| ('0'..='9').contains(c)).collect();
+LL +     let digits: Vec<&mut char> = ['1', 'A'].iter_mut().take_while(|c: &&mut char| c.is_ascii_digit()).collect();
+   |
 
 error: aborting due to 29 previous errors
 
diff --git a/src/tools/clippy/tests/ui/map_all_any_identity.stderr b/src/tools/clippy/tests/ui/map_all_any_identity.stderr
index 98fdcc2a9393..39df2a3d9616 100644
--- a/src/tools/clippy/tests/ui/map_all_any_identity.stderr
+++ b/src/tools/clippy/tests/ui/map_all_any_identity.stderr
@@ -8,8 +8,9 @@ LL |     let _ = ["foo"].into_iter().map(|s| s == "foo").any(|a| a);
    = help: to override `-D warnings` add `#[allow(clippy::map_all_any_identity)]`
 help: use `.any(...)` instead
    |
-LL |     let _ = ["foo"].into_iter().any(|s| s == "foo");
-   |                                 ~~~~~~~~~~~~~~~~~~~
+LL -     let _ = ["foo"].into_iter().map(|s| s == "foo").any(|a| a);
+LL +     let _ = ["foo"].into_iter().any(|s| s == "foo");
+   |
 
 error: usage of `.map(...).all(identity)`
   --> tests/ui/map_all_any_identity.rs:6:33
@@ -19,8 +20,9 @@ LL |     let _ = ["foo"].into_iter().map(|s| s == "foo").all(std::convert::ident
    |
 help: use `.all(...)` instead
    |
-LL |     let _ = ["foo"].into_iter().all(|s| s == "foo");
-   |                                 ~~~~~~~~~~~~~~~~~~~
+LL -     let _ = ["foo"].into_iter().map(|s| s == "foo").all(std::convert::identity);
+LL +     let _ = ["foo"].into_iter().all(|s| s == "foo");
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/src/tools/clippy/tests/ui/map_with_unused_argument_over_ranges.stderr b/src/tools/clippy/tests/ui/map_with_unused_argument_over_ranges.stderr
index 0b56c6d95219..840515f95df4 100644
--- a/src/tools/clippy/tests/ui/map_with_unused_argument_over_ranges.stderr
+++ b/src/tools/clippy/tests/ui/map_with_unused_argument_over_ranges.stderr
@@ -68,8 +68,9 @@ LL |     (0..10).map(|_| 3);
    |
 help: remove the explicit range and use `repeat_n`
    |
-LL |     std::iter::repeat_n(3, 10);
-   |     ~~~~~~~~~~~~~~~~~~~ ~~~~~
+LL -     (0..10).map(|_| 3);
+LL +     std::iter::repeat_n(3, 10);
+   |
 
 error: map of a closure that does not depend on its parameter over a range
   --> tests/ui/map_with_unused_argument_over_ranges.rs:31:5
@@ -216,8 +217,9 @@ LL |     (0..10).map(|_| 3);
    |
 help: remove the explicit range and use `repeat` and `take`
    |
-LL |     std::iter::repeat(3).take(10);
-   |     ~~~~~~~~~~~~~~~~~ ~ +++++++++
+LL -     (0..10).map(|_| 3);
+LL +     std::iter::repeat(3).take(10);
+   |
 
 error: aborting due to 18 previous errors
 
diff --git a/src/tools/clippy/tests/ui/map_with_unused_argument_over_ranges_nostd.stderr b/src/tools/clippy/tests/ui/map_with_unused_argument_over_ranges_nostd.stderr
index d47f3d09175b..975ded83560f 100644
--- a/src/tools/clippy/tests/ui/map_with_unused_argument_over_ranges_nostd.stderr
+++ b/src/tools/clippy/tests/ui/map_with_unused_argument_over_ranges_nostd.stderr
@@ -8,8 +8,9 @@ LL |     let _: Vec<_> = (0..10).map(|_| 3 + 1).collect();
    = help: to override `-D warnings` add `#[allow(clippy::map_with_unused_argument_over_ranges)]`
 help: remove the explicit range and use `repeat_n`
    |
-LL |     let _: Vec<_> = core::iter::repeat_n(3 + 1, 10).collect();
-   |                     ~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~
+LL -     let _: Vec<_> = (0..10).map(|_| 3 + 1).collect();
+LL +     let _: Vec<_> = core::iter::repeat_n(3 + 1, 10).collect();
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/src/tools/clippy/tests/ui/match_result_ok.stderr b/src/tools/clippy/tests/ui/match_result_ok.stderr
index b5b91cbe5534..18b23bd78454 100644
--- a/src/tools/clippy/tests/ui/match_result_ok.stderr
+++ b/src/tools/clippy/tests/ui/match_result_ok.stderr
@@ -8,8 +8,9 @@ LL |     if let Some(y) = x.parse().ok() { y } else { 0 }
    = help: to override `-D warnings` add `#[allow(clippy::match_result_ok)]`
 help: consider matching on `Ok(y)` and removing the call to `ok` instead
    |
-LL |     if let Ok(y) = x.parse() { y } else { 0 }
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     if let Some(y) = x.parse().ok() { y } else { 0 }
+LL +     if let Ok(y) = x.parse() { y } else { 0 }
+   |
 
 error: matching on `Some` with `ok()` is redundant
   --> tests/ui/match_result_ok.rs:23:9
@@ -19,8 +20,9 @@ LL |         if let Some(y) = x   .   parse()   .   ok   ()    {
    |
 help: consider matching on `Ok(y)` and removing the call to `ok` instead
    |
-LL |         if let Ok(y) = x   .   parse()    {
-   |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -         if let Some(y) = x   .   parse()   .   ok   ()    {
+LL +         if let Ok(y) = x   .   parse()    {
+   |
 
 error: matching on `Some` with `ok()` is redundant
   --> tests/ui/match_result_ok.rs:49:5
@@ -30,8 +32,9 @@ LL |     while let Some(a) = wat.next().ok() {
    |
 help: consider matching on `Ok(a)` and removing the call to `ok` instead
    |
-LL |     while let Ok(a) = wat.next() {
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     while let Some(a) = wat.next().ok() {
+LL +     while let Ok(a) = wat.next() {
+   |
 
 error: aborting due to 3 previous errors
 
diff --git a/src/tools/clippy/tests/ui/match_str_case_mismatch.stderr b/src/tools/clippy/tests/ui/match_str_case_mismatch.stderr
index 67e9ccaf6d2f..5b14fd13a53b 100644
--- a/src/tools/clippy/tests/ui/match_str_case_mismatch.stderr
+++ b/src/tools/clippy/tests/ui/match_str_case_mismatch.stderr
@@ -8,8 +8,9 @@ LL |         "Bar" => {},
    = help: to override `-D warnings` add `#[allow(clippy::match_str_case_mismatch)]`
 help: consider changing the case of this arm to respect `to_ascii_lowercase`
    |
-LL |         "bar" => {},
-   |         ~~~~~
+LL -         "Bar" => {},
+LL +         "bar" => {},
+   |
 
 error: this `match` arm has a differing case than its expression
   --> tests/ui/match_str_case_mismatch.rs:122:9
@@ -19,8 +20,9 @@ LL |         "~!@#$%^&*()-_=+Foo" => {},
    |
 help: consider changing the case of this arm to respect `to_ascii_lowercase` (notice the capitalization difference)
    |
-LL |         "~!@#$%^&*()-_=+foo" => {},
-   |         ~~~~~~~~~~~~~~~~~~~~
+LL -         "~!@#$%^&*()-_=+Foo" => {},
+LL +         "~!@#$%^&*()-_=+foo" => {},
+   |
 
 error: this `match` arm has a differing case than its expression
   --> tests/ui/match_str_case_mismatch.rs:134:9
@@ -30,8 +32,9 @@ LL |         "Воды" => {},
    |
 help: consider changing the case of this arm to respect `to_lowercase`
    |
-LL |         "воды" => {},
-   |         ~~~~~~
+LL -         "Воды" => {},
+LL +         "воды" => {},
+   |
 
 error: this `match` arm has a differing case than its expression
   --> tests/ui/match_str_case_mismatch.rs:145:9
@@ -41,8 +44,9 @@ LL |         "barDz" => {},
    |
 help: consider changing the case of this arm to respect `to_lowercase`
    |
-LL |         "bardz" => {},
-   |         ~~~~~~
+LL -         "barDz" => {},
+LL +         "bardz" => {},
+   |
 
 error: this `match` arm has a differing case than its expression
   --> tests/ui/match_str_case_mismatch.rs:155:9
@@ -52,8 +56,9 @@ LL |         "bARʁ" => {},
    |
 help: consider changing the case of this arm to respect `to_uppercase`
    |
-LL |         "BARʁ" => {},
-   |         ~~~~~~
+LL -         "bARʁ" => {},
+LL +         "BARʁ" => {},
+   |
 
 error: this `match` arm has a differing case than its expression
   --> tests/ui/match_str_case_mismatch.rs:165:9
@@ -63,8 +68,9 @@ LL |         "Bar" => {},
    |
 help: consider changing the case of this arm to respect `to_ascii_lowercase`
    |
-LL |         "bar" => {},
-   |         ~~~~~
+LL -         "Bar" => {},
+LL +         "bar" => {},
+   |
 
 error: this `match` arm has a differing case than its expression
   --> tests/ui/match_str_case_mismatch.rs:180:9
@@ -74,8 +80,9 @@ LL |         "bAR" => {},
    |
 help: consider changing the case of this arm to respect `to_ascii_uppercase`
    |
-LL |         "BAR" => {},
-   |         ~~~~~
+LL -         "bAR" => {},
+LL +         "BAR" => {},
+   |
 
 error: aborting due to 7 previous errors
 
diff --git a/src/tools/clippy/tests/ui/needless_borrow_pat.stderr b/src/tools/clippy/tests/ui/needless_borrow_pat.stderr
index 2ad694490396..035376cabaf4 100644
--- a/src/tools/clippy/tests/ui/needless_borrow_pat.stderr
+++ b/src/tools/clippy/tests/ui/needless_borrow_pat.stderr
@@ -15,8 +15,9 @@ LL |         Some(ref x) => *x,
    |
 help: try
    |
-LL |         Some(x) => x,
-   |              ~     ~
+LL -         Some(ref x) => *x,
+LL +         Some(x) => x,
+   |
 
 error: this pattern creates a reference to a reference
   --> tests/ui/needless_borrow_pat.rs:74:14
@@ -71,8 +72,9 @@ LL |         E::A(ref x) | E::B(ref x) => *x,
    |
 help: try
    |
-LL |         E::A(x) | E::B(x) => x,
-   |              ~         ~     ~
+LL -         E::A(ref x) | E::B(ref x) => *x,
+LL +         E::A(x) | E::B(x) => x,
+   |
 
 error: this pattern creates a reference to a reference
   --> tests/ui/needless_borrow_pat.rs:126:21
diff --git a/src/tools/clippy/tests/ui/needless_for_each_unfixable.stderr b/src/tools/clippy/tests/ui/needless_for_each_unfixable.stderr
index 682140a1dfda..722016b12125 100644
--- a/src/tools/clippy/tests/ui/needless_for_each_unfixable.stderr
+++ b/src/tools/clippy/tests/ui/needless_for_each_unfixable.stderr
@@ -25,8 +25,9 @@ LL +     }
    |
 help: ...and replace `return` with `continue`
    |
-LL |             continue;
-   |             ~~~~~~~~
+LL -             return;
+LL +             continue;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/src/tools/clippy/tests/ui/needless_pass_by_value.stderr b/src/tools/clippy/tests/ui/needless_pass_by_value.stderr
index 2587d3f8c52f..2c90da51252a 100644
--- a/src/tools/clippy/tests/ui/needless_pass_by_value.stderr
+++ b/src/tools/clippy/tests/ui/needless_pass_by_value.stderr
@@ -63,12 +63,14 @@ LL | fn issue_2114(s: String, t: String, u: Vec, v: Vec) {
    |
 help: consider changing the type to
    |
-LL | fn issue_2114(s: String, t: &str, u: Vec, v: Vec) {
-   |                             ~~~~
+LL - fn issue_2114(s: String, t: String, u: Vec, v: Vec) {
+LL + fn issue_2114(s: String, t: &str, u: Vec, v: Vec) {
+   |
 help: change `t.clone()` to
    |
-LL |     let _ = t.to_string();
-   |             ~~~~~~~~~~~~~
+LL -     let _ = t.clone();
+LL +     let _ = t.to_string();
+   |
 
 error: this argument is passed by value, but not consumed in the function body
   --> tests/ui/needless_pass_by_value.rs:91:40
@@ -84,12 +86,14 @@ LL | fn issue_2114(s: String, t: String, u: Vec, v: Vec) {
    |
 help: consider changing the type to
    |
-LL | fn issue_2114(s: String, t: String, u: Vec, v: &[i32]) {
-   |                                                     ~~~~~~
+LL - fn issue_2114(s: String, t: String, u: Vec, v: Vec) {
+LL + fn issue_2114(s: String, t: String, u: Vec, v: &[i32]) {
+   |
 help: change `v.clone()` to
    |
-LL |     let _ = v.to_owned();
-   |             ~~~~~~~~~~~~
+LL -     let _ = v.clone();
+LL +     let _ = v.to_owned();
+   |
 
 error: this argument is passed by value, but not consumed in the function body
   --> tests/ui/needless_pass_by_value.rs:108:12
diff --git a/src/tools/clippy/tests/ui/needless_range_loop.stderr b/src/tools/clippy/tests/ui/needless_range_loop.stderr
index 503d796e5e8d..831b8511e434 100644
--- a/src/tools/clippy/tests/ui/needless_range_loop.stderr
+++ b/src/tools/clippy/tests/ui/needless_range_loop.stderr
@@ -8,8 +8,9 @@ LL |     for i in 0..vec.len() {
    = help: to override `-D warnings` add `#[allow(clippy::needless_range_loop)]`
 help: consider using an iterator
    |
-LL |     for  in &vec {
-   |         ~~~~~~    ~~~~
+LL -     for i in 0..vec.len() {
+LL +     for  in &vec {
+   |
 
 error: the loop variable `i` is only used to index `vec`
   --> tests/ui/needless_range_loop.rs:27:14
@@ -19,8 +20,9 @@ LL |     for i in 0..vec.len() {
    |
 help: consider using an iterator
    |
-LL |     for  in &vec {
-   |         ~~~~~~    ~~~~
+LL -     for i in 0..vec.len() {
+LL +     for  in &vec {
+   |
 
 error: the loop variable `j` is only used to index `STATIC`
   --> tests/ui/needless_range_loop.rs:33:14
@@ -30,8 +32,9 @@ LL |     for j in 0..4 {
    |
 help: consider using an iterator
    |
-LL |     for  in &STATIC {
-   |         ~~~~~~    ~~~~~~~
+LL -     for j in 0..4 {
+LL +     for  in &STATIC {
+   |
 
 error: the loop variable `j` is only used to index `CONST`
   --> tests/ui/needless_range_loop.rs:38:14
@@ -41,8 +44,9 @@ LL |     for j in 0..4 {
    |
 help: consider using an iterator
    |
-LL |     for  in &CONST {
-   |         ~~~~~~    ~~~~~~
+LL -     for j in 0..4 {
+LL +     for  in &CONST {
+   |
 
 error: the loop variable `i` is used to index `vec`
   --> tests/ui/needless_range_loop.rs:43:14
@@ -52,8 +56,9 @@ LL |     for i in 0..vec.len() {
    |
 help: consider using an iterator and enumerate()
    |
-LL |     for (i, ) in vec.iter().enumerate() {
-   |         ~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~
+LL -     for i in 0..vec.len() {
+LL +     for (i, ) in vec.iter().enumerate() {
+   |
 
 error: the loop variable `i` is only used to index `vec2`
   --> tests/ui/needless_range_loop.rs:52:14
@@ -63,8 +68,9 @@ LL |     for i in 0..vec.len() {
    |
 help: consider using an iterator
    |
-LL |     for  in vec2.iter().take(vec.len()) {
-   |         ~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     for i in 0..vec.len() {
+LL +     for  in vec2.iter().take(vec.len()) {
+   |
 
 error: the loop variable `i` is only used to index `vec`
   --> tests/ui/needless_range_loop.rs:57:14
@@ -74,8 +80,9 @@ LL |     for i in 5..vec.len() {
    |
 help: consider using an iterator
    |
-LL |     for  in vec.iter().skip(5) {
-   |         ~~~~~~    ~~~~~~~~~~~~~~~~~~
+LL -     for i in 5..vec.len() {
+LL +     for  in vec.iter().skip(5) {
+   |
 
 error: the loop variable `i` is only used to index `vec`
   --> tests/ui/needless_range_loop.rs:62:14
@@ -85,8 +92,9 @@ LL |     for i in 0..MAX_LEN {
    |
 help: consider using an iterator
    |
-LL |     for  in vec.iter().take(MAX_LEN) {
-   |         ~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     for i in 0..MAX_LEN {
+LL +     for  in vec.iter().take(MAX_LEN) {
+   |
 
 error: the loop variable `i` is only used to index `vec`
   --> tests/ui/needless_range_loop.rs:67:14
@@ -96,8 +104,9 @@ LL |     for i in 0..=MAX_LEN {
    |
 help: consider using an iterator
    |
-LL |     for  in vec.iter().take(MAX_LEN + 1) {
-   |         ~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     for i in 0..=MAX_LEN {
+LL +     for  in vec.iter().take(MAX_LEN + 1) {
+   |
 
 error: the loop variable `i` is only used to index `vec`
   --> tests/ui/needless_range_loop.rs:72:14
@@ -107,8 +116,9 @@ LL |     for i in 5..10 {
    |
 help: consider using an iterator
    |
-LL |     for  in vec.iter().take(10).skip(5) {
-   |         ~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     for i in 5..10 {
+LL +     for  in vec.iter().take(10).skip(5) {
+   |
 
 error: the loop variable `i` is only used to index `vec`
   --> tests/ui/needless_range_loop.rs:77:14
@@ -118,8 +128,9 @@ LL |     for i in 5..=10 {
    |
 help: consider using an iterator
    |
-LL |     for  in vec.iter().take(10 + 1).skip(5) {
-   |         ~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     for i in 5..=10 {
+LL +     for  in vec.iter().take(10 + 1).skip(5) {
+   |
 
 error: the loop variable `i` is used to index `vec`
   --> tests/ui/needless_range_loop.rs:82:14
@@ -129,8 +140,9 @@ LL |     for i in 5..vec.len() {
    |
 help: consider using an iterator and enumerate()
    |
-LL |     for (i, ) in vec.iter().enumerate().skip(5) {
-   |         ~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     for i in 5..vec.len() {
+LL +     for (i, ) in vec.iter().enumerate().skip(5) {
+   |
 
 error: the loop variable `i` is used to index `vec`
   --> tests/ui/needless_range_loop.rs:87:14
@@ -140,8 +152,9 @@ LL |     for i in 5..10 {
    |
 help: consider using an iterator and enumerate()
    |
-LL |     for (i, ) in vec.iter().enumerate().take(10).skip(5) {
-   |         ~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     for i in 5..10 {
+LL +     for (i, ) in vec.iter().enumerate().take(10).skip(5) {
+   |
 
 error: the loop variable `i` is used to index `vec`
   --> tests/ui/needless_range_loop.rs:93:14
@@ -151,8 +164,9 @@ LL |     for i in 0..vec.len() {
    |
 help: consider using an iterator and enumerate()
    |
-LL |     for (i, ) in vec.iter_mut().enumerate() {
-   |         ~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     for i in 0..vec.len() {
+LL +     for (i, ) in vec.iter_mut().enumerate() {
+   |
 
 error: aborting due to 14 previous errors
 
diff --git a/src/tools/clippy/tests/ui/needless_range_loop2.stderr b/src/tools/clippy/tests/ui/needless_range_loop2.stderr
index 353f30b1b26d..f37e1f2872d0 100644
--- a/src/tools/clippy/tests/ui/needless_range_loop2.stderr
+++ b/src/tools/clippy/tests/ui/needless_range_loop2.stderr
@@ -8,8 +8,9 @@ LL |     for i in 3..10 {
    = help: to override `-D warnings` add `#[allow(clippy::needless_range_loop)]`
 help: consider using an iterator
    |
-LL |     for  in ns.iter().take(10).skip(3) {
-   |         ~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     for i in 3..10 {
+LL +     for  in ns.iter().take(10).skip(3) {
+   |
 
 error: the loop variable `i` is only used to index `ms`
   --> tests/ui/needless_range_loop2.rs:34:14
@@ -19,8 +20,9 @@ LL |     for i in 0..ms.len() {
    |
 help: consider using an iterator
    |
-LL |     for  in &mut ms {
-   |         ~~~~~~    ~~~~~~~
+LL -     for i in 0..ms.len() {
+LL +     for  in &mut ms {
+   |
 
 error: the loop variable `i` is only used to index `ms`
   --> tests/ui/needless_range_loop2.rs:41:14
@@ -30,8 +32,9 @@ LL |     for i in 0..ms.len() {
    |
 help: consider using an iterator
    |
-LL |     for  in &mut ms {
-   |         ~~~~~~    ~~~~~~~
+LL -     for i in 0..ms.len() {
+LL +     for  in &mut ms {
+   |
 
 error: the loop variable `i` is only used to index `vec`
   --> tests/ui/needless_range_loop2.rs:66:14
@@ -41,8 +44,9 @@ LL |     for i in x..x + 4 {
    |
 help: consider using an iterator
    |
-LL |     for  in vec.iter_mut().skip(x).take(4) {
-   |         ~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     for i in x..x + 4 {
+LL +     for  in vec.iter_mut().skip(x).take(4) {
+   |
 
 error: the loop variable `i` is only used to index `vec`
   --> tests/ui/needless_range_loop2.rs:74:14
@@ -52,8 +56,9 @@ LL |     for i in x..=x + 4 {
    |
 help: consider using an iterator
    |
-LL |     for  in vec.iter_mut().skip(x).take(4 + 1) {
-   |         ~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     for i in x..=x + 4 {
+LL +     for  in vec.iter_mut().skip(x).take(4 + 1) {
+   |
 
 error: the loop variable `i` is only used to index `arr`
   --> tests/ui/needless_range_loop2.rs:81:14
@@ -63,8 +68,9 @@ LL |     for i in 0..3 {
    |
 help: consider using an iterator
    |
-LL |     for  in &arr {
-   |         ~~~~~~    ~~~~
+LL -     for i in 0..3 {
+LL +     for  in &arr {
+   |
 
 error: the loop variable `i` is only used to index `arr`
   --> tests/ui/needless_range_loop2.rs:86:14
@@ -74,8 +80,9 @@ LL |     for i in 0..2 {
    |
 help: consider using an iterator
    |
-LL |     for  in arr.iter().take(2) {
-   |         ~~~~~~    ~~~~~~~~~~~~~~~~~~
+LL -     for i in 0..2 {
+LL +     for  in arr.iter().take(2) {
+   |
 
 error: the loop variable `i` is only used to index `arr`
   --> tests/ui/needless_range_loop2.rs:91:14
@@ -85,8 +92,9 @@ LL |     for i in 1..3 {
    |
 help: consider using an iterator
    |
-LL |     for  in arr.iter().skip(1) {
-   |         ~~~~~~    ~~~~~~~~~~~~~~~~~~
+LL -     for i in 1..3 {
+LL +     for  in arr.iter().skip(1) {
+   |
 
 error: aborting due to 8 previous errors
 
diff --git a/src/tools/clippy/tests/ui/needless_return.stderr b/src/tools/clippy/tests/ui/needless_return.stderr
index d3c2a6badc0f..8d8b5b9e713d 100644
--- a/src/tools/clippy/tests/ui/needless_return.stderr
+++ b/src/tools/clippy/tests/ui/needless_return.stderr
@@ -80,8 +80,9 @@ LL |         true => return false,
    |
 help: remove `return`
    |
-LL |         true => false,
-   |                 ~~~~~
+LL -         true => return false,
+LL +         true => false,
+   |
 
 error: unneeded `return` statement
   --> tests/ui/needless_return.rs:58:13
@@ -115,8 +116,9 @@ LL |     let _ = || return true;
    |
 help: remove `return`
    |
-LL |     let _ = || true;
-   |                ~~~~
+LL -     let _ = || return true;
+LL +     let _ = || true;
+   |
 
 error: unneeded `return` statement
   --> tests/ui/needless_return.rs:71:5
@@ -183,8 +185,9 @@ LL |         _ => return,
    |
 help: replace `return` with a unit value
    |
-LL |         _ => (),
-   |              ~~
+LL -         _ => return,
+LL +         _ => (),
+   |
 
 error: unneeded `return` statement
   --> tests/ui/needless_return.rs:97:24
@@ -209,8 +212,9 @@ LL |         _ => return,
    |
 help: replace `return` with a unit value
    |
-LL |         _ => (),
-   |              ~~
+LL -         _ => return,
+LL +         _ => (),
+   |
 
 error: unneeded `return` statement
   --> tests/ui/needless_return.rs:113:9
@@ -244,8 +248,9 @@ LL |         bar.unwrap_or_else(|_| return)
    |
 help: replace `return` with an empty block
    |
-LL |         bar.unwrap_or_else(|_| {})
-   |                                ~~
+LL -         bar.unwrap_or_else(|_| return)
+LL +         bar.unwrap_or_else(|_| {})
+   |
 
 error: unneeded `return` statement
   --> tests/ui/needless_return.rs:141:21
@@ -270,8 +275,9 @@ LL |         let _ = || return;
    |
 help: replace `return` with an empty block
    |
-LL |         let _ = || {};
-   |                    ~~
+LL -         let _ = || return;
+LL +         let _ = || {};
+   |
 
 error: unneeded `return` statement
   --> tests/ui/needless_return.rs:150:32
@@ -281,8 +287,9 @@ LL |         res.unwrap_or_else(|_| return Foo)
    |
 help: remove `return`
    |
-LL |         res.unwrap_or_else(|_| Foo)
-   |                                ~~~
+LL -         res.unwrap_or_else(|_| return Foo)
+LL +         res.unwrap_or_else(|_| Foo)
+   |
 
 error: unneeded `return` statement
   --> tests/ui/needless_return.rs:159:5
@@ -340,8 +347,9 @@ LL |         true => return false,
    |
 help: remove `return`
    |
-LL |         true => false,
-   |                 ~~~~~
+LL -         true => return false,
+LL +         true => false,
+   |
 
 error: unneeded `return` statement
   --> tests/ui/needless_return.rs:178:13
@@ -375,8 +383,9 @@ LL |     let _ = || return true;
    |
 help: remove `return`
    |
-LL |     let _ = || true;
-   |                ~~~~
+LL -     let _ = || return true;
+LL +     let _ = || true;
+   |
 
 error: unneeded `return` statement
   --> tests/ui/needless_return.rs:191:5
@@ -443,8 +452,9 @@ LL |         _ => return,
    |
 help: replace `return` with a unit value
    |
-LL |         _ => (),
-   |              ~~
+LL -         _ => return,
+LL +         _ => (),
+   |
 
 error: unneeded `return` statement
   --> tests/ui/needless_return.rs:222:9
diff --git a/src/tools/clippy/tests/ui/never_loop.stderr b/src/tools/clippy/tests/ui/never_loop.stderr
index dab3488af106..203e33258225 100644
--- a/src/tools/clippy/tests/ui/never_loop.stderr
+++ b/src/tools/clippy/tests/ui/never_loop.stderr
@@ -77,8 +77,9 @@ LL | |     }
    |
 help: if you need the first element of the iterator, try writing
    |
-LL |     if let Some(x) = (0..10).next() {
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     for x in 0..10 {
+LL +     if let Some(x) = (0..10).next() {
+   |
 
 error: this loop never actually loops
   --> tests/ui/never_loop.rs:167:5
@@ -145,8 +146,9 @@ LL | |             }
    |
 help: if you need the first element of the iterator, try writing
    |
-LL |             if let Some(_) = (0..20).next() {
-   |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -             for _ in 0..20 {
+LL +             if let Some(_) = (0..20).next() {
+   |
 
 error: this loop never actually loops
   --> tests/ui/never_loop.rs:378:13
diff --git a/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.stderr b/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.stderr
index a15379c5b1a5..9f0c2ec43015 100644
--- a/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.stderr
+++ b/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.stderr
@@ -25,8 +25,9 @@ LL | | }
    |
 help: change this to
    |
-LL |     fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) }
-   |                           ~~~~~                             ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     fn partial_cmp(&self, _: &Self) -> Option {
+LL +     fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) }
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/src/tools/clippy/tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.stderr b/src/tools/clippy/tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.stderr
index f956f4b8d52a..333052ae1c11 100644
--- a/src/tools/clippy/tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.stderr
+++ b/src/tools/clippy/tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.stderr
@@ -8,8 +8,9 @@ LL | static LAZY_FOO: Lazy = Lazy::new(|| "foo".to_uppercase());
    = help: to override `-D warnings` add `#[allow(clippy::non_std_lazy_statics)]`
 help: use `std::sync::LazyLock` instead
    |
-LL | static LAZY_FOO: std::sync::LazyLock = std::sync::LazyLock::new(|| "foo".to_uppercase());
-   |                  ~~~~~~~~~~~~~~~~~~~           ~~~~~~~~~~~~~~~~~~~~~~~~
+LL - static LAZY_FOO: Lazy = Lazy::new(|| "foo".to_uppercase());
+LL + static LAZY_FOO: std::sync::LazyLock = std::sync::LazyLock::new(|| "foo".to_uppercase());
+   |
 
 error: this type has been superceded by `LazyLock` in the standard library
   --> tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.rs:13:18
@@ -19,8 +20,9 @@ LL | static LAZY_BAR: Lazy = Lazy::new(|| {
    |
 help: use `std::sync::LazyLock` instead
    |
-LL | static LAZY_BAR: std::sync::LazyLock = std::sync::LazyLock::new(|| {
-   |                  ~~~~~~~~~~~~~~~~~~~           ~~~~~~~~~~~~~~~~~~~~~~~~
+LL - static LAZY_BAR: Lazy = Lazy::new(|| {
+LL + static LAZY_BAR: std::sync::LazyLock = std::sync::LazyLock::new(|| {
+   |
 
 error: this type has been superceded by `LazyLock` in the standard library
   --> tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.rs:18:18
@@ -30,8 +32,9 @@ LL | static LAZY_BAZ: Lazy = { Lazy::new(|| "baz".to_uppercase()) };
    |
 help: use `std::sync::LazyLock` instead
    |
-LL | static LAZY_BAZ: std::sync::LazyLock = { std::sync::LazyLock::new(|| "baz".to_uppercase()) };
-   |                  ~~~~~~~~~~~~~~~~~~~             ~~~~~~~~~~~~~~~~~~~~~~~~
+LL - static LAZY_BAZ: Lazy = { Lazy::new(|| "baz".to_uppercase()) };
+LL + static LAZY_BAZ: std::sync::LazyLock = { std::sync::LazyLock::new(|| "baz".to_uppercase()) };
+   |
 
 error: this type has been superceded by `LazyLock` in the standard library
   --> tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.rs:20:18
diff --git a/src/tools/clippy/tests/ui/non_std_lazy_static/non_std_lazy_static_unfixable.stderr b/src/tools/clippy/tests/ui/non_std_lazy_static/non_std_lazy_static_unfixable.stderr
index 66dc435f9823..216190ae4ca3 100644
--- a/src/tools/clippy/tests/ui/non_std_lazy_static/non_std_lazy_static_unfixable.stderr
+++ b/src/tools/clippy/tests/ui/non_std_lazy_static/non_std_lazy_static_unfixable.stderr
@@ -37,8 +37,9 @@ LL |     static LAZY_FOO: Lazy = Lazy::new(|| "foo".to_uppercase());
    |
 help: use `std::sync::LazyLock` instead
    |
-LL |     static LAZY_FOO: std::sync::LazyLock = std::sync::LazyLock::new(|| "foo".to_uppercase());
-   |                      ~~~~~~~~~~~~~~~~~~~           ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     static LAZY_FOO: Lazy = Lazy::new(|| "foo".to_uppercase());
+LL +     static LAZY_FOO: std::sync::LazyLock = std::sync::LazyLock::new(|| "foo".to_uppercase());
+   |
 
 error: this type has been superceded by `LazyLock` in the standard library
   --> tests/ui/non_std_lazy_static/non_std_lazy_static_unfixable.rs:13:26
@@ -48,8 +49,9 @@ LL |     static mut LAZY_BAR: Lazy = Lazy::new(|| "bar".to_uppercase());
    |
 help: use `std::sync::LazyLock` instead
    |
-LL |     static mut LAZY_BAR: std::sync::LazyLock = std::sync::LazyLock::new(|| "bar".to_uppercase());
-   |                          ~~~~~~~~~~~~~~~~~~~           ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     static mut LAZY_BAR: Lazy = Lazy::new(|| "bar".to_uppercase());
+LL +     static mut LAZY_BAR: std::sync::LazyLock = std::sync::LazyLock::new(|| "bar".to_uppercase());
+   |
 
 error: this type has been superceded by `LazyLock` in the standard library
   --> tests/ui/non_std_lazy_static/non_std_lazy_static_unfixable.rs:15:26
@@ -59,8 +61,9 @@ LL |     static mut LAZY_BAZ: Lazy = Lazy::new(|| "baz".to_uppercase());
    |
 help: use `std::sync::LazyLock` instead
    |
-LL |     static mut LAZY_BAZ: std::sync::LazyLock = std::sync::LazyLock::new(|| "baz".to_uppercase());
-   |                          ~~~~~~~~~~~~~~~~~~~           ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     static mut LAZY_BAZ: Lazy = Lazy::new(|| "baz".to_uppercase());
+LL +     static mut LAZY_BAZ: std::sync::LazyLock = std::sync::LazyLock::new(|| "baz".to_uppercase());
+   |
 
 error: aborting due to 6 previous errors
 
diff --git a/src/tools/clippy/tests/ui/nonminimal_bool.stderr b/src/tools/clippy/tests/ui/nonminimal_bool.stderr
index 578f918f0139..56d6eb10ac03 100644
--- a/src/tools/clippy/tests/ui/nonminimal_bool.stderr
+++ b/src/tools/clippy/tests/ui/nonminimal_bool.stderr
@@ -51,10 +51,12 @@ LL |     let _ = a == b && c == 5 && a == b;
    |
 help: try
    |
-LL |     let _ = !(a != b || c != 5);
-   |             ~~~~~~~~~~~~~~~~~~~
-LL |     let _ = a == b && c == 5;
-   |             ~~~~~~~~~~~~~~~~
+LL -     let _ = a == b && c == 5 && a == b;
+LL +     let _ = !(a != b || c != 5);
+   |
+LL -     let _ = a == b && c == 5 && a == b;
+LL +     let _ = a == b && c == 5;
+   |
 
 error: this boolean expression can be simplified
   --> tests/ui/nonminimal_bool.rs:44:13
@@ -64,10 +66,12 @@ LL |     let _ = a == b || c == 5 || a == b;
    |
 help: try
    |
-LL |     let _ = !(a != b && c != 5);
-   |             ~~~~~~~~~~~~~~~~~~~
-LL |     let _ = a == b || c == 5;
-   |             ~~~~~~~~~~~~~~~~
+LL -     let _ = a == b || c == 5 || a == b;
+LL +     let _ = !(a != b && c != 5);
+   |
+LL -     let _ = a == b || c == 5 || a == b;
+LL +     let _ = a == b || c == 5;
+   |
 
 error: this boolean expression can be simplified
   --> tests/ui/nonminimal_bool.rs:46:13
@@ -77,10 +81,12 @@ LL |     let _ = a == b && c == 5 && b == a;
    |
 help: try
    |
-LL |     let _ = !(a != b || c != 5);
-   |             ~~~~~~~~~~~~~~~~~~~
-LL |     let _ = a == b && c == 5;
-   |             ~~~~~~~~~~~~~~~~
+LL -     let _ = a == b && c == 5 && b == a;
+LL +     let _ = !(a != b || c != 5);
+   |
+LL -     let _ = a == b && c == 5 && b == a;
+LL +     let _ = a == b && c == 5;
+   |
 
 error: this boolean expression can be simplified
   --> tests/ui/nonminimal_bool.rs:48:13
@@ -90,10 +96,12 @@ LL |     let _ = a != b || !(a != b || c == d);
    |
 help: try
    |
-LL |     let _ = !(a == b && c == d);
-   |             ~~~~~~~~~~~~~~~~~~~
-LL |     let _ = a != b || c != d;
-   |             ~~~~~~~~~~~~~~~~
+LL -     let _ = a != b || !(a != b || c == d);
+LL +     let _ = !(a == b && c == d);
+   |
+LL -     let _ = a != b || !(a != b || c == d);
+LL +     let _ = a != b || c != d;
+   |
 
 error: this boolean expression can be simplified
   --> tests/ui/nonminimal_bool.rs:50:13
@@ -103,10 +111,12 @@ LL |     let _ = a != b && !(a != b && c == d);
    |
 help: try
    |
-LL |     let _ = !(a == b || c == d);
-   |             ~~~~~~~~~~~~~~~~~~~
-LL |     let _ = a != b && c != d;
-   |             ~~~~~~~~~~~~~~~~
+LL -     let _ = a != b && !(a != b && c == d);
+LL +     let _ = !(a == b || c == d);
+   |
+LL -     let _ = a != b && !(a != b && c == d);
+LL +     let _ = a != b && c != d;
+   |
 
 error: this boolean expression can be simplified
   --> tests/ui/nonminimal_bool.rs:81:8
diff --git a/src/tools/clippy/tests/ui/octal_escapes.stderr b/src/tools/clippy/tests/ui/octal_escapes.stderr
index 9343ba64a30b..c8a89ac8bea4 100644
--- a/src/tools/clippy/tests/ui/octal_escapes.stderr
+++ b/src/tools/clippy/tests/ui/octal_escapes.stderr
@@ -9,12 +9,14 @@ LL |     let _bad1 = "\033[0m";
    = help: to override `-D warnings` add `#[allow(clippy::octal_escapes)]`
 help: if an octal escape is intended, use a hex escape instead
    |
-LL |     let _bad1 = "\x1b[0m";
-   |                  ~~~~
+LL -     let _bad1 = "\033[0m";
+LL +     let _bad1 = "\x1b[0m";
+   |
 help: if a null escape is intended, disambiguate using
    |
-LL |     let _bad1 = "\x0033[0m";
-   |                  ~~~~~~
+LL -     let _bad1 = "\033[0m";
+LL +     let _bad1 = "\x0033[0m";
+   |
 
 error: octal-looking escape in a literal
   --> tests/ui/octal_escapes.rs:6:19
@@ -24,12 +26,14 @@ LL |     let _bad2 = b"\033[0m";
    |
 help: if an octal escape is intended, use a hex escape instead
    |
-LL |     let _bad2 = b"\x1b[0m";
-   |                   ~~~~
+LL -     let _bad2 = b"\033[0m";
+LL +     let _bad2 = b"\x1b[0m";
+   |
 help: if a null escape is intended, disambiguate using
    |
-LL |     let _bad2 = b"\x0033[0m";
-   |                   ~~~~~~
+LL -     let _bad2 = b"\033[0m";
+LL +     let _bad2 = b"\x0033[0m";
+   |
 
 error: octal-looking escape in a literal
   --> tests/ui/octal_escapes.rs:7:20
@@ -39,12 +43,14 @@ LL |     let _bad3 = "\\\033[0m";
    |
 help: if an octal escape is intended, use a hex escape instead
    |
-LL |     let _bad3 = "\\\x1b[0m";
-   |                    ~~~~
+LL -     let _bad3 = "\\\033[0m";
+LL +     let _bad3 = "\\\x1b[0m";
+   |
 help: if a null escape is intended, disambiguate using
    |
-LL |     let _bad3 = "\\\x0033[0m";
-   |                    ~~~~~~
+LL -     let _bad3 = "\\\033[0m";
+LL +     let _bad3 = "\\\x0033[0m";
+   |
 
 error: octal-looking escape in a literal
   --> tests/ui/octal_escapes.rs:9:18
@@ -54,12 +60,14 @@ LL |     let _bad4 = "\01234567";
    |
 help: if an octal escape is intended, use a hex escape instead
    |
-LL |     let _bad4 = "\x0a34567";
-   |                  ~~~~
+LL -     let _bad4 = "\01234567";
+LL +     let _bad4 = "\x0a34567";
+   |
 help: if a null escape is intended, disambiguate using
    |
-LL |     let _bad4 = "\x001234567";
-   |                  ~~~~~~
+LL -     let _bad4 = "\01234567";
+LL +     let _bad4 = "\x001234567";
+   |
 
 error: octal-looking escape in a literal
   --> tests/ui/octal_escapes.rs:10:20
@@ -69,12 +77,14 @@ LL |     let _bad5 = "\0\03";
    |
 help: if an octal escape is intended, use a hex escape instead
    |
-LL |     let _bad5 = "\0\x03";
-   |                    ~~~~
+LL -     let _bad5 = "\0\03";
+LL +     let _bad5 = "\0\x03";
+   |
 help: if a null escape is intended, disambiguate using
    |
-LL |     let _bad5 = "\0\x0003";
-   |                    ~~~~~~
+LL -     let _bad5 = "\0\03";
+LL +     let _bad5 = "\0\x0003";
+   |
 
 error: octal-looking escape in a literal
   --> tests/ui/octal_escapes.rs:11:23
@@ -84,12 +94,14 @@ LL |     let _bad6 = "Text-\055\077-MoreText";
    |
 help: if an octal escape is intended, use a hex escape instead
    |
-LL |     let _bad6 = "Text-\x2d\077-MoreText";
-   |                       ~~~~
+LL -     let _bad6 = "Text-\055\077-MoreText";
+LL +     let _bad6 = "Text-\x2d\077-MoreText";
+   |
 help: if a null escape is intended, disambiguate using
    |
-LL |     let _bad6 = "Text-\x0055\077-MoreText";
-   |                       ~~~~~~
+LL -     let _bad6 = "Text-\055\077-MoreText";
+LL +     let _bad6 = "Text-\x0055\077-MoreText";
+   |
 
 error: octal-looking escape in a literal
   --> tests/ui/octal_escapes.rs:11:27
@@ -99,12 +111,14 @@ LL |     let _bad6 = "Text-\055\077-MoreText";
    |
 help: if an octal escape is intended, use a hex escape instead
    |
-LL |     let _bad6 = "Text-\055\x3f-MoreText";
-   |                           ~~~~
+LL -     let _bad6 = "Text-\055\077-MoreText";
+LL +     let _bad6 = "Text-\055\x3f-MoreText";
+   |
 help: if a null escape is intended, disambiguate using
    |
-LL |     let _bad6 = "Text-\055\x0077-MoreText";
-   |                           ~~~~~~
+LL -     let _bad6 = "Text-\055\077-MoreText";
+LL +     let _bad6 = "Text-\055\x0077-MoreText";
+   |
 
 error: octal-looking escape in a literal
   --> tests/ui/octal_escapes.rs:14:31
@@ -114,12 +128,14 @@ LL |     let _bad7 = "EvenMoreText-\01\02-ShortEscapes";
    |
 help: if an octal escape is intended, use a hex escape instead
    |
-LL |     let _bad7 = "EvenMoreText-\x01\02-ShortEscapes";
-   |                               ~~~~
+LL -     let _bad7 = "EvenMoreText-\01\02-ShortEscapes";
+LL +     let _bad7 = "EvenMoreText-\x01\02-ShortEscapes";
+   |
 help: if a null escape is intended, disambiguate using
    |
-LL |     let _bad7 = "EvenMoreText-\x0001\02-ShortEscapes";
-   |                               ~~~~~~
+LL -     let _bad7 = "EvenMoreText-\01\02-ShortEscapes";
+LL +     let _bad7 = "EvenMoreText-\x0001\02-ShortEscapes";
+   |
 
 error: octal-looking escape in a literal
   --> tests/ui/octal_escapes.rs:14:34
@@ -129,12 +145,14 @@ LL |     let _bad7 = "EvenMoreText-\01\02-ShortEscapes";
    |
 help: if an octal escape is intended, use a hex escape instead
    |
-LL |     let _bad7 = "EvenMoreText-\01\x02-ShortEscapes";
-   |                                  ~~~~
+LL -     let _bad7 = "EvenMoreText-\01\02-ShortEscapes";
+LL +     let _bad7 = "EvenMoreText-\01\x02-ShortEscapes";
+   |
 help: if a null escape is intended, disambiguate using
    |
-LL |     let _bad7 = "EvenMoreText-\01\x0002-ShortEscapes";
-   |                                  ~~~~~~
+LL -     let _bad7 = "EvenMoreText-\01\02-ShortEscapes";
+LL +     let _bad7 = "EvenMoreText-\01\x0002-ShortEscapes";
+   |
 
 error: octal-looking escape in a literal
   --> tests/ui/octal_escapes.rs:17:19
@@ -144,12 +162,14 @@ LL |     let _bad8 = "锈\01锈";
    |
 help: if an octal escape is intended, use a hex escape instead
    |
-LL |     let _bad8 = "锈\x01锈";
-   |                    ~~~~
+LL -     let _bad8 = "锈\01锈";
+LL +     let _bad8 = "锈\x01锈";
+   |
 help: if a null escape is intended, disambiguate using
    |
-LL |     let _bad8 = "锈\x0001锈";
-   |                    ~~~~~~
+LL -     let _bad8 = "锈\01锈";
+LL +     let _bad8 = "锈\x0001锈";
+   |
 
 error: octal-looking escape in a literal
   --> tests/ui/octal_escapes.rs:18:19
@@ -159,12 +179,14 @@ LL |     let _bad9 = "锈\011锈";
    |
 help: if an octal escape is intended, use a hex escape instead
    |
-LL |     let _bad9 = "锈\x09锈";
-   |                    ~~~~
+LL -     let _bad9 = "锈\011锈";
+LL +     let _bad9 = "锈\x09锈";
+   |
 help: if a null escape is intended, disambiguate using
    |
-LL |     let _bad9 = "锈\x0011锈";
-   |                    ~~~~~~
+LL -     let _bad9 = "锈\011锈";
+LL +     let _bad9 = "锈\x0011锈";
+   |
 
 error: aborting due to 11 previous errors
 
diff --git a/src/tools/clippy/tests/ui/op_ref.stderr b/src/tools/clippy/tests/ui/op_ref.stderr
index c5b68730a8f2..ad002437c0c6 100644
--- a/src/tools/clippy/tests/ui/op_ref.stderr
+++ b/src/tools/clippy/tests/ui/op_ref.stderr
@@ -8,8 +8,9 @@ LL |     let foo = &5 - &6;
    = help: to override `-D warnings` add `#[allow(clippy::op_ref)]`
 help: use the values directly
    |
-LL |     let foo = 5 - 6;
-   |               ~   ~
+LL -     let foo = &5 - &6;
+LL +     let foo = 5 - 6;
+   |
 
 error: taken reference of right operand
   --> tests/ui/op_ref.rs:58:13
diff --git a/src/tools/clippy/tests/ui/option_as_ref_cloned.stderr b/src/tools/clippy/tests/ui/option_as_ref_cloned.stderr
index 5892f2bdec56..0eda42b91b96 100644
--- a/src/tools/clippy/tests/ui/option_as_ref_cloned.stderr
+++ b/src/tools/clippy/tests/ui/option_as_ref_cloned.stderr
@@ -8,8 +8,9 @@ LL |     let _: Option = x.as_ref().cloned();
    = help: to override `-D warnings` add `#[allow(clippy::option_as_ref_cloned)]`
 help: this can be written more concisely by cloning the `Option<_>` directly
    |
-LL |     let _: Option = x.clone();
-   |                               ~~~~~
+LL -     let _: Option = x.as_ref().cloned();
+LL +     let _: Option = x.clone();
+   |
 
 error: cloning an `Option<_>` using `.as_mut().cloned()`
   --> tests/ui/option_as_ref_cloned.rs:8:31
@@ -19,8 +20,9 @@ LL |     let _: Option = x.as_mut().cloned();
    |
 help: this can be written more concisely by cloning the `Option<_>` directly
    |
-LL |     let _: Option = x.clone();
-   |                               ~~~~~
+LL -     let _: Option = x.as_mut().cloned();
+LL +     let _: Option = x.clone();
+   |
 
 error: cloning an `Option<_>` using `.as_ref().cloned()`
   --> tests/ui/option_as_ref_cloned.rs:11:32
@@ -30,8 +32,9 @@ LL |     let _: Option<&String> = y.as_ref().cloned();
    |
 help: this can be written more concisely by cloning the `Option<_>` directly
    |
-LL |     let _: Option<&String> = y.clone();
-   |                                ~~~~~
+LL -     let _: Option<&String> = y.as_ref().cloned();
+LL +     let _: Option<&String> = y.clone();
+   |
 
 error: aborting due to 3 previous errors
 
diff --git a/src/tools/clippy/tests/ui/redundant_guards.stderr b/src/tools/clippy/tests/ui/redundant_guards.stderr
index 7512546450b2..a10cd5c2f481 100644
--- a/src/tools/clippy/tests/ui/redundant_guards.stderr
+++ b/src/tools/clippy/tests/ui/redundant_guards.stderr
@@ -44,8 +44,9 @@ LL |         Some(x) if matches!(x, Some(1) if true) => ..,
    |
 help: try
    |
-LL |         Some(Some(1)) if true => ..,
-   |              ~~~~~~~  ~~~~~~~
+LL -         Some(x) if matches!(x, Some(1) if true) => ..,
+LL +         Some(Some(1)) if true => ..,
+   |
 
 error: redundant guard
   --> tests/ui/redundant_guards.rs:50:20
diff --git a/src/tools/clippy/tests/ui/ref_binding_to_reference.stderr b/src/tools/clippy/tests/ui/ref_binding_to_reference.stderr
index 25ab98223827..233416351a0a 100644
--- a/src/tools/clippy/tests/ui/ref_binding_to_reference.stderr
+++ b/src/tools/clippy/tests/ui/ref_binding_to_reference.stderr
@@ -8,8 +8,9 @@ LL |         Some(ref x) => x,
    = help: to override `-D warnings` add `#[allow(clippy::ref_binding_to_reference)]`
 help: try
    |
-LL |         Some(x) => &x,
-   |              ~     ~~
+LL -         Some(ref x) => x,
+LL +         Some(x) => &x,
+   |
 
 error: this pattern creates a reference to a reference
   --> tests/ui/ref_binding_to_reference.rs:38:14
@@ -34,8 +35,9 @@ LL |         Some(ref x) => m2!(x),
    |
 help: try
    |
-LL |         Some(x) => m2!(&x),
-   |              ~         ~~
+LL -         Some(ref x) => m2!(x),
+LL +         Some(x) => m2!(&x),
+   |
 
 error: this pattern creates a reference to a reference
   --> tests/ui/ref_binding_to_reference.rs:55:15
diff --git a/src/tools/clippy/tests/ui/ref_option/ref_option.all.stderr b/src/tools/clippy/tests/ui/ref_option/ref_option.all.stderr
index b4c69ac62962..fd30628bdd81 100644
--- a/src/tools/clippy/tests/ui/ref_option/ref_option.all.stderr
+++ b/src/tools/clippy/tests/ui/ref_option/ref_option.all.stderr
@@ -55,8 +55,9 @@ LL | fn mult_string(a: &Option, b: &Option>) {}
    |
 help: change this to
    |
-LL | fn mult_string(a: Option<&String>, b: Option<&Vec>) {}
-   |                   ~~~~~~~~~~~~~~~     ~~~~~~~~~~~~~~~~
+LL - fn mult_string(a: &Option, b: &Option>) {}
+LL + fn mult_string(a: Option<&String>, b: Option<&Vec>) {}
+   |
 
 error: it is more idiomatic to use `Option<&T>` instead of `&Option`
   --> tests/ui/ref_option/ref_option.rs:18:1
@@ -85,8 +86,9 @@ LL | pub fn pub_mult_string(a: &Option, b: &Option>) {}
    |
 help: change this to
    |
-LL | pub fn pub_mult_string(a: Option<&String>, b: Option<&Vec>) {}
-   |                           ~~~~~~~~~~~~~~~     ~~~~~~~~~~~~~~~~
+LL - pub fn pub_mult_string(a: &Option, b: &Option>) {}
+LL + pub fn pub_mult_string(a: Option<&String>, b: Option<&Vec>) {}
+   |
 
 error: it is more idiomatic to use `Option<&T>` instead of `&Option`
   --> tests/ui/ref_option/ref_option.rs:26:5
diff --git a/src/tools/clippy/tests/ui/ref_option/ref_option.private.stderr b/src/tools/clippy/tests/ui/ref_option/ref_option.private.stderr
index 17c90536da34..d3428f1891f3 100644
--- a/src/tools/clippy/tests/ui/ref_option/ref_option.private.stderr
+++ b/src/tools/clippy/tests/ui/ref_option/ref_option.private.stderr
@@ -55,8 +55,9 @@ LL | fn mult_string(a: &Option, b: &Option>) {}
    |
 help: change this to
    |
-LL | fn mult_string(a: Option<&String>, b: Option<&Vec>) {}
-   |                   ~~~~~~~~~~~~~~~     ~~~~~~~~~~~~~~~~
+LL - fn mult_string(a: &Option, b: &Option>) {}
+LL + fn mult_string(a: Option<&String>, b: Option<&Vec>) {}
+   |
 
 error: it is more idiomatic to use `Option<&T>` instead of `&Option`
   --> tests/ui/ref_option/ref_option.rs:18:1
diff --git a/src/tools/clippy/tests/ui/repeat_vec_with_capacity.stderr b/src/tools/clippy/tests/ui/repeat_vec_with_capacity.stderr
index 43027c9cb892..05513a8859a4 100644
--- a/src/tools/clippy/tests/ui/repeat_vec_with_capacity.stderr
+++ b/src/tools/clippy/tests/ui/repeat_vec_with_capacity.stderr
@@ -9,8 +9,9 @@ LL |         vec![Vec::<()>::with_capacity(42); 123];
    = help: to override `-D warnings` add `#[allow(clippy::repeat_vec_with_capacity)]`
 help: if you intended to initialize multiple `Vec`s with an initial capacity, try
    |
-LL |         (0..123).map(|_| Vec::<()>::with_capacity(42)).collect::>();
-   |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -         vec![Vec::<()>::with_capacity(42); 123];
+LL +         (0..123).map(|_| Vec::<()>::with_capacity(42)).collect::>();
+   |
 
 error: repeating `Vec::with_capacity` using `vec![x; n]`, which does not retain capacity
   --> tests/ui/repeat_vec_with_capacity.rs:12:9
@@ -21,8 +22,9 @@ LL |         vec![Vec::<()>::with_capacity(42); n];
    = note: only the last `Vec` will have the capacity
 help: if you intended to initialize multiple `Vec`s with an initial capacity, try
    |
-LL |         (0..n).map(|_| Vec::<()>::with_capacity(42)).collect::>();
-   |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -         vec![Vec::<()>::with_capacity(42); n];
+LL +         (0..n).map(|_| Vec::<()>::with_capacity(42)).collect::>();
+   |
 
 error: repeating `Vec::with_capacity` using `iter::repeat`, which does not retain capacity
   --> tests/ui/repeat_vec_with_capacity.rs:27:9
@@ -33,8 +35,9 @@ LL |         std::iter::repeat(Vec::<()>::with_capacity(42));
    = note: none of the yielded `Vec`s will have the requested capacity
 help: if you intended to create an iterator that yields `Vec`s with an initial capacity, try
    |
-LL |         std::iter::repeat_with(|| Vec::<()>::with_capacity(42));
-   |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -         std::iter::repeat(Vec::<()>::with_capacity(42));
+LL +         std::iter::repeat_with(|| Vec::<()>::with_capacity(42));
+   |
 
 error: aborting due to 3 previous errors
 
diff --git a/src/tools/clippy/tests/ui/repeat_vec_with_capacity_nostd.stderr b/src/tools/clippy/tests/ui/repeat_vec_with_capacity_nostd.stderr
index 39364d09b961..092167485ced 100644
--- a/src/tools/clippy/tests/ui/repeat_vec_with_capacity_nostd.stderr
+++ b/src/tools/clippy/tests/ui/repeat_vec_with_capacity_nostd.stderr
@@ -9,8 +9,9 @@ LL |     let _: Vec> = iter::repeat(Vec::with_capacity(42)).take(123).co
    = help: to override `-D warnings` add `#[allow(clippy::repeat_vec_with_capacity)]`
 help: if you intended to create an iterator that yields `Vec`s with an initial capacity, try
    |
-LL |     let _: Vec> = core::iter::repeat_with(|| Vec::with_capacity(42)).take(123).collect();
-   |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _: Vec> = iter::repeat(Vec::with_capacity(42)).take(123).collect();
+LL +     let _: Vec> = core::iter::repeat_with(|| Vec::with_capacity(42)).take(123).collect();
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/src/tools/clippy/tests/ui/reversed_empty_ranges_fixable.stderr b/src/tools/clippy/tests/ui/reversed_empty_ranges_fixable.stderr
index 3747eb9deebc..24cb959c96af 100644
--- a/src/tools/clippy/tests/ui/reversed_empty_ranges_fixable.stderr
+++ b/src/tools/clippy/tests/ui/reversed_empty_ranges_fixable.stderr
@@ -8,8 +8,9 @@ LL |     (42..=21).for_each(|x| println!("{}", x));
    = help: to override `-D warnings` add `#[allow(clippy::reversed_empty_ranges)]`
 help: consider using the following if you are attempting to iterate over this range in reverse
    |
-LL |     (21..=42).rev().for_each(|x| println!("{}", x));
-   |     ~~~~~~~~~~~~~~~
+LL -     (42..=21).for_each(|x| println!("{}", x));
+LL +     (21..=42).rev().for_each(|x| println!("{}", x));
+   |
 
 error: this range is empty so it will yield no values
   --> tests/ui/reversed_empty_ranges_fixable.rs:10:13
@@ -19,8 +20,9 @@ LL |     let _ = (ANSWER..21).filter(|x| x % 2 == 0).take(10).collect::>(
    |
 help: consider using the following if you are attempting to iterate over this range in reverse
    |
-LL |     let _ = (21..ANSWER).rev().filter(|x| x % 2 == 0).take(10).collect::>();
-   |             ~~~~~~~~~~~~~~~~~~
+LL -     let _ = (ANSWER..21).filter(|x| x % 2 == 0).take(10).collect::>();
+LL +     let _ = (21..ANSWER).rev().filter(|x| x % 2 == 0).take(10).collect::>();
+   |
 
 error: this range is empty so it will yield no values
   --> tests/ui/reversed_empty_ranges_fixable.rs:12:14
@@ -30,8 +32,9 @@ LL |     for _ in -21..=-42 {}
    |
 help: consider using the following if you are attempting to iterate over this range in reverse
    |
-LL |     for _ in (-42..=-21).rev() {}
-   |              ~~~~~~~~~~~~~~~~~
+LL -     for _ in -21..=-42 {}
+LL +     for _ in (-42..=-21).rev() {}
+   |
 
 error: this range is empty so it will yield no values
   --> tests/ui/reversed_empty_ranges_fixable.rs:13:14
@@ -41,8 +44,9 @@ LL |     for _ in 42u32..21u32 {}
    |
 help: consider using the following if you are attempting to iterate over this range in reverse
    |
-LL |     for _ in (21u32..42u32).rev() {}
-   |              ~~~~~~~~~~~~~~~~~~~~
+LL -     for _ in 42u32..21u32 {}
+LL +     for _ in (21u32..42u32).rev() {}
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/src/tools/clippy/tests/ui/reversed_empty_ranges_loops_fixable.stderr b/src/tools/clippy/tests/ui/reversed_empty_ranges_loops_fixable.stderr
index d5df34c42f4f..3e9ccb653fe7 100644
--- a/src/tools/clippy/tests/ui/reversed_empty_ranges_loops_fixable.stderr
+++ b/src/tools/clippy/tests/ui/reversed_empty_ranges_loops_fixable.stderr
@@ -8,8 +8,9 @@ LL |     for i in 10..0 {
    = help: to override `-D warnings` add `#[allow(clippy::reversed_empty_ranges)]`
 help: consider using the following if you are attempting to iterate over this range in reverse
    |
-LL |     for i in (0..10).rev() {
-   |              ~~~~~~~~~~~~~
+LL -     for i in 10..0 {
+LL +     for i in (0..10).rev() {
+   |
 
 error: this range is empty so it will yield no values
   --> tests/ui/reversed_empty_ranges_loops_fixable.rs:11:14
@@ -19,8 +20,9 @@ LL |     for i in 10..=0 {
    |
 help: consider using the following if you are attempting to iterate over this range in reverse
    |
-LL |     for i in (0..=10).rev() {
-   |              ~~~~~~~~~~~~~~
+LL -     for i in 10..=0 {
+LL +     for i in (0..=10).rev() {
+   |
 
 error: this range is empty so it will yield no values
   --> tests/ui/reversed_empty_ranges_loops_fixable.rs:15:14
@@ -30,8 +32,9 @@ LL |     for i in MAX_LEN..0 {
    |
 help: consider using the following if you are attempting to iterate over this range in reverse
    |
-LL |     for i in (0..MAX_LEN).rev() {
-   |              ~~~~~~~~~~~~~~~~~~
+LL -     for i in MAX_LEN..0 {
+LL +     for i in (0..MAX_LEN).rev() {
+   |
 
 error: this range is empty so it will yield no values
   --> tests/ui/reversed_empty_ranges_loops_fixable.rs:34:14
@@ -41,8 +44,9 @@ LL |     for i in (10..0).map(|x| x * 2) {
    |
 help: consider using the following if you are attempting to iterate over this range in reverse
    |
-LL |     for i in (0..10).rev().map(|x| x * 2) {
-   |              ~~~~~~~~~~~~~
+LL -     for i in (10..0).map(|x| x * 2) {
+LL +     for i in (0..10).rev().map(|x| x * 2) {
+   |
 
 error: this range is empty so it will yield no values
   --> tests/ui/reversed_empty_ranges_loops_fixable.rs:39:14
@@ -52,8 +56,9 @@ LL |     for i in 10..5 + 4 {
    |
 help: consider using the following if you are attempting to iterate over this range in reverse
    |
-LL |     for i in (5 + 4..10).rev() {
-   |              ~~~~~~~~~~~~~~~~~
+LL -     for i in 10..5 + 4 {
+LL +     for i in (5 + 4..10).rev() {
+   |
 
 error: this range is empty so it will yield no values
   --> tests/ui/reversed_empty_ranges_loops_fixable.rs:43:14
@@ -63,8 +68,9 @@ LL |     for i in (5 + 2)..(3 - 1) {
    |
 help: consider using the following if you are attempting to iterate over this range in reverse
    |
-LL |     for i in ((3 - 1)..(5 + 2)).rev() {
-   |              ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     for i in (5 + 2)..(3 - 1) {
+LL +     for i in ((3 - 1)..(5 + 2)).rev() {
+   |
 
 error: aborting due to 6 previous errors
 
diff --git a/src/tools/clippy/tests/ui/single_range_in_vec_init.stderr b/src/tools/clippy/tests/ui/single_range_in_vec_init.stderr
index 9c125adb51a7..b3bc8dd4aca1 100644
--- a/src/tools/clippy/tests/ui/single_range_in_vec_init.stderr
+++ b/src/tools/clippy/tests/ui/single_range_in_vec_init.stderr
@@ -8,12 +8,14 @@ LL |     [0..200];
    = help: to override `-D warnings` add `#[allow(clippy::single_range_in_vec_init)]`
 help: if you wanted a `Vec` that contains the entire range, try
    |
-LL |     (0..200).collect::>();
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     [0..200];
+LL +     (0..200).collect::>();
+   |
 help: if you wanted an array of len 200, try
    |
-LL |     [0; 200];
-   |      ~~~~~~
+LL -     [0..200];
+LL +     [0; 200];
+   |
 
 error: a `Vec` of `Range` that is only one element
   --> tests/ui/single_range_in_vec_init.rs:27:5
@@ -23,12 +25,14 @@ LL |     vec![0..200];
    |
 help: if you wanted a `Vec` that contains the entire range, try
    |
-LL |     (0..200).collect::>();
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     vec![0..200];
+LL +     (0..200).collect::>();
+   |
 help: if you wanted a `Vec` of len 200, try
    |
-LL |     vec![0; 200];
-   |          ~~~~~~
+LL -     vec![0..200];
+LL +     vec![0; 200];
+   |
 
 error: an array of `Range` that is only one element
   --> tests/ui/single_range_in_vec_init.rs:28:5
@@ -38,12 +42,14 @@ LL |     [0u8..200];
    |
 help: if you wanted a `Vec` that contains the entire range, try
    |
-LL |     (0u8..200).collect::>();
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     [0u8..200];
+LL +     (0u8..200).collect::>();
+   |
 help: if you wanted an array of len 200, try
    |
-LL |     [0u8; 200];
-   |      ~~~~~~~~
+LL -     [0u8..200];
+LL +     [0u8; 200];
+   |
 
 error: an array of `Range` that is only one element
   --> tests/ui/single_range_in_vec_init.rs:29:5
@@ -53,12 +59,14 @@ LL |     [0usize..200];
    |
 help: if you wanted a `Vec` that contains the entire range, try
    |
-LL |     (0usize..200).collect::>();
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     [0usize..200];
+LL +     (0usize..200).collect::>();
+   |
 help: if you wanted an array of len 200, try
    |
-LL |     [0usize; 200];
-   |      ~~~~~~~~~~~
+LL -     [0usize..200];
+LL +     [0usize; 200];
+   |
 
 error: an array of `Range` that is only one element
   --> tests/ui/single_range_in_vec_init.rs:30:5
@@ -68,12 +76,14 @@ LL |     [0..200usize];
    |
 help: if you wanted a `Vec` that contains the entire range, try
    |
-LL |     (0..200usize).collect::>();
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     [0..200usize];
+LL +     (0..200usize).collect::>();
+   |
 help: if you wanted an array of len 200usize, try
    |
-LL |     [0; 200usize];
-   |      ~~~~~~~~~~~
+LL -     [0..200usize];
+LL +     [0; 200usize];
+   |
 
 error: a `Vec` of `Range` that is only one element
   --> tests/ui/single_range_in_vec_init.rs:31:5
@@ -83,12 +93,14 @@ LL |     vec![0u8..200];
    |
 help: if you wanted a `Vec` that contains the entire range, try
    |
-LL |     (0u8..200).collect::>();
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     vec![0u8..200];
+LL +     (0u8..200).collect::>();
+   |
 help: if you wanted a `Vec` of len 200, try
    |
-LL |     vec![0u8; 200];
-   |          ~~~~~~~~
+LL -     vec![0u8..200];
+LL +     vec![0u8; 200];
+   |
 
 error: a `Vec` of `Range` that is only one element
   --> tests/ui/single_range_in_vec_init.rs:32:5
@@ -98,12 +110,14 @@ LL |     vec![0usize..200];
    |
 help: if you wanted a `Vec` that contains the entire range, try
    |
-LL |     (0usize..200).collect::>();
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     vec![0usize..200];
+LL +     (0usize..200).collect::>();
+   |
 help: if you wanted a `Vec` of len 200, try
    |
-LL |     vec![0usize; 200];
-   |          ~~~~~~~~~~~
+LL -     vec![0usize..200];
+LL +     vec![0usize; 200];
+   |
 
 error: a `Vec` of `Range` that is only one element
   --> tests/ui/single_range_in_vec_init.rs:33:5
@@ -113,12 +127,14 @@ LL |     vec![0..200usize];
    |
 help: if you wanted a `Vec` that contains the entire range, try
    |
-LL |     (0..200usize).collect::>();
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     vec![0..200usize];
+LL +     (0..200usize).collect::>();
+   |
 help: if you wanted a `Vec` of len 200usize, try
    |
-LL |     vec![0; 200usize];
-   |          ~~~~~~~~~~~
+LL -     vec![0..200usize];
+LL +     vec![0; 200usize];
+   |
 
 error: an array of `Range` that is only one element
   --> tests/ui/single_range_in_vec_init.rs:35:5
@@ -128,8 +144,9 @@ LL |     [0..200isize];
    |
 help: if you wanted a `Vec` that contains the entire range, try
    |
-LL |     (0..200isize).collect::>();
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     [0..200isize];
+LL +     (0..200isize).collect::>();
+   |
 
 error: a `Vec` of `Range` that is only one element
   --> tests/ui/single_range_in_vec_init.rs:36:5
@@ -139,8 +156,9 @@ LL |     vec![0..200isize];
    |
 help: if you wanted a `Vec` that contains the entire range, try
    |
-LL |     (0..200isize).collect::>();
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     vec![0..200isize];
+LL +     (0..200isize).collect::>();
+   |
 
 error: aborting due to 10 previous errors
 
diff --git a/src/tools/clippy/tests/ui/string_lit_chars_any.stderr b/src/tools/clippy/tests/ui/string_lit_chars_any.stderr
index 4d3ca98e6237..1e28ae7b163e 100644
--- a/src/tools/clippy/tests/ui/string_lit_chars_any.stderr
+++ b/src/tools/clippy/tests/ui/string_lit_chars_any.stderr
@@ -8,8 +8,9 @@ LL |     "\\.+*?()|[]{}^$#&-~".chars().any(|x| x == c);
    = help: to override `-D warnings` add `#[allow(clippy::string_lit_chars_any)]`
 help: use `matches!(...)` instead
    |
-LL |     matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     "\\.+*?()|[]{}^$#&-~".chars().any(|x| x == c);
+LL +     matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
+   |
 
 error: usage of `.chars().any(...)` to check if a char matches any from a string literal
   --> tests/ui/string_lit_chars_any.rs:19:5
@@ -19,8 +20,9 @@ LL |     r#"\.+*?()|[]{}^$#&-~"#.chars().any(|x| x == c);
    |
 help: use `matches!(...)` instead
    |
-LL |     matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     r#"\.+*?()|[]{}^$#&-~"#.chars().any(|x| x == c);
+LL +     matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
+   |
 
 error: usage of `.chars().any(...)` to check if a char matches any from a string literal
   --> tests/ui/string_lit_chars_any.rs:20:5
@@ -30,8 +32,9 @@ LL |     "\\.+*?()|[]{}^$#&-~".chars().any(|x| c == x);
    |
 help: use `matches!(...)` instead
    |
-LL |     matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     "\\.+*?()|[]{}^$#&-~".chars().any(|x| c == x);
+LL +     matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
+   |
 
 error: usage of `.chars().any(...)` to check if a char matches any from a string literal
   --> tests/ui/string_lit_chars_any.rs:21:5
@@ -41,8 +44,9 @@ LL |     r#"\.+*?()|[]{}^$#&-~"#.chars().any(|x| c == x);
    |
 help: use `matches!(...)` instead
    |
-LL |     matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     r#"\.+*?()|[]{}^$#&-~"#.chars().any(|x| c == x);
+LL +     matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
+   |
 
 error: usage of `.chars().any(...)` to check if a char matches any from a string literal
   --> tests/ui/string_lit_chars_any.rs:23:5
@@ -52,8 +56,9 @@ LL |     "\\.+*?()|[]{}^$#&-~".chars().any(|x| { x == c });
    |
 help: use `matches!(...)` instead
    |
-LL |     matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     "\\.+*?()|[]{}^$#&-~".chars().any(|x| { x == c });
+LL +     matches!(c, '\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
+   |
 
 error: aborting due to 5 previous errors
 
diff --git a/src/tools/clippy/tests/ui/suspicious_command_arg_space.stderr b/src/tools/clippy/tests/ui/suspicious_command_arg_space.stderr
index 6fd07d07d7be..8952a3ffe4b8 100644
--- a/src/tools/clippy/tests/ui/suspicious_command_arg_space.stderr
+++ b/src/tools/clippy/tests/ui/suspicious_command_arg_space.stderr
@@ -8,8 +8,9 @@ LL |     std::process::Command::new("echo").arg("-n hello").spawn().unwrap();
    = help: to override `-D warnings` add `#[allow(clippy::suspicious_command_arg_space)]`
 help: consider splitting the argument
    |
-LL |     std::process::Command::new("echo").args(["-n", "hello"]).spawn().unwrap();
-   |                                        ~~~~ ~~~~~~~~~~~~~~~
+LL -     std::process::Command::new("echo").arg("-n hello").spawn().unwrap();
+LL +     std::process::Command::new("echo").args(["-n", "hello"]).spawn().unwrap();
+   |
 
 error: single argument that looks like it should be multiple arguments
   --> tests/ui/suspicious_command_arg_space.rs:7:43
@@ -19,8 +20,9 @@ LL |     std::process::Command::new("cat").arg("--number file").spawn().unwrap()
    |
 help: consider splitting the argument
    |
-LL |     std::process::Command::new("cat").args(["--number", "file"]).spawn().unwrap();
-   |                                       ~~~~ ~~~~~~~~~~~~~~~~~~~~
+LL -     std::process::Command::new("cat").arg("--number file").spawn().unwrap();
+LL +     std::process::Command::new("cat").args(["--number", "file"]).spawn().unwrap();
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/src/tools/clippy/tests/ui/suspicious_doc_comments.stderr b/src/tools/clippy/tests/ui/suspicious_doc_comments.stderr
index c34e39cd0fcb..7e5933df2376 100644
--- a/src/tools/clippy/tests/ui/suspicious_doc_comments.stderr
+++ b/src/tools/clippy/tests/ui/suspicious_doc_comments.stderr
@@ -8,7 +8,8 @@ LL | ///! Fake module documentation.
    = help: to override `-D warnings` add `#[allow(clippy::suspicious_doc_comments)]`
 help: use an inner doc comment to document the parent module or crate
    |
-LL | //! Fake module documentation.
+LL - ///! Fake module documentation.
+LL + //! Fake module documentation.
    |
 
 error: this is an outer doc comment and does not apply to the parent module or crate
@@ -19,7 +20,8 @@ LL |     ///! This module contains useful functions.
    |
 help: use an inner doc comment to document the parent module or crate
    |
-LL |     //! This module contains useful functions.
+LL -     ///! This module contains useful functions.
+LL +     //! This module contains useful functions.
    |
 
 error: this is an outer doc comment and does not apply to the parent module or crate
@@ -71,7 +73,8 @@ LL |     ///! a
    |
 help: use an inner doc comment to document the parent module or crate
    |
-LL |     //! a
+LL -     ///! a
+LL +     //! a
    |
 
 error: this is an outer doc comment and does not apply to the parent module or crate
@@ -97,7 +100,8 @@ LL |     ///! Very cool macro
    |
 help: use an inner doc comment to document the parent module or crate
    |
-LL |     //! Very cool macro
+LL -     ///! Very cool macro
+LL +     //! Very cool macro
    |
 
 error: this is an outer doc comment and does not apply to the parent module or crate
@@ -108,7 +112,8 @@ LL |     ///! Huh.
    |
 help: use an inner doc comment to document the parent module or crate
    |
-LL |     //! Huh.
+LL -     ///! Huh.
+LL +     //! Huh.
    |
 
 error: aborting due to 9 previous errors
diff --git a/src/tools/clippy/tests/ui/suspicious_to_owned.stderr b/src/tools/clippy/tests/ui/suspicious_to_owned.stderr
index 255f211e6550..74bbcfcca51e 100644
--- a/src/tools/clippy/tests/ui/suspicious_to_owned.stderr
+++ b/src/tools/clippy/tests/ui/suspicious_to_owned.stderr
@@ -8,12 +8,14 @@ LL |     let _ = cow.to_owned();
    = help: to override `-D warnings` add `#[allow(clippy::suspicious_to_owned)]`
 help: depending on intent, either make the Cow an Owned variant
    |
-LL |     let _ = cow.into_owned();
-   |             ~~~~~~~~~~~~~~~~
+LL -     let _ = cow.to_owned();
+LL +     let _ = cow.into_owned();
+   |
 help: or clone the Cow itself
    |
-LL |     let _ = cow.clone();
-   |             ~~~~~~~~~~~
+LL -     let _ = cow.to_owned();
+LL +     let _ = cow.clone();
+   |
 
 error: this `to_owned` call clones the Cow<'_, [char; 3]> itself and does not cause the Cow<'_, [char; 3]> contents to become owned
   --> tests/ui/suspicious_to_owned.rs:29:13
@@ -23,12 +25,14 @@ LL |     let _ = cow.to_owned();
    |
 help: depending on intent, either make the Cow an Owned variant
    |
-LL |     let _ = cow.into_owned();
-   |             ~~~~~~~~~~~~~~~~
+LL -     let _ = cow.to_owned();
+LL +     let _ = cow.into_owned();
+   |
 help: or clone the Cow itself
    |
-LL |     let _ = cow.clone();
-   |             ~~~~~~~~~~~
+LL -     let _ = cow.to_owned();
+LL +     let _ = cow.clone();
+   |
 
 error: this `to_owned` call clones the Cow<'_, Vec> itself and does not cause the Cow<'_, Vec> contents to become owned
   --> tests/ui/suspicious_to_owned.rs:40:13
@@ -38,12 +42,14 @@ LL |     let _ = cow.to_owned();
    |
 help: depending on intent, either make the Cow an Owned variant
    |
-LL |     let _ = cow.into_owned();
-   |             ~~~~~~~~~~~~~~~~
+LL -     let _ = cow.to_owned();
+LL +     let _ = cow.into_owned();
+   |
 help: or clone the Cow itself
    |
-LL |     let _ = cow.clone();
-   |             ~~~~~~~~~~~
+LL -     let _ = cow.to_owned();
+LL +     let _ = cow.clone();
+   |
 
 error: this `to_owned` call clones the Cow<'_, str> itself and does not cause the Cow<'_, str> contents to become owned
   --> tests/ui/suspicious_to_owned.rs:51:13
@@ -53,12 +59,14 @@ LL |     let _ = cow.to_owned();
    |
 help: depending on intent, either make the Cow an Owned variant
    |
-LL |     let _ = cow.into_owned();
-   |             ~~~~~~~~~~~~~~~~
+LL -     let _ = cow.to_owned();
+LL +     let _ = cow.into_owned();
+   |
 help: or clone the Cow itself
    |
-LL |     let _ = cow.clone();
-   |             ~~~~~~~~~~~
+LL -     let _ = cow.to_owned();
+LL +     let _ = cow.clone();
+   |
 
 error: implicitly cloning a `String` by calling `to_owned` on its dereferenced type
   --> tests/ui/suspicious_to_owned.rs:66:13
diff --git a/src/tools/clippy/tests/ui/suspicious_xor_used_as_pow.stderr b/src/tools/clippy/tests/ui/suspicious_xor_used_as_pow.stderr
index 43b03676b1db..2a153169bd34 100644
--- a/src/tools/clippy/tests/ui/suspicious_xor_used_as_pow.stderr
+++ b/src/tools/clippy/tests/ui/suspicious_xor_used_as_pow.stderr
@@ -8,8 +8,9 @@ LL |     let _ = 2 ^ 5;
    = help: to override `-D warnings` add `#[allow(clippy::suspicious_xor_used_as_pow)]`
 help: did you mean to write
    |
-LL |     let _ = 2.pow(5);
-   |             ~~~~~~~~
+LL -     let _ = 2 ^ 5;
+LL +     let _ = 2.pow(5);
+   |
 
 error: `^` is not the exponentiation operator
   --> tests/ui/suspicious_xor_used_as_pow.rs:22:13
@@ -19,8 +20,9 @@ LL |     let _ = 2i32 ^ 9i32;
    |
 help: did you mean to write
    |
-LL |     let _ = 2i32.pow(9i32);
-   |             ~~~~~~~~~~~~~~
+LL -     let _ = 2i32 ^ 9i32;
+LL +     let _ = 2i32.pow(9i32);
+   |
 
 error: `^` is not the exponentiation operator
   --> tests/ui/suspicious_xor_used_as_pow.rs:24:13
@@ -30,8 +32,9 @@ LL |     let _ = 2i32 ^ 2i32;
    |
 help: did you mean to write
    |
-LL |     let _ = 2i32.pow(2i32);
-   |             ~~~~~~~~~~~~~~
+LL -     let _ = 2i32 ^ 2i32;
+LL +     let _ = 2i32.pow(2i32);
+   |
 
 error: `^` is not the exponentiation operator
   --> tests/ui/suspicious_xor_used_as_pow.rs:26:13
@@ -41,8 +44,9 @@ LL |     let _ = 50i32 ^ 3i32;
    |
 help: did you mean to write
    |
-LL |     let _ = 50i32.pow(3i32);
-   |             ~~~~~~~~~~~~~~~
+LL -     let _ = 50i32 ^ 3i32;
+LL +     let _ = 50i32.pow(3i32);
+   |
 
 error: `^` is not the exponentiation operator
   --> tests/ui/suspicious_xor_used_as_pow.rs:28:13
@@ -52,8 +56,9 @@ LL |     let _ = 5i32 ^ 8i32;
    |
 help: did you mean to write
    |
-LL |     let _ = 5i32.pow(8i32);
-   |             ~~~~~~~~~~~~~~
+LL -     let _ = 5i32 ^ 8i32;
+LL +     let _ = 5i32.pow(8i32);
+   |
 
 error: `^` is not the exponentiation operator
   --> tests/ui/suspicious_xor_used_as_pow.rs:30:13
@@ -63,8 +68,9 @@ LL |     let _ = 2i32 ^ 32i32;
    |
 help: did you mean to write
    |
-LL |     let _ = 2i32.pow(32i32);
-   |             ~~~~~~~~~~~~~~~
+LL -     let _ = 2i32 ^ 32i32;
+LL +     let _ = 2i32.pow(32i32);
+   |
 
 error: `^` is not the exponentiation operator
   --> tests/ui/suspicious_xor_used_as_pow.rs:13:9
@@ -78,8 +84,9 @@ LL |     macro_test_inside!();
    = note: this error originates in the macro `macro_test_inside` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: did you mean to write
    |
-LL |         1.pow(2) // should warn even if inside macro
-   |         ~~~~~~~~
+LL -         1 ^ 2 // should warn even if inside macro
+LL +         1.pow(2) // should warn even if inside macro
+   |
 
 error: aborting due to 7 previous errors
 
diff --git a/src/tools/clippy/tests/ui/transmute_ptr_to_ptr.stderr b/src/tools/clippy/tests/ui/transmute_ptr_to_ptr.stderr
index 8801eb943ce8..f4f83cd7ac6a 100644
--- a/src/tools/clippy/tests/ui/transmute_ptr_to_ptr.stderr
+++ b/src/tools/clippy/tests/ui/transmute_ptr_to_ptr.stderr
@@ -8,8 +8,9 @@ LL |         let _: *const f32 = transmute(ptr);
    = help: to override `-D warnings` add `#[allow(clippy::transmute_ptr_to_ptr)]`
 help: use `pointer::cast` instead
    |
-LL |         let _: *const f32 = ptr.cast::();
-   |                             ~~~~~~~~~~~~~~~~~
+LL -         let _: *const f32 = transmute(ptr);
+LL +         let _: *const f32 = ptr.cast::();
+   |
 
 error: transmute from a pointer to a pointer
   --> tests/ui/transmute_ptr_to_ptr.rs:34:27
@@ -19,8 +20,9 @@ LL |         let _: *mut f32 = transmute(mut_ptr);
    |
 help: use `pointer::cast` instead
    |
-LL |         let _: *mut f32 = mut_ptr.cast::();
-   |                           ~~~~~~~~~~~~~~~~~~~~~
+LL -         let _: *mut f32 = transmute(mut_ptr);
+LL +         let _: *mut f32 = mut_ptr.cast::();
+   |
 
 error: transmute from a reference to a reference
   --> tests/ui/transmute_ptr_to_ptr.rs:37:23
@@ -60,8 +62,9 @@ LL |         let _: *const u32 = transmute(mut_ptr);
    |
 help: use `pointer::cast_const` instead
    |
-LL |         let _: *const u32 = mut_ptr.cast_const();
-   |                             ~~~~~~~~~~~~~~~~~~~~
+LL -         let _: *const u32 = transmute(mut_ptr);
+LL +         let _: *const u32 = mut_ptr.cast_const();
+   |
 
 error: transmute from a pointer to a pointer
   --> tests/ui/transmute_ptr_to_ptr.rs:52:27
@@ -71,8 +74,9 @@ LL |         let _: *mut u32 = transmute(ptr);
    |
 help: use `pointer::cast_mut` instead
    |
-LL |         let _: *mut u32 = ptr.cast_mut();
-   |                           ~~~~~~~~~~~~~~
+LL -         let _: *mut u32 = transmute(ptr);
+LL +         let _: *mut u32 = ptr.cast_mut();
+   |
 
 error: transmute from a pointer to a pointer
   --> tests/ui/transmute_ptr_to_ptr.rs:64:14
@@ -82,8 +86,9 @@ LL |     unsafe { transmute(v) }
    |
 help: use an `as` cast instead
    |
-LL |     unsafe { v as *const &() }
-   |              ~~~~~~~~~~~~~~~
+LL -     unsafe { transmute(v) }
+LL +     unsafe { v as *const &() }
+   |
 
 error: transmute from a pointer to a pointer
   --> tests/ui/transmute_ptr_to_ptr.rs:79:28
@@ -93,8 +98,9 @@ LL |         let _: *const i8 = transmute(ptr);
    |
 help: use an `as` cast instead
    |
-LL |         let _: *const i8 = ptr as *const i8;
-   |                            ~~~~~~~~~~~~~~~~
+LL -         let _: *const i8 = transmute(ptr);
+LL +         let _: *const i8 = ptr as *const i8;
+   |
 
 error: transmute from a pointer to a pointer
   --> tests/ui/transmute_ptr_to_ptr.rs:86:28
@@ -104,8 +110,9 @@ LL |         let _: *const i8 = transmute(ptr);
    |
 help: use `pointer::cast` instead
    |
-LL |         let _: *const i8 = ptr.cast::();
-   |                            ~~~~~~~~~~~~~~~~
+LL -         let _: *const i8 = transmute(ptr);
+LL +         let _: *const i8 = ptr.cast::();
+   |
 
 error: transmute from a pointer to a pointer
   --> tests/ui/transmute_ptr_to_ptr.rs:93:26
@@ -115,8 +122,9 @@ LL |         let _: *mut u8 = transmute(ptr);
    |
 help: use an `as` cast instead
    |
-LL |         let _: *mut u8 = ptr as *mut u8;
-   |                          ~~~~~~~~~~~~~~
+LL -         let _: *mut u8 = transmute(ptr);
+LL +         let _: *mut u8 = ptr as *mut u8;
+   |
 
 error: transmute from a pointer to a pointer
   --> tests/ui/transmute_ptr_to_ptr.rs:94:28
@@ -126,8 +134,9 @@ LL |         let _: *const u8 = transmute(mut_ptr);
    |
 help: use an `as` cast instead
    |
-LL |         let _: *const u8 = mut_ptr as *const u8;
-   |                            ~~~~~~~~~~~~~~~~~~~~
+LL -         let _: *const u8 = transmute(mut_ptr);
+LL +         let _: *const u8 = mut_ptr as *const u8;
+   |
 
 error: transmute from a pointer to a pointer
   --> tests/ui/transmute_ptr_to_ptr.rs:101:26
@@ -137,8 +146,9 @@ LL |         let _: *mut u8 = transmute(ptr);
    |
 help: use `pointer::cast_mut` instead
    |
-LL |         let _: *mut u8 = ptr.cast_mut();
-   |                          ~~~~~~~~~~~~~~
+LL -         let _: *mut u8 = transmute(ptr);
+LL +         let _: *mut u8 = ptr.cast_mut();
+   |
 
 error: transmute from a pointer to a pointer
   --> tests/ui/transmute_ptr_to_ptr.rs:102:28
@@ -148,8 +158,9 @@ LL |         let _: *const u8 = transmute(mut_ptr);
    |
 help: use `pointer::cast_const` instead
    |
-LL |         let _: *const u8 = mut_ptr.cast_const();
-   |                            ~~~~~~~~~~~~~~~~~~~~
+LL -         let _: *const u8 = transmute(mut_ptr);
+LL +         let _: *const u8 = mut_ptr.cast_const();
+   |
 
 error: aborting due to 16 previous errors
 
diff --git a/src/tools/clippy/tests/ui/transmutes_expressible_as_ptr_casts.stderr b/src/tools/clippy/tests/ui/transmutes_expressible_as_ptr_casts.stderr
index 2d74967ede56..21edd39e7ad6 100644
--- a/src/tools/clippy/tests/ui/transmutes_expressible_as_ptr_casts.stderr
+++ b/src/tools/clippy/tests/ui/transmutes_expressible_as_ptr_casts.stderr
@@ -17,8 +17,9 @@ LL |     let _ptr_i8_transmute = unsafe { transmute::<*const i32, *const i8>(ptr
    = help: to override `-D warnings` add `#[allow(clippy::transmute_ptr_to_ptr)]`
 help: use `pointer::cast` instead
    |
-LL |     let _ptr_i8_transmute = unsafe { ptr_i32.cast::() };
-   |                                      ~~~~~~~~~~~~~~~~~~~~
+LL -     let _ptr_i8_transmute = unsafe { transmute::<*const i32, *const i8>(ptr_i32) };
+LL +     let _ptr_i8_transmute = unsafe { ptr_i32.cast::() };
+   |
 
 error: transmute from a pointer to a pointer
   --> tests/ui/transmutes_expressible_as_ptr_casts.rs:27:46
@@ -28,8 +29,9 @@ LL |     let _ptr_to_unsized_transmute = unsafe { transmute::<*const [i32], *con
    |
 help: use an `as` cast instead
    |
-LL |     let _ptr_to_unsized_transmute = unsafe { slice_ptr as *const [u32] };
-   |                                              ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _ptr_to_unsized_transmute = unsafe { transmute::<*const [i32], *const [u32]>(slice_ptr) };
+LL +     let _ptr_to_unsized_transmute = unsafe { slice_ptr as *const [u32] };
+   |
 
 error: transmute from `*const i32` to `usize` which could be expressed as a pointer cast instead
   --> tests/ui/transmutes_expressible_as_ptr_casts.rs:33:50
diff --git a/src/tools/clippy/tests/ui/unit_arg.stderr b/src/tools/clippy/tests/ui/unit_arg.stderr
index 41ad1a2d3834..bf79e93e4440 100644
--- a/src/tools/clippy/tests/ui/unit_arg.stderr
+++ b/src/tools/clippy/tests/ui/unit_arg.stderr
@@ -10,7 +10,8 @@ LL | |     });
    = help: to override `-D warnings` add `#[allow(clippy::unit_arg)]`
 help: remove the semicolon from the last statement in the block
    |
-LL |         1
+LL -         1;
+LL +         1
    |
 help: or move the expression in front of the call and replace it with the unit literal `()`
    |
@@ -43,7 +44,8 @@ LL | |     });
    |
 help: remove the semicolon from the last statement in the block
    |
-LL |         foo(2)
+LL -         foo(2);
+LL +         foo(2)
    |
 help: or move the expression in front of the call and replace it with the unit literal `()`
    |
@@ -64,7 +66,8 @@ LL | |     });
    |
 help: remove the semicolon from the last statement in the block
    |
-LL |         1
+LL -         1;
+LL +         1
    |
 help: or move the expression in front of the call and replace it with the unit literal `()`
    |
@@ -98,7 +101,8 @@ LL | |     });
    |
 help: remove the semicolon from the last statement in the block
    |
-LL |         foo(2)
+LL -         foo(2);
+LL +         foo(2)
    |
 help: or move the expressions in front of the call and replace them with the unit literal `()`
    |
@@ -124,11 +128,13 @@ LL | |     );
    |
 help: remove the semicolon from the last statement in the block
    |
-LL |             foo(1)
+LL -             foo(1);
+LL +             foo(1)
    |
 help: remove the semicolon from the last statement in the block
    |
-LL |             foo(3)
+LL -             foo(3);
+LL +             foo(3)
    |
 help: or move the expressions in front of the call and replace them with the unit literal `()`
    |
diff --git a/src/tools/clippy/tests/ui/unknown_clippy_lints.stderr b/src/tools/clippy/tests/ui/unknown_clippy_lints.stderr
index aa2c2f3c0e20..ea925cd3a9fc 100644
--- a/src/tools/clippy/tests/ui/unknown_clippy_lints.stderr
+++ b/src/tools/clippy/tests/ui/unknown_clippy_lints.stderr
@@ -39,8 +39,9 @@ LL | #[warn(clippy::dead_cod)]
    |
 help: a lint with a similar name exists in `rustc` lints
    |
-LL | #[warn(dead_code)]
-   |        ~~~~~~~~~
+LL - #[warn(clippy::dead_cod)]
+LL + #[warn(dead_code)]
+   |
 
 error: unknown lint: `clippy::unused_colle`
   --> tests/ui/unknown_clippy_lints.rs:13:8
@@ -62,8 +63,9 @@ LL | #[warn(clippy::missing_docs)]
    |
 help: a lint with a similar name exists in `rustc` lints
    |
-LL | #[warn(missing_docs)]
-   |        ~~~~~~~~~~~~
+LL - #[warn(clippy::missing_docs)]
+LL + #[warn(missing_docs)]
+   |
 
 error: aborting due to 9 previous errors
 
diff --git a/src/tools/clippy/tests/ui/unnecessary_lazy_eval.stderr b/src/tools/clippy/tests/ui/unnecessary_lazy_eval.stderr
index 35a2144c389f..9bb1b71f0ed5 100644
--- a/src/tools/clippy/tests/ui/unnecessary_lazy_eval.stderr
+++ b/src/tools/clippy/tests/ui/unnecessary_lazy_eval.stderr
@@ -8,8 +8,9 @@ LL |     let _ = opt.unwrap_or_else(|| 2);
    = help: to override `-D warnings` add `#[allow(clippy::unnecessary_lazy_evaluations)]`
 help: use `unwrap_or` instead
    |
-LL |     let _ = opt.unwrap_or(2);
-   |                 ~~~~~~~~~~~~
+LL -     let _ = opt.unwrap_or_else(|| 2);
+LL +     let _ = opt.unwrap_or(2);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:84:13
@@ -19,8 +20,9 @@ LL |     let _ = opt.unwrap_or_else(|| astronomers_pi);
    |
 help: use `unwrap_or` instead
    |
-LL |     let _ = opt.unwrap_or(astronomers_pi);
-   |                 ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = opt.unwrap_or_else(|| astronomers_pi);
+LL +     let _ = opt.unwrap_or(astronomers_pi);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:85:13
@@ -30,8 +32,9 @@ LL |     let _ = opt.unwrap_or_else(|| ext_str.some_field);
    |
 help: use `unwrap_or` instead
    |
-LL |     let _ = opt.unwrap_or(ext_str.some_field);
-   |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = opt.unwrap_or_else(|| ext_str.some_field);
+LL +     let _ = opt.unwrap_or(ext_str.some_field);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:87:13
@@ -41,8 +44,9 @@ LL |     let _ = opt.and_then(|_| ext_opt);
    |
 help: use `and` instead
    |
-LL |     let _ = opt.and(ext_opt);
-   |                 ~~~~~~~~~~~~
+LL -     let _ = opt.and_then(|_| ext_opt);
+LL +     let _ = opt.and(ext_opt);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:88:13
@@ -52,8 +56,9 @@ LL |     let _ = opt.or_else(|| ext_opt);
    |
 help: use `or` instead
    |
-LL |     let _ = opt.or(ext_opt);
-   |                 ~~~~~~~~~~~
+LL -     let _ = opt.or_else(|| ext_opt);
+LL +     let _ = opt.or(ext_opt);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:89:13
@@ -63,8 +68,9 @@ LL |     let _ = opt.or_else(|| None);
    |
 help: use `or` instead
    |
-LL |     let _ = opt.or(None);
-   |                 ~~~~~~~~
+LL -     let _ = opt.or_else(|| None);
+LL +     let _ = opt.or(None);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:90:13
@@ -74,8 +80,9 @@ LL |     let _ = opt.get_or_insert_with(|| 2);
    |
 help: use `get_or_insert` instead
    |
-LL |     let _ = opt.get_or_insert(2);
-   |                 ~~~~~~~~~~~~~~~~
+LL -     let _ = opt.get_or_insert_with(|| 2);
+LL +     let _ = opt.get_or_insert(2);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:91:13
@@ -85,8 +92,9 @@ LL |     let _ = opt.ok_or_else(|| 2);
    |
 help: use `ok_or` instead
    |
-LL |     let _ = opt.ok_or(2);
-   |                 ~~~~~~~~
+LL -     let _ = opt.ok_or_else(|| 2);
+LL +     let _ = opt.ok_or(2);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:92:13
@@ -96,8 +104,9 @@ LL |     let _ = nested_tuple_opt.unwrap_or_else(|| Some((1, 2)));
    |
 help: use `unwrap_or` instead
    |
-LL |     let _ = nested_tuple_opt.unwrap_or(Some((1, 2)));
-   |                              ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = nested_tuple_opt.unwrap_or_else(|| Some((1, 2)));
+LL +     let _ = nested_tuple_opt.unwrap_or(Some((1, 2)));
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:93:13
@@ -107,8 +116,9 @@ LL |     let _ = cond.then(|| astronomers_pi);
    |
 help: use `then_some` instead
    |
-LL |     let _ = cond.then_some(astronomers_pi);
-   |                  ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = cond.then(|| astronomers_pi);
+LL +     let _ = cond.then_some(astronomers_pi);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:94:13
@@ -118,8 +128,9 @@ LL |     let _ = true.then(|| -> _ {});
    |
 help: use `then_some` instead
    |
-LL |     let _ = true.then_some({});
-   |                  ~~~~~~~~~~~~~
+LL -     let _ = true.then(|| -> _ {});
+LL +     let _ = true.then_some({});
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:95:13
@@ -129,8 +140,9 @@ LL |     let _ = true.then(|| {});
    |
 help: use `then_some` instead
    |
-LL |     let _ = true.then_some({});
-   |                  ~~~~~~~~~~~~~
+LL -     let _ = true.then(|| {});
+LL +     let _ = true.then_some({});
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:99:13
@@ -140,8 +152,9 @@ LL |     let _ = Some(1).unwrap_or_else(|| *r);
    |
 help: use `unwrap_or` instead
    |
-LL |     let _ = Some(1).unwrap_or(*r);
-   |                     ~~~~~~~~~~~~~
+LL -     let _ = Some(1).unwrap_or_else(|| *r);
+LL +     let _ = Some(1).unwrap_or(*r);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:101:13
@@ -151,8 +164,9 @@ LL |     let _ = Some(1).unwrap_or_else(|| *b);
    |
 help: use `unwrap_or` instead
    |
-LL |     let _ = Some(1).unwrap_or(*b);
-   |                     ~~~~~~~~~~~~~
+LL -     let _ = Some(1).unwrap_or_else(|| *b);
+LL +     let _ = Some(1).unwrap_or(*b);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:103:13
@@ -162,8 +176,9 @@ LL |     let _ = Some(1).as_ref().unwrap_or_else(|| &r);
    |
 help: use `unwrap_or` instead
    |
-LL |     let _ = Some(1).as_ref().unwrap_or(&r);
-   |                              ~~~~~~~~~~~~~
+LL -     let _ = Some(1).as_ref().unwrap_or_else(|| &r);
+LL +     let _ = Some(1).as_ref().unwrap_or(&r);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:104:13
@@ -173,8 +188,9 @@ LL |     let _ = Some(1).as_ref().unwrap_or_else(|| &b);
    |
 help: use `unwrap_or` instead
    |
-LL |     let _ = Some(1).as_ref().unwrap_or(&b);
-   |                              ~~~~~~~~~~~~~
+LL -     let _ = Some(1).as_ref().unwrap_or_else(|| &b);
+LL +     let _ = Some(1).as_ref().unwrap_or(&b);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:107:13
@@ -184,8 +200,9 @@ LL |     let _ = Some(10).unwrap_or_else(|| 2);
    |
 help: use `unwrap_or` instead
    |
-LL |     let _ = Some(10).unwrap_or(2);
-   |                      ~~~~~~~~~~~~
+LL -     let _ = Some(10).unwrap_or_else(|| 2);
+LL +     let _ = Some(10).unwrap_or(2);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:108:13
@@ -195,8 +212,9 @@ LL |     let _ = Some(10).and_then(|_| ext_opt);
    |
 help: use `and` instead
    |
-LL |     let _ = Some(10).and(ext_opt);
-   |                      ~~~~~~~~~~~~
+LL -     let _ = Some(10).and_then(|_| ext_opt);
+LL +     let _ = Some(10).and(ext_opt);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:109:28
@@ -206,8 +224,9 @@ LL |     let _: Option = None.or_else(|| ext_opt);
    |
 help: use `or` instead
    |
-LL |     let _: Option = None.or(ext_opt);
-   |                                 ~~~~~~~~~~~
+LL -     let _: Option = None.or_else(|| ext_opt);
+LL +     let _: Option = None.or(ext_opt);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:110:13
@@ -217,8 +236,9 @@ LL |     let _ = None.get_or_insert_with(|| 2);
    |
 help: use `get_or_insert` instead
    |
-LL |     let _ = None.get_or_insert(2);
-   |                  ~~~~~~~~~~~~~~~~
+LL -     let _ = None.get_or_insert_with(|| 2);
+LL +     let _ = None.get_or_insert(2);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:111:35
@@ -228,8 +248,9 @@ LL |     let _: Result = None.ok_or_else(|| 2);
    |
 help: use `ok_or` instead
    |
-LL |     let _: Result = None.ok_or(2);
-   |                                        ~~~~~~~~
+LL -     let _: Result = None.ok_or_else(|| 2);
+LL +     let _: Result = None.ok_or(2);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:112:28
@@ -239,8 +260,9 @@ LL |     let _: Option = None.or_else(|| None);
    |
 help: use `or` instead
    |
-LL |     let _: Option = None.or(None);
-   |                                 ~~~~~~~~
+LL -     let _: Option = None.or_else(|| None);
+LL +     let _: Option = None.or(None);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:115:13
@@ -250,8 +272,9 @@ LL |     let _ = deep.0.unwrap_or_else(|| 2);
    |
 help: use `unwrap_or` instead
    |
-LL |     let _ = deep.0.unwrap_or(2);
-   |                    ~~~~~~~~~~~~
+LL -     let _ = deep.0.unwrap_or_else(|| 2);
+LL +     let _ = deep.0.unwrap_or(2);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:116:13
@@ -261,8 +284,9 @@ LL |     let _ = deep.0.and_then(|_| ext_opt);
    |
 help: use `and` instead
    |
-LL |     let _ = deep.0.and(ext_opt);
-   |                    ~~~~~~~~~~~~
+LL -     let _ = deep.0.and_then(|_| ext_opt);
+LL +     let _ = deep.0.and(ext_opt);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:117:13
@@ -272,8 +296,9 @@ LL |     let _ = deep.0.or_else(|| None);
    |
 help: use `or` instead
    |
-LL |     let _ = deep.0.or(None);
-   |                    ~~~~~~~~
+LL -     let _ = deep.0.or_else(|| None);
+LL +     let _ = deep.0.or(None);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:118:13
@@ -283,8 +308,9 @@ LL |     let _ = deep.0.get_or_insert_with(|| 2);
    |
 help: use `get_or_insert` instead
    |
-LL |     let _ = deep.0.get_or_insert(2);
-   |                    ~~~~~~~~~~~~~~~~
+LL -     let _ = deep.0.get_or_insert_with(|| 2);
+LL +     let _ = deep.0.get_or_insert(2);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:119:13
@@ -294,8 +320,9 @@ LL |     let _ = deep.0.ok_or_else(|| 2);
    |
 help: use `ok_or` instead
    |
-LL |     let _ = deep.0.ok_or(2);
-   |                    ~~~~~~~~
+LL -     let _ = deep.0.ok_or_else(|| 2);
+LL +     let _ = deep.0.ok_or(2);
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:150:28
@@ -305,8 +332,9 @@ LL |     let _: Option = None.or_else(|| Some(3));
    |
 help: use `or` instead
    |
-LL |     let _: Option = None.or(Some(3));
-   |                                 ~~~~~~~~~~~
+LL -     let _: Option = None.or_else(|| Some(3));
+LL +     let _: Option = None.or(Some(3));
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:151:13
@@ -316,8 +344,9 @@ LL |     let _ = deep.0.or_else(|| Some(3));
    |
 help: use `or` instead
    |
-LL |     let _ = deep.0.or(Some(3));
-   |                    ~~~~~~~~~~~
+LL -     let _ = deep.0.or_else(|| Some(3));
+LL +     let _ = deep.0.or(Some(3));
+   |
 
 error: unnecessary closure used to substitute value for `Option::None`
   --> tests/ui/unnecessary_lazy_eval.rs:152:13
@@ -327,8 +356,9 @@ LL |     let _ = opt.or_else(|| Some(3));
    |
 help: use `or` instead
    |
-LL |     let _ = opt.or(Some(3));
-   |                 ~~~~~~~~~~~
+LL -     let _ = opt.or_else(|| Some(3));
+LL +     let _ = opt.or(Some(3));
+   |
 
 error: unnecessary closure used to substitute value for `Result::Err`
   --> tests/ui/unnecessary_lazy_eval.rs:158:13
@@ -338,8 +368,9 @@ LL |     let _ = res2.unwrap_or_else(|_| 2);
    |
 help: use `unwrap_or` instead
    |
-LL |     let _ = res2.unwrap_or(2);
-   |                  ~~~~~~~~~~~~
+LL -     let _ = res2.unwrap_or_else(|_| 2);
+LL +     let _ = res2.unwrap_or(2);
+   |
 
 error: unnecessary closure used to substitute value for `Result::Err`
   --> tests/ui/unnecessary_lazy_eval.rs:159:13
@@ -349,8 +380,9 @@ LL |     let _ = res2.unwrap_or_else(|_| astronomers_pi);
    |
 help: use `unwrap_or` instead
    |
-LL |     let _ = res2.unwrap_or(astronomers_pi);
-   |                  ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = res2.unwrap_or_else(|_| astronomers_pi);
+LL +     let _ = res2.unwrap_or(astronomers_pi);
+   |
 
 error: unnecessary closure used to substitute value for `Result::Err`
   --> tests/ui/unnecessary_lazy_eval.rs:160:13
@@ -360,8 +392,9 @@ LL |     let _ = res2.unwrap_or_else(|_| ext_str.some_field);
    |
 help: use `unwrap_or` instead
    |
-LL |     let _ = res2.unwrap_or(ext_str.some_field);
-   |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = res2.unwrap_or_else(|_| ext_str.some_field);
+LL +     let _ = res2.unwrap_or(ext_str.some_field);
+   |
 
 error: unnecessary closure used to substitute value for `Result::Err`
   --> tests/ui/unnecessary_lazy_eval.rs:182:35
@@ -371,8 +404,9 @@ LL |     let _: Result = res.and_then(|_| Err(2));
    |
 help: use `and` instead
    |
-LL |     let _: Result = res.and(Err(2));
-   |                                       ~~~~~~~~~~~
+LL -     let _: Result = res.and_then(|_| Err(2));
+LL +     let _: Result = res.and(Err(2));
+   |
 
 error: unnecessary closure used to substitute value for `Result::Err`
   --> tests/ui/unnecessary_lazy_eval.rs:183:35
@@ -382,8 +416,9 @@ LL |     let _: Result = res.and_then(|_| Err(astronomers_pi));
    |
 help: use `and` instead
    |
-LL |     let _: Result = res.and(Err(astronomers_pi));
-   |                                       ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _: Result = res.and_then(|_| Err(astronomers_pi));
+LL +     let _: Result = res.and(Err(astronomers_pi));
+   |
 
 error: unnecessary closure used to substitute value for `Result::Err`
   --> tests/ui/unnecessary_lazy_eval.rs:184:35
@@ -393,8 +428,9 @@ LL |     let _: Result = res.and_then(|_| Err(ext_str.some_field))
    |
 help: use `and` instead
    |
-LL |     let _: Result = res.and(Err(ext_str.some_field));
-   |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _: Result = res.and_then(|_| Err(ext_str.some_field));
+LL +     let _: Result = res.and(Err(ext_str.some_field));
+   |
 
 error: unnecessary closure used to substitute value for `Result::Err`
   --> tests/ui/unnecessary_lazy_eval.rs:186:35
@@ -404,8 +440,9 @@ LL |     let _: Result = res.or_else(|_| Ok(2));
    |
 help: use `or` instead
    |
-LL |     let _: Result = res.or(Ok(2));
-   |                                       ~~~~~~~~~
+LL -     let _: Result = res.or_else(|_| Ok(2));
+LL +     let _: Result = res.or(Ok(2));
+   |
 
 error: unnecessary closure used to substitute value for `Result::Err`
   --> tests/ui/unnecessary_lazy_eval.rs:187:35
@@ -415,8 +452,9 @@ LL |     let _: Result = res.or_else(|_| Ok(astronomers_pi));
    |
 help: use `or` instead
    |
-LL |     let _: Result = res.or(Ok(astronomers_pi));
-   |                                       ~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _: Result = res.or_else(|_| Ok(astronomers_pi));
+LL +     let _: Result = res.or(Ok(astronomers_pi));
+   |
 
 error: unnecessary closure used to substitute value for `Result::Err`
   --> tests/ui/unnecessary_lazy_eval.rs:188:35
@@ -426,8 +464,9 @@ LL |     let _: Result = res.or_else(|_| Ok(ext_str.some_field));
    |
 help: use `or` instead
    |
-LL |     let _: Result = res.or(Ok(ext_str.some_field));
-   |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _: Result = res.or_else(|_| Ok(ext_str.some_field));
+LL +     let _: Result = res.or(Ok(ext_str.some_field));
+   |
 
 error: unnecessary closure used to substitute value for `Result::Err`
   --> tests/ui/unnecessary_lazy_eval.rs:189:35
@@ -440,8 +479,9 @@ LL | |     or_else(|_| Ok(ext_str.some_field));
    |
 help: use `or` instead
    |
-LL |     or(Ok(ext_str.some_field));
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     or_else(|_| Ok(ext_str.some_field));
+LL +     or(Ok(ext_str.some_field));
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:219:14
@@ -451,8 +491,9 @@ LL |     let _x = false.then(|| i32::MAX + 1);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(i32::MAX + 1);
-   |                    ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| i32::MAX + 1);
+LL +     let _x = false.then_some(i32::MAX + 1);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:221:14
@@ -462,8 +503,9 @@ LL |     let _x = false.then(|| i32::MAX * 2);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(i32::MAX * 2);
-   |                    ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| i32::MAX * 2);
+LL +     let _x = false.then_some(i32::MAX * 2);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:223:14
@@ -473,8 +515,9 @@ LL |     let _x = false.then(|| i32::MAX - 1);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(i32::MAX - 1);
-   |                    ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| i32::MAX - 1);
+LL +     let _x = false.then_some(i32::MAX - 1);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:225:14
@@ -484,8 +527,9 @@ LL |     let _x = false.then(|| i32::MIN - 1);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(i32::MIN - 1);
-   |                    ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| i32::MIN - 1);
+LL +     let _x = false.then_some(i32::MIN - 1);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:227:14
@@ -495,8 +539,9 @@ LL |     let _x = false.then(|| (1 + 2 * 3 - 2 / 3 + 9) << 2);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some((1 + 2 * 3 - 2 / 3 + 9) << 2);
-   |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| (1 + 2 * 3 - 2 / 3 + 9) << 2);
+LL +     let _x = false.then_some((1 + 2 * 3 - 2 / 3 + 9) << 2);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:229:14
@@ -506,8 +551,9 @@ LL |     let _x = false.then(|| 255u8 << 7);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(255u8 << 7);
-   |                    ~~~~~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| 255u8 << 7);
+LL +     let _x = false.then_some(255u8 << 7);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:231:14
@@ -517,8 +563,9 @@ LL |     let _x = false.then(|| 255u8 << 8);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(255u8 << 8);
-   |                    ~~~~~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| 255u8 << 8);
+LL +     let _x = false.then_some(255u8 << 8);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:233:14
@@ -528,8 +575,9 @@ LL |     let _x = false.then(|| 255u8 >> 8);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(255u8 >> 8);
-   |                    ~~~~~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| 255u8 >> 8);
+LL +     let _x = false.then_some(255u8 >> 8);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:236:14
@@ -539,8 +587,9 @@ LL |     let _x = false.then(|| i32::MAX + -1);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(i32::MAX + -1);
-   |                    ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| i32::MAX + -1);
+LL +     let _x = false.then_some(i32::MAX + -1);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:238:14
@@ -550,8 +599,9 @@ LL |     let _x = false.then(|| -i32::MAX);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(-i32::MAX);
-   |                    ~~~~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| -i32::MAX);
+LL +     let _x = false.then_some(-i32::MAX);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:240:14
@@ -561,8 +611,9 @@ LL |     let _x = false.then(|| -i32::MIN);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(-i32::MIN);
-   |                    ~~~~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| -i32::MIN);
+LL +     let _x = false.then_some(-i32::MIN);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:243:14
@@ -572,8 +623,9 @@ LL |     let _x = false.then(|| 255 >> -7);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(255 >> -7);
-   |                    ~~~~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| 255 >> -7);
+LL +     let _x = false.then_some(255 >> -7);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:245:14
@@ -583,8 +635,9 @@ LL |     let _x = false.then(|| 255 << -1);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(255 << -1);
-   |                    ~~~~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| 255 << -1);
+LL +     let _x = false.then_some(255 << -1);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:247:14
@@ -594,8 +647,9 @@ LL |     let _x = false.then(|| 1 / 0);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(1 / 0);
-   |                    ~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| 1 / 0);
+LL +     let _x = false.then_some(1 / 0);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:249:14
@@ -605,8 +659,9 @@ LL |     let _x = false.then(|| x << -1);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(x << -1);
-   |                    ~~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| x << -1);
+LL +     let _x = false.then_some(x << -1);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:251:14
@@ -616,8 +671,9 @@ LL |     let _x = false.then(|| x << 2);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(x << 2);
-   |                    ~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| x << 2);
+LL +     let _x = false.then_some(x << 2);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:261:14
@@ -627,8 +683,9 @@ LL |     let _x = false.then(|| x / 0);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(x / 0);
-   |                    ~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| x / 0);
+LL +     let _x = false.then_some(x / 0);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:263:14
@@ -638,8 +695,9 @@ LL |     let _x = false.then(|| x % 0);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(x % 0);
-   |                    ~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| x % 0);
+LL +     let _x = false.then_some(x % 0);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:266:14
@@ -649,8 +707,9 @@ LL |     let _x = false.then(|| 1 / -1);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(1 / -1);
-   |                    ~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| 1 / -1);
+LL +     let _x = false.then_some(1 / -1);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:268:14
@@ -660,8 +719,9 @@ LL |     let _x = false.then(|| i32::MIN / -1);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(i32::MIN / -1);
-   |                    ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| i32::MIN / -1);
+LL +     let _x = false.then_some(i32::MIN / -1);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:271:14
@@ -671,8 +731,9 @@ LL |     let _x = false.then(|| i32::MIN / 0);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(i32::MIN / 0);
-   |                    ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| i32::MIN / 0);
+LL +     let _x = false.then_some(i32::MIN / 0);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:273:14
@@ -682,8 +743,9 @@ LL |     let _x = false.then(|| 4 / 2);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(4 / 2);
-   |                    ~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| 4 / 2);
+LL +     let _x = false.then_some(4 / 2);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval.rs:281:14
@@ -693,8 +755,9 @@ LL |     let _x = false.then(|| f1 + f2);
    |
 help: use `then_some` instead
    |
-LL |     let _x = false.then_some(f1 + f2);
-   |                    ~~~~~~~~~~~~~~~~~~
+LL -     let _x = false.then(|| f1 + f2);
+LL +     let _x = false.then_some(f1 + f2);
+   |
 
 error: aborting due to 63 previous errors
 
diff --git a/src/tools/clippy/tests/ui/unnecessary_lazy_eval_unfixable.stderr b/src/tools/clippy/tests/ui/unnecessary_lazy_eval_unfixable.stderr
index 390235b21247..9688c44c9145 100644
--- a/src/tools/clippy/tests/ui/unnecessary_lazy_eval_unfixable.stderr
+++ b/src/tools/clippy/tests/ui/unnecessary_lazy_eval_unfixable.stderr
@@ -8,8 +8,9 @@ LL |     let _ = Ok(1).unwrap_or_else(|()| 2);
    = help: to override `-D warnings` add `#[allow(clippy::unnecessary_lazy_evaluations)]`
 help: use `unwrap_or` instead
    |
-LL |     let _ = Ok(1).unwrap_or(2);
-   |                   ~~~~~~~~~~~~
+LL -     let _ = Ok(1).unwrap_or_else(|()| 2);
+LL +     let _ = Ok(1).unwrap_or(2);
+   |
 
 error: unnecessary closure used to substitute value for `Result::Err`
   --> tests/ui/unnecessary_lazy_eval_unfixable.rs:19:13
@@ -19,8 +20,9 @@ LL |     let _ = Ok(1).unwrap_or_else(|e::E| 2);
    |
 help: use `unwrap_or` instead
    |
-LL |     let _ = Ok(1).unwrap_or(2);
-   |                   ~~~~~~~~~~~~
+LL -     let _ = Ok(1).unwrap_or_else(|e::E| 2);
+LL +     let _ = Ok(1).unwrap_or(2);
+   |
 
 error: unnecessary closure used to substitute value for `Result::Err`
   --> tests/ui/unnecessary_lazy_eval_unfixable.rs:21:13
@@ -30,8 +32,9 @@ LL |     let _ = Ok(1).unwrap_or_else(|SomeStruct { .. }| 2);
    |
 help: use `unwrap_or` instead
    |
-LL |     let _ = Ok(1).unwrap_or(2);
-   |                   ~~~~~~~~~~~~
+LL -     let _ = Ok(1).unwrap_or_else(|SomeStruct { .. }| 2);
+LL +     let _ = Ok(1).unwrap_or(2);
+   |
 
 error: unnecessary closure used with `bool::then`
   --> tests/ui/unnecessary_lazy_eval_unfixable.rs:31:13
@@ -41,8 +44,9 @@ LL |     let _ = true.then(|| -> &[u8] { &[] });
    |
 help: use `then_some` instead
    |
-LL |     let _ = true.then_some({ &[] });
-   |                  ~~~~~~~~~~~~~~~~~~
+LL -     let _ = true.then(|| -> &[u8] { &[] });
+LL +     let _ = true.then_some({ &[] });
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/src/tools/clippy/tests/ui/unnecessary_literal_unwrap.stderr b/src/tools/clippy/tests/ui/unnecessary_literal_unwrap.stderr
index 37ee9195fce6..631bf0837266 100644
--- a/src/tools/clippy/tests/ui/unnecessary_literal_unwrap.stderr
+++ b/src/tools/clippy/tests/ui/unnecessary_literal_unwrap.stderr
@@ -62,8 +62,9 @@ LL |     let _val = None::<()>.expect("this always happens");
    |
 help: remove the `None` and `expect()`
    |
-LL |     let _val = panic!("this always happens");
-   |                ~~~~~~~
+LL -     let _val = None::<()>.expect("this always happens");
+LL +     let _val = panic!("this always happens");
+   |
 
 error: used `unwrap_or_default()` on `None` value
   --> tests/ui/unnecessary_literal_unwrap.rs:22:24
@@ -133,8 +134,9 @@ LL |     None::<()>.expect("this always happens");
    |
 help: remove the `None` and `expect()`
    |
-LL |     panic!("this always happens");
-   |     ~~~~~~~
+LL -     None::<()>.expect("this always happens");
+LL +     panic!("this always happens");
+   |
 
 error: used `unwrap_or_default()` on `None` value
   --> tests/ui/unnecessary_literal_unwrap.rs:30:5
@@ -222,8 +224,9 @@ LL |     let _val = Ok::<_, ()>(1).unwrap_err();
    |
 help: remove the `Ok` and `unwrap_err()`
    |
-LL |     let _val = panic!("{:?}", 1);
-   |                ~~~~~~~~~~~~~~  ~
+LL -     let _val = Ok::<_, ()>(1).unwrap_err();
+LL +     let _val = panic!("{:?}", 1);
+   |
 
 error: used `expect_err()` on `Ok` value
   --> tests/ui/unnecessary_literal_unwrap.rs:41:16
@@ -233,8 +236,9 @@ LL |     let _val = Ok::<_, ()>(1).expect_err("this always happens");
    |
 help: remove the `Ok` and `expect_err()`
    |
-LL |     let _val = panic!("{1}: {:?}", 1, "this always happens");
-   |                ~~~~~~~~~~~~~~~~~~~  ~
+LL -     let _val = Ok::<_, ()>(1).expect_err("this always happens");
+LL +     let _val = panic!("{1}: {:?}", 1, "this always happens");
+   |
 
 error: used `unwrap()` on `Ok` value
   --> tests/ui/unnecessary_literal_unwrap.rs:43:5
@@ -268,8 +272,9 @@ LL |     Ok::<_, ()>(1).unwrap_err();
    |
 help: remove the `Ok` and `unwrap_err()`
    |
-LL |     panic!("{:?}", 1);
-   |     ~~~~~~~~~~~~~~  ~
+LL -     Ok::<_, ()>(1).unwrap_err();
+LL +     panic!("{:?}", 1);
+   |
 
 error: used `expect_err()` on `Ok` value
   --> tests/ui/unnecessary_literal_unwrap.rs:46:5
@@ -279,8 +284,9 @@ LL |     Ok::<_, ()>(1).expect_err("this always happens");
    |
 help: remove the `Ok` and `expect_err()`
    |
-LL |     panic!("{1}: {:?}", 1, "this always happens");
-   |     ~~~~~~~~~~~~~~~~~~~  ~
+LL -     Ok::<_, ()>(1).expect_err("this always happens");
+LL +     panic!("{1}: {:?}", 1, "this always happens");
+   |
 
 error: used `unwrap_err()` on `Err` value
   --> tests/ui/unnecessary_literal_unwrap.rs:50:16
@@ -314,8 +320,9 @@ LL |     let _val = Err::<(), _>(1).unwrap();
    |
 help: remove the `Err` and `unwrap()`
    |
-LL |     let _val = panic!("{:?}", 1);
-   |                ~~~~~~~~~~~~~~  ~
+LL -     let _val = Err::<(), _>(1).unwrap();
+LL +     let _val = panic!("{:?}", 1);
+   |
 
 error: used `expect()` on `Err` value
   --> tests/ui/unnecessary_literal_unwrap.rs:53:16
@@ -325,8 +332,9 @@ LL |     let _val = Err::<(), _>(1).expect("this always happens");
    |
 help: remove the `Err` and `expect()`
    |
-LL |     let _val = panic!("{1}: {:?}", 1, "this always happens");
-   |                ~~~~~~~~~~~~~~~~~~~  ~
+LL -     let _val = Err::<(), _>(1).expect("this always happens");
+LL +     let _val = panic!("{1}: {:?}", 1, "this always happens");
+   |
 
 error: used `unwrap_err()` on `Err` value
   --> tests/ui/unnecessary_literal_unwrap.rs:55:5
@@ -360,8 +368,9 @@ LL |     Err::<(), _>(1).unwrap();
    |
 help: remove the `Err` and `unwrap()`
    |
-LL |     panic!("{:?}", 1);
-   |     ~~~~~~~~~~~~~~  ~
+LL -     Err::<(), _>(1).unwrap();
+LL +     panic!("{:?}", 1);
+   |
 
 error: used `expect()` on `Err` value
   --> tests/ui/unnecessary_literal_unwrap.rs:58:5
@@ -371,8 +380,9 @@ LL |     Err::<(), _>(1).expect("this always happens");
    |
 help: remove the `Err` and `expect()`
    |
-LL |     panic!("{1}: {:?}", 1, "this always happens");
-   |     ~~~~~~~~~~~~~~~~~~~  ~
+LL -     Err::<(), _>(1).expect("this always happens");
+LL +     panic!("{1}: {:?}", 1, "this always happens");
+   |
 
 error: used `unwrap_or()` on `Some` value
   --> tests/ui/unnecessary_literal_unwrap.rs:62:16
diff --git a/src/tools/clippy/tests/ui/unnecessary_map_or.stderr b/src/tools/clippy/tests/ui/unnecessary_map_or.stderr
index 2ae327f0bf88..9f38b8c8d93a 100644
--- a/src/tools/clippy/tests/ui/unnecessary_map_or.stderr
+++ b/src/tools/clippy/tests/ui/unnecessary_map_or.stderr
@@ -8,8 +8,9 @@ LL |     let _ = Some(5).map_or(false, |n| n == 5);
    = help: to override `-D warnings` add `#[allow(clippy::unnecessary_map_or)]`
 help: use a standard comparison instead
    |
-LL |     let _ = Some(5) == Some(5);
-   |             ~~~~~~~~~~~~~~~~~~
+LL -     let _ = Some(5).map_or(false, |n| n == 5);
+LL +     let _ = Some(5) == Some(5);
+   |
 
 error: this `map_or` can be simplified
   --> tests/ui/unnecessary_map_or.rs:14:13
@@ -19,8 +20,9 @@ LL |     let _ = Some(5).map_or(true, |n| n != 5);
    |
 help: use a standard comparison instead
    |
-LL |     let _ = Some(5) != Some(5);
-   |             ~~~~~~~~~~~~~~~~~~
+LL -     let _ = Some(5).map_or(true, |n| n != 5);
+LL +     let _ = Some(5) != Some(5);
+   |
 
 error: this `map_or` can be simplified
   --> tests/ui/unnecessary_map_or.rs:15:13
@@ -34,8 +36,12 @@ LL | |     });
    |
 help: use a standard comparison instead
    |
-LL |     let _ = Some(5) == Some(5);
-   |             ~~~~~~~~~~~~~~~~~~
+LL -     let _ = Some(5).map_or(false, |n| {
+LL -         let _ = 1;
+LL -         n == 5
+LL -     });
+LL +     let _ = Some(5) == Some(5);
+   |
 
 error: this `map_or` can be simplified
   --> tests/ui/unnecessary_map_or.rs:19:13
@@ -121,8 +127,9 @@ LL |     let _ = Ok::(5).map_or(false, |n| n == 5);
    |
 help: use a standard comparison instead
    |
-LL |     let _ = Ok::(5) == Ok(5);
-   |             ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = Ok::(5).map_or(false, |n| n == 5);
+LL +     let _ = Ok::(5) == Ok(5);
+   |
 
 error: this `map_or` can be simplified
   --> tests/ui/unnecessary_map_or.rs:29:13
@@ -132,8 +139,9 @@ LL |     let _ = Some(5).map_or(false, |n| n == 5).then(|| 1);
    |
 help: use a standard comparison instead
    |
-LL |     let _ = (Some(5) == Some(5)).then(|| 1);
-   |             ~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = Some(5).map_or(false, |n| n == 5).then(|| 1);
+LL +     let _ = (Some(5) == Some(5)).then(|| 1);
+   |
 
 error: this `map_or` can be simplified
   --> tests/ui/unnecessary_map_or.rs:30:13
@@ -167,8 +175,9 @@ LL |     let _ = !Some(5).map_or(false, |n| n == 5);
    |
 help: use a standard comparison instead
    |
-LL |     let _ = !(Some(5) == Some(5));
-   |              ~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = !Some(5).map_or(false, |n| n == 5);
+LL +     let _ = !(Some(5) == Some(5));
+   |
 
 error: this `map_or` can be simplified
   --> tests/ui/unnecessary_map_or.rs:33:13
@@ -178,8 +187,9 @@ LL |     let _ = Some(5).map_or(false, |n| n == 5) || false;
    |
 help: use a standard comparison instead
    |
-LL |     let _ = (Some(5) == Some(5)) || false;
-   |             ~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = Some(5).map_or(false, |n| n == 5) || false;
+LL +     let _ = (Some(5) == Some(5)) || false;
+   |
 
 error: this `map_or` can be simplified
   --> tests/ui/unnecessary_map_or.rs:34:13
@@ -189,8 +199,9 @@ LL |     let _ = Some(5).map_or(false, |n| n == 5) as usize;
    |
 help: use a standard comparison instead
    |
-LL |     let _ = (Some(5) == Some(5)) as usize;
-   |             ~~~~~~~~~~~~~~~~~~~~
+LL -     let _ = Some(5).map_or(false, |n| n == 5) as usize;
+LL +     let _ = (Some(5) == Some(5)) as usize;
+   |
 
 error: this `map_or` can be simplified
   --> tests/ui/unnecessary_map_or.rs:58:13
@@ -248,8 +259,9 @@ LL |     let _ = r.map_or(false, |x| x == 8);
    |
 help: use a standard comparison instead
    |
-LL |     let _ = r == Ok(8);
-   |             ~~~~~~~~~~
+LL -     let _ = r.map_or(false, |x| x == 8);
+LL +     let _ = r == Ok(8);
+   |
 
 error: this `map_or` can be simplified
   --> tests/ui/unnecessary_map_or.rs:90:5
diff --git a/src/tools/clippy/tests/ui/unnecessary_wraps.stderr b/src/tools/clippy/tests/ui/unnecessary_wraps.stderr
index b304d4dce6ea..b06ab91dc8de 100644
--- a/src/tools/clippy/tests/ui/unnecessary_wraps.stderr
+++ b/src/tools/clippy/tests/ui/unnecessary_wraps.stderr
@@ -13,8 +13,9 @@ LL | | }
    = help: to override `-D warnings` add `#[allow(clippy::unnecessary_wraps)]`
 help: remove `Option` from the return type...
    |
-LL | fn func1(a: bool, b: bool) -> i32 {
-   |                               ~~~
+LL - fn func1(a: bool, b: bool) -> Option {
+LL + fn func1(a: bool, b: bool) -> i32 {
+   |
 help: ...and then change returning expressions
    |
 LL ~         return 42;
@@ -40,8 +41,9 @@ LL | | }
    |
 help: remove `Option` from the return type...
    |
-LL | fn func2(a: bool, b: bool) -> i32 {
-   |                               ~~~
+LL - fn func2(a: bool, b: bool) -> Option {
+LL + fn func2(a: bool, b: bool) -> i32 {
+   |
 help: ...and then change returning expressions
    |
 LL ~         return 10;
@@ -60,11 +62,13 @@ LL | | }
    |
 help: remove `Option` from the return type...
    |
-LL | fn func5() -> i32 {
-   |               ~~~
+LL - fn func5() -> Option {
+LL + fn func5() -> i32 {
+   |
 help: ...and then change returning expressions
    |
-LL |     1
+LL -     Some(1)
+LL +     1
    |
 
 error: this function's return value is unnecessarily wrapped by `Result`
@@ -78,11 +82,13 @@ LL | | }
    |
 help: remove `Result` from the return type...
    |
-LL | fn func7() -> i32 {
-   |               ~~~
+LL - fn func7() -> Result {
+LL + fn func7() -> i32 {
+   |
 help: ...and then change returning expressions
    |
-LL |     1
+LL -     Ok(1)
+LL +     1
    |
 
 error: this function's return value is unnecessarily wrapped by `Option`
@@ -96,11 +102,13 @@ LL | |     }
    |
 help: remove `Option` from the return type...
    |
-LL |     fn func12() -> i32 {
-   |                    ~~~
+LL -     fn func12() -> Option {
+LL +     fn func12() -> i32 {
+   |
 help: ...and then change returning expressions
    |
-LL |         1
+LL -         Some(1)
+LL +         1
    |
 
 error: this function's return value is unnecessary
@@ -116,8 +124,9 @@ LL | | }
    |
 help: remove the return type...
    |
-LL | fn issue_6640_1(a: bool, b: bool) -> () {
-   |                                      ~~
+LL - fn issue_6640_1(a: bool, b: bool) -> Option<()> {
+LL + fn issue_6640_1(a: bool, b: bool) -> () {
+   |
 help: ...and then remove returned values
    |
 LL ~         return ;
@@ -142,8 +151,9 @@ LL | | }
    |
 help: remove the return type...
    |
-LL | fn issue_6640_2(a: bool, b: bool) -> () {
-   |                                      ~~
+LL - fn issue_6640_2(a: bool, b: bool) -> Result<(), i32> {
+LL + fn issue_6640_2(a: bool, b: bool) -> () {
+   |
 help: ...and then remove returned values
    |
 LL ~         return ;
diff --git a/src/tools/clippy/tests/ui/unnested_or_patterns.stderr b/src/tools/clippy/tests/ui/unnested_or_patterns.stderr
index bd15ef62368e..4325df143042 100644
--- a/src/tools/clippy/tests/ui/unnested_or_patterns.stderr
+++ b/src/tools/clippy/tests/ui/unnested_or_patterns.stderr
@@ -8,8 +8,9 @@ LL |     if let box 0 | box 2 = Box::new(0) {}
    = help: to override `-D warnings` add `#[allow(clippy::unnested_or_patterns)]`
 help: nest the patterns
    |
-LL |     if let box (0 | 2) = Box::new(0) {}
-   |            ~~~~~~~~~~~
+LL -     if let box 0 | box 2 = Box::new(0) {}
+LL +     if let box (0 | 2) = Box::new(0) {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns.rs:17:12
@@ -19,8 +20,9 @@ LL |     if let box ((0 | 1)) | box (2 | 3) | box 4 = Box::new(0) {}
    |
 help: nest the patterns
    |
-LL |     if let box (0 | 1 | 2 | 3 | 4) = Box::new(0) {}
-   |            ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     if let box ((0 | 1)) | box (2 | 3) | box 4 = Box::new(0) {}
+LL +     if let box (0 | 1 | 2 | 3 | 4) = Box::new(0) {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns.rs:19:12
@@ -30,8 +32,9 @@ LL |     if let Some(1) | C0 | Some(2) = None {}
    |
 help: nest the patterns
    |
-LL |     if let Some(1 | 2) | C0 = None {}
-   |            ~~~~~~~~~~~~~~~~
+LL -     if let Some(1) | C0 | Some(2) = None {}
+LL +     if let Some(1 | 2) | C0 = None {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns.rs:20:12
@@ -41,8 +44,9 @@ LL |     if let &mut 0 | &mut 2 = &mut 0 {}
    |
 help: nest the patterns
    |
-LL |     if let &mut (0 | 2) = &mut 0 {}
-   |            ~~~~~~~~~~~~
+LL -     if let &mut 0 | &mut 2 = &mut 0 {}
+LL +     if let &mut (0 | 2) = &mut 0 {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns.rs:21:12
@@ -52,8 +56,9 @@ LL |     if let x @ 0 | x @ 2 = 0 {}
    |
 help: nest the patterns
    |
-LL |     if let x @ (0 | 2) = 0 {}
-   |            ~~~~~~~~~~~
+LL -     if let x @ 0 | x @ 2 = 0 {}
+LL +     if let x @ (0 | 2) = 0 {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns.rs:22:12
@@ -63,8 +68,9 @@ LL |     if let (0, 1) | (0, 2) | (0, 3) = (0, 0) {}
    |
 help: nest the patterns
    |
-LL |     if let (0, 1 | 2 | 3) = (0, 0) {}
-   |            ~~~~~~~~~~~~~~
+LL -     if let (0, 1) | (0, 2) | (0, 3) = (0, 0) {}
+LL +     if let (0, 1 | 2 | 3) = (0, 0) {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns.rs:23:12
@@ -74,8 +80,9 @@ LL |     if let (1, 0) | (2, 0) | (3, 0) = (0, 0) {}
    |
 help: nest the patterns
    |
-LL |     if let (1 | 2 | 3, 0) = (0, 0) {}
-   |            ~~~~~~~~~~~~~~
+LL -     if let (1, 0) | (2, 0) | (3, 0) = (0, 0) {}
+LL +     if let (1 | 2 | 3, 0) = (0, 0) {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns.rs:24:12
@@ -85,8 +92,9 @@ LL |     if let (x, ..) | (x, 1) | (x, 2) = (0, 1) {}
    |
 help: nest the patterns
    |
-LL |     if let (x, ..) | (x, 1 | 2) = (0, 1) {}
-   |            ~~~~~~~~~~~~~~~~~~~~
+LL -     if let (x, ..) | (x, 1) | (x, 2) = (0, 1) {}
+LL +     if let (x, ..) | (x, 1 | 2) = (0, 1) {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns.rs:25:12
@@ -96,8 +104,9 @@ LL |     if let [0] | [1] = [0] {}
    |
 help: nest the patterns
    |
-LL |     if let [0 | 1] = [0] {}
-   |            ~~~~~~~
+LL -     if let [0] | [1] = [0] {}
+LL +     if let [0 | 1] = [0] {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns.rs:26:12
@@ -107,8 +116,9 @@ LL |     if let [x, 0] | [x, 1] = [0, 1] {}
    |
 help: nest the patterns
    |
-LL |     if let [x, 0 | 1] = [0, 1] {}
-   |            ~~~~~~~~~~
+LL -     if let [x, 0] | [x, 1] = [0, 1] {}
+LL +     if let [x, 0 | 1] = [0, 1] {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns.rs:27:12
@@ -118,8 +128,9 @@ LL |     if let [x, 0] | [x, 1] | [x, 2] = [0, 1] {}
    |
 help: nest the patterns
    |
-LL |     if let [x, 0 | 1 | 2] = [0, 1] {}
-   |            ~~~~~~~~~~~~~~
+LL -     if let [x, 0] | [x, 1] | [x, 2] = [0, 1] {}
+LL +     if let [x, 0 | 1 | 2] = [0, 1] {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns.rs:28:12
@@ -129,8 +140,9 @@ LL |     if let [x, ..] | [x, 1] | [x, 2] = [0, 1] {}
    |
 help: nest the patterns
    |
-LL |     if let [x, ..] | [x, 1 | 2] = [0, 1] {}
-   |            ~~~~~~~~~~~~~~~~~~~~
+LL -     if let [x, ..] | [x, 1] | [x, 2] = [0, 1] {}
+LL +     if let [x, ..] | [x, 1 | 2] = [0, 1] {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns.rs:30:12
@@ -140,8 +152,9 @@ LL |     if let TS(0, x) | TS(1, x) = TS(0, 0) {}
    |
 help: nest the patterns
    |
-LL |     if let TS(0 | 1, x) = TS(0, 0) {}
-   |            ~~~~~~~~~~~~
+LL -     if let TS(0, x) | TS(1, x) = TS(0, 0) {}
+LL +     if let TS(0 | 1, x) = TS(0, 0) {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns.rs:31:12
@@ -151,8 +164,9 @@ LL |     if let TS(1, 0) | TS(2, 0) | TS(3, 0) = TS(0, 0) {}
    |
 help: nest the patterns
    |
-LL |     if let TS(1 | 2 | 3, 0) = TS(0, 0) {}
-   |            ~~~~~~~~~~~~~~~~
+LL -     if let TS(1, 0) | TS(2, 0) | TS(3, 0) = TS(0, 0) {}
+LL +     if let TS(1 | 2 | 3, 0) = TS(0, 0) {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns.rs:32:12
@@ -162,8 +176,9 @@ LL |     if let TS(x, ..) | TS(x, 1) | TS(x, 2) = TS(0, 0) {}
    |
 help: nest the patterns
    |
-LL |     if let TS(x, ..) | TS(x, 1 | 2) = TS(0, 0) {}
-   |            ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     if let TS(x, ..) | TS(x, 1) | TS(x, 2) = TS(0, 0) {}
+LL +     if let TS(x, ..) | TS(x, 1 | 2) = TS(0, 0) {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns.rs:37:12
@@ -173,8 +188,9 @@ LL |     if let S { x: 0, y } | S { y, x: 1 } = (S { x: 0, y: 1 }) {}
    |
 help: nest the patterns
    |
-LL |     if let S { x: 0 | 1, y } = (S { x: 0, y: 1 }) {}
-   |            ~~~~~~~~~~~~~~~~~
+LL -     if let S { x: 0, y } | S { y, x: 1 } = (S { x: 0, y: 1 }) {}
+LL +     if let S { x: 0 | 1, y } = (S { x: 0, y: 1 }) {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns.rs:48:12
@@ -184,8 +200,9 @@ LL |     if let [1] | [53] = [0] {}
    |
 help: nest the patterns
    |
-LL |     if let [1 | 53] = [0] {}
-   |            ~~~~~~~~
+LL -     if let [1] | [53] = [0] {}
+LL +     if let [1 | 53] = [0] {}
+   |
 
 error: aborting due to 17 previous errors
 
diff --git a/src/tools/clippy/tests/ui/unnested_or_patterns2.stderr b/src/tools/clippy/tests/ui/unnested_or_patterns2.stderr
index 54f03937508a..3d8968551b96 100644
--- a/src/tools/clippy/tests/ui/unnested_or_patterns2.stderr
+++ b/src/tools/clippy/tests/ui/unnested_or_patterns2.stderr
@@ -8,8 +8,9 @@ LL |     if let Some(Some(0)) | Some(Some(1)) = None {}
    = help: to override `-D warnings` add `#[allow(clippy::unnested_or_patterns)]`
 help: nest the patterns
    |
-LL |     if let Some(Some(0 | 1)) = None {}
-   |            ~~~~~~~~~~~~~~~~~
+LL -     if let Some(Some(0)) | Some(Some(1)) = None {}
+LL +     if let Some(Some(0 | 1)) = None {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns2.rs:13:12
@@ -19,8 +20,9 @@ LL |     if let Some(Some(0)) | Some(Some(1) | Some(2)) = None {}
    |
 help: nest the patterns
    |
-LL |     if let Some(Some(0 | 1 | 2)) = None {}
-   |            ~~~~~~~~~~~~~~~~~~~~~
+LL -     if let Some(Some(0)) | Some(Some(1) | Some(2)) = None {}
+LL +     if let Some(Some(0 | 1 | 2)) = None {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns2.rs:14:12
@@ -30,8 +32,9 @@ LL |     if let Some(Some(0 | 1) | Some(2)) | Some(Some(3) | Some(4)) = None {}
    |
 help: nest the patterns
    |
-LL |     if let Some(Some(0 | 1 | 2 | 3 | 4)) = None {}
-   |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     if let Some(Some(0 | 1) | Some(2)) | Some(Some(3) | Some(4)) = None {}
+LL +     if let Some(Some(0 | 1 | 2 | 3 | 4)) = None {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns2.rs:15:12
@@ -41,8 +44,9 @@ LL |     if let Some(Some(0) | Some(1 | 2)) = None {}
    |
 help: nest the patterns
    |
-LL |     if let Some(Some(0 | 1 | 2)) = None {}
-   |            ~~~~~~~~~~~~~~~~~~~~~
+LL -     if let Some(Some(0) | Some(1 | 2)) = None {}
+LL +     if let Some(Some(0 | 1 | 2)) = None {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns2.rs:16:12
@@ -52,8 +56,9 @@ LL |     if let ((0,),) | ((1,) | (2,),) = ((0,),) {}
    |
 help: nest the patterns
    |
-LL |     if let ((0 | 1 | 2,),) = ((0,),) {}
-   |            ~~~~~~~~~~~~~~~
+LL -     if let ((0,),) | ((1,) | (2,),) = ((0,),) {}
+LL +     if let ((0 | 1 | 2,),) = ((0,),) {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns2.rs:17:12
@@ -63,8 +68,9 @@ LL |     if let 0 | (1 | 2) = 0 {}
    |
 help: nest the patterns
    |
-LL |     if let 0 | 1 | 2 = 0 {}
-   |            ~~~~~~~~~
+LL -     if let 0 | (1 | 2) = 0 {}
+LL +     if let 0 | 1 | 2 = 0 {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns2.rs:18:12
@@ -74,8 +80,9 @@ LL |     if let box (0 | 1) | (box 2 | box (3 | 4)) = Box::new(0) {}
    |
 help: nest the patterns
    |
-LL |     if let box (0 | 1 | 2 | 3 | 4) = Box::new(0) {}
-   |            ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     if let box (0 | 1) | (box 2 | box (3 | 4)) = Box::new(0) {}
+LL +     if let box (0 | 1 | 2 | 3 | 4) = Box::new(0) {}
+   |
 
 error: unnested or-patterns
   --> tests/ui/unnested_or_patterns2.rs:19:12
@@ -85,8 +92,9 @@ LL |     if let box box 0 | box (box 2 | box 4) = Box::new(Box::new(0)) {}
    |
 help: nest the patterns
    |
-LL |     if let box box (0 | 2 | 4) = Box::new(Box::new(0)) {}
-   |            ~~~~~~~~~~~~~~~~~~~
+LL -     if let box box 0 | box (box 2 | box 4) = Box::new(Box::new(0)) {}
+LL +     if let box box (0 | 2 | 4) = Box::new(Box::new(0)) {}
+   |
 
 error: aborting due to 8 previous errors
 
diff --git a/src/tools/clippy/tests/ui/unused_enumerate_index.stderr b/src/tools/clippy/tests/ui/unused_enumerate_index.stderr
index 6ec07dcbff0a..02d65f064308 100644
--- a/src/tools/clippy/tests/ui/unused_enumerate_index.stderr
+++ b/src/tools/clippy/tests/ui/unused_enumerate_index.stderr
@@ -8,8 +8,9 @@ LL |     for (_, x) in v.iter().enumerate() {
    = help: to override `-D warnings` add `#[allow(clippy::unused_enumerate_index)]`
 help: remove the `.enumerate()` call
    |
-LL |     for x in v.iter() {
-   |         ~    ~~~~~~~~
+LL -     for (_, x) in v.iter().enumerate() {
+LL +     for x in v.iter() {
+   |
 
 error: you seem to use `.enumerate()` and immediately discard the index
   --> tests/ui/unused_enumerate_index.rs:59:19
@@ -19,8 +20,9 @@ LL |     for (_, x) in dummy.enumerate() {
    |
 help: remove the `.enumerate()` call
    |
-LL |     for x in dummy {
-   |         ~    ~~~~~
+LL -     for (_, x) in dummy.enumerate() {
+LL +     for x in dummy {
+   |
 
 error: you seem to use `.enumerate()` and immediately discard the index
   --> tests/ui/unused_enumerate_index.rs:63:39
diff --git a/src/tools/clippy/tests/ui/unused_format_specs.stderr b/src/tools/clippy/tests/ui/unused_format_specs.stderr
index df61d59130ef..d3c0530ced46 100644
--- a/src/tools/clippy/tests/ui/unused_format_specs.stderr
+++ b/src/tools/clippy/tests/ui/unused_format_specs.stderr
@@ -8,8 +8,9 @@ LL |     println!("{:5}.", format_args!(""));
    = help: to override `-D warnings` add `#[allow(clippy::unused_format_specs)]`
 help: for the width to apply consider using `format!()`
    |
-LL |     println!("{:5}.", format!(""));
-   |                       ~~~~~~
+LL -     println!("{:5}.", format_args!(""));
+LL +     println!("{:5}.", format!(""));
+   |
 help: if the current behavior is intentional, remove the format specifiers
    |
 LL -     println!("{:5}.", format_args!(""));
@@ -24,8 +25,9 @@ LL |     println!("{:.3}", format_args!("abcde"));
    |
 help: for the precision to apply consider using `format!()`
    |
-LL |     println!("{:.3}", format!("abcde"));
-   |                       ~~~~~~
+LL -     println!("{:.3}", format_args!("abcde"));
+LL +     println!("{:.3}", format!("abcde"));
+   |
 help: if the current behavior is intentional, remove the format specifiers
    |
 LL -     println!("{:.3}", format_args!("abcde"));
@@ -66,8 +68,9 @@ LL |     usr_println!(true, "{:5}.", format_args!(""));
    |
 help: for the width to apply consider using `format!()`
    |
-LL |     usr_println!(true, "{:5}.", format!(""));
-   |                                 ~~~~~~
+LL -     usr_println!(true, "{:5}.", format_args!(""));
+LL +     usr_println!(true, "{:5}.", format!(""));
+   |
 help: if the current behavior is intentional, remove the format specifiers
    |
 LL -     usr_println!(true, "{:5}.", format_args!(""));
@@ -82,8 +85,9 @@ LL |     usr_println!(true, "{:.3}", format_args!("abcde"));
    |
 help: for the precision to apply consider using `format!()`
    |
-LL |     usr_println!(true, "{:.3}", format!("abcde"));
-   |                                 ~~~~~~
+LL -     usr_println!(true, "{:.3}", format_args!("abcde"));
+LL +     usr_println!(true, "{:.3}", format!("abcde"));
+   |
 help: if the current behavior is intentional, remove the format specifiers
    |
 LL -     usr_println!(true, "{:.3}", format_args!("abcde"));
diff --git a/src/tools/clippy/tests/ui/unused_result_ok.stderr b/src/tools/clippy/tests/ui/unused_result_ok.stderr
index 241e0c71261e..024aafa6bbb8 100644
--- a/src/tools/clippy/tests/ui/unused_result_ok.stderr
+++ b/src/tools/clippy/tests/ui/unused_result_ok.stderr
@@ -8,8 +8,9 @@ LL |     x.parse::().ok();
    = help: to override `-D warnings` add `#[allow(clippy::unused_result_ok)]`
 help: consider using `let _ =` and removing the call to `.ok()` instead
    |
-LL |     let _ = x.parse::();
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     x.parse::().ok();
+LL +     let _ = x.parse::();
+   |
 
 error: ignoring a result with `.ok()` is misleading
   --> tests/ui/unused_result_ok.rs:18:5
@@ -19,8 +20,9 @@ LL |     x   .   parse::()   .   ok   ();
    |
 help: consider using `let _ =` and removing the call to `.ok()` instead
    |
-LL |     let _ = x   .   parse::();
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     x   .   parse::()   .   ok   ();
+LL +     let _ = x   .   parse::();
+   |
 
 error: ignoring a result with `.ok()` is misleading
   --> tests/ui/unused_result_ok.rs:34:5
@@ -30,8 +32,9 @@ LL |     v!().ok();
    |
 help: consider using `let _ =` and removing the call to `.ok()` instead
    |
-LL |     let _ = v!();
-   |     ~~~~~~~~~~~~
+LL -     v!().ok();
+LL +     let _ = v!();
+   |
 
 error: ignoring a result with `.ok()` is misleading
   --> tests/ui/unused_result_ok.rs:29:9
@@ -45,8 +48,9 @@ LL |     w!();
    = note: this error originates in the macro `w` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider using `let _ =` and removing the call to `.ok()` instead
    |
-LL |         let _ = Ok::<(), ()>(());
-   |         ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -         Ok::<(), ()>(()).ok();
+LL +         let _ = Ok::<(), ()>(());
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr b/tests/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr
index ef7fec77b1e0..3bba27e593cf 100644
--- a/tests/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr
+++ b/tests/rustdoc-ui/intra-doc/disambiguator-mismatch.stderr
@@ -11,8 +11,9 @@ LL | #![deny(rustdoc::broken_intra_doc_links)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: to link to the enum, prefix with `enum@`
    |
-LL | /// Link to [enum@S]
-   |              ~~~~~
+LL - /// Link to [struct@S]
+LL + /// Link to [enum@S]
+   |
 
 error: incompatible link kind for `S`
   --> $DIR/disambiguator-mismatch.rs:27:14
@@ -22,8 +23,9 @@ LL | /// Link to [mod@S]
    |
 help: to link to the enum, prefix with `enum@`
    |
-LL | /// Link to [enum@S]
-   |              ~~~~~
+LL - /// Link to [mod@S]
+LL + /// Link to [enum@S]
+   |
 
 error: incompatible link kind for `S`
   --> $DIR/disambiguator-mismatch.rs:32:14
@@ -33,8 +35,9 @@ LL | /// Link to [union@S]
    |
 help: to link to the enum, prefix with `enum@`
    |
-LL | /// Link to [enum@S]
-   |              ~~~~~
+LL - /// Link to [union@S]
+LL + /// Link to [enum@S]
+   |
 
 error: incompatible link kind for `S`
   --> $DIR/disambiguator-mismatch.rs:37:14
@@ -44,8 +47,9 @@ LL | /// Link to [trait@S]
    |
 help: to link to the enum, prefix with `enum@`
    |
-LL | /// Link to [enum@S]
-   |              ~~~~~
+LL - /// Link to [trait@S]
+LL + /// Link to [enum@S]
+   |
 
 error: incompatible link kind for `T`
   --> $DIR/disambiguator-mismatch.rs:42:14
@@ -55,8 +59,9 @@ LL | /// Link to [struct@T]
    |
 help: to link to the trait, prefix with `trait@`
    |
-LL | /// Link to [trait@T]
-   |              ~~~~~~
+LL - /// Link to [struct@T]
+LL + /// Link to [trait@T]
+   |
 
 error: incompatible link kind for `m`
   --> $DIR/disambiguator-mismatch.rs:47:14
@@ -89,8 +94,9 @@ LL | /// Link to [const@s]
    |
 help: to link to the static, prefix with `static@`
    |
-LL | /// Link to [static@s]
-   |              ~~~~~~~
+LL - /// Link to [const@s]
+LL + /// Link to [static@s]
+   |
 
 error: incompatible link kind for `c`
   --> $DIR/disambiguator-mismatch.rs:63:14
@@ -100,8 +106,9 @@ LL | /// Link to [static@c]
    |
 help: to link to the constant, prefix with `const@`
    |
-LL | /// Link to [const@c]
-   |              ~~~~~~
+LL - /// Link to [static@c]
+LL + /// Link to [const@c]
+   |
 
 error: incompatible link kind for `c`
   --> $DIR/disambiguator-mismatch.rs:68:14
@@ -111,8 +118,9 @@ LL | /// Link to [fn@c]
    |
 help: to link to the constant, prefix with `const@`
    |
-LL | /// Link to [const@c]
-   |              ~~~~~~
+LL - /// Link to [fn@c]
+LL + /// Link to [const@c]
+   |
 
 error: incompatible link kind for `c`
   --> $DIR/disambiguator-mismatch.rs:73:14
@@ -146,8 +154,9 @@ LL | /// Link to [fn@std]
    |
 help: to link to the crate, prefix with `mod@`
    |
-LL | /// Link to [mod@std]
-   |              ~~~~
+LL - /// Link to [fn@std]
+LL + /// Link to [mod@std]
+   |
 
 error: incompatible link kind for `X::y`
   --> $DIR/disambiguator-mismatch.rs:88:14
@@ -157,8 +166,9 @@ LL | /// Link to [method@X::y]
    |
 help: to link to the field, prefix with `field@`
    |
-LL | /// Link to [field@X::y]
-   |              ~~~~~~
+LL - /// Link to [method@X::y]
+LL + /// Link to [field@X::y]
+   |
 
 error: unresolved link to `S::A`
   --> $DIR/disambiguator-mismatch.rs:93:14
@@ -168,8 +178,9 @@ LL | /// Link to [field@S::A]
    |
 help: to link to the variant, prefix with `variant@`
    |
-LL | /// Link to [variant@S::A]
-   |              ~~~~~~~~
+LL - /// Link to [field@S::A]
+LL + /// Link to [variant@S::A]
+   |
 
 error: aborting due to 15 previous errors
 
diff --git a/tests/rustdoc-ui/intra-doc/incompatible-primitive-disambiguator.stderr b/tests/rustdoc-ui/intra-doc/incompatible-primitive-disambiguator.stderr
index b952517022b7..2818b6b4bbab 100644
--- a/tests/rustdoc-ui/intra-doc/incompatible-primitive-disambiguator.stderr
+++ b/tests/rustdoc-ui/intra-doc/incompatible-primitive-disambiguator.stderr
@@ -11,8 +11,9 @@ LL | #![deny(rustdoc::broken_intra_doc_links)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: to link to the associated constant, prefix with `const@`
    |
-LL | //! [const@u8::MIN]
-   |      ~~~~~~
+LL - //! [static@u8::MIN]
+LL + //! [const@u8::MIN]
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/rustdoc-ui/intra-doc/prim-conflict.stderr b/tests/rustdoc-ui/intra-doc/prim-conflict.stderr
index 03ce8f15f0a5..c50f6bb9b875 100644
--- a/tests/rustdoc-ui/intra-doc/prim-conflict.stderr
+++ b/tests/rustdoc-ui/intra-doc/prim-conflict.stderr
@@ -26,12 +26,14 @@ LL | /// [type@char]
    |
 help: to link to the module, prefix with `mod@`
    |
-LL | /// [mod@char]
-   |      ~~~~
+LL - /// [type@char]
+LL + /// [mod@char]
+   |
 help: to link to the primitive type, prefix with `prim@`
    |
-LL | /// [prim@char]
-   |      ~~~~~
+LL - /// [type@char]
+LL + /// [prim@char]
+   |
 
 error: incompatible link kind for `char`
   --> $DIR/prim-conflict.rs:19:6
@@ -41,8 +43,9 @@ LL | /// [struct@char]
    |
 help: to link to the module, prefix with `mod@`
    |
-LL | /// [mod@char]
-   |      ~~~~
+LL - /// [struct@char]
+LL + /// [mod@char]
+   |
 
 error: incompatible link kind for `char`
   --> $DIR/prim-conflict.rs:26:10
@@ -52,8 +55,9 @@ LL |     //! [struct@char]
    |
 help: to link to the primitive type, prefix with `prim@`
    |
-LL |     //! [prim@char]
-   |          ~~~~~
+LL -     //! [struct@char]
+LL +     //! [prim@char]
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/rustdoc-ui/intra-doc/value-ctor.stderr b/tests/rustdoc-ui/intra-doc/value-ctor.stderr
index 8d2a6649f4c0..cfc2bb67396c 100644
--- a/tests/rustdoc-ui/intra-doc/value-ctor.stderr
+++ b/tests/rustdoc-ui/intra-doc/value-ctor.stderr
@@ -11,8 +11,9 @@ LL | #![deny(rustdoc::broken_intra_doc_links)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: to link to the variant, prefix with `variant@`
    |
-LL | /// [variant@Foo::X]
-   |      ~~~~~~~~
+LL - /// [value@Foo::X]
+LL + /// [variant@Foo::X]
+   |
 
 error: unresolved link to `MyStruct`
   --> $DIR/value-ctor.rs:10:11
@@ -22,8 +23,9 @@ LL | /// [tst][value@MyStruct]
    |
 help: to link to the struct, prefix with `struct@`
    |
-LL | /// [tst][struct@MyStruct]
-   |           ~~~~~~~
+LL - /// [tst][value@MyStruct]
+LL + /// [tst][struct@MyStruct]
+   |
 
 error: unresolved link to `Internals`
   --> $DIR/value-ctor.rs:20:15
@@ -33,8 +35,9 @@ LL | /// while [b][value@Internals] fails.
    |
 help: to link to the struct, prefix with `struct@`
    |
-LL | /// while [b][struct@Internals] fails.
-   |               ~~~~~~~
+LL - /// while [b][value@Internals] fails.
+LL + /// while [b][struct@Internals] fails.
+   |
 
 error: incompatible link kind for `Internals`
   --> $DIR/value-ctor.rs:22:15
@@ -44,8 +47,9 @@ LL | /// while [d][variant@Internals] fails.
    |
 help: to link to the struct, prefix with `struct@`
    |
-LL | /// while [d][struct@Internals] fails.
-   |               ~~~~~~~
+LL - /// while [d][variant@Internals] fails.
+LL + /// while [d][struct@Internals] fails.
+   |
 
 error: unresolved link to `Internals2`
   --> $DIR/value-ctor.rs:34:15
@@ -55,8 +59,9 @@ LL | /// while [b][value@Internals2] fails.
    |
 help: to link to the enum, prefix with `enum@`
    |
-LL | /// while [b][enum@Internals2] fails.
-   |               ~~~~~
+LL - /// while [b][value@Internals2] fails.
+LL + /// while [b][enum@Internals2] fails.
+   |
 
 error: aborting due to 5 previous errors
 
diff --git a/tests/rustdoc-ui/intra-doc/weird-syntax.stderr b/tests/rustdoc-ui/intra-doc/weird-syntax.stderr
index 17bcbc783fd9..1381c1b31ebb 100644
--- a/tests/rustdoc-ui/intra-doc/weird-syntax.stderr
+++ b/tests/rustdoc-ui/intra-doc/weird-syntax.stderr
@@ -11,8 +11,9 @@ LL | #![deny(rustdoc::broken_intra_doc_links)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: to link to the trait, prefix with `trait@`
    |
-LL | /// [`trait@Clone`]
-   |       ~~~~~~
+LL - /// [`struct@Clone`]
+LL + /// [`trait@Clone`]
+   |
 
 error: incompatible link kind for `Clone`
   --> $DIR/weird-syntax.rs:21:9
@@ -22,8 +23,9 @@ LL | /// [```struct@Clone```]
    |
 help: to link to the trait, prefix with `trait@`
    |
-LL | /// [```trait@Clone```]
-   |         ~~~~~~
+LL - /// [```struct@Clone```]
+LL + /// [```trait@Clone```]
+   |
 
 error: incompatible link kind for `Clone`
   --> $DIR/weird-syntax.rs:24:11
@@ -33,8 +35,9 @@ LL | /// [  `  struct@Clone  `  ]
    |
 help: to link to the trait, prefix with `trait@`
    |
-LL | /// [  `  trait@Clone  `  ]
-   |           ~~~~~~
+LL - /// [  `  struct@Clone  `  ]
+LL + /// [  `  trait@Clone  `  ]
+   |
 
 error: unresolved link to `Clone`
   --> $DIR/weird-syntax.rs:27:9
@@ -104,8 +107,9 @@ LL | /// [x][ struct@Clone]
    |
 help: to link to the trait, prefix with `trait@`
    |
-LL | /// [x][ trait@Clone]
-   |          ~~~~~~
+LL - /// [x][ struct@Clone]
+LL + /// [x][ trait@Clone]
+   |
 
 error: incompatible link kind for `Clone`
   --> $DIR/weird-syntax.rs:65:9
@@ -115,8 +119,9 @@ LL | /// [x][struct@Clone ]
    |
 help: to link to the trait, prefix with `trait@`
    |
-LL | /// [x][trait@Clone ]
-   |         ~~~~~~
+LL - /// [x][struct@Clone ]
+LL + /// [x][trait@Clone ]
+   |
 
 error: unresolved link to `Clone`
   --> $DIR/weird-syntax.rs:74:9
@@ -158,8 +163,9 @@ LL | /// [w]( struct@Clone)
    |
 help: to link to the trait, prefix with `trait@`
    |
-LL | /// [w]( trait@Clone)
-   |          ~~~~~~
+LL - /// [w]( struct@Clone)
+LL + /// [w]( trait@Clone)
+   |
 
 error: incompatible link kind for `Clone`
   --> $DIR/weird-syntax.rs:94:9
@@ -169,8 +175,9 @@ LL | /// [w](struct@Clone )
    |
 help: to link to the trait, prefix with `trait@`
    |
-LL | /// [w](trait@Clone )
-   |         ~~~~~~
+LL - /// [w](struct@Clone )
+LL + /// [w](trait@Clone )
+   |
 
 error: unresolved link to `Clone`
   --> $DIR/weird-syntax.rs:97:9
diff --git a/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr
index 1e52b699820b..e4a846554863 100644
--- a/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr
+++ b/tests/rustdoc-ui/issues/ice-generic-type-alias-105742.stderr
@@ -319,8 +319,9 @@ LL | |  > {
    | |__^ ...because it uses `Self` as a type parameter
 help: consider using an opaque type instead
    |
-LL | pub fn next<'a, T>(s: &'a mut impl SVec) {
-   |                               ~~~~
+LL - pub fn next<'a, T>(s: &'a mut dyn SVec) {
+LL + pub fn next<'a, T>(s: &'a mut impl SVec) {
+   |
 
 error[E0107]: missing generics for associated type `SVec::Item`
   --> $DIR/ice-generic-type-alias-105742.rs:16:21
diff --git a/tests/rustdoc-ui/issues/ice-typeof-102986.stderr b/tests/rustdoc-ui/issues/ice-typeof-102986.stderr
index 20dbb2661bc2..02e257a9163c 100644
--- a/tests/rustdoc-ui/issues/ice-typeof-102986.stderr
+++ b/tests/rustdoc-ui/issues/ice-typeof-102986.stderr
@@ -6,8 +6,9 @@ LL |     y: (typeof("hey"),),
    |
 help: consider replacing `typeof(...)` with an actual type
    |
-LL |     y: (&str,),
-   |         ~~~~
+LL -     y: (typeof("hey"),),
+LL +     y: (&str,),
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/rustdoc-ui/issues/issue-120444-1.stderr b/tests/rustdoc-ui/issues/issue-120444-1.stderr
index 7bc56b4263f2..aabdc91df2bd 100644
--- a/tests/rustdoc-ui/issues/issue-120444-1.stderr
+++ b/tests/rustdoc-ui/issues/issue-120444-1.stderr
@@ -15,8 +15,9 @@ LL | #![deny(rustdoc::redundant_explicit_links)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: remove explicit link target
    |
-LL | /// [`Vfs`]
-   |     ~~~~~~~
+LL - /// [`Vfs`][crate::Vfs]
+LL + /// [`Vfs`]
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/rustdoc-ui/issues/issue-120444-2.stderr b/tests/rustdoc-ui/issues/issue-120444-2.stderr
index 310bf08e2b52..ee160736b4d2 100644
--- a/tests/rustdoc-ui/issues/issue-120444-2.stderr
+++ b/tests/rustdoc-ui/issues/issue-120444-2.stderr
@@ -15,8 +15,9 @@ LL | #![deny(rustdoc::redundant_explicit_links)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: remove explicit link target
    |
-LL | /// [`Vfs`]
-   |     ~~~~~~~
+LL - /// [`Vfs`][crate::Vfs]
+LL + /// [`Vfs`]
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/rustdoc-ui/lints/redundant_explicit_links.stderr b/tests/rustdoc-ui/lints/redundant_explicit_links.stderr
index 34ec9be6646c..f90c41af9f1a 100644
--- a/tests/rustdoc-ui/lints/redundant_explicit_links.stderr
+++ b/tests/rustdoc-ui/lints/redundant_explicit_links.stderr
@@ -15,8 +15,9 @@ LL | #![deny(rustdoc::redundant_explicit_links)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: remove explicit link target
    |
-LL | /// [dummy_target]
-   |     ~~~~~~~~~~~~~~
+LL - /// [dummy_target](dummy_target)
+LL + /// [dummy_target]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:9:22
@@ -30,8 +31,9 @@ LL | /// [`dummy_target`](dummy_target)
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`dummy_target`]
-   |     ~~~~~~~~~~~~~~~~
+LL - /// [`dummy_target`](dummy_target)
+LL + /// [`dummy_target`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:12:11
@@ -45,8 +47,9 @@ LL | /// [Vec](Vec)
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [Vec]
-   |     ~~~~~
+LL - /// [Vec](Vec)
+LL + /// [Vec]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:14:13
@@ -60,8 +63,9 @@ LL | /// [`Vec`](Vec)
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`Vec`]
-   |     ~~~~~~~
+LL - /// [`Vec`](Vec)
+LL + /// [`Vec`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:16:11
@@ -75,8 +79,9 @@ LL | /// [Vec](std::vec::Vec)
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [Vec]
-   |     ~~~~~
+LL - /// [Vec](std::vec::Vec)
+LL + /// [Vec]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:18:13
@@ -90,8 +95,9 @@ LL | /// [`Vec`](std::vec::Vec)
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`Vec`]
-   |     ~~~~~~~
+LL - /// [`Vec`](std::vec::Vec)
+LL + /// [`Vec`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:20:21
@@ -105,8 +111,9 @@ LL | /// [std::vec::Vec](Vec)
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [std::vec::Vec]
-   |     ~~~~~~~~~~~~~~~
+LL - /// [std::vec::Vec](Vec)
+LL + /// [std::vec::Vec]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:22:23
@@ -120,8 +127,9 @@ LL | /// [`std::vec::Vec`](Vec)
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`std::vec::Vec`]
-   |     ~~~~~~~~~~~~~~~~~
+LL - /// [`std::vec::Vec`](Vec)
+LL + /// [`std::vec::Vec`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:24:21
@@ -135,8 +143,9 @@ LL | /// [std::vec::Vec](std::vec::Vec)
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [std::vec::Vec]
-   |     ~~~~~~~~~~~~~~~
+LL - /// [std::vec::Vec](std::vec::Vec)
+LL + /// [std::vec::Vec]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:26:23
@@ -150,8 +159,9 @@ LL | /// [`std::vec::Vec`](std::vec::Vec)
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`std::vec::Vec`]
-   |     ~~~~~~~~~~~~~~~~~
+LL - /// [`std::vec::Vec`](std::vec::Vec)
+LL + /// [`std::vec::Vec`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:29:13
@@ -165,8 +175,9 @@ LL | /// [usize](usize)
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [usize]
-   |     ~~~~~~~
+LL - /// [usize](usize)
+LL + /// [usize]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:31:15
@@ -180,8 +191,9 @@ LL | /// [`usize`](usize)
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`usize`]
-   |     ~~~~~~~~~
+LL - /// [`usize`](usize)
+LL + /// [`usize`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:33:13
@@ -195,8 +207,9 @@ LL | /// [usize](std::primitive::usize)
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [usize]
-   |     ~~~~~~~
+LL - /// [usize](std::primitive::usize)
+LL + /// [usize]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:35:15
@@ -210,8 +223,9 @@ LL | /// [`usize`](std::primitive::usize)
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`usize`]
-   |     ~~~~~~~~~
+LL - /// [`usize`](std::primitive::usize)
+LL + /// [`usize`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:37:29
@@ -225,8 +239,9 @@ LL | /// [std::primitive::usize](usize)
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [std::primitive::usize]
-   |     ~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// [std::primitive::usize](usize)
+LL + /// [std::primitive::usize]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:39:31
@@ -240,8 +255,9 @@ LL | /// [`std::primitive::usize`](usize)
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`std::primitive::usize`]
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// [`std::primitive::usize`](usize)
+LL + /// [`std::primitive::usize`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:41:29
@@ -255,8 +271,9 @@ LL | /// [std::primitive::usize](std::primitive::usize)
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [std::primitive::usize]
-   |     ~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// [std::primitive::usize](std::primitive::usize)
+LL + /// [std::primitive::usize]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:43:31
@@ -270,8 +287,9 @@ LL | /// [`std::primitive::usize`](std::primitive::usize)
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`std::primitive::usize`]
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// [`std::primitive::usize`](std::primitive::usize)
+LL + /// [`std::primitive::usize`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:46:20
@@ -285,8 +303,9 @@ LL | /// [dummy_target](dummy_target) TEXT
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [dummy_target] TEXT
-   |     ~~~~~~~~~~~~~~
+LL - /// [dummy_target](dummy_target) TEXT
+LL + /// [dummy_target] TEXT
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:48:22
@@ -300,8 +319,9 @@ LL | /// [`dummy_target`](dummy_target) TEXT
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`dummy_target`] TEXT
-   |     ~~~~~~~~~~~~~~~~
+LL - /// [`dummy_target`](dummy_target) TEXT
+LL + /// [`dummy_target`] TEXT
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:56:20
@@ -315,8 +335,9 @@ LL | /// [dummy_target][dummy_target]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [dummy_target]
-   |     ~~~~~~~~~~~~~~
+LL - /// [dummy_target][dummy_target]
+LL + /// [dummy_target]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:58:22
@@ -330,8 +351,9 @@ LL | /// [`dummy_target`][dummy_target]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`dummy_target`]
-   |     ~~~~~~~~~~~~~~~~
+LL - /// [`dummy_target`][dummy_target]
+LL + /// [`dummy_target`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:61:11
@@ -345,8 +367,9 @@ LL | /// [Vec][Vec]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [Vec]
-   |     ~~~~~
+LL - /// [Vec][Vec]
+LL + /// [Vec]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:63:13
@@ -360,8 +383,9 @@ LL | /// [`Vec`][Vec]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`Vec`]
-   |     ~~~~~~~
+LL - /// [`Vec`][Vec]
+LL + /// [`Vec`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:65:11
@@ -375,8 +399,9 @@ LL | /// [Vec][std::vec::Vec]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [Vec]
-   |     ~~~~~
+LL - /// [Vec][std::vec::Vec]
+LL + /// [Vec]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:67:13
@@ -390,8 +415,9 @@ LL | /// [`Vec`][std::vec::Vec]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`Vec`]
-   |     ~~~~~~~
+LL - /// [`Vec`][std::vec::Vec]
+LL + /// [`Vec`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:69:21
@@ -405,8 +431,9 @@ LL | /// [std::vec::Vec][Vec]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [std::vec::Vec]
-   |     ~~~~~~~~~~~~~~~
+LL - /// [std::vec::Vec][Vec]
+LL + /// [std::vec::Vec]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:71:23
@@ -420,8 +447,9 @@ LL | /// [`std::vec::Vec`][Vec]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`std::vec::Vec`]
-   |     ~~~~~~~~~~~~~~~~~
+LL - /// [`std::vec::Vec`][Vec]
+LL + /// [`std::vec::Vec`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:73:21
@@ -435,8 +463,9 @@ LL | /// [std::vec::Vec][std::vec::Vec]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [std::vec::Vec]
-   |     ~~~~~~~~~~~~~~~
+LL - /// [std::vec::Vec][std::vec::Vec]
+LL + /// [std::vec::Vec]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:75:23
@@ -450,8 +479,9 @@ LL | /// [`std::vec::Vec`][std::vec::Vec]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`std::vec::Vec`]
-   |     ~~~~~~~~~~~~~~~~~
+LL - /// [`std::vec::Vec`][std::vec::Vec]
+LL + /// [`std::vec::Vec`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:78:13
@@ -465,8 +495,9 @@ LL | /// [usize][usize]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [usize]
-   |     ~~~~~~~
+LL - /// [usize][usize]
+LL + /// [usize]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:80:15
@@ -480,8 +511,9 @@ LL | /// [`usize`][usize]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`usize`]
-   |     ~~~~~~~~~
+LL - /// [`usize`][usize]
+LL + /// [`usize`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:82:13
@@ -495,8 +527,9 @@ LL | /// [usize][std::primitive::usize]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [usize]
-   |     ~~~~~~~
+LL - /// [usize][std::primitive::usize]
+LL + /// [usize]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:84:15
@@ -510,8 +543,9 @@ LL | /// [`usize`][std::primitive::usize]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`usize`]
-   |     ~~~~~~~~~
+LL - /// [`usize`][std::primitive::usize]
+LL + /// [`usize`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:86:29
@@ -525,8 +559,9 @@ LL | /// [std::primitive::usize][usize]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [std::primitive::usize]
-   |     ~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// [std::primitive::usize][usize]
+LL + /// [std::primitive::usize]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:88:31
@@ -540,8 +575,9 @@ LL | /// [`std::primitive::usize`][usize]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`std::primitive::usize`]
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// [`std::primitive::usize`][usize]
+LL + /// [`std::primitive::usize`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:90:29
@@ -555,8 +591,9 @@ LL | /// [std::primitive::usize][std::primitive::usize]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [std::primitive::usize]
-   |     ~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// [std::primitive::usize][std::primitive::usize]
+LL + /// [std::primitive::usize]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:92:31
@@ -570,8 +607,9 @@ LL | /// [`std::primitive::usize`][std::primitive::usize]
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`std::primitive::usize`]
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// [`std::primitive::usize`][std::primitive::usize]
+LL + /// [`std::primitive::usize`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:95:20
@@ -585,8 +623,9 @@ LL | /// [dummy_target][dummy_target] TEXT
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [dummy_target] TEXT
-   |     ~~~~~~~~~~~~~~
+LL - /// [dummy_target][dummy_target] TEXT
+LL + /// [dummy_target] TEXT
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:97:22
@@ -600,8 +639,9 @@ LL | /// [`dummy_target`][dummy_target] TEXT
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`dummy_target`] TEXT
-   |     ~~~~~~~~~~~~~~~~
+LL - /// [`dummy_target`][dummy_target] TEXT
+LL + /// [`dummy_target`] TEXT
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:105:20
@@ -620,8 +660,9 @@ LL | /// [dummy_target]: dummy_target
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [dummy_target]
-   |     ~~~~~~~~~~~~~~
+LL - /// [dummy_target][dummy_target]
+LL + /// [dummy_target]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:107:22
@@ -640,8 +681,9 @@ LL | /// [dummy_target]: dummy_target
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`dummy_target`]
-   |     ~~~~~~~~~~~~~~~~
+LL - /// [`dummy_target`][dummy_target]
+LL + /// [`dummy_target`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:110:11
@@ -660,8 +702,9 @@ LL | /// [Vec]: Vec
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [Vec]
-   |     ~~~~~
+LL - /// [Vec][Vec]
+LL + /// [Vec]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:112:13
@@ -680,8 +723,9 @@ LL | /// [Vec]: Vec
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`Vec`]
-   |     ~~~~~~~
+LL - /// [`Vec`][Vec]
+LL + /// [`Vec`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:114:11
@@ -700,8 +744,9 @@ LL | /// [std::vec::Vec]: Vec
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [Vec]
-   |     ~~~~~
+LL - /// [Vec][std::vec::Vec]
+LL + /// [Vec]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:116:13
@@ -720,8 +765,9 @@ LL | /// [std::vec::Vec]: Vec
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`Vec`]
-   |     ~~~~~~~
+LL - /// [`Vec`][std::vec::Vec]
+LL + /// [`Vec`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:118:21
@@ -740,8 +786,9 @@ LL | /// [Vec]: Vec
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [std::vec::Vec]
-   |     ~~~~~~~~~~~~~~~
+LL - /// [std::vec::Vec][Vec]
+LL + /// [std::vec::Vec]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:120:23
@@ -760,8 +807,9 @@ LL | /// [Vec]: Vec
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`std::vec::Vec`]
-   |     ~~~~~~~~~~~~~~~~~
+LL - /// [`std::vec::Vec`][Vec]
+LL + /// [`std::vec::Vec`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:122:21
@@ -780,8 +828,9 @@ LL | /// [std::vec::Vec]: Vec
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [std::vec::Vec]
-   |     ~~~~~~~~~~~~~~~
+LL - /// [std::vec::Vec][std::vec::Vec]
+LL + /// [std::vec::Vec]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:124:23
@@ -800,8 +849,9 @@ LL | /// [std::vec::Vec]: Vec
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`std::vec::Vec`]
-   |     ~~~~~~~~~~~~~~~~~
+LL - /// [`std::vec::Vec`][std::vec::Vec]
+LL + /// [`std::vec::Vec`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:127:13
@@ -820,8 +870,9 @@ LL | /// [usize]: usize
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [usize]
-   |     ~~~~~~~
+LL - /// [usize][usize]
+LL + /// [usize]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:129:15
@@ -840,8 +891,9 @@ LL | /// [usize]: usize
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`usize`]
-   |     ~~~~~~~~~
+LL - /// [`usize`][usize]
+LL + /// [`usize`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:131:13
@@ -860,8 +912,9 @@ LL | /// [std::primitive::usize]: usize
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [usize]
-   |     ~~~~~~~
+LL - /// [usize][std::primitive::usize]
+LL + /// [usize]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:133:15
@@ -880,8 +933,9 @@ LL | /// [std::primitive::usize]: usize
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`usize`]
-   |     ~~~~~~~~~
+LL - /// [`usize`][std::primitive::usize]
+LL + /// [`usize`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:135:29
@@ -900,8 +954,9 @@ LL | /// [usize]: usize
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [std::primitive::usize]
-   |     ~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// [std::primitive::usize][usize]
+LL + /// [std::primitive::usize]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:137:31
@@ -920,8 +975,9 @@ LL | /// [usize]: usize
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`std::primitive::usize`]
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// [`std::primitive::usize`][usize]
+LL + /// [`std::primitive::usize`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:139:29
@@ -940,8 +996,9 @@ LL | /// [std::primitive::usize]: usize
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [std::primitive::usize]
-   |     ~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// [std::primitive::usize][std::primitive::usize]
+LL + /// [std::primitive::usize]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:141:31
@@ -960,8 +1017,9 @@ LL | /// [std::primitive::usize]: usize
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`std::primitive::usize`]
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - /// [`std::primitive::usize`][std::primitive::usize]
+LL + /// [`std::primitive::usize`]
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:144:20
@@ -980,8 +1038,9 @@ LL | /// [dummy_target]: dummy_target
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [dummy_target] TEXT
-   |     ~~~~~~~~~~~~~~
+LL - /// [dummy_target][dummy_target] TEXT
+LL + /// [dummy_target] TEXT
+   |
 
 error: redundant explicit link target
   --> $DIR/redundant_explicit_links.rs:146:22
@@ -1000,8 +1059,9 @@ LL | /// [dummy_target]: dummy_target
            the label is used to resolve intra-doc links
 help: remove explicit link target
    |
-LL | /// [`dummy_target`] TEXT
-   |     ~~~~~~~~~~~~~~~~
+LL - /// [`dummy_target`][dummy_target] TEXT
+LL + /// [`dummy_target`] TEXT
+   |
 
 error: aborting due to 60 previous errors
 
diff --git a/tests/ui/anon-params/anon-params-denied-2018.stderr b/tests/ui/anon-params/anon-params-denied-2018.stderr
index 2d6356ffcb1c..0c38987ca6f1 100644
--- a/tests/ui/anon-params/anon-params-denied-2018.stderr
+++ b/tests/ui/anon-params/anon-params-denied-2018.stderr
@@ -31,8 +31,9 @@ LL |     fn foo_with_ref(self: &mut i32);
    |                     +++++
 help: if this is a parameter name, give it a type
    |
-LL |     fn foo_with_ref(i32: &mut TypeName);
-   |                     ~~~~~~~~~~~~~~~~~~
+LL -     fn foo_with_ref(&mut i32);
+LL +     fn foo_with_ref(i32: &mut TypeName);
+   |
 help: if this is a type, explicitly ignore the parameter name
    |
 LL |     fn foo_with_ref(_: &mut i32);
diff --git a/tests/ui/argument-suggestions/basic.stderr b/tests/ui/argument-suggestions/basic.stderr
index 83f0f630fe81..9a639d4b5e4e 100644
--- a/tests/ui/argument-suggestions/basic.stderr
+++ b/tests/ui/argument-suggestions/basic.stderr
@@ -42,8 +42,9 @@ LL | fn missing(_i: u32) {}
    |    ^^^^^^^ -------
 help: provide the argument
    |
-LL |     missing(/* u32 */);
-   |            ~~~~~~~~~~~
+LL -     missing();
+LL +     missing(/* u32 */);
+   |
 
 error[E0308]: arguments to this function are incorrect
   --> $DIR/basic.rs:23:5
@@ -60,8 +61,9 @@ LL | fn swapped(_i: u32, _s: &str) {}
    |    ^^^^^^^
 help: swap these arguments
    |
-LL |     swapped(1, "");
-   |            ~~~~~~~
+LL -     swapped("", 1);
+LL +     swapped(1, "");
+   |
 
 error[E0308]: arguments to this function are incorrect
   --> $DIR/basic.rs:24:5
@@ -79,8 +81,9 @@ LL | fn permuted(_x: X, _y: Y, _z: Z) {}
    |    ^^^^^^^^
 help: reorder these arguments
    |
-LL |     permuted(X {}, Y {}, Z {});
-   |             ~~~~~~~~~~~~~~~~~~
+LL -     permuted(Y {}, Z {}, X {});
+LL +     permuted(X {}, Y {}, Z {});
+   |
 
 error[E0057]: this function takes 1 argument but 0 arguments were supplied
   --> $DIR/basic.rs:27:5
@@ -95,8 +98,9 @@ LL |     let closure = |x| x;
    |                   ^^^
 help: provide the argument
    |
-LL |     closure(/* x */);
-   |            ~~~~~~~~~
+LL -     closure();
+LL +     closure(/* x */);
+   |
 
 error: aborting due to 6 previous errors
 
diff --git a/tests/ui/argument-suggestions/complex.stderr b/tests/ui/argument-suggestions/complex.stderr
index 20c7c2fd7a5a..be8838f17d75 100644
--- a/tests/ui/argument-suggestions/complex.stderr
+++ b/tests/ui/argument-suggestions/complex.stderr
@@ -11,8 +11,9 @@ LL | fn complex(_i: u32, _s: &str, _e: E, _f: F, _g: G, _x: X, _y: Y, _z: Z ) {}
    |    ^^^^^^^ -------            -----
 help: did you mean
    |
-LL |   complex(/* u32 */, &"", /* E */, F::X2, G{}, X {}, Y {}, Z {});
-   |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -   complex(1.0, H {}, &"", G{}, F::X2, Z {}, X {}, Y {});
+LL +   complex(/* u32 */, &"", /* E */, F::X2, G{}, X {}, Y {}, Z {});
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/argument-suggestions/display-is-suggestable.stderr b/tests/ui/argument-suggestions/display-is-suggestable.stderr
index eea88c3e78d7..bb5df1ec234c 100644
--- a/tests/ui/argument-suggestions/display-is-suggestable.stderr
+++ b/tests/ui/argument-suggestions/display-is-suggestable.stderr
@@ -11,8 +11,9 @@ LL | fn foo(x: &(dyn Display + Send)) {}
    |    ^^^ ------------------------
 help: provide the argument
    |
-LL |     foo(/* &dyn std::fmt::Display + Send */);
-   |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     foo();
+LL +     foo(/* &dyn std::fmt::Display + Send */);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/argument-suggestions/extern-fn-arg-names.stderr b/tests/ui/argument-suggestions/extern-fn-arg-names.stderr
index 2aa4983624ce..62670316cd16 100644
--- a/tests/ui/argument-suggestions/extern-fn-arg-names.stderr
+++ b/tests/ui/argument-suggestions/extern-fn-arg-names.stderr
@@ -17,8 +17,9 @@ LL |     fn dstfn(src: i32, dst: err);
    |        ^^^^^           ---
 help: provide the argument
    |
-LL |     dstfn(1, /* dst */);
-   |          ~~~~~~~~~~~~~~
+LL -     dstfn(1);
+LL +     dstfn(1, /* dst */);
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/argument-suggestions/issue-100478.stderr b/tests/ui/argument-suggestions/issue-100478.stderr
index 6299571d9985..8889a0ab5df0 100644
--- a/tests/ui/argument-suggestions/issue-100478.stderr
+++ b/tests/ui/argument-suggestions/issue-100478.stderr
@@ -14,8 +14,9 @@ LL | fn three_diff(_a: T1, _b: T2, _c: T3) {}
    |    ^^^^^^^^^^ ------          ------
 help: provide the arguments
    |
-LL |     three_diff(/* T1 */, T2::new(0), /* T3 */);
-   |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     three_diff(T2::new(0));
+LL +     three_diff(/* T1 */, T2::new(0), /* T3 */);
+   |
 
 error[E0308]: arguments to this function are incorrect
   --> $DIR/issue-100478.rs:35:5
@@ -34,8 +35,9 @@ LL | fn four_shuffle(_a: T1, _b: T2, _c: T3, _d: T4) {}
    |    ^^^^^^^^^^^^
 help: did you mean
    |
-LL |     four_shuffle(T1::default(), T2::default(), T3::default(), T4::default());
-   |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     four_shuffle(T3::default(), T4::default(), T1::default(), T2::default());
+LL +     four_shuffle(T1::default(), T2::default(), T3::default(), T4::default());
+   |
 
 error[E0308]: arguments to this function are incorrect
   --> $DIR/issue-100478.rs:36:5
@@ -53,8 +55,9 @@ LL | fn four_shuffle(_a: T1, _b: T2, _c: T3, _d: T4) {}
    |    ^^^^^^^^^^^^                         ------
 help: swap these arguments
    |
-LL |     four_shuffle(T1::default(), T2::default(), T3::default(), /* T4 */);
-   |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     four_shuffle(T3::default(), T2::default(), T1::default(), T3::default());
+LL +     four_shuffle(T1::default(), T2::default(), T3::default(), /* T4 */);
+   |
 
 error[E0061]: this function takes 8 arguments but 7 arguments were supplied
   --> $DIR/issue-100478.rs:47:5
@@ -72,8 +75,13 @@ LL | fn foo(p1: T1, p2: Arc, p3: T3, p4: Arc, p5: T5, p6: T6, p7: T7, p8
    |    ^^^         -----------
 help: provide the argument
    |
-LL |     foo(p1, /* Arc */, p3, p4, p5, p6, p7, p8);
-   |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     foo(
+LL -
+LL -         p1, //p2,
+LL -         p3, p4, p5, p6, p7, p8,
+LL -     );
+LL +     foo(p1, /* Arc */, p3, p4, p5, p6, p7, p8);
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/argument-suggestions/issue-101097.stderr b/tests/ui/argument-suggestions/issue-101097.stderr
index 45aa2dba5d59..25770e36aa37 100644
--- a/tests/ui/argument-suggestions/issue-101097.stderr
+++ b/tests/ui/argument-suggestions/issue-101097.stderr
@@ -15,8 +15,9 @@ LL | fn f(
    |    ^
 help: did you mean
    |
-LL |     f(A, A, B, B, C, C);
-   |      ~~~~~~~~~~~~~~~~~~
+LL -     f(C, A, A, A, B, B, C);
+LL +     f(A, A, B, B, C, C);
+   |
 
 error[E0308]: arguments to this function are incorrect
   --> $DIR/issue-101097.rs:17:5
@@ -31,8 +32,9 @@ LL | fn f(
    |    ^
 help: did you mean
    |
-LL |     f(A, A, B, B, C, C);
-   |      ~~~~~~~~~~~~~~~~~~
+LL -     f(C, C, A, A, B, B);
+LL +     f(A, A, B, B, C, C);
+   |
 
 error[E0308]: arguments to this function are incorrect
   --> $DIR/issue-101097.rs:18:5
@@ -55,8 +57,9 @@ LL |     c2: C,
    |     -----
 help: did you mean
    |
-LL |     f(A, A, B, B, /* C */, /* C */);
-   |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     f(A, A, D, D, B, B);
+LL +     f(A, A, B, B, /* C */, /* C */);
+   |
 
 error[E0308]: arguments to this function are incorrect
   --> $DIR/issue-101097.rs:19:5
@@ -75,8 +78,9 @@ LL | fn f(
    |    ^
 help: did you mean
    |
-LL |     f(A, A, B, B, C, C);
-   |      ~~~~~~~~~~~~~~~~~~
+LL -     f(C, C, B, B, A, A);
+LL +     f(A, A, B, B, C, C);
+   |
 
 error[E0308]: arguments to this function are incorrect
   --> $DIR/issue-101097.rs:20:5
@@ -99,8 +103,9 @@ LL |     b1: B,
    |     -----
 help: did you mean
    |
-LL |     f(A, A, /* B */, B, C, C);
-   |      ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     f(C, C, A, B, A, A);
+LL +     f(A, A, /* B */, B, C, C);
+   |
 
 error: aborting due to 5 previous errors
 
diff --git a/tests/ui/argument-suggestions/issue-109831.stderr b/tests/ui/argument-suggestions/issue-109831.stderr
index cee87223866b..1a3a597175d8 100644
--- a/tests/ui/argument-suggestions/issue-109831.stderr
+++ b/tests/ui/argument-suggestions/issue-109831.stderr
@@ -9,8 +9,9 @@ LL | fn f(b1: B, b2: B, a2: C) {}
    |
 help: a struct with a similar name exists
    |
-LL | fn f(b1: B, b2: B, a2: A) {}
-   |                        ~
+LL - fn f(b1: B, b2: B, a2: C) {}
+LL + fn f(b1: B, b2: B, a2: A) {}
+   |
 help: you might be missing a type parameter
    |
 LL | fn f(b1: B, b2: B, a2: C) {}
diff --git a/tests/ui/argument-suggestions/issue-96638.stderr b/tests/ui/argument-suggestions/issue-96638.stderr
index 509b2a157ded..288a6853d059 100644
--- a/tests/ui/argument-suggestions/issue-96638.stderr
+++ b/tests/ui/argument-suggestions/issue-96638.stderr
@@ -13,8 +13,9 @@ LL | fn f(_: usize, _: &usize, _: usize) {}
    |    ^ --------             --------
 help: provide the argument
    |
-LL |     f(/* usize */, &x, /* usize */);
-   |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     f(&x, "");
+LL +     f(/* usize */, &x, /* usize */);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/argument-suggestions/issue-97197.stderr b/tests/ui/argument-suggestions/issue-97197.stderr
index 1cf19fc1bc80..acaf4f151073 100644
--- a/tests/ui/argument-suggestions/issue-97197.stderr
+++ b/tests/ui/argument-suggestions/issue-97197.stderr
@@ -11,8 +11,9 @@ LL | pub fn g(a1: (), a2: bool, a3: bool, a4: bool, a5: bool, a6: ()) -> () {}
    |        ^         --------  --------  --------  --------
 help: provide the arguments
    |
-LL |     g((), /* bool */, /* bool */, /* bool */, /* bool */, ());
-   |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     g((), ());
+LL +     g((), /* bool */, /* bool */, /* bool */, /* bool */, ());
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/argument-suggestions/issue-98894.stderr b/tests/ui/argument-suggestions/issue-98894.stderr
index 93e604c3101f..44353cb33388 100644
--- a/tests/ui/argument-suggestions/issue-98894.stderr
+++ b/tests/ui/argument-suggestions/issue-98894.stderr
@@ -11,8 +11,9 @@ LL |     (|_, ()| ())(if true {} else {return;});
    |      ^^^^^^^
 help: provide the argument
    |
-LL |     (|_, ()| ())(if true {} else {return;}, ());
-   |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     (|_, ()| ())(if true {} else {return;});
+LL +     (|_, ()| ())(if true {} else {return;}, ());
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/argument-suggestions/issue-98897.stderr b/tests/ui/argument-suggestions/issue-98897.stderr
index 671e3d99d855..fd3ef467b1c3 100644
--- a/tests/ui/argument-suggestions/issue-98897.stderr
+++ b/tests/ui/argument-suggestions/issue-98897.stderr
@@ -11,8 +11,9 @@ LL |     (|_, ()| ())([return, ()]);
    |      ^^^^^^^
 help: provide the argument
    |
-LL |     (|_, ()| ())([return, ()], ());
-   |                 ~~~~~~~~~~~~~~~~~~
+LL -     (|_, ()| ())([return, ()]);
+LL +     (|_, ()| ())([return, ()], ());
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/argument-suggestions/issue-99482.stderr b/tests/ui/argument-suggestions/issue-99482.stderr
index be4078746152..b3c39604a99b 100644
--- a/tests/ui/argument-suggestions/issue-99482.stderr
+++ b/tests/ui/argument-suggestions/issue-99482.stderr
@@ -11,8 +11,9 @@ LL |     let f = |_: (), f: fn()| f;
    |             ^^^^^^^^^^^^^^^^
 help: provide the argument
    |
-LL |     let _f = f((), main);
-   |               ~~~~~~~~~~
+LL -     let _f = f(main);
+LL +     let _f = f((), main);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/argument-suggestions/missing_arguments.stderr b/tests/ui/argument-suggestions/missing_arguments.stderr
index fc219b9ce2c6..264c485cbe1c 100644
--- a/tests/ui/argument-suggestions/missing_arguments.stderr
+++ b/tests/ui/argument-suggestions/missing_arguments.stderr
@@ -11,8 +11,9 @@ LL | fn one_arg(_a: i32) {}
    |    ^^^^^^^ -------
 help: provide the argument
    |
-LL |   one_arg(/* i32 */);
-   |          ~~~~~~~~~~~
+LL -   one_arg();
+LL +   one_arg(/* i32 */);
+   |
 
 error[E0061]: this function takes 2 arguments but 0 arguments were supplied
   --> $DIR/missing_arguments.rs:14:3
@@ -27,8 +28,9 @@ LL | fn two_same(_a: i32, _b: i32) {}
    |    ^^^^^^^^ -------  -------
 help: provide the arguments
    |
-LL |   two_same(/* i32 */, /* i32 */);
-   |           ~~~~~~~~~~~~~~~~~~~~~~
+LL -   two_same(               );
+LL +   two_same(/* i32 */, /* i32 */);
+   |
 
 error[E0061]: this function takes 2 arguments but 1 argument was supplied
   --> $DIR/missing_arguments.rs:15:3
@@ -43,8 +45,9 @@ LL | fn two_same(_a: i32, _b: i32) {}
    |    ^^^^^^^^          -------
 help: provide the argument
    |
-LL |   two_same(1, /* i32 */);
-   |           ~~~~~~~~~~~~~~
+LL -   two_same(   1           );
+LL +   two_same(1, /* i32 */);
+   |
 
 error[E0061]: this function takes 2 arguments but 0 arguments were supplied
   --> $DIR/missing_arguments.rs:16:3
@@ -59,8 +62,9 @@ LL | fn two_diff(_a: i32, _b: f32) {}
    |    ^^^^^^^^ -------  -------
 help: provide the arguments
    |
-LL |   two_diff(/* i32 */, /* f32 */);
-   |           ~~~~~~~~~~~~~~~~~~~~~~
+LL -   two_diff(               );
+LL +   two_diff(/* i32 */, /* f32 */);
+   |
 
 error[E0061]: this function takes 2 arguments but 1 argument was supplied
   --> $DIR/missing_arguments.rs:17:3
@@ -75,8 +79,9 @@ LL | fn two_diff(_a: i32, _b: f32) {}
    |    ^^^^^^^^          -------
 help: provide the argument
    |
-LL |   two_diff(1, /* f32 */);
-   |           ~~~~~~~~~~~~~~
+LL -   two_diff(   1           );
+LL +   two_diff(1, /* f32 */);
+   |
 
 error[E0061]: this function takes 2 arguments but 1 argument was supplied
   --> $DIR/missing_arguments.rs:18:3
@@ -91,8 +96,9 @@ LL | fn two_diff(_a: i32, _b: f32) {}
    |    ^^^^^^^^ -------
 help: provide the argument
    |
-LL |   two_diff(/* i32 */, 1.0);
-   |           ~~~~~~~~~~~~~~~~
+LL -   two_diff(          1.0  );
+LL +   two_diff(/* i32 */, 1.0);
+   |
 
 error[E0061]: this function takes 3 arguments but 0 arguments were supplied
   --> $DIR/missing_arguments.rs:21:3
@@ -107,8 +113,9 @@ LL | fn three_same(_a: i32, _b: i32, _c: i32) {}
    |    ^^^^^^^^^^ -------  -------  -------
 help: provide the arguments
    |
-LL |   three_same(/* i32 */, /* i32 */, /* i32 */);
-   |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -   three_same(                       );
+LL +   three_same(/* i32 */, /* i32 */, /* i32 */);
+   |
 
 error[E0061]: this function takes 3 arguments but 1 argument was supplied
   --> $DIR/missing_arguments.rs:22:3
@@ -123,8 +130,9 @@ LL | fn three_same(_a: i32, _b: i32, _c: i32) {}
    |    ^^^^^^^^^^          -------  -------
 help: provide the arguments
    |
-LL |   three_same(1, /* i32 */, /* i32 */);
-   |             ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -   three_same(   1                   );
+LL +   three_same(1, /* i32 */, /* i32 */);
+   |
 
 error[E0061]: this function takes 3 arguments but 2 arguments were supplied
   --> $DIR/missing_arguments.rs:23:3
@@ -139,8 +147,9 @@ LL | fn three_same(_a: i32, _b: i32, _c: i32) {}
    |    ^^^^^^^^^^                   -------
 help: provide the argument
    |
-LL |   three_same(1, 1, /* i32 */);
-   |             ~~~~~~~~~~~~~~~~~
+LL -   three_same(   1,      1           );
+LL +   three_same(1, 1, /* i32 */);
+   |
 
 error[E0061]: this function takes 3 arguments but 2 arguments were supplied
   --> $DIR/missing_arguments.rs:26:3
@@ -155,8 +164,9 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {}
    |    ^^^^^^^^^^ -------
 help: provide the argument
    |
-LL |   three_diff(/* i32 */, 1.0, "");
-   |             ~~~~~~~~~~~~~~~~~~~~
+LL -   three_diff(          1.0,     ""  );
+LL +   three_diff(/* i32 */, 1.0, "");
+   |
 
 error[E0061]: this function takes 3 arguments but 2 arguments were supplied
   --> $DIR/missing_arguments.rs:27:3
@@ -171,8 +181,9 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {}
    |    ^^^^^^^^^^          -------
 help: provide the argument
    |
-LL |   three_diff(1, /* f32 */, "");
-   |             ~~~~~~~~~~~~~~~~~~
+LL -   three_diff(   1,              ""  );
+LL +   three_diff(1, /* f32 */, "");
+   |
 
 error[E0061]: this function takes 3 arguments but 2 arguments were supplied
   --> $DIR/missing_arguments.rs:28:3
@@ -187,8 +198,9 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {}
    |    ^^^^^^^^^^                   --------
 help: provide the argument
    |
-LL |   three_diff(1, 1.0, /* &str */);
-   |             ~~~~~~~~~~~~~~~~~~~~
+LL -   three_diff(   1,     1.0          );
+LL +   three_diff(1, 1.0, /* &str */);
+   |
 
 error[E0061]: this function takes 3 arguments but 1 argument was supplied
   --> $DIR/missing_arguments.rs:29:3
@@ -203,8 +215,9 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {}
    |    ^^^^^^^^^^ -------  -------
 help: provide the arguments
    |
-LL |   three_diff(/* i32 */, /* f32 */, "");
-   |             ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -   three_diff(                   ""  );
+LL +   three_diff(/* i32 */, /* f32 */, "");
+   |
 
 error[E0061]: this function takes 3 arguments but 1 argument was supplied
   --> $DIR/missing_arguments.rs:30:3
@@ -222,8 +235,9 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {}
    |    ^^^^^^^^^^ -------           --------
 help: provide the arguments
    |
-LL |   three_diff(/* i32 */, 1.0, /* &str */);
-   |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -   three_diff(          1.0          );
+LL +   three_diff(/* i32 */, 1.0, /* &str */);
+   |
 
 error[E0061]: this function takes 3 arguments but 1 argument was supplied
   --> $DIR/missing_arguments.rs:31:3
@@ -238,8 +252,9 @@ LL | fn three_diff(_a: i32, _b: f32, _c: &str) {}
    |    ^^^^^^^^^^          -------  --------
 help: provide the arguments
    |
-LL |   three_diff(1, /* f32 */, /* &str */);
-   |             ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -   three_diff(   1                   );
+LL +   three_diff(1, /* f32 */, /* &str */);
+   |
 
 error[E0061]: this function takes 4 arguments but 0 arguments were supplied
   --> $DIR/missing_arguments.rs:34:3
@@ -254,8 +269,9 @@ LL | fn four_repeated(_a: i32, _b: f32, _c: f32, _d: &str) {}
    |    ^^^^^^^^^^^^^ -------  -------  -------  --------
 help: provide the arguments
    |
-LL |   four_repeated(/* i32 */, /* f32 */, /* f32 */, /* &str */);
-   |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -   four_repeated(                               );
+LL +   four_repeated(/* i32 */, /* f32 */, /* f32 */, /* &str */);
+   |
 
 error[E0061]: this function takes 4 arguments but 2 arguments were supplied
   --> $DIR/missing_arguments.rs:35:3
@@ -270,8 +286,9 @@ LL | fn four_repeated(_a: i32, _b: f32, _c: f32, _d: &str) {}
    |    ^^^^^^^^^^^^^          -------  -------
 help: provide the arguments
    |
-LL |   four_repeated(1, /* f32 */, /* f32 */, "");
-   |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -   four_repeated(   1,                     ""   );
+LL +   four_repeated(1, /* f32 */, /* f32 */, "");
+   |
 
 error[E0061]: this function takes 5 arguments but 0 arguments were supplied
   --> $DIR/missing_arguments.rs:38:3
@@ -286,8 +303,9 @@ LL | fn complex(_a: i32, _b: f32, _c: i32, _d: f32, _e: &str) {}
    |    ^^^^^^^ -------  -------  -------  -------  --------
 help: provide the arguments
    |
-LL |   complex(/* i32 */, /* f32 */, /* i32 */, /* f32 */, /* &str */);
-   |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -   complex(                               );
+LL +   complex(/* i32 */, /* f32 */, /* i32 */, /* f32 */, /* &str */);
+   |
 
 error[E0061]: this function takes 5 arguments but 2 arguments were supplied
   --> $DIR/missing_arguments.rs:39:3
@@ -302,8 +320,9 @@ LL | fn complex(_a: i32, _b: f32, _c: i32, _d: f32, _e: &str) {}
    |    ^^^^^^^          -------  -------  -------
 help: provide the arguments
    |
-LL |   complex(1, /* f32 */, /* i32 */, /* f32 */, "");
-   |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -   complex(   1,                     ""   );
+LL +   complex(1, /* f32 */, /* i32 */, /* f32 */, "");
+   |
 
 error: aborting due to 19 previous errors
 
diff --git a/tests/ui/argument-suggestions/mixed_cases.stderr b/tests/ui/argument-suggestions/mixed_cases.stderr
index c19cd68c7715..0dcb4337eb16 100644
--- a/tests/ui/argument-suggestions/mixed_cases.stderr
+++ b/tests/ui/argument-suggestions/mixed_cases.stderr
@@ -33,8 +33,9 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {}
    |    ^^^^^^^^^^          -------
 help: did you mean
    |
-LL |   three_args(1, /* f32 */, "");
-   |             ~~~~~~~~~~~~~~~~~~
+LL -   three_args(1, "", X {}, "");
+LL +   three_args(1, /* f32 */, "");
+   |
 
 error[E0061]: this function takes 3 arguments but 2 arguments were supplied
   --> $DIR/mixed_cases.rs:14:3
@@ -52,8 +53,9 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {}
    |    ^^^^^^^^^^          -------  --------
 help: provide the argument
    |
-LL |   three_args(1, /* f32 */, /* &str */);
-   |             ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -   three_args(1, X {});
+LL +   three_args(1, /* f32 */, /* &str */);
+   |
 
 error[E0308]: arguments to this function are incorrect
   --> $DIR/mixed_cases.rs:17:3
@@ -70,8 +72,9 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {}
    |    ^^^^^^^^^^          -------
 help: did you mean
    |
-LL |   three_args(1, /* f32 */, "");
-   |             ~~~~~~~~~~~~~~~~~~
+LL -   three_args(1, "", X {});
+LL +   three_args(1, /* f32 */, "");
+   |
 
 error[E0308]: arguments to this function are incorrect
   --> $DIR/mixed_cases.rs:20:3
@@ -89,8 +92,9 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {}
    |    ^^^^^^^^^^          -------
 help: swap these arguments
    |
-LL |   three_args(1, /* f32 */, "");
-   |             ~~~~~~~~~~~~~~~~~~
+LL -   three_args("", X {}, 1);
+LL +   three_args(1, /* f32 */, "");
+   |
 
 error[E0061]: this function takes 3 arguments but 2 arguments were supplied
   --> $DIR/mixed_cases.rs:23:3
@@ -109,8 +113,9 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {}
    |    ^^^^^^^^^^          -------
 help: did you mean
    |
-LL |   three_args(1, /* f32 */, "");
-   |             ~~~~~~~~~~~~~~~~~~
+LL -   three_args("", 1);
+LL +   three_args(1, /* f32 */, "");
+   |
 
 error: aborting due to 6 previous errors
 
diff --git a/tests/ui/argument-suggestions/permuted_arguments.stderr b/tests/ui/argument-suggestions/permuted_arguments.stderr
index f6bec520984f..9592fc2801c4 100644
--- a/tests/ui/argument-suggestions/permuted_arguments.stderr
+++ b/tests/ui/argument-suggestions/permuted_arguments.stderr
@@ -14,8 +14,9 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {}
    |    ^^^^^^^^^^
 help: reorder these arguments
    |
-LL |   three_args(1, 1.0, "");
-   |             ~~~~~~~~~~~~
+LL -   three_args(1.0, "", 1);
+LL +   three_args(1, 1.0, "");
+   |
 
 error[E0308]: arguments to this function are incorrect
   --> $DIR/permuted_arguments.rs:12:3
@@ -35,8 +36,9 @@ LL | fn many_args(_a: i32, _b: f32, _c: &str, _d: X, _e: Y) {}
    |    ^^^^^^^^^
 help: reorder these arguments
    |
-LL |   many_args(1, 1.0, "", X {}, Y {});
-   |            ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -   many_args(X {}, Y {}, 1, 1.0, "");
+LL +   many_args(1, 1.0, "", X {}, Y {});
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/argument-suggestions/swapped_arguments.stderr b/tests/ui/argument-suggestions/swapped_arguments.stderr
index 22db77b3b93b..f72659363ac4 100644
--- a/tests/ui/argument-suggestions/swapped_arguments.stderr
+++ b/tests/ui/argument-suggestions/swapped_arguments.stderr
@@ -13,8 +13,9 @@ LL | fn two_args(_a: i32, _b: f32) {}
    |    ^^^^^^^^
 help: swap these arguments
    |
-LL |   two_args(1, 1.0);
-   |           ~~~~~~~~
+LL -   two_args(1.0, 1);
+LL +   two_args(1, 1.0);
+   |
 
 error[E0308]: arguments to this function are incorrect
   --> $DIR/swapped_arguments.rs:9:3
@@ -31,8 +32,9 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {}
    |    ^^^^^^^^^^
 help: swap these arguments
    |
-LL |   three_args(1, 1.0, "");
-   |             ~~~~~~~~~~~~
+LL -   three_args(1.0,   1,  "");
+LL +   three_args(1, 1.0, "");
+   |
 
 error[E0308]: arguments to this function are incorrect
   --> $DIR/swapped_arguments.rs:10:3
@@ -49,8 +51,9 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {}
    |    ^^^^^^^^^^
 help: swap these arguments
    |
-LL |   three_args(1, 1.0, "");
-   |             ~~~~~~~~~~~~
+LL -   three_args(  1,  "", 1.0);
+LL +   three_args(1, 1.0, "");
+   |
 
 error[E0308]: arguments to this function are incorrect
   --> $DIR/swapped_arguments.rs:11:3
@@ -67,8 +70,9 @@ LL | fn three_args(_a: i32, _b: f32, _c: &str) {}
    |    ^^^^^^^^^^
 help: swap these arguments
    |
-LL |   three_args(1, 1.0, "");
-   |             ~~~~~~~~~~~~
+LL -   three_args( "", 1.0,   1);
+LL +   three_args(1, 1.0, "");
+   |
 
 error[E0308]: arguments to this function are incorrect
   --> $DIR/swapped_arguments.rs:13:3
@@ -87,8 +91,9 @@ LL | fn four_args(_a: i32, _b: f32, _c: &str, _d: X) {}
    |    ^^^^^^^^^
 help: did you mean
    |
-LL |   four_args(1, 1.0, "", X {});
-   |            ~~~~~~~~~~~~~~~~~~
+LL -   four_args(1.0, 1, X {}, "");
+LL +   four_args(1, 1.0, "", X {});
+   |
 
 error: aborting due to 5 previous errors
 
diff --git a/tests/ui/array-slice-vec/suggest-array-length.stderr b/tests/ui/array-slice-vec/suggest-array-length.stderr
index b71be306780f..14d10832e360 100644
--- a/tests/ui/array-slice-vec/suggest-array-length.stderr
+++ b/tests/ui/array-slice-vec/suggest-array-length.stderr
@@ -6,8 +6,9 @@ LL |     const Foo: [i32; _] = [1, 2, 3];
    |
 help: replace this with a fully-specified type
    |
-LL |     const Foo: [i32; 3] = [1, 2, 3];
-   |                ~~~~~~~~
+LL -     const Foo: [i32; _] = [1, 2, 3];
+LL +     const Foo: [i32; 3] = [1, 2, 3];
+   |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants
   --> $DIR/suggest-array-length.rs:7:26
@@ -17,8 +18,9 @@ LL |     const REF_FOO: &[u8; _] = &[1];
    |
 help: replace this with a fully-specified type
    |
-LL |     const REF_FOO: &[u8; 1] = &[1];
-   |                    ~~~~~~~~
+LL -     const REF_FOO: &[u8; _] = &[1];
+LL +     const REF_FOO: &[u8; 1] = &[1];
+   |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables
   --> $DIR/suggest-array-length.rs:9:26
@@ -28,8 +30,9 @@ LL |     static Statik: [i32; _] = [1, 2, 3];
    |
 help: replace this with a fully-specified type
    |
-LL |     static Statik: [i32; 3] = [1, 2, 3];
-   |                    ~~~~~~~~
+LL -     static Statik: [i32; _] = [1, 2, 3];
+LL +     static Statik: [i32; 3] = [1, 2, 3];
+   |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables
   --> $DIR/suggest-array-length.rs:11:30
@@ -39,8 +42,9 @@ LL |     static REF_STATIK: &[u8; _] = &[1];
    |
 help: replace this with a fully-specified type
    |
-LL |     static REF_STATIK: &[u8; 1] = &[1];
-   |                        ~~~~~~~~
+LL -     static REF_STATIK: &[u8; _] = &[1];
+LL +     static REF_STATIK: &[u8; 1] = &[1];
+   |
 
 error[E0658]: using `_` for array lengths is unstable
   --> $DIR/suggest-array-length.rs:13:20
diff --git a/tests/ui/asm/aarch64/parse-error.stderr b/tests/ui/asm/aarch64/parse-error.stderr
index 7b273282ee6a..b5e1169e5f6b 100644
--- a/tests/ui/asm/aarch64/parse-error.stderr
+++ b/tests/ui/asm/aarch64/parse-error.stderr
@@ -330,8 +330,9 @@ LL |         asm!("{}", options(), const foo);
    |
 help: consider using `const` instead of `let`
    |
-LL |     const foo: /* Type */ = 0;
-   |     ~~~~~    ++++++++++++
+LL -     let mut foo = 0;
+LL +     const foo: /* Type */ = 0;
+   |
 
 error[E0435]: attempt to use a non-constant value in a constant
   --> $DIR/parse-error.rs:45:44
@@ -341,8 +342,9 @@ LL |         asm!("{}", clobber_abi("C"), const foo);
    |
 help: consider using `const` instead of `let`
    |
-LL |     const foo: /* Type */ = 0;
-   |     ~~~~~    ++++++++++++
+LL -     let mut foo = 0;
+LL +     const foo: /* Type */ = 0;
+   |
 
 error[E0435]: attempt to use a non-constant value in a constant
   --> $DIR/parse-error.rs:48:55
@@ -352,8 +354,9 @@ LL |         asm!("{}", options(), clobber_abi("C"), const foo);
    |
 help: consider using `const` instead of `let`
    |
-LL |     const foo: /* Type */ = 0;
-   |     ~~~~~    ++++++++++++
+LL -     let mut foo = 0;
+LL +     const foo: /* Type */ = 0;
+   |
 
 error[E0435]: attempt to use a non-constant value in a constant
   --> $DIR/parse-error.rs:50:31
@@ -363,8 +366,9 @@ LL |         asm!("{a}", a = const foo, a = const bar);
    |
 help: consider using `const` instead of `let`
    |
-LL |     const foo: /* Type */ = 0;
-   |     ~~~~~    ++++++++++++
+LL -     let mut foo = 0;
+LL +     const foo: /* Type */ = 0;
+   |
 
 error[E0435]: attempt to use a non-constant value in a constant
   --> $DIR/parse-error.rs:50:46
@@ -374,8 +378,9 @@ LL |         asm!("{a}", a = const foo, a = const bar);
    |
 help: consider using `const` instead of `let`
    |
-LL |     const bar: /* Type */ = 0;
-   |     ~~~~~    ++++++++++++
+LL -     let mut bar = 0;
+LL +     const bar: /* Type */ = 0;
+   |
 
 error[E0435]: attempt to use a non-constant value in a constant
   --> $DIR/parse-error.rs:57:45
@@ -385,8 +390,9 @@ LL |         asm!("{a}", in("x0") foo, a = const bar);
    |
 help: consider using `const` instead of `let`
    |
-LL |     const bar: /* Type */ = 0;
-   |     ~~~~~    ++++++++++++
+LL -     let mut bar = 0;
+LL +     const bar: /* Type */ = 0;
+   |
 
 error[E0435]: attempt to use a non-constant value in a constant
   --> $DIR/parse-error.rs:59:45
@@ -396,8 +402,9 @@ LL |         asm!("{a}", in("x0") foo, a = const bar);
    |
 help: consider using `const` instead of `let`
    |
-LL |     const bar: /* Type */ = 0;
-   |     ~~~~~    ++++++++++++
+LL -     let mut bar = 0;
+LL +     const bar: /* Type */ = 0;
+   |
 
 error[E0435]: attempt to use a non-constant value in a constant
   --> $DIR/parse-error.rs:61:41
@@ -407,8 +414,9 @@ LL |         asm!("{1}", in("x0") foo, const bar);
    |
 help: consider using `const` instead of `let`
    |
-LL |     const bar: /* Type */ = 0;
-   |     ~~~~~    ++++++++++++
+LL -     let mut bar = 0;
+LL +     const bar: /* Type */ = 0;
+   |
 
 error: aborting due to 59 previous errors
 
diff --git a/tests/ui/asm/invalid-const-operand.stderr b/tests/ui/asm/invalid-const-operand.stderr
index bda4b0355b7c..13bb10e84a53 100644
--- a/tests/ui/asm/invalid-const-operand.stderr
+++ b/tests/ui/asm/invalid-const-operand.stderr
@@ -6,8 +6,9 @@ LL |         asm!("{}", const x);
    |
 help: consider using `const` instead of `let`
    |
-LL |         const x: /* Type */ = 0;
-   |         ~~~~~  ++++++++++++
+LL -         let x = 0;
+LL +         const x: /* Type */ = 0;
+   |
 
 error[E0435]: attempt to use a non-constant value in a constant
   --> $DIR/invalid-const-operand.rs:43:36
@@ -17,8 +18,9 @@ LL |         asm!("{}", const const_foo(x));
    |
 help: consider using `const` instead of `let`
    |
-LL |         const x: /* Type */ = 0;
-   |         ~~~~~  ++++++++++++
+LL -         let x = 0;
+LL +         const x: /* Type */ = 0;
+   |
 
 error[E0435]: attempt to use a non-constant value in a constant
   --> $DIR/invalid-const-operand.rs:46:36
@@ -28,8 +30,9 @@ LL |         asm!("{}", const const_bar(x));
    |
 help: consider using `const` instead of `let`
    |
-LL |         const x: /* Type */ = 0;
-   |         ~~~~~  ++++++++++++
+LL -         let x = 0;
+LL +         const x: /* Type */ = 0;
+   |
 
 error: invalid type for `const` operand
   --> $DIR/invalid-const-operand.rs:12:19
diff --git a/tests/ui/asm/parse-error.stderr b/tests/ui/asm/parse-error.stderr
index 6d0e629b9377..74647372a355 100644
--- a/tests/ui/asm/parse-error.stderr
+++ b/tests/ui/asm/parse-error.stderr
@@ -424,8 +424,9 @@ LL |         asm!("{}", options(), const foo);
    |
 help: consider using `const` instead of `let`
    |
-LL |     const foo: /* Type */ = 0;
-   |     ~~~~~    ++++++++++++
+LL -     let mut foo = 0;
+LL +     const foo: /* Type */ = 0;
+   |
 
 error[E0435]: attempt to use a non-constant value in a constant
   --> $DIR/parse-error.rs:69:44
@@ -435,8 +436,9 @@ LL |         asm!("{}", clobber_abi("C"), const foo);
    |
 help: consider using `const` instead of `let`
    |
-LL |     const foo: /* Type */ = 0;
-   |     ~~~~~    ++++++++++++
+LL -     let mut foo = 0;
+LL +     const foo: /* Type */ = 0;
+   |
 
 error[E0435]: attempt to use a non-constant value in a constant
   --> $DIR/parse-error.rs:72:55
@@ -446,8 +448,9 @@ LL |         asm!("{}", options(), clobber_abi("C"), const foo);
    |
 help: consider using `const` instead of `let`
    |
-LL |     const foo: /* Type */ = 0;
-   |     ~~~~~    ++++++++++++
+LL -     let mut foo = 0;
+LL +     const foo: /* Type */ = 0;
+   |
 
 error[E0435]: attempt to use a non-constant value in a constant
   --> $DIR/parse-error.rs:74:31
@@ -457,8 +460,9 @@ LL |         asm!("{a}", a = const foo, a = const bar);
    |
 help: consider using `const` instead of `let`
    |
-LL |     const foo: /* Type */ = 0;
-   |     ~~~~~    ++++++++++++
+LL -     let mut foo = 0;
+LL +     const foo: /* Type */ = 0;
+   |
 
 error[E0435]: attempt to use a non-constant value in a constant
   --> $DIR/parse-error.rs:74:46
@@ -468,8 +472,9 @@ LL |         asm!("{a}", a = const foo, a = const bar);
    |
 help: consider using `const` instead of `let`
    |
-LL |     const bar: /* Type */ = 0;
-   |     ~~~~~    ++++++++++++
+LL -     let mut bar = 0;
+LL +     const bar: /* Type */ = 0;
+   |
 
 error: aborting due to 72 previous errors
 
diff --git a/tests/ui/asm/x86_64/x86_64_parse_error.stderr b/tests/ui/asm/x86_64/x86_64_parse_error.stderr
index b64f6c1127eb..dfa3e1d0ef20 100644
--- a/tests/ui/asm/x86_64/x86_64_parse_error.stderr
+++ b/tests/ui/asm/x86_64/x86_64_parse_error.stderr
@@ -20,8 +20,9 @@ LL |         asm!("{a}", in("eax") foo, a = const bar);
    |
 help: consider using `const` instead of `let`
    |
-LL |     const bar: /* Type */ = 0;
-   |     ~~~~~    ++++++++++++
+LL -     let mut bar = 0;
+LL +     const bar: /* Type */ = 0;
+   |
 
 error[E0435]: attempt to use a non-constant value in a constant
   --> $DIR/x86_64_parse_error.rs:13:46
@@ -31,8 +32,9 @@ LL |         asm!("{a}", in("eax") foo, a = const bar);
    |
 help: consider using `const` instead of `let`
    |
-LL |     const bar: /* Type */ = 0;
-   |     ~~~~~    ++++++++++++
+LL -     let mut bar = 0;
+LL +     const bar: /* Type */ = 0;
+   |
 
 error[E0435]: attempt to use a non-constant value in a constant
   --> $DIR/x86_64_parse_error.rs:15:42
@@ -42,8 +44,9 @@ LL |         asm!("{1}", in("eax") foo, const bar);
    |
 help: consider using `const` instead of `let`
    |
-LL |     const bar: /* Type */ = 0;
-   |     ~~~~~    ++++++++++++
+LL -     let mut bar = 0;
+LL +     const bar: /* Type */ = 0;
+   |
 
 error: aborting due to 5 previous errors
 
diff --git a/tests/ui/associated-consts/associated-const-ambiguity-report.stderr b/tests/ui/associated-consts/associated-const-ambiguity-report.stderr
index 35ee95d1215b..e68ba503c505 100644
--- a/tests/ui/associated-consts/associated-const-ambiguity-report.stderr
+++ b/tests/ui/associated-consts/associated-const-ambiguity-report.stderr
@@ -16,10 +16,12 @@ LL |     const ID: i32 = 1;
    |     ^^^^^^^^^^^^^
 help: use fully-qualified syntax to disambiguate
    |
-LL | const X: i32 = ::ID;
-   |                ~~~~~~~~~~~~~~
-LL | const X: i32 = ::ID;
-   |                ~~~~~~~~~~~~~~
+LL - const X: i32 = ::ID;
+LL + const X: i32 = ::ID;
+   |
+LL - const X: i32 = ::ID;
+LL + const X: i32 = ::ID;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/associated-inherent-types/dont-select-if-disabled.stderr b/tests/ui/associated-inherent-types/dont-select-if-disabled.stderr
index edf54894cd4e..d245659c2097 100644
--- a/tests/ui/associated-inherent-types/dont-select-if-disabled.stderr
+++ b/tests/ui/associated-inherent-types/dont-select-if-disabled.stderr
@@ -6,8 +6,9 @@ LL | struct S(S::P);
    |
 help: if there were a trait named `Example` with associated type `P` implemented for `S`, you could use the fully-qualified path
    |
-LL | struct S(::P);
-   |          ~~~~~~~~~~~~~~~~~
+LL - struct S(S::P);
+LL + struct S(::P);
+   |
 
 error[E0658]: inherent associated types are unstable
   --> $DIR/dont-select-if-disabled.rs:15:10
diff --git a/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr b/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr
index 72d3f5c6d4d4..d5e8fd69645b 100644
--- a/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr
+++ b/tests/ui/associated-inherent-types/issue-109071.no_gate.stderr
@@ -28,10 +28,12 @@ LL |     fn T() -> Option {}
    |
 help: use fully-qualified syntax
    |
-LL |     fn T() -> Option< as IntoAsyncIterator>::Item> {}
-   |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LL |     fn T() -> Option< as IntoIterator>::Item> {}
-   |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     fn T() -> Option {}
+LL +     fn T() -> Option< as IntoAsyncIterator>::Item> {}
+   |
+LL -     fn T() -> Option {}
+LL +     fn T() -> Option< as IntoIterator>::Item> {}
+   |
 
 error[E0658]: inherent associated types are unstable
   --> $DIR/issue-109071.rs:8:5
diff --git a/tests/ui/associated-inherent-types/issue-109768.stderr b/tests/ui/associated-inherent-types/issue-109768.stderr
index e71551f9e732..18455f4669e9 100644
--- a/tests/ui/associated-inherent-types/issue-109768.stderr
+++ b/tests/ui/associated-inherent-types/issue-109768.stderr
@@ -43,8 +43,9 @@ LL | struct Wrapper(T);
    |        ^^^^^^^
 help: provide the argument
    |
-LL |     const WRAPPED_ASSOC_3: Wrapper = Wrapper(/* value */);
-   |                                                               ~~~~~~~~~~~~~
+LL -     const WRAPPED_ASSOC_3: Wrapper = Wrapper();
+LL +     const WRAPPED_ASSOC_3: Wrapper = Wrapper(/* value */);
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/associated-item/associated-item-enum.stderr b/tests/ui/associated-item/associated-item-enum.stderr
index 3b00588f1d1a..49f168b85440 100644
--- a/tests/ui/associated-item/associated-item-enum.stderr
+++ b/tests/ui/associated-item/associated-item-enum.stderr
@@ -9,8 +9,9 @@ LL |     Enum::mispellable();
    |
 help: there is an associated function `misspellable` with a similar name
    |
-LL |     Enum::misspellable();
-   |           ~~~~~~~~~~~~
+LL -     Enum::mispellable();
+LL +     Enum::misspellable();
+   |
 
 error[E0599]: no variant or associated item named `mispellable_trait` found for enum `Enum` in the current scope
   --> $DIR/associated-item-enum.rs:18:11
@@ -23,8 +24,9 @@ LL |     Enum::mispellable_trait();
    |
 help: there is an associated function `misspellable_trait` with a similar name
    |
-LL |     Enum::misspellable_trait();
-   |           ~~~~~~~~~~~~~~~~~~
+LL -     Enum::mispellable_trait();
+LL +     Enum::misspellable_trait();
+   |
 
 error[E0599]: no variant or associated item named `MISPELLABLE` found for enum `Enum` in the current scope
   --> $DIR/associated-item-enum.rs:19:11
@@ -37,8 +39,9 @@ LL |     Enum::MISPELLABLE;
    |
 help: there is an associated constant `MISSPELLABLE` with a similar name
    |
-LL |     Enum::MISSPELLABLE;
-   |           ~~~~~~~~~~~~
+LL -     Enum::MISPELLABLE;
+LL +     Enum::MISSPELLABLE;
+   |
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/associated-type-bounds/assoc-type-eq-with-dyn-atb-fail.stderr b/tests/ui/associated-type-bounds/assoc-type-eq-with-dyn-atb-fail.stderr
index b1575abe5711..d5795e7ed7db 100644
--- a/tests/ui/associated-type-bounds/assoc-type-eq-with-dyn-atb-fail.stderr
+++ b/tests/ui/associated-type-bounds/assoc-type-eq-with-dyn-atb-fail.stderr
@@ -6,8 +6,9 @@ LL |     type Out = Box>;
    |
 help: use `impl Trait` to introduce a type instead
    |
-LL |     type Out = Box>;
-   |                                  ~~~~~~
+LL -     type Out = Box>;
+LL +     type Out = Box>;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/associated-type-bounds/elision.stderr b/tests/ui/associated-type-bounds/elision.stderr
index 36ca5a80024a..75141080dbf2 100644
--- a/tests/ui/associated-type-bounds/elision.stderr
+++ b/tests/ui/associated-type-bounds/elision.stderr
@@ -7,8 +7,9 @@ LL | fn f(x: &mut dyn Iterator>) -> Option<&'_ ()>
    = help: this function's return type contains a borrowed value, but the signature does not say which one of `x`'s 2 lifetimes it is borrowed from
 help: consider introducing a named lifetime parameter
    |
-LL | fn f<'a>(x: &'a mut dyn Iterator>) -> Option<&'a ()> { x.next() }
-   |     ++++     ++                                         ~~                  ~~
+LL - fn f(x: &mut dyn Iterator>) -> Option<&'_ ()> { x.next() }
+LL + fn f<'a>(x: &'a mut dyn Iterator>) -> Option<&'a ()> { x.next() }
+   |
 
 error: associated type bounds are not allowed in `dyn` types
   --> $DIR/elision.rs:4:27
@@ -18,8 +19,9 @@ LL | fn f(x: &mut dyn Iterator>) -> Option<&'_ ()>
    |
 help: use `impl Trait` to introduce a type instead
    |
-LL | fn f(x: &mut dyn Iterator>) -> Option<&'_ ()> { x.next() }
-   |                                ~~~~~~
+LL - fn f(x: &mut dyn Iterator>) -> Option<&'_ ()> { x.next() }
+LL + fn f(x: &mut dyn Iterator>) -> Option<&'_ ()> { x.next() }
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-ambiguous.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-ambiguous.stderr
index 80705424035c..12f6762cb517 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/path-ambiguous.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/path-ambiguous.stderr
@@ -12,12 +12,14 @@ LL |     T::method(..): Send,
    |
 help: use fully-qualified syntax to disambiguate
    |
-LL |     ::method(..): Send,
-   |     ~~~~~~~~~~
+LL -     T::method(..): Send,
+LL +     ::method(..): Send,
+   |
 help: use fully-qualified syntax to disambiguate
    |
-LL |     ::method(..): Send,
-   |     ~~~~~~~~~~
+LL -     T::method(..): Send,
+LL +     ::method(..): Send,
+   |
 
 error[E0221]: ambiguous associated function `method` in bounds of `T`
   --> $DIR/path-ambiguous.rs:21:5
@@ -33,12 +35,14 @@ LL |     T::method(..): Send,
    |
 help: use fully-qualified syntax to disambiguate
    |
-LL |     ::method(..): Send,
-   |     ~~~~~~~~~~
+LL -     T::method(..): Send,
+LL +     ::method(..): Send,
+   |
 help: use fully-qualified syntax to disambiguate
    |
-LL |     ::method(..): Send,
-   |     ~~~~~~~~~~
+LL -     T::method(..): Send,
+LL +     ::method(..): Send,
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-higher-ranked.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-higher-ranked.stderr
index 2a9a1a1e8994..b3a229c58c81 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/path-higher-ranked.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/path-higher-ranked.stderr
@@ -6,8 +6,9 @@ LL |     T::method(..): Send,
    |
 help: use a fully qualified path with inferred lifetimes
    |
-LL |     >::method(..): Send,
-   |     ~~~~~~~~~~~~~~
+LL -     T::method(..): Send,
+LL +     >::method(..): Send,
+   |
 
 error[E0212]: cannot use the associated function of a trait with uninferred generic parameters
   --> $DIR/path-higher-ranked.rs:19:5
@@ -17,8 +18,9 @@ LL |     T::method(..): Send,
    |
 help: use a fully qualified path with inferred lifetimes
    |
-LL |     >::method(..): Send,
-   |     ~~~~~~~~~~~~~~
+LL -     T::method(..): Send,
+LL +     >::method(..): Send,
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.stderr
index 6dbb5dabc0e4..aad6dfc496b7 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.stderr
@@ -6,8 +6,9 @@ LL |     Trait::method(..): Send,
    |
 help: if there were a type named `Example` that implemented `Trait`, you could use the fully-qualified path
    |
-LL |     ::method: Send,
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     Trait::method(..): Send,
+LL +     ::method: Send,
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/associated-type-bounds/suggest-assoc-ty-bound-on-eq-bound.stderr b/tests/ui/associated-type-bounds/suggest-assoc-ty-bound-on-eq-bound.stderr
index dbe285c53107..6eb8fabb1852 100644
--- a/tests/ui/associated-type-bounds/suggest-assoc-ty-bound-on-eq-bound.stderr
+++ b/tests/ui/associated-type-bounds/suggest-assoc-ty-bound-on-eq-bound.stderr
@@ -10,8 +10,9 @@ LL | fn f(_: impl Trait) {}
    |                        +++
 help: you might have meant to write a bound here
    |
-LL | fn f(_: impl Trait) {}
-   |                     ~
+LL - fn f(_: impl Trait) {}
+LL + fn f(_: impl Trait) {}
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/suggest-assoc-ty-bound-on-eq-bound.rs:9:24
@@ -25,8 +26,9 @@ LL | fn g(_: impl Trait) {}
    |                        +++
 help: you might have meant to write a bound here
    |
-LL | fn g(_: impl Trait) {}
-   |                     ~
+LL - fn g(_: impl Trait) {}
+LL + fn g(_: impl Trait) {}
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/suggest-assoc-ty-bound-on-eq-bound.rs:14:26
@@ -40,8 +42,9 @@ LL | fn h(_: impl Trait = dyn 'static + for<'a> Fn(&'a ())>) {}
    |                          +++
 help: you might have meant to write a bound here
    |
-LL | fn h(_: impl Trait: 'static + for<'a> Fn(&'a ())>) {}
-   |                       ~
+LL - fn h(_: impl Trait = 'static + for<'a> Fn(&'a ())>) {}
+LL + fn h(_: impl Trait: 'static + for<'a> Fn(&'a ())>) {}
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/suggest-assoc-ty-bound-on-eq-bound.rs:20:26
diff --git a/tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr b/tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr
index df01e1e37686..b828eb86b439 100644
--- a/tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr
+++ b/tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr
@@ -12,12 +12,14 @@ LL | fn a(_: C::Color) {
    |
 help: use fully-qualified syntax to disambiguate
    |
-LL | fn a(_: ::Color) {
-   |                        ~~~~~~~~~~~~
+LL - fn a(_: C::Color) {
+LL + fn a(_: ::Color) {
+   |
 help: use fully-qualified syntax to disambiguate
    |
-LL | fn a(_: ::Color) {
-   |                        ~~~~~~~~~~~~~~~~
+LL - fn a(_: C::Color) {
+LL + fn a(_: ::Color) {
+   |
 
 error[E0221]: ambiguous associated type `Color` in bounds of `C`
   --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:20:12
@@ -33,12 +35,14 @@ LL | fn b(_: C::Color) where C : Vehicle+Box {
    |
 help: use fully-qualified syntax to disambiguate
    |
-LL | fn b(_: ::Color) where C : Vehicle+Box {
-   |            ~~~~~~~~~~~~
+LL - fn b(_: C::Color) where C : Vehicle+Box {
+LL + fn b(_: ::Color) where C : Vehicle+Box {
+   |
 help: use fully-qualified syntax to disambiguate
    |
-LL | fn b(_: ::Color) where C : Vehicle+Box {
-   |            ~~~~~~~~~~~~~~~~
+LL - fn b(_: C::Color) where C : Vehicle+Box {
+LL + fn b(_: ::Color) where C : Vehicle+Box {
+   |
 
 error[E0221]: ambiguous associated type `Color` in bounds of `C`
   --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:24:12
@@ -54,12 +58,14 @@ LL | fn c(_: C::Color) where C : Vehicle, C : Box {
    |
 help: use fully-qualified syntax to disambiguate
    |
-LL | fn c(_: ::Color) where C : Vehicle, C : Box {
-   |            ~~~~~~~~~~~~
+LL - fn c(_: C::Color) where C : Vehicle, C : Box {
+LL + fn c(_: ::Color) where C : Vehicle, C : Box {
+   |
 help: use fully-qualified syntax to disambiguate
    |
-LL | fn c(_: ::Color) where C : Vehicle, C : Box {
-   |            ~~~~~~~~~~~~~~~~
+LL - fn c(_: C::Color) where C : Vehicle, C : Box {
+LL + fn c(_: ::Color) where C : Vehicle, C : Box {
+   |
 
 error[E0221]: ambiguous associated type `Color` in bounds of `X`
   --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:35:20
@@ -75,12 +81,14 @@ LL |     fn e(&self, _: X::Color) where X : Box;
    |
 help: use fully-qualified syntax to disambiguate
    |
-LL |     fn e(&self, _: ::Color) where X : Box;
-   |                    ~~~~~~~~~~~~
+LL -     fn e(&self, _: X::Color) where X : Box;
+LL +     fn e(&self, _: ::Color) where X : Box;
+   |
 help: use fully-qualified syntax to disambiguate
    |
-LL |     fn e(&self, _: ::Color) where X : Box;
-   |                    ~~~~~~~~~~~~~~~~
+LL -     fn e(&self, _: X::Color) where X : Box;
+LL +     fn e(&self, _: ::Color) where X : Box;
+   |
 
 error[E0221]: ambiguous associated type `Color` in bounds of `X`
   --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:38:20
@@ -96,12 +104,14 @@ LL |     fn f(&self, _: X::Color) where X : Box { }
    |
 help: use fully-qualified syntax to disambiguate
    |
-LL |     fn f(&self, _: ::Color) where X : Box { }
-   |                    ~~~~~~~~~~~~
+LL -     fn f(&self, _: X::Color) where X : Box { }
+LL +     fn f(&self, _: ::Color) where X : Box { }
+   |
 help: use fully-qualified syntax to disambiguate
    |
-LL |     fn f(&self, _: ::Color) where X : Box { }
-   |                    ~~~~~~~~~~~~~~~~
+LL -     fn f(&self, _: X::Color) where X : Box { }
+LL +     fn f(&self, _: ::Color) where X : Box { }
+   |
 
 error[E0221]: ambiguous associated type `Color` in bounds of `X`
   --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:30:20
@@ -117,12 +127,14 @@ LL |     fn d(&self, _: X::Color) where X : Box { }
    |
 help: use fully-qualified syntax to disambiguate
    |
-LL |     fn d(&self, _: ::Color) where X : Box { }
-   |                    ~~~~~~~~~~~~
+LL -     fn d(&self, _: X::Color) where X : Box { }
+LL +     fn d(&self, _: ::Color) where X : Box { }
+   |
 help: use fully-qualified syntax to disambiguate
    |
-LL |     fn d(&self, _: ::Color) where X : Box { }
-   |                    ~~~~~~~~~~~~~~~~
+LL -     fn d(&self, _: X::Color) where X : Box { }
+LL +     fn d(&self, _: ::Color) where X : Box { }
+   |
 
 error: aborting due to 6 previous errors
 
diff --git a/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr b/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr
index a4874903285a..063623ebd123 100644
--- a/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr
+++ b/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr
@@ -20,12 +20,14 @@ LL | fn dent(c: C, color: C::Color) {
    |
 help: use fully-qualified syntax to disambiguate
    |
-LL | fn dent(c: C, color: ::Color) {
-   |                                ~~~~~~~~~~~~~~~~
+LL - fn dent(c: C, color: C::Color) {
+LL + fn dent(c: C, color: ::Color) {
+   |
 help: use fully-qualified syntax to disambiguate
    |
-LL | fn dent(c: C, color: ::Color) {
-   |                                ~~~~~~~~~~~~
+LL - fn dent(c: C, color: C::Color) {
+LL + fn dent(c: C, color: ::Color) {
+   |
 
 error[E0222]: ambiguous associated type `Color` in bounds of `BoxCar`
   --> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:38
@@ -73,12 +75,14 @@ LL | fn paint(c: C, d: C::Color) {
    |
 help: use fully-qualified syntax to disambiguate
    |
-LL | fn paint(c: C, d: ::Color) {
-   |                             ~~~~~~~~~~~~~~~~
+LL - fn paint(c: C, d: C::Color) {
+LL + fn paint(c: C, d: ::Color) {
+   |
 help: use fully-qualified syntax to disambiguate
    |
-LL | fn paint(c: C, d: ::Color) {
-   |                             ~~~~~~~~~~~~
+LL - fn paint(c: C, d: C::Color) {
+LL + fn paint(c: C, d: ::Color) {
+   |
 
 error[E0191]: the value of the associated types `Color` in `Box`, `Color` in `Vehicle` must be specified
   --> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:33
diff --git a/tests/ui/associated-types/associated-types-eq-1.stderr b/tests/ui/associated-types/associated-types-eq-1.stderr
index 14ef36876740..581ad25d88ac 100644
--- a/tests/ui/associated-types/associated-types-eq-1.stderr
+++ b/tests/ui/associated-types/associated-types-eq-1.stderr
@@ -8,8 +8,9 @@ LL |     let _: A = x.boo();
    |
 help: a type parameter with a similar name exists
    |
-LL |     let _: I = x.boo();
-   |            ~
+LL -     let _: A = x.boo();
+LL +     let _: I = x.boo();
+   |
 help: you might be missing a type parameter
    |
 LL | fn foo2(x: I) {
diff --git a/tests/ui/associated-types/associated-types-eq-2.stderr b/tests/ui/associated-types/associated-types-eq-2.stderr
index ccd13123d704..19c34241e5f2 100644
--- a/tests/ui/associated-types/associated-types-eq-2.stderr
+++ b/tests/ui/associated-types/associated-types-eq-2.stderr
@@ -100,8 +100,9 @@ LL | impl Tr2 for Bar {
    |
 help: to use `Qux` as a generic argument specify it directly
    |
-LL | impl Tr2 for Bar {
-   |               ~~~
+LL - impl Tr2 for Bar {
+LL + impl Tr2 for Bar {
+   |
 
 error[E0107]: trait takes 3 generic arguments but 1 generic argument was supplied
   --> $DIR/associated-types-eq-2.rs:47:6
@@ -189,8 +190,9 @@ LL | impl Tr2> for Bar {
    |
 help: to use `GenericTerm` as a generic argument specify it directly
    |
-LL | impl Tr2> for Bar {
-   |                    ~~~~~~~~~~~~~~~~
+LL - impl Tr2> for Bar {
+LL + impl Tr2> for Bar {
+   |
 
 error[E0229]: associated item constraints are not allowed here
   --> $DIR/associated-types-eq-2.rs:76:10
@@ -203,8 +205,12 @@ LL | | = 42, T2 = Qux, T3 = usize> for Bar {
    |
 help: to use `42` as a generic argument specify it directly
    |
-LL | impl Tr3<42, T2 = Qux, T3 = usize> for Bar {
-   |          ~~
+LL - impl Tr3 for Bar {
+LL + impl Tr3<42, T2 = Qux, T3 = usize> for Bar {
+   |
 
 error[E0107]: trait takes 3 generic arguments but 0 generic arguments were supplied
   --> $DIR/associated-types-eq-2.rs:84:6
@@ -328,8 +334,9 @@ LL | impl<'a, T> St<'a , T = Qux> {
    |
 help: to use `Qux` as a generic argument specify it directly
    |
-LL | impl<'a, T> St<'a , Qux> {
-   |                     ~~~
+LL - impl<'a, T> St<'a , T = Qux> {
+LL + impl<'a, T> St<'a , Qux> {
+   |
 
 error: aborting due to 25 previous errors
 
diff --git a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr
index 88db36117191..d7d2161e7ad9 100644
--- a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr
+++ b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr
@@ -6,8 +6,9 @@ LL | fn get(x: T, y: U) -> Get::Value {}
    |
 help: if there were a type named `Example` that implemented `Get`, you could use the fully-qualified path
    |
-LL | fn get(x: T, y: U) -> ::Value {}
-   |                                    ~~~~~~~~~~~~~~~~~~~~~~~
+LL - fn get(x: T, y: U) -> Get::Value {}
+LL + fn get(x: T, y: U) -> ::Value {}
+   |
 
 error[E0223]: ambiguous associated type
   --> $DIR/associated-types-in-ambiguous-context.rs:13:23
@@ -23,8 +24,9 @@ LL |     fn get(&self) -> Get::Value;
    |
 help: if there were a type named `Example` that implemented `Get`, you could use the fully-qualified path
    |
-LL |     fn get(&self) -> ::Value;
-   |                      ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     fn get(&self) -> Get::Value;
+LL +     fn get(&self) -> ::Value;
+   |
 
 error[E0223]: ambiguous associated type
   --> $DIR/associated-types-in-ambiguous-context.rs:22:17
@@ -40,14 +42,18 @@ LL | type X = std::ops::Deref::Target;
    |
 help: use fully-qualified syntax
    |
-LL | type X = ::Target;
-   |          ~~~~~~~~~~~~~~~~~~~~~~~~~~
-LL | type X = ::Target;
-   |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LL | type X = ::Target;
-   |          ~~~~~~~~~~~~~~~~~~~~~~~~~~
-LL | type X =  as Deref>::Target;
-   |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - type X = std::ops::Deref::Target;
+LL + type X = ::Target;
+   |
+LL - type X = std::ops::Deref::Target;
+LL + type X = ::Target;
+   |
+LL - type X = std::ops::Deref::Target;
+LL + type X = ::Target;
+   |
+LL - type X = std::ops::Deref::Target;
+LL + type X =  as Deref>::Target;
+   |
      and N other candidates
 
 error: aborting due to 5 previous errors
diff --git a/tests/ui/associated-types/associated-types-path-1.stderr b/tests/ui/associated-types/associated-types-path-1.stderr
index cab9dcec0b6b..aea70e085c19 100644
--- a/tests/ui/associated-types/associated-types-path-1.stderr
+++ b/tests/ui/associated-types/associated-types-path-1.stderr
@@ -18,12 +18,14 @@ LL | pub fn f2(a: T, x: T::A) {}
    |
 help: use fully-qualified syntax to disambiguate
    |
-LL | pub fn f2(a: T, x: ::A) {}
-   |                                  ~~~~~~~~~~~~
+LL - pub fn f2(a: T, x: T::A) {}
+LL + pub fn f2(a: T, x: ::A) {}
+   |
 help: use fully-qualified syntax to disambiguate
    |
-LL | pub fn f2(a: T, x: ::A) {}
-   |                                  ~~~~~~~~~~~~
+LL - pub fn f2(a: T, x: T::A) {}
+LL + pub fn f2(a: T, x: ::A) {}
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/associated-types/associated-types-path-2.stderr b/tests/ui/associated-types/associated-types-path-2.stderr
index 5edd5c864e13..897eb75e3e3d 100644
--- a/tests/ui/associated-types/associated-types-path-2.stderr
+++ b/tests/ui/associated-types/associated-types-path-2.stderr
@@ -13,8 +13,9 @@ LL | pub fn f1(a: T, x: T::A) {}
    |        ^^               -------
 help: change the type of the numeric literal from `i32` to `u32`
    |
-LL |     f1(2i32, 4u32);
-   |               ~~~
+LL -     f1(2i32, 4i32);
+LL +     f1(2i32, 4u32);
+   |
 
 error[E0277]: the trait bound `u32: Foo` is not satisfied
   --> $DIR/associated-types-path-2.rs:29:8
diff --git a/tests/ui/associated-types/associated-types-project-from-hrtb-in-fn.stderr b/tests/ui/associated-types/associated-types-project-from-hrtb-in-fn.stderr
index 83bad291e566..b0c904fe62be 100644
--- a/tests/ui/associated-types/associated-types-project-from-hrtb-in-fn.stderr
+++ b/tests/ui/associated-types/associated-types-project-from-hrtb-in-fn.stderr
@@ -6,8 +6,9 @@ LL |     x: I::A)
    |
 help: use a fully qualified path with inferred lifetimes
    |
-LL |     x: >::A)
-   |        ~~~~~~~~~~~~~~~~~~~~
+LL -     x: I::A)
+LL +     x: >::A)
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.stderr b/tests/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.stderr
index 48433b15286d..bd30c25c97bd 100644
--- a/tests/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.stderr
+++ b/tests/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.stderr
@@ -6,8 +6,9 @@ LL |     fn some_method(&self, arg: I::A);
    |
 help: use a fully qualified path with inferred lifetimes
    |
-LL |     fn some_method(&self, arg: >::A);
-   |                                ~~~~~~~~~~~~~~~~~~~~
+LL -     fn some_method(&self, arg: I::A);
+LL +     fn some_method(&self, arg: >::A);
+   |
 
 error[E0212]: cannot use the associated type of a trait with uninferred generic parameters
   --> $DIR/associated-types-project-from-hrtb-in-trait-method.rs:32:24
@@ -17,8 +18,9 @@ LL |     fn mango(&self) -> X::Assoc {
    |
 help: use a fully qualified path with inferred lifetimes
    |
-LL |     fn mango(&self) -> >::Assoc {
-   |                        ~~~~~~~~~~~~~~~~~~~
+LL -     fn mango(&self) -> X::Assoc {
+LL +     fn mango(&self) -> >::Assoc {
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/associated-types/defaults-specialization.stderr b/tests/ui/associated-types/defaults-specialization.stderr
index b4ed99f36f44..fd2a1a0c2d13 100644
--- a/tests/ui/associated-types/defaults-specialization.stderr
+++ b/tests/ui/associated-types/defaults-specialization.stderr
@@ -23,8 +23,9 @@ LL |     fn make() -> Self::Ty {
               found signature `fn() -> u8`
 help: change the output type to match the trait
    |
-LL |     fn make() ->  as Tr>::Ty { 0 }
-   |                  ~~~~~~~~~~~~~~~~
+LL -     fn make() -> u8 { 0 }
+LL +     fn make() ->  as Tr>::Ty { 0 }
+   |
 
 error[E0053]: method `make` has an incompatible type for trait
   --> $DIR/defaults-specialization.rs:35:18
@@ -44,8 +45,9 @@ LL |     fn make() -> Self::Ty {
               found signature `fn() -> bool`
 help: change the output type to match the trait
    |
-LL |     fn make() ->  as Tr>::Ty { true }
-   |                  ~~~~~~~~~~~~~~~~
+LL -     fn make() -> bool { true }
+LL +     fn make() ->  as Tr>::Ty { true }
+   |
 
 error[E0308]: mismatched types
   --> $DIR/defaults-specialization.rs:10:9
diff --git a/tests/ui/associated-types/defaults-suitability.current.stderr b/tests/ui/associated-types/defaults-suitability.current.stderr
index 61247cee1f34..b9ea541e9811 100644
--- a/tests/ui/associated-types/defaults-suitability.current.stderr
+++ b/tests/ui/associated-types/defaults-suitability.current.stderr
@@ -134,8 +134,9 @@ LL |     type Baz = T;
    |          --- required by a bound in this associated type
 help: consider further restricting type parameter `T` with trait `Clone`
    |
-LL |     Self::Baz: Clone, T: std::clone::Clone
-   |                     ~~~~~~~~~~~~~~~~~~~~~~
+LL -     Self::Baz: Clone,
+LL +     Self::Baz: Clone, T: std::clone::Clone
+   |
 
 error: aborting due to 8 previous errors
 
diff --git a/tests/ui/associated-types/defaults-suitability.next.stderr b/tests/ui/associated-types/defaults-suitability.next.stderr
index 61247cee1f34..b9ea541e9811 100644
--- a/tests/ui/associated-types/defaults-suitability.next.stderr
+++ b/tests/ui/associated-types/defaults-suitability.next.stderr
@@ -134,8 +134,9 @@ LL |     type Baz = T;
    |          --- required by a bound in this associated type
 help: consider further restricting type parameter `T` with trait `Clone`
    |
-LL |     Self::Baz: Clone, T: std::clone::Clone
-   |                     ~~~~~~~~~~~~~~~~~~~~~~
+LL -     Self::Baz: Clone,
+LL +     Self::Baz: Clone, T: std::clone::Clone
+   |
 
 error: aborting due to 8 previous errors
 
diff --git a/tests/ui/associated-types/impl-wf-cycle-3.stderr b/tests/ui/associated-types/impl-wf-cycle-3.stderr
index d3ca06f890b3..b97117a9aab6 100644
--- a/tests/ui/associated-types/impl-wf-cycle-3.stderr
+++ b/tests/ui/associated-types/impl-wf-cycle-3.stderr
@@ -19,8 +19,9 @@ LL |     T: A,
    |        ------------- unsatisfied trait bound introduced here
 help: replace the associated type with the type specified in this `impl`
    |
-LL |     T: A,
-   |          ~~~~
+LL -     T: A,
+LL +     T: A,
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/associated-types/invalid-ctor.stderr b/tests/ui/associated-types/invalid-ctor.stderr
index b545c95a7681..0b3bf316f60f 100644
--- a/tests/ui/associated-types/invalid-ctor.stderr
+++ b/tests/ui/associated-types/invalid-ctor.stderr
@@ -6,8 +6,9 @@ LL |         Self::Out(1)
    |
 help: to construct a value of type `Constructor`, use the explicit path
    |
-LL |         Constructor(1)
-   |         ~~~~~~~~~~~
+LL -         Self::Out(1)
+LL +         Constructor(1)
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/associated-types/issue-38821.stderr b/tests/ui/associated-types/issue-38821.stderr
index 58f019704e7a..b29e9cc16e29 100644
--- a/tests/ui/associated-types/issue-38821.stderr
+++ b/tests/ui/associated-types/issue-38821.stderr
@@ -13,8 +13,9 @@ LL | impl IntoNullable for T {
    |         unsatisfied trait bound introduced here
 help: consider extending the `where` clause, but there might be an alternative better way to express this requirement
    |
-LL |     Expr: Expression::Nullable>, ::SqlType: NotNull
-   |                                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     Expr: Expression::Nullable>,
+LL +     Expr: Expression::Nullable>, ::SqlType: NotNull
+   |
 
 error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied
   --> $DIR/issue-38821.rs:40:1
@@ -37,8 +38,9 @@ LL | impl IntoNullable for T {
    |         unsatisfied trait bound introduced here
 help: consider extending the `where` clause, but there might be an alternative better way to express this requirement
    |
-LL |     Expr: Expression::Nullable>, ::SqlType: NotNull
-   |                                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     Expr: Expression::Nullable>,
+LL +     Expr: Expression::Nullable>, ::SqlType: NotNull
+   |
 
 error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied
   --> $DIR/issue-38821.rs:23:10
diff --git a/tests/ui/associated-types/issue-54108.current.stderr b/tests/ui/associated-types/issue-54108.current.stderr
index 8850b4548e33..1b2285b214fe 100644
--- a/tests/ui/associated-types/issue-54108.current.stderr
+++ b/tests/ui/associated-types/issue-54108.current.stderr
@@ -12,8 +12,9 @@ LL |     type Size: Add;
    |                ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size`
 help: consider further restricting the associated type
    |
-LL |     T: SubEncoder, ::ActualSize: Add
-   |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     T: SubEncoder,
+LL +     T: SubEncoder, ::ActualSize: Add
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/associated-types/issue-54108.next.stderr b/tests/ui/associated-types/issue-54108.next.stderr
index 5e2fa551afe3..cc80ab63901e 100644
--- a/tests/ui/associated-types/issue-54108.next.stderr
+++ b/tests/ui/associated-types/issue-54108.next.stderr
@@ -12,8 +12,9 @@ LL |     type Size: Add;
    |                    ^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size`
 help: consider further restricting the associated type
    |
-LL |     T: SubEncoder, ::ActualSize: Add
-   |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     T: SubEncoder,
+LL +     T: SubEncoder, ::ActualSize: Add
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/associated-types/issue-59324.stderr b/tests/ui/associated-types/issue-59324.stderr
index 2abe337b69ae..dc8f9cfe895b 100644
--- a/tests/ui/associated-types/issue-59324.stderr
+++ b/tests/ui/associated-types/issue-59324.stderr
@@ -87,8 +87,9 @@ LL | fn with_factory(factory: dyn ThriftService<()>) {}
    = help: unsized fn params are gated as an unstable feature
 help: you can use `impl Trait` as the argument type
    |
-LL | fn with_factory(factory: impl ThriftService<()>) {}
-   |                             ~~~~
+LL - fn with_factory(factory: dyn ThriftService<()>) {}
+LL + fn with_factory(factory: impl ThriftService<()>) {}
+   |
 help: function arguments must have a statically known size, borrowed types always have a known size
    |
 LL | fn with_factory(factory: &dyn ThriftService<()>) {}
diff --git a/tests/ui/async-await/async-closures/arg-mismatch.stderr b/tests/ui/async-await/async-closures/arg-mismatch.stderr
index 5c8e66502938..8c11fa157769 100644
--- a/tests/ui/async-await/async-closures/arg-mismatch.stderr
+++ b/tests/ui/async-await/async-closures/arg-mismatch.stderr
@@ -13,8 +13,9 @@ LL |         let c = async |x| {};
    |                        ^
 help: change the type of the numeric literal from `usize` to `i32`
    |
-LL |         c(2i32).await;
-   |            ~~~
+LL -         c(2usize).await;
+LL +         c(2i32).await;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr b/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr
index 36f90c7bcd5f..b7f2879727f2 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr
+++ b/tests/ui/async-await/in-trait/async-example-desugared-boxed.stderr
@@ -17,8 +17,9 @@ LL |     #[warn(refining_impl_trait)]
    = note: `#[warn(refining_impl_trait_reachable)]` implied by `#[warn(refining_impl_trait)]`
 help: replace the return type so that it matches the trait
    |
-LL |     fn foo(&self) -> impl Future {
-   |                      ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     fn foo(&self) -> Pin + '_>> {
+LL +     fn foo(&self) -> impl Future {
+   |
 
 warning: 1 warning emitted
 
diff --git a/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr b/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr
index 8e39559071f1..86546df88c17 100644
--- a/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr
+++ b/tests/ui/async-await/in-trait/async-example-desugared-manual.stderr
@@ -17,8 +17,9 @@ LL |     #[warn(refining_impl_trait)]
    = note: `#[warn(refining_impl_trait_reachable)]` implied by `#[warn(refining_impl_trait)]`
 help: replace the return type so that it matches the trait
    |
-LL |     fn foo(&self) -> impl Future {
-   |                      ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     fn foo(&self) -> MyFuture {
+LL +     fn foo(&self) -> impl Future {
+   |
 
 warning: 1 warning emitted
 
diff --git a/tests/ui/async-await/incorrect-move-async-order-issue-79694.stderr b/tests/ui/async-await/incorrect-move-async-order-issue-79694.stderr
index 782fa4295fd7..2a3d46cc97f2 100644
--- a/tests/ui/async-await/incorrect-move-async-order-issue-79694.stderr
+++ b/tests/ui/async-await/incorrect-move-async-order-issue-79694.stderr
@@ -6,8 +6,9 @@ LL |     let _ = move async { };
    |
 help: try switching the order
    |
-LL |     let _ = async move { };
-   |             ~~~~~~~~~~
+LL -     let _ = move async { };
+LL +     let _ = async move { };
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2015.stderr b/tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2015.stderr
index d4266814a7c4..2bdc1347c815 100644
--- a/tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2015.stderr
+++ b/tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2015.stderr
@@ -16,12 +16,14 @@ LL |     fn r#struct(&self) {
    |     ^^^^^^^^^^^^^^^^^^
 help: disambiguate the method for candidate #1
    |
-LL |     async::r#struct(&r#fn {});
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     r#fn {}.r#struct();
+LL +     async::r#struct(&r#fn {});
+   |
 help: disambiguate the method for candidate #2
    |
-LL |     await::r#struct(&r#fn {});
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     r#fn {}.r#struct();
+LL +     await::r#struct(&r#fn {});
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2018.stderr b/tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2018.stderr
index fe104bfe4454..ab10ab749fed 100644
--- a/tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2018.stderr
+++ b/tests/ui/async-await/issue-65634-raw-ident-suggestion.edition2018.stderr
@@ -16,12 +16,14 @@ LL |     fn r#struct(&self) {
    |     ^^^^^^^^^^^^^^^^^^
 help: disambiguate the method for candidate #1
    |
-LL |     r#async::r#struct(&r#fn {});
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     r#fn {}.r#struct();
+LL +     r#async::r#struct(&r#fn {});
+   |
 help: disambiguate the method for candidate #2
    |
-LL |     r#await::r#struct(&r#fn {});
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     r#fn {}.r#struct();
+LL +     r#await::r#struct(&r#fn {});
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/async-await/pin-ergonomics/sugar-no-const.stderr b/tests/ui/async-await/pin-ergonomics/sugar-no-const.stderr
index 822cfffcb8c6..062b6d3f4871 100644
--- a/tests/ui/async-await/pin-ergonomics/sugar-no-const.stderr
+++ b/tests/ui/async-await/pin-ergonomics/sugar-no-const.stderr
@@ -8,8 +8,9 @@ LL |     let _x: &pin i32 = todo!();
    |
 help: there is a keyword `in` with a similar name
    |
-LL |     let _x: &in i32 = todo!();
-   |              ~~
+LL -     let _x: &pin i32 = todo!();
+LL +     let _x: &in i32 = todo!();
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/async-await/suggest-switching-edition-on-await-cargo.stderr b/tests/ui/async-await/suggest-switching-edition-on-await-cargo.stderr
index c8bbb3a243cf..11f5825c232e 100644
--- a/tests/ui/async-await/suggest-switching-edition-on-await-cargo.stderr
+++ b/tests/ui/async-await/suggest-switching-edition-on-await-cargo.stderr
@@ -19,8 +19,9 @@ LL |     x.await;
    = note: for more on editions, read https://doc.rust-lang.org/edition-guide
 help: a field with a similar name exists
    |
-LL |     x.awai;
-   |       ~~~~
+LL -     x.await;
+LL +     x.awai;
+   |
 
 error[E0609]: no field `await` on type `Pin<&mut dyn Future>`
   --> $DIR/suggest-switching-edition-on-await-cargo.rs:34:7
diff --git a/tests/ui/async-await/suggest-switching-edition-on-await.stderr b/tests/ui/async-await/suggest-switching-edition-on-await.stderr
index ef5a5f812698..2ede8d5b7f42 100644
--- a/tests/ui/async-await/suggest-switching-edition-on-await.stderr
+++ b/tests/ui/async-await/suggest-switching-edition-on-await.stderr
@@ -19,8 +19,9 @@ LL |     x.await;
    = note: for more on editions, read https://doc.rust-lang.org/edition-guide
 help: a field with a similar name exists
    |
-LL |     x.awai;
-   |       ~~~~
+LL -     x.await;
+LL +     x.awai;
+   |
 
 error[E0609]: no field `await` on type `Pin<&mut dyn Future>`
   --> $DIR/suggest-switching-edition-on-await.rs:32:7
diff --git a/tests/ui/attributes/key-value-non-ascii.stderr b/tests/ui/attributes/key-value-non-ascii.stderr
index cc01bc46ebd2..fa87ad5ee6d2 100644
--- a/tests/ui/attributes/key-value-non-ascii.stderr
+++ b/tests/ui/attributes/key-value-non-ascii.stderr
@@ -6,8 +6,9 @@ LL | #[rustc_dummy = b"ffi.rs"]
    |
 help: if you meant to use the UTF-8 encoding of 'ffi', use \xHH escapes
    |
-LL | #[rustc_dummy = b"/xEF/xAC/x83.rs"]
-   |                   ~~~~~~~~~~~~
+LL - #[rustc_dummy = b"ffi.rs"]
+LL + #[rustc_dummy = b"/xEF/xAC/x83.rs"]
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/attributes/rustc_confusables.stderr b/tests/ui/attributes/rustc_confusables.stderr
index 9e37d5f50837..f475e9c494e0 100644
--- a/tests/ui/attributes/rustc_confusables.stderr
+++ b/tests/ui/attributes/rustc_confusables.stderr
@@ -35,8 +35,9 @@ LL |     x.inser();
    |
 help: there is a method `insert` with a similar name
    |
-LL |     x.insert();
-   |       ~~~~~~
+LL -     x.inser();
+LL +     x.insert();
+   |
 
 error[E0599]: no method named `foo` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope
   --> $DIR/rustc_confusables.rs:15:7
@@ -52,8 +53,9 @@ LL |     x.push();
    |
 help: you might have meant to use `insert`
    |
-LL |     x.insert();
-   |       ~~~~~~
+LL -     x.push();
+LL +     x.insert();
+   |
 
 error[E0599]: no method named `test` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope
   --> $DIR/rustc_confusables.rs:20:7
@@ -69,8 +71,9 @@ LL |     x.pulled();
    |
 help: you might have meant to use `pull`
    |
-LL |     x.pull();
-   |       ~~~~
+LL -     x.pulled();
+LL +     x.pull();
+   |
 
 error: aborting due to 9 previous errors
 
diff --git a/tests/ui/attributes/rustc_confusables_std_cases.stderr b/tests/ui/attributes/rustc_confusables_std_cases.stderr
index 7bf96241ca72..b9acf2d31abe 100644
--- a/tests/ui/attributes/rustc_confusables_std_cases.stderr
+++ b/tests/ui/attributes/rustc_confusables_std_cases.stderr
@@ -6,8 +6,9 @@ LL |     x.push(1);
    |
 help: you might have meant to use `insert`
    |
-LL |     x.insert(1);
-   |       ~~~~~~
+LL -     x.push(1);
+LL +     x.insert(1);
+   |
 
 error[E0599]: no method named `push_back` found for struct `Vec<_>` in the current scope
   --> $DIR/rustc_confusables_std_cases.rs:9:7
@@ -17,8 +18,9 @@ LL |     x.push_back(1);
    |
 help: you might have meant to use `push`
    |
-LL |     x.push(1);
-   |       ~~~~
+LL -     x.push_back(1);
+LL +     x.push(1);
+   |
 
 error[E0599]: no method named `push` found for struct `VecDeque` in the current scope
   --> $DIR/rustc_confusables_std_cases.rs:12:7
@@ -36,8 +38,9 @@ LL |     let mut x = VecDeque::new();
    |         ----- earlier `x` shadowed here with type `VecDeque`
 help: you might have meant to use `push_back`
    |
-LL |     x.push_back(1);
-   |       ~~~~~~~~~
+LL -     x.push(1);
+LL +     x.push_back(1);
+   |
 
 error[E0599]: no method named `length` found for struct `Vec<{integer}>` in the current scope
   --> $DIR/rustc_confusables_std_cases.rs:15:7
@@ -47,8 +50,9 @@ LL |     x.length();
    |
 help: you might have meant to use `len`
    |
-LL |     x.len();
-   |       ~~~
+LL -     x.length();
+LL +     x.len();
+   |
 
 error[E0599]: no method named `size` found for struct `Vec<{integer}>` in the current scope
   --> $DIR/rustc_confusables_std_cases.rs:17:7
@@ -60,8 +64,9 @@ help: there is a method `resize` with a similar name, but with different argumen
   --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
 help: you might have meant to use `len`
    |
-LL |     x.len();
-   |       ~~~
+LL -     x.size();
+LL +     x.len();
+   |
 
 error[E0308]: mismatched types
   --> $DIR/rustc_confusables_std_cases.rs:20:14
@@ -77,8 +82,9 @@ note: method defined here
   --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
 help: you might have meant to use `push`
    |
-LL |     x.push(42);
-   |       ~~~~
+LL -     x.append(42);
+LL +     x.push(42);
+   |
 
 error[E0308]: mismatched types
   --> $DIR/rustc_confusables_std_cases.rs:22:24
@@ -92,8 +98,9 @@ note: method defined here
   --> $SRC_DIR/alloc/src/string.rs:LL:COL
 help: you might have meant to use `push_str`
    |
-LL |     String::new().push_str("");
-   |                   ~~~~~~~~
+LL -     String::new().push("");
+LL +     String::new().push_str("");
+   |
 
 error[E0599]: no method named `append` found for struct `String` in the current scope
   --> $DIR/rustc_confusables_std_cases.rs:24:19
@@ -103,8 +110,9 @@ LL |     String::new().append("");
    |
 help: you might have meant to use `push_str`
    |
-LL |     String::new().push_str("");
-   |                   ~~~~~~~~
+LL -     String::new().append("");
+LL +     String::new().push_str("");
+   |
 
 error[E0599]: no method named `get_line` found for struct `Stdin` in the current scope
   --> $DIR/rustc_confusables_std_cases.rs:28:11
@@ -114,8 +122,9 @@ LL |     stdin.get_line(&mut buffer).unwrap();
    |
 help: you might have meant to use `read_line`
    |
-LL |     stdin.read_line(&mut buffer).unwrap();
-   |           ~~~~~~~~~
+LL -     stdin.get_line(&mut buffer).unwrap();
+LL +     stdin.read_line(&mut buffer).unwrap();
+   |
 
 error: aborting due to 9 previous errors
 
diff --git a/tests/ui/binop/placement-syntax.stderr b/tests/ui/binop/placement-syntax.stderr
index b20a2ee63538..e398c0b0702a 100644
--- a/tests/ui/binop/placement-syntax.stderr
+++ b/tests/ui/binop/placement-syntax.stderr
@@ -6,8 +6,9 @@ LL |     if x<-1 {
    |
 help: if you meant to write a comparison against a negative value, add a space in between `<` and `-`
    |
-LL |     if x< -1 {
-   |         ~~~
+LL -     if x<-1 {
+LL +     if x< -1 {
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/block-result/issue-3563.stderr b/tests/ui/block-result/issue-3563.stderr
index 22606a52f851..e03453f39464 100644
--- a/tests/ui/block-result/issue-3563.stderr
+++ b/tests/ui/block-result/issue-3563.stderr
@@ -6,8 +6,9 @@ LL |         || self.b()
    |
 help: there is a method `a` with a similar name
    |
-LL |         || self.a()
-   |                 ~
+LL -         || self.b()
+LL +         || self.a()
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/borrowck/already-borrowed-as-mutable-if-let-133941.stderr b/tests/ui/borrowck/already-borrowed-as-mutable-if-let-133941.stderr
index bb21caccbaf9..2f443797dfa1 100644
--- a/tests/ui/borrowck/already-borrowed-as-mutable-if-let-133941.stderr
+++ b/tests/ui/borrowck/already-borrowed-as-mutable-if-let-133941.stderr
@@ -15,8 +15,9 @@ LL |     }
    |
 help: consider using the `matches!` macro
    |
-LL |     while matches!(foo.f(), Some(_)) {
-   |           ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     while let Some(_) = foo.f() {
+LL +     while matches!(foo.f(), Some(_)) {
+   |
 
 error[E0499]: cannot borrow `foo` as mutable more than once at a time
   --> $DIR/already-borrowed-as-mutable-if-let-133941.rs:29:9
@@ -35,8 +36,9 @@ LL |     }
    |
 help: consider using the `matches!` macro
    |
-LL |     if matches!(foo.f(), Some(_)) {
-   |        ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     if let Some(_) = foo.f() {
+LL +     if matches!(foo.f(), Some(_)) {
+   |
 
 error[E0499]: cannot borrow `foo` as mutable more than once at a time
   --> $DIR/already-borrowed-as-mutable-if-let-133941.rs:33:9
diff --git a/tests/ui/borrowck/borrowck-struct-update-with-dtor.stderr b/tests/ui/borrowck/borrowck-struct-update-with-dtor.stderr
index bc11204acf28..d953ed2ad3ef 100644
--- a/tests/ui/borrowck/borrowck-struct-update-with-dtor.stderr
+++ b/tests/ui/borrowck/borrowck-struct-update-with-dtor.stderr
@@ -33,8 +33,9 @@ LL | struct B;
    | ^^^^^^^^
 help: if `B` implemented `Clone`, you could clone the value from the field instead of using the functional record update syntax
    |
-LL |         let _s2 = S { a: 2, b: s0.b.clone(), c: s0.c.clone() };
-   |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -         let _s2 = S { a: 2, ..s0 };
+LL +         let _s2 = S { a: 2, b: s0.b.clone(), c: s0.c.clone() };
+   |
 
 error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
   --> $DIR/borrowck-struct-update-with-dtor.rs:24:19
@@ -52,8 +53,9 @@ LL | struct B;
    | ^^^^^^^^
 help: if `B` implemented `Clone`, you could clone the value from the field instead of using the functional record update syntax
    |
-LL |         let _s2 = S { a: 2, b: s0.b.clone(), c: s0.c.clone() };
-   |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -         let _s2 = S { a: 2, ..s0 };
+LL +         let _s2 = S { a: 2, b: s0.b.clone(), c: s0.c.clone() };
+   |
 
 error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
   --> $DIR/borrowck-struct-update-with-dtor.rs:29:19
@@ -99,8 +101,9 @@ LL |         let _s2 = T { a: 2, ..s0 };
    |
 help: clone the value from the field instead of using the functional record update syntax
    |
-LL |         let _s2 = T { a: 2, b: s0.b.clone() };
-   |                           ~~~~~~~~~~~~~~~~~
+LL -         let _s2 = T { a: 2, ..s0 };
+LL +         let _s2 = T { a: 2, b: s0.b.clone() };
+   |
 
 error[E0509]: cannot move out of type `T`, which implements the `Drop` trait
   --> $DIR/borrowck-struct-update-with-dtor.rs:42:19
@@ -113,8 +116,9 @@ LL |         let _s2 = T { ..s0 };
    |
 help: clone the value from the field instead of using the functional record update syntax
    |
-LL |         let _s2 = T { b: s0.b.clone(), ..s0 };
-   |                     ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -         let _s2 = T { ..s0 };
+LL +         let _s2 = T { b: s0.b.clone(), ..s0 };
+   |
 
 error[E0509]: cannot move out of type `T`, which implements the `Drop` trait
   --> $DIR/borrowck-struct-update-with-dtor.rs:47:32
diff --git a/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr b/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr
index e4dfa6d7fba7..1e3570fc8557 100644
--- a/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr
+++ b/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr
@@ -9,8 +9,9 @@ LL |         let sfoo: *mut Foo = &mut SFOO;
    = note: `#[warn(static_mut_refs)]` on by default
 help: use `&raw mut` instead to create a raw pointer
    |
-LL |         let sfoo: *mut Foo = &raw mut SFOO;
-   |                              ~~~~~~~~
+LL -         let sfoo: *mut Foo = &mut SFOO;
+LL +         let sfoo: *mut Foo = &raw mut SFOO;
+   |
 
 warning: 1 warning emitted
 
diff --git a/tests/ui/borrowck/index-mut-help.stderr b/tests/ui/borrowck/index-mut-help.stderr
index c4c9c1c53139..6c3bd0df20b2 100644
--- a/tests/ui/borrowck/index-mut-help.stderr
+++ b/tests/ui/borrowck/index-mut-help.stderr
@@ -7,8 +7,9 @@ LL |     map["peter"].clear();
    = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<&str, String>`
 help: to modify a `HashMap<&str, String>` use `.get_mut()`
    |
-LL |     if let Some(val) = map.get_mut("peter") { val.clear(); };
-   |     ++++++++++++++++++    ~~~~~~~~~       ~~~~~~~        +++
+LL -     map["peter"].clear();
+LL +     if let Some(val) = map.get_mut("peter") { val.clear(); };
+   |
 
 error[E0594]: cannot assign to data in an index of `HashMap<&str, String>`
   --> $DIR/index-mut-help.rs:11:5
@@ -19,12 +20,15 @@ LL |     map["peter"] = "0".to_string();
    = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<&str, String>`
 help: use `.insert()` to insert a value into a `HashMap<&str, String>`, `.get_mut()` to modify it, or the entry API for more flexibility
    |
-LL |     map.insert("peter", "0".to_string());
-   |        ~~~~~~~~       ~                +
-LL |     if let Some(val) = map.get_mut("peter") { *val = "0".to_string(); };
-   |     ++++++++++++++++++    ~~~~~~~~~       ~~~~~~~~                  +++
-LL |     let val = map.entry("peter").or_insert("0".to_string());
-   |     +++++++++    ~~~~~~~       ~~~~~~~~~~~~               +
+LL -     map["peter"] = "0".to_string();
+LL +     map.insert("peter", "0".to_string());
+   |
+LL -     map["peter"] = "0".to_string();
+LL +     if let Some(val) = map.get_mut("peter") { *val = "0".to_string(); };
+   |
+LL -     map["peter"] = "0".to_string();
+LL +     let val = map.entry("peter").or_insert("0".to_string());
+   |
 
 error[E0596]: cannot borrow data in an index of `HashMap<&str, String>` as mutable
   --> $DIR/index-mut-help.rs:12:13
diff --git a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr
index 40ab2e61d6a4..53b833e7c919 100644
--- a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr
+++ b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr
@@ -8,8 +8,9 @@ LL |         self.layers.iter().fold(0, |result, mut layer| result + layer.proce
    |
 help: you may want to use `iter_mut` here
    |
-LL |         self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process())
-   |                     ~~~~~~~~
+LL -         self.layers.iter().fold(0, |result, mut layer| result + layer.process())
+LL +         self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process())
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr
index 466f19eb0ab9..86d53012cf35 100644
--- a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr
+++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr
@@ -8,8 +8,9 @@ LL |             vec.iter().flat_map(|container| container.things()).cloned().co
    |
 help: you may want to use `iter_mut` here
    |
-LL |             vec.iter_mut().flat_map(|container| container.things()).cloned().collect::>();
-   |                 ~~~~~~~~
+LL -             vec.iter().flat_map(|container| container.things()).cloned().collect::>();
+LL +             vec.iter_mut().flat_map(|container| container.things()).cloned().collect::>();
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr
index fd58e4330202..f0a17d76a678 100644
--- a/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr
+++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr
@@ -8,8 +8,9 @@ LL |     v.iter().for_each(|a| a.double());
    |
 help: you may want to use `iter_mut` here
    |
-LL |     v.iter_mut().for_each(|a| a.double());
-   |       ~~~~~~~~
+LL -     v.iter().for_each(|a| a.double());
+LL +     v.iter_mut().for_each(|a| a.double());
+   |
 
 error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference
   --> $DIR/issue-62387-suggest-iter-mut.rs:25:39
@@ -21,8 +22,9 @@ LL |     v.iter().rev().rev().for_each(|a| a.double());
    |
 help: you may want to use `iter_mut` here
    |
-LL |     v.iter_mut().rev().rev().for_each(|a| a.double());
-   |       ~~~~~~~~
+LL -     v.iter().rev().rev().for_each(|a| a.double());
+LL +     v.iter_mut().rev().rev().for_each(|a| a.double());
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/borrowck/issue-85765-closure.stderr b/tests/ui/borrowck/issue-85765-closure.stderr
index 936ddd67bcd8..fa4e54415087 100644
--- a/tests/ui/borrowck/issue-85765-closure.stderr
+++ b/tests/ui/borrowck/issue-85765-closure.stderr
@@ -6,8 +6,9 @@ LL |         rofl.push(Vec::new());
    |
 help: consider changing this binding's type
    |
-LL |         let rofl: &mut Vec> = &mut test;
-   |                   ~~~~~~~~~~~~~~~~~~
+LL -         let rofl: &Vec> = &mut test;
+LL +         let rofl: &mut Vec> = &mut test;
+   |
 
 error[E0594]: cannot assign to `*r`, which is behind a `&` reference
   --> $DIR/issue-85765-closure.rs:13:9
@@ -28,8 +29,9 @@ LL |         *x = 1;
    |
 help: consider changing this binding's type
    |
-LL |         let x: &mut usize = &mut{0};
-   |                ~~~~~~~~~~
+LL -         let x: &usize = &mut{0};
+LL +         let x: &mut usize = &mut{0};
+   |
 
 error[E0594]: cannot assign to `*y`, which is behind a `&` reference
   --> $DIR/issue-85765-closure.rs:27:9
@@ -39,8 +41,9 @@ LL |         *y = 1;
    |
 help: consider changing this binding's type
    |
-LL |         let y: &mut usize = &mut(0);
-   |                ~~~~~~~~~~
+LL -         let y: &usize = &mut(0);
+LL +         let y: &mut usize = &mut(0);
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/borrowck/issue-85765.stderr b/tests/ui/borrowck/issue-85765.stderr
index 57900bfb612e..9354294f52b2 100644
--- a/tests/ui/borrowck/issue-85765.stderr
+++ b/tests/ui/borrowck/issue-85765.stderr
@@ -6,8 +6,9 @@ LL |     rofl.push(Vec::new());
    |
 help: consider changing this binding's type
    |
-LL |     let rofl: &mut Vec> = &mut test;
-   |               ~~~~~~~~~~~~~~~~~~
+LL -     let rofl: &Vec> = &mut test;
+LL +     let rofl: &mut Vec> = &mut test;
+   |
 
 error[E0594]: cannot assign to `*r`, which is behind a `&` reference
   --> $DIR/issue-85765.rs:12:5
@@ -28,8 +29,9 @@ LL |     *x = 1;
    |
 help: consider changing this binding's type
    |
-LL |     let x: &mut usize = &mut{0};
-   |            ~~~~~~~~~~
+LL -     let x: &usize = &mut{0};
+LL +     let x: &mut usize = &mut{0};
+   |
 
 error[E0594]: cannot assign to `*y`, which is behind a `&` reference
   --> $DIR/issue-85765.rs:26:5
@@ -39,8 +41,9 @@ LL |     *y = 1;
    |
 help: consider changing this binding's type
    |
-LL |     let y: &mut usize = &mut(0);
-   |            ~~~~~~~~~~
+LL -     let y: &usize = &mut(0);
+LL +     let y: &mut usize = &mut(0);
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr b/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr
index dbe834b6b78e..9bcfbd337955 100644
--- a/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr
+++ b/tests/ui/borrowck/no-invalid-mut-suggestion-for-raw-pointer-issue-127562.stderr
@@ -6,8 +6,9 @@ LL |     unsafe { *ptr = 3; }
    |
 help: consider changing this to be a mutable pointer
    |
-LL |     let ptr = &raw mut val;
-   |                    ~~~
+LL -     let ptr = &raw const val;
+LL +     let ptr = &raw mut val;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.stderr b/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.stderr
index 28b4b4aa290d..98fb49824ae9 100644
--- a/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.stderr
+++ b/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.stderr
@@ -12,8 +12,9 @@ LL | |     })
    |
 help: to declare that the trait object captures data from argument `x`, you can add a lifetime parameter `'a` in the type alias
    |
-LL | type Lazy<'a, T> = Box T + 'a>;
-   |           +++                          ~~
+LL - type Lazy = Box T + 'static>;
+LL + type Lazy<'a, T> = Box T + 'a>;
+   |
 
 error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
   --> $DIR/suggest-lt-on-ty-alias-w-generics.rs:4:14
diff --git a/tests/ui/borrowck/unmatched-arg-and-hir-arg-issue-126385.stderr b/tests/ui/borrowck/unmatched-arg-and-hir-arg-issue-126385.stderr
index 0ae301b2090a..a18c4e727194 100644
--- a/tests/ui/borrowck/unmatched-arg-and-hir-arg-issue-126385.stderr
+++ b/tests/ui/borrowck/unmatched-arg-and-hir-arg-issue-126385.stderr
@@ -16,8 +16,9 @@ LL | impl MyStruct<'_> {
    | ----------------- `Self` is on type `MyStruct` in this `impl`
 help: the `Self` type doesn't accept type parameters, use the concrete type's name `MyStruct` instead if you want to specify its type parameters
    |
-LL |     pub fn f(field: &[u32]) -> MyStruct {
-   |                                ~~~~~~~~
+LL -     pub fn f(field: &[u32]) -> Self {
+LL +     pub fn f(field: &[u32]) -> MyStruct {
+   |
 
 error: lifetime may not live long enough
   --> $DIR/unmatched-arg-and-hir-arg-issue-126385.rs:10:9
diff --git a/tests/ui/btreemap/btreemap-index-mut-2.stderr b/tests/ui/btreemap/btreemap-index-mut-2.stderr
index c42462ee1eb5..74a8aaf8aee9 100644
--- a/tests/ui/btreemap/btreemap-index-mut-2.stderr
+++ b/tests/ui/btreemap/btreemap-index-mut-2.stderr
@@ -7,12 +7,15 @@ LL |         map[&0] = 1;
    = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `BTreeMap`
 help: use `.insert()` to insert a value into a `BTreeMap`, `.get_mut()` to modify it, or the entry API for more flexibility
    |
-LL |         map.insert(&0, 1);
-   |            ~~~~~~~~  ~  +
-LL |         if let Some(val) = map.get_mut(&0) { *val = 1; };
-   |         ++++++++++++++++++    ~~~~~~~~~  ~~~~~~~~    +++
-LL |         let val = map.entry(&0).or_insert(1);
-   |         +++++++++    ~~~~~~~  ~~~~~~~~~~~~ +
+LL -         map[&0] = 1;
+LL +         map.insert(&0, 1);
+   |
+LL -         map[&0] = 1;
+LL +         if let Some(val) = map.get_mut(&0) { *val = 1; };
+   |
+LL -         map[&0] = 1;
+LL +         let val = map.entry(&0).or_insert(1);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/btreemap/btreemap-index-mut.stderr b/tests/ui/btreemap/btreemap-index-mut.stderr
index f402f503c157..e8850ed2a174 100644
--- a/tests/ui/btreemap/btreemap-index-mut.stderr
+++ b/tests/ui/btreemap/btreemap-index-mut.stderr
@@ -7,12 +7,15 @@ LL |     map[&0] = 1;
    = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `BTreeMap`
 help: use `.insert()` to insert a value into a `BTreeMap`, `.get_mut()` to modify it, or the entry API for more flexibility
    |
-LL |     map.insert(&0, 1);
-   |        ~~~~~~~~  ~  +
-LL |     if let Some(val) = map.get_mut(&0) { *val = 1; };
-   |     ++++++++++++++++++    ~~~~~~~~~  ~~~~~~~~    +++
-LL |     let val = map.entry(&0).or_insert(1);
-   |     +++++++++    ~~~~~~~  ~~~~~~~~~~~~ +
+LL -     map[&0] = 1;
+LL +     map.insert(&0, 1);
+   |
+LL -     map[&0] = 1;
+LL +     if let Some(val) = map.get_mut(&0) { *val = 1; };
+   |
+LL -     map[&0] = 1;
+LL +     let val = map.entry(&0).or_insert(1);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/c-variadic/issue-86053-1.stderr b/tests/ui/c-variadic/issue-86053-1.stderr
index 67a619e46d57..4ad3b73fd661 100644
--- a/tests/ui/c-variadic/issue-86053-1.stderr
+++ b/tests/ui/c-variadic/issue-86053-1.stderr
@@ -63,8 +63,9 @@ LL |     self , ... ,   self ,   self , ... ) where F : FnOnce ( & 'a & 'b usize
    |
 help: a trait with a similar name exists
    |
-LL |     self , ... ,   self ,   self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) {
-   |                                                ~~
+LL -     self , ... ,   self ,   self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
+LL +     self , ... ,   self ,   self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) {
+   |
 help: you might be missing a type parameter
    |
 LL | fn ordering4 < 'a , 'b, F     > ( a :            ,   self , self ,   self ,
diff --git a/tests/ui/c-variadic/variadic-ffi-1.stderr b/tests/ui/c-variadic/variadic-ffi-1.stderr
index 7eca4cb61bc0..061eae9729e2 100644
--- a/tests/ui/c-variadic/variadic-ffi-1.stderr
+++ b/tests/ui/c-variadic/variadic-ffi-1.stderr
@@ -17,8 +17,9 @@ LL |     fn foo(f: isize, x: u8, ...);
    |        ^^^ -         -
 help: provide the arguments
    |
-LL |         foo(/* isize */, /* u8 */);
-   |            ~~~~~~~~~~~~~~~~~~~~~~~
+LL -         foo();
+LL +         foo(/* isize */, /* u8 */);
+   |
 
 error[E0060]: this function takes at least 2 arguments but 1 argument was supplied
   --> $DIR/variadic-ffi-1.rs:23:9
@@ -33,8 +34,9 @@ LL |     fn foo(f: isize, x: u8, ...);
    |        ^^^           -
 help: provide the argument
    |
-LL |         foo(1, /* u8 */);
-   |            ~~~~~~~~~~~~~
+LL -         foo(1);
+LL +         foo(1, /* u8 */);
+   |
 
 error[E0308]: mismatched types
   --> $DIR/variadic-ffi-1.rs:25:56
diff --git a/tests/ui/cast/cast-as-bool.stderr b/tests/ui/cast/cast-as-bool.stderr
index 4ff56a95e49a..b2c9ae5c6ad6 100644
--- a/tests/ui/cast/cast-as-bool.stderr
+++ b/tests/ui/cast/cast-as-bool.stderr
@@ -6,8 +6,9 @@ LL |     let u = 5 as bool;
    |
 help: compare with zero instead
    |
-LL |     let u = 5 != 0;
-   |               ~~~~
+LL -     let u = 5 as bool;
+LL +     let u = 5 != 0;
+   |
 
 error[E0054]: cannot cast `i32` as `bool`
   --> $DIR/cast-as-bool.rs:6:13
@@ -17,8 +18,9 @@ LL |     let t = (1 + 2) as bool;
    |
 help: compare with zero instead
    |
-LL |     let t = (1 + 2) != 0;
-   |                     ~~~~
+LL -     let t = (1 + 2) as bool;
+LL +     let t = (1 + 2) != 0;
+   |
 
 error[E0054]: cannot cast `u32` as `bool`
   --> $DIR/cast-as-bool.rs:10:13
@@ -28,8 +30,9 @@ LL |     let _ = 5_u32 as bool;
    |
 help: compare with zero instead
    |
-LL |     let _ = 5_u32 != 0;
-   |                   ~~~~
+LL -     let _ = 5_u32 as bool;
+LL +     let _ = 5_u32 != 0;
+   |
 
 error[E0054]: cannot cast `f64` as `bool`
   --> $DIR/cast-as-bool.rs:13:13
@@ -39,8 +42,9 @@ LL |     let _ = 64.0_f64 as bool;
    |
 help: compare with zero instead
    |
-LL |     let _ = 64.0_f64 != 0;
-   |                      ~~~~
+LL -     let _ = 64.0_f64 as bool;
+LL +     let _ = 64.0_f64 != 0;
+   |
 
 error[E0054]: cannot cast `IntEnum` as `bool`
   --> $DIR/cast-as-bool.rs:24:13
@@ -86,8 +90,9 @@ LL |     let v = "hello" as bool;
    |
 help: consider using the `is_empty` method on `&'static str` to determine if it contains anything
    |
-LL |     let v = !"hello".is_empty();
-   |             +       ~~~~~~~~~~~
+LL -     let v = "hello" as bool;
+LL +     let v = !"hello".is_empty();
+   |
 
 error: aborting due to 11 previous errors
 
diff --git a/tests/ui/cast/cast-rfc0401-2.stderr b/tests/ui/cast/cast-rfc0401-2.stderr
index b7fb420533e6..f2956cdfa335 100644
--- a/tests/ui/cast/cast-rfc0401-2.stderr
+++ b/tests/ui/cast/cast-rfc0401-2.stderr
@@ -6,8 +6,9 @@ LL |     let _ = 3 as bool;
    |
 help: compare with zero instead
    |
-LL |     let _ = 3 != 0;
-   |               ~~~~
+LL -     let _ = 3 as bool;
+LL +     let _ = 3 != 0;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/cast/ice-cast-type-with-error-124848.stderr b/tests/ui/cast/ice-cast-type-with-error-124848.stderr
index 1e2adcc7d9ee..402ee27386dd 100644
--- a/tests/ui/cast/ice-cast-type-with-error-124848.stderr
+++ b/tests/ui/cast/ice-cast-type-with-error-124848.stderr
@@ -48,8 +48,9 @@ LL | struct MyType<'a>(Cell>>, Pin);
    |        ^^^^^^
 help: provide the argument
    |
-LL |     let mut unpinned = MyType(Cell::new(None), /* value */);
-   |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let mut unpinned = MyType(Cell::new(None));
+LL +     let mut unpinned = MyType(Cell::new(None), /* value */);
+   |
 
 error[E0606]: casting `&MyType<'_>` as `*const Cell>>` is invalid
   --> $DIR/ice-cast-type-with-error-124848.rs:14:20
diff --git a/tests/ui/cast/issue-106883-is-empty.stderr b/tests/ui/cast/issue-106883-is-empty.stderr
index 7115c7704ca2..5ebabc9ed837 100644
--- a/tests/ui/cast/issue-106883-is-empty.stderr
+++ b/tests/ui/cast/issue-106883-is-empty.stderr
@@ -6,8 +6,9 @@ LL |     let _ = "foo" as bool;
    |
 help: consider using the `is_empty` method on `&'static str` to determine if it contains anything
    |
-LL |     let _ = !"foo".is_empty();
-   |             +     ~~~~~~~~~~~
+LL -     let _ = "foo" as bool;
+LL +     let _ = !"foo".is_empty();
+   |
 
 error[E0605]: non-primitive cast: `String` as `bool`
   --> $DIR/issue-106883-is-empty.rs:17:13
@@ -22,8 +23,9 @@ LL |     let _ = String::from("foo") as bool;
    |             ^^^^^^^^^^^^^^^^^^^
 help: consider using the `is_empty` method on `String` to determine if it contains anything
    |
-LL |     let _ = !String::from("foo").is_empty();
-   |             +                   ~~~~~~~~~~~
+LL -     let _ = String::from("foo") as bool;
+LL +     let _ = !String::from("foo").is_empty();
+   |
 
 error[E0605]: non-primitive cast: `Foo` as `bool`
   --> $DIR/issue-106883-is-empty.rs:20:13
@@ -38,8 +40,9 @@ LL |     let _ = Foo as bool;
    |             ^^^
 help: consider using the `is_empty` method on `Foo` to determine if it contains anything
    |
-LL |     let _ = !Foo.is_empty();
-   |             +   ~~~~~~~~~~~
+LL -     let _ = Foo as bool;
+LL +     let _ = !Foo.is_empty();
+   |
 
 error[E0606]: casting `&[i32]` as `bool` is invalid
   --> $DIR/issue-106883-is-empty.rs:25:5
@@ -49,8 +52,9 @@ LL |     bar as bool
    |
 help: consider using the `is_empty` method on `&[i32]` to determine if it contains anything
    |
-LL |     !bar.is_empty()
-   |     +   ~~~~~~~~~~~
+LL -     bar as bool
+LL +     !bar.is_empty()
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/cfg/cfg-method-receiver.stderr b/tests/ui/cfg/cfg-method-receiver.stderr
index 5767a7c1b4b1..639413b90faa 100644
--- a/tests/ui/cfg/cfg-method-receiver.stderr
+++ b/tests/ui/cfg/cfg-method-receiver.stderr
@@ -16,8 +16,9 @@ LL |     cbor_map! { #[cfg(test)] 4};
    = note: this error originates in the macro `cbor_map` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: you must specify a concrete type for this numeric value, like `i32`
    |
-LL |     cbor_map! { #[cfg(test)] 4_i32};
-   |                              ~~~~~
+LL -     cbor_map! { #[cfg(test)] 4};
+LL +     cbor_map! { #[cfg(test)] 4_i32};
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr
index 138c7fc75849..5279f3b09015 100644
--- a/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr
+++ b/tests/ui/check-cfg/cfg-value-for-cfg-name-multiple.stderr
@@ -10,12 +10,14 @@ LL | #[cfg(my_value)]
    = note: `#[warn(unexpected_cfgs)]` on by default
 help: found config with similar value
    |
-LL | #[cfg(foo = "my_value")]
-   |       ~~~~~~~~~~~~~~~~
+LL - #[cfg(my_value)]
+LL + #[cfg(foo = "my_value")]
+   |
 help: found config with similar value
    |
-LL | #[cfg(bar = "my_value")]
-   |       ~~~~~~~~~~~~~~~~
+LL - #[cfg(my_value)]
+LL + #[cfg(bar = "my_value")]
+   |
 
 warning: 1 warning emitted
 
diff --git a/tests/ui/check-cfg/diagnotics.cargo.stderr b/tests/ui/check-cfg/diagnotics.cargo.stderr
index a440ccaaf584..ab7111eca24c 100644
--- a/tests/ui/check-cfg/diagnotics.cargo.stderr
+++ b/tests/ui/check-cfg/diagnotics.cargo.stderr
@@ -17,8 +17,9 @@ LL | #[cfg(featur = "foo")]
    = note: see  for more information about checking conditional configuration
 help: there is a config with a similar name and value
    |
-LL | #[cfg(feature = "foo")]
-   |       ~~~~~~~
+LL - #[cfg(featur = "foo")]
+LL + #[cfg(feature = "foo")]
+   |
 
 warning: unexpected `cfg` condition name: `featur`
   --> $DIR/diagnotics.rs:17:7
@@ -30,8 +31,9 @@ LL | #[cfg(featur = "fo")]
    = note: see  for more information about checking conditional configuration
 help: there is a config with a similar name and different values
    |
-LL | #[cfg(feature = "foo")]
-   |       ~~~~~~~~~~~~~~~
+LL - #[cfg(featur = "fo")]
+LL + #[cfg(feature = "foo")]
+   |
 
 warning: unexpected `cfg` condition name: `no_value`
   --> $DIR/diagnotics.rs:24:7
@@ -60,8 +62,9 @@ LL | #[cfg(no_value = "foo")]
    = note: see  for more information about checking conditional configuration
 help: there is a config with a similar name and no value
    |
-LL | #[cfg(no_values)]
-   |       ~~~~~~~~~
+LL - #[cfg(no_value = "foo")]
+LL + #[cfg(no_values)]
+   |
 
 warning: unexpected `cfg` condition value: `bar`
   --> $DIR/diagnotics.rs:32:7
diff --git a/tests/ui/check-cfg/diagnotics.rustc.stderr b/tests/ui/check-cfg/diagnotics.rustc.stderr
index 6868be482d87..4aae1f00e706 100644
--- a/tests/ui/check-cfg/diagnotics.rustc.stderr
+++ b/tests/ui/check-cfg/diagnotics.rustc.stderr
@@ -19,8 +19,9 @@ LL | #[cfg(featur = "foo")]
    = note: see  for more information about checking conditional configuration
 help: there is a config with a similar name and value
    |
-LL | #[cfg(feature = "foo")]
-   |       ~~~~~~~
+LL - #[cfg(featur = "foo")]
+LL + #[cfg(feature = "foo")]
+   |
 
 warning: unexpected `cfg` condition name: `featur`
   --> $DIR/diagnotics.rs:17:7
@@ -33,8 +34,9 @@ LL | #[cfg(featur = "fo")]
    = note: see  for more information about checking conditional configuration
 help: there is a config with a similar name and different values
    |
-LL | #[cfg(feature = "foo")]
-   |       ~~~~~~~~~~~~~~~
+LL - #[cfg(featur = "fo")]
+LL + #[cfg(feature = "foo")]
+   |
 
 warning: unexpected `cfg` condition name: `no_value`
   --> $DIR/diagnotics.rs:24:7
@@ -55,8 +57,9 @@ LL | #[cfg(no_value = "foo")]
    = note: see  for more information about checking conditional configuration
 help: there is a config with a similar name and no value
    |
-LL | #[cfg(no_values)]
-   |       ~~~~~~~~~
+LL - #[cfg(no_value = "foo")]
+LL + #[cfg(no_values)]
+   |
 
 warning: unexpected `cfg` condition value: `bar`
   --> $DIR/diagnotics.rs:32:7
diff --git a/tests/ui/check-cfg/well-known-names.stderr b/tests/ui/check-cfg/well-known-names.stderr
index 000315443f81..4edf608589d5 100644
--- a/tests/ui/check-cfg/well-known-names.stderr
+++ b/tests/ui/check-cfg/well-known-names.stderr
@@ -48,8 +48,9 @@ LL | #[cfg(target_oz = "linux")]
    = note: see  for more information about checking conditional configuration
 help: there is a config with a similar name and value
    |
-LL | #[cfg(target_os = "linux")]
-   |       ~~~~~~~~~
+LL - #[cfg(target_oz = "linux")]
+LL + #[cfg(target_os = "linux")]
+   |
 
 warning: unexpected `cfg` condition name: `features`
   --> $DIR/well-known-names.rs:19:7
diff --git a/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr b/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr
index b5ad8eb790f2..f5cbecc5704c 100644
--- a/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr
+++ b/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr
@@ -108,8 +108,9 @@ LL |         let PAT = v1;
    = note: the matched value is of type `u32`
 help: introduce a variable instead
    |
-LL |         let PAT_var = v1;
-   |             ~~~~~~~
+LL -         let PAT = v1;
+LL +         let PAT_var = v1;
+   |
 
 error: aborting due to 7 previous errors
 
diff --git a/tests/ui/closures/2229_closure_analysis/issue-118144.stderr b/tests/ui/closures/2229_closure_analysis/issue-118144.stderr
index 87084e602372..f717343122ee 100644
--- a/tests/ui/closures/2229_closure_analysis/issue-118144.stderr
+++ b/tests/ui/closures/2229_closure_analysis/issue-118144.stderr
@@ -8,8 +8,9 @@ LL |         V(x) = func_arg;
    |
 help: consider dereferencing to access the inner value using the Deref trait
    |
-LL |         V(x) = &*func_arg;
-   |                ~~~~~~~~~~
+LL -         V(x) = func_arg;
+LL +         V(x) = &*func_arg;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/closures/issue-78720.stderr b/tests/ui/closures/issue-78720.stderr
index 5d65c87b0fd6..acce1dc191a2 100644
--- a/tests/ui/closures/issue-78720.stderr
+++ b/tests/ui/closures/issue-78720.stderr
@@ -15,8 +15,9 @@ LL |     _func: F,
    |
 help: a trait with a similar name exists
    |
-LL |     _func: Fn,
-   |            ~~
+LL -     _func: F,
+LL +     _func: Fn,
+   |
 help: you might be missing a type parameter
    |
 LL | struct Map2 {
diff --git a/tests/ui/closures/multiple-fn-bounds.stderr b/tests/ui/closures/multiple-fn-bounds.stderr
index 861b39b4d076..9b824fa0eefb 100644
--- a/tests/ui/closures/multiple-fn-bounds.stderr
+++ b/tests/ui/closures/multiple-fn-bounds.stderr
@@ -21,8 +21,9 @@ LL | fn foo bool + Fn(char) -> bool>(f: F) {
    |                               ^^^^^^^^^^^^^^^^ required by this bound in `foo`
 help: consider adjusting the signature so it does not borrow its argument
    |
-LL |     foo(move |char| v);
-   |               ~~~~
+LL -     foo(move |x| v);
+LL +     foo(move |char| v);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr
index f20e67e3d943..0560f0eec1c0 100644
--- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr
+++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr
@@ -14,8 +14,9 @@ LL |     f1: extern "C-cmse-nonsecure-call" fn(U, u32, u32, u32) -> u64
    |
 help: a type parameter with a similar name exists
    |
-LL |     f1: extern "C-cmse-nonsecure-call" fn(T, u32, u32, u32) -> u64,
-   |                                                    ~
+LL -     f1: extern "C-cmse-nonsecure-call" fn(U, u32, u32, u32) -> u64,
+LL +     f1: extern "C-cmse-nonsecure-call" fn(T, u32, u32, u32) -> u64,
+   |
 help: you might be missing a type parameter
    |
 LL | struct Test {
diff --git a/tests/ui/codemap_tests/two_files.stderr b/tests/ui/codemap_tests/two_files.stderr
index d833d4944bfe..3b542fdbd33f 100644
--- a/tests/ui/codemap_tests/two_files.stderr
+++ b/tests/ui/codemap_tests/two_files.stderr
@@ -7,7 +7,8 @@ LL | impl Bar for Baz { }
 help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias
   --> $DIR/two_files_data.rs:5:1
    |
-LL | trait Bar = dyn Foo;
+LL - type Bar = dyn Foo;
+LL + trait Bar = dyn Foo;
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/compare-method/bad-self-type.stderr b/tests/ui/compare-method/bad-self-type.stderr
index a3a31f434471..f662b5a11cb3 100644
--- a/tests/ui/compare-method/bad-self-type.stderr
+++ b/tests/ui/compare-method/bad-self-type.stderr
@@ -8,8 +8,9 @@ LL |     fn poll(self, _: &mut Context<'_>) -> Poll<()> {
               found signature `fn(MyFuture, &mut Context<'_>) -> Poll<_>`
 help: change the self-receiver type to match the trait
    |
-LL |     fn poll(self: Pin<&mut MyFuture>, _: &mut Context<'_>) -> Poll<()> {
-   |             ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     fn poll(self, _: &mut Context<'_>) -> Poll<()> {
+LL +     fn poll(self: Pin<&mut MyFuture>, _: &mut Context<'_>) -> Poll<()> {
+   |
 
 error[E0053]: method `foo` has an incompatible type for trait
   --> $DIR/bad-self-type.rs:22:18
@@ -26,8 +27,9 @@ LL |     fn foo(self);
               found signature `fn(Box)`
 help: change the self-receiver type to match the trait
    |
-LL |     fn foo(self) {}
-   |            ~~~~
+LL -     fn foo(self: Box) {}
+LL +     fn foo(self) {}
+   |
 
 error[E0053]: method `bar` has an incompatible type for trait
   --> $DIR/bad-self-type.rs:24:17
diff --git a/tests/ui/compare-method/issue-90444.stderr b/tests/ui/compare-method/issue-90444.stderr
index f05c9939c009..c69d63b3e30b 100644
--- a/tests/ui/compare-method/issue-90444.stderr
+++ b/tests/ui/compare-method/issue-90444.stderr
@@ -8,8 +8,9 @@ LL |     fn from(_: fn((), (), &mut ())) -> Self {
               found signature `fn(for<'a> fn((), (), &'a mut ())) -> A`
 help: change the parameter type to match the trait
    |
-LL |     fn from(_: for<'a> fn((), (), &'a ())) -> Self {
-   |                ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     fn from(_: fn((), (), &mut ())) -> Self {
+LL +     fn from(_: for<'a> fn((), (), &'a ())) -> Self {
+   |
 
 error[E0053]: method `from` has an incompatible type for trait
   --> $DIR/issue-90444.rs:11:16
@@ -21,8 +22,9 @@ LL |     fn from(_: fn((), (), u64)) -> Self {
               found signature `fn(fn((), (), u64)) -> B`
 help: change the parameter type to match the trait
    |
-LL |     fn from(_: fn((), (), u32)) -> Self {
-   |                ~~~~~~~~~~~~~~~
+LL -     fn from(_: fn((), (), u64)) -> Self {
+LL +     fn from(_: fn((), (), u32)) -> Self {
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/compare-method/region-extra-2.stderr b/tests/ui/compare-method/region-extra-2.stderr
index 3f55f6731176..d19d4f28f12a 100644
--- a/tests/ui/compare-method/region-extra-2.stderr
+++ b/tests/ui/compare-method/region-extra-2.stderr
@@ -9,8 +9,9 @@ LL |     fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b {
    |
 help: copy the `where` clause predicates from the trait
    |
-LL |     fn renew<'b: 'a>(self) -> &'b mut [T] where 'b: 'a {
-   |                                           ~~~~~~~~~~~~
+LL -     fn renew<'b: 'a>(self) -> &'b mut [T] where 'a: 'b {
+LL +     fn renew<'b: 'a>(self) -> &'b mut [T] where 'b: 'a {
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/compare-method/reordered-type-param.stderr b/tests/ui/compare-method/reordered-type-param.stderr
index 1e8266e213d7..536364871a36 100644
--- a/tests/ui/compare-method/reordered-type-param.stderr
+++ b/tests/ui/compare-method/reordered-type-param.stderr
@@ -18,8 +18,9 @@ LL |   fn b(&self, x: C) -> C;
    = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
 help: change the parameter type to match the trait
    |
-LL |   fn b(&self, _x: F) -> G { panic!() }
-   |                              ~
+LL -   fn b(&self, _x: G) -> G { panic!() }
+LL +   fn b(&self, _x: F) -> G { panic!() }
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/conditional-compilation/cfg-attr-parse.stderr b/tests/ui/conditional-compilation/cfg-attr-parse.stderr
index 759df3c90c6f..1605761e5919 100644
--- a/tests/ui/conditional-compilation/cfg-attr-parse.stderr
+++ b/tests/ui/conditional-compilation/cfg-attr-parse.stderr
@@ -7,8 +7,9 @@ LL | #[cfg_attr()]
    = note: for more information, visit 
 help: missing condition and attribute
    |
-LL | #[cfg_attr(condition, attribute, other_attribute, ...)]
-   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - #[cfg_attr()]
+LL + #[cfg_attr(condition, attribute, other_attribute, ...)]
+   |
 
 error: expected `,`, found end of `cfg_attr` input
   --> $DIR/cfg-attr-parse.rs:8:17
@@ -54,8 +55,9 @@ LL | #[cfg_attr[all(),,]]
    |
 help: the delimiters should be `(` and `)`
    |
-LL | #[cfg_attr(all(),,)]
-   |           ~       ~
+LL - #[cfg_attr[all(),,]]
+LL + #[cfg_attr(all(),,)]
+   |
 
 error: expected identifier, found `,`
   --> $DIR/cfg-attr-parse.rs:44:18
@@ -74,8 +76,9 @@ LL | #[cfg_attr{all(),,}]
    |
 help: the delimiters should be `(` and `)`
    |
-LL | #[cfg_attr(all(),,)]
-   |           ~       ~
+LL - #[cfg_attr{all(),,}]
+LL + #[cfg_attr(all(),,)]
+   |
 
 error: expected identifier, found `,`
   --> $DIR/cfg-attr-parse.rs:50:18
diff --git a/tests/ui/confuse-field-and-method/issue-33784.stderr b/tests/ui/confuse-field-and-method/issue-33784.stderr
index 59a6f4fccd8d..69f569e09a44 100644
--- a/tests/ui/confuse-field-and-method/issue-33784.stderr
+++ b/tests/ui/confuse-field-and-method/issue-33784.stderr
@@ -10,8 +10,9 @@ LL |     (p.closure)();
    |     +         +
 help: there is a method `clone` with a similar name
    |
-LL |     p.clone();
-   |       ~~~~~
+LL -     p.closure();
+LL +     p.clone();
+   |
 
 error[E0599]: no method named `fn_ptr` found for reference `&&Obj<{closure@$DIR/issue-33784.rs:25:43: 25:45}>` in the current scope
   --> $DIR/issue-33784.rs:29:7
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_dyn_compatibility.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_dyn_compatibility.stderr
index 6fa9b591ad26..c71ec24dda33 100644
--- a/tests/ui/const-generics/adt_const_params/const_param_ty_dyn_compatibility.stderr
+++ b/tests/ui/const-generics/adt_const_params/const_param_ty_dyn_compatibility.stderr
@@ -11,8 +11,9 @@ note: for a trait to be dyn compatible it needs to allow building a vtable
    = note: the trait is not dyn compatible because it uses `Self` as a type parameter
 help: consider using an opaque type instead
    |
-LL | fn foo(a: &impl ConstParamTy_) {}
-   |            ~~~~
+LL - fn foo(a: &dyn ConstParamTy_) {}
+LL + fn foo(a: &impl ConstParamTy_) {}
+   |
 
 error[E0038]: the trait `UnsizedConstParamTy` is not dyn compatible
   --> $DIR/const_param_ty_dyn_compatibility.rs:9:16
@@ -27,8 +28,9 @@ note: for a trait to be dyn compatible it needs to allow building a vtable
    = note: the trait is not dyn compatible because it uses `Self` as a type parameter
 help: consider using an opaque type instead
    |
-LL | fn bar(a: &impl UnsizedConstParamTy) {}
-   |            ~~~~
+LL - fn bar(a: &dyn UnsizedConstParamTy) {}
+LL + fn bar(a: &impl UnsizedConstParamTy) {}
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/const-generics/early/invalid-const-arguments.stderr b/tests/ui/const-generics/early/invalid-const-arguments.stderr
index cee34e3b7159..86b4d006454f 100644
--- a/tests/ui/const-generics/early/invalid-const-arguments.stderr
+++ b/tests/ui/const-generics/early/invalid-const-arguments.stderr
@@ -9,8 +9,9 @@ LL | impl Foo for A {}
    |
 help: a struct with a similar name exists
    |
-LL | impl Foo for A {}
-   |                ~
+LL - impl Foo for A {}
+LL + impl Foo for A {}
+   |
 help: you might be missing a type parameter
    |
 LL | impl Foo for A {}
@@ -27,8 +28,9 @@ LL | impl Foo for C {}
    |
 help: a struct with a similar name exists
    |
-LL | impl Foo for C {}
-   |                                ~
+LL - impl Foo for C {}
+LL + impl Foo for C {}
+   |
 help: you might be missing a type parameter
    |
 LL | impl Foo for C {}
diff --git a/tests/ui/const-generics/ensure_is_evaluatable.stderr b/tests/ui/const-generics/ensure_is_evaluatable.stderr
index 62f8bc34f2ed..397902846ecb 100644
--- a/tests/ui/const-generics/ensure_is_evaluatable.stderr
+++ b/tests/ui/const-generics/ensure_is_evaluatable.stderr
@@ -14,8 +14,9 @@ LL |     [(); N + 1]:,
    |          ^^^^^ required by this bound in `bar`
 help: try adding a `where` bound
    |
-LL |     [(); M + 1]:, [(); N + 1]:
-   |                 ~~~~~~~~~~~~~~
+LL -     [(); M + 1]:,
+LL +     [(); M + 1]:, [(); N + 1]:
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/const-generics/fn_with_two_const_inputs.stderr b/tests/ui/const-generics/fn_with_two_const_inputs.stderr
index c0a913a21fd2..147a2c91fd07 100644
--- a/tests/ui/const-generics/fn_with_two_const_inputs.stderr
+++ b/tests/ui/const-generics/fn_with_two_const_inputs.stderr
@@ -14,8 +14,9 @@ LL |     [(); N + 1]:,
    |          ^^^^^ required by this bound in `bar`
 help: try adding a `where` bound
    |
-LL |     [(); both(N + 1, M + 1)]:, [(); N + 1]:
-   |                              ~~~~~~~~~~~~~~
+LL -     [(); both(N + 1, M + 1)]:,
+LL +     [(); both(N + 1, M + 1)]:, [(); N + 1]:
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/const-generics/forbid-non-structural_match-types.stderr b/tests/ui/const-generics/forbid-non-structural_match-types.stderr
index 94afded9469e..8ef629329f10 100644
--- a/tests/ui/const-generics/forbid-non-structural_match-types.stderr
+++ b/tests/ui/const-generics/forbid-non-structural_match-types.stderr
@@ -6,8 +6,8 @@ LL | struct D;
    |
 help: add `#[derive(ConstParamTy, PartialEq, Eq)]` to the struct
    |
+LL - struct C;
 LL + #[derive(ConstParamTy, PartialEq, Eq)]
-LL | struct C;
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/const-generics/generic_arg_infer/in-signature.stderr b/tests/ui/const-generics/generic_arg_infer/in-signature.stderr
index 5999bc182040..12d84268f955 100644
--- a/tests/ui/const-generics/generic_arg_infer/in-signature.stderr
+++ b/tests/ui/const-generics/generic_arg_infer/in-signature.stderr
@@ -34,8 +34,9 @@ LL | const ARR_CT: [u8; _] = [0; 3];
    |
 help: replace this with a fully-specified type
    |
-LL | const ARR_CT: [u8; 3] = [0; 3];
-   |               ~~~~~~~
+LL - const ARR_CT: [u8; _] = [0; 3];
+LL + const ARR_CT: [u8; 3] = [0; 3];
+   |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables
   --> $DIR/in-signature.rs:24:25
@@ -45,8 +46,9 @@ LL | static ARR_STATIC: [u8; _] = [0; 3];
    |
 help: replace this with a fully-specified type
    |
-LL | static ARR_STATIC: [u8; 3] = [0; 3];
-   |                    ~~~~~~~
+LL - static ARR_STATIC: [u8; _] = [0; 3];
+LL + static ARR_STATIC: [u8; 3] = [0; 3];
+   |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants
   --> $DIR/in-signature.rs:26:23
@@ -56,8 +58,9 @@ LL | const TY_CT: Bar = Bar::(0);
    |
 help: replace this with a fully-specified type
    |
-LL | const TY_CT: Bar = Bar::(0);
-   |              ~~~~~~~~~~~
+LL - const TY_CT: Bar = Bar::(0);
+LL + const TY_CT: Bar = Bar::(0);
+   |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables
   --> $DIR/in-signature.rs:28:28
@@ -67,8 +70,9 @@ LL | static TY_STATIC: Bar = Bar::(0);
    |
 help: replace this with a fully-specified type
    |
-LL | static TY_STATIC: Bar = Bar::(0);
-   |                   ~~~~~~~~~~~
+LL - static TY_STATIC: Bar = Bar::(0);
+LL + static TY_STATIC: Bar = Bar::(0);
+   |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants
   --> $DIR/in-signature.rs:30:24
@@ -80,8 +84,9 @@ LL | const TY_CT_MIXED: Bar<_, _> = Bar::(0);
    |
 help: replace this with a fully-specified type
    |
-LL | const TY_CT_MIXED: Bar = Bar::(0);
-   |                    ~~~~~~~~~~~
+LL - const TY_CT_MIXED: Bar<_, _> = Bar::(0);
+LL + const TY_CT_MIXED: Bar = Bar::(0);
+   |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables
   --> $DIR/in-signature.rs:32:29
@@ -93,8 +98,9 @@ LL | static TY_STATIC_MIXED: Bar<_, _> = Bar::(0);
    |
 help: replace this with a fully-specified type
    |
-LL | static TY_STATIC_MIXED: Bar = Bar::(0);
-   |                         ~~~~~~~~~~~
+LL - static TY_STATIC_MIXED: Bar<_, _> = Bar::(0);
+LL + static TY_STATIC_MIXED: Bar = Bar::(0);
+   |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types
   --> $DIR/in-signature.rs:51:23
diff --git a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr
index 3622ef16a960..9cb71ad8a096 100644
--- a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr
@@ -16,8 +16,9 @@ LL |     fn assert_impl() {}
    |                       ^^^^^ required by this bound in `assert_impl`
 help: try adding a `where` bound
    |
-LL |     EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: {
-   |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     EvaluatableU128<{N as u128}>:, {
+LL +     EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: {
+   |
 
 error[E0308]: mismatched types
   --> $DIR/abstract-const-as-cast-3.rs:17:5
@@ -51,8 +52,9 @@ LL |     fn assert_impl() {}
    |                       ^^^^^ required by this bound in `assert_impl`
 help: try adding a `where` bound
    |
-LL |     EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: {
-   |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     EvaluatableU128<{N as u128}>:, {
+LL +     EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: {
+   |
 
 error[E0308]: mismatched types
   --> $DIR/abstract-const-as-cast-3.rs:20:5
@@ -114,8 +116,9 @@ LL |     fn assert_impl() {}
    |                       ^^^^^ required by this bound in `assert_impl`
 help: try adding a `where` bound
    |
-LL |     EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: {
-   |                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     EvaluatableU128<{N as _}>:, {
+LL +     EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: {
+   |
 
 error[E0308]: mismatched types
   --> $DIR/abstract-const-as-cast-3.rs:35:5
@@ -149,8 +152,9 @@ LL |     fn assert_impl() {}
    |                       ^^^^^ required by this bound in `assert_impl`
 help: try adding a `where` bound
    |
-LL |     EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: {
-   |                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     EvaluatableU128<{N as _}>:, {
+LL +     EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: {
+   |
 
 error[E0308]: mismatched types
   --> $DIR/abstract-const-as-cast-3.rs:38:5
diff --git a/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr b/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr
index f3a38fcc0054..b43ce5eca435 100644
--- a/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr
@@ -6,8 +6,9 @@ LL |     bar::<{ T::ASSOC }>();
    |
 help: try adding a `where` bound
    |
-LL | fn foo() where [(); U::ASSOC]:, [(); { T::ASSOC }]: {
-   |                                                   ~~~~~~~~~~~~~~~~~~~~~
+LL - fn foo() where [(); U::ASSOC]:, {
+LL + fn foo() where [(); U::ASSOC]:, [(); { T::ASSOC }]: {
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr
index 4d1fb02b59e9..86e35e17a077 100644
--- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr
@@ -26,8 +26,9 @@ LL |     foo::<_, L>([(); L + 1 + L]);
    |
 help: try adding a `where` bound
    |
-LL |     [(); (L - 1) + 1 + L]:, [(); L + 1 + L]:
-   |                           ~~~~~~~~~~~~~~~~~~
+LL -     [(); (L - 1) + 1 + L]:,
+LL +     [(); (L - 1) + 1 + L]:, [(); L + 1 + L]:
+   |
 
 error: unconstrained generic constant
   --> $DIR/issue_114151.rs:17:17
diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr
index 99eab935a094..c63a79e64ed9 100644
--- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr
@@ -15,8 +15,9 @@ LL |     foo::<_, L>([(); L + 1 + L]);
    |
 help: try adding a `where` bound
    |
-LL |     [(); (L - 1) + 1 + L]:, [(); L + 1 + L]:
-   |                           ~~~~~~~~~~~~~~~~~~
+LL -     [(); (L - 1) + 1 + L]:,
+LL +     [(); (L - 1) + 1 + L]:, [(); L + 1 + L]:
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr
index 80d711ca844a..c63beeac367b 100644
--- a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr
@@ -9,8 +9,9 @@ LL |          let f: F = async { 1 };
    |
 help: a trait with a similar name exists
    |
-LL |          let f: Fn = async { 1 };
-   |                 ~~
+LL -          let f: F = async { 1 };
+LL +          let f: Fn = async { 1 };
+   |
 help: you might be missing a type parameter
    |
 LL | fn f(
@@ -28,8 +29,9 @@ LL | ) -> impl Iterator {
    |                           +++
 help: you might have meant to write a bound here
    |
-LL | ) -> impl Iterator {
-   |                        ~
+LL - ) -> impl Iterator {
+LL + ) -> impl Iterator {
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:27
@@ -44,8 +46,9 @@ LL | ) -> impl Iterator {
    |                           +++
 help: you might have meant to write a bound here
    |
-LL | ) -> impl Iterator {
-   |                        ~
+LL - ) -> impl Iterator {
+LL + ) -> impl Iterator {
+   |
 
 error[E0277]: `()` is not an iterator
   --> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:6
diff --git a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr
index 4004ad190325..2b4c7f4bcff8 100644
--- a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr
+++ b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr
@@ -6,8 +6,9 @@ LL |     let _: u32 = 5i32.try_into::<32>().unwrap();
    |
 help: consider moving this generic argument to the `TryInto` trait, which takes up to 1 argument
    |
-LL |     let _: u32 = TryInto::<32>::try_into(5i32).unwrap();
-   |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let _: u32 = 5i32.try_into::<32>().unwrap();
+LL +     let _: u32 = TryInto::<32>::try_into(5i32).unwrap();
+   |
 help: remove the unnecessary generics
    |
 LL -     let _: u32 = 5i32.try_into::<32>().unwrap();
diff --git a/tests/ui/const-generics/issue-80471.stderr b/tests/ui/const-generics/issue-80471.stderr
index a8514c5cc074..8cf3d68e5d69 100644
--- a/tests/ui/const-generics/issue-80471.stderr
+++ b/tests/ui/const-generics/issue-80471.stderr
@@ -6,8 +6,8 @@ LL | fn foo() {}
    |
 help: add `#[derive(ConstParamTy)]` to the struct
    |
+LL - enum Nat {
 LL + #[derive(ConstParamTy)]
-LL | enum Nat {
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/const-generics/issues/issue-87493.stderr b/tests/ui/const-generics/issues/issue-87493.stderr
index 73bd6ed73e67..42d32a0ee050 100644
--- a/tests/ui/const-generics/issues/issue-87493.stderr
+++ b/tests/ui/const-generics/issues/issue-87493.stderr
@@ -6,8 +6,9 @@ LL |     T: MyTrait,
    |
 help: if you meant to use an associated type binding, replace `==` with `=`
    |
-LL |     T: MyTrait,
-   |                      ~
+LL -     T: MyTrait,
+LL +     T: MyTrait,
+   |
 
 error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
   --> $DIR/issue-87493.rs:8:8
diff --git a/tests/ui/const-generics/issues/issue-97278.stderr b/tests/ui/const-generics/issues/issue-97278.stderr
index 47e6bf1df4d1..4894ddb7b8db 100644
--- a/tests/ui/const-generics/issues/issue-97278.stderr
+++ b/tests/ui/const-generics/issues/issue-97278.stderr
@@ -6,8 +6,8 @@ LL | fn test() {}
    |
 help: add `#[derive(ConstParamTy)]` to the struct
    |
+LL - enum Bar {
 LL + #[derive(ConstParamTy)]
-LL | enum Bar {
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/const-generics/legacy-const-generics-bad.stderr b/tests/ui/const-generics/legacy-const-generics-bad.stderr
index e9ea22e472c1..3a5fa417075a 100644
--- a/tests/ui/const-generics/legacy-const-generics-bad.stderr
+++ b/tests/ui/const-generics/legacy-const-generics-bad.stderr
@@ -6,8 +6,9 @@ LL |     legacy_const_generics::foo(0, a, 2);
    |
 help: consider using `const` instead of `let`
    |
-LL |     const a: /* Type */ = 1;
-   |     ~~~~~  ++++++++++++
+LL -     let a = 1;
+LL +     const a: /* Type */ = 1;
+   |
 
 error: generic parameters may not be used in const operations
   --> $DIR/legacy-const-generics-bad.rs:12:35
diff --git a/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr b/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr
index 78cddcc234c6..d435af07db2a 100644
--- a/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr
+++ b/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr
@@ -16,8 +16,9 @@ LL | impl Foo for Bar {
    |
 help: to use `3` as a generic argument specify it directly
    |
-LL | impl Foo<3> for Bar {
-   |          ~
+LL - impl Foo for Bar {
+LL + impl Foo<3> for Bar {
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr b/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr
index 387eb226e70e..f852c14b1784 100644
--- a/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr
+++ b/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr
@@ -28,8 +28,9 @@ LL | impl Foo for Bar {
    |
 help: to use `3` as a generic argument specify it directly
    |
-LL | impl Foo<3> for Bar {
-   |          ~
+LL - impl Foo for Bar {
+LL + impl Foo<3> for Bar {
+   |
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/const-generics/type-dependent/type-mismatch.full.stderr b/tests/ui/const-generics/type-dependent/type-mismatch.full.stderr
index 4fce1aede954..95d20de1b432 100644
--- a/tests/ui/const-generics/type-dependent/type-mismatch.full.stderr
+++ b/tests/ui/const-generics/type-dependent/type-mismatch.full.stderr
@@ -6,8 +6,9 @@ LL |     assert_eq!(R.method::<1u16>(), 1);
    |
 help: change the type of the numeric literal from `u16` to `u8`
    |
-LL |     assert_eq!(R.method::<1u8>(), 1);
-   |                            ~~
+LL -     assert_eq!(R.method::<1u16>(), 1);
+LL +     assert_eq!(R.method::<1u8>(), 1);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/const-generics/type-dependent/type-mismatch.min.stderr b/tests/ui/const-generics/type-dependent/type-mismatch.min.stderr
index 4fce1aede954..95d20de1b432 100644
--- a/tests/ui/const-generics/type-dependent/type-mismatch.min.stderr
+++ b/tests/ui/const-generics/type-dependent/type-mismatch.min.stderr
@@ -6,8 +6,9 @@ LL |     assert_eq!(R.method::<1u16>(), 1);
    |
 help: change the type of the numeric literal from `u16` to `u8`
    |
-LL |     assert_eq!(R.method::<1u8>(), 1);
-   |                            ~~
+LL -     assert_eq!(R.method::<1u16>(), 1);
+LL +     assert_eq!(R.method::<1u8>(), 1);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/consts/assoc-const-elided-lifetime.stderr b/tests/ui/consts/assoc-const-elided-lifetime.stderr
index 3e847298c356..0c3e455eb2de 100644
--- a/tests/ui/consts/assoc-const-elided-lifetime.stderr
+++ b/tests/ui/consts/assoc-const-elided-lifetime.stderr
@@ -18,8 +18,9 @@ LL | #![deny(elided_lifetimes_in_associated_constant)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: use the `'static` lifetime
    |
-LL |     const FOO: Foo<'static> = Foo { x: PhantomData::<&()> };
-   |                    ~~~~~~~
+LL -     const FOO: Foo<'_> = Foo { x: PhantomData::<&()> };
+LL +     const FOO: Foo<'static> = Foo { x: PhantomData::<&()> };
+   |
 
 error: `&` without an explicit lifetime name cannot be used here
   --> $DIR/assoc-const-elided-lifetime.rs:14:16
diff --git a/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr b/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr
index 272c2f045e17..a3d5054ced35 100644
--- a/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr
+++ b/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr
@@ -13,8 +13,9 @@ LL | struct Bar;
    |
 help: create an inline `const` block
    |
-LL |     let _: [Option; 2] = [const { no_copy() }; 2];
-   |                                ~~~~~~~~~~~~~~~~~~~
+LL -     let _: [Option; 2] = [no_copy(); 2];
+LL +     let _: [Option; 2] = [const { no_copy() }; 2];
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/consts/const-pattern-irrefutable.stderr b/tests/ui/consts/const-pattern-irrefutable.stderr
index 646426c94268..a97e35e385fa 100644
--- a/tests/ui/consts/const-pattern-irrefutable.stderr
+++ b/tests/ui/consts/const-pattern-irrefutable.stderr
@@ -12,8 +12,9 @@ LL |     let a = 4;
    = note: the matched value is of type `u8`
 help: introduce a variable instead
    |
-LL |     let a_var = 4;
-   |         ~~~~~
+LL -     let a = 4;
+LL +     let a_var = 4;
+   |
 
 error[E0005]: refutable pattern in local binding
   --> $DIR/const-pattern-irrefutable.rs:28:9
@@ -29,8 +30,9 @@ LL |     let c = 4;
    = note: the matched value is of type `u8`
 help: introduce a variable instead
    |
-LL |     let b_var = 4;
-   |         ~~~~~
+LL -     let c = 4;
+LL +     let b_var = 4;
+   |
 
 error[E0005]: refutable pattern in local binding
   --> $DIR/const-pattern-irrefutable.rs:32:9
@@ -46,8 +48,9 @@ LL |     let d = (4, 4);
    = note: the matched value is of type `(u8, u8)`
 help: introduce a variable instead
    |
-LL |     let d_var = (4, 4);
-   |         ~~~~~
+LL -     let d = (4, 4);
+LL +     let d_var = (4, 4);
+   |
 
 error[E0005]: refutable pattern in local binding
   --> $DIR/const-pattern-irrefutable.rs:36:9
@@ -68,8 +71,9 @@ LL | struct S {
    = note: the matched value is of type `S`
 help: introduce a variable instead
    |
-LL |     let e_var = S {
-   |         ~~~~~
+LL -     let e = S {
+LL +     let e_var = S {
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/consts/const_let_assign2.stderr b/tests/ui/consts/const_let_assign2.stderr
index 9a1b84dbf09f..be0ffefc80de 100644
--- a/tests/ui/consts/const_let_assign2.stderr
+++ b/tests/ui/consts/const_let_assign2.stderr
@@ -9,8 +9,9 @@ LL |     let ptr = unsafe { &mut BB };
    = note: `#[warn(static_mut_refs)]` on by default
 help: use `&raw mut` instead to create a raw pointer
    |
-LL |     let ptr = unsafe { &raw mut BB };
-   |                        ~~~~~~~~
+LL -     let ptr = unsafe { &mut BB };
+LL +     let ptr = unsafe { &raw mut BB };
+   |
 
 warning: 1 warning emitted
 
diff --git a/tests/ui/consts/ice-bad-input-type-for-cast-83056.stderr b/tests/ui/consts/ice-bad-input-type-for-cast-83056.stderr
index 115f16885205..4fc5972051c2 100644
--- a/tests/ui/consts/ice-bad-input-type-for-cast-83056.stderr
+++ b/tests/ui/consts/ice-bad-input-type-for-cast-83056.stderr
@@ -8,8 +8,9 @@ LL | fn f() -> T {}
    |
 help: a struct with a similar name exists
    |
-LL | fn f() -> S {}
-   |           ~
+LL - fn f() -> T {}
+LL + fn f() -> S {}
+   |
 help: you might be missing a type parameter
    |
 LL | fn f() -> T {}
diff --git a/tests/ui/consts/issue-104768.stderr b/tests/ui/consts/issue-104768.stderr
index 41a9bab0961a..bd4a54de0ae4 100644
--- a/tests/ui/consts/issue-104768.stderr
+++ b/tests/ui/consts/issue-104768.stderr
@@ -19,8 +19,9 @@ LL | const A: &_ = 0_u32;
    |
 help: replace this with a fully-specified type
    |
-LL | const A: u32 = 0_u32;
-   |          ~~~
+LL - const A: &_ = 0_u32;
+LL + const A: u32 = 0_u32;
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/consts/issue-3521.stderr b/tests/ui/consts/issue-3521.stderr
index c0e4cdc5a94c..bddab2ebc05d 100644
--- a/tests/ui/consts/issue-3521.stderr
+++ b/tests/ui/consts/issue-3521.stderr
@@ -6,8 +6,9 @@ LL |         Bar = foo
    |
 help: consider using `const` instead of `let`
    |
-LL |     const foo: isize = 100;
-   |     ~~~~~
+LL -     let foo: isize = 100;
+LL +     const foo: isize = 100;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/consts/issue-91560.stderr b/tests/ui/consts/issue-91560.stderr
index 37c8f50d4943..9b06f3775d9f 100644
--- a/tests/ui/consts/issue-91560.stderr
+++ b/tests/ui/consts/issue-91560.stderr
@@ -6,8 +6,9 @@ LL |     let arr = [0; length];
    |
 help: consider using `const` instead of `let`
    |
-LL |     const length: usize = 2;
-   |     ~~~~~
+LL -     let mut length: usize = 2;
+LL +     const length: usize = 2;
+   |
 
 error[E0435]: attempt to use a non-constant value in a constant
   --> $DIR/issue-91560.rs:17:19
@@ -17,8 +18,9 @@ LL |     let arr = [0; length];
    |
 help: consider using `const` instead of `let`
    |
-LL |     const length: usize = 2;
-   |     ~~~~~
+LL -     let   length: usize = 2;
+LL +     const length: usize = 2;
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/consts/non-const-value-in-const.stderr b/tests/ui/consts/non-const-value-in-const.stderr
index 654b573544c2..201c310843b3 100644
--- a/tests/ui/consts/non-const-value-in-const.stderr
+++ b/tests/ui/consts/non-const-value-in-const.stderr
@@ -6,8 +6,9 @@ LL |     const Y: i32 = x;
    |
 help: consider using `let` instead of `const`
    |
-LL |     let Y: i32 = x;
-   |     ~~~
+LL -     const Y: i32 = x;
+LL +     let Y: i32 = x;
+   |
 
 error[E0435]: attempt to use a non-constant value in a constant
   --> $DIR/non-const-value-in-const.rs:6:17
@@ -17,8 +18,9 @@ LL |     let _ = [0; x];
    |
 help: consider using `const` instead of `let`
    |
-LL |     const x: /* Type */ = 5;
-   |     ~~~~~  ++++++++++++
+LL -     let x = 5;
+LL +     const x: /* Type */ = 5;
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/consts/refs_check_const_eq-issue-88384.stderr b/tests/ui/consts/refs_check_const_eq-issue-88384.stderr
index 62c5c5276411..65e4dc22c288 100644
--- a/tests/ui/consts/refs_check_const_eq-issue-88384.stderr
+++ b/tests/ui/consts/refs_check_const_eq-issue-88384.stderr
@@ -15,8 +15,8 @@ LL | struct Foo;
    |
 help: add `#[derive(ConstParamTy)]` to the struct
    |
+LL - struct CompileTimeSettings {
 LL + #[derive(ConstParamTy)]
-LL | struct CompileTimeSettings {
    |
 
 error[E0741]: `CompileTimeSettings` must implement `ConstParamTy` to be used as the type of a const generic parameter
@@ -27,8 +27,8 @@ LL | impl Foo {
    |
 help: add `#[derive(ConstParamTy)]` to the struct
    |
+LL - struct CompileTimeSettings {
 LL + #[derive(ConstParamTy)]
-LL | struct CompileTimeSettings {
    |
 
 error: aborting due to 2 previous errors; 1 warning emitted
diff --git a/tests/ui/coroutine/issue-102645.stderr b/tests/ui/coroutine/issue-102645.stderr
index 1ef37d3f7d10..bec0518d8c60 100644
--- a/tests/ui/coroutine/issue-102645.stderr
+++ b/tests/ui/coroutine/issue-102645.stderr
@@ -8,8 +8,9 @@ note: method defined here
   --> $SRC_DIR/core/src/ops/coroutine.rs:LL:COL
 help: provide the argument
    |
-LL |     Pin::new(&mut b).resume(());
-   |                            ~~~~
+LL -     Pin::new(&mut b).resume();
+LL +     Pin::new(&mut b).resume(());
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/coroutine/resume-arg-outlives.stderr b/tests/ui/coroutine/resume-arg-outlives.stderr
index 2a6337b49451..0150009c8fa2 100644
--- a/tests/ui/coroutine/resume-arg-outlives.stderr
+++ b/tests/ui/coroutine/resume-arg-outlives.stderr
@@ -9,12 +9,14 @@ LL |     generator
    |
 help: consider changing `impl Coroutine<&'not_static str> + 'static`'s explicit `'static` bound to the lifetime of argument `s`
    |
-LL | fn demo<'not_static>(s: &'not_static str) -> Pin + 'not_static>> {
-   |                                                                                         ~~~~~~~~~~~
+LL - fn demo<'not_static>(s: &'not_static str) -> Pin + 'static>> {
+LL + fn demo<'not_static>(s: &'not_static str) -> Pin + 'not_static>> {
+   |
 help: alternatively, add an explicit `'static` bound to this reference
    |
-LL | fn demo<'not_static>(s: &'static str) -> Pin + 'static>> {
-   |                         ~~~~~~~~~~~~
+LL - fn demo<'not_static>(s: &'not_static str) -> Pin + 'static>> {
+LL + fn demo<'not_static>(s: &'static str) -> Pin + 'static>> {
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/coverage-attr/bad-attr-ice.feat.stderr b/tests/ui/coverage-attr/bad-attr-ice.feat.stderr
index 50e1c39d4f8b..a8a70e363b7e 100644
--- a/tests/ui/coverage-attr/bad-attr-ice.feat.stderr
+++ b/tests/ui/coverage-attr/bad-attr-ice.feat.stderr
@@ -6,9 +6,11 @@ LL | #[coverage]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
+LL - #[coverage]
+LL + #[coverage(off)]
    |
-LL | #[coverage(on)]
+LL - #[coverage]
+LL + #[coverage(on)]
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/coverage-attr/bad-attr-ice.nofeat.stderr b/tests/ui/coverage-attr/bad-attr-ice.nofeat.stderr
index e8bdd99c9b9b..6443fafef3e4 100644
--- a/tests/ui/coverage-attr/bad-attr-ice.nofeat.stderr
+++ b/tests/ui/coverage-attr/bad-attr-ice.nofeat.stderr
@@ -6,9 +6,11 @@ LL | #[coverage]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
+LL - #[coverage]
+LL + #[coverage(off)]
    |
-LL | #[coverage(on)]
+LL - #[coverage]
+LL + #[coverage(on)]
    |
 
 error[E0658]: the `#[coverage]` attribute is an experimental feature
diff --git a/tests/ui/coverage-attr/bad-syntax.stderr b/tests/ui/coverage-attr/bad-syntax.stderr
index 5592e89070d8..3123066e7bf9 100644
--- a/tests/ui/coverage-attr/bad-syntax.stderr
+++ b/tests/ui/coverage-attr/bad-syntax.stderr
@@ -6,10 +6,12 @@ LL | #[coverage]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
-   | ~~~~~~~~~~~~~~~~
-LL | #[coverage(on)]
-   | ~~~~~~~~~~~~~~~
+LL - #[coverage]
+LL + #[coverage(off)]
+   |
+LL - #[coverage]
+LL + #[coverage(on)]
+   |
 
 error: malformed `coverage` attribute input
   --> $DIR/bad-syntax.rs:20:1
@@ -19,10 +21,12 @@ LL | #[coverage = true]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
-   | ~~~~~~~~~~~~~~~~
-LL | #[coverage(on)]
-   | ~~~~~~~~~~~~~~~
+LL - #[coverage = true]
+LL + #[coverage(off)]
+   |
+LL - #[coverage = true]
+LL + #[coverage(on)]
+   |
 
 error: malformed `coverage` attribute input
   --> $DIR/bad-syntax.rs:23:1
@@ -32,10 +36,12 @@ LL | #[coverage()]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
-   | ~~~~~~~~~~~~~~~~
-LL | #[coverage(on)]
-   | ~~~~~~~~~~~~~~~
+LL - #[coverage()]
+LL + #[coverage(off)]
+   |
+LL - #[coverage()]
+LL + #[coverage(on)]
+   |
 
 error: malformed `coverage` attribute input
   --> $DIR/bad-syntax.rs:26:1
@@ -45,10 +51,12 @@ LL | #[coverage(off, off)]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
-   | ~~~~~~~~~~~~~~~~
-LL | #[coverage(on)]
-   | ~~~~~~~~~~~~~~~
+LL - #[coverage(off, off)]
+LL + #[coverage(off)]
+   |
+LL - #[coverage(off, off)]
+LL + #[coverage(on)]
+   |
 
 error: malformed `coverage` attribute input
   --> $DIR/bad-syntax.rs:29:1
@@ -58,10 +66,12 @@ LL | #[coverage(off, on)]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
-   | ~~~~~~~~~~~~~~~~
-LL | #[coverage(on)]
-   | ~~~~~~~~~~~~~~~
+LL - #[coverage(off, on)]
+LL + #[coverage(off)]
+   |
+LL - #[coverage(off, on)]
+LL + #[coverage(on)]
+   |
 
 error: malformed `coverage` attribute input
   --> $DIR/bad-syntax.rs:32:1
@@ -71,10 +81,12 @@ LL | #[coverage(bogus)]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
-   | ~~~~~~~~~~~~~~~~
-LL | #[coverage(on)]
-   | ~~~~~~~~~~~~~~~
+LL - #[coverage(bogus)]
+LL + #[coverage(off)]
+   |
+LL - #[coverage(bogus)]
+LL + #[coverage(on)]
+   |
 
 error: malformed `coverage` attribute input
   --> $DIR/bad-syntax.rs:35:1
@@ -84,10 +96,12 @@ LL | #[coverage(bogus, off)]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
-   | ~~~~~~~~~~~~~~~~
-LL | #[coverage(on)]
-   | ~~~~~~~~~~~~~~~
+LL - #[coverage(bogus, off)]
+LL + #[coverage(off)]
+   |
+LL - #[coverage(bogus, off)]
+LL + #[coverage(on)]
+   |
 
 error: malformed `coverage` attribute input
   --> $DIR/bad-syntax.rs:38:1
@@ -97,10 +111,12 @@ LL | #[coverage(off, bogus)]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
-   | ~~~~~~~~~~~~~~~~
-LL | #[coverage(on)]
-   | ~~~~~~~~~~~~~~~
+LL - #[coverage(off, bogus)]
+LL + #[coverage(off)]
+   |
+LL - #[coverage(off, bogus)]
+LL + #[coverage(on)]
+   |
 
 error: expected identifier, found `,`
   --> $DIR/bad-syntax.rs:44:12
diff --git a/tests/ui/coverage-attr/name-value.stderr b/tests/ui/coverage-attr/name-value.stderr
index bfd22ed5451b..31a635b57e54 100644
--- a/tests/ui/coverage-attr/name-value.stderr
+++ b/tests/ui/coverage-attr/name-value.stderr
@@ -6,9 +6,11 @@ LL | #[coverage = "off"]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
+LL - #[coverage = "off"]
+LL + #[coverage(off)]
    |
-LL | #[coverage(on)]
+LL - #[coverage = "off"]
+LL + #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -19,9 +21,11 @@ LL |     #![coverage = "off"]
    |
 help: the following are the possible correct uses
    |
-LL |     #![coverage(off)]
+LL -     #![coverage = "off"]
+LL +     #![coverage(off)]
    |
-LL |     #![coverage(on)]
+LL -     #![coverage = "off"]
+LL +     #![coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -32,9 +36,11 @@ LL | #[coverage = "off"]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
+LL - #[coverage = "off"]
+LL + #[coverage(off)]
    |
-LL | #[coverage(on)]
+LL - #[coverage = "off"]
+LL + #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -45,9 +51,11 @@ LL |     #[coverage = "off"]
    |
 help: the following are the possible correct uses
    |
-LL |     #[coverage(off)]
+LL -     #[coverage = "off"]
+LL +     #[coverage(off)]
    |
-LL |     #[coverage(on)]
+LL -     #[coverage = "off"]
+LL +     #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -58,9 +66,11 @@ LL | #[coverage = "off"]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
+LL - #[coverage = "off"]
+LL + #[coverage(off)]
    |
-LL | #[coverage(on)]
+LL - #[coverage = "off"]
+LL + #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -71,9 +81,11 @@ LL |     #[coverage = "off"]
    |
 help: the following are the possible correct uses
    |
-LL |     #[coverage(off)]
+LL -     #[coverage = "off"]
+LL +     #[coverage(off)]
    |
-LL |     #[coverage(on)]
+LL -     #[coverage = "off"]
+LL +     #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -84,9 +96,11 @@ LL |     #[coverage = "off"]
    |
 help: the following are the possible correct uses
    |
-LL |     #[coverage(off)]
+LL -     #[coverage = "off"]
+LL +     #[coverage(off)]
    |
-LL |     #[coverage(on)]
+LL -     #[coverage = "off"]
+LL +     #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -97,9 +111,11 @@ LL | #[coverage = "off"]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
+LL - #[coverage = "off"]
+LL + #[coverage(off)]
    |
-LL | #[coverage(on)]
+LL - #[coverage = "off"]
+LL + #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -110,9 +126,11 @@ LL |     #[coverage = "off"]
    |
 help: the following are the possible correct uses
    |
-LL |     #[coverage(off)]
+LL -     #[coverage = "off"]
+LL +     #[coverage(off)]
    |
-LL |     #[coverage(on)]
+LL -     #[coverage = "off"]
+LL +     #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -123,9 +141,11 @@ LL |     #[coverage = "off"]
    |
 help: the following are the possible correct uses
    |
-LL |     #[coverage(off)]
+LL -     #[coverage = "off"]
+LL +     #[coverage(off)]
    |
-LL |     #[coverage(on)]
+LL -     #[coverage = "off"]
+LL +     #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -136,9 +156,11 @@ LL | #[coverage = "off"]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
+LL - #[coverage = "off"]
+LL + #[coverage(off)]
    |
-LL | #[coverage(on)]
+LL - #[coverage = "off"]
+LL + #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -149,9 +171,11 @@ LL | #[coverage = "off"]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
+LL - #[coverage = "off"]
+LL + #[coverage(off)]
    |
-LL | #[coverage(on)]
+LL - #[coverage = "off"]
+LL + #[coverage(on)]
    |
 
 error[E0788]: coverage attribute not allowed here
diff --git a/tests/ui/coverage-attr/subword.stderr b/tests/ui/coverage-attr/subword.stderr
index a672ff4ac41d..a5d1a492181b 100644
--- a/tests/ui/coverage-attr/subword.stderr
+++ b/tests/ui/coverage-attr/subword.stderr
@@ -6,10 +6,12 @@ LL | #[coverage(yes(milord))]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
-   | ~~~~~~~~~~~~~~~~
-LL | #[coverage(on)]
-   | ~~~~~~~~~~~~~~~
+LL - #[coverage(yes(milord))]
+LL + #[coverage(off)]
+   |
+LL - #[coverage(yes(milord))]
+LL + #[coverage(on)]
+   |
 
 error: malformed `coverage` attribute input
   --> $DIR/subword.rs:11:1
@@ -19,10 +21,12 @@ LL | #[coverage(no(milord))]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
-   | ~~~~~~~~~~~~~~~~
-LL | #[coverage(on)]
-   | ~~~~~~~~~~~~~~~
+LL - #[coverage(no(milord))]
+LL + #[coverage(off)]
+   |
+LL - #[coverage(no(milord))]
+LL + #[coverage(on)]
+   |
 
 error: malformed `coverage` attribute input
   --> $DIR/subword.rs:14:1
@@ -32,10 +36,12 @@ LL | #[coverage(yes = "milord")]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
-   | ~~~~~~~~~~~~~~~~
-LL | #[coverage(on)]
-   | ~~~~~~~~~~~~~~~
+LL - #[coverage(yes = "milord")]
+LL + #[coverage(off)]
+   |
+LL - #[coverage(yes = "milord")]
+LL + #[coverage(on)]
+   |
 
 error: malformed `coverage` attribute input
   --> $DIR/subword.rs:17:1
@@ -45,10 +51,12 @@ LL | #[coverage(no = "milord")]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
-   | ~~~~~~~~~~~~~~~~
-LL | #[coverage(on)]
-   | ~~~~~~~~~~~~~~~
+LL - #[coverage(no = "milord")]
+LL + #[coverage(off)]
+   |
+LL - #[coverage(no = "milord")]
+LL + #[coverage(on)]
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/coverage-attr/word-only.stderr b/tests/ui/coverage-attr/word-only.stderr
index bad50b0c961d..c034149d8ec9 100644
--- a/tests/ui/coverage-attr/word-only.stderr
+++ b/tests/ui/coverage-attr/word-only.stderr
@@ -6,9 +6,11 @@ LL | #[coverage]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
+LL - #[coverage]
+LL + #[coverage(off)]
    |
-LL | #[coverage(on)]
+LL - #[coverage]
+LL + #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -19,9 +21,11 @@ LL |     #![coverage]
    |
 help: the following are the possible correct uses
    |
-LL |     #![coverage(off)]
+LL -     #![coverage]
+LL +     #![coverage(off)]
    |
-LL |     #![coverage(on)]
+LL -     #![coverage]
+LL +     #![coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -32,9 +36,11 @@ LL | #[coverage]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
+LL - #[coverage]
+LL + #[coverage(off)]
    |
-LL | #[coverage(on)]
+LL - #[coverage]
+LL + #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -45,9 +51,11 @@ LL |     #[coverage]
    |
 help: the following are the possible correct uses
    |
-LL |     #[coverage(off)]
+LL -     #[coverage]
+LL +     #[coverage(off)]
    |
-LL |     #[coverage(on)]
+LL -     #[coverage]
+LL +     #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -58,9 +66,11 @@ LL | #[coverage]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
+LL - #[coverage]
+LL + #[coverage(off)]
    |
-LL | #[coverage(on)]
+LL - #[coverage]
+LL + #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -71,9 +81,11 @@ LL |     #[coverage]
    |
 help: the following are the possible correct uses
    |
-LL |     #[coverage(off)]
+LL -     #[coverage]
+LL +     #[coverage(off)]
    |
-LL |     #[coverage(on)]
+LL -     #[coverage]
+LL +     #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -84,9 +96,11 @@ LL |     #[coverage]
    |
 help: the following are the possible correct uses
    |
-LL |     #[coverage(off)]
+LL -     #[coverage]
+LL +     #[coverage(off)]
    |
-LL |     #[coverage(on)]
+LL -     #[coverage]
+LL +     #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -97,9 +111,11 @@ LL | #[coverage]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
+LL - #[coverage]
+LL + #[coverage(off)]
    |
-LL | #[coverage(on)]
+LL - #[coverage]
+LL + #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -110,9 +126,11 @@ LL |     #[coverage]
    |
 help: the following are the possible correct uses
    |
-LL |     #[coverage(off)]
+LL -     #[coverage]
+LL +     #[coverage(off)]
    |
-LL |     #[coverage(on)]
+LL -     #[coverage]
+LL +     #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -123,9 +141,11 @@ LL |     #[coverage]
    |
 help: the following are the possible correct uses
    |
-LL |     #[coverage(off)]
+LL -     #[coverage]
+LL +     #[coverage(off)]
    |
-LL |     #[coverage(on)]
+LL -     #[coverage]
+LL +     #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -136,9 +156,11 @@ LL | #[coverage]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
+LL - #[coverage]
+LL + #[coverage(off)]
    |
-LL | #[coverage(on)]
+LL - #[coverage]
+LL + #[coverage(on)]
    |
 
 error: malformed `coverage` attribute input
@@ -149,9 +171,11 @@ LL | #[coverage]
    |
 help: the following are the possible correct uses
    |
-LL | #[coverage(off)]
+LL - #[coverage]
+LL + #[coverage(off)]
    |
-LL | #[coverage(on)]
+LL - #[coverage]
+LL + #[coverage(on)]
    |
 
 error[E0788]: coverage attribute not allowed here
diff --git a/tests/ui/deprecation/atomic_initializers.stderr b/tests/ui/deprecation/atomic_initializers.stderr
index 30fcc9de6181..3a2e66138188 100644
--- a/tests/ui/deprecation/atomic_initializers.stderr
+++ b/tests/ui/deprecation/atomic_initializers.stderr
@@ -7,8 +7,9 @@ LL | static FOO: AtomicIsize = ATOMIC_ISIZE_INIT;
    = note: `#[warn(deprecated)]` on by default
 help: replace the use of the deprecated constant
    |
-LL | static FOO: AtomicIsize = AtomicIsize::new(0);
-   |                           ~~~~~~~~~~~~~~~~~~~
+LL - static FOO: AtomicIsize = ATOMIC_ISIZE_INIT;
+LL + static FOO: AtomicIsize = AtomicIsize::new(0);
+   |
 
 warning: 1 warning emitted
 
diff --git a/tests/ui/deprecation/invalid-literal.stderr b/tests/ui/deprecation/invalid-literal.stderr
index ca827beda059..cbe1fcca0238 100644
--- a/tests/ui/deprecation/invalid-literal.stderr
+++ b/tests/ui/deprecation/invalid-literal.stderr
@@ -6,12 +6,15 @@ LL | #[deprecated = b"test"]
    |
 help: the following are the possible correct uses
    |
-LL | #[deprecated = "reason"]
-   | ~~~~~~~~~~~~~~~~~~~~~~~~
-LL | #[deprecated(/*opt*/ since = "version", /*opt*/ note = "reason")]
-   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LL | #[deprecated]
-   | ~~~~~~~~~~~~~
+LL - #[deprecated = b"test"]
+LL + #[deprecated = "reason"]
+   |
+LL - #[deprecated = b"test"]
+LL + #[deprecated(/*opt*/ since = "version", /*opt*/ note = "reason")]
+   |
+LL - #[deprecated = b"test"]
+LL + #[deprecated]
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr b/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr
index d1f5ea3602a8..a81143640a07 100644
--- a/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr
+++ b/tests/ui/deprecation/issue-84637-deprecated-associated-function.stderr
@@ -11,8 +11,9 @@ LL | #![deny(deprecated)]
    |         ^^^^^^^^^^
 help: replace the use of the deprecated method
    |
-LL |     let _foo = str::trim_start("   aoeu");
-   |                     ~~~~~~~~~~
+LL -     let _foo = str::trim_left("   aoeu");
+LL +     let _foo = str::trim_start("   aoeu");
+   |
 
 error: use of deprecated method `core::str::::trim_left`: superseded by `trim_start`
   --> $DIR/issue-84637-deprecated-associated-function.rs:8:26
@@ -22,8 +23,9 @@ LL |     let _bar = "   aoeu".trim_left();
    |
 help: replace the use of the deprecated method
    |
-LL |     let _bar = "   aoeu".trim_start();
-   |                          ~~~~~~~~~~
+LL -     let _bar = "   aoeu".trim_left();
+LL +     let _bar = "   aoeu".trim_start();
+   |
 
 error: use of deprecated method `std::slice::::connect`: renamed to join
   --> $DIR/issue-84637-deprecated-associated-function.rs:10:27
@@ -33,8 +35,9 @@ LL |     let _baz = ["a", "b"].connect(" ");
    |
 help: replace the use of the deprecated method
    |
-LL |     let _baz = ["a", "b"].join(" ");
-   |                           ~~~~
+LL -     let _baz = ["a", "b"].connect(" ");
+LL +     let _baz = ["a", "b"].join(" ");
+   |
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/deprecation/suggestion.stderr b/tests/ui/deprecation/suggestion.stderr
index 5584b6d2f8ff..58e4219d37b9 100644
--- a/tests/ui/deprecation/suggestion.stderr
+++ b/tests/ui/deprecation/suggestion.stderr
@@ -11,8 +11,9 @@ LL | #![deny(deprecated)]
    |         ^^^^^^^^^^
 help: replace the use of the deprecated function
    |
-LL |     bar::replacement();
-   |          ~~~~~~~~~~~
+LL -     bar::deprecated();
+LL +     bar::replacement();
+   |
 
 error: use of deprecated method `Foo::deprecated`: replaced by `replacement`
   --> $DIR/suggestion.rs:40:9
@@ -22,8 +23,9 @@ LL |     foo.deprecated();
    |
 help: replace the use of the deprecated method
    |
-LL |     foo.replacement();
-   |         ~~~~~~~~~~~
+LL -     foo.deprecated();
+LL +     foo.replacement();
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/deref-patterns/issue-71676-1.stderr b/tests/ui/deref-patterns/issue-71676-1.stderr
index 164641ff7751..348a2c12ec49 100644
--- a/tests/ui/deref-patterns/issue-71676-1.stderr
+++ b/tests/ui/deref-patterns/issue-71676-1.stderr
@@ -40,8 +40,9 @@ LL |     let _: *const u8 = &mut a;
            found mutable reference `&mut Emm`
 help: consider dereferencing
    |
-LL |     let _: *const u8 = &***a;
-   |                         ~~~
+LL -     let _: *const u8 = &mut a;
+LL +     let _: *const u8 = &***a;
+   |
 
 error[E0308]: mismatched types
   --> $DIR/issue-71676-1.rs:52:22
diff --git a/tests/ui/derived-errors/issue-30580.stderr b/tests/ui/derived-errors/issue-30580.stderr
index 05b555917299..e8659ea931dd 100644
--- a/tests/ui/derived-errors/issue-30580.stderr
+++ b/tests/ui/derived-errors/issue-30580.stderr
@@ -6,8 +6,9 @@ LL |         b.c;
    |
 help: a field with a similar name exists
    |
-LL |         b.a;
-   |           ~
+LL -         b.c;
+LL +         b.a;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/destructuring-assignment/struct_destructure_fail.stderr b/tests/ui/destructuring-assignment/struct_destructure_fail.stderr
index 58f8e97dea04..7efc0b20e54b 100644
--- a/tests/ui/destructuring-assignment/struct_destructure_fail.stderr
+++ b/tests/ui/destructuring-assignment/struct_destructure_fail.stderr
@@ -26,16 +26,19 @@ LL |     Struct { a, _ } = Struct { a: 1, b: 2 };
    |
 help: include the missing field in the pattern
    |
-LL |     Struct { a, b } = Struct { a: 1, b: 2 };
-   |               ~~~~~
+LL -     Struct { a, _ } = Struct { a: 1, b: 2 };
+LL +     Struct { a, b } = Struct { a: 1, b: 2 };
+   |
 help: if you don't care about this missing field, you can explicitly ignore it
    |
-LL |     Struct { a, b: _ } = Struct { a: 1, b: 2 };
-   |               ~~~~~~~~
+LL -     Struct { a, _ } = Struct { a: 1, b: 2 };
+LL +     Struct { a, b: _ } = Struct { a: 1, b: 2 };
+   |
 help: or always ignore missing fields here
    |
-LL |     Struct { a, .. } = Struct { a: 1, b: 2 };
-   |               ~~~~~~
+LL -     Struct { a, _ } = Struct { a: 1, b: 2 };
+LL +     Struct { a, .. } = Struct { a: 1, b: 2 };
+   |
 
 error[E0797]: base expression required after `..`
   --> $DIR/struct_destructure_fail.rs:15:19
diff --git a/tests/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr b/tests/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr
index 5cc7acba3f33..515d4cc76215 100644
--- a/tests/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr
+++ b/tests/ui/destructuring-assignment/tuple_struct_destructure_fail.stderr
@@ -38,8 +38,9 @@ LL |     TupleStruct(_, _) = TupleStruct(1, 2);
    |                  +++
 help: use `..` to ignore all fields
    |
-LL |     TupleStruct(..) = TupleStruct(1, 2);
-   |                 ~~
+LL -     TupleStruct(_) = TupleStruct(1, 2);
+LL +     TupleStruct(..) = TupleStruct(1, 2);
+   |
 
 error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields
   --> $DIR/tuple_struct_destructure_fail.rs:32:25
@@ -65,8 +66,9 @@ LL |     Enum::SingleVariant(_, _) = Enum::SingleVariant(1, 2);
    |                          +++
 help: use `..` to ignore all fields
    |
-LL |     Enum::SingleVariant(..) = Enum::SingleVariant(1, 2);
-   |                         ~~
+LL -     Enum::SingleVariant(_) = Enum::SingleVariant(1, 2);
+LL +     Enum::SingleVariant(..) = Enum::SingleVariant(1, 2);
+   |
 
 error[E0070]: invalid left-hand side of assignment
   --> $DIR/tuple_struct_destructure_fail.rs:38:12
diff --git a/tests/ui/diagnostic_namespace/suggest_typos.stderr b/tests/ui/diagnostic_namespace/suggest_typos.stderr
index ff4ee9717d42..f41e2f655567 100644
--- a/tests/ui/diagnostic_namespace/suggest_typos.stderr
+++ b/tests/ui/diagnostic_namespace/suggest_typos.stderr
@@ -11,8 +11,9 @@ LL | #![deny(unknown_or_malformed_diagnostic_attributes)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: an attribute with a similar name exists
    |
-LL | #[diagnostic::on_unimplemented]
-   |               ~~~~~~~~~~~~~~~~
+LL - #[diagnostic::onunimplemented]
+LL + #[diagnostic::on_unimplemented]
+   |
 
 error: unknown diagnostic attribute
   --> $DIR/suggest_typos.rs:9:15
@@ -22,8 +23,9 @@ LL | #[diagnostic::un_onimplemented]
    |
 help: an attribute with a similar name exists
    |
-LL | #[diagnostic::on_unimplemented]
-   |               ~~~~~~~~~~~~~~~~
+LL - #[diagnostic::un_onimplemented]
+LL + #[diagnostic::on_unimplemented]
+   |
 
 error: unknown diagnostic attribute
   --> $DIR/suggest_typos.rs:14:15
@@ -33,8 +35,9 @@ LL | #[diagnostic::on_implemented]
    |
 help: an attribute with a similar name exists
    |
-LL | #[diagnostic::on_unimplemented]
-   |               ~~~~~~~~~~~~~~~~
+LL - #[diagnostic::on_implemented]
+LL + #[diagnostic::on_unimplemented]
+   |
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/did_you_mean/bad-assoc-ty.stderr b/tests/ui/did_you_mean/bad-assoc-ty.stderr
index 5fc2f7c1fe68..7e34f4d35b4e 100644
--- a/tests/ui/did_you_mean/bad-assoc-ty.stderr
+++ b/tests/ui/did_you_mean/bad-assoc-ty.stderr
@@ -109,8 +109,9 @@ LL | type A = [u8; 4]::AssocTy;
    |
 help: if there were a trait named `Example` with associated type `AssocTy` implemented for `[u8; 4]`, you could use the fully-qualified path
    |
-LL | type A = <[u8; 4] as Example>::AssocTy;
-   |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - type A = [u8; 4]::AssocTy;
+LL + type A = <[u8; 4] as Example>::AssocTy;
+   |
 
 error[E0223]: ambiguous associated type
   --> $DIR/bad-assoc-ty.rs:5:10
@@ -120,8 +121,9 @@ LL | type B = [u8]::AssocTy;
    |
 help: if there were a trait named `Example` with associated type `AssocTy` implemented for `[u8]`, you could use the fully-qualified path
    |
-LL | type B = <[u8] as Example>::AssocTy;
-   |          ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - type B = [u8]::AssocTy;
+LL + type B = <[u8] as Example>::AssocTy;
+   |
 
 error[E0223]: ambiguous associated type
   --> $DIR/bad-assoc-ty.rs:9:10
@@ -131,8 +133,9 @@ LL | type C = (u8)::AssocTy;
    |
 help: if there were a trait named `Example` with associated type `AssocTy` implemented for `u8`, you could use the fully-qualified path
    |
-LL | type C = ::AssocTy;
-   |          ~~~~~~~~~~~~~~~~~~~~~~~~
+LL - type C = (u8)::AssocTy;
+LL + type C = ::AssocTy;
+   |
 
 error[E0223]: ambiguous associated type
   --> $DIR/bad-assoc-ty.rs:13:10
@@ -142,8 +145,9 @@ LL | type D = (u8, u8)::AssocTy;
    |
 help: if there were a trait named `Example` with associated type `AssocTy` implemented for `(u8, u8)`, you could use the fully-qualified path
    |
-LL | type D = <(u8, u8) as Example>::AssocTy;
-   |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - type D = (u8, u8)::AssocTy;
+LL + type D = <(u8, u8) as Example>::AssocTy;
+   |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases
   --> $DIR/bad-assoc-ty.rs:17:10
@@ -159,8 +163,9 @@ LL | type F = &'static (u8)::AssocTy;
    |
 help: if there were a trait named `Example` with associated type `AssocTy` implemented for `u8`, you could use the fully-qualified path
    |
-LL | type F = &'static ::AssocTy;
-   |                   ~~~~~~~~~~~~~~~~~~~~~~~~
+LL - type F = &'static (u8)::AssocTy;
+LL + type F = &'static ::AssocTy;
+   |
 
 error[E0223]: ambiguous associated type
   --> $DIR/bad-assoc-ty.rs:27:10
@@ -170,8 +175,9 @@ LL | type G = dyn 'static + (Send)::AssocTy;
    |
 help: if there were a trait named `Example` with associated type `AssocTy` implemented for `(dyn Send + 'static)`, you could use the fully-qualified path
    |
-LL | type G = <(dyn Send + 'static) as Example>::AssocTy;
-   |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - type G = dyn 'static + (Send)::AssocTy;
+LL + type G = <(dyn Send + 'static) as Example>::AssocTy;
+   |
 
 warning: trait objects without an explicit `dyn` are deprecated
   --> $DIR/bad-assoc-ty.rs:33:10
@@ -195,10 +201,12 @@ LL | type H = Fn(u8) -> (u8)::Output;
    |
 help: use fully-qualified syntax
    |
-LL | type H = <(dyn Fn(u8) -> u8 + 'static) as BitOr>::Output;
-   |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LL | type H = <(dyn Fn(u8) -> u8 + 'static) as IntoFuture>::Output;
-   |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - type H = Fn(u8) -> (u8)::Output;
+LL + type H = <(dyn Fn(u8) -> u8 + 'static) as BitOr>::Output;
+   |
+LL - type H = Fn(u8) -> (u8)::Output;
+LL + type H = <(dyn Fn(u8) -> u8 + 'static) as IntoFuture>::Output;
+   |
 
 error[E0223]: ambiguous associated type
   --> $DIR/bad-assoc-ty.rs:39:19
@@ -212,8 +220,9 @@ LL | type J = ty!(u8);
    = note: this error originates in the macro `ty` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: if there were a trait named `Example` with associated type `AssocTy` implemented for `u8`, you could use the fully-qualified path
    |
-LL |     ($ty: ty) => (::AssocTy);
-   |                   ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     ($ty: ty) => ($ty::AssocTy);
+LL +     ($ty: ty) => (::AssocTy);
+   |
 
 error[E0223]: ambiguous associated type
   --> $DIR/bad-assoc-ty.rs:46:10
@@ -223,8 +232,9 @@ LL | type I = ty!()::AssocTy;
    |
 help: if there were a trait named `Example` with associated type `AssocTy` implemented for `u8`, you could use the fully-qualified path
    |
-LL | type I = ::AssocTy;
-   |          ~~~~~~~~~~~~~~~~~~~~~~~~
+LL - type I = ty!()::AssocTy;
+LL + type I = ::AssocTy;
+   |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
   --> $DIR/bad-assoc-ty.rs:51:13
@@ -242,8 +252,9 @@ LL | fn bar(_: F) where F: Fn() -> _ {}
    |
 help: use type parameters instead
    |
-LL | fn bar(_: F) where F: Fn() -> T {}
-   |         +++                         ~
+LL - fn bar(_: F) where F: Fn() -> _ {}
+LL + fn bar(_: F) where F: Fn() -> T {}
+   |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
   --> $DIR/bad-assoc-ty.rs:57:19
@@ -253,8 +264,9 @@ LL | fn baz _>(_: F) {}
    |
 help: use type parameters instead
    |
-LL | fn baz T, T>(_: F) {}
-   |                   ~+++
+LL - fn baz _>(_: F) {}
+LL + fn baz T, T>(_: F) {}
+   |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
   --> $DIR/bad-assoc-ty.rs:60:33
@@ -264,8 +276,9 @@ LL | struct L(F) where F: Fn() -> _;
    |
 help: use type parameters instead
    |
-LL | struct L(F) where F: Fn() -> T;
-   |           +++                      ~
+LL - struct L(F) where F: Fn() -> _;
+LL + struct L(F) where F: Fn() -> T;
+   |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
   --> $DIR/bad-assoc-ty.rs:82:38
@@ -275,8 +288,9 @@ LL |     fn foo(_: F) where F: Fn() -> _ {}
    |
 help: use type parameters instead
    |
-LL |     fn foo(_: F) where F: Fn() -> T {}
-   |             +++                         ~
+LL -     fn foo(_: F) where F: Fn() -> _ {}
+LL +     fn foo(_: F) where F: Fn() -> T {}
+   |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
   --> $DIR/bad-assoc-ty.rs:62:30
@@ -286,8 +300,9 @@ LL | struct M where F: Fn() -> _ {
    |
 help: use type parameters instead
    |
-LL | struct M where F: Fn() -> T {
-   |           +++                   ~
+LL - struct M where F: Fn() -> _ {
+LL + struct M where F: Fn() -> T {
+   |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for enums
   --> $DIR/bad-assoc-ty.rs:66:28
@@ -297,8 +312,9 @@ LL | enum N where F: Fn() -> _ {
    |
 help: use type parameters instead
    |
-LL | enum N where F: Fn() -> T {
-   |         +++                   ~
+LL - enum N where F: Fn() -> _ {
+LL + enum N where F: Fn() -> T {
+   |
 
 error[E0121]: the placeholder `_` is not allowed within types on item signatures for unions
   --> $DIR/bad-assoc-ty.rs:71:29
@@ -308,8 +324,9 @@ LL | union O where F: Fn() -> _ {
    |
 help: use type parameters instead
    |
-LL | union O where F: Fn() -> T {
-   |          +++                   ~
+LL - union O where F: Fn() -> _ {
+LL + union O where F: Fn() -> T {
+   |
 
 error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
   --> $DIR/bad-assoc-ty.rs:73:5
@@ -331,8 +348,9 @@ LL | trait P where F: Fn() -> _ {
    |
 help: use type parameters instead
    |
-LL | trait P where F: Fn() -> T {
-   |          +++                   ~
+LL - trait P where F: Fn() -> _ {
+LL + trait P where F: Fn() -> T {
+   |
 
 error: aborting due to 29 previous errors; 1 warning emitted
 
diff --git a/tests/ui/did_you_mean/brackets-to-braces-single-element.stderr b/tests/ui/did_you_mean/brackets-to-braces-single-element.stderr
index a7ec192592e0..d4aeb1eee96a 100644
--- a/tests/ui/did_you_mean/brackets-to-braces-single-element.stderr
+++ b/tests/ui/did_you_mean/brackets-to-braces-single-element.stderr
@@ -6,8 +6,9 @@ LL | const A: [&str; 1] = { "hello" };
    |
 help: to create an array, use square brackets instead of curly braces
    |
-LL | const A: [&str; 1] = [ "hello" ];
-   |                      ~         ~
+LL - const A: [&str; 1] = { "hello" };
+LL + const A: [&str; 1] = [ "hello" ];
+   |
 
 error[E0308]: mismatched types
   --> $DIR/brackets-to-braces-single-element.rs:4:19
@@ -19,8 +20,9 @@ LL | const B: &[u32] = &{ 1 };
               found reference `&{integer}`
 help: to create an array, use square brackets instead of curly braces
    |
-LL | const B: &[u32] = &[ 1 ];
-   |                    ~   ~
+LL - const B: &[u32] = &{ 1 };
+LL + const B: &[u32] = &[ 1 ];
+   |
 
 error[E0308]: mismatched types
   --> $DIR/brackets-to-braces-single-element.rs:7:27
@@ -30,8 +32,9 @@ LL | const C: &&[u32; 1] = &&{ 1 };
    |
 help: to create an array, use square brackets instead of curly braces
    |
-LL | const C: &&[u32; 1] = &&[ 1 ];
-   |                         ~   ~
+LL - const C: &&[u32; 1] = &&{ 1 };
+LL + const C: &&[u32; 1] = &&[ 1 ];
+   |
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/did_you_mean/compatible-variants-in-pat.stderr b/tests/ui/did_you_mean/compatible-variants-in-pat.stderr
index 5e48871bb01b..09cf094e6bd7 100644
--- a/tests/ui/did_you_mean/compatible-variants-in-pat.stderr
+++ b/tests/ui/did_you_mean/compatible-variants-in-pat.stderr
@@ -33,8 +33,9 @@ LL |         Some(S) => {
    |         +++++ +
 help: introduce a new binding instead
    |
-LL |         other_s => {
-   |         ~~~~~~~
+LL -         S => {
+LL +         other_s => {
+   |
 
 error[E0308]: mismatched types
   --> $DIR/compatible-variants-in-pat.rs:32:9
@@ -60,8 +61,9 @@ LL |         Err(S) => {
    |         ++++ +
 help: introduce a new binding instead
    |
-LL |         other_s => {
-   |         ~~~~~~~
+LL -         S => {
+LL +         other_s => {
+   |
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr
index 473c9a339fc2..72b65006a3fb 100644
--- a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr
+++ b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr
@@ -10,8 +10,9 @@ LL |     const CRATE: Crate = Crate { fiel: () };
    = note: this error originates in the macro `environment` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: a field with a similar name exists
    |
-LL |     const CRATE: Crate = Crate { field: () };
-   |                                  ~~~~~
+LL -     const CRATE: Crate = Crate { fiel: () };
+LL +     const CRATE: Crate = Crate { field: () };
+   |
 
 error[E0609]: no field `field` on type `Compound`
   --> $DIR/dont-suggest-hygienic-fields.rs:24:16
diff --git a/tests/ui/did_you_mean/issue-36798.stderr b/tests/ui/did_you_mean/issue-36798.stderr
index 70aa3c32bfbf..233cb1e32486 100644
--- a/tests/ui/did_you_mean/issue-36798.stderr
+++ b/tests/ui/did_you_mean/issue-36798.stderr
@@ -6,8 +6,9 @@ LL |     f.baz;
    |
 help: a field with a similar name exists
    |
-LL |     f.bar;
-   |       ~~~
+LL -     f.baz;
+LL +     f.bar;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr b/tests/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr
index 952ac76a003d..9893aad7486b 100644
--- a/tests/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr
+++ b/tests/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr
@@ -6,8 +6,9 @@ LL |     let _x = ~1;
    |
 help: use `!` to perform bitwise not
    |
-LL |     let _x = !1;
-   |              ~
+LL -     let _x = ~1;
+LL +     let _x = !1;
+   |
 
 error: unexpected `1` after identifier
   --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:5:18
@@ -17,8 +18,9 @@ LL |     let _y = not 1;
    |
 help: use `!` to perform bitwise not
    |
-LL |     let _y = !1;
-   |              ~
+LL -     let _y = not 1;
+LL +     let _y = !1;
+   |
 
 error: unexpected keyword `false` after identifier
   --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:6:18
@@ -28,8 +30,9 @@ LL |     let _z = not false;
    |
 help: use `!` to perform logical negation
    |
-LL |     let _z = !false;
-   |              ~
+LL -     let _z = not false;
+LL +     let _z = !false;
+   |
 
 error: unexpected keyword `true` after identifier
   --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:7:18
@@ -39,8 +42,9 @@ LL |     let _a = not true;
    |
 help: use `!` to perform logical negation
    |
-LL |     let _a = !true;
-   |              ~
+LL -     let _a = not true;
+LL +     let _a = !true;
+   |
 
 error: unexpected `v` after identifier
   --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:9:18
@@ -50,8 +54,9 @@ LL |     let _v = not v;
    |
 help: use `!` to perform logical negation or bitwise not
    |
-LL |     let _v = !v;
-   |              ~
+LL -     let _v = not v;
+LL +     let _v = !v;
+   |
 
 error: aborting due to 5 previous errors
 
diff --git a/tests/ui/did_you_mean/issue-42599_available_fields_note.stderr b/tests/ui/did_you_mean/issue-42599_available_fields_note.stderr
index d60db01a4653..8fe46eb7ee18 100644
--- a/tests/ui/did_you_mean/issue-42599_available_fields_note.stderr
+++ b/tests/ui/did_you_mean/issue-42599_available_fields_note.stderr
@@ -6,8 +6,9 @@ LL |             Self { secret_integer: 2, inocently_mispellable: () }
    |
 help: a field with a similar name exists
    |
-LL |             Self { secret_integer: 2, innocently_misspellable: () }
-   |                                       ~~~~~~~~~~~~~~~~~~~~~~~
+LL -             Self { secret_integer: 2, inocently_mispellable: () }
+LL +             Self { secret_integer: 2, innocently_misspellable: () }
+   |
 
 error[E0560]: struct `Demo` has no field named `egregiously_nonexistent_field`
   --> $DIR/issue-42599_available_fields_note.rs:21:39
@@ -25,8 +26,9 @@ LL |     let innocent_field_misaccess = demo.inocently_mispellable;
    |
 help: a field with a similar name exists
    |
-LL |     let innocent_field_misaccess = demo.innocently_misspellable;
-   |                                         ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let innocent_field_misaccess = demo.inocently_mispellable;
+LL +     let innocent_field_misaccess = demo.innocently_misspellable;
+   |
 
 error[E0609]: no field `egregiously_nonexistent_field` on type `Demo`
   --> $DIR/issue-42599_available_fields_note.rs:35:42
diff --git a/tests/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr b/tests/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr
index 92cbc03e0dd7..633f331a13a4 100644
--- a/tests/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr
+++ b/tests/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr
@@ -6,8 +6,9 @@ LL |             PersonalityInventory { expressivity: exp, ... } => exp
    |
 help: to omit remaining fields, use `..`
    |
-LL |             PersonalityInventory { expressivity: exp, .. } => exp
-   |                                                       ~~
+LL -             PersonalityInventory { expressivity: exp, ... } => exp
+LL +             PersonalityInventory { expressivity: exp, .. } => exp
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.stderr b/tests/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.stderr
index 6dea6a4fac8f..3a25181d29cc 100644
--- a/tests/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.stderr
+++ b/tests/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.stderr
@@ -6,8 +6,9 @@ LL |     if not for_you {
    |
 help: use `!` to perform logical negation or bitwise not
    |
-LL |     if !for_you {
-   |        ~
+LL -     if not for_you {
+LL +     if !for_you {
+   |
 
 error: unexpected `the_worst` after identifier
   --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:11:15
@@ -17,8 +18,9 @@ LL |     while not the_worst {
    |
 help: use `!` to perform logical negation or bitwise not
    |
-LL |     while !the_worst {
-   |           ~
+LL -     while not the_worst {
+LL +     while !the_worst {
+   |
 
 error: unexpected `println` after identifier
   --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:20:9
@@ -28,8 +30,9 @@ LL |         println!("Then when?");
    |
 help: use `!` to perform logical negation or bitwise not
    |
-LL |     if !// lack of braces is [sic]
-   |        ~
+LL -     if not  // lack of braces is [sic]
+LL +     if !// lack of braces is [sic]
+   |
 
 error: expected `{`, found `;`
   --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:20:31
@@ -53,8 +56,9 @@ LL |     let resource = not 2;
    |
 help: use `!` to perform bitwise not
    |
-LL |     let resource = !2;
-   |                    ~
+LL -     let resource = not 2;
+LL +     let resource = !2;
+   |
 
 error: unexpected `be_smothered_out_before` after identifier
   --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:32:27
@@ -64,8 +68,9 @@ LL |     let young_souls = not be_smothered_out_before;
    |
 help: use `!` to perform logical negation or bitwise not
    |
-LL |     let young_souls = !be_smothered_out_before;
-   |                       ~
+LL -     let young_souls = not be_smothered_out_before;
+LL +     let young_souls = !be_smothered_out_before;
+   |
 
 error: aborting due to 6 previous errors
 
diff --git a/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr b/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr
index 6d92fa5e14e9..d4812d4831b0 100644
--- a/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr
+++ b/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr
@@ -34,8 +34,9 @@ LL |         (Nucleotide::Adenine, Nucleotide::Cytosine, _) => true
    |         +                                            +
 help: ...or a vertical bar to match on multiple alternatives
    |
-LL |         Nucleotide::Adenine | Nucleotide::Cytosine | _ => true
-   |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -         Nucleotide::Adenine, Nucleotide::Cytosine, _ => true
+LL +         Nucleotide::Adenine | Nucleotide::Cytosine | _ => true
+   |
 
 error: unexpected `,` in pattern
   --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:67:10
diff --git a/tests/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr b/tests/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr
index 4b3d429c7509..664bf69b9ebc 100644
--- a/tests/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr
+++ b/tests/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr
@@ -12,8 +12,9 @@ LL | const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e−11; // m³⋅kg⁻¹
    |
 help: Unicode character '−' (Minus Sign) looks like '-' (Minus/Hyphen), but it is not
    |
-LL | const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e-11; // m³⋅kg⁻¹⋅s⁻²
-   |                                                     ~
+LL - const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e−11; // m³⋅kg⁻¹⋅s⁻²
+LL + const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e-11; // m³⋅kg⁻¹⋅s⁻²
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr b/tests/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr
index c52102e2631d..5dad6924dfd7 100644
--- a/tests/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr
+++ b/tests/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr
@@ -7,8 +7,9 @@ LL |     let _ = a and b;
    = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators
 help: use `&&` to perform logical conjunction
    |
-LL |     let _ = a && b;
-   |               ~~
+LL -     let _ = a and b;
+LL +     let _ = a && b;
+   |
 
 error: `and` is not a logical operator
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:9:10
@@ -19,8 +20,9 @@ LL |     if a and b {
    = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators
 help: use `&&` to perform logical conjunction
    |
-LL |     if a && b {
-   |          ~~
+LL -     if a and b {
+LL +     if a && b {
+   |
 
 error: `or` is not a logical operator
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:20:15
@@ -31,8 +33,9 @@ LL |     let _ = a or b;
    = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators
 help: use `||` to perform logical disjunction
    |
-LL |     let _ = a || b;
-   |               ~~
+LL -     let _ = a or b;
+LL +     let _ = a || b;
+   |
 
 error: `or` is not a logical operator
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:22:10
@@ -43,8 +46,9 @@ LL |     if a or b {
    = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators
 help: use `||` to perform logical disjunction
    |
-LL |     if a || b {
-   |          ~~
+LL -     if a or b {
+LL +     if a || b {
+   |
 
 error: `and` is not a logical operator
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:30:11
@@ -55,8 +59,9 @@ LL |     if (a and b) {
    = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators
 help: use `&&` to perform logical conjunction
    |
-LL |     if (a && b) {
-   |           ~~
+LL -     if (a and b) {
+LL +     if (a && b) {
+   |
 
 error: `or` is not a logical operator
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:38:11
@@ -67,8 +72,9 @@ LL |     if (a or b) {
    = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators
 help: use `||` to perform logical disjunction
    |
-LL |     if (a || b) {
-   |           ~~
+LL -     if (a or b) {
+LL +     if (a || b) {
+   |
 
 error: `and` is not a logical operator
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:46:13
@@ -79,8 +85,9 @@ LL |     while a and b {
    = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators
 help: use `&&` to perform logical conjunction
    |
-LL |     while a && b {
-   |             ~~
+LL -     while a and b {
+LL +     while a && b {
+   |
 
 error: `or` is not a logical operator
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:54:13
@@ -91,8 +98,9 @@ LL |     while a or b {
    = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators
 help: use `||` to perform logical disjunction
    |
-LL |     while a || b {
-   |             ~~
+LL -     while a or b {
+LL +     while a || b {
+   |
 
 error[E0308]: mismatched types
   --> $DIR/issue-54109-and_instead_of_ampersands.rs:13:33
diff --git a/tests/ui/did_you_mean/issue-54109-without-witness.stderr b/tests/ui/did_you_mean/issue-54109-without-witness.stderr
index ee6d9901fcf6..1ad88f0084c8 100644
--- a/tests/ui/did_you_mean/issue-54109-without-witness.stderr
+++ b/tests/ui/did_you_mean/issue-54109-without-witness.stderr
@@ -7,8 +7,9 @@ LL |     let _ = a and b;
    = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators
 help: use `&&` to perform logical conjunction
    |
-LL |     let _ = a && b;
-   |               ~~
+LL -     let _ = a and b;
+LL +     let _ = a && b;
+   |
 
 error: `and` is not a logical operator
   --> $DIR/issue-54109-without-witness.rs:15:10
@@ -19,8 +20,9 @@ LL |     if a and b {
    = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators
 help: use `&&` to perform logical conjunction
    |
-LL |     if a && b {
-   |          ~~
+LL -     if a and b {
+LL +     if a && b {
+   |
 
 error: `or` is not a logical operator
   --> $DIR/issue-54109-without-witness.rs:24:15
@@ -31,8 +33,9 @@ LL |     let _ = a or b;
    = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators
 help: use `||` to perform logical disjunction
    |
-LL |     let _ = a || b;
-   |               ~~
+LL -     let _ = a or b;
+LL +     let _ = a || b;
+   |
 
 error: `or` is not a logical operator
   --> $DIR/issue-54109-without-witness.rs:26:10
@@ -43,8 +46,9 @@ LL |     if a or b {
    = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators
 help: use `||` to perform logical disjunction
    |
-LL |     if a || b {
-   |          ~~
+LL -     if a or b {
+LL +     if a || b {
+   |
 
 error: `and` is not a logical operator
   --> $DIR/issue-54109-without-witness.rs:34:11
@@ -55,8 +59,9 @@ LL |     if (a and b) {
    = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators
 help: use `&&` to perform logical conjunction
    |
-LL |     if (a && b) {
-   |           ~~
+LL -     if (a and b) {
+LL +     if (a && b) {
+   |
 
 error: `or` is not a logical operator
   --> $DIR/issue-54109-without-witness.rs:42:11
@@ -67,8 +72,9 @@ LL |     if (a or b) {
    = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators
 help: use `||` to perform logical disjunction
    |
-LL |     if (a || b) {
-   |           ~~
+LL -     if (a or b) {
+LL +     if (a || b) {
+   |
 
 error: `and` is not a logical operator
   --> $DIR/issue-54109-without-witness.rs:50:13
@@ -79,8 +85,9 @@ LL |     while a and b {
    = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators
 help: use `&&` to perform logical conjunction
    |
-LL |     while a && b {
-   |             ~~
+LL -     while a and b {
+LL +     while a && b {
+   |
 
 error: `or` is not a logical operator
   --> $DIR/issue-54109-without-witness.rs:58:13
@@ -91,8 +98,9 @@ LL |     while a or b {
    = note: unlike in e.g., Python and PHP, `&&` and `||` are used for logical operators
 help: use `||` to perform logical disjunction
    |
-LL |     while a || b {
-   |             ~~
+LL -     while a or b {
+LL +     while a || b {
+   |
 
 error: aborting due to 8 previous errors
 
diff --git a/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr b/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr
index b1a15b8594a0..927f9e842e66 100644
--- a/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr
+++ b/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr
@@ -6,14 +6,18 @@ LL | fn setup() -> Set { Set }
    |
 help: there is an enum variant `AffixHeart::Set` and 7 others; try using the variant's enum
    |
-LL | fn setup() -> AffixHeart { Set }
-   |               ~~~~~~~~~~
-LL | fn setup() -> CauseToBe { Set }
-   |               ~~~~~~~~~
-LL | fn setup() -> Determine { Set }
-   |               ~~~~~~~~~
-LL | fn setup() -> PutDown { Set }
-   |               ~~~~~~~
+LL - fn setup() -> Set { Set }
+LL + fn setup() -> AffixHeart { Set }
+   |
+LL - fn setup() -> Set { Set }
+LL + fn setup() -> CauseToBe { Set }
+   |
+LL - fn setup() -> Set { Set }
+LL + fn setup() -> Determine { Set }
+   |
+LL - fn setup() -> Set { Set }
+LL + fn setup() -> PutDown { Set }
+   |
      and 3 other candidates
 
 error[E0425]: cannot find value `Set` in this scope
diff --git a/tests/ui/did_you_mean/issue-87830-try-brackets-for-arrays.stderr b/tests/ui/did_you_mean/issue-87830-try-brackets-for-arrays.stderr
index d5ad1a72b825..58232e2307d8 100644
--- a/tests/ui/did_you_mean/issue-87830-try-brackets-for-arrays.stderr
+++ b/tests/ui/did_you_mean/issue-87830-try-brackets-for-arrays.stderr
@@ -24,8 +24,9 @@ LL | const BAR: [&str; 3] = {"one", "two", "three"};
    |
 help: to make an array, use square brackets instead of curly braces
    |
-LL | const BAR: [&str; 3] = ["one", "two", "three"];
-   |                        ~                     ~
+LL - const BAR: [&str; 3] = {"one", "two", "three"};
+LL + const BAR: [&str; 3] = ["one", "two", "three"];
+   |
 
 error: this is a block expression, not an array
   --> $DIR/issue-87830-try-brackets-for-arrays.rs:12:5
@@ -35,8 +36,9 @@ LL |     {1, 2, 3};
    |
 help: to make an array, use square brackets instead of curly braces
    |
-LL |     [1, 2, 3];
-   |     ~       ~
+LL -     {1, 2, 3};
+LL +     [1, 2, 3];
+   |
 
 error: expected one of `.`, `;`, `?`, `}`, or an operator, found `,`
   --> $DIR/issue-87830-try-brackets-for-arrays.rs:17:6
diff --git a/tests/ui/did_you_mean/pub-macro-rules.stderr b/tests/ui/did_you_mean/pub-macro-rules.stderr
index fb9148748ca1..a91d419d96bc 100644
--- a/tests/ui/did_you_mean/pub-macro-rules.stderr
+++ b/tests/ui/did_you_mean/pub-macro-rules.stderr
@@ -6,8 +6,9 @@ LL |     pub macro_rules! foo {
    |
 help: try exporting the macro
    |
-LL |     #[macro_export] macro_rules! foo {
-   |     ~~~~~~~~~~~~~~~
+LL -     pub macro_rules! foo {
+LL +     #[macro_export] macro_rules! foo {
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/did_you_mean/replace-impl-infer-ty-from-trait.stderr b/tests/ui/did_you_mean/replace-impl-infer-ty-from-trait.stderr
index 96742f8bf47c..6c24a5899eae 100644
--- a/tests/ui/did_you_mean/replace-impl-infer-ty-from-trait.stderr
+++ b/tests/ui/did_you_mean/replace-impl-infer-ty-from-trait.stderr
@@ -10,8 +10,9 @@ LL |     fn bar(i: _, t: _, s: _) -> _ {
    |
 help: try replacing `_` with the types in the corresponding trait method signature
    |
-LL |     fn bar(i: i32, t: usize, s: &()) -> (usize, i32) {
-   |               ~~~     ~~~~~     ~~~     ~~~~~~~~~~~~
+LL -     fn bar(i: _, t: _, s: _) -> _ {
+LL +     fn bar(i: i32, t: usize, s: &()) -> (usize, i32) {
+   |
 
 error[E0282]: type annotations needed
   --> $DIR/replace-impl-infer-ty-from-trait.rs:9:15
diff --git a/tests/ui/did_you_mean/use_instead_of_import.stderr b/tests/ui/did_you_mean/use_instead_of_import.stderr
index f8d6de8a1176..aadd7524ec67 100644
--- a/tests/ui/did_you_mean/use_instead_of_import.stderr
+++ b/tests/ui/did_you_mean/use_instead_of_import.stderr
@@ -6,8 +6,9 @@ LL | import std::{
    |
 help: items are imported using the `use` keyword
    |
-LL | use std::{
-   | ~~~
+LL - import std::{
+LL + use std::{
+   |
 
 error: expected item, found `require`
   --> $DIR/use_instead_of_import.rs:9:1
@@ -17,8 +18,9 @@ LL | require std::time::Duration;
    |
 help: items are imported using the `use` keyword
    |
-LL | use std::time::Duration;
-   | ~~~
+LL - require std::time::Duration;
+LL + use std::time::Duration;
+   |
 
 error: expected item, found `include`
   --> $DIR/use_instead_of_import.rs:12:1
@@ -28,8 +30,9 @@ LL | include std::time::Instant;
    |
 help: items are imported using the `use` keyword
    |
-LL | use std::time::Instant;
-   | ~~~
+LL - include std::time::Instant;
+LL + use std::time::Instant;
+   |
 
 error: expected item, found `using`
   --> $DIR/use_instead_of_import.rs:15:5
@@ -39,8 +42,9 @@ LL | pub using std::io;
    |
 help: items are imported using the `use` keyword
    |
-LL | pub use std::io;
-   |     ~~~
+LL - pub using std::io;
+LL + pub use std::io;
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/drop/if-let-rescope-borrowck-suggestions.stderr b/tests/ui/drop/if-let-rescope-borrowck-suggestions.stderr
index 3c87e196af6e..b418ff4684da 100644
--- a/tests/ui/drop/if-let-rescope-borrowck-suggestions.stderr
+++ b/tests/ui/drop/if-let-rescope-borrowck-suggestions.stderr
@@ -18,8 +18,9 @@ LL ~     do_something(if let Some(value) = binding.get_ref() { value } else { &0
    |
 help: consider rewriting the `if` into `match` which preserves the extended lifetime
    |
-LL |     do_something({ match Droppy.get_ref()  { Some(value) => { value } _ => { &0 }}});
-   |                  ~~~~~~~                   ++++++++++++++++           ~~~~       ++
+LL -     do_something(if let Some(value) = Droppy.get_ref() { value } else { &0 });
+LL +     do_something({ match Droppy.get_ref()  { Some(value) => { value } _ => { &0 }}});
+   |
 
 error[E0716]: temporary value dropped while borrowed
   --> $DIR/if-let-rescope-borrowck-suggestions.rs:23:39
diff --git a/tests/ui/drop/lint-if-let-rescope.stderr b/tests/ui/drop/lint-if-let-rescope.stderr
index f6715dbae050..2b0fcb7a938a 100644
--- a/tests/ui/drop/lint-if-let-rescope.stderr
+++ b/tests/ui/drop/lint-if-let-rescope.stderr
@@ -108,8 +108,9 @@ LL |     if let Some(1) = { if let Some(_value) = Droppy.get() { Some(1) } else
    |                                                                     ^
 help: a `match` with a single arm can preserve the drop order up to Edition 2021
    |
-LL |     if let Some(1) = { match Droppy.get() { Some(_value) => { Some(1) } _ => { None }} } {
-   |                        ~~~~~              +++++++++++++++++             ~~~~         +
+LL -     if let Some(1) = { if let Some(_value) = Droppy.get() { Some(1) } else { None } } {
+LL +     if let Some(1) = { match Droppy.get() { Some(_value) => { Some(1) } _ => { None }} } {
+   |
 
 error: `if let` assigns a shorter lifetime since Edition 2024
   --> $DIR/lint-if-let-rescope.rs:72:12
@@ -128,8 +129,9 @@ LL |     if (if let Some(_value) = droppy().get() { true } else { false }) {
    |                                                     ^
 help: a `match` with a single arm can preserve the drop order up to Edition 2021
    |
-LL |     if (match droppy().get() { Some(_value) => { true } _ => { false }}) {
-   |         ~~~~~                +++++++++++++++++          ~~~~          +
+LL -     if (if let Some(_value) = droppy().get() { true } else { false }) {
+LL +     if (match droppy().get() { Some(_value) => { true } _ => { false }}) {
+   |
 
 error: `if let` assigns a shorter lifetime since Edition 2024
   --> $DIR/lint-if-let-rescope.rs:78:21
@@ -148,8 +150,9 @@ LL |     } else if (((if let Some(_value) = droppy().get() { true } else { false
    |                                                              ^
 help: a `match` with a single arm can preserve the drop order up to Edition 2021
    |
-LL |     } else if (((match droppy().get() { Some(_value) => { true } _ => { false }}))) {
-   |                  ~~~~~                +++++++++++++++++          ~~~~          +
+LL -     } else if (((if let Some(_value) = droppy().get() { true } else { false }))) {
+LL +     } else if (((match droppy().get() { Some(_value) => { true } _ => { false }}))) {
+   |
 
 error: `if let` assigns a shorter lifetime since Edition 2024
   --> $DIR/lint-if-let-rescope.rs:90:15
@@ -168,8 +171,9 @@ LL |     while (if let Some(_value) = droppy().get() { false } else { true }) {
    |                                                         ^
 help: a `match` with a single arm can preserve the drop order up to Edition 2021
    |
-LL |     while (match droppy().get() { Some(_value) => { false } _ => { true }}) {
-   |            ~~~~~                +++++++++++++++++           ~~~~         +
+LL -     while (if let Some(_value) = droppy().get() { false } else { true }) {
+LL +     while (match droppy().get() { Some(_value) => { false } _ => { true }}) {
+   |
 
 error: aborting due to 7 previous errors
 
diff --git a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr
index 2caa779ffaba..650244ac02a9 100644
--- a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr
+++ b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr
@@ -11,8 +11,9 @@ LL | struct DropMe(T);
    |                  ^^^^ required by this bound in `DropMe`
 help: consider further restricting type parameter `T` with trait `Copy`
    |
-LL |     [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy`
-   |                 ~~~~~~~~~~~~~~~~~~~~~~
+LL -     [T; 1]: Copy, // But `[T; 1]: Copy` does not imply `T: Copy`
+LL +     [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy`
+   |
 
 error[E0277]: the trait bound `T: Copy` is not satisfied
   --> $DIR/explicit-drop-bounds.rs:32:18
@@ -27,8 +28,9 @@ LL | struct DropMe(T);
    |                  ^^^^ required by this bound in `DropMe`
 help: consider further restricting type parameter `T` with trait `Copy`
    |
-LL |     [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy`
-   |                 ~~~~~~~~~~~~~~~~~~~~~~
+LL -     [T; 1]: Copy, // But `[T; 1]: Copy` does not imply `T: Copy`
+LL +     [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy`
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr b/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr
index 774d5ba3c892..c54cc858129c 100644
--- a/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr
+++ b/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr
@@ -67,8 +67,9 @@ LL | fn wants_write(_: impl Write) {}
    |                        ^^^^^ required by this bound in `wants_write`
 help: consider changing this borrow's mutability
    |
-LL |     wants_write(&mut [0u8][..]);
-   |                 ~~~~
+LL -     wants_write(&[0u8][..]);
+LL +     wants_write(&mut [0u8][..]);
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr
index 83795f3128ec..87207d607e2a 100644
--- a/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr
+++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr
@@ -7,8 +7,9 @@ LL | fn id(f: Copy) -> usize {
    = note: `Copy` it is dyn-incompatible, so it can't be `dyn`
 help: use a new generic type parameter, constrained by `Copy`
    |
-LL | fn id(f: T) -> usize {
-   |        +++++++++     ~
+LL - fn id(f: Copy) -> usize {
+LL + fn id(f: T) -> usize {
+   |
 help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
    |
 LL | fn id(f: impl Copy) -> usize {
diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr
index 813b5863738f..6075e313f4ed 100644
--- a/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr
+++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr
@@ -7,8 +7,9 @@ LL | trait A { fn g(b: B) -> B; }
    = note: `B` it is dyn-incompatible, so it can't be `dyn`
 help: use a new generic type parameter, constrained by `B`
    |
-LL | trait A { fn g(b: T) -> B; }
-   |               ++++++    ~
+LL - trait A { fn g(b: B) -> B; }
+LL + trait A { fn g(b: T) -> B; }
+   |
 help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
    |
 LL | trait A { fn g(b: impl B) -> B; }
@@ -34,8 +35,9 @@ LL | trait B { fn f(a: A) -> A; }
    = note: `A` it is dyn-incompatible, so it can't be `dyn`
 help: use a new generic type parameter, constrained by `A`
    |
-LL | trait B { fn f(a: T) -> A; }
-   |               ++++++    ~
+LL - trait B { fn f(a: A) -> A; }
+LL + trait B { fn f(a: T) -> A; }
+   |
 help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
    |
 LL | trait B { fn f(a: impl A) -> A; }
diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning.new.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning.new.stderr
index e9eb1cdd0c23..3ba4aa12e6d9 100644
--- a/tests/ui/dyn-compatibility/avoid-ice-on-warning.new.stderr
+++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning.new.stderr
@@ -6,8 +6,9 @@ LL | fn call_this(f: F) : Fn(&str) + call_that {}
    |
 help: use `->` instead
    |
-LL | fn call_this(f: F) -> Fn(&str) + call_that {}
-   |                       ~~
+LL - fn call_this(f: F) : Fn(&str) + call_that {}
+LL + fn call_this(f: F) -> Fn(&str) + call_that {}
+   |
 
 error[E0405]: cannot find trait `call_that` in this scope
   --> $DIR/avoid-ice-on-warning.rs:4:36
diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr
index 646fb57af9ed..dbfe91e18114 100644
--- a/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr
+++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr
@@ -6,8 +6,9 @@ LL | fn call_this(f: F) : Fn(&str) + call_that {}
    |
 help: use `->` instead
    |
-LL | fn call_this(f: F) -> Fn(&str) + call_that {}
-   |                       ~~
+LL - fn call_this(f: F) : Fn(&str) + call_that {}
+LL + fn call_this(f: F) -> Fn(&str) + call_that {}
+   |
 
 error[E0405]: cannot find trait `call_that` in this scope
   --> $DIR/avoid-ice-on-warning.rs:4:36
diff --git a/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr b/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr
index 4c6d84f05341..832e7ef4dc38 100644
--- a/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr
+++ b/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr
@@ -195,8 +195,9 @@ LL |     fn foo(_: &Trait);
    |
 help: use a new generic type parameter, constrained by `Trait`
    |
-LL |     fn foo(_: &T);
-   |           ++++++++++     ~
+LL -     fn foo(_: &Trait);
+LL +     fn foo(_: &T);
+   |
 help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
    |
 LL |     fn foo(_: &impl Trait);
@@ -214,8 +215,9 @@ LL |     fn bar(_: &'a Trait);
    |
 help: use a new generic type parameter, constrained by `Trait`
    |
-LL |     fn bar(_: &'a T);
-   |           ++++++++++        ~
+LL -     fn bar(_: &'a Trait);
+LL +     fn bar(_: &'a T);
+   |
 help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
    |
 LL |     fn bar(_: &'a impl Trait);
@@ -233,8 +235,9 @@ LL |     fn alice<'a>(_: &Trait);
    |
 help: use a new generic type parameter, constrained by `Trait`
    |
-LL |     fn alice<'a, T: Trait>(_: &T);
-   |                ++++++++++      ~
+LL -     fn alice<'a>(_: &Trait);
+LL +     fn alice<'a, T: Trait>(_: &T);
+   |
 help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
    |
 LL |     fn alice<'a>(_: &impl Trait);
@@ -252,8 +255,9 @@ LL |     fn bob<'a>(_: &'a Trait);
    |
 help: use a new generic type parameter, constrained by `Trait`
    |
-LL |     fn bob<'a, T: Trait>(_: &'a T);
-   |              ++++++++++         ~
+LL -     fn bob<'a>(_: &'a Trait);
+LL +     fn bob<'a, T: Trait>(_: &'a T);
+   |
 help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
    |
 LL |     fn bob<'a>(_: &'a impl Trait);
@@ -275,8 +279,9 @@ LL |     fn cat() -> &impl Trait;
    |                  ++++
 help: alternatively, you can return an owned trait object
    |
-LL |     fn cat() -> Box;
-   |                 ~~~~~~~~~~~~~~
+LL -     fn cat() -> &Trait;
+LL +     fn cat() -> Box;
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:69:22
@@ -290,8 +295,9 @@ LL |     fn dog<'a>() -> &impl Trait {
    |                      ++++
 help: alternatively, you can return an owned trait object
    |
-LL |     fn dog<'a>() -> Box {
-   |                     ~~~~~~~~~~~~~~
+LL -     fn dog<'a>() -> &Trait {
+LL +     fn dog<'a>() -> Box {
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:75:24
@@ -305,8 +311,9 @@ LL |     fn kitten() -> &'a impl Trait {
    |                        ++++
 help: alternatively, you can return an owned trait object
    |
-LL |     fn kitten() -> Box {
-   |                    ~~~~~~~~~~~~~~
+LL -     fn kitten() -> &'a Trait {
+LL +     fn kitten() -> Box {
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:81:27
@@ -320,8 +327,9 @@ LL |     fn puppy<'a>() -> &'a impl Trait {
    |                           ++++
 help: alternatively, you can return an owned trait object
    |
-LL |     fn puppy<'a>() -> Box {
-   |                       ~~~~~~~~~~~~~~
+LL -     fn puppy<'a>() -> &'a Trait {
+LL +     fn puppy<'a>() -> Box {
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:86:25
@@ -335,8 +343,9 @@ LL |     fn parrot() -> &mut impl Trait {
    |                         ++++
 help: alternatively, you can return an owned trait object
    |
-LL |     fn parrot() -> Box {
-   |                    ~~~~~~~~~~~~~~
+LL -     fn parrot() -> &mut Trait {
+LL +     fn parrot() -> Box {
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:93:12
@@ -346,8 +355,9 @@ LL | fn foo(_: &Trait) {}
    |
 help: use a new generic type parameter, constrained by `Trait`
    |
-LL | fn foo(_: &T) {}
-   |       ++++++++++     ~
+LL - fn foo(_: &Trait) {}
+LL + fn foo(_: &T) {}
+   |
 help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
    |
 LL | fn foo(_: &impl Trait) {}
@@ -365,8 +375,9 @@ LL | fn bar(_: &'a Trait) {}
    |
 help: use a new generic type parameter, constrained by `Trait`
    |
-LL | fn bar(_: &'a T) {}
-   |       ++++++++++        ~
+LL - fn bar(_: &'a Trait) {}
+LL + fn bar(_: &'a T) {}
+   |
 help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
    |
 LL | fn bar(_: &'a impl Trait) {}
@@ -384,8 +395,9 @@ LL | fn alice<'a>(_: &Trait) {}
    |
 help: use a new generic type parameter, constrained by `Trait`
    |
-LL | fn alice<'a, T: Trait>(_: &T) {}
-   |            ++++++++++      ~
+LL - fn alice<'a>(_: &Trait) {}
+LL + fn alice<'a, T: Trait>(_: &T) {}
+   |
 help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
    |
 LL | fn alice<'a>(_: &impl Trait) {}
@@ -403,8 +415,9 @@ LL | fn bob<'a>(_: &'a Trait) {}
    |
 help: use a new generic type parameter, constrained by `Trait`
    |
-LL | fn bob<'a, T: Trait>(_: &'a T) {}
-   |          ++++++++++         ~
+LL - fn bob<'a>(_: &'a Trait) {}
+LL + fn bob<'a, T: Trait>(_: &'a T) {}
+   |
 help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
    |
 LL | fn bob<'a>(_: &'a impl Trait) {}
@@ -426,8 +439,9 @@ LL | fn cat() -> &impl Trait {
    |              ++++
 help: alternatively, you can return an owned trait object
    |
-LL | fn cat() -> Box {
-   |             ~~~~~~~~~~~~~~
+LL - fn cat() -> &Trait {
+LL + fn cat() -> Box {
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:116:18
@@ -441,8 +455,9 @@ LL | fn dog<'a>() -> &impl Trait {
    |                  ++++
 help: alternatively, you can return an owned trait object
    |
-LL | fn dog<'a>() -> Box {
-   |                 ~~~~~~~~~~~~~~
+LL - fn dog<'a>() -> &Trait {
+LL + fn dog<'a>() -> Box {
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:122:20
@@ -456,8 +471,9 @@ LL | fn kitten() -> &'a impl Trait {
    |                    ++++
 help: alternatively, you can return an owned trait object
    |
-LL | fn kitten() -> Box {
-   |                ~~~~~~~~~~~~~~
+LL - fn kitten() -> &'a Trait {
+LL + fn kitten() -> Box {
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:128:23
@@ -471,8 +487,9 @@ LL | fn puppy<'a>() -> &'a impl Trait {
    |                       ++++
 help: alternatively, you can return an owned trait object
    |
-LL | fn puppy<'a>() -> Box {
-   |                   ~~~~~~~~~~~~~~
+LL - fn puppy<'a>() -> &'a Trait {
+LL + fn puppy<'a>() -> Box {
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:133:21
@@ -486,8 +503,9 @@ LL | fn parrot() -> &mut impl Trait {
    |                     ++++
 help: alternatively, you can return an owned trait object
    |
-LL | fn parrot() -> Box {
-   |                ~~~~~~~~~~~~~~
+LL - fn parrot() -> &mut Trait {
+LL + fn parrot() -> Box {
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:8:16
@@ -497,8 +515,9 @@ LL |     fn foo(_: &Trait) {}
    |
 help: use a new generic type parameter, constrained by `Trait`
    |
-LL |     fn foo(_: &T) {}
-   |           ++++++++++     ~
+LL -     fn foo(_: &Trait) {}
+LL +     fn foo(_: &T) {}
+   |
 help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
    |
 LL |     fn foo(_: &impl Trait) {}
@@ -516,8 +535,9 @@ LL |     fn bar(self, _: &'a Trait) {}
    |
 help: use a new generic type parameter, constrained by `Trait`
    |
-LL |     fn bar(self, _: &'a T) {}
-   |           ++++++++++              ~
+LL -     fn bar(self, _: &'a Trait) {}
+LL +     fn bar(self, _: &'a T) {}
+   |
 help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
    |
 LL |     fn bar(self, _: &'a impl Trait) {}
@@ -535,8 +555,9 @@ LL |     fn alice<'a>(&self, _: &Trait) {}
    |
 help: use a new generic type parameter, constrained by `Trait`
    |
-LL |     fn alice<'a, T: Trait>(&self, _: &T) {}
-   |                ++++++++++             ~
+LL -     fn alice<'a>(&self, _: &Trait) {}
+LL +     fn alice<'a, T: Trait>(&self, _: &T) {}
+   |
 help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
    |
 LL |     fn alice<'a>(&self, _: &impl Trait) {}
@@ -554,8 +575,9 @@ LL |     fn bob<'a>(_: &'a Trait) {}
    |
 help: use a new generic type parameter, constrained by `Trait`
    |
-LL |     fn bob<'a, T: Trait>(_: &'a T) {}
-   |              ++++++++++         ~
+LL -     fn bob<'a>(_: &'a Trait) {}
+LL +     fn bob<'a, T: Trait>(_: &'a T) {}
+   |
 help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
    |
 LL |     fn bob<'a>(_: &'a impl Trait) {}
@@ -577,8 +599,9 @@ LL |     fn cat() -> &impl Trait {
    |                  ++++
 help: alternatively, you can return an owned trait object
    |
-LL |     fn cat() -> Box {
-   |                 ~~~~~~~~~~~~~~
+LL -     fn cat() -> &Trait {
+LL +     fn cat() -> Box {
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:27:22
@@ -592,8 +615,9 @@ LL |     fn dog<'a>() -> &impl Trait {
    |                      ++++
 help: alternatively, you can return an owned trait object
    |
-LL |     fn dog<'a>() -> Box {
-   |                     ~~~~~~~~~~~~~~
+LL -     fn dog<'a>() -> &Trait {
+LL +     fn dog<'a>() -> Box {
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:33:24
@@ -607,8 +631,9 @@ LL |     fn kitten() -> &'a impl Trait {
    |                        ++++
 help: alternatively, you can return an owned trait object
    |
-LL |     fn kitten() -> Box {
-   |                    ~~~~~~~~~~~~~~
+LL -     fn kitten() -> &'a Trait {
+LL +     fn kitten() -> Box {
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:39:27
@@ -622,8 +647,9 @@ LL |     fn puppy<'a>() -> &'a impl Trait {
    |                           ++++
 help: alternatively, you can return an owned trait object
    |
-LL |     fn puppy<'a>() -> Box {
-   |                       ~~~~~~~~~~~~~~
+LL -     fn puppy<'a>() -> &'a Trait {
+LL +     fn puppy<'a>() -> Box {
+   |
 
 error[E0782]: expected a type, found a trait
   --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:44:25
@@ -637,8 +663,9 @@ LL |     fn parrot() -> &mut impl Trait {
    |                         ++++
 help: alternatively, you can return an owned trait object
    |
-LL |     fn parrot() -> Box {
-   |                    ~~~~~~~~~~~~~~
+LL -     fn parrot() -> &mut Trait {
+LL +     fn parrot() -> Box {
+   |
 
 error: aborting due to 42 previous errors
 
diff --git a/tests/ui/dyn-compatibility/supertrait-mentions-GAT.stderr b/tests/ui/dyn-compatibility/supertrait-mentions-GAT.stderr
index 8e139ee6b48b..582cf1af0546 100644
--- a/tests/ui/dyn-compatibility/supertrait-mentions-GAT.stderr
+++ b/tests/ui/dyn-compatibility/supertrait-mentions-GAT.stderr
@@ -17,8 +17,9 @@ LL |     fn c(&self) -> dyn SuperTrait;
    |
 help: you might have meant to use `Self` to refer to the implementing type
    |
-LL |     fn c(&self) -> Self;
-   |                    ~~~~
+LL -     fn c(&self) -> dyn SuperTrait;
+LL +     fn c(&self) -> Self;
+   |
 
 error[E0038]: the trait `SuperTrait` is not dyn compatible
   --> $DIR/supertrait-mentions-GAT.rs:10:20
diff --git a/tests/ui/dyn-compatibility/supertrait-mentions-Self.stderr b/tests/ui/dyn-compatibility/supertrait-mentions-Self.stderr
index a763649e9c64..2ba8e4611cbb 100644
--- a/tests/ui/dyn-compatibility/supertrait-mentions-Self.stderr
+++ b/tests/ui/dyn-compatibility/supertrait-mentions-Self.stderr
@@ -34,8 +34,9 @@ LL | trait Baz : Bar {
    |       this trait is not dyn compatible...
 help: consider using an opaque type instead
    |
-LL | fn make_baz(t: &T) -> &impl Baz {
-   |                               ~~~~
+LL - fn make_baz(t: &T) -> &dyn Baz {
+LL + fn make_baz(t: &T) -> &impl Baz {
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/dyn-keyword/dyn-2021-edition-error.stderr b/tests/ui/dyn-keyword/dyn-2021-edition-error.stderr
index 6d1a1618ac03..8c4b809e76b0 100644
--- a/tests/ui/dyn-keyword/dyn-2021-edition-error.stderr
+++ b/tests/ui/dyn-keyword/dyn-2021-edition-error.stderr
@@ -6,8 +6,9 @@ LL | fn function(x: &SomeTrait, y: Box) {
    |
 help: use a new generic type parameter, constrained by `SomeTrait`
    |
-LL | fn function(x: &T, y: Box) {
-   |            ++++++++++++++     ~
+LL - fn function(x: &SomeTrait, y: Box) {
+LL + fn function(x: &T, y: Box) {
+   |
 help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference
    |
 LL | fn function(x: &impl SomeTrait, y: Box) {
diff --git a/tests/ui/dyn-keyword/misspelled-associated-item.stderr b/tests/ui/dyn-keyword/misspelled-associated-item.stderr
index 4211889e524c..0880100dc04f 100644
--- a/tests/ui/dyn-keyword/misspelled-associated-item.stderr
+++ b/tests/ui/dyn-keyword/misspelled-associated-item.stderr
@@ -10,8 +10,9 @@ LL |     let () = ::typoe();
    |              ++++      +
 help: you may have misspelled this associated item, causing `Trait` to be interpreted as a type rather than a trait
    |
-LL |     let () = Trait::typo();
-   |                     ~~~~
+LL -     let () = Trait::typoe();
+LL +     let () = Trait::typo();
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/empty/empty-struct-braces-expr.stderr b/tests/ui/empty/empty-struct-braces-expr.stderr
index 28c701443de4..3411702a12df 100644
--- a/tests/ui/empty/empty-struct-braces-expr.stderr
+++ b/tests/ui/empty/empty-struct-braces-expr.stderr
@@ -14,12 +14,14 @@ LL | pub struct XEmpty2;
    |
 help: use struct literal syntax instead
    |
-LL |     let e1 = Empty1 {};
-   |              ~~~~~~~~~
+LL -     let e1 = Empty1;
+LL +     let e1 = Empty1 {};
+   |
 help: a unit struct with a similar name exists
    |
-LL |     let e1 = XEmpty2;
-   |              ~~~~~~~
+LL -     let e1 = Empty1;
+LL +     let e1 = XEmpty2;
+   |
 
 error[E0423]: expected value, found struct `XEmpty1`
   --> $DIR/empty-struct-braces-expr.rs:22:15
@@ -36,12 +38,14 @@ LL | pub struct XEmpty2;
    |
 help: use struct literal syntax instead
    |
-LL |     let xe1 = XEmpty1 {};
-   |               ~~~~~~~~~~
+LL -     let xe1 = XEmpty1;
+LL +     let xe1 = XEmpty1 {};
+   |
 help: a unit struct with a similar name exists
    |
-LL |     let xe1 = XEmpty2;
-   |               ~~~~~~~
+LL -     let xe1 = XEmpty1;
+LL +     let xe1 = XEmpty2;
+   |
 
 error[E0423]: expected function, tuple struct or tuple variant, found struct `Empty1`
   --> $DIR/empty-struct-braces-expr.rs:16:14
@@ -59,12 +63,14 @@ LL | pub struct XEmpty2;
    |
 help: use struct literal syntax instead
    |
-LL |     let e1 = Empty1 {};
-   |              ~~~~~~~~~
+LL -     let e1 = Empty1();
+LL +     let e1 = Empty1 {};
+   |
 help: a unit struct with a similar name exists
    |
-LL |     let e1 = XEmpty2();
-   |              ~~~~~~~
+LL -     let e1 = Empty1();
+LL +     let e1 = XEmpty2();
+   |
 
 error[E0533]: expected value, found struct variant `E::Empty3`
   --> $DIR/empty-struct-braces-expr.rs:18:14
@@ -85,8 +91,9 @@ LL |     let e3 = E::Empty3();
    |
 help: you might have meant to create a new value of the struct
    |
-LL |     let e3 = E::Empty3 {};
-   |                        ~~
+LL -     let e3 = E::Empty3();
+LL +     let e3 = E::Empty3 {};
+   |
 
 error[E0423]: expected function, tuple struct or tuple variant, found struct `XEmpty1`
   --> $DIR/empty-struct-braces-expr.rs:23:15
@@ -103,12 +110,14 @@ LL | pub struct XEmpty2;
    |
 help: use struct literal syntax instead
    |
-LL |     let xe1 = XEmpty1 {};
-   |               ~~~~~~~~~~
+LL -     let xe1 = XEmpty1();
+LL +     let xe1 = XEmpty1 {};
+   |
 help: a unit struct with a similar name exists
    |
-LL |     let xe1 = XEmpty2();
-   |               ~~~~~~~
+LL -     let xe1 = XEmpty1();
+LL +     let xe1 = XEmpty2();
+   |
 
 error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope
   --> $DIR/empty-struct-braces-expr.rs:25:19
@@ -118,8 +127,9 @@ LL |     let xe3 = XE::Empty3;
    |
 help: there is a variant with a similar name
    |
-LL |     let xe3 = XE::XEmpty3;
-   |                   ~~~~~~~
+LL -     let xe3 = XE::Empty3;
+LL +     let xe3 = XE::XEmpty3;
+   |
 
 error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope
   --> $DIR/empty-struct-braces-expr.rs:26:19
@@ -129,8 +139,9 @@ LL |     let xe3 = XE::Empty3();
    |
 help: there is a variant with a similar name
    |
-LL |     let xe3 = XE::XEmpty3 {};
-   |                   ~~~~~~~~~~
+LL -     let xe3 = XE::Empty3();
+LL +     let xe3 = XE::XEmpty3 {};
+   |
 
 error[E0599]: no variant named `Empty1` found for enum `empty_struct::XE`
   --> $DIR/empty-struct-braces-expr.rs:28:9
@@ -140,8 +151,9 @@ LL |     XE::Empty1 {};
    |
 help: there is a variant with a similar name
    |
-LL |     XE::XEmpty3 {};
-   |         ~~~~~~~~~~
+LL -     XE::Empty1 {};
+LL +     XE::XEmpty3 {};
+   |
 
 error: aborting due to 9 previous errors
 
diff --git a/tests/ui/empty/empty-struct-braces-pat-2.stderr b/tests/ui/empty/empty-struct-braces-pat-2.stderr
index 7fb5cb2034a8..497dc9601a71 100644
--- a/tests/ui/empty/empty-struct-braces-pat-2.stderr
+++ b/tests/ui/empty/empty-struct-braces-pat-2.stderr
@@ -14,12 +14,14 @@ LL | pub struct XEmpty6();
    |
 help: use struct pattern syntax instead
    |
-LL |         Empty1 {} => ()
-   |         ~~~~~~~~~
+LL -         Empty1() => ()
+LL +         Empty1 {} => ()
+   |
 help: a tuple struct with a similar name exists
    |
-LL |         XEmpty6() => ()
-   |         ~~~~~~~
+LL -         Empty1() => ()
+LL +         XEmpty6() => ()
+   |
 
 error[E0532]: expected tuple struct or tuple variant, found struct `XEmpty1`
   --> $DIR/empty-struct-braces-pat-2.rs:18:9
@@ -37,12 +39,14 @@ LL | pub struct XEmpty6();
    |
 help: use struct pattern syntax instead
    |
-LL |         XEmpty1 {} => ()
-   |         ~~~~~~~~~~
+LL -         XEmpty1() => ()
+LL +         XEmpty1 {} => ()
+   |
 help: a tuple struct with a similar name exists
    |
-LL |         XEmpty6() => ()
-   |         ~~~~~~~
+LL -         XEmpty1() => ()
+LL +         XEmpty6() => ()
+   |
 
 error[E0532]: expected tuple struct or tuple variant, found struct `Empty1`
   --> $DIR/empty-struct-braces-pat-2.rs:21:9
@@ -60,12 +64,14 @@ LL | pub struct XEmpty6();
    |
 help: use struct pattern syntax instead
    |
-LL |         Empty1 {} => ()
-   |         ~~~~~~~~~
+LL -         Empty1(..) => ()
+LL +         Empty1 {} => ()
+   |
 help: a tuple struct with a similar name exists
    |
-LL |         XEmpty6(..) => ()
-   |         ~~~~~~~
+LL -         Empty1(..) => ()
+LL +         XEmpty6(..) => ()
+   |
 
 error[E0532]: expected tuple struct or tuple variant, found struct `XEmpty1`
   --> $DIR/empty-struct-braces-pat-2.rs:24:9
@@ -83,12 +89,14 @@ LL | pub struct XEmpty6();
    |
 help: use struct pattern syntax instead
    |
-LL |         XEmpty1 {} => ()
-   |         ~~~~~~~~~~
+LL -         XEmpty1(..) => ()
+LL +         XEmpty1 {} => ()
+   |
 help: a tuple struct with a similar name exists
    |
-LL |         XEmpty6(..) => ()
-   |         ~~~~~~~
+LL -         XEmpty1(..) => ()
+LL +         XEmpty6(..) => ()
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/empty/empty-struct-braces-pat-3.stderr b/tests/ui/empty/empty-struct-braces-pat-3.stderr
index b2ab7113347f..6e9618da99d5 100644
--- a/tests/ui/empty/empty-struct-braces-pat-3.stderr
+++ b/tests/ui/empty/empty-struct-braces-pat-3.stderr
@@ -6,8 +6,9 @@ LL |         E::Empty3() => ()
    |
 help: use the struct variant pattern syntax
    |
-LL |         E::Empty3 {} => ()
-   |                   ~~
+LL -         E::Empty3() => ()
+LL +         E::Empty3 {} => ()
+   |
 
 error[E0164]: expected tuple struct or tuple variant, found struct variant `XE::XEmpty3`
   --> $DIR/empty-struct-braces-pat-3.rs:21:9
@@ -17,8 +18,9 @@ LL |         XE::XEmpty3() => ()
    |
 help: use the struct variant pattern syntax
    |
-LL |         XE::XEmpty3 {} => ()
-   |                     ~~
+LL -         XE::XEmpty3() => ()
+LL +         XE::XEmpty3 {} => ()
+   |
 
 error[E0164]: expected tuple struct or tuple variant, found struct variant `E::Empty3`
   --> $DIR/empty-struct-braces-pat-3.rs:25:9
@@ -28,8 +30,9 @@ LL |         E::Empty3(..) => ()
    |
 help: use the struct variant pattern syntax
    |
-LL |         E::Empty3 {} => ()
-   |                   ~~
+LL -         E::Empty3(..) => ()
+LL +         E::Empty3 {} => ()
+   |
 
 error[E0164]: expected tuple struct or tuple variant, found struct variant `XE::XEmpty3`
   --> $DIR/empty-struct-braces-pat-3.rs:29:9
@@ -39,8 +42,9 @@ LL |         XE::XEmpty3(..) => ()
    |
 help: use the struct variant pattern syntax
    |
-LL |         XE::XEmpty3 {} => ()
-   |                     ~~
+LL -         XE::XEmpty3(..) => ()
+LL +         XE::XEmpty3 {} => ()
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/empty/empty-struct-tuple-pat.stderr b/tests/ui/empty/empty-struct-tuple-pat.stderr
index 45001c797532..3906a0e20608 100644
--- a/tests/ui/empty/empty-struct-tuple-pat.stderr
+++ b/tests/ui/empty/empty-struct-tuple-pat.stderr
@@ -46,12 +46,14 @@ LL |     XEmpty5(),
    |
 help: use the tuple variant pattern syntax instead
    |
-LL |         XE::XEmpty5() => (),
-   |         ~~~~~~~~~~~~~
+LL -         XE::XEmpty5 => (),
+LL +         XE::XEmpty5() => (),
+   |
 help: a unit variant with a similar name exists
    |
-LL |         XE::XEmpty4 => (),
-   |             ~~~~~~~
+LL -         XE::XEmpty5 => (),
+LL +         XE::XEmpty4 => (),
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/empty/empty-struct-unit-pat.stderr b/tests/ui/empty/empty-struct-unit-pat.stderr
index 5c0b4cffa946..09a476423c8d 100644
--- a/tests/ui/empty/empty-struct-unit-pat.stderr
+++ b/tests/ui/empty/empty-struct-unit-pat.stderr
@@ -14,12 +14,14 @@ LL | pub struct XEmpty6();
    |
 help: use this syntax instead
    |
-LL |         Empty2 => ()
-   |         ~~~~~~
+LL -         Empty2() => ()
+LL +         Empty2 => ()
+   |
 help: a tuple struct with a similar name exists
    |
-LL |         XEmpty6() => ()
-   |         ~~~~~~~
+LL -         Empty2() => ()
+LL +         XEmpty6() => ()
+   |
 
 error[E0532]: expected tuple struct or tuple variant, found unit struct `XEmpty2`
   --> $DIR/empty-struct-unit-pat.rs:24:9
@@ -36,12 +38,14 @@ LL | pub struct XEmpty6();
    |
 help: use this syntax instead
    |
-LL |         XEmpty2 => ()
-   |         ~~~~~~~
+LL -         XEmpty2() => ()
+LL +         XEmpty2 => ()
+   |
 help: a tuple struct with a similar name exists
    |
-LL |         XEmpty6() => ()
-   |         ~~~~~~~
+LL -         XEmpty2() => ()
+LL +         XEmpty6() => ()
+   |
 
 error[E0532]: expected tuple struct or tuple variant, found unit struct `Empty2`
   --> $DIR/empty-struct-unit-pat.rs:28:9
@@ -59,12 +63,14 @@ LL | pub struct XEmpty6();
    |
 help: use this syntax instead
    |
-LL |         Empty2 => ()
-   |         ~~~~~~
+LL -         Empty2(..) => ()
+LL +         Empty2 => ()
+   |
 help: a tuple struct with a similar name exists
    |
-LL |         XEmpty6(..) => ()
-   |         ~~~~~~~
+LL -         Empty2(..) => ()
+LL +         XEmpty6(..) => ()
+   |
 
 error[E0532]: expected tuple struct or tuple variant, found unit struct `XEmpty2`
   --> $DIR/empty-struct-unit-pat.rs:32:9
@@ -81,12 +87,14 @@ LL | pub struct XEmpty6();
    |
 help: use this syntax instead
    |
-LL |         XEmpty2 => ()
-   |         ~~~~~~~
+LL -         XEmpty2(..) => ()
+LL +         XEmpty2 => ()
+   |
 help: a tuple struct with a similar name exists
    |
-LL |         XEmpty6(..) => ()
-   |         ~~~~~~~
+LL -         XEmpty2(..) => ()
+LL +         XEmpty6(..) => ()
+   |
 
 error[E0532]: expected tuple struct or tuple variant, found unit variant `E::Empty4`
   --> $DIR/empty-struct-unit-pat.rs:37:9
@@ -112,12 +120,14 @@ LL |     XEmpty5(),
    |
 help: use this syntax instead
    |
-LL |         XE::XEmpty4 => (),
-   |         ~~~~~~~~~~~
+LL -         XE::XEmpty4() => (),
+LL +         XE::XEmpty4 => (),
+   |
 help: a tuple variant with a similar name exists
    |
-LL |         XE::XEmpty5() => (),
-   |             ~~~~~~~
+LL -         XE::XEmpty4() => (),
+LL +         XE::XEmpty5() => (),
+   |
 
 error[E0532]: expected tuple struct or tuple variant, found unit variant `E::Empty4`
   --> $DIR/empty-struct-unit-pat.rs:46:9
@@ -143,12 +153,14 @@ LL |     XEmpty5(),
    |
 help: use this syntax instead
    |
-LL |         XE::XEmpty4 => (),
-   |         ~~~~~~~~~~~
+LL -         XE::XEmpty4(..) => (),
+LL +         XE::XEmpty4 => (),
+   |
 help: a tuple variant with a similar name exists
    |
-LL |         XE::XEmpty5(..) => (),
-   |             ~~~~~~~
+LL -         XE::XEmpty4(..) => (),
+LL +         XE::XEmpty5(..) => (),
+   |
 
 error: aborting due to 8 previous errors
 
diff --git a/tests/ui/enum-discriminant/discriminant-ill-typed.stderr b/tests/ui/enum-discriminant/discriminant-ill-typed.stderr
index 2757145285c7..e9508b7fe962 100644
--- a/tests/ui/enum-discriminant/discriminant-ill-typed.stderr
+++ b/tests/ui/enum-discriminant/discriminant-ill-typed.stderr
@@ -6,8 +6,9 @@ LL |         OhNo = 0_u8,
    |
 help: change the type of the numeric literal from `u8` to `i8`
    |
-LL |         OhNo = 0_i8,
-   |                  ~~
+LL -         OhNo = 0_u8,
+LL +         OhNo = 0_i8,
+   |
 
 error[E0308]: mismatched types
   --> $DIR/discriminant-ill-typed.rs:28:16
@@ -17,8 +18,9 @@ LL |         OhNo = 0_i8,
    |
 help: change the type of the numeric literal from `i8` to `u8`
    |
-LL |         OhNo = 0_u8,
-   |                  ~~
+LL -         OhNo = 0_i8,
+LL +         OhNo = 0_u8,
+   |
 
 error[E0308]: mismatched types
   --> $DIR/discriminant-ill-typed.rs:41:16
@@ -28,8 +30,9 @@ LL |         OhNo = 0_u16,
    |
 help: change the type of the numeric literal from `u16` to `i16`
    |
-LL |         OhNo = 0_i16,
-   |                  ~~~
+LL -         OhNo = 0_u16,
+LL +         OhNo = 0_i16,
+   |
 
 error[E0308]: mismatched types
   --> $DIR/discriminant-ill-typed.rs:54:16
@@ -39,8 +42,9 @@ LL |         OhNo = 0_i16,
    |
 help: change the type of the numeric literal from `i16` to `u16`
    |
-LL |         OhNo = 0_u16,
-   |                  ~~~
+LL -         OhNo = 0_i16,
+LL +         OhNo = 0_u16,
+   |
 
 error[E0308]: mismatched types
   --> $DIR/discriminant-ill-typed.rs:67:16
@@ -50,8 +54,9 @@ LL |         OhNo = 0_u32,
    |
 help: change the type of the numeric literal from `u32` to `i32`
    |
-LL |         OhNo = 0_i32,
-   |                  ~~~
+LL -         OhNo = 0_u32,
+LL +         OhNo = 0_i32,
+   |
 
 error[E0308]: mismatched types
   --> $DIR/discriminant-ill-typed.rs:80:16
@@ -61,8 +66,9 @@ LL |         OhNo = 0_i32,
    |
 help: change the type of the numeric literal from `i32` to `u32`
    |
-LL |         OhNo = 0_u32,
-   |                  ~~~
+LL -         OhNo = 0_i32,
+LL +         OhNo = 0_u32,
+   |
 
 error[E0308]: mismatched types
   --> $DIR/discriminant-ill-typed.rs:93:16
@@ -72,8 +78,9 @@ LL |         OhNo = 0_u64,
    |
 help: change the type of the numeric literal from `u64` to `i64`
    |
-LL |         OhNo = 0_i64,
-   |                  ~~~
+LL -         OhNo = 0_u64,
+LL +         OhNo = 0_i64,
+   |
 
 error[E0308]: mismatched types
   --> $DIR/discriminant-ill-typed.rs:106:16
@@ -83,8 +90,9 @@ LL |         OhNo = 0_i64,
    |
 help: change the type of the numeric literal from `i64` to `u64`
    |
-LL |         OhNo = 0_u64,
-   |                  ~~~
+LL -         OhNo = 0_i64,
+LL +         OhNo = 0_u64,
+   |
 
 error: aborting due to 8 previous errors
 
diff --git a/tests/ui/enum/assoc-fn-call-on-variant.stderr b/tests/ui/enum/assoc-fn-call-on-variant.stderr
index 47fc630c9239..5318025f5545 100644
--- a/tests/ui/enum/assoc-fn-call-on-variant.stderr
+++ b/tests/ui/enum/assoc-fn-call-on-variant.stderr
@@ -6,8 +6,9 @@ LL |     E::A::f();
    |
 help: there is an enum variant `E::A`; try using the variant's enum
    |
-LL |     E::f();
-   |     ~
+LL -     E::A::f();
+LL +     E::f();
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/env-macro/error-recovery-issue-55897.stderr b/tests/ui/env-macro/error-recovery-issue-55897.stderr
index 5a20bf8b1686..cda9aa330d22 100644
--- a/tests/ui/env-macro/error-recovery-issue-55897.stderr
+++ b/tests/ui/env-macro/error-recovery-issue-55897.stderr
@@ -30,8 +30,9 @@ LL |     use env;
    |
 help: consider importing this module instead
    |
-LL |     use std::env;
-   |         ~~~~~~~~
+LL -     use env;
+LL +     use std::env;
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/error-codes/E0027.stderr b/tests/ui/error-codes/E0027.stderr
index 7bbafcf0a27a..701e636dc581 100644
--- a/tests/ui/error-codes/E0027.stderr
+++ b/tests/ui/error-codes/E0027.stderr
@@ -6,16 +6,19 @@ LL |         Dog { age: x } => {}
    |
 help: include the missing field in the pattern
    |
-LL |         Dog { age: x, name } => {}
-   |                     ~~~~~~~~
+LL -         Dog { age: x } => {}
+LL +         Dog { age: x, name } => {}
+   |
 help: if you don't care about this missing field, you can explicitly ignore it
    |
-LL |         Dog { age: x, name: _ } => {}
-   |                     ~~~~~~~~~~~
+LL -         Dog { age: x } => {}
+LL +         Dog { age: x, name: _ } => {}
+   |
 help: or always ignore missing fields here
    |
-LL |         Dog { age: x, .. } => {}
-   |                     ~~~~~~
+LL -         Dog { age: x } => {}
+LL +         Dog { age: x, .. } => {}
+   |
 
 error[E0027]: pattern does not mention field `age`
   --> $DIR/E0027.rs:15:9
@@ -25,16 +28,19 @@ LL |         Dog { name: x, } => {}
    |
 help: include the missing field in the pattern
    |
-LL |         Dog { name: x, age } => {}
-   |                      ~~~~~~~
+LL -         Dog { name: x, } => {}
+LL +         Dog { name: x, age } => {}
+   |
 help: if you don't care about this missing field, you can explicitly ignore it
    |
-LL |         Dog { name: x, age: _ } => {}
-   |                      ~~~~~~~~~~
+LL -         Dog { name: x, } => {}
+LL +         Dog { name: x, age: _ } => {}
+   |
 help: or always ignore missing fields here
    |
-LL |         Dog { name: x, .. } => {}
-   |                      ~~~~~~
+LL -         Dog { name: x, } => {}
+LL +         Dog { name: x, .. } => {}
+   |
 
 error[E0027]: pattern does not mention field `age`
   --> $DIR/E0027.rs:19:9
@@ -44,16 +50,19 @@ LL |         Dog { name: x  , } => {}
    |
 help: include the missing field in the pattern
    |
-LL |         Dog { name: x, age } => {}
-   |                      ~~~~~~~
+LL -         Dog { name: x  , } => {}
+LL +         Dog { name: x, age } => {}
+   |
 help: if you don't care about this missing field, you can explicitly ignore it
    |
-LL |         Dog { name: x, age: _ } => {}
-   |                      ~~~~~~~~~~
+LL -         Dog { name: x  , } => {}
+LL +         Dog { name: x, age: _ } => {}
+   |
 help: or always ignore missing fields here
    |
-LL |         Dog { name: x, .. } => {}
-   |                      ~~~~~~
+LL -         Dog { name: x  , } => {}
+LL +         Dog { name: x, .. } => {}
+   |
 
 error[E0027]: pattern does not mention fields `name`, `age`
   --> $DIR/E0027.rs:22:9
@@ -63,16 +72,19 @@ LL |         Dog {} => {}
    |
 help: include the missing fields in the pattern
    |
-LL |         Dog { name, age } => {}
-   |             ~~~~~~~~~~~~~
+LL -         Dog {} => {}
+LL +         Dog { name, age } => {}
+   |
 help: if you don't care about these missing fields, you can explicitly ignore them
    |
-LL |         Dog { name: _, age: _ } => {}
-   |             ~~~~~~~~~~~~~~~~~~~
+LL -         Dog {} => {}
+LL +         Dog { name: _, age: _ } => {}
+   |
 help: or always ignore missing fields here
    |
-LL |         Dog { .. } => {}
-   |             ~~~~~~
+LL -         Dog {} => {}
+LL +         Dog { .. } => {}
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/error-codes/E0034.stderr b/tests/ui/error-codes/E0034.stderr
index 48b8efcf8a29..434518741fc4 100644
--- a/tests/ui/error-codes/E0034.stderr
+++ b/tests/ui/error-codes/E0034.stderr
@@ -16,10 +16,12 @@ LL |     fn foo() {}
    |     ^^^^^^^^
 help: use fully-qualified syntax to disambiguate
    |
-LL |     ::foo()
-   |     ~~~~~~~~~~~~~~~~~~
-LL |     ::foo()
-   |     ~~~~~~~~~~~~~~~~~~
+LL -     Test::foo()
+LL +     ::foo()
+   |
+LL -     Test::foo()
+LL +     ::foo()
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/error-codes/E0040.stderr b/tests/ui/error-codes/E0040.stderr
index 00cccb07c0f5..674c2b70b031 100644
--- a/tests/ui/error-codes/E0040.stderr
+++ b/tests/ui/error-codes/E0040.stderr
@@ -6,8 +6,9 @@ LL |     x.drop();
    |
 help: consider using `drop` function
    |
-LL |     drop(x);
-   |     +++++ ~
+LL -     x.drop();
+LL +     drop(x);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/error-codes/E0054.stderr b/tests/ui/error-codes/E0054.stderr
index be35242ad725..a2e618d9b06b 100644
--- a/tests/ui/error-codes/E0054.stderr
+++ b/tests/ui/error-codes/E0054.stderr
@@ -6,8 +6,9 @@ LL |     let x_is_nonzero = x as bool;
    |
 help: compare with zero instead
    |
-LL |     let x_is_nonzero = x != 0;
-   |                          ~~~~
+LL -     let x_is_nonzero = x as bool;
+LL +     let x_is_nonzero = x != 0;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/error-codes/E0057.stderr b/tests/ui/error-codes/E0057.stderr
index ef6e2908b939..35bd842b2cf4 100644
--- a/tests/ui/error-codes/E0057.stderr
+++ b/tests/ui/error-codes/E0057.stderr
@@ -11,8 +11,9 @@ LL |     let f = |x| x * 3;
    |             ^^^
 help: provide the argument
    |
-LL |     let a = f(/* x */);
-   |              ~~~~~~~~~
+LL -     let a = f();
+LL +     let a = f(/* x */);
+   |
 
 error[E0057]: this function takes 1 argument but 2 arguments were supplied
   --> $DIR/E0057.rs:5:13
diff --git a/tests/ui/error-codes/E0060.stderr b/tests/ui/error-codes/E0060.stderr
index aadf1ea93cb8..fc52c6fc5ea5 100644
--- a/tests/ui/error-codes/E0060.stderr
+++ b/tests/ui/error-codes/E0060.stderr
@@ -11,8 +11,9 @@ LL |     fn printf(_: *const u8, ...) -> u32;
    |        ^^^^^^ -
 help: provide the argument
    |
-LL |     unsafe { printf(/* *const u8 */); }
-   |                    ~~~~~~~~~~~~~~~~~
+LL -     unsafe { printf(); }
+LL +     unsafe { printf(/* *const u8 */); }
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/error-codes/E0061.stderr b/tests/ui/error-codes/E0061.stderr
index 4a420cd118aa..b70d607ebeb6 100644
--- a/tests/ui/error-codes/E0061.stderr
+++ b/tests/ui/error-codes/E0061.stderr
@@ -11,8 +11,9 @@ LL | fn f(a: u16, b: &str) {}
    |    ^         -------
 help: provide the argument
    |
-LL |     f(0, /* &str */);
-   |      ~~~~~~~~~~~~~~~
+LL -     f(0);
+LL +     f(0, /* &str */);
+   |
 
 error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> $DIR/E0061.rs:9:5
@@ -27,8 +28,9 @@ LL | fn f2(a: u16) {}
    |    ^^ ------
 help: provide the argument
    |
-LL |     f2(/* u16 */);
-   |       ~~~~~~~~~~~
+LL -     f2();
+LL +     f2(/* u16 */);
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/error-codes/E0121.stderr b/tests/ui/error-codes/E0121.stderr
index 5f5df0fd0ae0..b169373f6439 100644
--- a/tests/ui/error-codes/E0121.stderr
+++ b/tests/ui/error-codes/E0121.stderr
@@ -15,8 +15,9 @@ LL | static BAR: _ = "test";
    |
 help: replace this with a fully-specified type
    |
-LL | static BAR: &str = "test";
-   |             ~~~~
+LL - static BAR: _ = "test";
+LL + static BAR: &str = "test";
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/error-codes/E0214.stderr b/tests/ui/error-codes/E0214.stderr
index 76b11f30996e..71ae62d64e3b 100644
--- a/tests/ui/error-codes/E0214.stderr
+++ b/tests/ui/error-codes/E0214.stderr
@@ -6,8 +6,9 @@ LL |     let v: Vec(&str) = vec!["foo"];
    |
 help: use angle brackets instead
    |
-LL |     let v: Vec<&str> = vec!["foo"];
-   |               ~    ~
+LL -     let v: Vec(&str) = vec!["foo"];
+LL +     let v: Vec<&str> = vec!["foo"];
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/error-codes/E0221.stderr b/tests/ui/error-codes/E0221.stderr
index 07e7485b67e0..a18e91806d7d 100644
--- a/tests/ui/error-codes/E0221.stderr
+++ b/tests/ui/error-codes/E0221.stderr
@@ -12,12 +12,14 @@ LL |         let _: Self::A;
    |
 help: use fully-qualified syntax to disambiguate
    |
-LL |         let _: ::A;
-   |                ~~~~~~~~~~~~~~~
+LL -         let _: Self::A;
+LL +         let _: ::A;
+   |
 help: use fully-qualified syntax to disambiguate
    |
-LL |         let _: ::A;
-   |                ~~~~~~~~~~~~~~~
+LL -         let _: Self::A;
+LL +         let _: ::A;
+   |
 
 error[E0221]: ambiguous associated type `Err` in bounds of `Self`
   --> $DIR/E0221.rs:21:16
@@ -31,8 +33,9 @@ LL |         let _: Self::Err;
    = note: associated type `Err` could derive from `FromStr`
 help: use fully-qualified syntax to disambiguate
    |
-LL |         let _: ::Err;
-   |                ~~~~~~~~~~~~~~
+LL -         let _: Self::Err;
+LL +         let _: ::Err;
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/error-codes/E0259.stderr b/tests/ui/error-codes/E0259.stderr
index 975d1a161a01..08d3deb68d23 100644
--- a/tests/ui/error-codes/E0259.stderr
+++ b/tests/ui/error-codes/E0259.stderr
@@ -10,7 +10,8 @@ LL | extern crate test as alloc;
    = note: `alloc` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL | extern crate test as other_alloc;
+LL - extern crate test as alloc;
+LL + extern crate test as other_alloc;
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/error-codes/E0260.stderr b/tests/ui/error-codes/E0260.stderr
index 35698c653590..cb47b77904a3 100644
--- a/tests/ui/error-codes/E0260.stderr
+++ b/tests/ui/error-codes/E0260.stderr
@@ -10,7 +10,8 @@ LL | mod alloc {
    = note: `alloc` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL | extern crate alloc as other_alloc;
+LL - extern crate alloc;
+LL + extern crate alloc as other_alloc;
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/error-codes/E0283.stderr b/tests/ui/error-codes/E0283.stderr
index 381eca5f2a44..29baae5f133a 100644
--- a/tests/ui/error-codes/E0283.stderr
+++ b/tests/ui/error-codes/E0283.stderr
@@ -30,8 +30,9 @@ LL | impl Into for Impl {
              where U: From;
 help: try using a fully qualified path to specify the expected types
    |
-LL |     let bar = >::into(foo_impl) * 1u32;
-   |               ++++++++++++++++++++++++        ~
+LL -     let bar = foo_impl.into() * 1u32;
+LL +     let bar = >::into(foo_impl) * 1u32;
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/error-codes/E0423.stderr b/tests/ui/error-codes/E0423.stderr
index dd7a5b034c58..e50b8bd820cf 100644
--- a/tests/ui/error-codes/E0423.stderr
+++ b/tests/ui/error-codes/E0423.stderr
@@ -51,12 +51,14 @@ LL | fn foo() {
    |
 help: use struct literal syntax instead
    |
-LL |     let f = Foo { a: val };
-   |             ~~~~~~~~~~~~~~
+LL -     let f = Foo();
+LL +     let f = Foo { a: val };
+   |
 help: a function with a similar name exists (notice the capitalization difference)
    |
-LL |     let f = foo();
-   |             ~~~
+LL -     let f = Foo();
+LL +     let f = foo();
+   |
 
 error: aborting due to 5 previous errors
 
diff --git a/tests/ui/error-codes/E0435.stderr b/tests/ui/error-codes/E0435.stderr
index 1ebb99763944..13187472e60c 100644
--- a/tests/ui/error-codes/E0435.stderr
+++ b/tests/ui/error-codes/E0435.stderr
@@ -6,8 +6,9 @@ LL |     let _: [u8; foo];
    |
 help: consider using `const` instead of `let`
    |
-LL |     const foo: usize = 42;
-   |     ~~~~~
+LL -     let foo: usize = 42;
+LL +     const foo: usize = 42;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/error-codes/E0516.stderr b/tests/ui/error-codes/E0516.stderr
index 62e70a4668d1..f4127678d5b9 100644
--- a/tests/ui/error-codes/E0516.stderr
+++ b/tests/ui/error-codes/E0516.stderr
@@ -6,8 +6,9 @@ LL |     let x: typeof(92) = 92;
    |
 help: consider replacing `typeof(...)` with an actual type
    |
-LL |     let x: i32 = 92;
-   |            ~~~
+LL -     let x: typeof(92) = 92;
+LL +     let x: i32 = 92;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/error-codes/E0637.stderr b/tests/ui/error-codes/E0637.stderr
index d9db89ddb0c9..95a5a58ab856 100644
--- a/tests/ui/error-codes/E0637.stderr
+++ b/tests/ui/error-codes/E0637.stderr
@@ -13,8 +13,9 @@ LL | fn underscore_lifetime<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str {
    = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `str1` or `str2`
 help: consider introducing a named lifetime parameter
    |
-LL | fn underscore_lifetime<'a, '_>(str1: &'a str, str2: &'a str) -> &'a str {
-   |                        +++            ~~             ~~          ~~
+LL - fn underscore_lifetime<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str {
+LL + fn underscore_lifetime<'a, '_>(str1: &'a str, str2: &'a str) -> &'a str {
+   |
 
 error[E0637]: `&` without an explicit lifetime name cannot be used here
   --> $DIR/E0637.rs:13:13
diff --git a/tests/ui/error-codes/E0642.stderr b/tests/ui/error-codes/E0642.stderr
index dd9e28ad4927..97309e95b6b4 100644
--- a/tests/ui/error-codes/E0642.stderr
+++ b/tests/ui/error-codes/E0642.stderr
@@ -6,8 +6,9 @@ LL |     fn foo((x, y): (i32, i32));
    |
 help: give this argument a name or use an underscore to ignore it
    |
-LL |     fn foo(_: (i32, i32));
-   |            ~
+LL -     fn foo((x, y): (i32, i32));
+LL +     fn foo(_: (i32, i32));
+   |
 
 error[E0642]: patterns aren't allowed in methods without bodies
   --> $DIR/E0642.rs:11:12
@@ -17,8 +18,9 @@ LL |     fn bar((x, y): (i32, i32)) {}
    |
 help: give this argument a name or use an underscore to ignore it
    |
-LL |     fn bar(_: (i32, i32)) {}
-   |            ~
+LL -     fn bar((x, y): (i32, i32)) {}
+LL +     fn bar(_: (i32, i32)) {}
+   |
 
 error[E0642]: patterns aren't allowed in methods without bodies
   --> $DIR/E0642.rs:13:15
@@ -28,8 +30,9 @@ LL |     fn method(S { .. }: S) {}
    |
 help: give this argument a name or use an underscore to ignore it
    |
-LL |     fn method(_: S) {}
-   |               ~
+LL -     fn method(S { .. }: S) {}
+LL +     fn method(_: S) {}
+   |
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/error-codes/E0746.stderr b/tests/ui/error-codes/E0746.stderr
index ec785561415a..07d6b285f764 100644
--- a/tests/ui/error-codes/E0746.stderr
+++ b/tests/ui/error-codes/E0746.stderr
@@ -6,8 +6,9 @@ LL | fn foo() -> dyn Trait { Struct }
    |
 help: consider returning an `impl Trait` instead of a `dyn Trait`
    |
-LL | fn foo() -> impl Trait { Struct }
-   |             ~~~~
+LL - fn foo() -> dyn Trait { Struct }
+LL + fn foo() -> impl Trait { Struct }
+   |
 help: alternatively, box the return type, and wrap all of the returned values in `Box::new`
    |
 LL | fn foo() -> Box { Box::new(Struct) }
@@ -21,8 +22,9 @@ LL | fn bar() -> dyn Trait {
    |
 help: consider returning an `impl Trait` instead of a `dyn Trait`
    |
-LL | fn bar() -> impl Trait {
-   |             ~~~~
+LL - fn bar() -> dyn Trait {
+LL + fn bar() -> impl Trait {
+   |
 help: alternatively, box the return type, and wrap all of the returned values in `Box::new`
    |
 LL ~ fn bar() -> Box {
diff --git a/tests/ui/error-codes/ex-E0612.stderr b/tests/ui/error-codes/ex-E0612.stderr
index 23c1697b9b20..54451d3d4526 100644
--- a/tests/ui/error-codes/ex-E0612.stderr
+++ b/tests/ui/error-codes/ex-E0612.stderr
@@ -6,8 +6,9 @@ LL |    y.1;
    |
 help: a field with a similar name exists
    |
-LL |    y.0;
-   |      ~
+LL -    y.1;
+LL +    y.0;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/error-festival.stderr b/tests/ui/error-festival.stderr
index f71fa7e685cc..9db953637914 100644
--- a/tests/ui/error-festival.stderr
+++ b/tests/ui/error-festival.stderr
@@ -6,8 +6,9 @@ LL |     y = 2;
    |
 help: a local variable with a similar name exists
    |
-LL |     x = 2;
-   |     ~
+LL -     y = 2;
+LL +     x = 2;
+   |
 help: you might have meant to introduce a new binding
    |
 LL |     let y = 2;
@@ -76,8 +77,9 @@ LL |     let x_is_nonzero = x as bool;
    |
 help: compare with zero instead
    |
-LL |     let x_is_nonzero = x != 0;
-   |                          ~~~~
+LL -     let x_is_nonzero = x as bool;
+LL +     let x_is_nonzero = x != 0;
+   |
 
 error[E0606]: casting `&u8` as `u32` is invalid
   --> $DIR/error-festival.rs:37:18
diff --git a/tests/ui/explicit-tail-calls/become-operator.stderr b/tests/ui/explicit-tail-calls/become-operator.stderr
index 26e4343faaea..9741fbfca6d8 100644
--- a/tests/ui/explicit-tail-calls/become-operator.stderr
+++ b/tests/ui/explicit-tail-calls/become-operator.stderr
@@ -16,8 +16,9 @@ LL |     become a + b;
    |
 help: try using the method directly
    |
-LL |     become (a).add(b);
-   |            + ~~~~~~ +
+LL -     become a + b;
+LL +     become (a).add(b);
+   |
 
 error: `become` does not support operators
   --> $DIR/become-operator.rs:19:12
@@ -37,8 +38,9 @@ LL |     become !x;
    |
 help: try using the method directly
    |
-LL |     become (x).not();
-   |            ~ +++++++
+LL -     become !x;
+LL +     become (x).not();
+   |
 
 error: `become` does not support operators
   --> $DIR/become-operator.rs:27:12
@@ -68,8 +70,9 @@ LL |     become *b ^= 1;
    |
 help: try using the method directly
    |
-LL |     become (*b).bitxor_assign(1);
-   |            +  ~~~~~~~~~~~~~~~~ +
+LL -     become *b ^= 1;
+LL +     become (*b).bitxor_assign(1);
+   |
 
 error: aborting due to 7 previous errors
 
diff --git a/tests/ui/explicit/explicit-call-to-dtor.stderr b/tests/ui/explicit/explicit-call-to-dtor.stderr
index 6f40f3998a98..47d2823c82d3 100644
--- a/tests/ui/explicit/explicit-call-to-dtor.stderr
+++ b/tests/ui/explicit/explicit-call-to-dtor.stderr
@@ -6,8 +6,9 @@ LL |     x.drop();
    |
 help: consider using `drop` function
    |
-LL |     drop(x);
-   |     +++++ ~
+LL -     x.drop();
+LL +     drop(x);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr b/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr
index 13b6ee9987e8..9f98fb5f26c2 100644
--- a/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr
+++ b/tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr
@@ -6,8 +6,9 @@ LL |         self.drop();
    |
 help: consider using `drop` function
    |
-LL |         drop(self);
-   |         +++++    ~
+LL -         self.drop();
+LL +         drop(self);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/expr/if/if-branch-types.stderr b/tests/ui/expr/if/if-branch-types.stderr
index 0e86a24f31b7..587d2f10a8c0 100644
--- a/tests/ui/expr/if/if-branch-types.stderr
+++ b/tests/ui/expr/if/if-branch-types.stderr
@@ -8,8 +8,9 @@ LL |     let x = if true { 10i32 } else { 10u32 };
    |
 help: change the type of the numeric literal from `u32` to `i32`
    |
-LL |     let x = if true { 10i32 } else { 10i32 };
-   |                                        ~~~
+LL -     let x = if true { 10i32 } else { 10u32 };
+LL +     let x = if true { 10i32 } else { 10i32 };
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/expr/if/if-else-type-mismatch.stderr b/tests/ui/expr/if/if-else-type-mismatch.stderr
index f1fffdb1e7ef..1cf94c98800b 100644
--- a/tests/ui/expr/if/if-else-type-mismatch.stderr
+++ b/tests/ui/expr/if/if-else-type-mismatch.stderr
@@ -13,8 +13,9 @@ LL | |     };
    |
 help: change the type of the numeric literal from `u32` to `i32`
    |
-LL |         2i32
-   |          ~~~
+LL -         2u32
+LL +         2i32
+   |
 
 error[E0308]: `if` and `else` have incompatible types
   --> $DIR/if-else-type-mismatch.rs:8:38
@@ -26,8 +27,9 @@ LL |     let _ = if true { 42i32 } else { 42u32 };
    |
 help: change the type of the numeric literal from `u32` to `i32`
    |
-LL |     let _ = if true { 42i32 } else { 42i32 };
-   |                                        ~~~
+LL -     let _ = if true { 42i32 } else { 42u32 };
+LL +     let _ = if true { 42i32 } else { 42i32 };
+   |
 
 error[E0308]: `if` and `else` have incompatible types
   --> $DIR/if-else-type-mismatch.rs:13:9
diff --git a/tests/ui/expr/issue-22933-2.stderr b/tests/ui/expr/issue-22933-2.stderr
index dadc31213621..07f095f643ee 100644
--- a/tests/ui/expr/issue-22933-2.stderr
+++ b/tests/ui/expr/issue-22933-2.stderr
@@ -9,8 +9,9 @@ LL |     ApplePie = Delicious::Apple as isize | Delicious::PIE as isize,
    |
 help: there is a variant with a similar name
    |
-LL |     ApplePie = Delicious::Apple as isize | Delicious::Pie as isize,
-   |                                                       ~~~
+LL -     ApplePie = Delicious::Apple as isize | Delicious::PIE as isize,
+LL +     ApplePie = Delicious::Apple as isize | Delicious::Pie as isize,
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/extern/extern-const.stderr b/tests/ui/extern/extern-const.stderr
index 441495866cd9..c48eca8c36df 100644
--- a/tests/ui/extern/extern-const.stderr
+++ b/tests/ui/extern/extern-const.stderr
@@ -7,8 +7,9 @@ LL |     const rust_dbg_static_mut: c_int;
    = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
 help: try using a static value
    |
-LL |     static rust_dbg_static_mut: c_int;
-   |     ~~~~~~
+LL -     const rust_dbg_static_mut: c_int;
+LL +     static rust_dbg_static_mut: c_int;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/extern/extern-crate-rename.stderr b/tests/ui/extern/extern-crate-rename.stderr
index 43f6e56ab0e7..4d4a585de60c 100644
--- a/tests/ui/extern/extern-crate-rename.stderr
+++ b/tests/ui/extern/extern-crate-rename.stderr
@@ -9,8 +9,9 @@ LL | extern crate m2 as m1;
    = note: `m1` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL | extern crate m2 as other_m1;
-   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - extern crate m2 as m1;
+LL + extern crate m2 as other_m1;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/extern/extern-crate-visibility.stderr b/tests/ui/extern/extern-crate-visibility.stderr
index b239727092ae..c037da41b5ea 100644
--- a/tests/ui/extern/extern-crate-visibility.stderr
+++ b/tests/ui/extern/extern-crate-visibility.stderr
@@ -11,8 +11,9 @@ LL |     extern crate core;
    |     ^^^^^^^^^^^^^^^^^^
 help: consider importing this module instead
    |
-LL | use std::cell;
-   |     ~~~~~~~~~
+LL - use foo::core::cell;
+LL + use std::cell;
+   |
 
 error[E0603]: crate import `core` is private
   --> $DIR/extern-crate-visibility.rs:9:10
@@ -27,8 +28,9 @@ LL |     extern crate core;
    |     ^^^^^^^^^^^^^^^^^^
 help: consider importing this struct instead
    |
-LL |     std::cell::Cell::new(0);
-   |     ~~~~~~~~~~~~~~~
+LL -     foo::core::cell::Cell::new(0);
+LL +     std::cell::Cell::new(0);
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/extern/issue-18819.stderr b/tests/ui/extern/issue-18819.stderr
index 6de0ebfe9aee..566bf6a1f648 100644
--- a/tests/ui/extern/issue-18819.stderr
+++ b/tests/ui/extern/issue-18819.stderr
@@ -22,8 +22,9 @@ LL |     print_x(&X);
    |             +
 help: provide the argument
    |
-LL |     print_x(/* &dyn Foo */, /* &str */);
-   |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     print_x(X);
+LL +     print_x(/* &dyn Foo */, /* &str */);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/extern/not-in-block.stderr b/tests/ui/extern/not-in-block.stderr
index f86c279a2342..f35d98e99488 100644
--- a/tests/ui/extern/not-in-block.stderr
+++ b/tests/ui/extern/not-in-block.stderr
@@ -6,12 +6,14 @@ LL | extern fn none_fn(x: bool) -> i32;
    |
 help: provide a definition for the function
    |
-LL | extern fn none_fn(x: bool) -> i32 {  }
-   |                                   ~~~~~~~~~~
+LL - extern fn none_fn(x: bool) -> i32;
+LL + extern fn none_fn(x: bool) -> i32 {  }
+   |
 help: if you meant to declare an externally defined function, use an `extern` block
    |
-LL | extern { fn none_fn(x: bool) -> i32; }
-   | ~~~~~~~~                             +
+LL - extern fn none_fn(x: bool) -> i32;
+LL + extern { fn none_fn(x: bool) -> i32; }
+   |
 
 error: free function without a body
   --> $DIR/not-in-block.rs:6:1
@@ -21,12 +23,14 @@ LL | extern "C" fn c_fn(x: bool) -> i32;
    |
 help: provide a definition for the function
    |
-LL | extern "C" fn c_fn(x: bool) -> i32 {  }
-   |                                    ~~~~~~~~~~
+LL - extern "C" fn c_fn(x: bool) -> i32;
+LL + extern "C" fn c_fn(x: bool) -> i32 {  }
+   |
 help: if you meant to declare an externally defined function, use an `extern` block
    |
-LL | extern "C" { fn c_fn(x: bool) -> i32; }
-   | ~~~~~~~~~~~~                          +
+LL - extern "C" fn c_fn(x: bool) -> i32;
+LL + extern "C" { fn c_fn(x: bool) -> i32; }
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr
index 0234480ac5ac..2f5e3650734e 100644
--- a/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr
+++ b/tests/ui/feature-gates/feature-gate-extern_absolute_paths.stderr
@@ -15,8 +15,9 @@ LL |     let _: u8 = ::core::default::Default();
    |
 help: try using `std` instead of `core`
    |
-LL |     let _: u8 = ::std::default::Default();
-   |                   ~~~
+LL -     let _: u8 = ::core::default::Default();
+LL +     let _: u8 = ::std::default::Default();
+   |
 help: consider importing this module
    |
 LL + use std::default;
diff --git a/tests/ui/feature-gates/feature-gate-negate-unsigned.stderr b/tests/ui/feature-gates/feature-gate-negate-unsigned.stderr
index 696326157ce2..a6e0e668261c 100644
--- a/tests/ui/feature-gates/feature-gate-negate-unsigned.stderr
+++ b/tests/ui/feature-gates/feature-gate-negate-unsigned.stderr
@@ -7,8 +7,9 @@ LL |     let _max: usize = -1;
    = note: unsigned values cannot be negated
 help: you may have meant the maximum value of `usize`
    |
-LL |     let _max: usize = usize::MAX;
-   |                       ~~~~~~~~~~
+LL -     let _max: usize = -1;
+LL +     let _max: usize = usize::MAX;
+   |
 
 error[E0600]: cannot apply unary operator `-` to type `u8`
   --> $DIR/feature-gate-negate-unsigned.rs:14:14
diff --git a/tests/ui/feature-gates/feature-gate-never_patterns.stderr b/tests/ui/feature-gates/feature-gate-never_patterns.stderr
index 9f94e9620351..dcd5db56da88 100644
--- a/tests/ui/feature-gates/feature-gate-never_patterns.stderr
+++ b/tests/ui/feature-gates/feature-gate-never_patterns.stderr
@@ -10,7 +10,8 @@ LL |         (Some(_),)
    |         +        +
 help: ...or a vertical bar to match on multiple alternatives
    |
-LL |         Some(_) |
+LL -         Some(_),
+LL +         Some(_) |
    |
 
 error[E0658]: `!` patterns are experimental
diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr
index 584724dfe59c..e427665fbc35 100644
--- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr
+++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr
@@ -95,8 +95,9 @@ LL |     extern "rust-call" fn call(self, args: ()) -> () {}
               found signature `extern "rust-call" fn(Foo, ()) -> ()`
 help: change the self-receiver type to match the trait
    |
-LL |     extern "rust-call" fn call(&self, args: ()) -> () {}
-   |                                ~~~~~
+LL -     extern "rust-call" fn call(self, args: ()) -> () {}
+LL +     extern "rust-call" fn call(&self, args: ()) -> () {}
+   |
 
 error[E0183]: manual implementations of `FnOnce` are experimental
   --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6
@@ -165,8 +166,9 @@ LL |     extern "rust-call" fn call_mut(&self, args: ()) -> () {}
               found signature `extern "rust-call" fn(&Bar, ()) -> ()`
 help: change the self-receiver type to match the trait
    |
-LL |     extern "rust-call" fn call_mut(&mut self, args: ()) -> () {}
-   |                                    ~~~~~~~~~
+LL -     extern "rust-call" fn call_mut(&self, args: ()) -> () {}
+LL +     extern "rust-call" fn call_mut(&mut self, args: ()) -> () {}
+   |
 
 error[E0046]: not all trait items implemented, missing: `Output`
   --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:35:1
diff --git a/tests/ui/feature-gates/feature-gate-unsized_fn_params.stderr b/tests/ui/feature-gates/feature-gate-unsized_fn_params.stderr
index 360c73ae2d7b..30f958517680 100644
--- a/tests/ui/feature-gates/feature-gate-unsized_fn_params.stderr
+++ b/tests/ui/feature-gates/feature-gate-unsized_fn_params.stderr
@@ -8,8 +8,9 @@ LL | fn foo(x: dyn Foo) {
    = help: unsized fn params are gated as an unstable feature
 help: you can use `impl Trait` as the argument type
    |
-LL | fn foo(x: impl Foo) {
-   |           ~~~~
+LL - fn foo(x: dyn Foo) {
+LL + fn foo(x: impl Foo) {
+   |
 help: function arguments must have a statically known size, borrowed types always have a known size
    |
 LL | fn foo(x: &dyn Foo) {
diff --git a/tests/ui/feature-gates/feature-gate-unsized_locals.stderr b/tests/ui/feature-gates/feature-gate-unsized_locals.stderr
index f48565b922bf..ce0f423fb5c7 100644
--- a/tests/ui/feature-gates/feature-gate-unsized_locals.stderr
+++ b/tests/ui/feature-gates/feature-gate-unsized_locals.stderr
@@ -8,8 +8,9 @@ LL | fn f(f: dyn FnOnce()) {}
    = help: unsized fn params are gated as an unstable feature
 help: you can use `impl Trait` as the argument type
    |
-LL | fn f(f: impl FnOnce()) {}
-   |         ~~~~
+LL - fn f(f: dyn FnOnce()) {}
+LL + fn f(f: impl FnOnce()) {}
+   |
 help: function arguments must have a statically known size, borrowed types always have a known size
    |
 LL | fn f(f: &dyn FnOnce()) {}
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr b/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr
index 9a12851f20e5..8987b87f84e9 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr
+++ b/tests/ui/feature-gates/issue-43106-gating-of-macro_use.stderr
@@ -24,10 +24,12 @@ LL |     #[macro_use = "2700"] struct S;
    |
 help: the following are the possible correct uses
    |
-LL |     #[macro_use(name1, name2, ...)] struct S;
-   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LL |     #[macro_use] struct S;
-   |     ~~~~~~~~~~~~
+LL -     #[macro_use = "2700"] struct S;
+LL +     #[macro_use(name1, name2, ...)] struct S;
+   |
+LL -     #[macro_use = "2700"] struct S;
+LL +     #[macro_use] struct S;
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/fmt/format-args-non-identifier-diagnostics.stderr b/tests/ui/fmt/format-args-non-identifier-diagnostics.stderr
index 08abba2854ec..af6bb58071ff 100644
--- a/tests/ui/fmt/format-args-non-identifier-diagnostics.stderr
+++ b/tests/ui/fmt/format-args-non-identifier-diagnostics.stderr
@@ -6,8 +6,9 @@ LL |     println!("{x.0}");
    |
 help: consider using a positional formatting argument instead
    |
-LL |     println!("{0}", x.0);
-   |                ~  +++++
+LL -     println!("{x.0}");
+LL +     println!("{0}", x.0);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/fmt/format-string-error-2.stderr b/tests/ui/fmt/format-string-error-2.stderr
index a2d142e0baba..6d8c34fdb709 100644
--- a/tests/ui/fmt/format-string-error-2.stderr
+++ b/tests/ui/fmt/format-string-error-2.stderr
@@ -6,8 +6,9 @@ LL |     println!("\x7B}\u8 {", 1);
    |
 help: format of unicode escape sequences uses braces
    |
-LL |     println!("\x7B}\u{8} {", 1);
-   |                    ~~~~~
+LL -     println!("\x7B}\u8 {", 1);
+LL +     println!("\x7B}\u{8} {", 1);
+   |
 
 error: invalid format string: expected `}`, found `a`
   --> $DIR/format-string-error-2.rs:5:5
diff --git a/tests/ui/fmt/no-inline-literals-out-of-range.stderr b/tests/ui/fmt/no-inline-literals-out-of-range.stderr
index 78ec4888c27a..78047eabf499 100644
--- a/tests/ui/fmt/no-inline-literals-out-of-range.stderr
+++ b/tests/ui/fmt/no-inline-literals-out-of-range.stderr
@@ -8,12 +8,14 @@ LL |     format_args!("{}", 0x8f_i8); // issue #115423
    = note: `#[deny(overflowing_literals)]` on by default
 help: consider using the type `u8` instead
    |
-LL |     format_args!("{}", 0x8f_u8); // issue #115423
-   |                        ~~~~~~~
+LL -     format_args!("{}", 0x8f_i8); // issue #115423
+LL +     format_args!("{}", 0x8f_u8); // issue #115423
+   |
 help: to use as a negative number (decimal `-113`), consider using the type `u8` for the literal and cast it to `i8`
    |
-LL |     format_args!("{}", 0x8f_u8 as i8); // issue #115423
-   |                        ~~~~~~~~~~~~~
+LL -     format_args!("{}", 0x8f_i8); // issue #115423
+LL +     format_args!("{}", 0x8f_u8 as i8); // issue #115423
+   |
 
 error: literal out of range for `u8`
   --> $DIR/no-inline-literals-out-of-range.rs:6:24
@@ -49,8 +51,9 @@ LL |     format_args!("{}", 0xffff_ffff); // treat unsuffixed literals as i32
    = help: consider using the type `u32` instead
 help: to use as a negative number (decimal `-1`), consider using the type `u32` for the literal and cast it to `i32`
    |
-LL |     format_args!("{}", 0xffff_ffffu32 as i32); // treat unsuffixed literals as i32
-   |                        ~~~~~~~~~~~~~~~~~~~~~
+LL -     format_args!("{}", 0xffff_ffff); // treat unsuffixed literals as i32
+LL +     format_args!("{}", 0xffff_ffffu32 as i32); // treat unsuffixed literals as i32
+   |
 
 error: aborting due to 5 previous errors
 
diff --git a/tests/ui/fmt/struct-field-as-captured-argument.stderr b/tests/ui/fmt/struct-field-as-captured-argument.stderr
index 4ef022cecb04..388c14f932bb 100644
--- a/tests/ui/fmt/struct-field-as-captured-argument.stderr
+++ b/tests/ui/fmt/struct-field-as-captured-argument.stderr
@@ -6,8 +6,9 @@ LL |     let _ = format!("{foo.field}");
    |
 help: consider using a positional formatting argument instead
    |
-LL |     let _ = format!("{0}", foo.field);
-   |                       ~  +++++++++++
+LL -     let _ = format!("{foo.field}");
+LL +     let _ = format!("{0}", foo.field);
+   |
 
 error: invalid format string: field access isn't supported
   --> $DIR/struct-field-as-captured-argument.rs:12:23
@@ -17,8 +18,9 @@ LL |     let _ = format!("{foo.field} {} {bar}", "aa");
    |
 help: consider using a positional formatting argument instead
    |
-LL |     let _ = format!("{1} {} {bar}", "aa", foo.field);
-   |                       ~                 +++++++++++
+LL -     let _ = format!("{foo.field} {} {bar}", "aa");
+LL +     let _ = format!("{1} {} {bar}", "aa", foo.field);
+   |
 
 error: invalid format string: field access isn't supported
   --> $DIR/struct-field-as-captured-argument.rs:13:23
@@ -28,8 +30,9 @@ LL |     let _ = format!("{foo.field} {} {1} {bar}", "aa", "bb");
    |
 help: consider using a positional formatting argument instead
    |
-LL |     let _ = format!("{2} {} {1} {bar}", "aa", "bb", foo.field);
-   |                       ~                           +++++++++++
+LL -     let _ = format!("{foo.field} {} {1} {bar}", "aa", "bb");
+LL +     let _ = format!("{2} {} {1} {bar}", "aa", "bb", foo.field);
+   |
 
 error: invalid format string: field access isn't supported
   --> $DIR/struct-field-as-captured-argument.rs:14:23
@@ -39,8 +42,9 @@ LL |     let _ = format!("{foo.field} {} {baz}", "aa", baz = 3);
    |
 help: consider using a positional formatting argument instead
    |
-LL |     let _ = format!("{1} {} {baz}", "aa", foo.field, baz = 3);
-   |                       ~                 +++++++++++
+LL -     let _ = format!("{foo.field} {} {baz}", "aa", baz = 3);
+LL +     let _ = format!("{1} {} {baz}", "aa", foo.field, baz = 3);
+   |
 
 error: invalid format string: field access isn't supported
   --> $DIR/struct-field-as-captured-argument.rs:15:23
@@ -50,8 +54,9 @@ LL |     let _ = format!("{foo.field:?} {} {baz}", "aa", baz = 3);
    |
 help: consider using a positional formatting argument instead
    |
-LL |     let _ = format!("{1:?} {} {baz}", "aa", foo.field, baz = 3);
-   |                       ~                   +++++++++++
+LL -     let _ = format!("{foo.field:?} {} {baz}", "aa", baz = 3);
+LL +     let _ = format!("{1:?} {} {baz}", "aa", foo.field, baz = 3);
+   |
 
 error: invalid format string: field access isn't supported
   --> $DIR/struct-field-as-captured-argument.rs:16:23
@@ -61,8 +66,9 @@ LL |     let _ = format!("{foo.field:#?} {} {baz}", "aa", baz = 3);
    |
 help: consider using a positional formatting argument instead
    |
-LL |     let _ = format!("{1:#?} {} {baz}", "aa", foo.field, baz = 3);
-   |                       ~                    +++++++++++
+LL -     let _ = format!("{foo.field:#?} {} {baz}", "aa", baz = 3);
+LL +     let _ = format!("{1:#?} {} {baz}", "aa", foo.field, baz = 3);
+   |
 
 error: invalid format string: field access isn't supported
   --> $DIR/struct-field-as-captured-argument.rs:17:23
@@ -72,8 +78,9 @@ LL |     let _ = format!("{foo.field:.3} {} {baz}", "aa", baz = 3);
    |
 help: consider using a positional formatting argument instead
    |
-LL |     let _ = format!("{1:.3} {} {baz}", "aa", foo.field, baz = 3);
-   |                       ~                    +++++++++++
+LL -     let _ = format!("{foo.field:.3} {} {baz}", "aa", baz = 3);
+LL +     let _ = format!("{1:.3} {} {baz}", "aa", foo.field, baz = 3);
+   |
 
 error: aborting due to 7 previous errors
 
diff --git a/tests/ui/fmt/suggest-wrongly-order-format-parameter.stderr b/tests/ui/fmt/suggest-wrongly-order-format-parameter.stderr
index fe693d2e9041..516fb870a566 100644
--- a/tests/ui/fmt/suggest-wrongly-order-format-parameter.stderr
+++ b/tests/ui/fmt/suggest-wrongly-order-format-parameter.stderr
@@ -6,8 +6,9 @@ LL |     println!("{f:?#}");
    |
 help: did you mean `#?`?
    |
-LL |     println!("{f:#?}");
-   |                  ~~
+LL -     println!("{f:?#}");
+LL +     println!("{f:#?}");
+   |
 
 error: invalid format string: expected `}`, found `x`
   --> $DIR/suggest-wrongly-order-format-parameter.rs:18:19
@@ -17,8 +18,9 @@ LL |     println!("{f:?x}");
    |
 help: did you mean `x?`?
    |
-LL |     println!("{f:x?}");
-   |                  ~~
+LL -     println!("{f:?x}");
+LL +     println!("{f:x?}");
+   |
 
 error: invalid format string: expected `}`, found `X`
   --> $DIR/suggest-wrongly-order-format-parameter.rs:22:19
@@ -28,8 +30,9 @@ LL |     println!("{f:?X}");
    |
 help: did you mean `X?`?
    |
-LL |     println!("{f:X?}");
-   |                  ~~
+LL -     println!("{f:?X}");
+LL +     println!("{f:X?}");
+   |
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/fn/error-recovery-mismatch.stderr b/tests/ui/fn/error-recovery-mismatch.stderr
index ad4652c11c12..f281e77f13b9 100644
--- a/tests/ui/fn/error-recovery-mismatch.stderr
+++ b/tests/ui/fn/error-recovery-mismatch.stderr
@@ -37,8 +37,9 @@ LL |     fn fold(&self, _: T, &self._) {}
    |
 help: use type parameters instead
    |
-LL |     fn fold(&self, _: T, &self.U) {}
-   |              +++                     ~
+LL -     fn fold(&self, _: T, &self._) {}
+LL +     fn fold(&self, _: T, &self.U) {}
+   |
 
 error: aborting due to 4 previous errors; 1 warning emitted
 
diff --git a/tests/ui/fn/fn-pointer-mismatch.stderr b/tests/ui/fn/fn-pointer-mismatch.stderr
index 2aa840911f66..051eb9454679 100644
--- a/tests/ui/fn/fn-pointer-mismatch.stderr
+++ b/tests/ui/fn/fn-pointer-mismatch.stderr
@@ -51,8 +51,9 @@ LL |     let c: fn(u32) -> u32 = &foo;
                found reference `&fn(_) -> _ {foo}`
 help: consider removing the reference
    |
-LL |     let c: fn(u32) -> u32 = foo;
-   |                             ~~~
+LL -     let c: fn(u32) -> u32 = &foo;
+LL +     let c: fn(u32) -> u32 = foo;
+   |
 
 error[E0308]: mismatched types
   --> $DIR/fn-pointer-mismatch.rs:42:30
@@ -82,8 +83,9 @@ LL |     let e: &fn(u32) -> u32 = &foo;
    = note: fn items are distinct from fn pointers
 help: consider casting to a fn pointer
    |
-LL |     let e: &fn(u32) -> u32 = &(foo as fn(u32) -> u32);
-   |                              ~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     let e: &fn(u32) -> u32 = &foo;
+LL +     let e: &fn(u32) -> u32 = &(foo as fn(u32) -> u32);
+   |
 
 error: aborting due to 6 previous errors
 
diff --git a/tests/ui/fn/fn-recover-return-sign.stderr b/tests/ui/fn/fn-recover-return-sign.stderr
index e6012f3f9502..96aa96f00adb 100644
--- a/tests/ui/fn/fn-recover-return-sign.stderr
+++ b/tests/ui/fn/fn-recover-return-sign.stderr
@@ -6,8 +6,9 @@ LL | fn a() => usize { 0 }
    |
 help: use `->` instead
    |
-LL | fn a() -> usize { 0 }
-   |        ~~
+LL - fn a() => usize { 0 }
+LL + fn a() -> usize { 0 }
+   |
 
 error: return types are denoted using `->`
   --> $DIR/fn-recover-return-sign.rs:6:7
@@ -17,8 +18,9 @@ LL | fn b(): usize { 0 }
    |
 help: use `->` instead
    |
-LL | fn b() -> usize { 0 }
-   |        ~~
+LL - fn b(): usize { 0 }
+LL + fn b() -> usize { 0 }
+   |
 
 error: return types are denoted using `->`
   --> $DIR/fn-recover-return-sign.rs:21:25
@@ -28,8 +30,9 @@ LL |     let foo = |a: bool| => bool { a };
    |
 help: use `->` instead
    |
-LL |     let foo = |a: bool| -> bool { a };
-   |                         ~~
+LL -     let foo = |a: bool| => bool { a };
+LL +     let foo = |a: bool| -> bool { a };
+   |
 
 error: return types are denoted using `->`
   --> $DIR/fn-recover-return-sign.rs:25:24
@@ -39,8 +42,9 @@ LL |     let bar = |a: bool|: bool { a };
    |
 help: use `->` instead
    |
-LL |     let bar = |a: bool| -> bool { a };
-   |                         ~~
+LL -     let bar = |a: bool|: bool { a };
+LL +     let bar = |a: bool| -> bool { a };
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/fn/fn-recover-return-sign2.stderr b/tests/ui/fn/fn-recover-return-sign2.stderr
index fb88ff7b9504..ba6662b0d46d 100644
--- a/tests/ui/fn/fn-recover-return-sign2.stderr
+++ b/tests/ui/fn/fn-recover-return-sign2.stderr
@@ -6,8 +6,9 @@ LL | fn foo() => impl Fn() => bool {
    |
 help: use `->` instead
    |
-LL | fn foo() -> impl Fn() => bool {
-   |          ~~
+LL - fn foo() => impl Fn() => bool {
+LL + fn foo() -> impl Fn() => bool {
+   |
 
 error: expected one of `+`, `->`, `::`, `where`, or `{`, found `=>`
   --> $DIR/fn-recover-return-sign2.rs:4:23
diff --git a/tests/ui/fn/param-mismatch-foreign.stderr b/tests/ui/fn/param-mismatch-foreign.stderr
index 1182908891c6..88aa3cd03683 100644
--- a/tests/ui/fn/param-mismatch-foreign.stderr
+++ b/tests/ui/fn/param-mismatch-foreign.stderr
@@ -11,8 +11,9 @@ LL |     fn foo(x: i32, y: u32, z: i32);
    |        ^^^         -
 help: provide the argument
    |
-LL |     foo(1i32, /* u32 */, 2i32);
-   |        ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     foo(1i32, 2i32);
+LL +     foo(1i32, /* u32 */, 2i32);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/force-inlining/invalid.stderr b/tests/ui/force-inlining/invalid.stderr
index 5d280124129b..92b3c314bad1 100644
--- a/tests/ui/force-inlining/invalid.stderr
+++ b/tests/ui/force-inlining/invalid.stderr
@@ -6,9 +6,11 @@ LL | #[rustc_force_inline("foo")]
    |
 help: the following are the possible correct uses
    |
-LL | #[rustc_force_inline = "reason"]
+LL - #[rustc_force_inline("foo")]
+LL + #[rustc_force_inline = "reason"]
    |
-LL | #[rustc_force_inline]
+LL - #[rustc_force_inline("foo")]
+LL + #[rustc_force_inline]
    |
 
 error: malformed `rustc_force_inline` attribute input
@@ -19,9 +21,11 @@ LL | #[rustc_force_inline(bar, baz)]
    |
 help: the following are the possible correct uses
    |
-LL | #[rustc_force_inline = "reason"]
+LL - #[rustc_force_inline(bar, baz)]
+LL + #[rustc_force_inline = "reason"]
    |
-LL | #[rustc_force_inline]
+LL - #[rustc_force_inline(bar, baz)]
+LL + #[rustc_force_inline]
    |
 
 error: malformed `rustc_force_inline` attribute input
@@ -32,9 +36,11 @@ LL | #[rustc_force_inline(2)]
    |
 help: the following are the possible correct uses
    |
-LL | #[rustc_force_inline = "reason"]
+LL - #[rustc_force_inline(2)]
+LL + #[rustc_force_inline = "reason"]
    |
-LL | #[rustc_force_inline]
+LL - #[rustc_force_inline(2)]
+LL + #[rustc_force_inline]
    |
 
 error: malformed `rustc_force_inline` attribute input
@@ -45,9 +51,11 @@ LL | #[rustc_force_inline = 2]
    |
 help: the following are the possible correct uses
    |
-LL | #[rustc_force_inline = "reason"]
+LL - #[rustc_force_inline = 2]
+LL + #[rustc_force_inline = "reason"]
    |
-LL | #[rustc_force_inline]
+LL - #[rustc_force_inline = 2]
+LL + #[rustc_force_inline]
    |
 
 error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
diff --git a/tests/ui/functional-struct-update/functional-struct-update-noncopyable.stderr b/tests/ui/functional-struct-update/functional-struct-update-noncopyable.stderr
index d167a60dad38..b09ffb10673e 100644
--- a/tests/ui/functional-struct-update/functional-struct-update-noncopyable.stderr
+++ b/tests/ui/functional-struct-update/functional-struct-update-noncopyable.stderr
@@ -9,8 +9,9 @@ LL |     let _b = A { y: Arc::new(3), ..a };
    |
 help: clone the value from the field instead of using the functional record update syntax
    |
-LL |     let _b = A { y: Arc::new(3), x: a.x.clone() };
-   |                                ~~~~~~~~~~~~~~~~
+LL -     let _b = A { y: Arc::new(3), ..a };
+LL +     let _b = A { y: Arc::new(3), x: a.x.clone() };
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr
index 52fed354edf8..99300ea1cb7f 100644
--- a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr
+++ b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr
@@ -12,8 +12,9 @@ LL | fn foo<'a>(arg: Box>) {}
    |
 help: use angle brackets instead
    |
-LL | fn foo<'a>(arg: Box = &'a ()>>) {}
-   |                            ~  ~
+LL - fn foo<'a>(arg: Box>) {}
+LL + fn foo<'a>(arg: Box = &'a ()>>) {}
+   |
 
 error: parenthesized generic arguments cannot be used in associated type constraints
   --> $DIR/gat-trait-path-parenthesised-args.rs:18:27
diff --git a/tests/ui/generic-associated-types/impl_bounds.stderr b/tests/ui/generic-associated-types/impl_bounds.stderr
index aa56505dd300..291f0ade439e 100644
--- a/tests/ui/generic-associated-types/impl_bounds.stderr
+++ b/tests/ui/generic-associated-types/impl_bounds.stderr
@@ -18,8 +18,9 @@ LL |     type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a;
    |
 help: copy the `where` clause predicates from the trait
    |
-LL |     type B<'a, 'b> = (&'a(), &'b ()) where 'a: 'b;
-   |                                      ~~~~~~~~~~~~
+LL -     type B<'a, 'b> = (&'a(), &'b ()) where 'b: 'a;
+LL +     type B<'a, 'b> = (&'a(), &'b ()) where 'a: 'b;
+   |
 
 error[E0277]: the trait bound `T: Copy` is not satisfied
   --> $DIR/impl_bounds.rs:18:33
diff --git a/tests/ui/generic-associated-types/issue-70304.stderr b/tests/ui/generic-associated-types/issue-70304.stderr
index 9b02c1b07683..a181b1035b7c 100644
--- a/tests/ui/generic-associated-types/issue-70304.stderr
+++ b/tests/ui/generic-associated-types/issue-70304.stderr
@@ -13,8 +13,9 @@ LL | fn create_doc() -> impl Document = DocCursorImpl<'_>> {
    = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
 help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values
    |
-LL | fn create_doc() -> impl Document = DocCursorImpl<'static>> {
-   |                                                             ~~~~~~~
+LL - fn create_doc() -> impl Document = DocCursorImpl<'_>> {
+LL + fn create_doc() -> impl Document = DocCursorImpl<'static>> {
+   |
 
 error: missing required bound on `Cursor`
   --> $DIR/issue-70304.rs:2:5
diff --git a/tests/ui/generic-associated-types/mismatched-where-clause-regions.stderr b/tests/ui/generic-associated-types/mismatched-where-clause-regions.stderr
index ee90f61aabc7..9ff343c255b7 100644
--- a/tests/ui/generic-associated-types/mismatched-where-clause-regions.stderr
+++ b/tests/ui/generic-associated-types/mismatched-where-clause-regions.stderr
@@ -9,8 +9,9 @@ LL |     type T<'a2, 'b2> = () where 'b2: 'a2;
    |
 help: copy the `where` clause predicates from the trait
    |
-LL |     type T<'a2, 'b2> = () where 'a2: 'b2;
-   |                           ~~~~~~~~~~~~~~
+LL -     type T<'a2, 'b2> = () where 'b2: 'a2;
+LL +     type T<'a2, 'b2> = () where 'a2: 'b2;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/generic-associated-types/missing-bounds.stderr b/tests/ui/generic-associated-types/missing-bounds.stderr
index 6e0700639e9c..13e4d2498760 100644
--- a/tests/ui/generic-associated-types/missing-bounds.stderr
+++ b/tests/ui/generic-associated-types/missing-bounds.stderr
@@ -7,8 +7,9 @@ LL | impl Add for E where ::Output = B {
    = note: see issue #20041  for more information
 help: if `Output` is an associated type you're trying to set, use the associated type binding syntax
    |
-LL | impl Add for E where B: Add {
-   |                                 ~~~~~~~~~~~~~~~~~~
+LL - impl Add for E where ::Output = B {
+LL + impl Add for E where B: Add {
+   |
 
 error[E0308]: mismatched types
   --> $DIR/missing-bounds.rs:11:11
diff --git a/tests/ui/generic-const-items/duplicate-where-clause.stderr b/tests/ui/generic-const-items/duplicate-where-clause.stderr
index 5fa61b01ee9d..6b742dfafeda 100644
--- a/tests/ui/generic-const-items/duplicate-where-clause.stderr
+++ b/tests/ui/generic-const-items/duplicate-where-clause.stderr
@@ -9,8 +9,10 @@ LL |         P: Eq;
    |
 help: consider joining the two `where` clauses into one
    |
-LL |         P: Copy,
-   |                ~
+LL -         P: Copy
+LL -     where
+LL +         P: Copy,
+   |
 
 error: where clauses are not allowed before const item bodies
   --> $DIR/duplicate-where-clause.rs:19:5
diff --git a/tests/ui/generics/issue-95208-ignore-qself.stderr b/tests/ui/generics/issue-95208-ignore-qself.stderr
index 7d91fbc14a18..b9a5ffac274f 100644
--- a/tests/ui/generics/issue-95208-ignore-qself.stderr
+++ b/tests/ui/generics/issue-95208-ignore-qself.stderr
@@ -6,8 +6,9 @@ LL | impl Struct where ::Item:: std::
    |
 help: use single colon
    |
-LL | impl Struct where ::Item: std::fmt::Display {
-   |                                                                    ~
+LL - impl Struct where ::Item:: std::fmt::Display {
+LL + impl Struct where ::Item: std::fmt::Display {
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/generics/issue-95208.stderr b/tests/ui/generics/issue-95208.stderr
index e047f1265e2e..0ff6c8be9fd1 100644
--- a/tests/ui/generics/issue-95208.stderr
+++ b/tests/ui/generics/issue-95208.stderr
@@ -6,8 +6,9 @@ LL | impl Struct where T:: std::fmt::Display {
    |
 help: use single colon
    |
-LL | impl Struct where T: std::fmt::Display {
-   |                          ~
+LL - impl Struct where T:: std::fmt::Display {
+LL + impl Struct where T: std::fmt::Display {
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/generics/overlapping-errors-span-issue-123861.stderr b/tests/ui/generics/overlapping-errors-span-issue-123861.stderr
index e0a49343b0e0..9622dffda9f8 100644
--- a/tests/ui/generics/overlapping-errors-span-issue-123861.stderr
+++ b/tests/ui/generics/overlapping-errors-span-issue-123861.stderr
@@ -33,8 +33,9 @@ LL | fn mainIterator<_ = _> {}
    |
 help: use type parameters instead
    |
-LL | fn mainIterator {}
-   |                 ~   ~
+LL - fn mainIterator<_ = _> {}
+LL + fn mainIterator {}
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr
index aa3d2cd2d904..ec0e09a302ea 100644
--- a/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr
+++ b/tests/ui/half-open-range-patterns/half-open-range-pats-inclusive-dotdotdot-bad-syntax.stderr
@@ -6,8 +6,9 @@ LL |         ...X => {}
    |
 help: use `..=` instead
    |
-LL |         ..=X => {}
-   |         ~~~
+LL -         ...X => {}
+LL +         ..=X => {}
+   |
 
 error: range-to patterns with `...` are not allowed
   --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:16:9
@@ -17,8 +18,9 @@ LL |         ...0 => {}
    |
 help: use `..=` instead
    |
-LL |         ..=0 => {}
-   |         ~~~
+LL -         ...0 => {}
+LL +         ..=0 => {}
+   |
 
 error: range-to patterns with `...` are not allowed
   --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:17:9
@@ -28,8 +30,9 @@ LL |         ...'a' => {}
    |
 help: use `..=` instead
    |
-LL |         ..='a' => {}
-   |         ~~~
+LL -         ...'a' => {}
+LL +         ..='a' => {}
+   |
 
 error: range-to patterns with `...` are not allowed
   --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:18:9
@@ -39,8 +42,9 @@ LL |         ...0.0f32 => {}
    |
 help: use `..=` instead
    |
-LL |         ..=0.0f32 => {}
-   |         ~~~
+LL -         ...0.0f32 => {}
+LL +         ..=0.0f32 => {}
+   |
 
 error: range-to patterns with `...` are not allowed
   --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:25:17
@@ -54,8 +58,9 @@ LL |     mac!(0);
    = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: use `..=` instead
    |
-LL |             let ..=$e;
-   |                 ~~~
+LL -             let ...$e;
+LL +             let ..=$e;
+   |
 
 error[E0005]: refutable pattern in local binding
   --> $DIR/half-open-range-pats-inclusive-dotdotdot-bad-syntax.rs:25:17
diff --git a/tests/ui/half-open-range-patterns/half-open-range-pats-ref-ambiguous-interp.stderr b/tests/ui/half-open-range-patterns/half-open-range-pats-ref-ambiguous-interp.stderr
index 83a374c3d65d..2d70f75f2c6d 100644
--- a/tests/ui/half-open-range-patterns/half-open-range-pats-ref-ambiguous-interp.stderr
+++ b/tests/ui/half-open-range-patterns/half-open-range-pats-ref-ambiguous-interp.stderr
@@ -76,8 +76,9 @@ LL |         &...0 | _ => {}
    |
 help: use `..=` instead
    |
-LL |         &..=0 | _ => {}
-   |          ~~~
+LL -         &...0 | _ => {}
+LL +         &..=0 | _ => {}
+   |
 
 error: the range pattern here has ambiguous interpretation
   --> $DIR/half-open-range-pats-ref-ambiguous-interp.rs:20:10
diff --git a/tests/ui/hashmap/hashmap-index-mut.stderr b/tests/ui/hashmap/hashmap-index-mut.stderr
index ad33c6f9b154..e8b22350c59d 100644
--- a/tests/ui/hashmap/hashmap-index-mut.stderr
+++ b/tests/ui/hashmap/hashmap-index-mut.stderr
@@ -7,12 +7,15 @@ LL |     map[&0] = 1;
    = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap`
 help: use `.insert()` to insert a value into a `HashMap`, `.get_mut()` to modify it, or the entry API for more flexibility
    |
-LL |     map.insert(&0, 1);
-   |        ~~~~~~~~  ~  +
-LL |     if let Some(val) = map.get_mut(&0) { *val = 1; };
-   |     ++++++++++++++++++    ~~~~~~~~~  ~~~~~~~~    +++
-LL |     let val = map.entry(&0).or_insert(1);
-   |     +++++++++    ~~~~~~~  ~~~~~~~~~~~~ +
+LL -     map[&0] = 1;
+LL +     map.insert(&0, 1);
+   |
+LL -     map[&0] = 1;
+LL +     if let Some(val) = map.get_mut(&0) { *val = 1; };
+   |
+LL -     map[&0] = 1;
+LL +     let val = map.entry(&0).or_insert(1);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/higher-ranked/trait-bounds/issue-58451.stderr b/tests/ui/higher-ranked/trait-bounds/issue-58451.stderr
index 34d7db9b3cf8..4f9fc0ac6492 100644
--- a/tests/ui/higher-ranked/trait-bounds/issue-58451.stderr
+++ b/tests/ui/higher-ranked/trait-bounds/issue-58451.stderr
@@ -11,8 +11,9 @@ LL | fn f(i: I)
    |    ^    ----
 help: provide the argument
    |
-LL |     f(&[f(/* i */)]);
-   |          ~~~~~~~~~
+LL -     f(&[f()]);
+LL +     f(&[f(/* i */)]);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/hygiene/globs.stderr b/tests/ui/hygiene/globs.stderr
index 180172644402..3f7a0ae7efa1 100644
--- a/tests/ui/hygiene/globs.stderr
+++ b/tests/ui/hygiene/globs.stderr
@@ -9,8 +9,9 @@ LL |         f();
    |
 help: a function with a similar name exists
    |
-LL |         g();
-   |         ~
+LL -         f();
+LL +         g();
+   |
 help: consider importing this function
    |
 LL + use foo::f;
@@ -35,8 +36,9 @@ LL | |     }
    = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: a function with a similar name exists
    |
-LL |     f();
-   |     ~
+LL -     g();
+LL +     f();
+   |
 help: consider importing this function
    |
 LL + use bar::g;
diff --git a/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-dyn-trait.stderr b/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-dyn-trait.stderr
index c2fd11fe23de..2c314b07bcee 100644
--- a/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-dyn-trait.stderr
+++ b/tests/ui/impl-trait/dyn-incompatible-trait-in-return-position-dyn-trait.stderr
@@ -34,8 +34,9 @@ LL | fn car() -> dyn DynIncompatible {
    |
 help: consider returning an `impl Trait` instead of a `dyn Trait`
    |
-LL | fn car() -> impl DynIncompatible {
-   |             ~~~~
+LL - fn car() -> dyn DynIncompatible {
+LL + fn car() -> impl DynIncompatible {
+   |
 help: alternatively, box the return type, and wrap all of the returned values in `Box::new`
    |
 LL ~ fn car() -> Box {
diff --git a/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr b/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr
index 11491a55738b..304d7d43b78b 100644
--- a/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr
+++ b/tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr
@@ -41,8 +41,9 @@ LL | fn ban() -> dyn Trait { Struct }
    |
 help: consider returning an `impl Trait` instead of a `dyn Trait`
    |
-LL | fn ban() -> impl Trait { Struct }
-   |             ~~~~
+LL - fn ban() -> dyn Trait { Struct }
+LL + fn ban() -> impl Trait { Struct }
+   |
 help: alternatively, box the return type, and wrap all of the returned values in `Box::new`
    |
 LL | fn ban() -> Box { Box::new(Struct) }
@@ -56,8 +57,9 @@ LL | fn bak() -> dyn Trait { unimplemented!() }
    |
 help: consider returning an `impl Trait` instead of a `dyn Trait`
    |
-LL | fn bak() -> impl Trait { unimplemented!() }
-   |             ~~~~
+LL - fn bak() -> dyn Trait { unimplemented!() }
+LL + fn bak() -> impl Trait { unimplemented!() }
+   |
 help: alternatively, box the return type, and wrap all of the returned values in `Box::new`
    |
 LL | fn bak() -> Box { Box::new(unimplemented!()) }
@@ -71,8 +73,9 @@ LL | fn bal() -> dyn Trait {
    |
 help: consider returning an `impl Trait` instead of a `dyn Trait`
    |
-LL | fn bal() -> impl Trait {
-   |             ~~~~
+LL - fn bal() -> dyn Trait {
+LL + fn bal() -> impl Trait {
+   |
 help: alternatively, box the return type, and wrap all of the returned values in `Box::new`
    |
 LL ~ fn bal() -> Box {
@@ -90,8 +93,9 @@ LL | fn bax() -> dyn Trait {
    |
 help: consider returning an `impl Trait` instead of a `dyn Trait`
    |
-LL | fn bax() -> impl Trait {
-   |             ~~~~
+LL - fn bax() -> dyn Trait {
+LL + fn bax() -> impl Trait {
+   |
 help: alternatively, box the return type, and wrap all of the returned values in `Box::new`
    |
 LL ~ fn bax() -> Box {
@@ -109,8 +113,9 @@ LL | fn bat() -> dyn Trait {
    |
 help: consider returning an `impl Trait` instead of a `dyn Trait`
    |
-LL | fn bat() -> impl Trait {
-   |             ~~~~
+LL - fn bat() -> dyn Trait {
+LL + fn bat() -> impl Trait {
+   |
 help: alternatively, box the return type, and wrap all of the returned values in `Box::new`
    |
 LL ~ fn bat() -> Box {
@@ -128,8 +133,9 @@ LL | fn bay() -> dyn Trait {
    |
 help: consider returning an `impl Trait` instead of a `dyn Trait`
    |
-LL | fn bay() -> impl Trait {
-   |             ~~~~
+LL - fn bay() -> dyn Trait {
+LL + fn bay() -> impl Trait {
+   |
 help: alternatively, box the return type, and wrap all of the returned values in `Box::new`
    |
 LL ~ fn bay() -> Box {
diff --git a/tests/ui/impl-trait/equality.stderr b/tests/ui/impl-trait/equality.stderr
index fd6f4b34241a..8106bab98782 100644
--- a/tests/ui/impl-trait/equality.stderr
+++ b/tests/ui/impl-trait/equality.stderr
@@ -19,8 +19,9 @@ LL |     0_u32
    |
 help: change the type of the numeric literal from `u32` to `i32`
    |
-LL |     0_i32
-   |       ~~~
+LL -     0_u32
+LL +     0_i32
+   |
 
 error[E0277]: cannot add `impl Foo` to `u32`
   --> $DIR/equality.rs:24:11
diff --git a/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr b/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr
index d0f8f7689d17..31f39eb90041 100644
--- a/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr
+++ b/tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr
@@ -7,8 +7,9 @@ LL | fn d() -> impl Fn() -> (impl Debug + '_) {
    = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
 help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values
    |
-LL | fn d() -> impl Fn() -> (impl Debug + 'static) {
-   |                                      ~~~~~~~
+LL - fn d() -> impl Fn() -> (impl Debug + '_) {
+LL + fn d() -> impl Fn() -> (impl Debug + 'static) {
+   |
 
 warning: elided lifetime has a name
   --> $DIR/impl-fn-hrtb-bounds.rs:14:52
diff --git a/tests/ui/impl-trait/impl-generic-mismatch-ab.stderr b/tests/ui/impl-trait/impl-generic-mismatch-ab.stderr
index 90c31c9e3fc1..9db996cf9ce6 100644
--- a/tests/ui/impl-trait/impl-generic-mismatch-ab.stderr
+++ b/tests/ui/impl-trait/impl-generic-mismatch-ab.stderr
@@ -17,8 +17,9 @@ LL |     fn foo(&self, a: &A, b: &impl Debug);
    = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
 help: change the parameter type to match the trait
    |
-LL |     fn foo(&self, a: &B, b: &B) { }
-   |                                ~~
+LL -     fn foo(&self, a: &impl Debug, b: &B) { }
+LL +     fn foo(&self, a: &B, b: &B) { }
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/impl-trait/impl-generic-mismatch.stderr b/tests/ui/impl-trait/impl-generic-mismatch.stderr
index 973b65bfd625..18347bd0f978 100644
--- a/tests/ui/impl-trait/impl-generic-mismatch.stderr
+++ b/tests/ui/impl-trait/impl-generic-mismatch.stderr
@@ -24,8 +24,9 @@ LL |     fn bar(&self, _: &impl Debug) { }
    |
 help: try changing the `impl Trait` argument to a generic parameter
    |
-LL |     fn bar(&self, _: &U) { }
-   |           ++++++++++            ~
+LL -     fn bar(&self, _: &impl Debug) { }
+LL +     fn bar(&self, _: &U) { }
+   |
 
 error[E0643]: method `baz` has incompatible signature for trait
   --> $DIR/impl-generic-mismatch.rs:26:33
@@ -38,8 +39,9 @@ LL |     fn baz(&self, _: &impl Debug, _: &T) { }
    |
 help: try changing the `impl Trait` argument to a generic parameter
    |
-LL |     fn baz(&self, _: &T, _: &T) { }
-   |           ~~~~~~~~~~~~~~~~~~~~            ~
+LL -     fn baz(&self, _: &impl Debug, _: &T) { }
+LL +     fn baz(&self, _: &T, _: &T) { }
+   |
 
 error[E0643]: method `hash` has incompatible signature for trait
   --> $DIR/impl-generic-mismatch.rs:37:33
diff --git a/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr b/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr
index 75cbe43eeb4a..8351175099c9 100644
--- a/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr
+++ b/tests/ui/impl-trait/in-assoc-type-unconstrained.stderr
@@ -43,8 +43,9 @@ LL |         fn method() -> () {}
    |            ^^^^^^
 help: change the output type to match the trait
    |
-LL |         fn method() -> <() as compare_method::Trait>::Ty {}
-   |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -         fn method() -> () {}
+LL +         fn method() -> <() as compare_method::Trait>::Ty {}
+   |
 
 error: unconstrained opaque type
   --> $DIR/in-assoc-type-unconstrained.rs:20:19
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
index 022df6f906cf..d3729b6c9737 100644
--- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
@@ -9,8 +9,10 @@ LL |         'b: 'a;
    |
 help: copy the `where` clause predicates from the trait
    |
-LL |     where Self: 'b;
-   |     ~~~~~~~~~~~~~~
+LL -     where
+LL -         'b: 'a;
+LL +     where Self: 'b;
+   |
 
 warning: impl trait in impl method signature does not match trait method signature
   --> $DIR/bad-item-bound-within-rpitit.rs:18:28
@@ -26,8 +28,9 @@ LL |     fn iter(&self) -> impl 'a + Iterator> {
    = note: `#[warn(refining_impl_trait_reachable)]` on by default
 help: replace the return type so that it matches the trait
    |
-LL |     fn iter(&self) -> impl Iterator::Item<'_>> + '_ {
-   |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     fn iter(&self) -> impl 'a + Iterator> {
+LL +     fn iter(&self) -> impl Iterator::Item<'_>> + '_ {
+   |
 
 error: aborting due to 1 previous error; 1 warning emitted
 
diff --git a/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr b/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr
index 94f068cabaa8..b7797317ea68 100644
--- a/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr
+++ b/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr
@@ -12,8 +12,9 @@ LL |     fn bar(&self) -> impl Iterator + '_ {
    = note: `#[warn(refining_impl_trait_internal)]` on by default
 help: replace the return type so that it matches the trait
    |
-LL |     fn bar(&self) -> impl Iterator + '_ {
-   |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     fn bar(&self) -> impl Iterator + '_ {
+LL +     fn bar(&self) -> impl Iterator + '_ {
+   |
 
 warning: 1 warning emitted
 
diff --git a/tests/ui/impl-trait/in-trait/foreign.stderr b/tests/ui/impl-trait/in-trait/foreign.stderr
index 36114dcf02b6..8801ccc68b3b 100644
--- a/tests/ui/impl-trait/in-trait/foreign.stderr
+++ b/tests/ui/impl-trait/in-trait/foreign.stderr
@@ -14,8 +14,9 @@ LL |     #[warn(refining_impl_trait)]
    = note: `#[warn(refining_impl_trait_internal)]` implied by `#[warn(refining_impl_trait)]`
 help: replace the return type so that it matches the trait
    |
-LL |     fn bar(self) -> impl Deref {
-   |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     fn bar(self) -> Arc {
+LL +     fn bar(self) -> impl Deref {
+   |
 
 warning: impl trait in impl method signature does not match trait method signature
   --> $DIR/foreign.rs:31:21
@@ -32,8 +33,9 @@ LL |     #[warn(refining_impl_trait)]
    |            ^^^^^^^^^^^^^^^^^^^
 help: replace the return type so that it matches the trait
    |
-LL |     fn bar(self) -> impl Deref {
-   |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     fn bar(self) -> Arc {
+LL +     fn bar(self) -> impl Deref {
+   |
 
 warning: 2 warnings emitted
 
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr
index a23879eb6c37..97f5b2af862e 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr
@@ -15,8 +15,9 @@ LL |     fn early<'early, T>(x: &'early T) -> impl Sized;
               found signature `fn(&())`
 help: change the parameter type to match the trait
    |
-LL |     fn early<'late, T>(_: &'early T) {}
-   |                           ~~~~~~~~~
+LL -     fn early<'late, T>(_: &'late ()) {}
+LL +     fn early<'late, T>(_: &'early T) {}
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr
index 9e18517e48c5..588b45376100 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr
@@ -13,8 +13,9 @@ LL |     fn owo(x: ()) -> impl Sized;
               found signature `fn(u8)`
 help: change the parameter type to match the trait
    |
-LL |     fn owo(_: ()) {}
-   |               ~~
+LL -     fn owo(_: u8) {}
+LL +     fn owo(_: ()) {}
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr
index c01d7322d117..b0530045bea9 100644
--- a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr
+++ b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr
@@ -13,8 +13,9 @@ LL |     async fn owo(x: ()) {}
               found signature `fn(u8) -> _`
 help: change the parameter type to match the trait
    |
-LL |     async fn owo(_: ()) {}
-   |                     ~~
+LL -     async fn owo(_: u8) {}
+LL +     async fn owo(_: ()) {}
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr
index 81570781b27d..d575fedbb58d 100644
--- a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr
+++ b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr
@@ -86,8 +86,9 @@ LL |     fn bar() -> Wrapper;
               found signature `fn() -> i32`
 help: change the output type to match the trait
    |
-LL |     fn bar() -> Wrapper<'static> {
-   |                 ~~~~~~~~~~~~~~~~
+LL -     fn bar() -> i32 {
+LL +     fn bar() -> Wrapper<'static> {
+   |
 
 error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
   --> $DIR/opaque-and-lifetime-mismatch.rs:24:17
diff --git a/tests/ui/impl-trait/in-trait/refine-captures.stderr b/tests/ui/impl-trait/in-trait/refine-captures.stderr
index ad2c2a11601d..8a5c8d3c77b0 100644
--- a/tests/ui/impl-trait/in-trait/refine-captures.stderr
+++ b/tests/ui/impl-trait/in-trait/refine-captures.stderr
@@ -9,8 +9,9 @@ LL |     fn test() -> impl Sized + use<> {}
    = note: `#[warn(refining_impl_trait_internal)]` on by default
 help: modify the `use<..>` bound to capture the same lifetimes that the trait does
    |
-LL |     fn test() -> impl Sized + use<'a> {}
-   |                               ~~~~~~~
+LL -     fn test() -> impl Sized + use<> {}
+LL +     fn test() -> impl Sized + use<'a> {}
+   |
 
 warning: impl trait in impl method captures fewer lifetimes than in trait
   --> $DIR/refine-captures.rs:22:31
@@ -22,8 +23,9 @@ LL |     fn test() -> impl Sized + use<> {}
    = note: we are soliciting feedback, see issue #121718  for more information
 help: modify the `use<..>` bound to capture the same lifetimes that the trait does
    |
-LL |     fn test() -> impl Sized + use<'a> {}
-   |                               ~~~~~~~
+LL -     fn test() -> impl Sized + use<> {}
+LL +     fn test() -> impl Sized + use<'a> {}
+   |
 
 warning: impl trait in impl method captures fewer lifetimes than in trait
   --> $DIR/refine-captures.rs:27:31
@@ -35,8 +37,9 @@ LL |     fn test() -> impl Sized + use<'b> {}
    = note: we are soliciting feedback, see issue #121718  for more information
 help: modify the `use<..>` bound to capture the same lifetimes that the trait does
    |
-LL |     fn test() -> impl Sized + use<'a, 'b> {}
-   |                               ~~~~~~~~~~~
+LL -     fn test() -> impl Sized + use<'b> {}
+LL +     fn test() -> impl Sized + use<'a, 'b> {}
+   |
 
 error: `impl Trait` must mention all type parameters in scope in `use<...>`
   --> $DIR/refine-captures.rs:32:18
diff --git a/tests/ui/impl-trait/in-trait/refine.stderr b/tests/ui/impl-trait/in-trait/refine.stderr
index 8d30b0359216..e381ef8c3f71 100644
--- a/tests/ui/impl-trait/in-trait/refine.stderr
+++ b/tests/ui/impl-trait/in-trait/refine.stderr
@@ -17,8 +17,9 @@ LL | #![deny(refining_impl_trait)]
    = note: `#[deny(refining_impl_trait_reachable)]` implied by `#[deny(refining_impl_trait)]`
 help: replace the return type so that it matches the trait
    |
-LL |     fn bar() -> impl Sized {}
-   |                 ~~~~~~~~~~
+LL -     fn bar() -> impl Copy {}
+LL +     fn bar() -> impl Sized {}
+   |
 
 error: impl trait in impl method signature does not match trait method signature
   --> $DIR/refine.rs:15:5
@@ -49,8 +50,9 @@ LL |     fn bar() -> () {}
    = note: we are soliciting feedback, see issue #121718  for more information
 help: replace the return type so that it matches the trait
    |
-LL |     fn bar() -> impl Sized {}
-   |                 ~~~~~~~~~~
+LL -     fn bar() -> () {}
+LL +     fn bar() -> impl Sized {}
+   |
 
 error: impl trait in impl method signature does not match trait method signature
   --> $DIR/refine.rs:27:17
@@ -66,8 +68,9 @@ LL |     fn bar() -> () {}
    = note: `#[deny(refining_impl_trait_internal)]` implied by `#[deny(refining_impl_trait)]`
 help: replace the return type so that it matches the trait
    |
-LL |     fn bar() -> impl Sized {}
-   |                 ~~~~~~~~~~
+LL -     fn bar() -> () {}
+LL +     fn bar() -> impl Sized {}
+   |
 
 error: impl trait in impl method signature does not match trait method signature
   --> $DIR/refine.rs:35:17
@@ -82,8 +85,9 @@ LL |     fn bar() -> () {}
    = note: we are soliciting feedback, see issue #121718  for more information
 help: replace the return type so that it matches the trait
    |
-LL |     fn bar() -> impl Sized {}
-   |                 ~~~~~~~~~~
+LL -     fn bar() -> () {}
+LL +     fn bar() -> impl Sized {}
+   |
 
 error: impl trait in impl method signature does not match trait method signature
   --> $DIR/refine.rs:45:27
@@ -98,8 +102,9 @@ LL |     fn bar(&self) -> impl Copy + '_ {}
    = note: we are soliciting feedback, see issue #121718  for more information
 help: replace the return type so that it matches the trait
    |
-LL |     fn bar(&self) -> impl Sized + '_ {}
-   |                      ~~~~~~~~~~~~~~~
+LL -     fn bar(&self) -> impl Copy + '_ {}
+LL +     fn bar(&self) -> impl Sized + '_ {}
+   |
 
 error: impl trait in impl method signature does not match trait method signature
   --> $DIR/refine.rs:56:9
diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr
index 15bef5c78b05..dfcf11c57ddc 100644
--- a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr
+++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr
@@ -9,7 +9,9 @@ LL |         'a: 'static,
    |
 help: copy the `where` clause predicates from the trait
    |
-LL |     where 'a: 'a
+LL -     where
+LL -         'a: 'static,
+LL +     where 'a: 'a
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.stderr b/tests/ui/impl-trait/in-trait/specialization-broken.stderr
index 8c9f26560154..fbbe1ac40b9e 100644
--- a/tests/ui/impl-trait/in-trait/specialization-broken.stderr
+++ b/tests/ui/impl-trait/in-trait/specialization-broken.stderr
@@ -16,8 +16,9 @@ LL |     fn bar(&self) -> impl Sized;
               found signature `fn(&_) -> U`
 help: change the output type to match the trait
    |
-LL |     fn bar(&self) -> impl Sized {
-   |                      ~~~~~~~~~~
+LL -     fn bar(&self) -> U {
+LL +     fn bar(&self) -> impl Sized {
+   |
 
 error: method with return-position `impl Trait` in trait cannot be specialized
   --> $DIR/specialization-broken.rs:15:5
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 f620bf6dc389..46561b66c8ee 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
@@ -36,12 +36,14 @@ LL | fn elided2(x: &i32) -> impl Copy + 'static { x }
    |
 help: consider changing `impl Copy + 'static`'s explicit `'static` bound to the lifetime of argument `x`
    |
-LL | fn elided2(x: &i32) -> impl Copy + '_ { x }
-   |                                    ~~
+LL - fn elided2(x: &i32) -> impl Copy + 'static { x }
+LL + fn elided2(x: &i32) -> impl Copy + '_ { x }
+   |
 help: alternatively, add an explicit `'static` bound to this reference
    |
-LL | fn elided2(x: &'static i32) -> impl Copy + 'static { x }
-   |               ~~~~~~~~~~~~
+LL - fn elided2(x: &i32) -> impl Copy + 'static { x }
+LL + fn elided2(x: &'static i32) -> impl Copy + 'static { x }
+   |
 
 error: lifetime may not live long enough
   --> $DIR/must_outlive_least_region_or_bound.rs:12:55
@@ -51,12 +53,14 @@ LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x }
    |
 help: consider changing `impl Copy + 'static`'s explicit `'static` bound to the lifetime of argument `x`
    |
-LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'a { x }
-   |                                             ~~
+LL - fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x }
+LL + fn explicit2<'a>(x: &'a i32) -> impl Copy + 'a { x }
+   |
 help: alternatively, add an explicit `'static` bound to this reference
    |
-LL | fn explicit2<'a>(x: &'static i32) -> impl Copy + 'static { x }
-   |                     ~~~~~~~~~~~~
+LL - fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x }
+LL + fn explicit2<'a>(x: &'static i32) -> impl Copy + 'static { x }
+   |
 
 error[E0621]: explicit lifetime required in the type of `x`
   --> $DIR/must_outlive_least_region_or_bound.rs:15:41
@@ -91,12 +95,14 @@ LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
    |
 help: consider changing `impl LifetimeTrait<'a> + 'static`'s explicit `'static` bound to the lifetime of argument `x`
    |
-LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'a { x }
-   |                                                           ~~
+LL - fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
+LL + fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'a { x }
+   |
 help: alternatively, add an explicit `'static` bound to this reference
    |
-LL | fn with_bound<'a>(x: &'static i32) -> impl LifetimeTrait<'a> + 'static { x }
-   |                      ~~~~~~~~~~~~
+LL - fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
+LL + fn with_bound<'a>(x: &'static i32) -> impl LifetimeTrait<'a> + 'static { x }
+   |
 
 error[E0700]: hidden type for `impl Fn(&'a u32)` captures lifetime that does not appear in bounds
   --> $DIR/must_outlive_least_region_or_bound.rs:42:5
@@ -161,12 +167,14 @@ LL | fn elided4(x: &i32) -> Box { Box::new(x) }
    |
 help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `x`
    |
-LL | fn elided4(x: &i32) -> Box { Box::new(x) }
-   |                                        ~~
+LL - fn elided4(x: &i32) -> Box { Box::new(x) }
+LL + fn elided4(x: &i32) -> Box { Box::new(x) }
+   |
 help: alternatively, add an explicit `'static` bound to this reference
    |
-LL | fn elided4(x: &'static i32) -> Box { Box::new(x) }
-   |               ~~~~~~~~~~~~
+LL - fn elided4(x: &i32) -> Box { Box::new(x) }
+LL + fn elided4(x: &'static i32) -> Box { Box::new(x) }
+   |
 
 error: lifetime may not live long enough
   --> $DIR/must_outlive_least_region_or_bound.rs:27:60
@@ -176,12 +184,14 @@ LL | fn explicit4<'a>(x: &'a i32) -> Box { Box::new(x) }
    |
 help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `x`
    |
-LL | fn explicit4<'a>(x: &'a i32) -> Box { Box::new(x) }
-   |                                                 ~~
+LL - fn explicit4<'a>(x: &'a i32) -> Box { Box::new(x) }
+LL + fn explicit4<'a>(x: &'a i32) -> Box { Box::new(x) }
+   |
 help: alternatively, add an explicit `'static` bound to this reference
    |
-LL | fn explicit4<'a>(x: &'static i32) -> Box { Box::new(x) }
-   |                     ~~~~~~~~~~~~
+LL - fn explicit4<'a>(x: &'a i32) -> Box { Box::new(x) }
+LL + fn explicit4<'a>(x: &'static i32) -> Box { Box::new(x) }
+   |
 
 error: aborting due to 13 previous errors
 
diff --git a/tests/ui/impl-trait/no-method-suggested-traits.stderr b/tests/ui/impl-trait/no-method-suggested-traits.stderr
index 676247d1a423..af6d492c74d1 100644
--- a/tests/ui/impl-trait/no-method-suggested-traits.stderr
+++ b/tests/ui/impl-trait/no-method-suggested-traits.stderr
@@ -17,8 +17,9 @@ LL + use no_method_suggested_traits::qux::PrivPub;
    |
 help: there is a method `method2` with a similar name
    |
-LL |     1u32.method2();
-   |          ~~~~~~~
+LL -     1u32.method();
+LL +     1u32.method2();
+   |
 
 error[E0599]: no method named `method` found for struct `Rc<&mut Box<&u32>>` in the current scope
   --> $DIR/no-method-suggested-traits.rs:26:44
@@ -39,8 +40,9 @@ LL + use no_method_suggested_traits::qux::PrivPub;
    |
 help: there is a method `method2` with a similar name
    |
-LL |     std::rc::Rc::new(&mut Box::new(&1u32)).method2();
-   |                                            ~~~~~~~
+LL -     std::rc::Rc::new(&mut Box::new(&1u32)).method();
+LL +     std::rc::Rc::new(&mut Box::new(&1u32)).method2();
+   |
 
 error[E0599]: no method named `method` found for type `char` in the current scope
   --> $DIR/no-method-suggested-traits.rs:30:9
@@ -58,8 +60,9 @@ LL + use foo::Bar;
    |
 help: there is a method `method2` with a similar name
    |
-LL |     'a'.method2();
-   |         ~~~~~~~
+LL -     'a'.method();
+LL +     'a'.method2();
+   |
 
 error[E0599]: no method named `method` found for struct `Rc<&mut Box<&char>>` in the current scope
   --> $DIR/no-method-suggested-traits.rs:32:43
@@ -74,8 +77,9 @@ LL + use foo::Bar;
    |
 help: there is a method `method2` with a similar name
    |
-LL |     std::rc::Rc::new(&mut Box::new(&'a')).method2();
-   |                                           ~~~~~~~
+LL -     std::rc::Rc::new(&mut Box::new(&'a')).method();
+LL +     std::rc::Rc::new(&mut Box::new(&'a')).method2();
+   |
 
 error[E0599]: no method named `method` found for type `i32` in the current scope
   --> $DIR/no-method-suggested-traits.rs:35:10
@@ -95,8 +99,9 @@ LL + use no_method_suggested_traits::foo::PubPub;
    |
 help: there is a method `method3` with a similar name
    |
-LL |     1i32.method3();
-   |          ~~~~~~~
+LL -     1i32.method();
+LL +     1i32.method3();
+   |
 
 error[E0599]: no method named `method` found for struct `Rc<&mut Box<&i32>>` in the current scope
   --> $DIR/no-method-suggested-traits.rs:37:44
@@ -111,8 +116,9 @@ LL + use no_method_suggested_traits::foo::PubPub;
    |
 help: there is a method `method3` with a similar name
    |
-LL |     std::rc::Rc::new(&mut Box::new(&1i32)).method3();
-   |                                            ~~~~~~~
+LL -     std::rc::Rc::new(&mut Box::new(&1i32)).method();
+LL +     std::rc::Rc::new(&mut Box::new(&1i32)).method3();
+   |
 
 error[E0599]: no method named `method` found for struct `Foo` in the current scope
   --> $DIR/no-method-suggested-traits.rs:40:9
diff --git a/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr b/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr
index 6f0f287fe122..4198095db65f 100644
--- a/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr
+++ b/tests/ui/impl-trait/opaque-used-in-extraneous-argument.stderr
@@ -7,8 +7,9 @@ LL | fn frob() -> impl Fn + '_ {}
    = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
 help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values
    |
-LL | fn frob() -> impl Fn + 'static {}
-   |                                       ~~~~~~~
+LL - fn frob() -> impl Fn + '_ {}
+LL + fn frob() -> impl Fn + 'static {}
+   |
 
 error[E0412]: cannot find type `P` in this scope
   --> $DIR/opaque-used-in-extraneous-argument.rs:5:22
diff --git a/tests/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.stderr b/tests/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.stderr
index 17eaed436dfb..b2aa0e592df7 100644
--- a/tests/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.stderr
+++ b/tests/ui/impl-trait/point-to-type-err-cause-on-impl-trait-return.stderr
@@ -6,8 +6,9 @@ LL | fn hat() -> dyn std::fmt::Display {
    |
 help: consider returning an `impl Trait` instead of a `dyn Trait`
    |
-LL | fn hat() -> impl std::fmt::Display {
-   |             ~~~~
+LL - fn hat() -> dyn std::fmt::Display {
+LL + fn hat() -> impl std::fmt::Display {
+   |
 help: alternatively, box the return type, and wrap all of the returned values in `Box::new`
    |
 LL ~ fn hat() -> Box {
@@ -27,8 +28,9 @@ LL | fn pug() -> dyn std::fmt::Display {
    |
 help: consider returning an `impl Trait` instead of a `dyn Trait`
    |
-LL | fn pug() -> impl std::fmt::Display {
-   |             ~~~~
+LL - fn pug() -> dyn std::fmt::Display {
+LL + fn pug() -> impl std::fmt::Display {
+   |
 help: alternatively, box the return type, and wrap all of the returned values in `Box::new`
    |
 LL ~ fn pug() -> Box {
@@ -46,8 +48,9 @@ LL | fn man() -> dyn std::fmt::Display {
    |
 help: consider returning an `impl Trait` instead of a `dyn Trait`
    |
-LL | fn man() -> impl std::fmt::Display {
-   |             ~~~~
+LL - fn man() -> dyn std::fmt::Display {
+LL + fn man() -> impl std::fmt::Display {
+   |
 help: alternatively, box the return type, and wrap all of the returned values in `Box::new`
    |
 LL ~ fn man() -> Box {
@@ -68,8 +71,9 @@ LL |     1u32
    |
 help: change the type of the numeric literal from `u32` to `i32`
    |
-LL |     1i32
-   |      ~~~
+LL -     1u32
+LL +     1i32
+   |
 
 error[E0308]: mismatched types
   --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:12:16
@@ -82,8 +86,9 @@ LL |         return 1u32;
    |
 help: change the type of the numeric literal from `u32` to `i32`
    |
-LL |         return 1i32;
-   |                 ~~~
+LL -         return 1u32;
+LL +         return 1i32;
+   |
 
 error[E0308]: mismatched types
   --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:20:9
@@ -113,8 +118,9 @@ LL | |     }
    |
 help: you could change the return type to be a boxed trait object
    |
-LL | fn qux() -> Box {
-   |             ~~~~~~~                  +
+LL - fn qux() -> impl std::fmt::Display {
+LL + fn qux() -> Box {
+   |
 help: if you change the return type to expect trait objects, box the returned expressions
    |
 LL ~         Box::new(0i32)
@@ -123,8 +129,9 @@ LL ~         Box::new(1u32)
    |
 help: change the type of the numeric literal from `u32` to `i32`
    |
-LL |         1i32
-   |          ~~~
+LL -         1u32
+LL +         1i32
+   |
 
 error[E0308]: mismatched types
   --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:35:14
@@ -185,8 +192,9 @@ LL | |     }
    |
 help: you could change the return type to be a boxed trait object
    |
-LL | fn dog() -> Box {
-   |             ~~~~~~~                  +
+LL - fn dog() -> impl std::fmt::Display {
+LL + fn dog() -> Box {
+   |
 help: if you change the return type to expect trait objects, box the returned expressions
    |
 LL ~         0 => Box::new(0i32),
@@ -194,8 +202,9 @@ LL ~         1 => Box::new(1u32),
    |
 help: change the type of the numeric literal from `u32` to `i32`
    |
-LL |         1 => 1i32,
-   |               ~~~
+LL -         1 => 1u32,
+LL +         1 => 1i32,
+   |
 
 error[E0308]: `if` and `else` have incompatible types
   --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:97:9
@@ -211,8 +220,9 @@ LL | |     }
    |
 help: you could change the return type to be a boxed trait object
    |
-LL | fn apt() -> Box {
-   |             ~~~~~~~                  +
+LL - fn apt() -> impl std::fmt::Display {
+LL + fn apt() -> Box {
+   |
 help: if you change the return type to expect trait objects, box the returned expressions
    |
 LL ~         Box::new(0i32)
@@ -221,8 +231,9 @@ LL ~         Box::new(1u32)
    |
 help: change the type of the numeric literal from `u32` to `i32`
    |
-LL |         1i32
-   |          ~~~
+LL -         1u32
+LL +         1i32
+   |
 
 error: aborting due to 12 previous errors
 
diff --git a/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr b/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr
index a8acecf10c7b..c8dac3a69cd9 100644
--- a/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr
+++ b/tests/ui/impl-trait/precise-capturing/bad-lifetimes.stderr
@@ -7,8 +7,9 @@ LL | fn no_elided_lt() -> impl Sized + use<'_> {}
    = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
 help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values
    |
-LL | fn no_elided_lt() -> impl Sized + use<'static> {}
-   |                                       ~~~~~~~
+LL - fn no_elided_lt() -> impl Sized + use<'_> {}
+LL + fn no_elided_lt() -> impl Sized + use<'static> {}
+   |
 
 error[E0261]: use of undeclared lifetime name `'missing`
   --> $DIR/bad-lifetimes.rs:8:37
diff --git a/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.stderr b/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.stderr
index b0c4cc2fea0e..0d8fa650df47 100644
--- a/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.stderr
+++ b/tests/ui/impl-trait/precise-capturing/hidden-type-suggestion.stderr
@@ -80,8 +80,9 @@ LL | fn no_params_yet(_: impl Sized, y: &()) -> impl Sized {
    |                     ^^^^^^^^^^
 help: add a `use<...>` bound to explicitly capture `'_` after turning all argument-position `impl Trait` into type parameters, noting that this possibly affects the API of this crate
    |
-LL | fn no_params_yet(_: T, y: &()) -> impl Sized + use<'_, T> {
-   |                 ++++++++++    ~                        ++++++++++++
+LL - fn no_params_yet(_: impl Sized, y: &()) -> impl Sized {
+LL + fn no_params_yet(_: T, y: &()) -> impl Sized + use<'_, T> {
+   |
 
 error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds
   --> $DIR/hidden-type-suggestion.rs:36:5
@@ -101,8 +102,9 @@ LL | fn yes_params_yet<'a, T>(_: impl Sized, y: &'a ()) -> impl Sized {
    |                             ^^^^^^^^^^
 help: add a `use<...>` bound to explicitly capture `'a` after turning all argument-position `impl Trait` into type parameters, noting that this possibly affects the API of this crate
    |
-LL | fn yes_params_yet<'a, T, U: Sized>(_: U, y: &'a ()) -> impl Sized + use<'a, T, U> {
-   |                        ++++++++++     ~                           +++++++++++++++
+LL - fn yes_params_yet<'a, T>(_: impl Sized, y: &'a ()) -> impl Sized {
+LL + fn yes_params_yet<'a, T, U: Sized>(_: U, y: &'a ()) -> impl Sized + use<'a, T, U> {
+   |
 
 error: aborting due to 6 previous errors
 
diff --git a/tests/ui/impl-trait/precise-capturing/migration-note.stderr b/tests/ui/impl-trait/precise-capturing/migration-note.stderr
index 9caf7a201ef8..676b6c12f52a 100644
--- a/tests/ui/impl-trait/precise-capturing/migration-note.stderr
+++ b/tests/ui/impl-trait/precise-capturing/migration-note.stderr
@@ -305,8 +305,9 @@ LL | fn capture_apit(x: &impl Sized) -> impl Sized {}
    |                     ^^^^^^^^^^
 help: use the precise capturing `use<...>` syntax to make the captures explicit
    |
-LL | fn capture_apit(x: &T) -> impl Sized + use {}
-   |                ++++++++++     ~                ++++++++
+LL - fn capture_apit(x: &impl Sized) -> impl Sized {}
+LL + fn capture_apit(x: &T) -> impl Sized + use {}
+   |
 help: consider cloning the value if the performance cost is acceptable
    |
 LL |     let y = capture_apit(&x.clone());
diff --git a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr
index 965f8e7b6722..3f8511a21a06 100644
--- a/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr
+++ b/tests/ui/impl-trait/precise-capturing/overcaptures-2024.stderr
@@ -100,8 +100,9 @@ LL | fn apit(_: &impl Sized) -> impl Sized {}
    |             ^^^^^^^^^^
 help: use the precise capturing `use<...>` syntax to make the captures explicit
    |
-LL | fn apit(_: &T) -> impl Sized + use {}
-   |        ++++++++++     ~                ++++++++
+LL - fn apit(_: &impl Sized) -> impl Sized {}
+LL + fn apit(_: &T) -> impl Sized + use {}
+   |
 
 error: `impl Sized` will capture more lifetimes than possibly intended in edition 2024
   --> $DIR/overcaptures-2024.rs:37:38
@@ -124,8 +125,9 @@ LL | fn apit2(_: &impl Sized, _: U) -> impl Sized {}
    |                 ^^^^^^^^^^
 help: use the precise capturing `use<...>` syntax to make the captures explicit
    |
-LL | fn apit2(_: &T, _: U) -> impl Sized + use {}
-   |           ++++++++++      ~                      +++++++++++
+LL - fn apit2(_: &impl Sized, _: U) -> impl Sized {}
+LL + fn apit2(_: &T, _: U) -> impl Sized + use {}
+   |
 
 error: `impl Sized` will capture more lifetimes than possibly intended in edition 2024
   --> $DIR/overcaptures-2024.rs:41:37
diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr
index b127bf418003..767bd312407a 100644
--- a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr
+++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration-too-subtle.stderr
@@ -11,8 +11,9 @@ LL |         fn eq(&self, _other: &(Foo, i32)) -> bool {
               found signature `fn(&a::Bar, &(a::Foo, _)) -> _`
 help: change the parameter type to match the trait
    |
-LL |         fn eq(&self, _other: &(a::Bar, i32)) -> bool {
-   |                              ~~~~~~~~~~~~~~
+LL -         fn eq(&self, _other: &(Foo, i32)) -> bool {
+LL +         fn eq(&self, _other: &(a::Bar, i32)) -> bool {
+   |
 
 error: item does not constrain `a::Foo::{opaque#0}`, but has it in its signature
   --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:9:12
@@ -45,8 +46,9 @@ LL |         fn eq(&self, _other: &(Bar, i32)) -> bool {
    |            ^^
 help: change the parameter type to match the trait
    |
-LL |         fn eq(&self, _other: &(b::Foo, i32)) -> bool {
-   |                              ~~~~~~~~~~~~~~
+LL -         fn eq(&self, _other: &(Bar, i32)) -> bool {
+LL +         fn eq(&self, _other: &(b::Foo, i32)) -> bool {
+   |
 
 error: unconstrained opaque type
   --> $DIR/recursive-type-alias-impl-trait-declaration-too-subtle.rs:18:16
diff --git a/tests/ui/impl-trait/trait_type.stderr b/tests/ui/impl-trait/trait_type.stderr
index 989779a61783..ce5b2f1cca62 100644
--- a/tests/ui/impl-trait/trait_type.stderr
+++ b/tests/ui/impl-trait/trait_type.stderr
@@ -8,8 +8,9 @@ LL |    fn fmt(&self, x: &str) -> () { }
               found signature `fn(&MyType, &str) -> ()`
 help: change the parameter type to match the trait
    |
-LL |    fn fmt(&self, x: &mut Formatter<'_>) -> () { }
-   |                     ~~~~~~~~~~~~~~~~~~
+LL -    fn fmt(&self, x: &str) -> () { }
+LL +    fn fmt(&self, x: &mut Formatter<'_>) -> () { }
+   |
 
 error[E0050]: method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2
   --> $DIR/trait_type.rs:12:11
diff --git a/tests/ui/impl-trait/where-allowed.stderr b/tests/ui/impl-trait/where-allowed.stderr
index 400df87ca3ff..ebce9b7e445b 100644
--- a/tests/ui/impl-trait/where-allowed.stderr
+++ b/tests/ui/impl-trait/where-allowed.stderr
@@ -364,8 +364,9 @@ LL |     fn in_trait_impl_return() -> Self::Out;
    = note: distinct uses of `impl Trait` result in different opaque types
 help: change the output type to match the trait
    |
-LL |     fn in_trait_impl_return() -> <() as DummyTrait>::Out { () }
-   |                                  ~~~~~~~~~~~~~~~~~~~~~~~
+LL -     fn in_trait_impl_return() -> impl Debug { () }
+LL +     fn in_trait_impl_return() -> <() as DummyTrait>::Out { () }
+   |
 
 error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
   --> $DIR/where-allowed.rs:245:36
diff --git a/tests/ui/imports/bad-import-with-rename.stderr b/tests/ui/imports/bad-import-with-rename.stderr
index f9c5cf920e1f..a8e97d13c55a 100644
--- a/tests/ui/imports/bad-import-with-rename.stderr
+++ b/tests/ui/imports/bad-import-with-rename.stderr
@@ -6,8 +6,9 @@ LL |     use crate::D::B as _;
    |
 help: consider importing this type alias instead
    |
-LL |     use A::B as _;
-   |         ~~~~~~~~~
+LL -     use crate::D::B as _;
+LL +     use A::B as _;
+   |
 
 error[E0432]: unresolved import `crate::D::B2`
   --> $DIR/bad-import-with-rename.rs:10:9
@@ -17,8 +18,9 @@ LL |     use crate::D::B2;
    |
 help: consider importing this type alias instead
    |
-LL |     use A::B2;
-   |         ~~~~~
+LL -     use crate::D::B2;
+LL +     use A::B2;
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/imports/extern-crate-self/extern-crate-self-fail.stderr b/tests/ui/imports/extern-crate-self/extern-crate-self-fail.stderr
index 127765727b40..9a3ebfddc49c 100644
--- a/tests/ui/imports/extern-crate-self/extern-crate-self-fail.stderr
+++ b/tests/ui/imports/extern-crate-self/extern-crate-self-fail.stderr
@@ -6,8 +6,9 @@ LL | extern crate self;
    |
 help: rename the `self` crate to be able to import it
    |
-LL | extern crate self as name;
-   | ~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - extern crate self;
+LL + extern crate self as name;
+   |
 
 error: `#[macro_use]` is not supported on `extern crate self`
   --> $DIR/extern-crate-self-fail.rs:3:1
diff --git a/tests/ui/imports/glob-resolve1.stderr b/tests/ui/imports/glob-resolve1.stderr
index 4401ef58732e..6a48e36d3789 100644
--- a/tests/ui/imports/glob-resolve1.stderr
+++ b/tests/ui/imports/glob-resolve1.stderr
@@ -37,8 +37,9 @@ LL | |     }
    | |_____^
 help: you might have meant to use the following enum variant
    |
-LL |     B::B1;
-   |     ~~~~~
+LL -     B;
+LL +     B::B1;
+   |
 
 error[E0425]: cannot find value `C` in this scope
   --> $DIR/glob-resolve1.rs:29:5
diff --git a/tests/ui/imports/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr b/tests/ui/imports/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr
index 80cea1a83d93..def0676a0f82 100644
--- a/tests/ui/imports/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr
+++ b/tests/ui/imports/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr
@@ -7,7 +7,8 @@ LL | extern crate std;
    = note: `std` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL | extern crate std as other_std;
+LL - extern crate std;
+LL + extern crate std as other_std;
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/imports/issue-45829/import-self.stderr b/tests/ui/imports/issue-45829/import-self.stderr
index 3c9d4fe6ba6f..62bc559b7786 100644
--- a/tests/ui/imports/issue-45829/import-self.stderr
+++ b/tests/ui/imports/issue-45829/import-self.stderr
@@ -32,8 +32,9 @@ LL | use foo::{self};
    = note: `foo` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL | use foo::{self as other_foo};
-   |           ~~~~~~~~~~~~~~~~~
+LL - use foo::{self};
+LL + use foo::{self as other_foo};
+   |
 
 error[E0255]: the name `foo` is defined multiple times
   --> $DIR/import-self.rs:12:5
@@ -47,8 +48,9 @@ LL | use foo::self;
    = note: `foo` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL | use foo as other_foo;
-   |         ~~~~~~~~~~~~
+LL - use foo::self;
+LL + use foo as other_foo;
+   |
 
 error[E0252]: the name `A` is defined multiple times
   --> $DIR/import-self.rs:16:11
@@ -61,8 +63,9 @@ LL | use foo::{self as A};
    = note: `A` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL | use foo::{self as OtherA};
-   |           ~~~~~~~~~~~~~~
+LL - use foo::{self as A};
+LL + use foo::{self as OtherA};
+   |
 
 error: aborting due to 5 previous errors
 
diff --git a/tests/ui/imports/issue-45829/issue-45829.stderr b/tests/ui/imports/issue-45829/issue-45829.stderr
index c6835c3bd7aa..9fd0e5a76729 100644
--- a/tests/ui/imports/issue-45829/issue-45829.stderr
+++ b/tests/ui/imports/issue-45829/issue-45829.stderr
@@ -9,8 +9,9 @@ LL | use foo::{A, B as A};
    = note: `A` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL | use foo::{A, B as OtherA};
-   |                ~~~~~~~~~
+LL - use foo::{A, B as A};
+LL + use foo::{A, B as OtherA};
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/issue-45829/rename-extern-vs-use.stderr b/tests/ui/imports/issue-45829/rename-extern-vs-use.stderr
index 8f2f7bbac0c9..98fe16824ff7 100644
--- a/tests/ui/imports/issue-45829/rename-extern-vs-use.stderr
+++ b/tests/ui/imports/issue-45829/rename-extern-vs-use.stderr
@@ -9,7 +9,8 @@ LL | extern crate issue_45829_b as bar;
    = note: `bar` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL | extern crate issue_45829_b as other_bar;
+LL - extern crate issue_45829_b as bar;
+LL + extern crate issue_45829_b as other_bar;
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/imports/issue-45829/rename-extern-with-tab.stderr b/tests/ui/imports/issue-45829/rename-extern-with-tab.stderr
index ae26d1fd0bbc..346f2481c213 100644
--- a/tests/ui/imports/issue-45829/rename-extern-with-tab.stderr
+++ b/tests/ui/imports/issue-45829/rename-extern-with-tab.stderr
@@ -9,7 +9,8 @@ LL | extern  crate    issue_45829_b  as  issue_45829_a;
    = note: `issue_45829_a` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL | extern crate issue_45829_b as other_issue_45829_a;
+LL - extern  crate    issue_45829_b  as  issue_45829_a;
+LL + extern crate issue_45829_b as other_issue_45829_a;
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/imports/issue-45829/rename-extern.stderr b/tests/ui/imports/issue-45829/rename-extern.stderr
index 46560ef9244e..f99f433c6424 100644
--- a/tests/ui/imports/issue-45829/rename-extern.stderr
+++ b/tests/ui/imports/issue-45829/rename-extern.stderr
@@ -9,7 +9,8 @@ LL | extern crate issue_45829_b as issue_45829_a;
    = note: `issue_45829_a` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL | extern crate issue_45829_b as other_issue_45829_a;
+LL - extern crate issue_45829_b as issue_45829_a;
+LL + extern crate issue_45829_b as other_issue_45829_a;
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/imports/issue-45829/rename-use-vs-extern.stderr b/tests/ui/imports/issue-45829/rename-use-vs-extern.stderr
index fd4fb9db0b6d..e0647cd3ab68 100644
--- a/tests/ui/imports/issue-45829/rename-use-vs-extern.stderr
+++ b/tests/ui/imports/issue-45829/rename-use-vs-extern.stderr
@@ -9,8 +9,9 @@ LL | use std as issue_45829_b;
    = note: `issue_45829_b` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL | use std as other_issue_45829_b;
-   |         ~~~~~~~~~~~~~~~~~~~~~~
+LL - use std as issue_45829_b;
+LL + use std as other_issue_45829_b;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/issue-45829/rename-use-with-tabs.stderr b/tests/ui/imports/issue-45829/rename-use-with-tabs.stderr
index 178303bbc1d1..c2e63ffa91ea 100644
--- a/tests/ui/imports/issue-45829/rename-use-with-tabs.stderr
+++ b/tests/ui/imports/issue-45829/rename-use-with-tabs.stderr
@@ -9,8 +9,9 @@ LL | use foo::{A, bar::B    as    A};
    = note: `A` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL | use foo::{A, bar::B as OtherA};
-   |                     ~~~~~~~~~
+LL - use foo::{A, bar::B    as    A};
+LL + use foo::{A, bar::B as OtherA};
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/issue-45829/rename-with-path.stderr b/tests/ui/imports/issue-45829/rename-with-path.stderr
index a83fdb373243..45fdd46850e0 100644
--- a/tests/ui/imports/issue-45829/rename-with-path.stderr
+++ b/tests/ui/imports/issue-45829/rename-with-path.stderr
@@ -9,8 +9,9 @@ LL | use std::{collections::HashMap as A, sync::Arc as A};
    = note: `A` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL | use std::{collections::HashMap as A, sync::Arc as OtherA};
-   |                                                ~~~~~~~~~
+LL - use std::{collections::HashMap as A, sync::Arc as A};
+LL + use std::{collections::HashMap as A, sync::Arc as OtherA};
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/issue-45829/rename.stderr b/tests/ui/imports/issue-45829/rename.stderr
index 4977909487cf..dc5775e3d56d 100644
--- a/tests/ui/imports/issue-45829/rename.stderr
+++ b/tests/ui/imports/issue-45829/rename.stderr
@@ -9,8 +9,9 @@ LL | use std as core;
    = note: `core` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL | use std as other_core;
-   |         ~~~~~~~~~~~~~
+LL - use std as core;
+LL + use std as other_core;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/issue-56125.stderr b/tests/ui/imports/issue-56125.stderr
index 0c4a569c7ea7..81336d51df4c 100644
--- a/tests/ui/imports/issue-56125.stderr
+++ b/tests/ui/imports/issue-56125.stderr
@@ -6,14 +6,18 @@ LL |     use empty::issue_56125;
    |
 help: consider importing one of these modules instead
    |
-LL |     use crate::m3::last_segment::issue_56125;
-   |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LL |     use crate::m3::non_last_segment::non_last_segment::issue_56125;
-   |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LL |     use ::issue_56125::issue_56125;
-   |         ~~~~~~~~~~~~~~~~~~~~~~~~~~
-LL |     use ::issue_56125::last_segment::issue_56125;
-   |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     use empty::issue_56125;
+LL +     use crate::m3::last_segment::issue_56125;
+   |
+LL -     use empty::issue_56125;
+LL +     use crate::m3::non_last_segment::non_last_segment::issue_56125;
+   |
+LL -     use empty::issue_56125;
+LL +     use ::issue_56125::issue_56125;
+   |
+LL -     use empty::issue_56125;
+LL +     use ::issue_56125::last_segment::issue_56125;
+   |
      and 1 other candidate
 
 error[E0659]: `issue_56125` is ambiguous
diff --git a/tests/ui/imports/issue-57015.stderr b/tests/ui/imports/issue-57015.stderr
index f1ae78452417..d3b9cd21fba0 100644
--- a/tests/ui/imports/issue-57015.stderr
+++ b/tests/ui/imports/issue-57015.stderr
@@ -6,8 +6,9 @@ LL | use single_err::something;
    |
 help: consider importing this module instead
    |
-LL | use glob_ok::something;
-   |     ~~~~~~~~~~~~~~~~~~
+LL - use single_err::something;
+LL + use glob_ok::something;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/issue-59764.stderr b/tests/ui/imports/issue-59764.stderr
index 74525c9c88f5..1d31e3bda0de 100644
--- a/tests/ui/imports/issue-59764.stderr
+++ b/tests/ui/imports/issue-59764.stderr
@@ -182,8 +182,9 @@ LL |     use issue_59764::foo::makro as baz;
    = note: this could be because a macro annotated with `#[macro_export]` will be exported at the root of the crate instead of the module where it is defined
 help: a macro with this name exists at the root of the crate
    |
-LL |     use issue_59764::makro as baz;
-   |         ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     use issue_59764::foo::makro as baz;
+LL +     use issue_59764::makro as baz;
+   |
 
 error[E0432]: unresolved import `issue_59764::foo::makro`
   --> $DIR/issue-59764.rs:107:33
@@ -223,8 +224,9 @@ LL | use issue_59764::foo::makro;
    = note: this could be because a macro annotated with `#[macro_export]` will be exported at the root of the crate instead of the module where it is defined
 help: a macro with this name exists at the root of the crate
    |
-LL | use issue_59764::makro;
-   |     ~~~~~~~~~~~~~~~~~~
+LL - use issue_59764::foo::makro;
+LL + use issue_59764::makro;
+   |
 
 error[E0425]: cannot find function `bar` in this scope
   --> $DIR/issue-59764.rs:133:5
diff --git a/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr b/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr
index a84a6c42aa8d..4a5c85479d33 100644
--- a/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr
+++ b/tests/ui/imports/multiple-extern-by-macro-for-buitlin.stderr
@@ -14,7 +14,8 @@ LL | m!();
    = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: you can use `as` to change the binding name of the import
    |
-LL |         extern crate std as other_core;
+LL -         extern crate std as core;
+LL +         extern crate std as other_core;
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr b/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr
index 556d75a4dbb5..8b87ae93b4d5 100644
--- a/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr
+++ b/tests/ui/imports/multiple-extern-by-macro-for-custom.stderr
@@ -14,7 +14,8 @@ LL | m!();
    = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: you can use `as` to change the binding name of the import
    |
-LL |         extern crate std as other_empty;
+LL -         extern crate std as empty;
+LL +         extern crate std as other_empty;
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr b/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr
index ec34489f2323..9a9e538740d7 100644
--- a/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr
+++ b/tests/ui/imports/multiple-extern-by-macro-for-inexist.stderr
@@ -20,7 +20,8 @@ LL | m!();
    = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: you can use `as` to change the binding name of the import
    |
-LL |         extern crate std as other_non_existent;
+LL -         extern crate std as non_existent;
+LL +         extern crate std as other_non_existent;
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/imports/no-std-inject.stderr b/tests/ui/imports/no-std-inject.stderr
index 597ecdce9eb9..d3952a50cd31 100644
--- a/tests/ui/imports/no-std-inject.stderr
+++ b/tests/ui/imports/no-std-inject.stderr
@@ -7,8 +7,9 @@ LL | extern crate core;
    = note: `core` must be defined only once in the type namespace of this module
 help: you can use `as` to change the binding name of the import
    |
-LL | extern crate core as other_core;
-   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL - extern crate core;
+LL + extern crate core as other_core;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/private-std-reexport-suggest-public.stderr b/tests/ui/imports/private-std-reexport-suggest-public.stderr
index 222553235aaa..90d84bb4f5b4 100644
--- a/tests/ui/imports/private-std-reexport-suggest-public.stderr
+++ b/tests/ui/imports/private-std-reexport-suggest-public.stderr
@@ -15,8 +15,9 @@ note: ...and refers to the module `mem` which is defined here
    = note: you could import this directly
 help: import `mem` through the re-export
    |
-LL |     use std::mem;
-   |         ~~~~~~~~
+LL -     use foo::mem;
+LL +     use std::mem;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr
index 414eeee0fedc..c9cfe769aeb2 100644
--- a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr
+++ b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr
@@ -6,8 +6,9 @@ LL |     println!("Hello, {}!", crate::bar::do_the_thing);
    |
 help: a similar path exists
    |
-LL |     println!("Hello, {}!", crate::foo::bar::do_the_thing);
-   |                                   ~~~~~~~~
+LL -     println!("Hello, {}!", crate::bar::do_the_thing);
+LL +     println!("Hello, {}!", crate::foo::bar::do_the_thing);
+   |
 help: consider importing this module
    |
 LL + use foo::bar;
diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr
index 414eeee0fedc..c9cfe769aeb2 100644
--- a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr
+++ b/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr
@@ -6,8 +6,9 @@ LL |     println!("Hello, {}!", crate::bar::do_the_thing);
    |
 help: a similar path exists
    |
-LL |     println!("Hello, {}!", crate::foo::bar::do_the_thing);
-   |                                   ~~~~~~~~
+LL -     println!("Hello, {}!", crate::bar::do_the_thing);
+LL +     println!("Hello, {}!", crate::foo::bar::do_the_thing);
+   |
 help: consider importing this module
    |
 LL + use foo::bar;
diff --git a/tests/ui/include-macros/parent_dir.stderr b/tests/ui/include-macros/parent_dir.stderr
index 0470d5b1f1e3..23029e911203 100644
--- a/tests/ui/include-macros/parent_dir.stderr
+++ b/tests/ui/include-macros/parent_dir.stderr
@@ -7,8 +7,9 @@ LL |     let _ = include_str!("include-macros/file.txt");
    = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: there is a file with the same name in a different directory
    |
-LL |     let _ = include_str!("file.txt");
-   |                          ~~~~~~~~~~
+LL -     let _ = include_str!("include-macros/file.txt");
+LL +     let _ = include_str!("file.txt");
+   |
 
 error: couldn't read `$DIR/hello.rs`: $FILE_NOT_FOUND_MSG
   --> $DIR/parent_dir.rs:6:13
@@ -19,8 +20,9 @@ LL |     let _ = include_str!("hello.rs");
    = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: there is a file with the same name in a different directory
    |
-LL |     let _ = include_str!("../hello.rs");
-   |                          ~~~~~~~~~~~~~
+LL -     let _ = include_str!("hello.rs");
+LL +     let _ = include_str!("../hello.rs");
+   |
 
 error: couldn't read `$DIR/../../data.bin`: $FILE_NOT_FOUND_MSG
   --> $DIR/parent_dir.rs:8:13
@@ -31,8 +33,9 @@ LL |     let _ = include_bytes!("../../data.bin");
    = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: there is a file with the same name in a different directory
    |
-LL |     let _ = include_bytes!("data.bin");
-   |                            ~~~~~~~~~~
+LL -     let _ = include_bytes!("../../data.bin");
+LL +     let _ = include_bytes!("data.bin");
+   |
 
 error: couldn't read `$DIR/tests/ui/include-macros/file.txt`: $FILE_NOT_FOUND_MSG
   --> $DIR/parent_dir.rs:10:13
@@ -43,8 +46,9 @@ LL |     let _ = include_str!("tests/ui/include-macros/file.txt");
    = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: there is a file with the same name in a different directory
    |
-LL |     let _ = include_str!("file.txt");
-   |                          ~~~~~~~~~~
+LL -     let _ = include_str!("tests/ui/include-macros/file.txt");
+LL +     let _ = include_str!("file.txt");
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/inference/ambiguous_type_parameter.stderr b/tests/ui/inference/ambiguous_type_parameter.stderr
index 0674deb63ba0..835999121d61 100644
--- a/tests/ui/inference/ambiguous_type_parameter.stderr
+++ b/tests/ui/inference/ambiguous_type_parameter.stderr
@@ -6,8 +6,9 @@ LL |     InMemoryStore.get_raw(&String::default());
    |
 help: try using a fully qualified path to specify the expected types
    |
-LL |     >>::get_raw(&InMemoryStore, &String::default());
-   |     +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++             ~
+LL -     InMemoryStore.get_raw(&String::default());
+LL +     >>::get_raw(&InMemoryStore, &String::default());
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/inference/char-as-str-single.stderr b/tests/ui/inference/char-as-str-single.stderr
index 9149efe32407..5455a0fd7ee3 100644
--- a/tests/ui/inference/char-as-str-single.stderr
+++ b/tests/ui/inference/char-as-str-single.stderr
@@ -8,8 +8,9 @@ LL |     let _: char = "a";
    |
 help: if you meant to write a `char` literal, use single quotes
    |
-LL |     let _: char = 'a';
-   |                   ~~~
+LL -     let _: char = "a";
+LL +     let _: char = 'a';
+   |
 
 error[E0308]: mismatched types
   --> $DIR/char-as-str-single.rs:10:19
@@ -21,8 +22,9 @@ LL |     let _: char = "人";
    |
 help: if you meant to write a `char` literal, use single quotes
    |
-LL |     let _: char = '人';
-   |                   ~~~~
+LL -     let _: char = "人";
+LL +     let _: char = '人';
+   |
 
 error[E0308]: mismatched types
   --> $DIR/char-as-str-single.rs:11:19
@@ -34,8 +36,9 @@ LL |     let _: char = "'";
    |
 help: if you meant to write a `char` literal, use single quotes
    |
-LL |     let _: char = '\'';
-   |                   ~~~~
+LL -     let _: char = "'";
+LL +     let _: char = '\'';
+   |
 
 error[E0308]: mismatched types
   --> $DIR/char-as-str-single.rs:18:9
@@ -47,8 +50,9 @@ LL |         "A" => {}
    |
 help: if you meant to write a `char` literal, use single quotes
    |
-LL |         'A' => {}
-   |         ~~~
+LL -         "A" => {}
+LL +         'A' => {}
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/inference/inference_unstable.stderr b/tests/ui/inference/inference_unstable.stderr
index 51f086177dba..395dcb2661f1 100644
--- a/tests/ui/inference/inference_unstable.stderr
+++ b/tests/ui/inference/inference_unstable.stderr
@@ -65,8 +65,9 @@ LL |     assert_eq!(char::C, 1);
    = note: for more information, see issue #48919 
 help: use the fully qualified path to the associated const
    |
-LL |     assert_eq!(::C, 1);
-   |                ~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     assert_eq!(char::C, 1);
+LL +     assert_eq!(::C, 1);
+   |
 help: add `#![feature(assoc_const_ipu_iter)]` to the crate attributes to enable `inference_unstable_iterator::IpuIterator::C`
    |
 LL + #![feature(assoc_const_ipu_iter)]
diff --git a/tests/ui/inference/inference_unstable_featured.stderr b/tests/ui/inference/inference_unstable_featured.stderr
index b908c7142d4b..b267ca497de8 100644
--- a/tests/ui/inference/inference_unstable_featured.stderr
+++ b/tests/ui/inference/inference_unstable_featured.stderr
@@ -8,12 +8,14 @@ LL |     assert_eq!('x'.ipu_flatten(), 0);
    = note: candidate #2 is defined in an impl of the trait `IpuItertools` for the type `char`
 help: disambiguate the method for candidate #1
    |
-LL |     assert_eq!(IpuIterator::ipu_flatten(&'x'), 0);
-   |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     assert_eq!('x'.ipu_flatten(), 0);
+LL +     assert_eq!(IpuIterator::ipu_flatten(&'x'), 0);
+   |
 help: disambiguate the method for candidate #2
    |
-LL |     assert_eq!(IpuItertools::ipu_flatten(&'x'), 0);
-   |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     assert_eq!('x'.ipu_flatten(), 0);
+LL +     assert_eq!(IpuItertools::ipu_flatten(&'x'), 0);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/inference/issue-103587.stderr b/tests/ui/inference/issue-103587.stderr
index 589cb7ea7b13..bd6a9b71b86d 100644
--- a/tests/ui/inference/issue-103587.stderr
+++ b/tests/ui/inference/issue-103587.stderr
@@ -6,8 +6,9 @@ LL |     if let Some(_) == x {}
    |
 help: consider using `=` here
    |
-LL |     if let Some(_) = x {}
-   |                    ~
+LL -     if let Some(_) == x {}
+LL +     if let Some(_) = x {}
+   |
 
 error[E0308]: mismatched types
   --> $DIR/issue-103587.rs:7:8
diff --git a/tests/ui/inference/issue-12028.stderr b/tests/ui/inference/issue-12028.stderr
index 3d7fb13d4475..0d8ef1c938d4 100644
--- a/tests/ui/inference/issue-12028.stderr
+++ b/tests/ui/inference/issue-12028.stderr
@@ -7,8 +7,9 @@ LL |         self.input_stream(&mut stream);
    = note: cannot satisfy `<_ as StreamHasher>::S == ::S`
 help: try using a fully qualified path to specify the expected types
    |
-LL |         >::input_stream(self, &mut stream);
-   |         ++++++++++++++++++++++++++++++++++++    ~
+LL -         self.input_stream(&mut stream);
+LL +         >::input_stream(self, &mut stream);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/inference/issue-70082.stderr b/tests/ui/inference/issue-70082.stderr
index 442e7479a9eb..926ecff4a4fb 100644
--- a/tests/ui/inference/issue-70082.stderr
+++ b/tests/ui/inference/issue-70082.stderr
@@ -9,8 +9,9 @@ LL |     let y: f64 = 0.01f64 * 1i16.into();
    = note: cannot satisfy `>::Output == f64`
 help: try using a fully qualified path to specify the expected types
    |
-LL |     let y: f64 = 0.01f64 * >::into(1i16);
-   |                            +++++++++++++++++++++++    ~
+LL -     let y: f64 = 0.01f64 * 1i16.into();
+LL +     let y: f64 = 0.01f64 * >::into(1i16);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/inference/issue-71584.stderr b/tests/ui/inference/issue-71584.stderr
index 391d3e7613e0..4bbfef6c44af 100644
--- a/tests/ui/inference/issue-71584.stderr
+++ b/tests/ui/inference/issue-71584.stderr
@@ -9,8 +9,9 @@ LL |     d = d % n.into();
    = note: cannot satisfy `>::Output == u64`
 help: try using a fully qualified path to specify the expected types
    |
-LL |     d = d % >::into(n);
-   |             +++++++++++++++++++++++ ~
+LL -     d = d % n.into();
+LL +     d = d % >::into(n);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/inference/issue-72616.stderr b/tests/ui/inference/issue-72616.stderr
index 3848fcf61d90..31a0586301df 100644
--- a/tests/ui/inference/issue-72616.stderr
+++ b/tests/ui/inference/issue-72616.stderr
@@ -16,8 +16,9 @@ LL |         if String::from("a") == "a".try_into().unwrap() {}
              `String` implements `PartialEq`
 help: try using a fully qualified path to specify the expected types
    |
-LL |         if String::from("a") == <&str as TryInto>::try_into("a").unwrap() {}
-   |                                 +++++++++++++++++++++++++++++++   ~
+LL -         if String::from("a") == "a".try_into().unwrap() {}
+LL +         if String::from("a") == <&str as TryInto>::try_into("a").unwrap() {}
+   |
 
 error[E0283]: type annotations needed
   --> $DIR/issue-72616.rs:22:37
@@ -32,8 +33,9 @@ LL |         if String::from("a") == "a".try_into().unwrap() {}
    = note: required for `&str` to implement `TryInto<_>`
 help: try using a fully qualified path to specify the expected types
    |
-LL |         if String::from("a") == <&str as TryInto>::try_into("a").unwrap() {}
-   |                                 +++++++++++++++++++++++++++++++   ~
+LL -         if String::from("a") == "a".try_into().unwrap() {}
+LL +         if String::from("a") == <&str as TryInto>::try_into("a").unwrap() {}
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/inference/issue-72690.stderr b/tests/ui/inference/issue-72690.stderr
index 2d09f667ae2c..4926cf9e981b 100644
--- a/tests/ui/inference/issue-72690.stderr
+++ b/tests/ui/inference/issue-72690.stderr
@@ -22,8 +22,9 @@ LL |     String::from("x".as_ref());
            - impl AsRef for str;
 help: try using a fully qualified path to specify the expected types
    |
-LL |     String::from(>::as_ref("x"));
-   |                  ++++++++++++++++++++++++++   ~
+LL -     String::from("x".as_ref());
+LL +     String::from(>::as_ref("x"));
+   |
 
 error[E0283]: type annotations needed
   --> $DIR/issue-72690.rs:12:9
@@ -49,8 +50,9 @@ LL |     |x| String::from("x".as_ref());
            - impl AsRef for str;
 help: try using a fully qualified path to specify the expected types
    |
-LL |     |x| String::from(>::as_ref("x"));
-   |                      ++++++++++++++++++++++++++   ~
+LL -     |x| String::from("x".as_ref());
+LL +     |x| String::from(>::as_ref("x"));
+   |
 
 error[E0283]: type annotations needed for `&_`
   --> $DIR/issue-72690.rs:17:9
@@ -93,8 +95,9 @@ LL |     String::from("x".as_ref());
            - impl AsRef for str;
 help: try using a fully qualified path to specify the expected types
    |
-LL |     String::from(>::as_ref("x"));
-   |                  ++++++++++++++++++++++++++   ~
+LL -     String::from("x".as_ref());
+LL +     String::from(>::as_ref("x"));
+   |
 
 error[E0283]: type annotations needed
   --> $DIR/issue-72690.rs:28:5
@@ -120,8 +123,9 @@ LL |     String::from("x".as_ref());
            - impl AsRef for str;
 help: try using a fully qualified path to specify the expected types
    |
-LL |     String::from(>::as_ref("x"));
-   |                  ++++++++++++++++++++++++++   ~
+LL -     String::from("x".as_ref());
+LL +     String::from(>::as_ref("x"));
+   |
 
 error[E0283]: type annotations needed
   --> $DIR/issue-72690.rs:37:5
@@ -147,8 +151,9 @@ LL |     String::from("x".as_ref());
            - impl AsRef for str;
 help: try using a fully qualified path to specify the expected types
    |
-LL |     String::from(>::as_ref("x"));
-   |                  ++++++++++++++++++++++++++   ~
+LL -     String::from("x".as_ref());
+LL +     String::from(>::as_ref("x"));
+   |
 
 error[E0283]: type annotations needed
   --> $DIR/issue-72690.rs:46:5
@@ -174,8 +179,9 @@ LL |     String::from("x".as_ref());
            - impl AsRef for str;
 help: try using a fully qualified path to specify the expected types
    |
-LL |     String::from(>::as_ref("x"));
-   |                  ++++++++++++++++++++++++++   ~
+LL -     String::from("x".as_ref());
+LL +     String::from(>::as_ref("x"));
+   |
 
 error[E0283]: type annotations needed
   --> $DIR/issue-72690.rs:53:5
@@ -201,8 +207,9 @@ LL |     String::from("x".as_ref());
            - impl AsRef for str;
 help: try using a fully qualified path to specify the expected types
    |
-LL |     String::from(>::as_ref("x"));
-   |                  ++++++++++++++++++++++++++   ~
+LL -     String::from("x".as_ref());
+LL +     String::from(>::as_ref("x"));
+   |
 
 error[E0283]: type annotations needed
   --> $DIR/issue-72690.rs:62:5
@@ -228,8 +235,9 @@ LL |     String::from("x".as_ref());
            - impl AsRef for str;
 help: try using a fully qualified path to specify the expected types
    |
-LL |     String::from(>::as_ref("x"));
-   |                  ++++++++++++++++++++++++++   ~
+LL -     String::from("x".as_ref());
+LL +     String::from(>::as_ref("x"));
+   |
 
 error: aborting due to 17 previous errors
 
diff --git a/tests/ui/inference/issue-80816.stderr b/tests/ui/inference/issue-80816.stderr
index ab62db8e6af2..bca7cd4c3adb 100644
--- a/tests/ui/inference/issue-80816.stderr
+++ b/tests/ui/inference/issue-80816.stderr
@@ -21,8 +21,9 @@ LL | impl, P: Deref> Access for P {
    |            unsatisfied trait bound introduced here
 help: try using a fully qualified path to specify the expected types
    |
-LL |     let guard: Guard> = >> as Access>::load(&s);
-   |                                    ++++++++++++++++++++++++++++++++++++++++++++++++++ ~
+LL -     let guard: Guard> = s.load();
+LL +     let guard: Guard> = >> as Access>::load(&s);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/inference/str-as-char.stderr b/tests/ui/inference/str-as-char.stderr
index 4ca71c5f067f..2e70faa8cfac 100644
--- a/tests/ui/inference/str-as-char.stderr
+++ b/tests/ui/inference/str-as-char.stderr
@@ -6,8 +6,9 @@ LL |     let _: &str = '"""';
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL |     let _: &str = "\"\"\"";
-   |                   ~~~~~~~~
+LL -     let _: &str = '"""';
+LL +     let _: &str = "\"\"\"";
+   |
 
 error: character literal may only contain one codepoint
   --> $DIR/str-as-char.rs:9:19
@@ -17,8 +18,9 @@ LL |     let _: &str = '\"\"\"';
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL |     let _: &str = "\"\"\"";
-   |                   ~      ~
+LL -     let _: &str = '\"\"\"';
+LL +     let _: &str = "\"\"\"";
+   |
 
 error: character literal may only contain one codepoint
   --> $DIR/str-as-char.rs:10:19
@@ -28,8 +30,9 @@ LL |     let _: &str = '"\"\"\\"\\"';
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL |     let _: &str = "\"\"\\"\\"\\\"";
-   |                   ~~~~~~~~~~~~~~~~~~~~
+LL -     let _: &str = '"\"\"\\"\\"';
+LL +     let _: &str = "\"\"\\"\\"\\\"";
+   |
 
 error[E0308]: mismatched types
   --> $DIR/str-as-char.rs:7:19
@@ -41,8 +44,9 @@ LL |     let _: &str = 'a';
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL |     let _: &str = "a";
-   |                   ~ ~
+LL -     let _: &str = 'a';
+LL +     let _: &str = "a";
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/infinite/infinite-assoc.stderr b/tests/ui/infinite/infinite-assoc.stderr
index e6b91f132413..c55d85942a4a 100644
--- a/tests/ui/infinite/infinite-assoc.stderr
+++ b/tests/ui/infinite/infinite-assoc.stderr
@@ -6,8 +6,9 @@ LL | struct A((A, ::T));
    |
 help: if you meant to express that the type might not contain a value, use the `Option` wrapper type
    |
-LL | struct A((A, ::T>));
-   |                              +++++++         ~
+LL - struct A((A, ::T));
+LL + struct A((A, ::T>));
+   |
 
 error[E0072]: recursive type `A` has infinite size
   --> $DIR/infinite-assoc.rs:12:1
diff --git a/tests/ui/inline-const/cross-const-control-flow-125846.stderr b/tests/ui/inline-const/cross-const-control-flow-125846.stderr
index 4aa1c273504c..0a910e70d09e 100644
--- a/tests/ui/inline-const/cross-const-control-flow-125846.stderr
+++ b/tests/ui/inline-const/cross-const-control-flow-125846.stderr
@@ -26,8 +26,9 @@ LL |     const { &x };
    |
 help: consider using `const` instead of `let`
    |
-LL |     const x: /* Type */ = 1;
-   |     ~~~~~  ++++++++++++
+LL -     let x = 1;
+LL +     const x: /* Type */ = 1;
+   |
 
 error[E0728]: `await` is only allowed inside `async` functions and blocks
   --> $DIR/cross-const-control-flow-125846.rs:35:22
diff --git a/tests/ui/invalid/invalid-rustc_legacy_const_generics-issue-123077.stderr b/tests/ui/invalid/invalid-rustc_legacy_const_generics-issue-123077.stderr
index 7e05ae4f20c5..d92836aa063b 100644
--- a/tests/ui/invalid/invalid-rustc_legacy_const_generics-issue-123077.stderr
+++ b/tests/ui/invalid/invalid-rustc_legacy_const_generics-issue-123077.stderr
@@ -6,8 +6,9 @@ LL |     std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, || ());
    |
 help: try using a const generic argument instead
    |
-LL |     std::arch::x86_64::_mm_blend_ps::<{ || () }>(loop {}, loop {});
-   |                                    +++++++++++++ ~~~~~~~~~~~~~~~~
+LL -     std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, || ());
+LL +     std::arch::x86_64::_mm_blend_ps::<{ || () }>(loop {}, loop {});
+   |
 
 error: invalid argument to a legacy const generic: cannot have const blocks, closures, async blocks or items
   --> $DIR/invalid-rustc_legacy_const_generics-issue-123077.rs:11:59
@@ -17,8 +18,9 @@ LL |     std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, 5 + || ());
    |
 help: try using a const generic argument instead
    |
-LL |     std::arch::x86_64::_mm_blend_ps::<{ 5 + (|| ()) }>(loop {}, loop {});
-   |                                    +++++++++++++++++++ ~~~~~~~~~~~~~~~~
+LL -     std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, 5 + || ());
+LL +     std::arch::x86_64::_mm_blend_ps::<{ 5 + (|| ()) }>(loop {}, loop {});
+   |
 
 error: invalid argument to a legacy const generic: cannot have const blocks, closures, async blocks or items
   --> $DIR/invalid-rustc_legacy_const_generics-issue-123077.rs:14:61
@@ -28,8 +30,9 @@ LL |     std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, foo::<{ 1 + 2 }>());
    |
 help: try using a const generic argument instead
    |
-LL |     std::arch::x86_64::_mm_blend_ps::<{ foo::<{ 1 + 2 }>() }>(loop {}, loop {});
-   |                                    ++++++++++++++++++++++++++ ~~~~~~~~~~~~~~~~
+LL -     std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, foo::<{ 1 + 2 }>());
+LL +     std::arch::x86_64::_mm_blend_ps::<{ foo::<{ 1 + 2 }>() }>(loop {}, loop {});
+   |
 
 error: invalid argument to a legacy const generic: cannot have const blocks, closures, async blocks or items
   --> $DIR/invalid-rustc_legacy_const_generics-issue-123077.rs:17:61
@@ -39,8 +42,9 @@ LL |     std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, foo::<3>());
    |
 help: try using a const generic argument instead
    |
-LL |     std::arch::x86_64::_mm_blend_ps::<{ foo::<3>() }>(loop {}, loop {});
-   |                                    ++++++++++++++++++ ~~~~~~~~~~~~~~~~
+LL -     std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, foo::<3>());
+LL +     std::arch::x86_64::_mm_blend_ps::<{ foo::<3>() }>(loop {}, loop {});
+   |
 
 error: invalid argument to a legacy const generic: cannot have const blocks, closures, async blocks or items
   --> $DIR/invalid-rustc_legacy_const_generics-issue-123077.rs:20:56
@@ -50,8 +54,9 @@ LL |     std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, &const {});
    |
 help: try using a const generic argument instead
    |
-LL |     std::arch::x86_64::_mm_blend_ps::<{ &const {} }>(loop {}, loop {});
-   |                                    +++++++++++++++++ ~~~~~~~~~~~~~~~~
+LL -     std::arch::x86_64::_mm_blend_ps(loop {}, loop {}, &const {});
+LL +     std::arch::x86_64::_mm_blend_ps::<{ &const {} }>(loop {}, loop {});
+   |
 
 error: invalid argument to a legacy const generic: cannot have const blocks, closures, async blocks or items
   --> $DIR/invalid-rustc_legacy_const_generics-issue-123077.rs:24:9
@@ -75,8 +80,9 @@ LL |     std::arch::x86_64::_mm_inserti_si64(loop {}, loop {}, || (), 1 + || ())
    |
 help: try using a const generic argument instead
    |
-LL |     std::arch::x86_64::_mm_inserti_si64::<{ || () }, { 1 + (|| ()) }>(loop {}, loop {});
-   |                                        ++++++++++++++++++++++++++++++ ~~~~~~~~~~~~~~~~
+LL -     std::arch::x86_64::_mm_inserti_si64(loop {}, loop {}, || (), 1 + || ());
+LL +     std::arch::x86_64::_mm_inserti_si64::<{ || () }, { 1 + (|| ()) }>(loop {}, loop {});
+   |
 
 error: aborting due to 7 previous errors
 
diff --git a/tests/ui/issues/issue-13497.stderr b/tests/ui/issues/issue-13497.stderr
index 7630848f6a51..8016b55d6aad 100644
--- a/tests/ui/issues/issue-13497.stderr
+++ b/tests/ui/issues/issue-13497.stderr
@@ -11,8 +11,9 @@ LL |     &'static str
    |      +++++++
 help: instead, you are more likely to want to return an owned value
    |
-LL |     String
-   |     ~~~~~~
+LL -     &str
+LL +     String
+   |
 
 error[E0515]: cannot return value referencing local variable `rawLines`
   --> $DIR/issue-13497.rs:5:5
diff --git a/tests/ui/issues/issue-17546.stderr b/tests/ui/issues/issue-17546.stderr
index cf7ed1bbd668..25a94dd97232 100644
--- a/tests/ui/issues/issue-17546.stderr
+++ b/tests/ui/issues/issue-17546.stderr
@@ -9,12 +9,14 @@ LL |     fn new() -> NoResult {
    |
 help: try using the variant's enum
    |
-LL |     fn new() -> foo::MyEnum {
-   |                 ~~~~~~~~~~~
+LL -     fn new() -> NoResult {
+LL +     fn new() -> foo::MyEnum {
+   |
 help: an enum with a similar name exists
    |
-LL |     fn new() -> Result {
-   |                 ~~~~~~
+LL -     fn new() -> NoResult {
+LL +     fn new() -> Result {
+   |
 
 error[E0573]: expected type, found variant `Result`
   --> $DIR/issue-17546.rs:24:17
@@ -61,12 +63,14 @@ LL | fn newer() -> NoResult {
    |
 help: try using the variant's enum
    |
-LL | fn newer() -> foo::MyEnum {
-   |               ~~~~~~~~~~~
+LL - fn newer() -> NoResult {
+LL + fn newer() -> foo::MyEnum {
+   |
 help: an enum with a similar name exists
    |
-LL | fn newer() -> Result {
-   |               ~~~~~~
+LL - fn newer() -> NoResult {
+LL + fn newer() -> Result {
+   |
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/issues/issue-17800.stderr b/tests/ui/issues/issue-17800.stderr
index 2a15af50d02a..322c77eaa1dc 100644
--- a/tests/ui/issues/issue-17800.stderr
+++ b/tests/ui/issues/issue-17800.stderr
@@ -6,8 +6,9 @@ LL |         MyOption::MySome { x: 42 } => (),
    |
 help: use the tuple variant pattern syntax instead
    |
-LL |         MyOption::MySome(42) => (),
-   |                         ~~~~
+LL -         MyOption::MySome { x: 42 } => (),
+LL +         MyOption::MySome(42) => (),
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/issues/issue-18107.stderr b/tests/ui/issues/issue-18107.stderr
index 6956d6a34aa2..177ef2f1c33f 100644
--- a/tests/ui/issues/issue-18107.stderr
+++ b/tests/ui/issues/issue-18107.stderr
@@ -6,8 +6,9 @@ LL |     dyn AbstractRenderer
    |
 help: consider returning an `impl Trait` instead of a `dyn Trait`
    |
-LL |     impl AbstractRenderer
-   |     ~~~~
+LL -     dyn AbstractRenderer
+LL +     impl AbstractRenderer
+   |
 help: alternatively, box the return type, and wrap all of the returned values in `Box::new`
    |
 LL ~     Box
diff --git a/tests/ui/issues/issue-18446.stderr b/tests/ui/issues/issue-18446.stderr
index 08a9cfc644f4..25ae303e902b 100644
--- a/tests/ui/issues/issue-18446.stderr
+++ b/tests/ui/issues/issue-18446.stderr
@@ -16,8 +16,9 @@ LL |     fn foo(&self) {}
    |     ^^^^^^^^^^^^^
 help: disambiguate the method for candidate #1
    |
-LL |     T::foo(&x);
-   |     ~~~~~~~~~~
+LL -     x.foo();
+LL +     T::foo(&x);
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/issues/issue-20225.stderr b/tests/ui/issues/issue-20225.stderr
index 7d6b09cf7f89..6a3c4e2a836e 100644
--- a/tests/ui/issues/issue-20225.stderr
+++ b/tests/ui/issues/issue-20225.stderr
@@ -10,8 +10,9 @@ LL |   extern "rust-call" fn call(&self, (_,): (T,)) {}
               found signature `extern "rust-call" fn(&Foo, (_,))`
 help: change the parameter type to match the trait
    |
-LL |   extern "rust-call" fn call(&self, (_,): (&'a T,)) {}
-   |                                           ~~~~~~~~
+LL -   extern "rust-call" fn call(&self, (_,): (T,)) {}
+LL +   extern "rust-call" fn call(&self, (_,): (&'a T,)) {}
+   |
 
 error[E0053]: method `call_mut` has an incompatible type for trait
   --> $DIR/issue-20225.rs:11:51
@@ -25,8 +26,9 @@ LL |   extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
               found signature `extern "rust-call" fn(&mut Foo, (_,))`
 help: change the parameter type to match the trait
    |
-LL |   extern "rust-call" fn call_mut(&mut self, (_,): (&'a T,)) {}
-   |                                                   ~~~~~~~~
+LL -   extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {}
+LL +   extern "rust-call" fn call_mut(&mut self, (_,): (&'a T,)) {}
+   |
 
 error[E0053]: method `call_once` has an incompatible type for trait
   --> $DIR/issue-20225.rs:18:47
@@ -41,8 +43,9 @@ LL |   extern "rust-call" fn call_once(self, (_,): (T,)) {}
               found signature `extern "rust-call" fn(Foo, (_,))`
 help: change the parameter type to match the trait
    |
-LL |   extern "rust-call" fn call_once(self, (_,): (&'a T,)) {}
-   |                                               ~~~~~~~~
+LL -   extern "rust-call" fn call_once(self, (_,): (T,)) {}
+LL +   extern "rust-call" fn call_once(self, (_,): (&'a T,)) {}
+   |
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/issues/issue-21332.stderr b/tests/ui/issues/issue-21332.stderr
index 7c960f7646db..237b3acc9b4d 100644
--- a/tests/ui/issues/issue-21332.stderr
+++ b/tests/ui/issues/issue-21332.stderr
@@ -8,8 +8,9 @@ LL |     fn next(&mut self) -> Result { Ok(7) }
               found signature `fn(&mut S) -> Result`
 help: change the output type to match the trait
    |
-LL |     fn next(&mut self) -> Option { Ok(7) }
-   |                           ~~~~~~~~~~~
+LL -     fn next(&mut self) -> Result { Ok(7) }
+LL +     fn next(&mut self) -> Option { Ok(7) }
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/issues/issue-23041.stderr b/tests/ui/issues/issue-23041.stderr
index 0142926dd156..bd0e457fa9da 100644
--- a/tests/ui/issues/issue-23041.stderr
+++ b/tests/ui/issues/issue-23041.stderr
@@ -6,8 +6,9 @@ LL |     b.downcast_ref::_>();
    |
 help: consider specifying the generic argument
    |
-LL |     b.downcast_ref:: _>();
-   |                   ~~~~~~~~~~~~~~
+LL -     b.downcast_ref::_>();
+LL +     b.downcast_ref:: _>();
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/issues/issue-23073.stderr b/tests/ui/issues/issue-23073.stderr
index 6a61df8d46b2..8aa86887bcfc 100644
--- a/tests/ui/issues/issue-23073.stderr
+++ b/tests/ui/issues/issue-23073.stderr
@@ -6,8 +6,9 @@ LL |     type FooT = <::Foo>::T;
    |
 help: if there were a trait named `Example` with associated type `T` implemented for `::Foo`, you could use the fully-qualified path
    |
-LL |     type FooT = <::Foo as Example>::T;
-   |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL -     type FooT = <::Foo>::T;
+LL +     type FooT = <::Foo as Example>::T;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/issues/issue-23217.stderr b/tests/ui/issues/issue-23217.stderr
index d14da75ab72e..830d260f99d7 100644
--- a/tests/ui/issues/issue-23217.stderr
+++ b/tests/ui/issues/issue-23217.stderr
@@ -8,8 +8,9 @@ LL |     B = SomeEnum::A,
    |
 help: there is a variant with a similar name
    |
-LL |     B = SomeEnum::B,
-   |                   ~
+LL -     B = SomeEnum::A,
+LL +     B = SomeEnum::B,
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/issues/issue-23589.stderr b/tests/ui/issues/issue-23589.stderr
index 21d383b0e8ce..726efea1d6f6 100644
--- a/tests/ui/issues/issue-23589.stderr
+++ b/tests/ui/issues/issue-23589.stderr
@@ -6,8 +6,9 @@ LL |     let v: Vec(&str) = vec!['1', '2'];
    |
 help: use angle brackets instead
    |
-LL |     let v: Vec<&str> = vec!['1', '2'];
-   |               ~    ~
+LL -     let v: Vec(&str) = vec!['1', '2'];
+LL +     let v: Vec<&str> = vec!['1', '2'];
+   |
 
 error[E0308]: mismatched types
   --> $DIR/issue-23589.rs:2:29
@@ -17,8 +18,9 @@ LL |     let v: Vec(&str) = vec!['1', '2'];
    |
 help: if you meant to write a string literal, use double quotes
    |
-LL |     let v: Vec(&str) = vec!["1", '2'];
-   |                             ~ ~
+LL -     let v: Vec(&str) = vec!['1', '2'];
+LL +     let v: Vec(&str) = vec!["1", '2'];
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/issues/issue-27433.stderr b/tests/ui/issues/issue-27433.stderr
index f6d5fc2b768f..d8fd3d84ecbb 100644
--- a/tests/ui/issues/issue-27433.stderr
+++ b/tests/ui/issues/issue-27433.stderr
@@ -6,8 +6,9 @@ LL |     const FOO : u32 = foo;
    |
 help: consider using `let` instead of `const`
    |
-LL |     let FOO : u32 = foo;
-   |     ~~~
+LL -     const FOO : u32 = foo;
+LL +     let FOO : u32 = foo;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/issues/issue-28971.stderr b/tests/ui/issues/issue-28971.stderr
index 7ca57d6b9981..fd689a2b36ee 100644
--- a/tests/ui/issues/issue-28971.stderr
+++ b/tests/ui/issues/issue-28971.stderr
@@ -9,8 +9,9 @@ LL |             Foo::Baz(..) => (),
    |
 help: there is a variant with a similar name
    |
-LL |             Foo::Bar(..) => (),
-   |                  ~~~
+LL -             Foo::Baz(..) => (),
+LL +             Foo::Bar(..) => (),
+   |
 
 error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
   --> $DIR/issue-28971.rs:15:5
diff --git a/tests/ui/issues/issue-32004.stderr b/tests/ui/issues/issue-32004.stderr
index 2d2ed5a63015..88395cd85209 100644
--- a/tests/ui/issues/issue-32004.stderr
+++ b/tests/ui/issues/issue-32004.stderr
@@ -11,12 +11,14 @@ LL |         Foo::Bar => {}
    |
 help: use the tuple variant pattern syntax instead
    |
-LL |         Foo::Bar(_) => {}
-   |         ~~~~~~~~~~~
+LL -         Foo::Bar => {}
+LL +         Foo::Bar(_) => {}
+   |
 help: a unit variant with a similar name exists
    |
-LL |         Foo::Baz => {}
-   |              ~~~
+LL -         Foo::Bar => {}
+LL +         Foo::Baz => {}
+   |
 
 error[E0532]: expected tuple struct or tuple variant, found unit struct `S`
   --> $DIR/issue-32004.rs:16:9
diff --git a/tests/ui/issues/issue-34209.stderr b/tests/ui/issues/issue-34209.stderr
index 4c61d250f52d..83b40d0c0816 100644
--- a/tests/ui/issues/issue-34209.stderr
+++ b/tests/ui/issues/issue-34209.stderr
@@ -9,8 +9,9 @@ LL |         S::B {} => {},
    |
 help: there is a variant with a similar name
    |
-LL |         S::A {} => {},
-   |            ~
+LL -         S::B {} => {},
+LL +         S::A {} => {},
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/issues/issue-3521-2.stderr b/tests/ui/issues/issue-3521-2.stderr
index a12241cb1dfd..ecf1ad0403d3 100644
--- a/tests/ui/issues/issue-3521-2.stderr
+++ b/tests/ui/issues/issue-3521-2.stderr
@@ -6,8 +6,9 @@ LL |     static y: isize = foo + 1;
    |
 help: consider using `let` instead of `static`
    |
-LL |     let y: isize = foo + 1;
-   |     ~~~
+LL -     static y: isize = foo + 1;
+LL +     let y: isize = foo + 1;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668-2.stderr b/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668-2.stderr
index 9661dbf2f62f..f87514ba83b0 100644
--- a/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668-2.stderr
+++ b/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668-2.stderr
@@ -6,8 +6,9 @@ LL |     static child: isize = x + 1;
    |
 help: consider using `let` instead of `static`
    |
-LL |     let child: isize = x + 1;
-   |     ~~~
+LL -     static child: isize = x + 1;
+LL +     let child: isize = x + 1;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668.stderr b/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668.stderr
index 7fad45f4b1a2..06e0192d9574 100644
--- a/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668.stderr
+++ b/tests/ui/issues/issue-3668-non-constant-value-in-constant/issue-3668.stderr
@@ -6,8 +6,9 @@ LL |        static childVal: Box

= self.child.get(); | help: consider using `let` instead of `static` | -LL | let childVal: Box

= self.child.get(); - | ~~~ +LL - static childVal: Box

= self.child.get(); +LL + let childVal: Box

{}
\n", out.into_inner()) }; expect_file!["fixtures/sample.html"].assert_eq(&html); @@ -37,7 +37,7 @@ fn test_dos_backline() { println!(\"foo\");\r\n\ }\r\n"; let mut html = Buffer::new(); - write_code(&mut html, src, None, None); + write_code(&mut html, src, None, None, None); expect_file!["fixtures/dos_line.html"].assert_eq(&html.into_inner()); }); } @@ -51,7 +51,7 @@ let x = super::b::foo; let y = Self::whatever;"; let mut html = Buffer::new(); - write_code(&mut html, src, None, None); + write_code(&mut html, src, None, None, None); expect_file!["fixtures/highlight.html"].assert_eq(&html.into_inner()); }); } @@ -61,7 +61,7 @@ fn test_union_highlighting() { create_default_session_globals_then(|| { let src = include_str!("fixtures/union.rs"); let mut html = Buffer::new(); - write_code(&mut html, src, None, None); + write_code(&mut html, src, None, None, None); expect_file!["fixtures/union.html"].assert_eq(&html.into_inner()); }); } @@ -78,7 +78,7 @@ let a = 4;"; decorations.insert("example2", vec![(22, 32)]); let mut html = Buffer::new(); - write_code(&mut html, src, None, Some(&DecorationInfo(decorations))); + write_code(&mut html, src, None, Some(&DecorationInfo(decorations)), None); expect_file!["fixtures/decorations.html"].assert_eq(&html.into_inner()); }); } diff --git a/tests/rustdoc-gui/basic-code.goml b/tests/rustdoc-gui/basic-code.goml deleted file mode 100644 index 22ac53161842..000000000000 --- a/tests/rustdoc-gui/basic-code.goml +++ /dev/null @@ -1,6 +0,0 @@ -// Small test to ensure the "src-line-numbers" element is only present once on -// the page. -go-to: "file://" + |DOC_PATH| + "/test_docs/index.html" -click: "a.src" -wait-for: ".src-line-numbers" -assert-count: (".src-line-numbers", 1) diff --git a/tests/rustdoc-gui/docblock-code-block-line-number.goml b/tests/rustdoc-gui/docblock-code-block-line-number.goml index 3c16626336ea..032746a6bdf4 100644 --- a/tests/rustdoc-gui/docblock-code-block-line-number.goml +++ b/tests/rustdoc-gui/docblock-code-block-line-number.goml @@ -111,28 +111,6 @@ wait-for: "pre.example-line-numbers" // Same check with scraped examples line numbers. go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" -assert-css: ( - ".scraped-example .src-line-numbers > pre", - { - // There should not be a radius on the right of the line numbers. - "border-top-left-radius": "6px", - "border-bottom-left-radius": "6px", - "border-top-right-radius": "0px", - "border-bottom-right-radius": "0px", - }, - ALL, -) -assert-css: ( - ".scraped-example .src-line-numbers", - { - // There should not be a radius on the right of the line numbers. - "border-top-left-radius": "6px", - "border-bottom-left-radius": "6px", - "border-top-right-radius": "0px", - "border-bottom-right-radius": "0px", - }, - ALL, -) assert-css: ( ".scraped-example .rust", { @@ -149,23 +127,15 @@ define-function: ( "check-padding", [path, padding_bottom], block { - assert-css: (|path| + " .src-line-numbers", { + assert-css: (|path| + " span[data-nosnippet]", { "padding-top": "0px", "padding-bottom": "0px", - "padding-left": "0px", - "padding-right": "0px", - }, ALL) - assert-css: (|path| + " .src-line-numbers > pre", { - "padding-top": "14px", - "padding-bottom": |padding_bottom|, - "padding-left": "0px", - "padding-right": "0px", - }, ALL) - assert-css: (|path| + " .src-line-numbers > pre > span", { - "padding-top": "0px", - "padding-bottom": "0px", - "padding-left": "8px", - "padding-right": "8px", + "padding-left": "4px", + "padding-right": "4px", + "margin-right": "20px", + "margin-left": "0px", + "margin-top": "0px", + "margin-bottom": "0px", }, ALL) }, ) @@ -196,13 +166,13 @@ define-function: ("check-line-numbers-existence", [], block { wait-for-local-storage-false: {"rustdoc-line-numbers": "true" } assert-false: ".example-line-numbers" // Line numbers should still be there. - assert: ".src-line-numbers" + assert-css: ("[data-nosnippet]", { "display": "inline-block"}) // Now disabling the setting. click: "input#line-numbers" wait-for-local-storage: {"rustdoc-line-numbers": "true" } assert-false: ".example-line-numbers" // Line numbers should still be there. - assert: ".src-line-numbers" + assert-css: ("[data-nosnippet]", { "display": "inline-block"}) // Closing settings menu. click: "#settings-menu" wait-for-css: ("#settings", {"display": "none"}) @@ -214,18 +184,16 @@ call-function: ("check-line-numbers-existence", {}) // Now checking the line numbers in the source code page. click: ".src" -assert-css: (".src-line-numbers", { - "padding-top": "20px", - "padding-bottom": "20px", - "padding-left": "4px", - "padding-right": "0px", -}) -assert-css: (".src-line-numbers > a", { +assert-css: ("a[data-nosnippet]", { "padding-top": "0px", "padding-bottom": "0px", - "padding-left": "8px", - "padding-right": "8px", -}) + "padding-left": "4px", + "padding-right": "4px", + "margin-top": "0px", + "margin-bottom": "0px", + "margin-left": "0px", + "margin-right": "20px", +}, ALL) // Checking that turning off the line numbers setting won't remove line numbers. call-function: ("check-line-numbers-existence", {}) diff --git a/tests/rustdoc-gui/jump-to-def-background.goml b/tests/rustdoc-gui/jump-to-def-background.goml index 71320360740c..de5ea6c9b0b0 100644 --- a/tests/rustdoc-gui/jump-to-def-background.goml +++ b/tests/rustdoc-gui/jump-to-def-background.goml @@ -8,7 +8,7 @@ define-function: ( block { call-function: ("switch-theme", {"theme": |theme|}) assert-css: ( - "body.src .example-wrap pre.rust a", + "body.src .example-wrap pre.rust a:not([data-nosnippet])", {"background-color": |background_color|}, ALL, ) diff --git a/tests/rustdoc-gui/scrape-examples-button-focus.goml b/tests/rustdoc-gui/scrape-examples-button-focus.goml index 83ed6a219b25..d53993ac08ba 100644 --- a/tests/rustdoc-gui/scrape-examples-button-focus.goml +++ b/tests/rustdoc-gui/scrape-examples-button-focus.goml @@ -4,52 +4,18 @@ go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test.html" // The next/prev buttons vertically scroll the code viewport between examples move-cursor-to: ".scraped-example-list > .scraped-example" -store-property: (".scraped-example-list > .scraped-example .src-line-numbers", { - "scrollTop": initialScrollTop, -}) +wait-for: ".scraped-example-list > .scraped-example .next" +store-value: (initialScrollTop, 250) assert-property: (".scraped-example-list > .scraped-example .rust", { "scrollTop": |initialScrollTop|, -}) +}, NEAR) focus: ".scraped-example-list > .scraped-example .next" press-key: "Enter" -assert-property-false: (".scraped-example-list > .scraped-example .src-line-numbers", { - "scrollTop": |initialScrollTop| -}, NEAR) assert-property-false: (".scraped-example-list > .scraped-example .rust", { "scrollTop": |initialScrollTop| }, NEAR) focus: ".scraped-example-list > .scraped-example .prev" press-key: "Enter" -assert-property: (".scraped-example-list > .scraped-example .src-line-numbers", { - "scrollTop": |initialScrollTop| -}, NEAR) assert-property: (".scraped-example-list > .scraped-example .rust", { "scrollTop": |initialScrollTop| }, NEAR) - -// The expand button increases the scrollHeight of the minimized code viewport -store-property: (".scraped-example-list > .scraped-example pre", {"offsetHeight": smallOffsetHeight}) -assert-property: (".scraped-example-list > .scraped-example .src-line-numbers", { - "scrollHeight": |smallOffsetHeight| -}, NEAR) -assert-property: (".scraped-example-list > .scraped-example .rust", { - "scrollHeight": |smallOffsetHeight| -}, NEAR) -focus: ".scraped-example-list > .scraped-example .expand" -press-key: "Enter" -assert-property-false: (".scraped-example-list > .scraped-example .src-line-numbers", { - "offsetHeight": |smallOffsetHeight| -}, NEAR) -assert-property-false: (".scraped-example-list > .scraped-example .rust", { - "offsetHeight": |smallOffsetHeight| -}, NEAR) -store-property: (".scraped-example-list > .scraped-example .src-line-numbers", { - "offsetHeight": fullOffsetHeight, -}) -assert-property: (".scraped-example-list > .scraped-example .rust", { - "offsetHeight": |fullOffsetHeight|, - "scrollHeight": |fullOffsetHeight|, -}) -assert-property: (".scraped-example-list > .scraped-example .src-line-numbers", { - "scrollHeight": |fullOffsetHeight| -}, NEAR) diff --git a/tests/rustdoc-gui/scrape-examples-layout.goml b/tests/rustdoc-gui/scrape-examples-layout.goml index 5187ac486b08..85a3b2a62873 100644 --- a/tests/rustdoc-gui/scrape-examples-layout.goml +++ b/tests/rustdoc-gui/scrape-examples-layout.goml @@ -3,35 +3,38 @@ go-to: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html" set-window-size: (1000, 1000) +// We move the mouse over the scraped example for the prev button to be generated. +move-cursor-to: ".scraped-example" + // Check that it's not zero. assert-property-false: ( - ".more-scraped-examples .scraped-example .src-line-numbers", + ".more-scraped-examples .scraped-example span[data-nosnippet]", {"clientWidth": "0"} ) // Check that examples with very long lines have the same width as ones that don't. store-property: ( - ".more-scraped-examples .scraped-example:nth-child(2) .src-line-numbers", + ".more-scraped-examples .scraped-example:nth-child(2) span[data-nosnippet]", {"clientWidth": clientWidth}, ) assert-property: ( - ".more-scraped-examples .scraped-example:nth-child(3) .src-line-numbers", + ".more-scraped-examples .scraped-example:nth-child(3) span[data-nosnippet]", {"clientWidth": |clientWidth|} ) assert-property: ( - ".more-scraped-examples .scraped-example:nth-child(4) .src-line-numbers", + ".more-scraped-examples .scraped-example:nth-child(4) span[data-nosnippet]", {"clientWidth": |clientWidth|} ) assert-property: ( - ".more-scraped-examples .scraped-example:nth-child(5) .src-line-numbers", + ".more-scraped-examples .scraped-example:nth-child(5) span[data-nosnippet]", {"clientWidth": |clientWidth|} ) assert-property: ( - ".more-scraped-examples .scraped-example:nth-child(6) .src-line-numbers", + ".more-scraped-examples .scraped-example:nth-child(6) span[data-nosnippet]", {"clientWidth": |clientWidth|} ) @@ -55,25 +58,6 @@ assert-size: (".more-scraped-examples .scraped-example .example-wrap", { "width": |width|, }) -// Check that the expand button works and also that line number aligns with code. -move-cursor-to: ".scraped-example .rust" -click: ".scraped-example .button-holder .expand" -wait-for: ".scraped-example.expanded" -// They should have the same y position. -compare-elements-position: ( - ".scraped-example.expanded .src-line-numbers pre span", - ".scraped-example.expanded .rust code", - ["y"], -) -// And they should have the same height. -compare-elements-size: ( - ".scraped-example.expanded .src-line-numbers", - ".scraped-example.expanded .rust", - ["height"], -) -// Collapse code again. -click: ".scraped-example .button-holder .expand" - // Check that for both mobile and desktop sizes, the buttons in scraped examples are displayed // correctly. @@ -98,7 +82,7 @@ define-function: ( [], block { // Title should be above the code. - store-position: (".scraped-example .example-wrap .src-line-numbers", {"x": x, "y": y}) + store-position: (".scraped-example .example-wrap", {"x": x, "y": y}) store-size: (".scraped-example .scraped-example-title", { "height": title_height }) assert-position: (".scraped-example .scraped-example-title", { @@ -107,10 +91,13 @@ define-function: ( }) // Line numbers should be right beside the code. - compare-elements-position: ( - ".scraped-example .example-wrap .src-line-numbers", - ".scraped-example .example-wrap .rust", - ["y"], + compare-elements-position-near: ( + ".scraped-example .example-wrap span[data-nosnippet]", + // On the first line, the code starts with `fn main` so we have a keyword. + ".scraped-example .example-wrap .rust span.kw", + // They're not exactly the same size but since they're on the same line, + // it's kinda the same. + {"y": 2}, ) } ) diff --git a/tests/rustdoc-gui/source-anchor-scroll.goml b/tests/rustdoc-gui/source-anchor-scroll.goml index 4ad65bbbd61a..c005af1e7a1c 100644 --- a/tests/rustdoc-gui/source-anchor-scroll.goml +++ b/tests/rustdoc-gui/source-anchor-scroll.goml @@ -8,13 +8,13 @@ set-window-size: (600, 800) assert-property: ("html", {"scrollTop": "0"}) click: '//a[text() = "barbar" and @href="#5-7"]' -assert-property: ("html", {"scrollTop": "208"}) +assert-property: ("html", {"scrollTop": "206"}) click: '//a[text() = "bar" and @href="#28-36"]' assert-property: ("html", {"scrollTop": "239"}) click: '//a[normalize-space() = "sub_fn" and @href="#2-4"]' -assert-property: ("html", {"scrollTop": "136"}) +assert-property: ("html", {"scrollTop": "134"}) // We now check that clicking on lines doesn't change the scroll // Extra information: the "sub_fn" function header is on line 1. click: '//*[@id="6"]' -assert-property: ("html", {"scrollTop": "136"}) +assert-property: ("html", {"scrollTop": "134"}) diff --git a/tests/rustdoc-gui/source-code-page-code-scroll.goml b/tests/rustdoc-gui/source-code-page-code-scroll.goml index 60012db6c8c8..c15a9ae7983c 100644 --- a/tests/rustdoc-gui/source-code-page-code-scroll.goml +++ b/tests/rustdoc-gui/source-code-page-code-scroll.goml @@ -2,7 +2,7 @@ go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" set-window-size: (800, 1000) // "scrollWidth" should be superior than "clientWidth". -assert-property: ("body", {"scrollWidth": 1776, "clientWidth": 800}) +assert-property: ("body", {"scrollWidth": 1780, "clientWidth": 800}) // Both properties should be equal (ie, no scroll on the code block). -assert-property: (".example-wrap .rust", {"scrollWidth": 1662, "clientWidth": 1662}) +assert-property: (".example-wrap .rust", {"scrollWidth": 1715, "clientWidth": 1715}) diff --git a/tests/rustdoc-gui/source-code-page.goml b/tests/rustdoc-gui/source-code-page.goml index afb194625210..aa5a16aac704 100644 --- a/tests/rustdoc-gui/source-code-page.goml +++ b/tests/rustdoc-gui/source-code-page.goml @@ -3,7 +3,7 @@ include: "utils.goml" go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" show-text: true // Check that we can click on the line number. -click: ".src-line-numbers > a:nth-child(4)" // This is the anchor for line 4. +click: "//a[@data-nosnippet and text()='4']" // This is the anchor for line 4. // Ensure that the page URL was updated. assert-document-property: ({"URL": "lib.rs.html#4"}, ENDS_WITH) assert-attribute: ("//*[@id='4']", {"class": "line-highlighted"}) @@ -14,11 +14,11 @@ assert-attribute: ("//*[@id='4']", {"class": "line-highlighted"}) assert-css: ("//*[@id='4']", {"border-right-width": "0px"}) // We now check that the good anchors are highlighted go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html#4-6" -assert-attribute-false: (".src-line-numbers > a:nth-child(3)", {"class": "line-highlighted"}) -assert-attribute: (".src-line-numbers > a:nth-child(4)", {"class": "line-highlighted"}) -assert-attribute: (".src-line-numbers > a:nth-child(5)", {"class": "line-highlighted"}) -assert-attribute: (".src-line-numbers > a:nth-child(6)", {"class": "line-highlighted"}) -assert-attribute-false: (".src-line-numbers > a:nth-child(7)", {"class": "line-highlighted"}) +assert-attribute-false: ("//a[@data-nosnippet and text()='3']", {"class": "line-highlighted"}) +assert-attribute: ("//a[@data-nosnippet and text()='4']", {"class": "line-highlighted"}) +assert-attribute: ("//a[@data-nosnippet and text()='5']", {"class": "line-highlighted"}) +assert-attribute: ("//a[@data-nosnippet and text()='6']", {"class": "line-highlighted"}) +assert-attribute-false: ("//a[@data-nosnippet and text()='7']", {"class": "line-highlighted"}) define-function: ( "check-colors", @@ -26,12 +26,12 @@ define-function: ( block { call-function: ("switch-theme", {"theme": |theme|}) assert-css: ( - ".src-line-numbers > a:not(.line-highlighted)", + "a[data-nosnippet]:not(.line-highlighted)", {"color": |color|, "background-color": |background_color|}, ALL, ) assert-css: ( - ".src-line-numbers > a.line-highlighted", + "a[data-nosnippet].line-highlighted", {"color": |highlight_color|, "background-color": |highlight_background_color|}, ALL, ) @@ -61,37 +61,37 @@ call-function: ("check-colors", { }) // This is to ensure that the content is correctly align with the line numbers. -compare-elements-position: ("//*[@id='1']", ".rust > code > span", ["y"]) +compare-elements-position-near: ("//*[@id='1']", ".rust > code > span", {"y": 2}) // Check the `href` property so that users can treat anchors as links. -assert-property: (".src-line-numbers > a:nth-child(1)", { +assert-property: ("//a[@data-nosnippet and text()='1']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#1" }, ENDS_WITH) -assert-property: (".src-line-numbers > a:nth-child(2)", { +assert-property: ("//a[@data-nosnippet and text()='2']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#2" }, ENDS_WITH) -assert-property: (".src-line-numbers > a:nth-child(3)", { +assert-property: ("//a[@data-nosnippet and text()='3']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#3" }, ENDS_WITH) -assert-property: (".src-line-numbers > a:nth-child(4)", { +assert-property: ("//a[@data-nosnippet and text()='4']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#4" }, ENDS_WITH) -assert-property: (".src-line-numbers > a:nth-child(5)", { +assert-property: ("//a[@data-nosnippet and text()='5']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#5" }, ENDS_WITH) -assert-property: (".src-line-numbers > a:nth-child(6)", { +assert-property: ("//a[@data-nosnippet and text()='6']", { "href": |DOC_PATH| + "/src/test_docs/lib.rs.html#6" }, ENDS_WITH) // Assert that the line numbers text is aligned to the right. -assert-css: (".src-line-numbers", {"text-align": "right"}) +assert-css: ("a[data-nosnippet]", {"text-align": "right"}, ALL) // Now let's check that clicking on something else than the line number doesn't // do anything (and certainly not add a `#NaN` to the URL!). go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" // We use this assert-position to know where we will click. -assert-position: ("//*[@id='1']", {"x": 88, "y": 171}) -// We click on the left of the "1" anchor but still in the "src-line-number" `
`.
-click: (163, 77)
+assert-position: ("//*[@id='1']", {"x": 81, "y": 169})
+// We click on the left of the "1" anchor but still in the `a[data-nosnippet]`.
+click: (77, 163)
 assert-document-property: ({"URL": "/lib.rs.html"}, ENDS_WITH)
 
 // Checking the source code sidebar.
diff --git a/tests/rustdoc/check-source-code-urls-to-def.rs b/tests/rustdoc/check-source-code-urls-to-def.rs
index 8703287abc55..d701b88bf9fd 100644
--- a/tests/rustdoc/check-source-code-urls-to-def.rs
+++ b/tests/rustdoc/check-source-code-urls-to-def.rs
@@ -31,7 +31,8 @@ fn babar() {}
 //@ has - '//pre[@class="rust"]//a/@href' '/struct.String.html'
 //@ has - '//pre[@class="rust"]//a/@href' '/primitive.u32.html'
 //@ has - '//pre[@class="rust"]//a/@href' '/primitive.str.html'
-//@ count - '//pre[@class="rust"]//a[@href="#23"]' 5
+// The 5 links to line 23 and the line 23 itself.
+//@ count - '//pre[@class="rust"]//a[@href="#23"]' 6
 //@ has - '//pre[@class="rust"]//a[@href="../../source_code/struct.SourceCode.html"]' \
 //        'source_code::SourceCode'
 pub fn foo(a: u32, b: &str, c: String, d: Foo, e: bar::Bar, f: source_code::SourceCode) {
@@ -50,8 +51,8 @@ pub fn foo2(t: &T, v: &V, b: bool) {}
 pub trait AnotherTrait {}
 pub trait WhyNot {}
 
-//@ has - '//pre[@class="rust"]//a[@href="#50"]' 'AnotherTrait'
-//@ has - '//pre[@class="rust"]//a[@href="#51"]' 'WhyNot'
+//@ has - '//pre[@class="rust"]//a[@href="#51"]' 'AnotherTrait'
+//@ has - '//pre[@class="rust"]//a[@href="#52"]' 'WhyNot'
 pub fn foo3(t: &T, v: &V)
 where
     T: AnotherTrait,
@@ -60,7 +61,7 @@ where
 
 pub trait AnotherTrait2 {}
 
-//@ has - '//pre[@class="rust"]//a[@href="#61"]' 'AnotherTrait2'
+//@ has - '//pre[@class="rust"]//a[@href="#62"]' 'AnotherTrait2'
 pub fn foo4() {
     let x: Vec<&dyn AnotherTrait2> = Vec::new();
 }

From 9e0c8b67e9fdb0dd2045f986536aa612d0746714 Mon Sep 17 00:00:00 2001
From: Guillaume Gomez 
Date: Mon, 10 Feb 2025 18:49:09 +0100
Subject: [PATCH 089/128] Add regression test for source line numbers

---
 tests/rustdoc/source-line-numbers.rs | 35 ++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 tests/rustdoc/source-line-numbers.rs

diff --git a/tests/rustdoc/source-line-numbers.rs b/tests/rustdoc/source-line-numbers.rs
new file mode 100644
index 000000000000..0b654b1a0047
--- /dev/null
+++ b/tests/rustdoc/source-line-numbers.rs
@@ -0,0 +1,35 @@
+// This test ensures that we have the expected number of line generated.
+
+#![crate_name = "foo"]
+
+//@ has 'src/foo/source-line-numbers.rs.html'
+//@ count - '//a[@data-nosnippet]' 35
+//@ has - '//a[@id="35"]' '35'
+
+#[
+macro_export
+]
+macro_rules! bar {
+    ($x:ident) => {{
+        $x += 2;
+        $x *= 2;
+    }}
+}
+
+/*
+multi line
+comment
+*/
+fn x(_: u8, _: u8) {}
+
+fn foo() {
+    let mut y = 0;
+    bar!(y);
+    println!("
+    {y}
+    ");
+    x(
+      1,
+      2,
+    );
+}

From 9222b05d9fb29c465058cbac744fd9c054f8ec1a Mon Sep 17 00:00:00 2001
From: Guillaume Gomez 
Date: Tue, 11 Feb 2025 11:56:47 +0100
Subject: [PATCH 090/128] Correctly handle `user-select: none`

---
 src/librustdoc/html/static/css/rustdoc.css | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index 613407cbe1f1..f39c0e4a3140 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -900,7 +900,9 @@ both the code example and the line numbers, so we need to remove the radius in t
 	min-width: fit-content; /* prevent collapsing into nothing in truncated scraped examples */
 	flex-grow: 0;
 	text-align: right;
+	-moz-user-select: none;
 	-webkit-user-select: none;
+	-ms-user-select: none;
 	user-select: none;
 	padding: 14px 8px;
 	padding-right: 2px;
@@ -940,6 +942,9 @@ both the code example and the line numbers, so we need to remove the radius in t
 	text-align: right;
 	display: inline-block;
 	margin-right: 20px;
+	-moz-user-select: none;
+	-webkit-user-select: none;
+	-ms-user-select: none;
 	user-select: none;
 	padding: 0 4px;
 }

From 909d43b38cfafe85a806b8a51b0718539885e756 Mon Sep 17 00:00:00 2001
From: onur-ozkan 
Date: Sun, 9 Feb 2025 11:44:14 +0300
Subject: [PATCH 091/128] add `Builder::is_host_target`

Signed-off-by: onur-ozkan 
---
 src/bootstrap/src/core/build_steps/compile.rs |  4 ++--
 src/bootstrap/src/core/build_steps/dist.rs    |  6 +++---
 src/bootstrap/src/core/build_steps/llvm.rs    |  6 +++---
 src/bootstrap/src/core/build_steps/test.rs    |  2 +-
 src/bootstrap/src/core/sanity.rs              |  2 +-
 src/bootstrap/src/lib.rs                      | 11 ++++++++---
 6 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index f6f9067b9c6f..980383c38157 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -191,7 +191,7 @@ impl Step for Std {
         // The LLD wrappers and `rust-lld` are self-contained linking components that can be
         // necessary to link the stdlib on some targets. We'll also need to copy these binaries to
         // the `stage0-sysroot` to ensure the linker is found when bootstrapping on such a target.
-        if compiler.stage == 0 && compiler.host == builder.config.build {
+        if compiler.stage == 0 && builder.is_host_target(&compiler.host) {
             // We want to copy the host `bin` folder within the `rustlib` folder in the sysroot.
             let src_sysroot_bin = builder
                 .rustc_snapshot_sysroot()
@@ -2312,7 +2312,7 @@ pub fn strip_debug(builder: &Builder<'_>, target: TargetSelection, path: &Path)
     // FIXME: to make things simpler for now, limit this to the host and target where we know
     // `strip -g` is both available and will fix the issue, i.e. on a x64 linux host that is not
     // cross-compiling. Expand this to other appropriate targets in the future.
-    if target != "x86_64-unknown-linux-gnu" || target != builder.config.build || !path.exists() {
+    if target != "x86_64-unknown-linux-gnu" || !builder.is_host_target(&target) || !path.exists() {
         return;
     }
 
diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs
index 18f920b85eee..22c3be60499d 100644
--- a/src/bootstrap/src/core/build_steps/dist.rs
+++ b/src/bootstrap/src/core/build_steps/dist.rs
@@ -582,7 +582,7 @@ impl Step for DebuggerScripts {
 fn skip_host_target_lib(builder: &Builder<'_>, compiler: Compiler) -> bool {
     // The only true set of target libraries came from the build triple, so
     // let's reduce redundant work by only producing archives from that host.
-    if compiler.host != builder.config.build {
+    if !builder.is_host_target(&compiler.host) {
         builder.info("\tskipping, not a build host");
         true
     } else {
@@ -637,7 +637,7 @@ fn copy_target_libs(
     for (path, dependency_type) in builder.read_stamp_file(stamp) {
         if dependency_type == DependencyType::TargetSelfContained {
             builder.copy_link(&path, &self_contained_dst.join(path.file_name().unwrap()));
-        } else if dependency_type == DependencyType::Target || builder.config.build == target {
+        } else if dependency_type == DependencyType::Target || builder.is_host_target(&target) {
             builder.copy_link(&path, &dst.join(path.file_name().unwrap()));
         }
     }
@@ -786,7 +786,7 @@ impl Step for Analysis {
     fn run(self, builder: &Builder<'_>) -> Option {
         let compiler = self.compiler;
         let target = self.target;
-        if compiler.host != builder.config.build {
+        if !builder.is_host_target(&compiler.host) {
             return None;
         }
 
diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs
index 9dd350570621..00485c5a2312 100644
--- a/src/bootstrap/src/core/build_steps/llvm.rs
+++ b/src/bootstrap/src/core/build_steps/llvm.rs
@@ -516,7 +516,7 @@ impl Step for Llvm {
         }
 
         // https://llvm.org/docs/HowToCrossCompileLLVM.html
-        if target != builder.config.build {
+        if !builder.is_host_target(&target) {
             let LlvmResult { llvm_config, .. } =
                 builder.ensure(Llvm { target: builder.config.build });
             if !builder.config.dry_run() {
@@ -661,7 +661,7 @@ fn configure_cmake(
     }
     cfg.target(&target.triple).host(&builder.config.build.triple);
 
-    if target != builder.config.build {
+    if !builder.is_host_target(&target) {
         cfg.define("CMAKE_CROSSCOMPILING", "True");
 
         if target.contains("netbsd") {
@@ -1111,7 +1111,7 @@ impl Step for Lld {
             .define("LLVM_CMAKE_DIR", llvm_cmake_dir)
             .define("LLVM_INCLUDE_TESTS", "OFF");
 
-        if target != builder.config.build {
+        if !builder.is_host_target(&target) {
             // Use the host llvm-tblgen binary.
             cfg.define(
                 "LLVM_TABLEGEN_EXE",
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index c452f4cd6ae0..259a6c4b1cb3 100644
--- a/src/bootstrap/src/core/build_steps/test.rs
+++ b/src/bootstrap/src/core/build_steps/test.rs
@@ -2742,7 +2742,7 @@ impl Step for Crate {
             cargo
         } else {
             // Also prepare a sysroot for the target.
-            if builder.config.build != target {
+            if !builder.is_host_target(&target) {
                 builder.ensure(compile::Std::new(compiler, target).force_recompile(true));
                 builder.ensure(RemoteCopyLibs { compiler, target });
             }
diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs
index 6c8cda18548e..8055a724e339 100644
--- a/src/bootstrap/src/core/sanity.rs
+++ b/src/bootstrap/src/core/sanity.rs
@@ -329,7 +329,7 @@ than building it.
         if target.contains("musl") && !target.contains("unikraft") {
             // If this is a native target (host is also musl) and no musl-root is given,
             // fall back to the system toolchain in /usr before giving up
-            if build.musl_root(*target).is_none() && build.config.build == *target {
+            if build.musl_root(*target).is_none() && build.is_host_target(target) {
                 let target = build.config.target_config.entry(*target).or_default();
                 target.musl_root = Some("/usr".into());
             }
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index e564a4b97514..440c9e782da6 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -739,7 +739,7 @@ impl Build {
     /// Note that if LLVM is configured externally then the directory returned
     /// will likely be empty.
     fn llvm_out(&self, target: TargetSelection) -> PathBuf {
-        if self.config.llvm_from_ci && self.config.build == target {
+        if self.config.llvm_from_ci && self.is_host_target(&target) {
             self.config.ci_llvm_root()
         } else {
             self.out.join(target).join("llvm")
@@ -789,7 +789,7 @@ impl Build {
     fn is_system_llvm(&self, target: TargetSelection) -> bool {
         match self.config.target_config.get(&target) {
             Some(Target { llvm_config: Some(_), .. }) => {
-                let ci_llvm = self.config.llvm_from_ci && target == self.config.build;
+                let ci_llvm = self.config.llvm_from_ci && self.is_host_target(&target);
                 !ci_llvm
             }
             // We're building from the in-tree src/llvm-project sources.
@@ -1274,7 +1274,7 @@ Executed at: {executed_at}"#,
             // need to use CXX compiler as linker to resolve the exception functions
             // that are only existed in CXX libraries
             Some(self.cxx.borrow()[&target].path().into())
-        } else if target != self.config.build
+        } else if !self.is_host_target(&target)
             && helpers::use_host_linker(target)
             && !target.is_msvc()
         {
@@ -1925,6 +1925,11 @@ to download LLVM rather than building it.
         stream.reset().unwrap();
         result
     }
+
+    /// Checks if the given target is the same as the host target.
+    fn is_host_target(&self, target: &TargetSelection) -> bool {
+        &self.config.build == target
+    }
 }
 
 #[cfg(unix)]

From 61ba728b18f892d704d8a062027d81880f4958b8 Mon Sep 17 00:00:00 2001
From: onur-ozkan 
Date: Sun, 9 Feb 2025 11:51:15 +0300
Subject: [PATCH 092/128] add coverage for `Builder::is_host_target`

Signed-off-by: onur-ozkan 
---
 src/bootstrap/src/core/builder/tests.rs | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs
index 994975ed5a8b..5718c84f3148 100644
--- a/src/bootstrap/src/core/builder/tests.rs
+++ b/src/bootstrap/src/core/builder/tests.rs
@@ -1065,3 +1065,18 @@ fn test_prebuilt_llvm_config_path_resolution() {
         .join(exe("llvm-config", builder.config.build));
     assert_eq!(expected, actual);
 }
+
+fn test_is_host_target() {
+    let target1 = TargetSelection::from_user(TEST_TRIPLE_1);
+    let target2 = TargetSelection::from_user(TEST_TRIPLE_2);
+
+    for (target1, target2) in [(target1, target2), (target2, target1)] {
+        let mut config = configure("build", &[], &[]);
+        config.build = target1;
+        let build = Build::new(config);
+        let builder = Builder::new(&build);
+
+        assert!(builder.is_host_target(&target1));
+        assert!(!builder.is_host_target(&target2));
+    }
+}

From 7972aa2394583e3aa4cfe4d7c6eab05c3be56e94 Mon Sep 17 00:00:00 2001
From: Mads Marquart 
Date: Tue, 11 Feb 2025 15:47:29 +0100
Subject: [PATCH 093/128] dev-guide: Link to t-lang procedures for new features

---
 src/doc/rustc-dev-guide/src/implementing_new_features.md | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/doc/rustc-dev-guide/src/implementing_new_features.md b/src/doc/rustc-dev-guide/src/implementing_new_features.md
index d87afeaedce6..5b67ccd7f4c5 100644
--- a/src/doc/rustc-dev-guide/src/implementing_new_features.md
+++ b/src/doc/rustc-dev-guide/src/implementing_new_features.md
@@ -9,7 +9,11 @@ smoothly.
 **NOTE: this section is for *language* features, not *library* features,
 which use [a different process].**
 
+See also [the Rust Language Design Team's procedures][lang-propose] for
+proposing changes to the language.
+
 [a different process]: ./stability.md
+[lang-propose]: https://lang-team.rust-lang.org/how_to/propose.html
 
 ## The @rfcbot FCP process
 

From e32f79583c3709644567b55db7b6fcb9c425e787 Mon Sep 17 00:00:00 2001
From: Trevor Gross 
Date: Tue, 11 Feb 2025 16:08:08 +0000
Subject: [PATCH 094/128] Change the issue number for `likely_unlikely` and
 `cold_path`

These currently point to rust-lang/rust#26179, which is nearly a decade
old and has a lot of outdated discussion. Move these features to a new
tracking issue specifically for the recently added API.

New tracking issue: https://github.com/rust-lang/rust/issues/136873
---
 library/core/src/hint.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/library/core/src/hint.rs b/library/core/src/hint.rs
index e5c1a64c12ee..520b9941ae45 100644
--- a/library/core/src/hint.rs
+++ b/library/core/src/hint.rs
@@ -646,7 +646,7 @@ pub const fn must_use(value: T) -> T {
 /// ```
 ///
 ///
-#[unstable(feature = "likely_unlikely", issue = "26179")]
+#[unstable(feature = "likely_unlikely", issue = "136873")]
 #[inline(always)]
 pub const fn likely(b: bool) -> bool {
     crate::intrinsics::likely(b)
@@ -696,7 +696,7 @@ pub const fn likely(b: bool) -> bool {
 ///     }
 /// }
 /// ```
-#[unstable(feature = "likely_unlikely", issue = "26179")]
+#[unstable(feature = "likely_unlikely", issue = "136873")]
 #[inline(always)]
 pub const fn unlikely(b: bool) -> bool {
     crate::intrinsics::unlikely(b)
@@ -729,7 +729,7 @@ pub const fn unlikely(b: bool) -> bool {
 ///     }
 /// }
 /// ```
-#[unstable(feature = "cold_path", issue = "26179")]
+#[unstable(feature = "cold_path", issue = "136873")]
 #[inline(always)]
 pub const fn cold_path() {
     crate::intrinsics::cold_path()

From b594b9f4f54d05f7ac21d2c49c3093f89fd3ed1f Mon Sep 17 00:00:00 2001
From: Guillaume Gomez 
Date: Tue, 11 Feb 2025 18:17:46 +0100
Subject: [PATCH 095/128] Remove quotes around href in code line numbers

---
 src/librustdoc/html/highlight.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs
index fbe3a8d5ba4f..15bf968e0fc7 100644
--- a/src/librustdoc/html/highlight.rs
+++ b/src/librustdoc/html/highlight.rs
@@ -249,7 +249,7 @@ fn write_scraped_line_number(out: &mut impl Write, line: u32, extra: &'static st
 fn write_line_number(out: &mut impl Write, line: u32, extra: &'static str) {
     // https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag#data-nosnippet-attr
     // Do not show "1 2 3 4 5 ..." in web search results.
-    write!(out, "{extra}{line}",).unwrap();
+    write!(out, "{extra}{line}",).unwrap();
 }
 
 fn empty_line_number(out: &mut impl Write, _: u32, extra: &'static str) {

From acc7ddfd53a425b61d2beee8ea34726d7c99b553 Mon Sep 17 00:00:00 2001
From: onur-ozkan 
Date: Mon, 10 Feb 2025 11:25:35 +0300
Subject: [PATCH 096/128] rename `is_host_target` to `is_builder_target`

Signed-off-by: onur-ozkan 
---
 src/bootstrap/src/core/build_steps/compile.rs |  5 +++--
 src/bootstrap/src/core/build_steps/dist.rs    |  6 +++---
 src/bootstrap/src/core/build_steps/llvm.rs    |  6 +++---
 src/bootstrap/src/core/build_steps/test.rs    |  2 +-
 src/bootstrap/src/core/builder/tests.rs       |  7 ++++---
 src/bootstrap/src/core/sanity.rs              |  2 +-
 src/bootstrap/src/lib.rs                      | 10 +++++-----
 7 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 980383c38157..e0cc9c2cae90 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -191,7 +191,7 @@ impl Step for Std {
         // The LLD wrappers and `rust-lld` are self-contained linking components that can be
         // necessary to link the stdlib on some targets. We'll also need to copy these binaries to
         // the `stage0-sysroot` to ensure the linker is found when bootstrapping on such a target.
-        if compiler.stage == 0 && builder.is_host_target(&compiler.host) {
+        if compiler.stage == 0 && builder.is_builder_target(&compiler.host) {
             // We want to copy the host `bin` folder within the `rustlib` folder in the sysroot.
             let src_sysroot_bin = builder
                 .rustc_snapshot_sysroot()
@@ -2312,7 +2312,8 @@ pub fn strip_debug(builder: &Builder<'_>, target: TargetSelection, path: &Path)
     // FIXME: to make things simpler for now, limit this to the host and target where we know
     // `strip -g` is both available and will fix the issue, i.e. on a x64 linux host that is not
     // cross-compiling. Expand this to other appropriate targets in the future.
-    if target != "x86_64-unknown-linux-gnu" || !builder.is_host_target(&target) || !path.exists() {
+    if target != "x86_64-unknown-linux-gnu" || !builder.is_builder_target(&target) || !path.exists()
+    {
         return;
     }
 
diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs
index 22c3be60499d..ae3761a97e50 100644
--- a/src/bootstrap/src/core/build_steps/dist.rs
+++ b/src/bootstrap/src/core/build_steps/dist.rs
@@ -582,7 +582,7 @@ impl Step for DebuggerScripts {
 fn skip_host_target_lib(builder: &Builder<'_>, compiler: Compiler) -> bool {
     // The only true set of target libraries came from the build triple, so
     // let's reduce redundant work by only producing archives from that host.
-    if !builder.is_host_target(&compiler.host) {
+    if !builder.is_builder_target(&compiler.host) {
         builder.info("\tskipping, not a build host");
         true
     } else {
@@ -637,7 +637,7 @@ fn copy_target_libs(
     for (path, dependency_type) in builder.read_stamp_file(stamp) {
         if dependency_type == DependencyType::TargetSelfContained {
             builder.copy_link(&path, &self_contained_dst.join(path.file_name().unwrap()));
-        } else if dependency_type == DependencyType::Target || builder.is_host_target(&target) {
+        } else if dependency_type == DependencyType::Target || builder.is_builder_target(&target) {
             builder.copy_link(&path, &dst.join(path.file_name().unwrap()));
         }
     }
@@ -786,7 +786,7 @@ impl Step for Analysis {
     fn run(self, builder: &Builder<'_>) -> Option {
         let compiler = self.compiler;
         let target = self.target;
-        if !builder.is_host_target(&compiler.host) {
+        if !builder.is_builder_target(&compiler.host) {
             return None;
         }
 
diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs
index 00485c5a2312..ee60dbef7b98 100644
--- a/src/bootstrap/src/core/build_steps/llvm.rs
+++ b/src/bootstrap/src/core/build_steps/llvm.rs
@@ -516,7 +516,7 @@ impl Step for Llvm {
         }
 
         // https://llvm.org/docs/HowToCrossCompileLLVM.html
-        if !builder.is_host_target(&target) {
+        if !builder.is_builder_target(&target) {
             let LlvmResult { llvm_config, .. } =
                 builder.ensure(Llvm { target: builder.config.build });
             if !builder.config.dry_run() {
@@ -661,7 +661,7 @@ fn configure_cmake(
     }
     cfg.target(&target.triple).host(&builder.config.build.triple);
 
-    if !builder.is_host_target(&target) {
+    if !builder.is_builder_target(&target) {
         cfg.define("CMAKE_CROSSCOMPILING", "True");
 
         if target.contains("netbsd") {
@@ -1111,7 +1111,7 @@ impl Step for Lld {
             .define("LLVM_CMAKE_DIR", llvm_cmake_dir)
             .define("LLVM_INCLUDE_TESTS", "OFF");
 
-        if !builder.is_host_target(&target) {
+        if !builder.is_builder_target(&target) {
             // Use the host llvm-tblgen binary.
             cfg.define(
                 "LLVM_TABLEGEN_EXE",
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index 259a6c4b1cb3..509875a469f1 100644
--- a/src/bootstrap/src/core/build_steps/test.rs
+++ b/src/bootstrap/src/core/build_steps/test.rs
@@ -2742,7 +2742,7 @@ impl Step for Crate {
             cargo
         } else {
             // Also prepare a sysroot for the target.
-            if !builder.is_host_target(&target) {
+            if !builder.is_builder_target(&target) {
                 builder.ensure(compile::Std::new(compiler, target).force_recompile(true));
                 builder.ensure(RemoteCopyLibs { compiler, target });
             }
diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs
index 5718c84f3148..a0be474ca3e3 100644
--- a/src/bootstrap/src/core/builder/tests.rs
+++ b/src/bootstrap/src/core/builder/tests.rs
@@ -1066,7 +1066,8 @@ fn test_prebuilt_llvm_config_path_resolution() {
     assert_eq!(expected, actual);
 }
 
-fn test_is_host_target() {
+#[test]
+fn test_is_builder_target() {
     let target1 = TargetSelection::from_user(TEST_TRIPLE_1);
     let target2 = TargetSelection::from_user(TEST_TRIPLE_2);
 
@@ -1076,7 +1077,7 @@ fn test_is_host_target() {
         let build = Build::new(config);
         let builder = Builder::new(&build);
 
-        assert!(builder.is_host_target(&target1));
-        assert!(!builder.is_host_target(&target2));
+        assert!(builder.is_builder_target(&target1));
+        assert!(!builder.is_builder_target(&target2));
     }
 }
diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs
index 8055a724e339..9e4a0816e0d4 100644
--- a/src/bootstrap/src/core/sanity.rs
+++ b/src/bootstrap/src/core/sanity.rs
@@ -329,7 +329,7 @@ than building it.
         if target.contains("musl") && !target.contains("unikraft") {
             // If this is a native target (host is also musl) and no musl-root is given,
             // fall back to the system toolchain in /usr before giving up
-            if build.musl_root(*target).is_none() && build.is_host_target(target) {
+            if build.musl_root(*target).is_none() && build.is_builder_target(target) {
                 let target = build.config.target_config.entry(*target).or_default();
                 target.musl_root = Some("/usr".into());
             }
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index 440c9e782da6..665ab117002e 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -739,7 +739,7 @@ impl Build {
     /// Note that if LLVM is configured externally then the directory returned
     /// will likely be empty.
     fn llvm_out(&self, target: TargetSelection) -> PathBuf {
-        if self.config.llvm_from_ci && self.is_host_target(&target) {
+        if self.config.llvm_from_ci && self.is_builder_target(&target) {
             self.config.ci_llvm_root()
         } else {
             self.out.join(target).join("llvm")
@@ -789,7 +789,7 @@ impl Build {
     fn is_system_llvm(&self, target: TargetSelection) -> bool {
         match self.config.target_config.get(&target) {
             Some(Target { llvm_config: Some(_), .. }) => {
-                let ci_llvm = self.config.llvm_from_ci && self.is_host_target(&target);
+                let ci_llvm = self.config.llvm_from_ci && self.is_builder_target(&target);
                 !ci_llvm
             }
             // We're building from the in-tree src/llvm-project sources.
@@ -1274,7 +1274,7 @@ Executed at: {executed_at}"#,
             // need to use CXX compiler as linker to resolve the exception functions
             // that are only existed in CXX libraries
             Some(self.cxx.borrow()[&target].path().into())
-        } else if !self.is_host_target(&target)
+        } else if !self.is_builder_target(&target)
             && helpers::use_host_linker(target)
             && !target.is_msvc()
         {
@@ -1926,8 +1926,8 @@ to download LLVM rather than building it.
         result
     }
 
-    /// Checks if the given target is the same as the host target.
-    fn is_host_target(&self, target: &TargetSelection) -> bool {
+    /// Checks if the given target is the same as the builder target.
+    fn is_builder_target(&self, target: &TargetSelection) -> bool {
         &self.config.build == target
     }
 }

From f0cb746480830d585768c03f8447c0e5f9817b52 Mon Sep 17 00:00:00 2001
From: Michael Goulet 
Date: Tue, 11 Feb 2025 19:16:12 +0000
Subject: [PATCH 097/128] Lower fn items as ZST valtrees and delay a bug

---
 .../src/hir_ty_lowering/mod.rs                | 14 +++++++++-----
 compiler/rustc_middle/src/ty/print/pretty.rs  | 13 +++++++++----
 .../mgca/unexpected-fn-item-in-array.rs       | 13 +++++++++++++
 .../mgca/unexpected-fn-item-in-array.stderr   | 19 +++++++++++++++++++
 4 files changed, 50 insertions(+), 9 deletions(-)
 create mode 100644 tests/ui/const-generics/mgca/unexpected-fn-item-in-array.rs
 create mode 100644 tests/ui/const-generics/mgca/unexpected-fn-item-in-array.stderr

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 ffddf6f73aaf..e58cb2ff5920 100644
--- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
+++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
@@ -2154,11 +2154,15 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
                 span_bug!(span, "use of bare `static` ConstArgKind::Path's not yet supported")
             }
             // FIXME(const_generics): create real const to allow fn items as const paths
-            Res::Def(DefKind::Fn | DefKind::AssocFn, _) => ty::Const::new_error_with_message(
-                tcx,
-                span,
-                "fn items cannot be used as const args",
-            ),
+            Res::Def(DefKind::Fn | DefKind::AssocFn, did) => {
+                self.dcx().span_delayed_bug(span, "function items cannot be used as const args");
+                let args = self.lower_generic_args_of_path_segment(
+                    span,
+                    did,
+                    path.segments.last().unwrap(),
+                );
+                ty::Const::new_value(tcx, ty::ValTree::zst(), Ty::new_fn_def(tcx, did, args))
+            }
 
             // Exhaustive match to be clear about what exactly we're considering to be
             // an invalid Res for a const path.
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs
index feae8ea312ea..5a88e315b399 100644
--- a/compiler/rustc_middle/src/ty/print/pretty.rs
+++ b/compiler/rustc_middle/src/ty/print/pretty.rs
@@ -1800,7 +1800,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
         }
 
         let u8_type = self.tcx().types.u8;
-        match (cv.valtree, cv.ty.kind()) {
+        match (cv.valtree, *cv.ty.kind()) {
             (ty::ValTree::Branch(_), ty::Ref(_, inner_ty, _)) => match inner_ty.kind() {
                 ty::Slice(t) if *t == u8_type => {
                     let bytes = cv.try_to_raw_bytes(self.tcx()).unwrap_or_else(|| {
@@ -1820,13 +1820,13 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
                     return Ok(());
                 }
                 _ => {
-                    let cv = ty::Value { valtree: cv.valtree, ty: *inner_ty };
+                    let cv = ty::Value { valtree: cv.valtree, ty: inner_ty };
                     p!("&");
                     p!(pretty_print_const_valtree(cv, print_ty));
                     return Ok(());
                 }
             },
-            (ty::ValTree::Branch(_), ty::Array(t, _)) if *t == u8_type => {
+            (ty::ValTree::Branch(_), ty::Array(t, _)) if t == u8_type => {
                 let bytes = cv.try_to_raw_bytes(self.tcx()).unwrap_or_else(|| {
                     bug!("expected to convert valtree to raw bytes for type {:?}", t)
                 });
@@ -1893,11 +1893,16 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
             }
             (ty::ValTree::Leaf(leaf), ty::Ref(_, inner_ty, _)) => {
                 p!(write("&"));
-                return self.pretty_print_const_scalar_int(leaf, *inner_ty, print_ty);
+                return self.pretty_print_const_scalar_int(leaf, inner_ty, print_ty);
             }
             (ty::ValTree::Leaf(leaf), _) => {
                 return self.pretty_print_const_scalar_int(leaf, cv.ty, print_ty);
             }
+            (_, ty::FnDef(def_id, args)) => {
+                // Never allowed today, but we still encounter them in invalid const args.
+                p!(print_value_path(def_id, args));
+                return Ok(());
+            }
             // FIXME(oli-obk): also pretty print arrays and other aggregate constants by reading
             // their fields instead of just dumping the memory.
             _ => {}
diff --git a/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.rs b/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.rs
new file mode 100644
index 000000000000..1c3274f6a376
--- /dev/null
+++ b/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.rs
@@ -0,0 +1,13 @@
+// Make sure we don't ICE when encountering an fn item during lowering in mGCA.
+
+#![feature(min_generic_const_args)]
+//~^ WARN the feature `min_generic_const_args` is incomplete
+
+trait A {}
+
+impl A<[usize; fn_item]> for () {}
+//~^ ERROR the constant `fn_item` is not of type `usize`
+
+fn fn_item() {}
+
+fn main() {}
diff --git a/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.stderr b/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.stderr
new file mode 100644
index 000000000000..89fc8270e3e7
--- /dev/null
+++ b/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.stderr
@@ -0,0 +1,19 @@
+warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes
+  --> $DIR/unexpected-fn-item-in-array.rs:3:12
+   |
+LL | #![feature(min_generic_const_args)]
+   |            ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #132980  for more information
+   = note: `#[warn(incomplete_features)]` on by default
+
+error: the constant `fn_item` is not of type `usize`
+  --> $DIR/unexpected-fn-item-in-array.rs:8:6
+   |
+LL | impl A<[usize; fn_item]> for () {}
+   |      ^^^^^^^^^^^^^^^^^^^ expected `usize`, found fn item
+   |
+   = note: the length of array `[usize; fn_item]` must be type `usize`
+
+error: aborting due to 1 previous error; 1 warning emitted
+

From a02a982ffc73457caa1849b09da63e84f78541c6 Mon Sep 17 00:00:00 2001
From: Michael Goulet 
Date: Sat, 25 Jan 2025 21:27:06 +0000
Subject: [PATCH 098/128] Make DeeplyNormalize a real type op

---
 .../src/type_check/constraint_conversion.rs   | 21 +------
 .../src/type_check/free_region_relations.rs   | 21 ++-----
 compiler/rustc_middle/src/traits/query.rs     |  7 +++
 .../src/traits/query/type_op/normalize.rs     | 58 ++++++++++++++++++-
 4 files changed, 70 insertions(+), 37 deletions(-)

diff --git a/compiler/rustc_borrowck/src/type_check/constraint_conversion.rs b/compiler/rustc_borrowck/src/type_check/constraint_conversion.rs
index 4b7f53213886..3b48ca305c45 100644
--- a/compiler/rustc_borrowck/src/type_check/constraint_conversion.rs
+++ b/compiler/rustc_borrowck/src/type_check/constraint_conversion.rs
@@ -4,15 +4,12 @@ use rustc_infer::infer::outlives::env::RegionBoundPairs;
 use rustc_infer::infer::outlives::obligations::{TypeOutlives, TypeOutlivesDelegate};
 use rustc_infer::infer::region_constraints::{GenericKind, VerifyBound};
 use rustc_infer::infer::{self, InferCtxt, SubregionOrigin};
+use rustc_infer::traits::query::type_op::DeeplyNormalize;
 use rustc_middle::bug;
 use rustc_middle::mir::{ClosureOutlivesSubject, ClosureRegionRequirements, ConstraintCategory};
-use rustc_middle::traits::ObligationCause;
-use rustc_middle::traits::query::NoSolution;
 use rustc_middle::ty::fold::fold_regions;
 use rustc_middle::ty::{self, GenericArgKind, Ty, TyCtxt, TypeFoldable, TypeVisitableExt};
 use rustc_span::Span;
-use rustc_trait_selection::traits::ScrubbedTraitError;
-use rustc_trait_selection::traits::query::type_op::custom::CustomTypeOp;
 use rustc_trait_selection::traits::query::type_op::{TypeOp, TypeOpOutput};
 use tracing::{debug, instrument};
 
@@ -270,20 +267,8 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
             ConstraintCategory<'tcx>,
         )>,
     ) -> Ty<'tcx> {
-        let result = CustomTypeOp::new(
-            |ocx| {
-                ocx.deeply_normalize(
-                    &ObligationCause::dummy_with_span(self.span),
-                    self.param_env,
-                    ty,
-                )
-                .map_err(|_: Vec>| NoSolution)
-            },
-            "normalize type outlives obligation",
-        )
-        .fully_perform(self.infcx, self.span);
-
-        match result {
+        match self.param_env.and(DeeplyNormalize { value: ty }).fully_perform(self.infcx, self.span)
+        {
             Ok(TypeOpOutput { output: ty, constraints, .. }) => {
                 if let Some(QueryRegionConstraints { outlives }) = constraints {
                     next_outlives_predicates.extend(outlives.iter().copied());
diff --git a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
index edf612f4e97a..2bac084c9643 100644
--- a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
+++ b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
@@ -5,14 +5,11 @@ use rustc_infer::infer::canonical::QueryRegionConstraints;
 use rustc_infer::infer::outlives::env::RegionBoundPairs;
 use rustc_infer::infer::region_constraints::GenericKind;
 use rustc_infer::infer::{InferCtxt, outlives};
-use rustc_infer::traits::ScrubbedTraitError;
+use rustc_infer::traits::query::type_op::DeeplyNormalize;
 use rustc_middle::mir::ConstraintCategory;
-use rustc_middle::traits::ObligationCause;
 use rustc_middle::traits::query::OutlivesBound;
 use rustc_middle::ty::{self, RegionVid, Ty, TypeVisitableExt};
 use rustc_span::{ErrorGuaranteed, Span};
-use rustc_trait_selection::solve::NoSolution;
-use rustc_trait_selection::traits::query::type_op::custom::CustomTypeOp;
 use rustc_trait_selection::traits::query::type_op::{self, TypeOp};
 use tracing::{debug, instrument};
 use type_op::TypeOpOutput;
@@ -360,18 +357,10 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
                 output: normalized_outlives,
                 constraints: constraints_normalize,
                 error_info: _,
-            }) = CustomTypeOp::new(
-                |ocx| {
-                    ocx.deeply_normalize(
-                        &ObligationCause::dummy_with_span(span),
-                        self.param_env,
-                        outlives,
-                    )
-                    .map_err(|_: Vec>| NoSolution)
-                },
-                "normalize type outlives obligation",
-            )
-            .fully_perform(self.infcx, span)
+            }) = self
+                .param_env
+                .and(DeeplyNormalize { value: outlives })
+                .fully_perform(self.infcx, span)
             else {
                 self.infcx.dcx().delayed_bug(format!("could not normalize {outlives:?}"));
                 return;
diff --git a/compiler/rustc_middle/src/traits/query.rs b/compiler/rustc_middle/src/traits/query.rs
index 8cd04a6f5e40..5b19d1742cd4 100644
--- a/compiler/rustc_middle/src/traits/query.rs
+++ b/compiler/rustc_middle/src/traits/query.rs
@@ -41,11 +41,18 @@ pub mod type_op {
         pub predicate: Predicate<'tcx>,
     }
 
+    /// Normalizes, but not in the new solver.
     #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, TypeVisitable)]
     pub struct Normalize {
         pub value: T,
     }
 
+    /// Normalizes, and deeply normalizes in the new solver.
+    #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, TypeVisitable)]
+    pub struct DeeplyNormalize {
+        pub value: T,
+    }
+
     #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, TypeVisitable)]
     pub struct ImpliedOutlivesBounds<'tcx> {
         pub ty: Ty<'tcx>,
diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/normalize.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/normalize.rs
index e8c2528aa6ee..2f6bbd7f4cf4 100644
--- a/compiler/rustc_trait_selection/src/traits/query/type_op/normalize.rs
+++ b/compiler/rustc_trait_selection/src/traits/query/type_op/normalize.rs
@@ -2,7 +2,7 @@ use std::fmt;
 
 use rustc_middle::traits::ObligationCause;
 use rustc_middle::traits::query::NoSolution;
-pub use rustc_middle::traits::query::type_op::Normalize;
+pub use rustc_middle::traits::query::type_op::{DeeplyNormalize, Normalize};
 use rustc_middle::ty::fold::TypeFoldable;
 use rustc_middle::ty::{self, Lift, ParamEnvAnd, Ty, TyCtxt, TypeVisitableExt};
 use rustc_span::Span;
@@ -27,13 +27,54 @@ where
         T::type_op_method(tcx, canonicalized)
     }
 
+    fn perform_locally_with_next_solver(
+        _ocx: &ObligationCtxt<'_, 'tcx>,
+        key: ParamEnvAnd<'tcx, Self>,
+        _span: Span,
+    ) -> Result {
+        Ok(key.value.value)
+    }
+}
+
+impl<'tcx, T> super::QueryTypeOp<'tcx> for DeeplyNormalize
+where
+    T: Normalizable<'tcx> + 'tcx,
+{
+    type QueryResponse = T;
+
+    fn try_fast_path(_tcx: TyCtxt<'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option {
+        if !key.value.value.has_aliases() { Some(key.value.value) } else { None }
+    }
+
+    fn perform_query(
+        tcx: TyCtxt<'tcx>,
+        canonicalized: CanonicalQueryInput<'tcx, ParamEnvAnd<'tcx, Self>>,
+    ) -> Result, NoSolution> {
+        T::type_op_method(
+            tcx,
+            CanonicalQueryInput {
+                typing_mode: canonicalized.typing_mode,
+                canonical: canonicalized.canonical.unchecked_map(
+                    |ty::ParamEnvAnd { param_env, value }| ty::ParamEnvAnd {
+                        param_env,
+                        value: Normalize { value: value.value },
+                    },
+                ),
+            },
+        )
+    }
+
     fn perform_locally_with_next_solver(
         ocx: &ObligationCtxt<'_, 'tcx>,
         key: ParamEnvAnd<'tcx, Self>,
         span: Span,
     ) -> Result {
-        // FIXME(-Znext-solver): shouldn't be using old normalizer
-        Ok(ocx.normalize(&ObligationCause::dummy_with_span(span), key.param_env, key.value.value))
+        ocx.deeply_normalize(
+            &ObligationCause::dummy_with_span(span),
+            key.param_env,
+            key.value.value,
+        )
+        .map_err(|_| NoSolution)
     }
 }
 
@@ -81,3 +122,14 @@ impl<'tcx> Normalizable<'tcx> for ty::FnSig<'tcx> {
         tcx.type_op_normalize_fn_sig(canonicalized)
     }
 }
+
+/// This impl is not needed, since we never normalize type outlives predicates
+/// in the old solver, but is required by trait bounds to be happy.
+impl<'tcx> Normalizable<'tcx> for ty::PolyTypeOutlivesPredicate<'tcx> {
+    fn type_op_method(
+        _tcx: TyCtxt<'tcx>,
+        _canonicalized: CanonicalQueryInput<'tcx, ParamEnvAnd<'tcx, Normalize>>,
+    ) -> Result, NoSolution> {
+        unreachable!("we never normalize PolyTypeOutlivesPredicate")
+    }
+}

From ce0c952e968777004fc59f45653be2fda116fee1 Mon Sep 17 00:00:00 2001
From: Michael Goulet 
Date: Sat, 25 Jan 2025 21:39:59 +0000
Subject: [PATCH 099/128] Deeply normalize args for implied bounds

---
 .../src/type_check/free_region_relations.rs   |  2 +-
 .../implied-bound-from-normalized-arg.rs      | 22 +++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100644 tests/ui/borrowck/implied-bound-from-normalized-arg.rs

diff --git a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
index 2bac084c9643..a7f8d9c28848 100644
--- a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
+++ b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
@@ -264,7 +264,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
             }
             let TypeOpOutput { output: norm_ty, constraints: constraints_normalize, .. } =
                 param_env
-                    .and(type_op::normalize::Normalize { value: ty })
+                    .and(DeeplyNormalize { value: ty })
                     .fully_perform(self.infcx, span)
                     .unwrap_or_else(|guar| TypeOpOutput {
                         output: Ty::new_error(self.infcx.tcx, guar),
diff --git a/tests/ui/borrowck/implied-bound-from-normalized-arg.rs b/tests/ui/borrowck/implied-bound-from-normalized-arg.rs
new file mode 100644
index 000000000000..4e9a4953c6b7
--- /dev/null
+++ b/tests/ui/borrowck/implied-bound-from-normalized-arg.rs
@@ -0,0 +1,22 @@
+//@ check-pass
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+
+// Make sure that we can normalize `>::Assoc` to `&'a T` and get
+// its implied bounds.
+
+trait Ref<'a> {
+    type Assoc;
+}
+impl<'a, T> Ref<'a> for T where T: 'a {
+    type Assoc = &'a T;
+}
+
+fn outlives<'a, T: 'a>() {}
+
+fn test<'a, T>(_: >::Assoc) {
+    outlives::<'a, T>();
+}
+
+fn main() {}

From ef9d992a0d8a7a093a398e51b42dbea8eed72847 Mon Sep 17 00:00:00 2001
From: Michael Goulet 
Date: Sat, 25 Jan 2025 21:42:29 +0000
Subject: [PATCH 100/128] Deeply normalize in impl header

---
 .../src/type_check/free_region_relations.rs   |  2 +-
 .../implied-bound-from-impl-header.rs         | 28 +++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 tests/ui/borrowck/implied-bound-from-impl-header.rs

diff --git a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
index a7f8d9c28848..b8008f18a399 100644
--- a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
+++ b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
@@ -301,7 +301,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
         if matches!(tcx.def_kind(defining_ty_def_id), DefKind::AssocFn | DefKind::AssocConst) {
             for &(ty, _) in tcx.assumed_wf_types(tcx.local_parent(defining_ty_def_id)) {
                 let result: Result<_, ErrorGuaranteed> = param_env
-                    .and(type_op::normalize::Normalize { value: ty })
+                    .and(DeeplyNormalize { value: ty })
                     .fully_perform(self.infcx, span);
                 let Ok(TypeOpOutput { output: norm_ty, constraints: c, .. }) = result else {
                     continue;
diff --git a/tests/ui/borrowck/implied-bound-from-impl-header.rs b/tests/ui/borrowck/implied-bound-from-impl-header.rs
new file mode 100644
index 000000000000..326a62b22f05
--- /dev/null
+++ b/tests/ui/borrowck/implied-bound-from-impl-header.rs
@@ -0,0 +1,28 @@
+//@ check-pass
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+
+// Make sure that we can normalize `>::Assoc` to `&'a T` and get
+// its implied bounds in impl header.
+
+trait Ref<'a> {
+    type Assoc;
+}
+impl<'a, T> Ref<'a> for T where T: 'a {
+    type Assoc = &'a T;
+}
+
+fn outlives<'a, T: 'a>() {}
+
+trait Trait<'a, T> {
+    fn test();
+}
+
+impl<'a, T> Trait<'a, T> for >::Assoc {
+    fn test() {
+        outlives::<'a, T>();
+    }
+}
+
+fn main() {}

From d5be3bae5182ad064bf2b28a7c9d6847e08d8463 Mon Sep 17 00:00:00 2001
From: Michael Goulet 
Date: Sat, 25 Jan 2025 22:22:53 +0000
Subject: [PATCH 101/128] Deeply normalize signature in new solver

---
 .../src/diagnostics/bound_region_errors.rs    | 59 ++++++++++++++++++-
 .../src/type_check/canonical.rs               | 12 ++++
 .../src/type_check/free_region_relations.rs   |  5 +-
 compiler/rustc_borrowck/src/type_check/mod.rs |  2 +-
 compiler/rustc_middle/src/traits/query.rs     |  3 +
 ...heck-normalized-sig-for-wf.current.stderr} |  6 +-
 .../check-normalized-sig-for-wf.next.stderr   | 47 +++++++++++++++
 tests/ui/nll/check-normalized-sig-for-wf.rs   |  4 ++
 8 files changed, 129 insertions(+), 9 deletions(-)
 rename tests/ui/nll/{check-normalized-sig-for-wf.stderr => check-normalized-sig-for-wf.current.stderr} (90%)
 create mode 100644 tests/ui/nll/check-normalized-sig-for-wf.next.stderr

diff --git a/compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs
index 30b0a3585802..aa968a1e40f3 100644
--- a/compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs
@@ -9,8 +9,8 @@ use rustc_infer::infer::{
 };
 use rustc_infer::traits::ObligationCause;
 use rustc_infer::traits::query::{
-    CanonicalTypeOpAscribeUserTypeGoal, CanonicalTypeOpNormalizeGoal,
-    CanonicalTypeOpProvePredicateGoal,
+    CanonicalTypeOpAscribeUserTypeGoal, CanonicalTypeOpDeeplyNormalizeGoal,
+    CanonicalTypeOpNormalizeGoal, CanonicalTypeOpProvePredicateGoal,
 };
 use rustc_middle::ty::error::TypeError;
 use rustc_middle::ty::{
@@ -109,6 +109,14 @@ impl<'tcx, T: Copy + fmt::Display + TypeFoldable> + 'tcx> ToUnivers
     }
 }
 
+impl<'tcx, T: Copy + fmt::Display + TypeFoldable> + 'tcx> ToUniverseInfo<'tcx>
+    for CanonicalTypeOpDeeplyNormalizeGoal<'tcx, T>
+{
+    fn to_universe_info(self, base_universe: ty::UniverseIndex) -> UniverseInfo<'tcx> {
+        UniverseInfo::TypeOp(Rc::new(DeeplyNormalizeQuery { canonical_query: self, base_universe }))
+    }
+}
+
 impl<'tcx> ToUniverseInfo<'tcx> for CanonicalTypeOpAscribeUserTypeGoal<'tcx> {
     fn to_universe_info(self, base_universe: ty::UniverseIndex) -> UniverseInfo<'tcx> {
         UniverseInfo::TypeOp(Rc::new(AscribeUserTypeQuery { canonical_query: self, base_universe }))
@@ -285,6 +293,53 @@ where
     }
 }
 
+struct DeeplyNormalizeQuery<'tcx, T> {
+    canonical_query: CanonicalTypeOpDeeplyNormalizeGoal<'tcx, T>,
+    base_universe: ty::UniverseIndex,
+}
+
+impl<'tcx, T> TypeOpInfo<'tcx> for DeeplyNormalizeQuery<'tcx, T>
+where
+    T: Copy + fmt::Display + TypeFoldable> + 'tcx,
+{
+    fn fallback_error(&self, tcx: TyCtxt<'tcx>, span: Span) -> Diag<'tcx> {
+        tcx.dcx().create_err(HigherRankedLifetimeError {
+            cause: Some(HigherRankedErrorCause::CouldNotNormalize {
+                value: self.canonical_query.canonical.value.value.value.to_string(),
+            }),
+            span,
+        })
+    }
+
+    fn base_universe(&self) -> ty::UniverseIndex {
+        self.base_universe
+    }
+
+    fn nice_error<'infcx>(
+        &self,
+        mbcx: &mut MirBorrowckCtxt<'_, 'infcx, 'tcx>,
+        cause: ObligationCause<'tcx>,
+        placeholder_region: ty::Region<'tcx>,
+        error_region: Option>,
+    ) -> Option> {
+        let (infcx, key, _) =
+            mbcx.infcx.tcx.infer_ctxt().build_with_canonical(cause.span, &self.canonical_query);
+        let ocx = ObligationCtxt::new(&infcx);
+
+        let (param_env, value) = key.into_parts();
+        let _ = ocx.deeply_normalize(&cause, param_env, value.value);
+
+        let diag = try_extract_error_from_fulfill_cx(
+            &ocx,
+            mbcx.mir_def_id(),
+            placeholder_region,
+            error_region,
+        )?
+        .with_dcx(mbcx.dcx());
+        Some(diag)
+    }
+}
+
 struct AscribeUserTypeQuery<'tcx> {
     canonical_query: CanonicalTypeOpAscribeUserTypeGoal<'tcx>,
     base_universe: ty::UniverseIndex,
diff --git a/compiler/rustc_borrowck/src/type_check/canonical.rs b/compiler/rustc_borrowck/src/type_check/canonical.rs
index bffd9f383343..b3fa786a5177 100644
--- a/compiler/rustc_borrowck/src/type_check/canonical.rs
+++ b/compiler/rustc_borrowck/src/type_check/canonical.rs
@@ -149,6 +149,18 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
         self.normalize_with_category(value, location, ConstraintCategory::Boring)
     }
 
+    pub(super) fn deeply_normalize(&mut self, value: T, location: impl NormalizeLocation) -> T
+    where
+        T: type_op::normalize::Normalizable<'tcx> + fmt::Display + Copy + 'tcx,
+    {
+        let result: Result<_, ErrorGuaranteed> = self.fully_perform_op(
+            location.to_locations(),
+            ConstraintCategory::Boring,
+            self.infcx.param_env.and(type_op::normalize::DeeplyNormalize { value }),
+        );
+        result.unwrap_or(value)
+    }
+
     #[instrument(skip(self), level = "debug")]
     pub(super) fn normalize_with_category(
         &mut self,
diff --git a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
index b8008f18a399..efbae1e15353 100644
--- a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
+++ b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs
@@ -300,9 +300,8 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
         // Add implied bounds from impl header.
         if matches!(tcx.def_kind(defining_ty_def_id), DefKind::AssocFn | DefKind::AssocConst) {
             for &(ty, _) in tcx.assumed_wf_types(tcx.local_parent(defining_ty_def_id)) {
-                let result: Result<_, ErrorGuaranteed> = param_env
-                    .and(DeeplyNormalize { value: ty })
-                    .fully_perform(self.infcx, span);
+                let result: Result<_, ErrorGuaranteed> =
+                    param_env.and(DeeplyNormalize { value: ty }).fully_perform(self.infcx, span);
                 let Ok(TypeOpOutput { output: norm_ty, constraints: c, .. }) = result else {
                     continue;
                 };
diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs
index 26a5d438edb9..93081919ec79 100644
--- a/compiler/rustc_borrowck/src/type_check/mod.rs
+++ b/compiler/rustc_borrowck/src/type_check/mod.rs
@@ -1116,7 +1116,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
                     ConstraintCategory::Boring,
                 );
 
-                let sig = self.normalize(unnormalized_sig, term_location);
+                let sig = self.deeply_normalize(unnormalized_sig, term_location);
                 // HACK(#114936): `WF(sig)` does not imply `WF(normalized(sig))`
                 // with built-in `Fn` implementations, since the impl may not be
                 // well-formed itself.
diff --git a/compiler/rustc_middle/src/traits/query.rs b/compiler/rustc_middle/src/traits/query.rs
index 5b19d1742cd4..4203c8fd8614 100644
--- a/compiler/rustc_middle/src/traits/query.rs
+++ b/compiler/rustc_middle/src/traits/query.rs
@@ -87,6 +87,9 @@ pub type CanonicalTypeOpProvePredicateGoal<'tcx> =
 pub type CanonicalTypeOpNormalizeGoal<'tcx, T> =
     CanonicalQueryInput<'tcx, ty::ParamEnvAnd<'tcx, type_op::Normalize>>;
 
+pub type CanonicalTypeOpDeeplyNormalizeGoal<'tcx, T> =
+    CanonicalQueryInput<'tcx, ty::ParamEnvAnd<'tcx, type_op::DeeplyNormalize>>;
+
 pub type CanonicalImpliedOutlivesBoundsGoal<'tcx> =
     CanonicalQueryInput<'tcx, ty::ParamEnvAnd<'tcx, type_op::ImpliedOutlivesBounds<'tcx>>>;
 
diff --git a/tests/ui/nll/check-normalized-sig-for-wf.stderr b/tests/ui/nll/check-normalized-sig-for-wf.current.stderr
similarity index 90%
rename from tests/ui/nll/check-normalized-sig-for-wf.stderr
rename to tests/ui/nll/check-normalized-sig-for-wf.current.stderr
index 5c96b0c6561a..b25ae72f7fb9 100644
--- a/tests/ui/nll/check-normalized-sig-for-wf.stderr
+++ b/tests/ui/nll/check-normalized-sig-for-wf.current.stderr
@@ -1,5 +1,5 @@
 error[E0597]: `s` does not live long enough
-  --> $DIR/check-normalized-sig-for-wf.rs:7:7
+  --> $DIR/check-normalized-sig-for-wf.rs:11:7
    |
 LL |     s: String,
    |     - binding `s` declared here
@@ -14,7 +14,7 @@ LL | }
    | - `s` dropped here while still borrowed
 
 error[E0521]: borrowed data escapes outside of function
-  --> $DIR/check-normalized-sig-for-wf.rs:15:5
+  --> $DIR/check-normalized-sig-for-wf.rs:19:5
    |
 LL | fn extend(input: &T) -> &'static T {
    |              -----  - let's call the lifetime of this reference `'1`
@@ -28,7 +28,7 @@ LL |     n(input).0
    |     argument requires that `'1` must outlive `'static`
 
 error[E0521]: borrowed data escapes outside of function
-  --> $DIR/check-normalized-sig-for-wf.rs:23:5
+  --> $DIR/check-normalized-sig-for-wf.rs:27:5
    |
 LL | fn extend_mut<'a, T>(input: &'a mut T) -> &'static mut T {
    |               --     ----- `input` is a reference that is only valid in the function body
diff --git a/tests/ui/nll/check-normalized-sig-for-wf.next.stderr b/tests/ui/nll/check-normalized-sig-for-wf.next.stderr
new file mode 100644
index 000000000000..b25ae72f7fb9
--- /dev/null
+++ b/tests/ui/nll/check-normalized-sig-for-wf.next.stderr
@@ -0,0 +1,47 @@
+error[E0597]: `s` does not live long enough
+  --> $DIR/check-normalized-sig-for-wf.rs:11:7
+   |
+LL |     s: String,
+   |     - binding `s` declared here
+...
+LL |     f(&s).0
+   |     --^^-
+   |     | |
+   |     | borrowed value does not live long enough
+   |     argument requires that `s` is borrowed for `'static`
+LL |
+LL | }
+   | - `s` dropped here while still borrowed
+
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/check-normalized-sig-for-wf.rs:19:5
+   |
+LL | fn extend(input: &T) -> &'static T {
+   |              -----  - let's call the lifetime of this reference `'1`
+   |              |
+   |              `input` is a reference that is only valid in the function body
+...
+LL |     n(input).0
+   |     ^^^^^^^^
+   |     |
+   |     `input` escapes the function body here
+   |     argument requires that `'1` must outlive `'static`
+
+error[E0521]: borrowed data escapes outside of function
+  --> $DIR/check-normalized-sig-for-wf.rs:27:5
+   |
+LL | fn extend_mut<'a, T>(input: &'a mut T) -> &'static mut T {
+   |               --     ----- `input` is a reference that is only valid in the function body
+   |               |
+   |               lifetime `'a` defined here
+...
+LL |     n(input).0
+   |     ^^^^^^^^
+   |     |
+   |     `input` escapes the function body here
+   |     argument requires that `'a` must outlive `'static`
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0521, E0597.
+For more information about an error, try `rustc --explain E0521`.
diff --git a/tests/ui/nll/check-normalized-sig-for-wf.rs b/tests/ui/nll/check-normalized-sig-for-wf.rs
index cb0f34ce02f7..9d7411fd8124 100644
--- a/tests/ui/nll/check-normalized-sig-for-wf.rs
+++ b/tests/ui/nll/check-normalized-sig-for-wf.rs
@@ -1,3 +1,7 @@
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+
 // 
 fn whoops(
     s: String,

From 9d8ffe47e73c12b48c8790249f6494253301ffde Mon Sep 17 00:00:00 2001
From: Ralf Jung 
Date: Tue, 11 Feb 2025 20:37:01 +0100
Subject: [PATCH 102/128] i686-linux-android: increase CPU baseline to Pentium
 4 (without an actual change)

---
 compiler/rustc_target/src/spec/targets/i686_linux_android.rs | 2 +-
 src/doc/rustc/src/platform-support.md                        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler/rustc_target/src/spec/targets/i686_linux_android.rs b/compiler/rustc_target/src/spec/targets/i686_linux_android.rs
index dcf9b6b4460f..1b8f4c1be2df 100644
--- a/compiler/rustc_target/src/spec/targets/i686_linux_android.rs
+++ b/compiler/rustc_target/src/spec/targets/i686_linux_android.rs
@@ -9,7 +9,7 @@ pub(crate) fn target() -> Target {
     base.max_atomic_width = Some(64);
 
     // https://developer.android.com/ndk/guides/abis.html#x86
-    base.cpu = "pentiumpro".into();
+    base.cpu = "pentium4".into();
     base.features = "+mmx,+sse,+sse2,+sse3,+ssse3".into();
     base.stack_probes = StackProbeType::Inline;
 
diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md
index 05555f537c96..a086498fcbdc 100644
--- a/src/doc/rustc/src/platform-support.md
+++ b/src/doc/rustc/src/platform-support.md
@@ -165,7 +165,7 @@ target | std | notes
 `i586-pc-windows-msvc` | * | 32-bit Windows (original Pentium) [^x86_32-floats-x87]
 `i586-unknown-linux-gnu` | ✓ | 32-bit Linux (kernel 3.2, glibc 2.17, original Pentium) [^x86_32-floats-x87]
 `i586-unknown-linux-musl` | ✓ | 32-bit Linux (musl 1.2.3, original Pentium) [^x86_32-floats-x87]
-[`i686-linux-android`](platform-support/android.md) | ✓ | 32-bit x86 Android ([PentiumPro with SSE](https://developer.android.com/ndk/guides/abis.html#x86)) [^x86_32-floats-return-ABI]
+[`i686-linux-android`](platform-support/android.md) | ✓ | 32-bit x86 Android ([Pentium 4 plus various extensions](https://developer.android.com/ndk/guides/abis.html#x86)) [^x86_32-floats-return-ABI]
 [`i686-pc-windows-gnullvm`](platform-support/pc-windows-gnullvm.md) | ✓ | 32-bit x86 MinGW (Windows 10+, Pentium 4), LLVM ABI [^x86_32-floats-return-ABI]
 [`i686-unknown-freebsd`](platform-support/freebsd.md) | ✓ | 32-bit x86 FreeBSD (Pentium 4) [^x86_32-floats-return-ABI]
 `i686-unknown-linux-musl` | ✓ | 32-bit Linux with musl 1.2.3 (Pentium 4) [^x86_32-floats-return-ABI]

From 53456200568d3d8647b390fd8933be12f646aaee Mon Sep 17 00:00:00 2001
From: Tshepang Mbambo 
Date: Tue, 11 Feb 2025 21:21:04 +0200
Subject: [PATCH 103/128] document the directive

---
 src/doc/rustc-dev-guide/src/tests/directives.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/doc/rustc-dev-guide/src/tests/directives.md b/src/doc/rustc-dev-guide/src/tests/directives.md
index 9e0f8f9c279c..b6209bcb2d80 100644
--- a/src/doc/rustc-dev-guide/src/tests/directives.md
+++ b/src/doc/rustc-dev-guide/src/tests/directives.md
@@ -192,6 +192,8 @@ settings:
   specified atomic widths, e.g. the test with `//@ needs-target-has-atomic: 8,
   16, ptr` will only run if it supports the comma-separated list of atomic
   widths.
+- `needs-dynamic-linking` - ignores if target does not support dynamic linking
+  (which is orthogonal to it being unable to create `dylib` and `cdylib` crate types)
 
 The following directives will check LLVM support:
 

From 4c17270332c2908a9e77d0c5a5cdfc27edd45654 Mon Sep 17 00:00:00 2001
From: Jubilee Young 
Date: Sun, 9 Feb 2025 16:54:53 -0800
Subject: [PATCH 104/128] tests: simplify dont-shuffle-bswaps test

This should guarantee it tests what we want it to test and no more.
It should probably also run on 64-bit platforms that are not x86-64,
which will often have the vector registers the opt implies.
---
 tests/codegen/dont-shuffle-bswaps.rs | 40 +++++++---------------------
 1 file changed, 10 insertions(+), 30 deletions(-)

diff --git a/tests/codegen/dont-shuffle-bswaps.rs b/tests/codegen/dont-shuffle-bswaps.rs
index 16dae801ee43..0e712bc3a4eb 100644
--- a/tests/codegen/dont-shuffle-bswaps.rs
+++ b/tests/codegen/dont-shuffle-bswaps.rs
@@ -1,11 +1,8 @@
-//@ revisions: OPT2 OPT3WINX64 OPT3LINX64
-//@ [OPT2] compile-flags: -O
-//@ [OPT3LINX64] compile-flags: -C opt-level=3
-//@ [OPT3WINX64] compile-flags: -C opt-level=3
-//@ [OPT3LINX64] only-linux
-//@ [OPT3WINX64] only-windows
-//@ [OPT3LINX64] only-x86_64
-//@ [OPT3WINX64] only-x86_64
+//@ revisions: OPT2 OPT3
+//@[OPT2] compile-flags: -Copt-level=2
+//@[OPT3] compile-flags: -C opt-level=3
+// some targets don't do the opt we are looking for
+//@[OPT3] only-64bit
 //@ min-llvm-version: 18.1.3
 
 #![crate_type = "lib"]
@@ -16,28 +13,11 @@
 // to avoid complicating the code.
 // CHECK-LABEL: define{{.*}}void @convert(
 // CHECK-NOT: shufflevector
-// OPT2: store i16
-// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 2
-// OPT2-NEXT: store i16
-// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 4
-// OPT2-NEXT: store i16
-// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 6
-// OPT2-NEXT: store i16
-// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 8
-// OPT2-NEXT: store i16
-// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 10
-// OPT2-NEXT: store i16
-// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 12
-// OPT2-NEXT: store i16
-// OPT2-NEXT: getelementptr inbounds{{( nuw)?}} i8, {{.+}} 14
-// OPT2-NEXT: store i16
-// OPT3LINX64: load <8 x i16>
-// OPT3LINX64-NEXT: call <8 x i16> @llvm.bswap
-// OPT3LINX64-NEXT: store <8 x i16>
-// OPT3WINX64: load <8 x i16>
-// OPT3WINX64-NEXT: call <8 x i16> @llvm.bswap
-// OPT3WINX64-NEXT: store <8 x i16>
-// CHECK-NEXT: ret void
+// On higher opt levels, this should just be a bswap:
+// OPT3: load <8 x i16>
+// OPT3-NEXT: call <8 x i16> @llvm.bswap
+// OPT3-NEXT: store <8 x i16>
+// OPT3-NEXT: ret void
 #[no_mangle]
 pub fn convert(value: [u16; 8]) -> [u8; 16] {
     #[cfg(target_endian = "little")]

From 3c0c9b6770f1ac0324be91580f52b6f45346e47b Mon Sep 17 00:00:00 2001
From: Jubilee Young 
Date: Sat, 8 Feb 2025 19:45:40 -0800
Subject: [PATCH 105/128] tests/codegen: use -Copt-level=3 instead of -O

---
 tests/codegen/abi-repr-ext.rs                                   | 2 +-
 tests/codegen/align-offset.rs                                   | 2 +-
 tests/codegen/alloc-optimisation.rs                             | 2 +-
 tests/codegen/array-clone.rs                                    | 2 +-
 tests/codegen/array-codegen.rs                                  | 2 +-
 tests/codegen/array-equality.rs                                 | 2 +-
 tests/codegen/array-optimized.rs                                | 2 +-
 tests/codegen/array-repeat.rs                                   | 2 +-
 tests/codegen/asm/goto.rs                                       | 2 +-
 tests/codegen/asm/may_unwind.rs                                 | 2 +-
 tests/codegen/asm/maybe-uninit.rs                               | 2 +-
 tests/codegen/asm/multiple-options.rs                           | 2 +-
 tests/codegen/asm/options.rs                                    | 2 +-
 tests/codegen/asm/x86-clobber_abi.rs                            | 2 +-
 tests/codegen/asm/x86-clobbers.rs                               | 2 +-
 tests/codegen/atomic-operations.rs                              | 2 +-
 tests/codegen/atomicptr.rs                                      | 2 +-
 tests/codegen/avr/avr-func-addrspace.rs                         | 2 +-
 tests/codegen/binary-heap-peek-mut-pop-no-panic.rs              | 2 +-
 tests/codegen/binary-search-index-no-bound-check.rs             | 2 +-
 tests/codegen/box-uninit-bytes.rs                               | 2 +-
 tests/codegen/call-metadata.rs                                  | 2 +-
 tests/codegen/cast-optimized.rs                                 | 2 +-
 tests/codegen/cast-target-abi.rs                                | 2 +-
 tests/codegen/catch-unwind.rs                                   | 2 +-
 tests/codegen/char-ascii-branchless.rs                          | 2 +-
 tests/codegen/checked_ilog.rs                                   | 2 +-
 tests/codegen/checked_math.rs                                   | 2 +-
 tests/codegen/clone_as_copy.rs                                  | 2 +-
 tests/codegen/common_prim_int_ptr.rs                            | 2 +-
 tests/codegen/const-array.rs                                    | 2 +-
 tests/codegen/cross-crate-inlining/always-inline.rs             | 2 +-
 tests/codegen/cross-crate-inlining/auxiliary/always.rs          | 2 +-
 tests/codegen/cross-crate-inlining/auxiliary/leaf.rs            | 2 +-
 tests/codegen/cross-crate-inlining/auxiliary/never.rs           | 2 +-
 tests/codegen/cross-crate-inlining/leaf-inlining.rs             | 2 +-
 tests/codegen/cross-crate-inlining/never-inline.rs              | 2 +-
 tests/codegen/dealloc-no-unwind.rs                              | 2 +-
 tests/codegen/debug-fndef-size.rs                               | 2 +-
 tests/codegen/debuginfo-constant-locals.rs                      | 2 +-
 tests/codegen/debuginfo-inline-callsite-location.rs             | 2 +-
 tests/codegen/deduced-param-attrs.rs                            | 2 +-
 tests/codegen/drop-in-place-noalias.rs                          | 2 +-
 tests/codegen/dst-vtable-align-nonzero.rs                       | 2 +-
 tests/codegen/dst-vtable-size-range.rs                          | 2 +-
 tests/codegen/emscripten-catch-unwind-js-eh.rs                  | 2 +-
 tests/codegen/emscripten-catch-unwind-wasm-eh.rs                | 2 +-
 tests/codegen/enum/enum-bounds-check-derived-idx.rs             | 2 +-
 tests/codegen/enum/enum-bounds-check-issue-13926.rs             | 2 +-
 tests/codegen/enum/enum-bounds-check.rs                         | 2 +-
 tests/codegen/enum/enum-early-otherwise-branch.rs               | 2 +-
 tests/codegen/enum/unreachable_enum_default_branch.rs           | 2 +-
 tests/codegen/error-provide.rs                                  | 2 +-
 tests/codegen/external-no-mangle-statics.rs                     | 2 +-
 tests/codegen/f128-wasm32-callconv.rs                           | 2 +-
 tests/codegen/fastcall-inreg.rs                                 | 2 +-
 tests/codegen/fewer-names.rs                                    | 2 +-
 tests/codegen/function-arguments.rs                             | 2 +-
 tests/codegen/hint/cold_path.rs                                 | 2 +-
 tests/codegen/hint/likely.rs                                    | 2 +-
 tests/codegen/hint/unlikely.rs                                  | 2 +-
 tests/codegen/i128-wasm32-callconv.rs                           | 2 +-
 tests/codegen/i128-x86-align.rs                                 | 2 +-
 tests/codegen/integer-overflow.rs                               | 2 +-
 tests/codegen/intrinsics/aggregate-thin-pointer.rs              | 2 +-
 tests/codegen/intrinsics/cold_path.rs                           | 2 +-
 tests/codegen/intrinsics/compare_bytes.rs                       | 2 +-
 tests/codegen/intrinsics/likely.rs                              | 2 +-
 tests/codegen/intrinsics/likely_assert.rs                       | 2 +-
 tests/codegen/intrinsics/nontemporal.rs                         | 2 +-
 tests/codegen/intrinsics/offset.rs                              | 2 +-
 tests/codegen/intrinsics/ptr_metadata.rs                        | 2 +-
 tests/codegen/intrinsics/select_unpredictable.rs                | 2 +-
 tests/codegen/intrinsics/transmute-x64.rs                       | 2 +-
 tests/codegen/intrinsics/transmute.rs                           | 2 +-
 tests/codegen/intrinsics/unlikely.rs                            | 2 +-
 tests/codegen/is_val_statically_known.rs                        | 2 +-
 tests/codegen/issues/issue-101048.rs                            | 2 +-
 tests/codegen/issues/issue-101082.rs                            | 2 +-
 tests/codegen/issues/issue-101814.rs                            | 2 +-
 tests/codegen/issues/issue-103132.rs                            | 2 +-
 tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs    | 2 +-
 tests/codegen/issues/issue-103327.rs                            | 2 +-
 tests/codegen/issues/issue-103840.rs                            | 2 +-
 tests/codegen/issues/issue-105386-ub-in-debuginfo.rs            | 2 +-
 tests/codegen/issues/issue-106369.rs                            | 2 +-
 tests/codegen/issues/issue-107681-unwrap_unchecked.rs           | 2 +-
 tests/codegen/issues/issue-108395-branchy-bool-match.rs         | 2 +-
 tests/codegen/issues/issue-109328-split_first.rs                | 2 +-
 tests/codegen/issues/issue-110797-enum-jump-same.rs             | 2 +-
 tests/codegen/issues/issue-111603.rs                            | 2 +-
 tests/codegen/issues/issue-112509-slice-get-andthen-get.rs      | 2 +-
 tests/codegen/issues/issue-114312.rs                            | 2 +-
 tests/codegen/issues/issue-115385-llvm-jump-threading.rs        | 2 +-
 tests/codegen/issues/issue-116878.rs                            | 2 +-
 tests/codegen/issues/issue-118306.rs                            | 2 +-
 tests/codegen/issues/issue-118392.rs                            | 2 +-
 tests/codegen/issues/issue-119422.rs                            | 2 +-
 tests/codegen/issues/issue-121719-common-field-offset.rs        | 2 +-
 tests/codegen/issues/issue-122600-ptr-discriminant-update.rs    | 2 +-
 tests/codegen/issues/issue-13018.rs                             | 2 +-
 tests/codegen/issues/issue-27130.rs                             | 2 +-
 tests/codegen/issues/issue-34634.rs                             | 2 +-
 tests/codegen/issues/issue-34947-pow-i32.rs                     | 2 +-
 tests/codegen/issues/issue-36010-some-box-is_some.rs            | 2 +-
 tests/codegen/issues/issue-37945.rs                             | 2 +-
 tests/codegen/issues/issue-45222.rs                             | 2 +-
 tests/codegen/issues/issue-45466.rs                             | 2 +-
 tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs      | 2 +-
 tests/codegen/issues/issue-59352.rs                             | 2 +-
 tests/codegen/issues/issue-68667-unwrap-combinators.rs          | 2 +-
 tests/codegen/issues/issue-69101-bounds-check.rs                | 2 +-
 tests/codegen/issues/issue-73031.rs                             | 2 +-
 tests/codegen/issues/issue-73258.rs                             | 2 +-
 tests/codegen/issues/issue-73396-bounds-check-after-position.rs | 2 +-
 .../codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs | 2 +-
 tests/codegen/issues/issue-74938-array-split-at.rs              | 2 +-
 tests/codegen/issues/issue-75525-bounds-checks.rs               | 2 +-
 tests/codegen/issues/issue-75546.rs                             | 2 +-
 tests/codegen/issues/issue-75659.rs                             | 2 +-
 tests/codegen/issues/issue-75978.rs                             | 2 +-
 tests/codegen/issues/issue-77812.rs                             | 2 +-
 tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs   | 2 +-
 tests/codegen/issues/issue-84268.rs                             | 2 +-
 tests/codegen/issues/issue-85872-multiple-reverse.rs            | 2 +-
 tests/codegen/issues/issue-86109-eliminate-div-by-zero-check.rs | 2 +-
 tests/codegen/issues/issue-93036-assert-index.rs                | 2 +-
 tests/codegen/issues/issue-96274.rs                             | 2 +-
 tests/codegen/issues/issue-96497-slice-size-nowrap.rs           | 2 +-
 tests/codegen/issues/issue-98156-const-arg-temp-lifetime.rs     | 2 +-
 tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs | 2 +-
 tests/codegen/issues/issue-99960.rs                             | 2 +-
 tests/codegen/layout-size-checks.rs                             | 2 +-
 tests/codegen/lib-optimizations/iter-sum.rs                     | 2 +-
 tests/codegen/lib-optimizations/slice_rotate.rs                 | 2 +-
 tests/codegen/lifetime_start_end.rs                             | 2 +-
 tests/codegen/loads.rs                                          | 2 +-
 tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs            | 2 +-
 tests/codegen/lto-removes-invokes.rs                            | 2 +-
 tests/codegen/macos/i686-macosx-deployment-target.rs            | 2 +-
 tests/codegen/macos/i686-no-macosx-deployment-target.rs         | 2 +-
 tests/codegen/macos/x86_64-macosx-deployment-target.rs          | 2 +-
 tests/codegen/macos/x86_64-no-macosx-deployment-target.rs       | 2 +-
 tests/codegen/match-optimized.rs                                | 2 +-
 tests/codegen/match-optimizes-away.rs                           | 2 +-
 tests/codegen/maybeuninit-rvo.rs                                | 2 +-
 tests/codegen/mem-replace-simple-type.rs                        | 2 +-
 tests/codegen/merge-functions.rs                                | 2 +-
 tests/codegen/mir-aggregate-no-alloca.rs                        | 2 +-
 tests/codegen/mir-inlined-line-numbers.rs                       | 2 +-
 tests/codegen/move-before-nocapture-ref-arg.rs                  | 2 +-
 tests/codegen/move-operands.rs                                  | 2 +-
 tests/codegen/naked-fn/generics.rs                              | 2 +-
 tests/codegen/noalias-box-off.rs                                | 2 +-
 tests/codegen/noalias-box.rs                                    | 2 +-
 tests/codegen/noalias-flag.rs                                   | 2 +-
 tests/codegen/noalias-refcell.rs                                | 2 +-
 tests/codegen/noalias-rwlockreadguard.rs                        | 2 +-
 tests/codegen/noalias-unpin.rs                                  | 2 +-
 tests/codegen/nrvo.rs                                           | 2 +-
 tests/codegen/option-as-slice.rs                                | 2 +-
 tests/codegen/option-niche-eq.rs                                | 2 +-
 tests/codegen/packed.rs                                         | 2 +-
 tests/codegen/panic-abort-windows.rs                            | 2 +-
 tests/codegen/panic-in-drop-abort.rs                            | 2 +-
 tests/codegen/personality_lifetimes.rs                          | 2 +-
 tests/codegen/placement-new.rs                                  | 2 +-
 tests/codegen/ptr-arithmetic.rs                                 | 2 +-
 tests/codegen/ptr-read-metadata.rs                              | 2 +-
 tests/codegen/range-attribute.rs                                | 2 +-
 tests/codegen/range_to_inclusive.rs                             | 2 +-
 tests/codegen/reg-struct-return.rs                              | 2 +-
 tests/codegen/regparm-inreg.rs                                  | 2 +-
 tests/codegen/repeat-trusted-len.rs                             | 2 +-
 tests/codegen/repr/transparent-byval-struct-ptr.rs              | 2 +-
 tests/codegen/repr/transparent-imm-array.rs                     | 2 +-
 tests/codegen/repr/transparent-mips64.rs                        | 2 +-
 tests/codegen/repr/transparent-opaque-ptr.rs                    | 2 +-
 tests/codegen/repr/transparent-sparc64.rs                       | 2 +-
 tests/codegen/repr/transparent-sysv64.rs                        | 2 +-
 tests/codegen/repr/transparent.rs                               | 2 +-
 tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs         | 2 +-
 tests/codegen/riscv-abi/riscv64-lp64d-abi.rs                    | 2 +-
 tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs              | 2 +-
 tests/codegen/rust-abi-arch-specific-adjustment.rs              | 2 +-
 tests/codegen/s390x-simd.rs                                     | 2 +-
 tests/codegen/scalar-pair-bool.rs                               | 2 +-
 tests/codegen/simd/swap-simd-types.rs                           | 2 +-
 tests/codegen/slice-as_chunks.rs                                | 2 +-
 tests/codegen/slice-indexing.rs                                 | 2 +-
 tests/codegen/slice-iter-fold.rs                                | 2 +-
 tests/codegen/slice-iter-len-eq-zero.rs                         | 2 +-
 tests/codegen/slice-iter-nonnull.rs                             | 2 +-
 tests/codegen/slice-pointer-nonnull-unwrap.rs                   | 2 +-
 tests/codegen/slice-position-bounds-check.rs                    | 2 +-
 tests/codegen/slice-ref-equality.rs                             | 2 +-
 tests/codegen/slice-reverse.rs                                  | 2 +-
 tests/codegen/slice-windows-no-bounds-check.rs                  | 2 +-
 tests/codegen/slice_as_from_ptr_range.rs                        | 2 +-
 tests/codegen/some-global-nonnull.rs                            | 2 +-
 tests/codegen/sparc-struct-abi.rs                               | 2 +-
 tests/codegen/static-relocation-model-msvc.rs                   | 2 +-
 tests/codegen/step_by-overflow-checks.rs                        | 2 +-
 tests/codegen/swap-large-types.rs                               | 2 +-
 tests/codegen/swap-small-types.rs                               | 2 +-
 tests/codegen/thread-local.rs                                   | 2 +-
 tests/codegen/to_vec.rs                                         | 2 +-
 tests/codegen/trailing_zeros.rs                                 | 2 +-
 tests/codegen/transmute-optimized.rs                            | 2 +-
 tests/codegen/try_question_mark_nop.rs                          | 2 +-
 tests/codegen/ub-checks.rs                                      | 2 +-
 tests/codegen/unchecked_shifts.rs                               | 2 +-
 tests/codegen/union-abi.rs                                      | 2 +-
 tests/codegen/var-names.rs                                      | 2 +-
 tests/codegen/vec-as-ptr.rs                                     | 2 +-
 tests/codegen/vec-calloc.rs                                     | 2 +-
 tests/codegen/vec-in-place.rs                                   | 2 +-
 tests/codegen/vec-iter-collect-len.rs                           | 2 +-
 tests/codegen/vec-iter.rs                                       | 2 +-
 tests/codegen/vec-len-invariant.rs                              | 2 +-
 tests/codegen/vec-optimizes-away.rs                             | 2 +-
 tests/codegen/vec-reserve-extend.rs                             | 2 +-
 tests/codegen/vec-shrink-panik.rs                               | 2 +-
 tests/codegen/vec-with-capacity.rs                              | 2 +-
 tests/codegen/vec_pop_push_noop.rs                              | 2 +-
 tests/codegen/vecdeque-drain.rs                                 | 2 +-
 tests/codegen/vecdeque-nonempty-get-no-panic.rs                 | 2 +-
 tests/codegen/vecdeque_no_panic.rs                              | 2 +-
 tests/codegen/vecdeque_pop_push.rs                              | 2 +-
 tests/codegen/virtual-function-elimination-32bit.rs             | 2 +-
 tests/codegen/virtual-function-elimination.rs                   | 2 +-
 tests/codegen/vtable-loads.rs                                   | 2 +-
 tests/codegen/zip.rs                                            | 2 +-
 233 files changed, 233 insertions(+), 233 deletions(-)

diff --git a/tests/codegen/abi-repr-ext.rs b/tests/codegen/abi-repr-ext.rs
index a42f73566961..b06d225ed70e 100644
--- a/tests/codegen/abi-repr-ext.rs
+++ b/tests/codegen/abi-repr-ext.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 //@ revisions:x86_64 i686 aarch64-apple aarch64-windows aarch64-linux arm riscv
 
diff --git a/tests/codegen/align-offset.rs b/tests/codegen/align-offset.rs
index aeac230f718f..21062cc0a914 100644
--- a/tests/codegen/align-offset.rs
+++ b/tests/codegen/align-offset.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/alloc-optimisation.rs b/tests/codegen/alloc-optimisation.rs
index 6f320e68fdb3..8abeecf8550b 100644
--- a/tests/codegen/alloc-optimisation.rs
+++ b/tests/codegen/alloc-optimisation.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 #[no_mangle]
diff --git a/tests/codegen/array-clone.rs b/tests/codegen/array-clone.rs
index 2873f3cadca8..35445174684f 100644
--- a/tests/codegen/array-clone.rs
+++ b/tests/codegen/array-clone.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/array-codegen.rs b/tests/codegen/array-codegen.rs
index fc272f2556cb..9b0c6e8c3472 100644
--- a/tests/codegen/array-codegen.rs
+++ b/tests/codegen/array-codegen.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/array-equality.rs b/tests/codegen/array-equality.rs
index bc5425c7a4f4..fa0475bf4809 100644
--- a/tests/codegen/array-equality.rs
+++ b/tests/codegen/array-equality.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Z merge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
 //@ only-x86_64
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/array-optimized.rs b/tests/codegen/array-optimized.rs
index 42fdbd39b7ef..000163d5519b 100644
--- a/tests/codegen/array-optimized.rs
+++ b/tests/codegen/array-optimized.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/array-repeat.rs b/tests/codegen/array-repeat.rs
index b6f3b2e83d3e..4c755df93903 100644
--- a/tests/codegen/array-repeat.rs
+++ b/tests/codegen/array-repeat.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 #![feature(array_repeat)]
diff --git a/tests/codegen/asm/goto.rs b/tests/codegen/asm/goto.rs
index c40a43fbe1bd..7a87bb7983ba 100644
--- a/tests/codegen/asm/goto.rs
+++ b/tests/codegen/asm/goto.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ only-x86_64
 
 #![crate_type = "rlib"]
diff --git a/tests/codegen/asm/may_unwind.rs b/tests/codegen/asm/may_unwind.rs
index be66b3975ff8..63cdec7584c9 100644
--- a/tests/codegen/asm/may_unwind.rs
+++ b/tests/codegen/asm/may_unwind.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ only-x86_64
 
 #![crate_type = "rlib"]
diff --git a/tests/codegen/asm/maybe-uninit.rs b/tests/codegen/asm/maybe-uninit.rs
index 55813c35a468..d76d5cb1312e 100644
--- a/tests/codegen/asm/maybe-uninit.rs
+++ b/tests/codegen/asm/maybe-uninit.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ only-x86_64
 
 #![crate_type = "rlib"]
diff --git a/tests/codegen/asm/multiple-options.rs b/tests/codegen/asm/multiple-options.rs
index 1ee295e32c9e..4d87471a1939 100644
--- a/tests/codegen/asm/multiple-options.rs
+++ b/tests/codegen/asm/multiple-options.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ only-x86_64
 
 #![crate_type = "rlib"]
diff --git a/tests/codegen/asm/options.rs b/tests/codegen/asm/options.rs
index 96a72c2f5ae9..c087f91fd434 100644
--- a/tests/codegen/asm/options.rs
+++ b/tests/codegen/asm/options.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ only-x86_64
 
 #![crate_type = "rlib"]
diff --git a/tests/codegen/asm/x86-clobber_abi.rs b/tests/codegen/asm/x86-clobber_abi.rs
index cc563474bf8c..5b34b4e8ef31 100644
--- a/tests/codegen/asm/x86-clobber_abi.rs
+++ b/tests/codegen/asm/x86-clobber_abi.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ only-x86_64
 
 #![crate_type = "rlib"]
diff --git a/tests/codegen/asm/x86-clobbers.rs b/tests/codegen/asm/x86-clobbers.rs
index 4094db741346..50163b646b25 100644
--- a/tests/codegen/asm/x86-clobbers.rs
+++ b/tests/codegen/asm/x86-clobbers.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ only-x86_64
 
 #![crate_type = "rlib"]
diff --git a/tests/codegen/atomic-operations.rs b/tests/codegen/atomic-operations.rs
index 8a70c94e4805..8771b8b24199 100644
--- a/tests/codegen/atomic-operations.rs
+++ b/tests/codegen/atomic-operations.rs
@@ -1,5 +1,5 @@
 // Code generation of atomic operations.
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 use std::sync::atomic::AtomicI32;
diff --git a/tests/codegen/atomicptr.rs b/tests/codegen/atomicptr.rs
index e8c5e6a67497..4819af40ca2d 100644
--- a/tests/codegen/atomicptr.rs
+++ b/tests/codegen/atomicptr.rs
@@ -4,7 +4,7 @@
 // ensures that we do not have such a round-trip for AtomicPtr::swap, because LLVM supports pointer
 // arguments to `atomicrmw xchg`.
 
-//@ compile-flags: -O -Cno-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes
 #![crate_type = "lib"]
 #![feature(strict_provenance_atomic_ptr)]
 
diff --git a/tests/codegen/avr/avr-func-addrspace.rs b/tests/codegen/avr/avr-func-addrspace.rs
index 7a36490fe93b..ed8acccb1ad8 100644
--- a/tests/codegen/avr/avr-func-addrspace.rs
+++ b/tests/codegen/avr/avr-func-addrspace.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O --target=avr-unknown-gnu-atmega328 --crate-type=rlib -C panic=abort
+//@ compile-flags: -Copt-level=3 --target=avr-unknown-gnu-atmega328 --crate-type=rlib -C panic=abort
 //@ needs-llvm-components: avr
 
 // This test validates that function pointers can be stored in global variables
diff --git a/tests/codegen/binary-heap-peek-mut-pop-no-panic.rs b/tests/codegen/binary-heap-peek-mut-pop-no-panic.rs
index e3bc9a4761cf..2c40327f6245 100644
--- a/tests/codegen/binary-heap-peek-mut-pop-no-panic.rs
+++ b/tests/codegen/binary-heap-peek-mut-pop-no-panic.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ ignore-std-debug-assertions
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/binary-search-index-no-bound-check.rs b/tests/codegen/binary-search-index-no-bound-check.rs
index a213c015a40b..d59c0beec641 100644
--- a/tests/codegen/binary-search-index-no-bound-check.rs
+++ b/tests/codegen/binary-search-index-no-bound-check.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 // Make sure no bounds checks are emitted when slicing or indexing
diff --git a/tests/codegen/box-uninit-bytes.rs b/tests/codegen/box-uninit-bytes.rs
index 63a6c7b84156..3b83ef3e250c 100644
--- a/tests/codegen/box-uninit-bytes.rs
+++ b/tests/codegen/box-uninit-bytes.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 use std::mem::MaybeUninit;
diff --git a/tests/codegen/call-metadata.rs b/tests/codegen/call-metadata.rs
index b986b4467fac..7ad3ded2f09d 100644
--- a/tests/codegen/call-metadata.rs
+++ b/tests/codegen/call-metadata.rs
@@ -1,7 +1,7 @@
 // Checks that range metadata gets emitted on calls to functions returning a
 // scalar value.
 
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 //@ max-llvm-major-version: 18
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/cast-optimized.rs b/tests/codegen/cast-optimized.rs
index 59cf40935cd5..11220c4a922b 100644
--- a/tests/codegen/cast-optimized.rs
+++ b/tests/codegen/cast-optimized.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Z merge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
 #![crate_type = "lib"]
 
 // This tests that LLVM can optimize based on the niches in the source or
diff --git a/tests/codegen/cast-target-abi.rs b/tests/codegen/cast-target-abi.rs
index b3a35cbf3b1c..a0801eb98269 100644
--- a/tests/codegen/cast-target-abi.rs
+++ b/tests/codegen/cast-target-abi.rs
@@ -1,7 +1,7 @@
 // ignore-tidy-linelength
 //@ revisions:aarch64 loongarch64 powerpc64 sparc64 x86_64
 //@ min-llvm-version: 19
-//@ compile-flags: -O -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error
+//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error
 
 //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu
 //@[aarch64] needs-llvm-components: arm
diff --git a/tests/codegen/catch-unwind.rs b/tests/codegen/catch-unwind.rs
index 48ad486fa03a..d1ff55bcc285 100644
--- a/tests/codegen/catch-unwind.rs
+++ b/tests/codegen/catch-unwind.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 // On x86 the closure is inlined in foo() producing something like
 // define i32 @foo() [...] {
diff --git a/tests/codegen/char-ascii-branchless.rs b/tests/codegen/char-ascii-branchless.rs
index 76d2f617ed1c..f99066aa9aae 100644
--- a/tests/codegen/char-ascii-branchless.rs
+++ b/tests/codegen/char-ascii-branchless.rs
@@ -1,6 +1,6 @@
 // Checks that these functions are branchless.
 //
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/checked_ilog.rs b/tests/codegen/checked_ilog.rs
index d7dfc7c29e7d..e340a45b6a96 100644
--- a/tests/codegen/checked_ilog.rs
+++ b/tests/codegen/checked_ilog.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/checked_math.rs b/tests/codegen/checked_math.rs
index c612ddccdaa4..66667c694881 100644
--- a/tests/codegen/checked_math.rs
+++ b/tests/codegen/checked_math.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Z merge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
 
 #![crate_type = "lib"]
 #![feature(unchecked_shifts)]
diff --git a/tests/codegen/clone_as_copy.rs b/tests/codegen/clone_as_copy.rs
index 6ba198297e22..c39f120044c0 100644
--- a/tests/codegen/clone_as_copy.rs
+++ b/tests/codegen/clone_as_copy.rs
@@ -1,7 +1,7 @@
 //@ revisions: DEBUGINFO NODEBUGINFO
 //@ compile-flags: -Zunsound-mir-opts
 // FIXME: see 
-//@ compile-flags: -O -Cno-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes
 //@ [DEBUGINFO] compile-flags: -Cdebuginfo=full
 
 // From https://github.com/rust-lang/rust/issues/128081.
diff --git a/tests/codegen/common_prim_int_ptr.rs b/tests/codegen/common_prim_int_ptr.rs
index aa7ebb4c9119..8eb050241741 100644
--- a/tests/codegen/common_prim_int_ptr.rs
+++ b/tests/codegen/common_prim_int_ptr.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 #![feature(core_intrinsics)]
diff --git a/tests/codegen/const-array.rs b/tests/codegen/const-array.rs
index f2b331c315dc..e257d8acc088 100644
--- a/tests/codegen/const-array.rs
+++ b/tests/codegen/const-array.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/cross-crate-inlining/always-inline.rs b/tests/codegen/cross-crate-inlining/always-inline.rs
index d3a35dadb67b..df28b3fe197c 100644
--- a/tests/codegen/cross-crate-inlining/always-inline.rs
+++ b/tests/codegen/cross-crate-inlining/always-inline.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ aux-build:always.rs
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/cross-crate-inlining/auxiliary/always.rs b/tests/codegen/cross-crate-inlining/auxiliary/always.rs
index 7f524e17d34a..6ee3f81e3c87 100644
--- a/tests/codegen/cross-crate-inlining/auxiliary/always.rs
+++ b/tests/codegen/cross-crate-inlining/auxiliary/always.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Zcross-crate-inline-threshold=always
+//@ compile-flags: -Copt-level=3 -Zcross-crate-inline-threshold=always
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/cross-crate-inlining/auxiliary/leaf.rs b/tests/codegen/cross-crate-inlining/auxiliary/leaf.rs
index 5895812b5ee5..d059a3d0a73b 100644
--- a/tests/codegen/cross-crate-inlining/auxiliary/leaf.rs
+++ b/tests/codegen/cross-crate-inlining/auxiliary/leaf.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/cross-crate-inlining/auxiliary/never.rs b/tests/codegen/cross-crate-inlining/auxiliary/never.rs
index 3a391608df84..55c90809ec18 100644
--- a/tests/codegen/cross-crate-inlining/auxiliary/never.rs
+++ b/tests/codegen/cross-crate-inlining/auxiliary/never.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Zcross-crate-inline-threshold=never
+//@ compile-flags: -Copt-level=3 -Zcross-crate-inline-threshold=never
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/cross-crate-inlining/leaf-inlining.rs b/tests/codegen/cross-crate-inlining/leaf-inlining.rs
index b47898f750a2..37132312ca94 100644
--- a/tests/codegen/cross-crate-inlining/leaf-inlining.rs
+++ b/tests/codegen/cross-crate-inlining/leaf-inlining.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Zcross-crate-inline-threshold=yes
+//@ compile-flags: -Copt-level=3 -Zcross-crate-inline-threshold=yes
 //@ aux-build:leaf.rs
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/cross-crate-inlining/never-inline.rs b/tests/codegen/cross-crate-inlining/never-inline.rs
index eedf90ceec0f..759f65d9d42b 100644
--- a/tests/codegen/cross-crate-inlining/never-inline.rs
+++ b/tests/codegen/cross-crate-inlining/never-inline.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ aux-build:never.rs
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/dealloc-no-unwind.rs b/tests/codegen/dealloc-no-unwind.rs
index ead26da610e2..c560d7a99320 100644
--- a/tests/codegen/dealloc-no-unwind.rs
+++ b/tests/codegen/dealloc-no-unwind.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/debug-fndef-size.rs b/tests/codegen/debug-fndef-size.rs
index c58a8228967a..8f716c34e7b7 100644
--- a/tests/codegen/debug-fndef-size.rs
+++ b/tests/codegen/debug-fndef-size.rs
@@ -1,7 +1,7 @@
 // Verify that `i32::cmp` FnDef type is declared with a size of 0 and an
 // alignment of 8 bits (1 byte) in LLVM debuginfo.
 
-//@ compile-flags: -O -g -Cno-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -g -Cno-prepopulate-passes
 //@ ignore-msvc the types are mangled differently
 
 use std::cmp::Ordering;
diff --git a/tests/codegen/debuginfo-constant-locals.rs b/tests/codegen/debuginfo-constant-locals.rs
index c8f1d964722e..580c69c05a54 100644
--- a/tests/codegen/debuginfo-constant-locals.rs
+++ b/tests/codegen/debuginfo-constant-locals.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -g -O
+//@ compile-flags: -g -Copt-level=3
 
 // Check that simple constant values are preserved in debuginfo across both MIR opts and LLVM opts
 
diff --git a/tests/codegen/debuginfo-inline-callsite-location.rs b/tests/codegen/debuginfo-inline-callsite-location.rs
index c31788d82db3..59ade52ad327 100644
--- a/tests/codegen/debuginfo-inline-callsite-location.rs
+++ b/tests/codegen/debuginfo-inline-callsite-location.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -g -O -C panic=abort
+//@ compile-flags: -g -Copt-level=3 -C panic=abort
 
 // Check that each inline call site for the same function uses the same "sub-program" so that LLVM
 // can correctly merge the debug info if it merges the inlined code (e.g., for merging of tail
diff --git a/tests/codegen/deduced-param-attrs.rs b/tests/codegen/deduced-param-attrs.rs
index 5e7c571b63f8..22db090d4d88 100644
--- a/tests/codegen/deduced-param-attrs.rs
+++ b/tests/codegen/deduced-param-attrs.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 #![allow(incomplete_features)]
diff --git a/tests/codegen/drop-in-place-noalias.rs b/tests/codegen/drop-in-place-noalias.rs
index 2dc769df1c92..bff2f52781f2 100644
--- a/tests/codegen/drop-in-place-noalias.rs
+++ b/tests/codegen/drop-in-place-noalias.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 
 // Tests that the compiler can apply `noalias` and other &mut attributes to `drop_in_place`.
 // Note that non-Unpin types should not get `noalias`, matching &mut behavior.
diff --git a/tests/codegen/dst-vtable-align-nonzero.rs b/tests/codegen/dst-vtable-align-nonzero.rs
index cb07e43238c1..1404bd64f500 100644
--- a/tests/codegen/dst-vtable-align-nonzero.rs
+++ b/tests/codegen/dst-vtable-align-nonzero.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Z merge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
 
 #![crate_type = "lib"]
 #![feature(core_intrinsics)]
diff --git a/tests/codegen/dst-vtable-size-range.rs b/tests/codegen/dst-vtable-size-range.rs
index 69d8e68497ca..670f5e8d553f 100644
--- a/tests/codegen/dst-vtable-size-range.rs
+++ b/tests/codegen/dst-vtable-size-range.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Z merge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
 
 #![crate_type = "lib"]
 #![feature(core_intrinsics)]
diff --git a/tests/codegen/emscripten-catch-unwind-js-eh.rs b/tests/codegen/emscripten-catch-unwind-js-eh.rs
index b15fb40b68f0..018ad5454fc2 100644
--- a/tests/codegen/emscripten-catch-unwind-js-eh.rs
+++ b/tests/codegen/emscripten-catch-unwind-js-eh.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O --target wasm32-unknown-emscripten
+//@ compile-flags: -Copt-level=3 --target wasm32-unknown-emscripten
 //@ needs-llvm-components: webassembly
 
 // Emscripten has its own unique implementation of catch_unwind (in `codegen_emcc_try`),
diff --git a/tests/codegen/emscripten-catch-unwind-wasm-eh.rs b/tests/codegen/emscripten-catch-unwind-wasm-eh.rs
index 72395f432d5f..0fc9ae96720e 100644
--- a/tests/codegen/emscripten-catch-unwind-wasm-eh.rs
+++ b/tests/codegen/emscripten-catch-unwind-wasm-eh.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O --target wasm32-unknown-emscripten -Z emscripten-wasm-eh
+//@ compile-flags: -Copt-level=3 --target wasm32-unknown-emscripten -Z emscripten-wasm-eh
 //@ needs-llvm-components: webassembly
 
 // Emscripten catch_unwind using wasm exceptions
diff --git a/tests/codegen/enum/enum-bounds-check-derived-idx.rs b/tests/codegen/enum/enum-bounds-check-derived-idx.rs
index 15280cb2e6c8..a5785f4addf0 100644
--- a/tests/codegen/enum/enum-bounds-check-derived-idx.rs
+++ b/tests/codegen/enum/enum-bounds-check-derived-idx.rs
@@ -1,6 +1,6 @@
 // This test checks an optimization that is not guaranteed to work. This test case should not block
 // a future LLVM update.
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/enum/enum-bounds-check-issue-13926.rs b/tests/codegen/enum/enum-bounds-check-issue-13926.rs
index b60ff38ce392..6e8e5035b0d0 100644
--- a/tests/codegen/enum/enum-bounds-check-issue-13926.rs
+++ b/tests/codegen/enum/enum-bounds-check-issue-13926.rs
@@ -1,6 +1,6 @@
 // This test checks an optimization that is not guaranteed to work. This test case should not block
 // a future LLVM update.
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/enum/enum-bounds-check.rs b/tests/codegen/enum/enum-bounds-check.rs
index c44c007ed6a9..5362598ca7c4 100644
--- a/tests/codegen/enum/enum-bounds-check.rs
+++ b/tests/codegen/enum/enum-bounds-check.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/enum/enum-early-otherwise-branch.rs b/tests/codegen/enum/enum-early-otherwise-branch.rs
index 07c8aed2624c..8d39d8e9b746 100644
--- a/tests/codegen/enum/enum-early-otherwise-branch.rs
+++ b/tests/codegen/enum/enum-early-otherwise-branch.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/enum/unreachable_enum_default_branch.rs b/tests/codegen/enum/unreachable_enum_default_branch.rs
index 76a92496c072..55b165fc111d 100644
--- a/tests/codegen/enum/unreachable_enum_default_branch.rs
+++ b/tests/codegen/enum/unreachable_enum_default_branch.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/error-provide.rs b/tests/codegen/error-provide.rs
index 68dd383e5cce..25a66078fd4a 100644
--- a/tests/codegen/error-provide.rs
+++ b/tests/codegen/error-provide.rs
@@ -1,6 +1,6 @@
 // Codegen test for #126242
 
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 #![feature(error_generic_member_access)]
 use std::error::Request;
diff --git a/tests/codegen/external-no-mangle-statics.rs b/tests/codegen/external-no-mangle-statics.rs
index a44867ff9230..dc4eca8c7b48 100644
--- a/tests/codegen/external-no-mangle-statics.rs
+++ b/tests/codegen/external-no-mangle-statics.rs
@@ -1,6 +1,6 @@
 //@ revisions: lib staticlib
 //@ ignore-emscripten default visibility is hidden
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ [lib] compile-flags: --crate-type lib
 //@ [staticlib] compile-flags: --crate-type staticlib
 // `#[no_mangle]`d static variables always have external linkage, i.e., no `internal` in their
diff --git a/tests/codegen/f128-wasm32-callconv.rs b/tests/codegen/f128-wasm32-callconv.rs
index 8b1b5e7fb013..7dccbda18f1a 100644
--- a/tests/codegen/f128-wasm32-callconv.rs
+++ b/tests/codegen/f128-wasm32-callconv.rs
@@ -1,7 +1,7 @@
 //! Verify that Rust implements the expected calling convention for `f128`
 
 //@ add-core-stubs
-//@ compile-flags: -O --target wasm32-wasip1
+//@ compile-flags: -Copt-level=3 --target wasm32-wasip1
 //@ needs-llvm-components: webassembly
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/fastcall-inreg.rs b/tests/codegen/fastcall-inreg.rs
index 2459ec1539e4..00b390bf1bf1 100644
--- a/tests/codegen/fastcall-inreg.rs
+++ b/tests/codegen/fastcall-inreg.rs
@@ -2,7 +2,7 @@
 // as "inreg" like the C/C++ compilers for the platforms.
 // x86 only.
 
-//@ compile-flags: --target i686-unknown-linux-gnu -O -C no-prepopulate-passes
+//@ compile-flags: --target i686-unknown-linux-gnu -Cno-prepopulate-passes -Copt-level=3
 //@ needs-llvm-components: x86
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/fewer-names.rs b/tests/codegen/fewer-names.rs
index a171629a076b..ff7a916b619c 100644
--- a/tests/codegen/fewer-names.rs
+++ b/tests/codegen/fewer-names.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -Coverflow-checks=no -O
+//@ compile-flags: -Coverflow-checks=no -Copt-level=3
 //@ revisions: YES NO
 //@ [YES]compile-flags: -Zfewer-names=yes
 //@ [NO] compile-flags: -Zfewer-names=no
diff --git a/tests/codegen/function-arguments.rs b/tests/codegen/function-arguments.rs
index 1a211dfe096b..f0708a7a109f 100644
--- a/tests/codegen/function-arguments.rs
+++ b/tests/codegen/function-arguments.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 #![crate_type = "lib"]
 #![feature(rustc_attrs)]
 #![feature(dyn_star)]
diff --git a/tests/codegen/hint/cold_path.rs b/tests/codegen/hint/cold_path.rs
index dac72073f858..149abe474f67 100644
--- a/tests/codegen/hint/cold_path.rs
+++ b/tests/codegen/hint/cold_path.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 #![feature(cold_path)]
 
diff --git a/tests/codegen/hint/likely.rs b/tests/codegen/hint/likely.rs
index 2f589cc99d28..75f9e7aae367 100644
--- a/tests/codegen/hint/likely.rs
+++ b/tests/codegen/hint/likely.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 #![feature(likely_unlikely)]
 
diff --git a/tests/codegen/hint/unlikely.rs b/tests/codegen/hint/unlikely.rs
index 328533f30816..248b1e2537e9 100644
--- a/tests/codegen/hint/unlikely.rs
+++ b/tests/codegen/hint/unlikely.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 #![feature(likely_unlikely)]
 
diff --git a/tests/codegen/i128-wasm32-callconv.rs b/tests/codegen/i128-wasm32-callconv.rs
index c6d25fbe8bea..9d73d270ef3d 100644
--- a/tests/codegen/i128-wasm32-callconv.rs
+++ b/tests/codegen/i128-wasm32-callconv.rs
@@ -1,7 +1,7 @@
 //! Verify that Rust implements the expected calling convention for `i128`/`u128`.
 
 //@ add-core-stubs
-//@ compile-flags: -O --target wasm32-wasip1
+//@ compile-flags: -Copt-level=3 --target wasm32-wasip1
 //@ needs-llvm-components: webassembly
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/i128-x86-align.rs b/tests/codegen/i128-x86-align.rs
index ac101b72513d..75802b0c5056 100644
--- a/tests/codegen/i128-x86-align.rs
+++ b/tests/codegen/i128-x86-align.rs
@@ -1,5 +1,5 @@
 //@ only-x86_64
-//@ compile-flags: -O -C no-prepopulate-passes --crate-type=lib
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --crate-type=lib
 
 // On LLVM 17 and earlier LLVM's own data layout specifies that i128 has 8 byte alignment,
 // while rustc wants it to have 16 byte alignment. This test checks that we handle this
diff --git a/tests/codegen/integer-overflow.rs b/tests/codegen/integer-overflow.rs
index a6407476fc20..80362247a86f 100644
--- a/tests/codegen/integer-overflow.rs
+++ b/tests/codegen/integer-overflow.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C overflow-checks=on
+//@ compile-flags: -Copt-level=3 -C overflow-checks=on
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/intrinsics/aggregate-thin-pointer.rs b/tests/codegen/intrinsics/aggregate-thin-pointer.rs
index aa3bf7e8b14a..bd590ce91809 100644
--- a/tests/codegen/intrinsics/aggregate-thin-pointer.rs
+++ b/tests/codegen/intrinsics/aggregate-thin-pointer.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes -Z mir-enable-passes=-InstSimplify
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes -Z mir-enable-passes=-InstSimplify
 //@ only-64bit (so I don't need to worry about usize)
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/intrinsics/cold_path.rs b/tests/codegen/intrinsics/cold_path.rs
index 24ee84e07bf1..fd75324b671e 100644
--- a/tests/codegen/intrinsics/cold_path.rs
+++ b/tests/codegen/intrinsics/cold_path.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 #![feature(core_intrinsics)]
 
diff --git a/tests/codegen/intrinsics/compare_bytes.rs b/tests/codegen/intrinsics/compare_bytes.rs
index cd592918fb0c..3ab0e4e97e09 100644
--- a/tests/codegen/intrinsics/compare_bytes.rs
+++ b/tests/codegen/intrinsics/compare_bytes.rs
@@ -1,5 +1,5 @@
 //@ revisions: INT32 INT16
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ [INT32] ignore-16bit
 //@ [INT16] only-16bit
 
diff --git a/tests/codegen/intrinsics/likely.rs b/tests/codegen/intrinsics/likely.rs
index e318390db205..c5e3c466f452 100644
--- a/tests/codegen/intrinsics/likely.rs
+++ b/tests/codegen/intrinsics/likely.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 #![feature(core_intrinsics)]
 
diff --git a/tests/codegen/intrinsics/likely_assert.rs b/tests/codegen/intrinsics/likely_assert.rs
index 0ddbd6206aee..87ffb4ee3fb6 100644
--- a/tests/codegen/intrinsics/likely_assert.rs
+++ b/tests/codegen/intrinsics/likely_assert.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 #[no_mangle]
diff --git a/tests/codegen/intrinsics/nontemporal.rs b/tests/codegen/intrinsics/nontemporal.rs
index ff2d62960668..af8892d30e7f 100644
--- a/tests/codegen/intrinsics/nontemporal.rs
+++ b/tests/codegen/intrinsics/nontemporal.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@revisions: with_nontemporal without_nontemporal
 //@[with_nontemporal] compile-flags: --target aarch64-unknown-linux-gnu
 //@[with_nontemporal] needs-llvm-components: aarch64
diff --git a/tests/codegen/intrinsics/offset.rs b/tests/codegen/intrinsics/offset.rs
index d4791cd30b0b..d76d3e705aba 100644
--- a/tests/codegen/intrinsics/offset.rs
+++ b/tests/codegen/intrinsics/offset.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 
 #![crate_type = "lib"]
 #![feature(core_intrinsics)]
diff --git a/tests/codegen/intrinsics/ptr_metadata.rs b/tests/codegen/intrinsics/ptr_metadata.rs
index f4bf5a1f5f17..87a32fa3d246 100644
--- a/tests/codegen/intrinsics/ptr_metadata.rs
+++ b/tests/codegen/intrinsics/ptr_metadata.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes -Z inline-mir
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes -Z inline-mir
 //@ only-64bit (so I don't need to worry about usize)
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/intrinsics/select_unpredictable.rs b/tests/codegen/intrinsics/select_unpredictable.rs
index ea6127a48bf3..68a02c8342d0 100644
--- a/tests/codegen/intrinsics/select_unpredictable.rs
+++ b/tests/codegen/intrinsics/select_unpredictable.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Zmerge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled
 
 #![feature(core_intrinsics)]
 #![feature(select_unpredictable)]
diff --git a/tests/codegen/intrinsics/transmute-x64.rs b/tests/codegen/intrinsics/transmute-x64.rs
index ea1c6b0e7e80..fe68f1836670 100644
--- a/tests/codegen/intrinsics/transmute-x64.rs
+++ b/tests/codegen/intrinsics/transmute-x64.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 //@ only-x86_64 (it's using arch-specific types)
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/intrinsics/transmute.rs b/tests/codegen/intrinsics/transmute.rs
index 8c8e975d327a..541333a52b0d 100644
--- a/tests/codegen/intrinsics/transmute.rs
+++ b/tests/codegen/intrinsics/transmute.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 //@ only-64bit (so I don't need to worry about usize)
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/intrinsics/unlikely.rs b/tests/codegen/intrinsics/unlikely.rs
index 2d776031a52e..90ebf070d270 100644
--- a/tests/codegen/intrinsics/unlikely.rs
+++ b/tests/codegen/intrinsics/unlikely.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 #![feature(core_intrinsics)]
 
diff --git a/tests/codegen/is_val_statically_known.rs b/tests/codegen/is_val_statically_known.rs
index fe432d3bcc4d..8119d3a3bf67 100644
--- a/tests/codegen/is_val_statically_known.rs
+++ b/tests/codegen/is_val_statically_known.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: --crate-type=lib -Zmerge-functions=disabled -O
+//@ compile-flags: --crate-type=lib -Zmerge-functions=disabled -Copt-level=3
 
 #![feature(core_intrinsics)]
 #![feature(f16, f128)]
diff --git a/tests/codegen/issues/issue-101048.rs b/tests/codegen/issues/issue-101048.rs
index fa6dc550f301..cfe65e758fdb 100644
--- a/tests/codegen/issues/issue-101048.rs
+++ b/tests/codegen/issues/issue-101048.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-101082.rs b/tests/codegen/issues/issue-101082.rs
index 4be1b6cb168e..048b69d207b6 100644
--- a/tests/codegen/issues/issue-101082.rs
+++ b/tests/codegen/issues/issue-101082.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ revisions: host x86-64-v3
 
 // This particular CPU regressed in #131563
diff --git a/tests/codegen/issues/issue-101814.rs b/tests/codegen/issues/issue-101814.rs
index e3843e9edb0b..668ec8476e8c 100644
--- a/tests/codegen/issues/issue-101814.rs
+++ b/tests/codegen/issues/issue-101814.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-103132.rs b/tests/codegen/issues/issue-103132.rs
index 8c1a17c8b78c..623cab92806d 100644
--- a/tests/codegen/issues/issue-103132.rs
+++ b/tests/codegen/issues/issue-103132.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C overflow-checks
+//@ compile-flags: -Copt-level=3 -C overflow-checks
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs b/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs
index 122f02fbbc55..3ada5412e833 100644
--- a/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs
+++ b/tests/codegen/issues/issue-103285-ptr-addr-overflow-check.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C debug-assertions=yes
+//@ compile-flags: -Copt-level=3 -C debug-assertions=yes
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-103327.rs b/tests/codegen/issues/issue-103327.rs
index f8cf273e4a6c..4de3cfd12a09 100644
--- a/tests/codegen/issues/issue-103327.rs
+++ b/tests/codegen/issues/issue-103327.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-103840.rs b/tests/codegen/issues/issue-103840.rs
index 14f157771e07..c6c5098bdd04 100644
--- a/tests/codegen/issues/issue-103840.rs
+++ b/tests/codegen/issues/issue-103840.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 pub fn foo(t: &mut Vec) {
diff --git a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs
index db9eeda19a6c..848aa910b584 100644
--- a/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs
+++ b/tests/codegen/issues/issue-105386-ub-in-debuginfo.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: --crate-type=lib -O -Cdebuginfo=2 -Cno-prepopulate-passes -Zmir-enable-passes=-ScalarReplacementOfAggregates
+//@ compile-flags: --crate-type=lib -Copt-level=3 -Cdebuginfo=2 -Cno-prepopulate-passes -Zmir-enable-passes=-ScalarReplacementOfAggregates
 // MIR SROA will decompose the closure
 #![feature(stmt_expr_attributes)]
 
diff --git a/tests/codegen/issues/issue-106369.rs b/tests/codegen/issues/issue-106369.rs
index fd375e4e6058..3583d20c9fa1 100644
--- a/tests/codegen/issues/issue-106369.rs
+++ b/tests/codegen/issues/issue-106369.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-107681-unwrap_unchecked.rs b/tests/codegen/issues/issue-107681-unwrap_unchecked.rs
index 7d9679d2322b..fd7296de4c86 100644
--- a/tests/codegen/issues/issue-107681-unwrap_unchecked.rs
+++ b/tests/codegen/issues/issue-107681-unwrap_unchecked.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ min-llvm-version: 19
 
 // Test for #107681.
diff --git a/tests/codegen/issues/issue-108395-branchy-bool-match.rs b/tests/codegen/issues/issue-108395-branchy-bool-match.rs
index 24f5c0f66353..96387e791b03 100644
--- a/tests/codegen/issues/issue-108395-branchy-bool-match.rs
+++ b/tests/codegen/issues/issue-108395-branchy-bool-match.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Zmerge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled
 //! Test for . Check that
 //! matching on two bools with wildcards does not produce branches.
 #![crate_type = "lib"]
diff --git a/tests/codegen/issues/issue-109328-split_first.rs b/tests/codegen/issues/issue-109328-split_first.rs
index 7f7957593d2d..26235edfc190 100644
--- a/tests/codegen/issues/issue-109328-split_first.rs
+++ b/tests/codegen/issues/issue-109328-split_first.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-110797-enum-jump-same.rs b/tests/codegen/issues/issue-110797-enum-jump-same.rs
index f114e0e260eb..b5f7c08795bc 100644
--- a/tests/codegen/issues/issue-110797-enum-jump-same.rs
+++ b/tests/codegen/issues/issue-110797-enum-jump-same.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-111603.rs b/tests/codegen/issues/issue-111603.rs
index 41bfb493ff58..2ba5a3f876ae 100644
--- a/tests/codegen/issues/issue-111603.rs
+++ b/tests/codegen/issues/issue-111603.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 #![feature(get_mut_unchecked, new_uninit)]
diff --git a/tests/codegen/issues/issue-112509-slice-get-andthen-get.rs b/tests/codegen/issues/issue-112509-slice-get-andthen-get.rs
index aee2edd8dfad..3909b203d089 100644
--- a/tests/codegen/issues/issue-112509-slice-get-andthen-get.rs
+++ b/tests/codegen/issues/issue-112509-slice-get-andthen-get.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 // CHECK-LABEL: @write_u8_variant_a
diff --git a/tests/codegen/issues/issue-114312.rs b/tests/codegen/issues/issue-114312.rs
index be5b999afd0b..e9418249089d 100644
--- a/tests/codegen/issues/issue-114312.rs
+++ b/tests/codegen/issues/issue-114312.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ only-x86_64-unknown-linux-gnu
 
 // We want to check that this function does not mis-optimize to loop jumping.
diff --git a/tests/codegen/issues/issue-115385-llvm-jump-threading.rs b/tests/codegen/issues/issue-115385-llvm-jump-threading.rs
index 55aa69a7de03..8cabd94f2028 100644
--- a/tests/codegen/issues/issue-115385-llvm-jump-threading.rs
+++ b/tests/codegen/issues/issue-115385-llvm-jump-threading.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Ccodegen-units=1
+//@ compile-flags: -Copt-level=3 -Ccodegen-units=1
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-116878.rs b/tests/codegen/issues/issue-116878.rs
index a09fac42c018..daf46c8bb554 100644
--- a/tests/codegen/issues/issue-116878.rs
+++ b/tests/codegen/issues/issue-116878.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 /// Make sure no bounds checks are emitted after a `get_unchecked`.
diff --git a/tests/codegen/issues/issue-118306.rs b/tests/codegen/issues/issue-118306.rs
index 0778ab3fde97..f9f3e0c0529c 100644
--- a/tests/codegen/issues/issue-118306.rs
+++ b/tests/codegen/issues/issue-118306.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ min-llvm-version: 19
 //@ only-x86_64
 
diff --git a/tests/codegen/issues/issue-118392.rs b/tests/codegen/issues/issue-118392.rs
index ce2332b4c3c7..07de8d9b237a 100644
--- a/tests/codegen/issues/issue-118392.rs
+++ b/tests/codegen/issues/issue-118392.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 // CHECK-LABEL: @div2
diff --git a/tests/codegen/issues/issue-119422.rs b/tests/codegen/issues/issue-119422.rs
index 682430a79f4a..e1a082c377f8 100644
--- a/tests/codegen/issues/issue-119422.rs
+++ b/tests/codegen/issues/issue-119422.rs
@@ -1,7 +1,7 @@
 //! This test checks that compiler don't generate useless compares to zeros
 //! for `NonZero` integer types.
 //!
-//@ compile-flags: -O --edition=2021 -Zmerge-functions=disabled
+//@ compile-flags: -Copt-level=3 --edition=2021 -Zmerge-functions=disabled
 //@ only-64bit (because the LLVM type of i64 for usize shows up)
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-121719-common-field-offset.rs b/tests/codegen/issues/issue-121719-common-field-offset.rs
index 11a8aa8dcd14..9f5f44e03755 100644
--- a/tests/codegen/issues/issue-121719-common-field-offset.rs
+++ b/tests/codegen/issues/issue-121719-common-field-offset.rs
@@ -1,7 +1,7 @@
 //! This test checks that match branches which all access a field
 //! at the same offset are merged together.
 //!
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 #[repr(C)]
diff --git a/tests/codegen/issues/issue-122600-ptr-discriminant-update.rs b/tests/codegen/issues/issue-122600-ptr-discriminant-update.rs
index 4b520a620695..fdb8f06df800 100644
--- a/tests/codegen/issues/issue-122600-ptr-discriminant-update.rs
+++ b/tests/codegen/issues/issue-122600-ptr-discriminant-update.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ min-llvm-version: 19
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/issues/issue-13018.rs b/tests/codegen/issues/issue-13018.rs
index a29452436d2c..8040018b9310 100644
--- a/tests/codegen/issues/issue-13018.rs
+++ b/tests/codegen/issues/issue-13018.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 // A drop([...].clone()) sequence on an Rc should be a no-op
 // In particular, no call to __rust_dealloc should be emitted
diff --git a/tests/codegen/issues/issue-27130.rs b/tests/codegen/issues/issue-27130.rs
index 9c22b41e97fe..594e02af0977 100644
--- a/tests/codegen/issues/issue-27130.rs
+++ b/tests/codegen/issues/issue-27130.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-34634.rs b/tests/codegen/issues/issue-34634.rs
index a11f248e7404..d32fa97ec38c 100644
--- a/tests/codegen/issues/issue-34634.rs
+++ b/tests/codegen/issues/issue-34634.rs
@@ -3,7 +3,7 @@
 // switch case (the second check present until rustc 1.12).
 // This test also verifies that a single panic call is generated (for the division by zero case).
 
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 // CHECK-LABEL: @f
diff --git a/tests/codegen/issues/issue-34947-pow-i32.rs b/tests/codegen/issues/issue-34947-pow-i32.rs
index c9141c0e9252..b4750cd35bc3 100644
--- a/tests/codegen/issues/issue-34947-pow-i32.rs
+++ b/tests/codegen/issues/issue-34947-pow-i32.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-36010-some-box-is_some.rs b/tests/codegen/issues/issue-36010-some-box-is_some.rs
index 44c01096f15a..c9a8262162d6 100644
--- a/tests/codegen/issues/issue-36010-some-box-is_some.rs
+++ b/tests/codegen/issues/issue-36010-some-box-is_some.rs
@@ -1,6 +1,6 @@
 #![crate_type = "lib"]
 
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 use std::mem;
 
diff --git a/tests/codegen/issues/issue-37945.rs b/tests/codegen/issues/issue-37945.rs
index 01d1c694ec7c..23d0eab8ae46 100644
--- a/tests/codegen/issues/issue-37945.rs
+++ b/tests/codegen/issues/issue-37945.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Zmerge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled
 //@ ignore-32bit LLVM has a bug with them
 
 // Check that LLVM understands that `Iter` pointer is not null. Issue #37945.
diff --git a/tests/codegen/issues/issue-45222.rs b/tests/codegen/issues/issue-45222.rs
index d2c1ba421c45..0201363c41aa 100644
--- a/tests/codegen/issues/issue-45222.rs
+++ b/tests/codegen/issues/issue-45222.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-45466.rs b/tests/codegen/issues/issue-45466.rs
index 8a324fa555bb..164a27ef5d4c 100644
--- a/tests/codegen/issues/issue-45466.rs
+++ b/tests/codegen/issues/issue-45466.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "rlib"]
 
diff --git a/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs b/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs
index ea9288564e9d..a48bb2a1ccf8 100644
--- a/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs
+++ b/tests/codegen/issues/issue-45964-bounds-check-slice-pos.rs
@@ -1,7 +1,7 @@
 // This test case checks that slice::{r}position functions do not
 // prevent optimizing away bounds checks
 
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "rlib"]
 
diff --git a/tests/codegen/issues/issue-59352.rs b/tests/codegen/issues/issue-59352.rs
index 7bedc3ffc4a1..cb4383d4a309 100644
--- a/tests/codegen/issues/issue-59352.rs
+++ b/tests/codegen/issues/issue-59352.rs
@@ -6,7 +6,7 @@
 // test case should be removed as it will become redundant.
 
 // mir-opt-level=3 enables inlining and enables LLVM to optimize away the unreachable panic call.
-//@ compile-flags: -O -Z mir-opt-level=3
+//@ compile-flags: -Copt-level=3 -Z mir-opt-level=3
 
 #![crate_type = "rlib"]
 
diff --git a/tests/codegen/issues/issue-68667-unwrap-combinators.rs b/tests/codegen/issues/issue-68667-unwrap-combinators.rs
index 21a5a5bf4ee9..7f4a32109fe9 100644
--- a/tests/codegen/issues/issue-68667-unwrap-combinators.rs
+++ b/tests/codegen/issues/issue-68667-unwrap-combinators.rs
@@ -1,6 +1,6 @@
 #![crate_type = "lib"]
 
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 // MIR inlining now optimizes this code.
 
diff --git a/tests/codegen/issues/issue-69101-bounds-check.rs b/tests/codegen/issues/issue-69101-bounds-check.rs
index c014a1c1b1d4..953b79aa263e 100644
--- a/tests/codegen/issues/issue-69101-bounds-check.rs
+++ b/tests/codegen/issues/issue-69101-bounds-check.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 // Make sure no bounds checks are emitted in the loop when upfront slicing
diff --git a/tests/codegen/issues/issue-73031.rs b/tests/codegen/issues/issue-73031.rs
index db9c6d6db233..80dea9b5bc2b 100644
--- a/tests/codegen/issues/issue-73031.rs
+++ b/tests/codegen/issues/issue-73031.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 // Test that LLVM can eliminate the unreachable `All::None` branch.
diff --git a/tests/codegen/issues/issue-73258.rs b/tests/codegen/issues/issue-73258.rs
index e5c622b5656b..936a75544966 100644
--- a/tests/codegen/issues/issue-73258.rs
+++ b/tests/codegen/issues/issue-73258.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-73396-bounds-check-after-position.rs b/tests/codegen/issues/issue-73396-bounds-check-after-position.rs
index 9b3b1318ced1..1e2c25babe0a 100644
--- a/tests/codegen/issues/issue-73396-bounds-check-after-position.rs
+++ b/tests/codegen/issues/issue-73396-bounds-check-after-position.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 // Make sure no bounds checks are emitted when slicing or indexing
diff --git a/tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs b/tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs
index c3eb1a5968af..e9dd0d1bf237 100644
--- a/tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs
+++ b/tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs
@@ -1,7 +1,7 @@
 // This test checks that bounds checks are elided when
 // index is part of a (x | y) < C style condition
 
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-74938-array-split-at.rs b/tests/codegen/issues/issue-74938-array-split-at.rs
index 2675e404ced3..9d3e23d642b8 100644
--- a/tests/codegen/issues/issue-74938-array-split-at.rs
+++ b/tests/codegen/issues/issue-74938-array-split-at.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-75525-bounds-checks.rs b/tests/codegen/issues/issue-75525-bounds-checks.rs
index fbc10ce3d843..5dfbd3500101 100644
--- a/tests/codegen/issues/issue-75525-bounds-checks.rs
+++ b/tests/codegen/issues/issue-75525-bounds-checks.rs
@@ -1,6 +1,6 @@
 // Regression test for #75525, verifies that no bounds checks are generated.
 
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-75546.rs b/tests/codegen/issues/issue-75546.rs
index 1132c8ab5093..1e1e6543a889 100644
--- a/tests/codegen/issues/issue-75546.rs
+++ b/tests/codegen/issues/issue-75546.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 // Test that LLVM can eliminate the impossible `i == 0` check.
diff --git a/tests/codegen/issues/issue-75659.rs b/tests/codegen/issues/issue-75659.rs
index 1860b73f2a9a..0960bfdb6b0a 100644
--- a/tests/codegen/issues/issue-75659.rs
+++ b/tests/codegen/issues/issue-75659.rs
@@ -1,7 +1,7 @@
 // This test checks that the call to memchr/slice_contains is optimized away
 // when searching in small slices.
 
-//@ compile-flags: -O -Zinline-mir=false
+//@ compile-flags: -Copt-level=3 -Zinline-mir=false
 //@ only-x86_64
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/issues/issue-75978.rs b/tests/codegen/issues/issue-75978.rs
index ed953fae7671..f4b0bc36329e 100644
--- a/tests/codegen/issues/issue-75978.rs
+++ b/tests/codegen/issues/issue-75978.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-77812.rs b/tests/codegen/issues/issue-77812.rs
index bf84ac21b16d..09e2376c30dd 100644
--- a/tests/codegen/issues/issue-77812.rs
+++ b/tests/codegen/issues/issue-77812.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 // Test that LLVM can eliminate the unreachable `Variant::Zero` branch.
diff --git a/tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs b/tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs
index 49301be776fd..4023412f23cf 100644
--- a/tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs
+++ b/tests/codegen/issues/issue-81408-dllimport-thinlto-windows.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C lto=thin -C prefer-dynamic=no
+//@ compile-flags: -Copt-level=3 -C lto=thin -C prefer-dynamic=no
 //@ only-windows
 //@ aux-build:static_dllimport_aux.rs
 
diff --git a/tests/codegen/issues/issue-84268.rs b/tests/codegen/issues/issue-84268.rs
index 5e852133ed3d..8a8ea9d1ccf8 100644
--- a/tests/codegen/issues/issue-84268.rs
+++ b/tests/codegen/issues/issue-84268.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O --crate-type=rlib
+//@ compile-flags: -Copt-level=3 --crate-type=rlib
 #![feature(intrinsics, repr_simd)]
 
 extern "rust-intrinsic" {
diff --git a/tests/codegen/issues/issue-85872-multiple-reverse.rs b/tests/codegen/issues/issue-85872-multiple-reverse.rs
index fb5ff8309e5c..6f566ddee6b0 100644
--- a/tests/codegen/issues/issue-85872-multiple-reverse.rs
+++ b/tests/codegen/issues/issue-85872-multiple-reverse.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-86109-eliminate-div-by-zero-check.rs b/tests/codegen/issues/issue-86109-eliminate-div-by-zero-check.rs
index a8fab61b13e9..345c09738b61 100644
--- a/tests/codegen/issues/issue-86109-eliminate-div-by-zero-check.rs
+++ b/tests/codegen/issues/issue-86109-eliminate-div-by-zero-check.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //! Test for https://github.com/rust-lang/rust/issues/86109
 //! Check LLVM can eliminate the impossible division by zero check by
 //! ensuring there is no call (to panic) instruction.
diff --git a/tests/codegen/issues/issue-93036-assert-index.rs b/tests/codegen/issues/issue-93036-assert-index.rs
index 7a2ea0872668..46f45c2f06ee 100644
--- a/tests/codegen/issues/issue-93036-assert-index.rs
+++ b/tests/codegen/issues/issue-93036-assert-index.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-96274.rs b/tests/codegen/issues/issue-96274.rs
index ffefd5f43f8c..2425ec53e4e1 100644
--- a/tests/codegen/issues/issue-96274.rs
+++ b/tests/codegen/issues/issue-96274.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-96497-slice-size-nowrap.rs b/tests/codegen/issues/issue-96497-slice-size-nowrap.rs
index f922462cc279..dce156dd4254 100644
--- a/tests/codegen/issues/issue-96497-slice-size-nowrap.rs
+++ b/tests/codegen/issues/issue-96497-slice-size-nowrap.rs
@@ -2,7 +2,7 @@
 // The possibility of wrapping results in an additional branch when dropping boxed slices
 // in some situations, see https://github.com/rust-lang/rust/issues/96497#issuecomment-1112865218
 
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-98156-const-arg-temp-lifetime.rs b/tests/codegen/issues/issue-98156-const-arg-temp-lifetime.rs
index 28324bfa90ef..aecb81caf22b 100644
--- a/tests/codegen/issues/issue-98156-const-arg-temp-lifetime.rs
+++ b/tests/codegen/issues/issue-98156-const-arg-temp-lifetime.rs
@@ -1,6 +1,6 @@
 // This test checks that temporaries for indirectly-passed arguments get lifetime markers.
 
-//@ compile-flags: -O -C no-prepopulate-passes -Zmir-opt-level=0
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes -Zmir-opt-level=0
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs b/tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs
index 40827e32a012..76adcf9fd453 100644
--- a/tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs
+++ b/tests/codegen/issues/issue-98294-get-mut-copy-from-slice-opt.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/issues/issue-99960.rs b/tests/codegen/issues/issue-99960.rs
index 9029121d35f4..571a9be967d4 100644
--- a/tests/codegen/issues/issue-99960.rs
+++ b/tests/codegen/issues/issue-99960.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/layout-size-checks.rs b/tests/codegen/layout-size-checks.rs
index 901f8f822f32..d64a7055e0b1 100644
--- a/tests/codegen/layout-size-checks.rs
+++ b/tests/codegen/layout-size-checks.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ only-x86_64
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/lib-optimizations/iter-sum.rs b/tests/codegen/lib-optimizations/iter-sum.rs
index ea8c916bfc1b..a054ffffe74b 100644
--- a/tests/codegen/lib-optimizations/iter-sum.rs
+++ b/tests/codegen/lib-optimizations/iter-sum.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ only-x86_64 (vectorization varies between architectures)
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/lib-optimizations/slice_rotate.rs b/tests/codegen/lib-optimizations/slice_rotate.rs
index d0a7b328d184..aa4bb3b528c9 100644
--- a/tests/codegen/lib-optimizations/slice_rotate.rs
+++ b/tests/codegen/lib-optimizations/slice_rotate.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/lifetime_start_end.rs b/tests/codegen/lifetime_start_end.rs
index 99d37c25dcac..0639e7640aa1 100644
--- a/tests/codegen/lifetime_start_end.rs
+++ b/tests/codegen/lifetime_start_end.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes -Zmir-opt-level=0
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes -Zmir-opt-level=0
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/loads.rs b/tests/codegen/loads.rs
index e3e2f7577706..88d67642b725 100644
--- a/tests/codegen/loads.rs
+++ b/tests/codegen/loads.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0 -O
+//@ compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0 -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs
index b147d01b38e3..b11bd657c18e 100644
--- a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs
+++ b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes --target loongarch64-unknown-linux-gnu
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target loongarch64-unknown-linux-gnu
 //@ needs-llvm-components: loongarch
 
 #![feature(no_core, lang_items)]
diff --git a/tests/codegen/lto-removes-invokes.rs b/tests/codegen/lto-removes-invokes.rs
index 3217c239bf78..3640bd1ab865 100644
--- a/tests/codegen/lto-removes-invokes.rs
+++ b/tests/codegen/lto-removes-invokes.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -C lto -C panic=abort -O
+//@ compile-flags: -C lto -C panic=abort -Copt-level=3
 //@ no-prefer-dynamic
 
 fn main() {
diff --git a/tests/codegen/macos/i686-macosx-deployment-target.rs b/tests/codegen/macos/i686-macosx-deployment-target.rs
index 389434da1f67..1f44bdfc6485 100644
--- a/tests/codegen/macos/i686-macosx-deployment-target.rs
+++ b/tests/codegen/macos/i686-macosx-deployment-target.rs
@@ -2,7 +2,7 @@
 // Checks that we correctly modify the target when MACOSX_DEPLOYMENT_TARGET is set.
 // See issue #60235.
 
-//@ compile-flags: -O --target=i686-apple-darwin --crate-type=rlib
+//@ compile-flags: -Copt-level=3 --target=i686-apple-darwin --crate-type=rlib
 //@ needs-llvm-components: x86
 //@ rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14
 #![feature(no_core, lang_items)]
diff --git a/tests/codegen/macos/i686-no-macosx-deployment-target.rs b/tests/codegen/macos/i686-no-macosx-deployment-target.rs
index 4c6b7656e593..a09773e0b9e2 100644
--- a/tests/codegen/macos/i686-no-macosx-deployment-target.rs
+++ b/tests/codegen/macos/i686-no-macosx-deployment-target.rs
@@ -2,7 +2,7 @@
 // Checks that we leave the target alone MACOSX_DEPLOYMENT_TARGET is unset.
 // See issue #60235.
 
-//@ compile-flags: -O --target=i686-apple-darwin --crate-type=rlib
+//@ compile-flags: -Copt-level=3 --target=i686-apple-darwin --crate-type=rlib
 //@ needs-llvm-components: x86
 //@ unset-rustc-env:MACOSX_DEPLOYMENT_TARGET
 #![feature(no_core, lang_items)]
diff --git a/tests/codegen/macos/x86_64-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-macosx-deployment-target.rs
index a40deca24bbe..bd8c027a9fb9 100644
--- a/tests/codegen/macos/x86_64-macosx-deployment-target.rs
+++ b/tests/codegen/macos/x86_64-macosx-deployment-target.rs
@@ -2,7 +2,7 @@
 // Checks that we correctly modify the target when MACOSX_DEPLOYMENT_TARGET is set.
 // See issue #60235.
 
-//@ compile-flags: -O --target=x86_64-apple-darwin --crate-type=rlib
+//@ compile-flags: -Copt-level=3 --target=x86_64-apple-darwin --crate-type=rlib
 //@ needs-llvm-components: x86
 //@ rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14
 #![feature(no_core, lang_items)]
diff --git a/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs
index 26d519ef1a6d..ff4a8fc46f98 100644
--- a/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs
+++ b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs
@@ -2,7 +2,7 @@
 // Checks that we leave the target alone when MACOSX_DEPLOYMENT_TARGET is unset.
 // See issue #60235.
 
-//@ compile-flags: -O --target=x86_64-apple-darwin --crate-type=rlib
+//@ compile-flags: -Copt-level=3 --target=x86_64-apple-darwin --crate-type=rlib
 //@ needs-llvm-components: x86
 //@ unset-rustc-env:MACOSX_DEPLOYMENT_TARGET
 #![feature(no_core, lang_items)]
diff --git a/tests/codegen/match-optimized.rs b/tests/codegen/match-optimized.rs
index d6893be0b7be..7b409e619a8c 100644
--- a/tests/codegen/match-optimized.rs
+++ b/tests/codegen/match-optimized.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -C no-prepopulate-passes -O
+//@ compile-flags: -Cno-prepopulate-passes -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/match-optimizes-away.rs b/tests/codegen/match-optimizes-away.rs
index 82ab5718b375..8a70d9934231 100644
--- a/tests/codegen/match-optimizes-away.rs
+++ b/tests/codegen/match-optimizes-away.rs
@@ -1,5 +1,5 @@
 //
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 pub enum Three {
diff --git a/tests/codegen/maybeuninit-rvo.rs b/tests/codegen/maybeuninit-rvo.rs
index db2e33c34bd2..097aa610f1b3 100644
--- a/tests/codegen/maybeuninit-rvo.rs
+++ b/tests/codegen/maybeuninit-rvo.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ needs-unwind
 #![feature(c_unwind)]
 #![crate_type = "lib"]
diff --git a/tests/codegen/mem-replace-simple-type.rs b/tests/codegen/mem-replace-simple-type.rs
index 41c3660dc15c..9f3c6bacb712 100644
--- a/tests/codegen/mem-replace-simple-type.rs
+++ b/tests/codegen/mem-replace-simple-type.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 //@ only-x86_64 (to not worry about usize differing)
 //@ ignore-std-debug-assertions
 // Reason: precondition checks make mem::replace not a candidate for MIR inlining
diff --git a/tests/codegen/merge-functions.rs b/tests/codegen/merge-functions.rs
index 8e4b65c9ee65..b9d3727ce112 100644
--- a/tests/codegen/merge-functions.rs
+++ b/tests/codegen/merge-functions.rs
@@ -1,6 +1,6 @@
 //@ revisions: O Os
 //@[Os] compile-flags: -Copt-level=s
-//@[O] compile-flags: -O
+//@[O] compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 // CHECK: @func{{2|1}} = {{.*}}alias{{.*}}@func{{1|2}}
diff --git a/tests/codegen/mir-aggregate-no-alloca.rs b/tests/codegen/mir-aggregate-no-alloca.rs
index 37b024a55b37..77d367ed5da9 100644
--- a/tests/codegen/mir-aggregate-no-alloca.rs
+++ b/tests/codegen/mir-aggregate-no-alloca.rs
@@ -2,7 +2,7 @@
 //@ revisions: bit32 bit64
 //@[bit32] only-32bit
 //@[bit64] only-64bit
-//@ compile-flags: -O -C no-prepopulate-passes -Z randomize-layout=no
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes -Z randomize-layout=no
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/mir-inlined-line-numbers.rs b/tests/codegen/mir-inlined-line-numbers.rs
index 57978bc70976..cfe43a6cf89a 100644
--- a/tests/codegen/mir-inlined-line-numbers.rs
+++ b/tests/codegen/mir-inlined-line-numbers.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -g
+//@ compile-flags: -Copt-level=3 -g
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/move-before-nocapture-ref-arg.rs b/tests/codegen/move-before-nocapture-ref-arg.rs
index c3448192ea17..2ebd645e1c3d 100644
--- a/tests/codegen/move-before-nocapture-ref-arg.rs
+++ b/tests/codegen/move-before-nocapture-ref-arg.rs
@@ -1,6 +1,6 @@
 // Verify that move before the call of the function with noalias, nocapture, readonly.
 // #107436
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/move-operands.rs b/tests/codegen/move-operands.rs
index 4f22921b4a3d..ddad231b762c 100644
--- a/tests/codegen/move-operands.rs
+++ b/tests/codegen/move-operands.rs
@@ -1,5 +1,5 @@
 // Verify that optimized MIR only copies `a` once.
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/naked-fn/generics.rs b/tests/codegen/naked-fn/generics.rs
index a33d213617a8..64998df64ddb 100644
--- a/tests/codegen/naked-fn/generics.rs
+++ b/tests/codegen/naked-fn/generics.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ only-x86_64
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/noalias-box-off.rs b/tests/codegen/noalias-box-off.rs
index 1642103903a0..664c79502804 100644
--- a/tests/codegen/noalias-box-off.rs
+++ b/tests/codegen/noalias-box-off.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Z box-noalias=no
+//@ compile-flags: -Copt-level=3 -Z box-noalias=no
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/noalias-box.rs b/tests/codegen/noalias-box.rs
index 06f94691c895..cccde775977a 100644
--- a/tests/codegen/noalias-box.rs
+++ b/tests/codegen/noalias-box.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/noalias-flag.rs b/tests/codegen/noalias-flag.rs
index 35b94d813d5f..67ba68ee6f80 100644
--- a/tests/codegen/noalias-flag.rs
+++ b/tests/codegen/noalias-flag.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Zmutable-noalias=no
+//@ compile-flags: -Copt-level=3 -Zmutable-noalias=no
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/noalias-refcell.rs b/tests/codegen/noalias-refcell.rs
index 51d13967bece..b37adf92b9cc 100644
--- a/tests/codegen/noalias-refcell.rs
+++ b/tests/codegen/noalias-refcell.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes -Z mutable-noalias=yes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes -Z mutable-noalias=yes
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/noalias-rwlockreadguard.rs b/tests/codegen/noalias-rwlockreadguard.rs
index 7b870cb28b4f..c676dc32399d 100644
--- a/tests/codegen/noalias-rwlockreadguard.rs
+++ b/tests/codegen/noalias-rwlockreadguard.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes -Z mutable-noalias=yes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes -Z mutable-noalias=yes
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/noalias-unpin.rs b/tests/codegen/noalias-unpin.rs
index 630a62020c11..30a8b399b979 100644
--- a/tests/codegen/noalias-unpin.rs
+++ b/tests/codegen/noalias-unpin.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Z mutable-noalias=yes
+//@ compile-flags: -Copt-level=3 -Z mutable-noalias=yes
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/nrvo.rs b/tests/codegen/nrvo.rs
index aa8bed941f54..7972186bfe5d 100644
--- a/tests/codegen/nrvo.rs
+++ b/tests/codegen/nrvo.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/option-as-slice.rs b/tests/codegen/option-as-slice.rs
index 0edbbac11762..39b34a2035b7 100644
--- a/tests/codegen/option-as-slice.rs
+++ b/tests/codegen/option-as-slice.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Z randomize-layout=no
+//@ compile-flags: -Copt-level=3 -Z randomize-layout=no
 //@ only-x86_64
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/option-niche-eq.rs b/tests/codegen/option-niche-eq.rs
index caef0598b4be..9c5ed9ce57a5 100644
--- a/tests/codegen/option-niche-eq.rs
+++ b/tests/codegen/option-niche-eq.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Zmerge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled
 #![crate_type = "lib"]
 
 extern crate core;
diff --git a/tests/codegen/packed.rs b/tests/codegen/packed.rs
index 66df978d48ca..6f62719282ea 100644
--- a/tests/codegen/packed.rs
+++ b/tests/codegen/packed.rs
@@ -1,5 +1,5 @@
 //
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/panic-abort-windows.rs b/tests/codegen/panic-abort-windows.rs
index eb61e649f04a..17fdd9cc7260 100644
--- a/tests/codegen/panic-abort-windows.rs
+++ b/tests/codegen/panic-abort-windows.rs
@@ -1,7 +1,7 @@
 // This test is for *-windows only.
 //@ only-windows
 
-//@ compile-flags: -C no-prepopulate-passes -C panic=abort -O
+//@ compile-flags: -C no-prepopulate-passes -C panic=abort -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/panic-in-drop-abort.rs b/tests/codegen/panic-in-drop-abort.rs
index b150c537ad55..e89170e56ed0 100644
--- a/tests/codegen/panic-in-drop-abort.rs
+++ b/tests/codegen/panic-in-drop-abort.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -Z panic-in-drop=abort -O
+//@ compile-flags: -Z panic-in-drop=abort -Copt-level=3
 //@ ignore-msvc
 
 // Ensure that unwinding code paths are eliminated from the output after
diff --git a/tests/codegen/personality_lifetimes.rs b/tests/codegen/personality_lifetimes.rs
index 828af05436b4..cd81db639534 100644
--- a/tests/codegen/personality_lifetimes.rs
+++ b/tests/codegen/personality_lifetimes.rs
@@ -1,7 +1,7 @@
 //@ ignore-msvc
 //@ needs-unwind
 
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/placement-new.rs b/tests/codegen/placement-new.rs
index 0ec2b6a6f20e..7f7f0033bece 100644
--- a/tests/codegen/placement-new.rs
+++ b/tests/codegen/placement-new.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ compile-flags: -Zmerge-functions=disabled
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/ptr-arithmetic.rs b/tests/codegen/ptr-arithmetic.rs
index 6f115d33d8dd..ecb44b30f5ca 100644
--- a/tests/codegen/ptr-arithmetic.rs
+++ b/tests/codegen/ptr-arithmetic.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Z merge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/ptr-read-metadata.rs b/tests/codegen/ptr-read-metadata.rs
index e3565c962f73..b38cfdbff883 100644
--- a/tests/codegen/ptr-read-metadata.rs
+++ b/tests/codegen/ptr-read-metadata.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Z merge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/range-attribute.rs b/tests/codegen/range-attribute.rs
index a44ec1026b16..e23f5e6bb748 100644
--- a/tests/codegen/range-attribute.rs
+++ b/tests/codegen/range-attribute.rs
@@ -5,7 +5,7 @@
 //@ revisions: bit32 bit64
 //@[bit32] only-32bit
 //@[bit64] only-64bit
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 //@ min-llvm-version: 19
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/range_to_inclusive.rs b/tests/codegen/range_to_inclusive.rs
index f3001897f88d..6d939f40f558 100644
--- a/tests/codegen/range_to_inclusive.rs
+++ b/tests/codegen/range_to_inclusive.rs
@@ -1,6 +1,6 @@
 //! Test that `RangeTo` and `RangeToInclusive` generate identical
 //! (and optimal) code; #63646
-//@ compile-flags: -O -Zmerge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled
 #![crate_type = "lib"]
 
 #[no_mangle]
diff --git a/tests/codegen/reg-struct-return.rs b/tests/codegen/reg-struct-return.rs
index 73816745ea86..dfc9f8c519c2 100644
--- a/tests/codegen/reg-struct-return.rs
+++ b/tests/codegen/reg-struct-return.rs
@@ -5,7 +5,7 @@
 
 //@ revisions: ENABLED DISABLED
 //@ add-core-stubs
-//@ compile-flags: --target i686-unknown-linux-gnu -O -C no-prepopulate-passes
+//@ compile-flags: --target i686-unknown-linux-gnu -Cno-prepopulate-passes -Copt-level=3
 //@ [ENABLED] compile-flags: -Zreg-struct-return
 //@ needs-llvm-components: x86
 
diff --git a/tests/codegen/regparm-inreg.rs b/tests/codegen/regparm-inreg.rs
index c8c647bcc87c..82e157311287 100644
--- a/tests/codegen/regparm-inreg.rs
+++ b/tests/codegen/regparm-inreg.rs
@@ -2,7 +2,7 @@
 // marks function arguments as "inreg" like the C/C++ compilers for the platforms.
 // x86 only.
 
-//@ compile-flags: --target i686-unknown-linux-gnu -O -C no-prepopulate-passes
+//@ compile-flags: --target i686-unknown-linux-gnu -Cno-prepopulate-passes -Copt-level=3
 //@ needs-llvm-components: x86
 
 //@ revisions:regparm0 regparm1 regparm2 regparm3
diff --git a/tests/codegen/repeat-trusted-len.rs b/tests/codegen/repeat-trusted-len.rs
index fa01f2b4969d..95379535971f 100644
--- a/tests/codegen/repeat-trusted-len.rs
+++ b/tests/codegen/repeat-trusted-len.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/repr/transparent-byval-struct-ptr.rs b/tests/codegen/repr/transparent-byval-struct-ptr.rs
index 92ef937d734b..f9cfeb90390c 100644
--- a/tests/codegen/repr/transparent-byval-struct-ptr.rs
+++ b/tests/codegen/repr/transparent-byval-struct-ptr.rs
@@ -1,5 +1,5 @@
 //@ revisions: i686-linux i686-freebsd x64-linux x64-apple
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 
 //@[i686-linux] compile-flags: --target i686-unknown-linux-gnu
 //@[i686-linux] needs-llvm-components: x86
diff --git a/tests/codegen/repr/transparent-imm-array.rs b/tests/codegen/repr/transparent-imm-array.rs
index 99828e4e80a5..f790d093cf4a 100644
--- a/tests/codegen/repr/transparent-imm-array.rs
+++ b/tests/codegen/repr/transparent-imm-array.rs
@@ -1,5 +1,5 @@
 //@ revisions: arm-linux arm-android armv7-linux armv7-android mips thumb sparc
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 
 //@[arm-linux] compile-flags: --target arm-unknown-linux-gnueabi
 //@[arm-linux] needs-llvm-components: arm
diff --git a/tests/codegen/repr/transparent-mips64.rs b/tests/codegen/repr/transparent-mips64.rs
index 588d440b4d7b..7282654b8562 100644
--- a/tests/codegen/repr/transparent-mips64.rs
+++ b/tests/codegen/repr/transparent-mips64.rs
@@ -1,5 +1,5 @@
 //@ revisions: mips64 mips64el
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 
 //@[mips64] compile-flags: --target mips64-unknown-linux-gnuabi64
 //@[mips64] needs-llvm-components: mips
diff --git a/tests/codegen/repr/transparent-opaque-ptr.rs b/tests/codegen/repr/transparent-opaque-ptr.rs
index 29c03f0d5d96..798b7e01bba5 100644
--- a/tests/codegen/repr/transparent-opaque-ptr.rs
+++ b/tests/codegen/repr/transparent-opaque-ptr.rs
@@ -1,5 +1,5 @@
 //@ revisions: aarch64-linux aarch64-darwin wasm32-wasip1
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 
 //@[aarch64-linux] compile-flags: --target aarch64-unknown-linux-gnu
 //@[aarch64-linux] needs-llvm-components: aarch64
diff --git a/tests/codegen/repr/transparent-sparc64.rs b/tests/codegen/repr/transparent-sparc64.rs
index 8e4c8ce2ee9b..05c090bd6721 100644
--- a/tests/codegen/repr/transparent-sparc64.rs
+++ b/tests/codegen/repr/transparent-sparc64.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes --target sparc64-unknown-linux-gnu
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target sparc64-unknown-linux-gnu
 //@ needs-llvm-components: sparc
 
 // See ./transparent.rs
diff --git a/tests/codegen/repr/transparent-sysv64.rs b/tests/codegen/repr/transparent-sysv64.rs
index 068414976c52..99c855db9620 100644
--- a/tests/codegen/repr/transparent-sysv64.rs
+++ b/tests/codegen/repr/transparent-sysv64.rs
@@ -1,5 +1,5 @@
 //@ revisions: linux apple win
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 
 //@[linux] compile-flags: --target x86_64-unknown-linux-gnu
 //@[linux] needs-llvm-components: x86
diff --git a/tests/codegen/repr/transparent.rs b/tests/codegen/repr/transparent.rs
index adcd3aacd2ac..e7e4c40a0991 100644
--- a/tests/codegen/repr/transparent.rs
+++ b/tests/codegen/repr/transparent.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 //@ ignore-riscv64 riscv64 has an i128 type used with test_Vector
 //@ ignore-s390x s390x with default march passes vector types per reference
 //@ ignore-loongarch64 see codegen/loongarch-abi for loongarch function call tests
diff --git a/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs b/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs
index 520192b5d591..46f747ad4075 100644
--- a/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs
+++ b/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: --target riscv64gc-unknown-linux-gnu -O -C no-prepopulate-passes -C panic=abort
+//@ compile-flags: --target riscv64gc-unknown-linux-gnu -Copt-level=3 -C no-prepopulate-passes -C panic=abort
 //@ needs-llvm-components: riscv
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs b/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs
index c14d5c01450b..bef8fe0c0441 100644
--- a/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs
+++ b/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu
 //@ needs-llvm-components: riscv
 
 #![feature(no_core, lang_items)]
diff --git a/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs b/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs
index 27018d2e6d20..214370f424c2 100644
--- a/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs
+++ b/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu
 //@ needs-llvm-components: riscv
 
 #![feature(no_core, lang_items)]
diff --git a/tests/codegen/rust-abi-arch-specific-adjustment.rs b/tests/codegen/rust-abi-arch-specific-adjustment.rs
index 9da10f662b0e..561f081c700e 100644
--- a/tests/codegen/rust-abi-arch-specific-adjustment.rs
+++ b/tests/codegen/rust-abi-arch-specific-adjustment.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 //@ revisions: riscv64 loongarch64
 
 //@[riscv64] only-riscv64
diff --git a/tests/codegen/s390x-simd.rs b/tests/codegen/s390x-simd.rs
index 23181e6a1030..ac39357519e4 100644
--- a/tests/codegen/s390x-simd.rs
+++ b/tests/codegen/s390x-simd.rs
@@ -1,7 +1,7 @@
 //! test that s390x vector types are passed using `PassMode::Direct`
 //! see also https://github.com/rust-lang/rust/issues/135744
 //@ add-core-stubs
-//@ compile-flags: --target s390x-unknown-linux-gnu -O
+//@ compile-flags: --target s390x-unknown-linux-gnu -Copt-level=3
 //@ needs-llvm-components: systemz
 
 #![crate_type = "rlib"]
diff --git a/tests/codegen/scalar-pair-bool.rs b/tests/codegen/scalar-pair-bool.rs
index fce0648e4507..def3b32f71aa 100644
--- a/tests/codegen/scalar-pair-bool.rs
+++ b/tests/codegen/scalar-pair-bool.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/simd/swap-simd-types.rs b/tests/codegen/simd/swap-simd-types.rs
index cd6e84286e1c..69767d0a7558 100644
--- a/tests/codegen/simd/swap-simd-types.rs
+++ b/tests/codegen/simd/swap-simd-types.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C target-feature=+avx
+//@ compile-flags: -Copt-level=3 -C target-feature=+avx
 //@ only-x86_64
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/slice-as_chunks.rs b/tests/codegen/slice-as_chunks.rs
index 631d18d78095..a90ee7c628ec 100644
--- a/tests/codegen/slice-as_chunks.rs
+++ b/tests/codegen/slice-as_chunks.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ only-64bit (because the LLVM type of i64 for usize shows up)
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/slice-indexing.rs b/tests/codegen/slice-indexing.rs
index 75112bb0c24e..d957ccfb5ef7 100644
--- a/tests/codegen/slice-indexing.rs
+++ b/tests/codegen/slice-indexing.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ only-64bit (because the LLVM type of i64 for usize shows up)
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/slice-iter-fold.rs b/tests/codegen/slice-iter-fold.rs
index 1770cd4a1199..55ab34661c36 100644
--- a/tests/codegen/slice-iter-fold.rs
+++ b/tests/codegen/slice-iter-fold.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 // CHECK-LABEL: @slice_fold_to_last
diff --git a/tests/codegen/slice-iter-len-eq-zero.rs b/tests/codegen/slice-iter-len-eq-zero.rs
index b2a4b2495b6a..c85861d47f85 100644
--- a/tests/codegen/slice-iter-len-eq-zero.rs
+++ b/tests/codegen/slice-iter-len-eq-zero.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 type Demo = [u8; 3];
diff --git a/tests/codegen/slice-iter-nonnull.rs b/tests/codegen/slice-iter-nonnull.rs
index 307020b42c06..98a1b961a644 100644
--- a/tests/codegen/slice-iter-nonnull.rs
+++ b/tests/codegen/slice-iter-nonnull.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ needs-deterministic-layouts
 #![crate_type = "lib"]
 #![feature(exact_size_is_empty)]
diff --git a/tests/codegen/slice-pointer-nonnull-unwrap.rs b/tests/codegen/slice-pointer-nonnull-unwrap.rs
index 202edb98c732..35e4bf2c6615 100644
--- a/tests/codegen/slice-pointer-nonnull-unwrap.rs
+++ b/tests/codegen/slice-pointer-nonnull-unwrap.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 use std::ptr::NonNull;
diff --git a/tests/codegen/slice-position-bounds-check.rs b/tests/codegen/slice-position-bounds-check.rs
index f83e2f2ec440..0d1d1d869ae2 100644
--- a/tests/codegen/slice-position-bounds-check.rs
+++ b/tests/codegen/slice-position-bounds-check.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C panic=abort
+//@ compile-flags: -Copt-level=3 -C panic=abort
 #![crate_type = "lib"]
 
 fn search(arr: &mut [T], a: &T) -> Result {
diff --git a/tests/codegen/slice-ref-equality.rs b/tests/codegen/slice-ref-equality.rs
index 1153d7817b27..a5046a759445 100644
--- a/tests/codegen/slice-ref-equality.rs
+++ b/tests/codegen/slice-ref-equality.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Zmerge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled
 #![crate_type = "lib"]
 
 use std::num::NonZero;
diff --git a/tests/codegen/slice-reverse.rs b/tests/codegen/slice-reverse.rs
index 87cdad479628..e58d1c1d9d8e 100644
--- a/tests/codegen/slice-reverse.rs
+++ b/tests/codegen/slice-reverse.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ only-x86_64
 //@ ignore-std-debug-assertions (debug assertions prevent generating shufflevector)
 
diff --git a/tests/codegen/slice-windows-no-bounds-check.rs b/tests/codegen/slice-windows-no-bounds-check.rs
index db3211c8defd..87e89b14f06c 100644
--- a/tests/codegen/slice-windows-no-bounds-check.rs
+++ b/tests/codegen/slice-windows-no-bounds-check.rs
@@ -1,6 +1,6 @@
 #![crate_type = "lib"]
 
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 use std::slice::Windows;
 
diff --git a/tests/codegen/slice_as_from_ptr_range.rs b/tests/codegen/slice_as_from_ptr_range.rs
index 47c60461c0e8..2073f05c07f0 100644
--- a/tests/codegen/slice_as_from_ptr_range.rs
+++ b/tests/codegen/slice_as_from_ptr_range.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ only-64bit (because we're using [ui]size)
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/some-global-nonnull.rs b/tests/codegen/some-global-nonnull.rs
index 8e9308a72658..bb4d12e1c762 100644
--- a/tests/codegen/some-global-nonnull.rs
+++ b/tests/codegen/some-global-nonnull.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/sparc-struct-abi.rs b/tests/codegen/sparc-struct-abi.rs
index 5d9781663570..0a8720c4fcae 100644
--- a/tests/codegen/sparc-struct-abi.rs
+++ b/tests/codegen/sparc-struct-abi.rs
@@ -1,7 +1,7 @@
 // Checks that we correctly codegen extern "C" functions returning structs.
 // See issues #52638 and #86163.
 
-//@ compile-flags: -O --target=sparc64-unknown-linux-gnu --crate-type=rlib
+//@ compile-flags: -Copt-level=3 --target=sparc64-unknown-linux-gnu --crate-type=rlib
 //@ needs-llvm-components: sparc
 #![feature(no_core, lang_items)]
 #![no_core]
diff --git a/tests/codegen/static-relocation-model-msvc.rs b/tests/codegen/static-relocation-model-msvc.rs
index 8ed8331466c7..4d30e6ec505d 100644
--- a/tests/codegen/static-relocation-model-msvc.rs
+++ b/tests/codegen/static-relocation-model-msvc.rs
@@ -1,6 +1,6 @@
 // Verify linkage of external symbols in the static relocation model on MSVC.
 //
-//@ compile-flags: -O -C relocation-model=static
+//@ compile-flags: -Copt-level=3 -C relocation-model=static
 //@ aux-build: extern_decl.rs
 //@ only-x86_64-pc-windows-msvc
 
diff --git a/tests/codegen/step_by-overflow-checks.rs b/tests/codegen/step_by-overflow-checks.rs
index 43e8514a8b7c..53800e9f879d 100644
--- a/tests/codegen/step_by-overflow-checks.rs
+++ b/tests/codegen/step_by-overflow-checks.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/swap-large-types.rs b/tests/codegen/swap-large-types.rs
index 761d48969dad..49a41bb14692 100644
--- a/tests/codegen/swap-large-types.rs
+++ b/tests/codegen/swap-large-types.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ only-x86_64
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/swap-small-types.rs b/tests/codegen/swap-small-types.rs
index 1a48c63d8139..76bb853e6423 100644
--- a/tests/codegen/swap-small-types.rs
+++ b/tests/codegen/swap-small-types.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Z merge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
 //@ only-x86_64
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/thread-local.rs b/tests/codegen/thread-local.rs
index 3cd81652f5ac..9ce34473b915 100644
--- a/tests/codegen/thread-local.rs
+++ b/tests/codegen/thread-local.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ aux-build:thread_local_aux.rs
 //@ ignore-windows FIXME(#134939)
 //@ ignore-wasm globals are used instead of thread locals
diff --git a/tests/codegen/to_vec.rs b/tests/codegen/to_vec.rs
index 4666f8d6f153..4f6e77188d81 100644
--- a/tests/codegen/to_vec.rs
+++ b/tests/codegen/to_vec.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/trailing_zeros.rs b/tests/codegen/trailing_zeros.rs
index b659e061821e..0816a9809926 100644
--- a/tests/codegen/trailing_zeros.rs
+++ b/tests/codegen/trailing_zeros.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/transmute-optimized.rs b/tests/codegen/transmute-optimized.rs
index de54eecf0c04..477fdc6de90d 100644
--- a/tests/codegen/transmute-optimized.rs
+++ b/tests/codegen/transmute-optimized.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Z merge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
 #![crate_type = "lib"]
 
 // This tests that LLVM can optimize based on the niches in the source or
diff --git a/tests/codegen/try_question_mark_nop.rs b/tests/codegen/try_question_mark_nop.rs
index 36a0d9066c89..751d7ca93116 100644
--- a/tests/codegen/try_question_mark_nop.rs
+++ b/tests/codegen/try_question_mark_nop.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Z merge-functions=disabled --edition=2021
+//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled --edition=2021
 //@ only-x86_64
 // FIXME: Remove the `min-llvm-version`.
 //@ revisions: NINETEEN TWENTY
diff --git a/tests/codegen/ub-checks.rs b/tests/codegen/ub-checks.rs
index de48d74e652f..67f5bff08d5b 100644
--- a/tests/codegen/ub-checks.rs
+++ b/tests/codegen/ub-checks.rs
@@ -8,7 +8,7 @@
 //@ revisions: DEBUG NOCHECKS
 //@ [DEBUG] compile-flags:
 //@ [NOCHECKS] compile-flags: -Zub-checks=no
-//@ compile-flags: -O -Cdebug-assertions=yes
+//@ compile-flags: -Copt-level=3 -Cdebug-assertions=yes
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/unchecked_shifts.rs b/tests/codegen/unchecked_shifts.rs
index 86517c896276..b27eb73c0cc9 100644
--- a/tests/codegen/unchecked_shifts.rs
+++ b/tests/codegen/unchecked_shifts.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 #![feature(unchecked_shifts)]
diff --git a/tests/codegen/union-abi.rs b/tests/codegen/union-abi.rs
index 2f14682dfa57..92d40d8ac14c 100644
--- a/tests/codegen/union-abi.rs
+++ b/tests/codegen/union-abi.rs
@@ -1,5 +1,5 @@
 //@ ignore-emscripten vectors passed directly
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 // 32-bit x86 returns `f32` differently to avoid the x87 stack.
 // 32-bit systems will return 128bit values using a return area pointer.
 //@ revisions: x86 bit32 bit64
diff --git a/tests/codegen/var-names.rs b/tests/codegen/var-names.rs
index 4ea5b3b436d8..40720e197614 100644
--- a/tests/codegen/var-names.rs
+++ b/tests/codegen/var-names.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -C no-prepopulate-passes
+//@ compile-flags: -Copt-level=3 -C no-prepopulate-passes
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/vec-as-ptr.rs b/tests/codegen/vec-as-ptr.rs
index 17869c21c832..5c997802640d 100644
--- a/tests/codegen/vec-as-ptr.rs
+++ b/tests/codegen/vec-as-ptr.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Zmerge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Zmerge-functions=disabled
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/vec-calloc.rs b/tests/codegen/vec-calloc.rs
index f88ed7ae8a55..2e2769ce1301 100644
--- a/tests/codegen/vec-calloc.rs
+++ b/tests/codegen/vec-calloc.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O -Z merge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
 //@ only-x86_64
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/vec-in-place.rs b/tests/codegen/vec-in-place.rs
index e835a7ef69bd..1f6836f6dfab 100644
--- a/tests/codegen/vec-in-place.rs
+++ b/tests/codegen/vec-in-place.rs
@@ -1,5 +1,5 @@
 //@ ignore-std-debug-assertions (FIXME: checks for call detect scoped noalias metadata)
-//@ compile-flags: -O -Z merge-functions=disabled
+//@ compile-flags: -Copt-level=3 -Z merge-functions=disabled
 #![crate_type = "lib"]
 
 // Ensure that trivial casts of vec elements are O(1)
diff --git a/tests/codegen/vec-iter-collect-len.rs b/tests/codegen/vec-iter-collect-len.rs
index 8c5d2f6f9a74..a88573522d4d 100644
--- a/tests/codegen/vec-iter-collect-len.rs
+++ b/tests/codegen/vec-iter-collect-len.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 #[no_mangle]
diff --git a/tests/codegen/vec-iter.rs b/tests/codegen/vec-iter.rs
index 310680969c4f..4ed00d2d34f0 100644
--- a/tests/codegen/vec-iter.rs
+++ b/tests/codegen/vec-iter.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 #![feature(exact_size_is_empty)]
 
diff --git a/tests/codegen/vec-len-invariant.rs b/tests/codegen/vec-len-invariant.rs
index 780c86bab956..033181c2bfb7 100644
--- a/tests/codegen/vec-len-invariant.rs
+++ b/tests/codegen/vec-len-invariant.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ only-64bit
 //
 // This test confirms that we do not reload the length of a Vec after growing it in push.
diff --git a/tests/codegen/vec-optimizes-away.rs b/tests/codegen/vec-optimizes-away.rs
index 77a94b0b4294..39d5c1614c82 100644
--- a/tests/codegen/vec-optimizes-away.rs
+++ b/tests/codegen/vec-optimizes-away.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 #![crate_type = "lib"]
 
 #[no_mangle]
diff --git a/tests/codegen/vec-reserve-extend.rs b/tests/codegen/vec-reserve-extend.rs
index 1f00f7d20633..4d3f23ccecfc 100644
--- a/tests/codegen/vec-reserve-extend.rs
+++ b/tests/codegen/vec-reserve-extend.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/vec-shrink-panik.rs b/tests/codegen/vec-shrink-panik.rs
index 873904c2569e..23dd300d48cd 100644
--- a/tests/codegen/vec-shrink-panik.rs
+++ b/tests/codegen/vec-shrink-panik.rs
@@ -1,6 +1,6 @@
 // LLVM 17 realizes double panic is not possible and doesn't generate calls
 // to panic_cannot_unwind.
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ ignore-std-debug-assertions (plain old debug assertions)
 //@ needs-unwind
 #![crate_type = "lib"]
diff --git a/tests/codegen/vec-with-capacity.rs b/tests/codegen/vec-with-capacity.rs
index e8c5bc88bd0d..777bbcc4fcb4 100644
--- a/tests/codegen/vec-with-capacity.rs
+++ b/tests/codegen/vec-with-capacity.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ ignore-std-debug-assertions
 // (with debug assertions turned on, `assert_unchecked` generates a real assertion)
 
diff --git a/tests/codegen/vec_pop_push_noop.rs b/tests/codegen/vec_pop_push_noop.rs
index 4821e8408840..2635660596ab 100644
--- a/tests/codegen/vec_pop_push_noop.rs
+++ b/tests/codegen/vec_pop_push_noop.rs
@@ -1,7 +1,7 @@
 //@ revisions: llvm-pre-19 llvm-19
 //@ [llvm-19] min-llvm-version: 19
 //@ [llvm-pre-19] max-llvm-major-version: 18
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/vecdeque-drain.rs b/tests/codegen/vecdeque-drain.rs
index 8a34ba0674b1..a5e5da650133 100644
--- a/tests/codegen/vecdeque-drain.rs
+++ b/tests/codegen/vecdeque-drain.rs
@@ -1,6 +1,6 @@
 // Check that draining at the front or back doesn't copy memory.
 
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ needs-deterministic-layouts
 //@ ignore-std-debug-assertions (FIXME: checks for call detect scoped noalias metadata)
 
diff --git a/tests/codegen/vecdeque-nonempty-get-no-panic.rs b/tests/codegen/vecdeque-nonempty-get-no-panic.rs
index 3f802de9eeed..1f886b096bbb 100644
--- a/tests/codegen/vecdeque-nonempty-get-no-panic.rs
+++ b/tests/codegen/vecdeque-nonempty-get-no-panic.rs
@@ -1,6 +1,6 @@
 // Guards against regression for optimization discussed in issue #80836
 
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/vecdeque_no_panic.rs b/tests/codegen/vecdeque_no_panic.rs
index da948d12254c..3166842afca0 100644
--- a/tests/codegen/vecdeque_no_panic.rs
+++ b/tests/codegen/vecdeque_no_panic.rs
@@ -1,6 +1,6 @@
 // This test checks that `VecDeque::front[_mut]()` and `VecDeque::back[_mut]()` can't panic.
 
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 //@ ignore-std-debug-assertions (plain old debug assertions)
 
 #![crate_type = "lib"]
diff --git a/tests/codegen/vecdeque_pop_push.rs b/tests/codegen/vecdeque_pop_push.rs
index 040d5a279dca..5afa1b2248b0 100644
--- a/tests/codegen/vecdeque_pop_push.rs
+++ b/tests/codegen/vecdeque_pop_push.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/virtual-function-elimination-32bit.rs b/tests/codegen/virtual-function-elimination-32bit.rs
index 76223be1f3da..c9919cecccf9 100644
--- a/tests/codegen/virtual-function-elimination-32bit.rs
+++ b/tests/codegen/virtual-function-elimination-32bit.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -Zvirtual-function-elimination -Clto -O -Csymbol-mangling-version=v0
+//@ compile-flags: -Zvirtual-function-elimination -Clto -Copt-level=3 -Csymbol-mangling-version=v0
 //@ ignore-64bit
 
 // CHECK: @vtable.0 = {{.*}}, !type ![[TYPE0:[0-9]+]], !vcall_visibility ![[VCALL_VIS0:[0-9]+]]
diff --git a/tests/codegen/virtual-function-elimination.rs b/tests/codegen/virtual-function-elimination.rs
index 23d7657baa99..d2d0c4b78abd 100644
--- a/tests/codegen/virtual-function-elimination.rs
+++ b/tests/codegen/virtual-function-elimination.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -Zvirtual-function-elimination -Clto -O -Csymbol-mangling-version=v0
+//@ compile-flags: -Zvirtual-function-elimination -Clto -Copt-level=3 -Csymbol-mangling-version=v0
 //@ ignore-32bit
 
 // CHECK: @vtable.0 = {{.*}}, !type ![[TYPE0:[0-9]+]], !vcall_visibility ![[VCALL_VIS0:[0-9]+]]
diff --git a/tests/codegen/vtable-loads.rs b/tests/codegen/vtable-loads.rs
index 1dd6ca51063b..aa103ec6f7cb 100644
--- a/tests/codegen/vtable-loads.rs
+++ b/tests/codegen/vtable-loads.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -O
+//@ compile-flags: -Copt-level=3
 
 #![crate_type = "lib"]
 
diff --git a/tests/codegen/zip.rs b/tests/codegen/zip.rs
index ea8caba61f39..38ecf7c15c67 100644
--- a/tests/codegen/zip.rs
+++ b/tests/codegen/zip.rs
@@ -1,4 +1,4 @@
-//@ compile-flags: -C no-prepopulate-passes -O
+//@ compile-flags: -Cno-prepopulate-passes -Copt-level=3
 
 #![crate_type = "lib"]
 

From 6ffe6dd826d737daf363c1251621b7da362a437d Mon Sep 17 00:00:00 2001
From: Michael Goulet 
Date: Tue, 11 Feb 2025 22:59:50 +0000
Subject: [PATCH 106/128] Check sig for errors before checking for
 unconstrained anonymous lifetime

---
 .../src/hir_ty_lowering/mod.rs                | 42 ++++++++++---------
 .../ui/async-await/unconstrained-lifetimes.rs |  9 ++++
 .../unconstrained-lifetimes.stderr            |  9 ++++
 3 files changed, 40 insertions(+), 20 deletions(-)
 create mode 100644 tests/ui/async-await/unconstrained-lifetimes.rs
 create mode 100644 tests/ui/async-await/unconstrained-lifetimes.stderr

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 ffddf6f73aaf..1ef0cbb39ebf 100644
--- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
+++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
@@ -2557,27 +2557,29 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
         // reject function types that violate cmse ABI requirements
         cmse::validate_cmse_abi(self.tcx(), self.dcx(), hir_id, abi, bare_fn_ty);
 
-        // Find any late-bound regions declared in return type that do
-        // not appear in the arguments. These are not well-formed.
-        //
-        // Example:
-        //     for<'a> fn() -> &'a str <-- 'a is bad
-        //     for<'a> fn(&'a String) -> &'a str <-- 'a is ok
-        let inputs = bare_fn_ty.inputs();
-        let late_bound_in_args =
-            tcx.collect_constrained_late_bound_regions(inputs.map_bound(|i| i.to_owned()));
-        let output = bare_fn_ty.output();
-        let late_bound_in_ret = tcx.collect_referenced_late_bound_regions(output);
+        if !bare_fn_ty.references_error() {
+            // Find any late-bound regions declared in return type that do
+            // not appear in the arguments. These are not well-formed.
+            //
+            // Example:
+            //     for<'a> fn() -> &'a str <-- 'a is bad
+            //     for<'a> fn(&'a String) -> &'a str <-- 'a is ok
+            let inputs = bare_fn_ty.inputs();
+            let late_bound_in_args =
+                tcx.collect_constrained_late_bound_regions(inputs.map_bound(|i| i.to_owned()));
+            let output = bare_fn_ty.output();
+            let late_bound_in_ret = tcx.collect_referenced_late_bound_regions(output);
 
-        self.validate_late_bound_regions(late_bound_in_args, late_bound_in_ret, |br_name| {
-            struct_span_code_err!(
-                self.dcx(),
-                decl.output.span(),
-                E0581,
-                "return type references {}, which is not constrained by the fn input types",
-                br_name
-            )
-        });
+            self.validate_late_bound_regions(late_bound_in_args, late_bound_in_ret, |br_name| {
+                struct_span_code_err!(
+                    self.dcx(),
+                    decl.output.span(),
+                    E0581,
+                    "return type references {}, which is not constrained by the fn input types",
+                    br_name
+                )
+            });
+        }
 
         bare_fn_ty
     }
diff --git a/tests/ui/async-await/unconstrained-lifetimes.rs b/tests/ui/async-await/unconstrained-lifetimes.rs
new file mode 100644
index 000000000000..50ab7bae73d4
--- /dev/null
+++ b/tests/ui/async-await/unconstrained-lifetimes.rs
@@ -0,0 +1,9 @@
+//@ edition: 2021
+
+// Make sure we don't complain about the implicit `-> impl Future` capturing an
+// unconstrained anonymous lifetime.
+
+async fn foo(_: Missing<'_>) {}
+//~^ ERROR cannot find type `Missing` in this scope
+
+fn main() {}
diff --git a/tests/ui/async-await/unconstrained-lifetimes.stderr b/tests/ui/async-await/unconstrained-lifetimes.stderr
new file mode 100644
index 000000000000..18a46a3b5551
--- /dev/null
+++ b/tests/ui/async-await/unconstrained-lifetimes.stderr
@@ -0,0 +1,9 @@
+error[E0412]: cannot find type `Missing` in this scope
+  --> $DIR/unconstrained-lifetimes.rs:6:17
+   |
+LL | async fn foo(_: Missing<'_>) {}
+   |                 ^^^^^^^ not found in this scope
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0412`.

From 1b98d0ed13e4a8ff8d94e6aee0f11fab07d6139a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Esteban=20K=C3=BCber?= 
Date: Tue, 31 Dec 2024 18:51:36 +0000
Subject: [PATCH 107/128] Explain that in paths generics can't be set on both
 the enum and the variant

```
error[E0109]: type arguments are not allowed on enum `Enum` and tuple variant `TSVariant`
  --> $DIR/enum-variant-generic-args.rs:54:12
   |
LL |     Enum::<()>::TSVariant::<()>(());
   |     ----   ^^   ---------   ^^ type argument not allowed
   |     |           |
   |     |           not allowed on tuple variant `TSVariant`
   |     not allowed on enum `Enum`
   |
   = note: generic arguments are not allowed on both an enum and its variant's path segments simultaneously; they are only valid in one place or the other
help: remove the generics arguments from one of the path segments
   |
LL -     Enum::<()>::TSVariant::<()>(());
LL +     Enum::<()>::TSVariant(());
   |
```

Fix #93993.
---
 compiler/rustc_hir_analysis/src/collect.rs    |  7 ++-
 .../src/hir_ty_lowering/errors.rs             | 58 +++++++++++++------
 .../src/hir_ty_lowering/mod.rs                |  4 +-
 .../rustc_hir_typeck/src/fn_ctxt/_impl.rs     |  7 ++-
 .../enum-variant-generic-args.rs              |  6 +-
 .../enum-variant-generic-args.stderr          | 54 ++++++++++++-----
 6 files changed, 94 insertions(+), 42 deletions(-)

diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs
index ce7319f65619..126237799562 100644
--- a/compiler/rustc_hir_analysis/src/collect.rs
+++ b/compiler/rustc_hir_analysis/src/collect.rs
@@ -614,9 +614,10 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
             if !infer_replacements.is_empty() {
                 diag.multipart_suggestion(
                     format!(
-                    "try replacing `_` with the type{} in the corresponding trait method signature",
-                    rustc_errors::pluralize!(infer_replacements.len()),
-                ),
+                        "try replacing `_` with the type{} in the corresponding trait method \
+                         signature",
+                        rustc_errors::pluralize!(infer_replacements.len()),
+                    ),
                     infer_replacements,
                     Applicability::MachineApplicable,
                 );
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 79aa2f4b8ccd..66746dfc3875 100644
--- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs
+++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs
@@ -6,7 +6,7 @@ use rustc_errors::{
     Applicability, Diag, ErrorGuaranteed, MultiSpan, listify, pluralize, struct_span_code_err,
 };
 use rustc_hir as hir;
-use rustc_hir::def::{DefKind, Res};
+use rustc_hir::def::{CtorOf, DefKind, Res};
 use rustc_hir::def_id::DefId;
 use rustc_middle::bug;
 use rustc_middle::ty::fast_reject::{TreatParams, simplify_type};
@@ -1027,7 +1027,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
         &self,
         segments: impl Iterator> + Clone,
         args_visitors: impl Iterator> + Clone,
-        err_extend: GenericsArgsErrExtend<'_>,
+        err_extend: GenericsArgsErrExtend<'a>,
     ) -> ErrorGuaranteed {
         #[derive(PartialEq, Eq, Hash)]
         enum ProhibitGenericsArg {
@@ -1047,23 +1047,27 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
             };
         });
 
+        let segments: Vec<_> = match err_extend {
+            GenericsArgsErrExtend::DefVariant(segments) => segments.iter().collect(),
+            _ => segments.collect(),
+        };
         let types_and_spans: Vec<_> = segments
-            .clone()
+            .iter()
             .flat_map(|segment| {
                 if segment.args().args.is_empty() {
                     None
                 } else {
                     Some((
                         match segment.res {
-                            hir::def::Res::PrimTy(ty) => {
+                            Res::PrimTy(ty) => {
                                 format!("{} `{}`", segment.res.descr(), ty.name())
                             }
-                            hir::def::Res::Def(_, def_id)
+                            Res::Def(_, def_id)
                                 if let Some(name) = self.tcx().opt_item_name(def_id) =>
                             {
                                 format!("{} `{name}`", segment.res.descr())
                             }
-                            hir::def::Res::Err => "this type".to_string(),
+                            Res::Err => "this type".to_string(),
                             _ => segment.res.descr().to_string(),
                         },
                         segment.ident.span,
@@ -1074,11 +1078,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
         let this_type = listify(&types_and_spans, |(t, _)| t.to_string())
             .expect("expected one segment to deny");
 
-        let arg_spans: Vec = segments
-            .clone()
-            .flat_map(|segment| segment.args().args)
-            .map(|arg| arg.span())
-            .collect();
+        let arg_spans: Vec =
+            segments.iter().flat_map(|segment| segment.args().args).map(|arg| arg.span()).collect();
 
         let mut kinds = Vec::with_capacity(4);
         prohibit_args.iter().for_each(|arg| match arg {
@@ -1103,7 +1104,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
         for (what, span) in types_and_spans {
             err.span_label(span, format!("not allowed on {what}"));
         }
-        generics_args_err_extend(self.tcx(), segments, &mut err, err_extend);
+        generics_args_err_extend(self.tcx(), segments.into_iter(), &mut err, err_extend);
         err.emit()
     }
 
@@ -1400,7 +1401,7 @@ pub enum GenericsArgsErrExtend<'tcx> {
     },
     SelfTyParam(Span),
     Param(DefId),
-    DefVariant,
+    DefVariant(&'tcx [hir::PathSegment<'tcx>]),
     None,
 }
 
@@ -1408,7 +1409,7 @@ fn generics_args_err_extend<'a>(
     tcx: TyCtxt<'_>,
     segments: impl Iterator> + Clone,
     err: &mut Diag<'_>,
-    err_extend: GenericsArgsErrExtend<'_>,
+    err_extend: GenericsArgsErrExtend<'a>,
 ) {
     match err_extend {
         GenericsArgsErrExtend::EnumVariant { qself, assoc_segment, adt_def } => {
@@ -1496,6 +1497,32 @@ fn generics_args_err_extend<'a>(
             ];
             err.multipart_suggestion_verbose(msg, suggestion, Applicability::MaybeIncorrect);
         }
+        GenericsArgsErrExtend::DefVariant(segments) => {
+            let args: Vec = segments
+                .iter()
+                .filter_map(|segment| match segment.res {
+                    Res::Def(
+                        DefKind::Ctor(CtorOf::Variant, _) | DefKind::Variant | DefKind::Enum,
+                        _,
+                    ) => segment.args().span_ext().map(|s| s.with_lo(segment.ident.span.hi())),
+                    _ => None,
+                })
+                .collect();
+            if args.len() > 1
+                && let Some(span) = args.into_iter().last()
+            {
+                let msg = "generic arguments are not allowed on both an enum and its variant's \
+                           path segments simultaneously; they are only valid in one place or the \
+                           other";
+                err.note(msg);
+                err.span_suggestion_verbose(
+                    span,
+                    "remove the generics arguments from one of the path segments",
+                    String::new(),
+                    Applicability::MaybeIncorrect,
+                );
+            }
+        }
         GenericsArgsErrExtend::PrimTy(prim_ty) => {
             let name = prim_ty.name_str();
             for segment in segments {
@@ -1512,9 +1539,6 @@ fn generics_args_err_extend<'a>(
         GenericsArgsErrExtend::OpaqueTy => {
             err.note("`impl Trait` types can't have type parameters");
         }
-        GenericsArgsErrExtend::DefVariant => {
-            err.note("enum variants can't have type parameters");
-        }
         GenericsArgsErrExtend::Param(def_id) => {
             let span = tcx.def_ident_span(def_id).unwrap();
             let kind = tcx.def_descr(def_id);
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 ffddf6f73aaf..aef5c7aa38f1 100644
--- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
+++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
@@ -1694,7 +1694,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
     pub fn prohibit_generic_args<'a>(
         &self,
         segments: impl Iterator> + Clone,
-        err_extend: GenericsArgsErrExtend<'_>,
+        err_extend: GenericsArgsErrExtend<'a>,
     ) -> Result<(), ErrorGuaranteed> {
         let args_visitors = segments.clone().flat_map(|segment| segment.args().args);
         let mut result = Ok(());
@@ -1911,7 +1911,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
                     path.segments.iter().enumerate().filter_map(|(index, seg)| {
                         if !indices.contains(&index) { Some(seg) } else { None }
                     }),
-                    GenericsArgsErrExtend::DefVariant,
+                    GenericsArgsErrExtend::DefVariant(&path.segments),
                 );
 
                 let GenericPathSegment(def_id, index) = generic_segments.last().unwrap();
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
index 6bb8cf5f3315..e74ffeff343a 100644
--- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
+++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
@@ -1043,12 +1043,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
 
         let mut user_self_ty = None;
         let mut is_alias_variant_ctor = false;
+        let mut err_extend = GenericsArgsErrExtend::None;
         match res {
             Res::Def(DefKind::Ctor(CtorOf::Variant, _), _) if let Some(self_ty) = self_ty => {
                 let adt_def = self_ty.normalized.ty_adt_def().unwrap();
                 user_self_ty =
                     Some(UserSelfTy { impl_def_id: adt_def.did(), self_ty: self_ty.raw });
                 is_alias_variant_ctor = true;
+                err_extend = GenericsArgsErrExtend::DefVariant(segments);
+            }
+            Res::Def(DefKind::Ctor(CtorOf::Variant, _), _) => {
+                err_extend = GenericsArgsErrExtend::DefVariant(segments);
             }
             Res::Def(DefKind::AssocFn | DefKind::AssocConst, def_id) => {
                 let assoc_item = tcx.associated_item(def_id);
@@ -1095,7 +1100,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             segments.iter().enumerate().filter_map(|(index, seg)| {
                 if !indices.contains(&index) || is_alias_variant_ctor { Some(seg) } else { None }
             }),
-            GenericsArgsErrExtend::None,
+            err_extend,
         );
 
         if let Res::Local(hid) = res {
diff --git a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.rs b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.rs
index 759a7fd7e05a..e4897005a5c1 100644
--- a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.rs
+++ b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.rs
@@ -52,7 +52,7 @@ fn main() {
     // Tuple struct variant
 
     Enum::<()>::TSVariant::<()>(());
-    //~^ ERROR type arguments are not allowed on tuple variant `TSVariant` [E0109]
+    //~^ ERROR type arguments are not allowed on enum `Enum` and tuple variant `TSVariant` [E0109]
 
     Alias::TSVariant::<()>(());
     //~^ ERROR type arguments are not allowed on this type [E0109]
@@ -70,7 +70,7 @@ fn main() {
     // Struct variant
 
     Enum::<()>::SVariant::<()> { v: () };
-    //~^ ERROR type arguments are not allowed on variant `SVariant` [E0109]
+    //~^ ERROR type arguments are not allowed on enum `Enum` and variant `SVariant` [E0109]
 
     Alias::SVariant::<()> { v: () };
     //~^ ERROR type arguments are not allowed on this type [E0109]
@@ -88,7 +88,7 @@ fn main() {
     // Unit variant
 
     Enum::<()>::UVariant::<()>;
-    //~^ ERROR type arguments are not allowed on unit variant `UVariant` [E0109]
+    //~^ ERROR type arguments are not allowed on enum `Enum` and unit variant `UVariant` [E0109]
 
     Alias::UVariant::<()>;
     //~^ ERROR type arguments are not allowed on this type [E0109]
diff --git a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr
index 8caf17ae2da5..3f98a1eb5c09 100644
--- a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr
+++ b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr
@@ -278,13 +278,21 @@ LL |         Self::<()>::UVariant::<()>;
    |                     |
    |                     not allowed on this type
 
-error[E0109]: type arguments are not allowed on tuple variant `TSVariant`
-  --> $DIR/enum-variant-generic-args.rs:54:29
+error[E0109]: type arguments are not allowed on enum `Enum` and tuple variant `TSVariant`
+  --> $DIR/enum-variant-generic-args.rs:54:12
    |
 LL |     Enum::<()>::TSVariant::<()>(());
-   |                 ---------   ^^ type argument not allowed
-   |                 |
-   |                 not allowed on tuple variant `TSVariant`
+   |     ----   ^^   ---------   ^^ type argument not allowed
+   |     |           |
+   |     |           not allowed on tuple variant `TSVariant`
+   |     not allowed on enum `Enum`
+   |
+   = note: generic arguments are not allowed on both an enum and its variant's path segments simultaneously; they are only valid in one place or the other
+help: remove the generics arguments from one of the path segments
+   |
+LL -     Enum::<()>::TSVariant::<()>(());
+LL +     Enum::<()>::TSVariant(());
+   |
 
 error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:57:24
@@ -346,15 +354,21 @@ LL |     AliasFixed::<()>::TSVariant::<()>(());
    |                       |
    |                       not allowed on this type
 
-error[E0109]: type arguments are not allowed on variant `SVariant`
-  --> $DIR/enum-variant-generic-args.rs:72:28
+error[E0109]: type arguments are not allowed on enum `Enum` and variant `SVariant`
+  --> $DIR/enum-variant-generic-args.rs:72:12
    |
 LL |     Enum::<()>::SVariant::<()> { v: () };
-   |                 --------   ^^ type argument not allowed
-   |                 |
-   |                 not allowed on variant `SVariant`
+   |     ----   ^^   --------   ^^ type argument not allowed
+   |     |           |
+   |     |           not allowed on variant `SVariant`
+   |     not allowed on enum `Enum`
+   |
+   = note: generic arguments are not allowed on both an enum and its variant's path segments simultaneously; they are only valid in one place or the other
+help: remove the generics arguments from one of the path segments
+   |
+LL -     Enum::<()>::SVariant::<()> { v: () };
+LL +     Enum::<()>::SVariant { v: () };
    |
-   = note: enum variants can't have type parameters
 
 error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:75:23
@@ -444,13 +458,21 @@ LL -     AliasFixed::<()>::SVariant::<()> { v: () };
 LL +     AliasFixed::<()>::SVariant { v: () };
    |
 
-error[E0109]: type arguments are not allowed on unit variant `UVariant`
-  --> $DIR/enum-variant-generic-args.rs:90:28
+error[E0109]: type arguments are not allowed on enum `Enum` and unit variant `UVariant`
+  --> $DIR/enum-variant-generic-args.rs:90:12
    |
 LL |     Enum::<()>::UVariant::<()>;
-   |                 --------   ^^ type argument not allowed
-   |                 |
-   |                 not allowed on unit variant `UVariant`
+   |     ----   ^^   --------   ^^ type argument not allowed
+   |     |           |
+   |     |           not allowed on unit variant `UVariant`
+   |     not allowed on enum `Enum`
+   |
+   = note: generic arguments are not allowed on both an enum and its variant's path segments simultaneously; they are only valid in one place or the other
+help: remove the generics arguments from one of the path segments
+   |
+LL -     Enum::<()>::UVariant::<()>;
+LL +     Enum::<()>::UVariant;
+   |
 
 error[E0109]: type arguments are not allowed on this type
   --> $DIR/enum-variant-generic-args.rs:93:23

From 23daa8c724cccc4ef75de60d271a50ef193abf0f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Esteban=20K=C3=BCber?= 
Date: Tue, 11 Feb 2025 23:47:56 +0000
Subject: [PATCH 108/128] Remove some the spans pointing at the enum in the
 path and its generic args

```
error[E0109]: type arguments are not allowed on tuple variant `TSVariant`
  --> $DIR/enum-variant-generic-args.rs:54:29
   |
LL |     Enum::<()>::TSVariant::<()>(());
   |                 ---------   ^^ type argument not allowed
   |                 |
   |                 not allowed on tuple variant `TSVariant`
   |
   = note: generic arguments are not allowed on both an enum and its variant's path segments simultaneously; they are only valid in one place or the other
help: remove the generics arguments from one of the path segments
   |
LL -     Enum::<()>::TSVariant::<()>(());
LL +     Enum::<()>::TSVariant(());
   |
```
---
 .../src/hir_ty_lowering/errors.rs             | 13 +++-----
 .../enum-variant-generic-args.rs              |  6 ++--
 .../enum-variant-generic-args.stderr          | 33 +++++++++----------
 3 files changed, 23 insertions(+), 29 deletions(-)

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 66746dfc3875..7eb982a31798 100644
--- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs
+++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs
@@ -1047,10 +1047,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
             };
         });
 
-        let segments: Vec<_> = match err_extend {
-            GenericsArgsErrExtend::DefVariant(segments) => segments.iter().collect(),
-            _ => segments.collect(),
-        };
+        let segments: Vec<_> = segments.collect();
         let types_and_spans: Vec<_> = segments
             .iter()
             .flat_map(|segment| {
@@ -1511,10 +1508,10 @@ fn generics_args_err_extend<'a>(
             if args.len() > 1
                 && let Some(span) = args.into_iter().last()
             {
-                let msg = "generic arguments are not allowed on both an enum and its variant's \
-                           path segments simultaneously; they are only valid in one place or the \
-                           other";
-                err.note(msg);
+                err.note(
+                    "generic arguments are not allowed on both an enum and its variant's path \
+                     segments simultaneously; they are only valid in one place or the other",
+                );
                 err.span_suggestion_verbose(
                     span,
                     "remove the generics arguments from one of the path segments",
diff --git a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.rs b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.rs
index e4897005a5c1..759a7fd7e05a 100644
--- a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.rs
+++ b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.rs
@@ -52,7 +52,7 @@ fn main() {
     // Tuple struct variant
 
     Enum::<()>::TSVariant::<()>(());
-    //~^ ERROR type arguments are not allowed on enum `Enum` and tuple variant `TSVariant` [E0109]
+    //~^ ERROR type arguments are not allowed on tuple variant `TSVariant` [E0109]
 
     Alias::TSVariant::<()>(());
     //~^ ERROR type arguments are not allowed on this type [E0109]
@@ -70,7 +70,7 @@ fn main() {
     // Struct variant
 
     Enum::<()>::SVariant::<()> { v: () };
-    //~^ ERROR type arguments are not allowed on enum `Enum` and variant `SVariant` [E0109]
+    //~^ ERROR type arguments are not allowed on variant `SVariant` [E0109]
 
     Alias::SVariant::<()> { v: () };
     //~^ ERROR type arguments are not allowed on this type [E0109]
@@ -88,7 +88,7 @@ fn main() {
     // Unit variant
 
     Enum::<()>::UVariant::<()>;
-    //~^ ERROR type arguments are not allowed on enum `Enum` and unit variant `UVariant` [E0109]
+    //~^ ERROR type arguments are not allowed on unit variant `UVariant` [E0109]
 
     Alias::UVariant::<()>;
     //~^ ERROR type arguments are not allowed on this type [E0109]
diff --git a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr
index 3f98a1eb5c09..5039ae8f288e 100644
--- a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr
+++ b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr
@@ -278,14 +278,13 @@ LL |         Self::<()>::UVariant::<()>;
    |                     |
    |                     not allowed on this type
 
-error[E0109]: type arguments are not allowed on enum `Enum` and tuple variant `TSVariant`
-  --> $DIR/enum-variant-generic-args.rs:54:12
+error[E0109]: type arguments are not allowed on tuple variant `TSVariant`
+  --> $DIR/enum-variant-generic-args.rs:54:29
    |
 LL |     Enum::<()>::TSVariant::<()>(());
-   |     ----   ^^   ---------   ^^ type argument not allowed
-   |     |           |
-   |     |           not allowed on tuple variant `TSVariant`
-   |     not allowed on enum `Enum`
+   |                 ---------   ^^ type argument not allowed
+   |                 |
+   |                 not allowed on tuple variant `TSVariant`
    |
    = note: generic arguments are not allowed on both an enum and its variant's path segments simultaneously; they are only valid in one place or the other
 help: remove the generics arguments from one of the path segments
@@ -354,14 +353,13 @@ LL |     AliasFixed::<()>::TSVariant::<()>(());
    |                       |
    |                       not allowed on this type
 
-error[E0109]: type arguments are not allowed on enum `Enum` and variant `SVariant`
-  --> $DIR/enum-variant-generic-args.rs:72:12
+error[E0109]: type arguments are not allowed on variant `SVariant`
+  --> $DIR/enum-variant-generic-args.rs:72:28
    |
 LL |     Enum::<()>::SVariant::<()> { v: () };
-   |     ----   ^^   --------   ^^ type argument not allowed
-   |     |           |
-   |     |           not allowed on variant `SVariant`
-   |     not allowed on enum `Enum`
+   |                 --------   ^^ type argument not allowed
+   |                 |
+   |                 not allowed on variant `SVariant`
    |
    = note: generic arguments are not allowed on both an enum and its variant's path segments simultaneously; they are only valid in one place or the other
 help: remove the generics arguments from one of the path segments
@@ -458,14 +456,13 @@ LL -     AliasFixed::<()>::SVariant::<()> { v: () };
 LL +     AliasFixed::<()>::SVariant { v: () };
    |
 
-error[E0109]: type arguments are not allowed on enum `Enum` and unit variant `UVariant`
-  --> $DIR/enum-variant-generic-args.rs:90:12
+error[E0109]: type arguments are not allowed on unit variant `UVariant`
+  --> $DIR/enum-variant-generic-args.rs:90:28
    |
 LL |     Enum::<()>::UVariant::<()>;
-   |     ----   ^^   --------   ^^ type argument not allowed
-   |     |           |
-   |     |           not allowed on unit variant `UVariant`
-   |     not allowed on enum `Enum`
+   |                 --------   ^^ type argument not allowed
+   |                 |
+   |                 not allowed on unit variant `UVariant`
    |
    = note: generic arguments are not allowed on both an enum and its variant's path segments simultaneously; they are only valid in one place or the other
 help: remove the generics arguments from one of the path segments

From d97bde059a21211de92344233738ede496df3e32 Mon Sep 17 00:00:00 2001
From: Jubilee Young 
Date: Tue, 11 Feb 2025 17:22:27 -0800
Subject: [PATCH 109/128] Revert "Stabilize `extended_varargs_abi_support`"

This reverts commit 685f189b4307435b83d625fea397ef36dff4e955.
---
 compiler/rustc_feature/src/accepted.rs        |  3 --
 compiler/rustc_feature/src/unstable.rs        |  3 ++
 compiler/rustc_hir_analysis/messages.ftl      |  2 +-
 compiler/rustc_hir_analysis/src/errors.rs     |  3 +-
 compiler/rustc_hir_analysis/src/lib.rs        | 31 ++++++++++-
 library/std/src/lib.rs                        |  1 +
 .../extended-varargs-abi-support.md           | 10 ++++
 ...ature-gate-extended_varargs_abi_support.rs | 19 +++++++
 ...e-gate-extended_varargs_abi_support.stderr | 52 +++++++++++++++++++
 tests/ui/c-variadic/variadic-ffi-1.stderr     |  2 +-
 tests/ui/c-variadic/variadic-ffi-2-arm.rs     |  1 +
 tests/ui/c-variadic/variadic-ffi-2.rs         |  1 +
 tests/ui/c-variadic/variadic-ffi-2.stderr     |  2 +-
 .../cmse-nonsecure-call/generics.rs           |  2 +-
 .../cmse-nonsecure-call/generics.stderr       |  2 +-
 tests/ui/error-codes/E0045.stderr             |  2 +-
 16 files changed, 124 insertions(+), 12 deletions(-)
 create mode 100644 src/doc/unstable-book/src/language-features/extended-varargs-abi-support.md
 create mode 100644 tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.rs
 create mode 100644 tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.stderr

diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs
index 822cf4982b56..76ca0d618d55 100644
--- a/compiler/rustc_feature/src/accepted.rs
+++ b/compiler/rustc_feature/src/accepted.rs
@@ -197,9 +197,6 @@ declare_features! (
     (accepted, expr_fragment_specifier_2024, "1.83.0", Some(123742)),
     /// Allows arbitrary expressions in key-value attributes at parse time.
     (accepted, extended_key_value_attributes, "1.54.0", Some(78835)),
-    /// Allows using `efiapi`, `aapcs`, `sysv64` and `win64` as calling
-    /// convention for functions with varargs.
-    (accepted, extended_varargs_abi_support, "1.85.0", Some(100189)),
     /// Allows resolving absolute paths as paths from other crates.
     (accepted, extern_absolute_paths, "1.30.0", Some(44660)),
     /// Allows `extern crate foo as bar;`. This puts `bar` into extern prelude.
diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs
index a4c5e4800eb4..ee22d8990fa4 100644
--- a/compiler/rustc_feature/src/unstable.rs
+++ b/compiler/rustc_feature/src/unstable.rs
@@ -487,6 +487,9 @@ declare_features! (
     (unstable, exhaustive_patterns, "1.13.0", Some(51085)),
     /// Allows explicit tail calls via `become` expression.
     (incomplete, explicit_tail_calls, "1.72.0", Some(112788)),
+    /// Allows using `efiapi`, `sysv64` and `win64` as calling convention
+    /// for functions with varargs.
+    (unstable, extended_varargs_abi_support, "1.65.0", Some(100189)),
     /// Allows defining `extern type`s.
     (unstable, extern_types, "1.23.0", Some(43467)),
     /// Allow using 128-bit (quad precision) floating point numbers.
diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl
index 258267c5ca92..be731547b31b 100644
--- a/compiler/rustc_hir_analysis/messages.ftl
+++ b/compiler/rustc_hir_analysis/messages.ftl
@@ -602,7 +602,7 @@ hir_analysis_value_of_associated_struct_already_specified =
     .label = re-bound here
     .previous_bound_label = `{$item_name}` bound here first
 
-hir_analysis_variadic_function_compatible_convention = C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi`
+hir_analysis_variadic_function_compatible_convention = C-variadic function must have a compatible calling convention, like {$conventions}
     .label = C-variadic function must have a compatible calling convention
 
 hir_analysis_variances_of = {$variances}
diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs
index 12750543f4bf..e1e6b677c006 100644
--- a/compiler/rustc_hir_analysis/src/errors.rs
+++ b/compiler/rustc_hir_analysis/src/errors.rs
@@ -646,10 +646,11 @@ pub(crate) struct MainFunctionGenericParameters {
 
 #[derive(Diagnostic)]
 #[diag(hir_analysis_variadic_function_compatible_convention, code = E0045)]
-pub(crate) struct VariadicFunctionCompatibleConvention {
+pub(crate) struct VariadicFunctionCompatibleConvention<'a> {
     #[primary_span]
     #[label]
     pub span: Span,
+    pub conventions: &'a str,
 }
 
 #[derive(Diagnostic)]
diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs
index 3af4318544e9..323b912ca18a 100644
--- a/compiler/rustc_hir_analysis/src/lib.rs
+++ b/compiler/rustc_hir_analysis/src/lib.rs
@@ -100,6 +100,8 @@ use rustc_middle::middle;
 use rustc_middle::mir::interpret::GlobalId;
 use rustc_middle::query::Providers;
 use rustc_middle::ty::{self, Const, Ty, TyCtxt};
+use rustc_session::parse::feature_err;
+use rustc_span::symbol::sym;
 use rustc_span::{ErrorGuaranteed, Span};
 use rustc_trait_selection::traits;
 
@@ -114,9 +116,34 @@ fn require_c_abi_if_c_variadic(
     abi: ExternAbi,
     span: Span,
 ) {
-    if decl.c_variadic && !abi.supports_varargs() {
-        tcx.dcx().emit_err(errors::VariadicFunctionCompatibleConvention { span });
+    const CONVENTIONS_UNSTABLE: &str =
+        "`C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi`";
+    const CONVENTIONS_STABLE: &str = "`C` or `cdecl`";
+    const UNSTABLE_EXPLAIN: &str =
+        "using calling conventions other than `C` or `cdecl` for varargs functions is unstable";
+
+    if !decl.c_variadic || matches!(abi, ExternAbi::C { .. } | ExternAbi::Cdecl { .. }) {
+        return;
     }
+
+    let extended_abi_support = tcx.features().extended_varargs_abi_support();
+    let conventions = match (extended_abi_support, abi.supports_varargs()) {
+        // User enabled additional ABI support for varargs and function ABI matches those ones.
+        (true, true) => return,
+
+        // Using this ABI would be ok, if the feature for additional ABI support was enabled.
+        // Return CONVENTIONS_STABLE, because we want the other error to look the same.
+        (false, true) => {
+            feature_err(&tcx.sess, sym::extended_varargs_abi_support, span, UNSTABLE_EXPLAIN)
+                .emit();
+            CONVENTIONS_STABLE
+        }
+
+        (false, false) => CONVENTIONS_STABLE,
+        (true, false) => CONVENTIONS_UNSTABLE,
+    };
+
+    tcx.dcx().emit_err(errors::VariadicFunctionCompatibleConvention { span, conventions });
 }
 
 pub fn provide(providers: &mut Providers) {
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
index 954a4182fbd6..378c2e18152f 100644
--- a/library/std/src/lib.rs
+++ b/library/std/src/lib.rs
@@ -289,6 +289,7 @@
 #![feature(doc_masked)]
 #![feature(doc_notable_trait)]
 #![feature(dropck_eyepatch)]
+#![feature(extended_varargs_abi_support)]
 #![feature(f128)]
 #![feature(f16)]
 #![feature(formatting_options)]
diff --git a/src/doc/unstable-book/src/language-features/extended-varargs-abi-support.md b/src/doc/unstable-book/src/language-features/extended-varargs-abi-support.md
new file mode 100644
index 000000000000..b20c30ec8f1c
--- /dev/null
+++ b/src/doc/unstable-book/src/language-features/extended-varargs-abi-support.md
@@ -0,0 +1,10 @@
+# `extended_varargs_abi_support`
+
+The tracking issue for this feature is: [#100189]
+
+[#100189]: https://github.com/rust-lang/rust/issues/100189
+
+------------------------
+
+This feature adds the possibility of using `sysv64`, `win64` or `efiapi` calling
+conventions on functions with varargs.
diff --git a/tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.rs b/tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.rs
new file mode 100644
index 000000000000..d47a8e085fd3
--- /dev/null
+++ b/tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.rs
@@ -0,0 +1,19 @@
+//@ only-x86_64
+
+fn efiapi(f: extern "efiapi" fn(usize, ...)) {
+    //~^ ERROR: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
+    //~^^ ERROR: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
+    f(22, 44);
+}
+fn sysv(f: extern "sysv64" fn(usize, ...)) {
+    //~^ ERROR: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
+    //~^^ ERROR: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
+    f(22, 44);
+}
+fn win(f: extern "win64" fn(usize, ...)) {
+    //~^ ERROR: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
+    //~^^ ERROR: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
+    f(22, 44);
+}
+
+fn main() {}
diff --git a/tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.stderr b/tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.stderr
new file mode 100644
index 000000000000..41be37842454
--- /dev/null
+++ b/tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.stderr
@@ -0,0 +1,52 @@
+error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
+  --> $DIR/feature-gate-extended_varargs_abi_support.rs:3:14
+   |
+LL | fn efiapi(f: extern "efiapi" fn(usize, ...)) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #100189  for more information
+   = help: add `#![feature(extended_varargs_abi_support)]` 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[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
+  --> $DIR/feature-gate-extended_varargs_abi_support.rs:3:14
+   |
+LL | fn efiapi(f: extern "efiapi" fn(usize, ...)) {
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
+
+error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
+  --> $DIR/feature-gate-extended_varargs_abi_support.rs:8:12
+   |
+LL | fn sysv(f: extern "sysv64" fn(usize, ...)) {
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #100189  for more information
+   = help: add `#![feature(extended_varargs_abi_support)]` 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[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
+  --> $DIR/feature-gate-extended_varargs_abi_support.rs:8:12
+   |
+LL | fn sysv(f: extern "sysv64" fn(usize, ...)) {
+   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
+
+error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
+  --> $DIR/feature-gate-extended_varargs_abi_support.rs:13:11
+   |
+LL | fn win(f: extern "win64" fn(usize, ...)) {
+   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #100189  for more information
+   = help: add `#![feature(extended_varargs_abi_support)]` 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[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
+  --> $DIR/feature-gate-extended_varargs_abi_support.rs:13:11
+   |
+LL | fn win(f: extern "win64" fn(usize, ...)) {
+   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
+
+error: aborting due to 6 previous errors
+
+Some errors have detailed explanations: E0045, E0658.
+For more information about an error, try `rustc --explain E0045`.
diff --git a/tests/ui/c-variadic/variadic-ffi-1.stderr b/tests/ui/c-variadic/variadic-ffi-1.stderr
index 061eae9729e2..dd8c7e93c4ef 100644
--- a/tests/ui/c-variadic/variadic-ffi-1.stderr
+++ b/tests/ui/c-variadic/variadic-ffi-1.stderr
@@ -1,4 +1,4 @@
-error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi`
+error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
   --> $DIR/variadic-ffi-1.rs:9:5
    |
 LL |     fn printf(_: *const u8, ...);
diff --git a/tests/ui/c-variadic/variadic-ffi-2-arm.rs b/tests/ui/c-variadic/variadic-ffi-2-arm.rs
index 82f9df5053c1..3b0a71007a0e 100644
--- a/tests/ui/c-variadic/variadic-ffi-2-arm.rs
+++ b/tests/ui/c-variadic/variadic-ffi-2-arm.rs
@@ -1,5 +1,6 @@
 //@ only-arm
 //@ build-pass
+#![feature(extended_varargs_abi_support)]
 
 fn aapcs(f: extern "aapcs" fn(usize, ...)) {
     f(22, 44);
diff --git a/tests/ui/c-variadic/variadic-ffi-2.rs b/tests/ui/c-variadic/variadic-ffi-2.rs
index 17a1065279f4..bafb7e2b20cc 100644
--- a/tests/ui/c-variadic/variadic-ffi-2.rs
+++ b/tests/ui/c-variadic/variadic-ffi-2.rs
@@ -1,4 +1,5 @@
 //@ ignore-arm stdcall isn't supported
+#![feature(extended_varargs_abi_support)]
 
 #[allow(unsupported_fn_ptr_calling_conventions)]
 fn baz(f: extern "stdcall" fn(usize, ...)) {
diff --git a/tests/ui/c-variadic/variadic-ffi-2.stderr b/tests/ui/c-variadic/variadic-ffi-2.stderr
index fbf273b1f1db..e52de93a9264 100644
--- a/tests/ui/c-variadic/variadic-ffi-2.stderr
+++ b/tests/ui/c-variadic/variadic-ffi-2.stderr
@@ -1,5 +1,5 @@
 error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi`
-  --> $DIR/variadic-ffi-2.rs:4:11
+  --> $DIR/variadic-ffi-2.rs:5:11
    |
 LL | fn baz(f: extern "stdcall" fn(usize, ...)) {
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs
index da1327dace5d..9e0ffa75c229 100644
--- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs
+++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs
@@ -39,4 +39,4 @@ type WithTransparentTraitObject =
 //~^ ERROR return value of `"C-cmse-nonsecure-call"` function too large to pass via registers [E0798]
 
 type WithVarArgs = extern "C-cmse-nonsecure-call" fn(u32, ...);
-//~^ ERROR C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi` [E0045]
+//~^ ERROR C-variadic function must have a compatible calling convention, like `C` or `cdecl` [E0045]
diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr
index 0560f0eec1c0..f0d5f648f4c6 100644
--- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr
+++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr
@@ -69,7 +69,7 @@ LL |     extern "C-cmse-nonsecure-call" fn(WrapperTransparent) -> WrapperTranspa
    = note: functions with the `"C-cmse-nonsecure-call"` ABI must pass their result via the available return registers
    = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
 
-error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi`
+error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
   --> $DIR/generics.rs:41:20
    |
 LL | type WithVarArgs = extern "C-cmse-nonsecure-call" fn(u32, ...);
diff --git a/tests/ui/error-codes/E0045.stderr b/tests/ui/error-codes/E0045.stderr
index b8ee31a40495..25b2f2654da1 100644
--- a/tests/ui/error-codes/E0045.stderr
+++ b/tests/ui/error-codes/E0045.stderr
@@ -1,4 +1,4 @@
-error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi`
+error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
   --> $DIR/E0045.rs:1:17
    |
 LL | extern "Rust" { fn foo(x: u8, ...); }

From 3e50873aa14806d25243a73f1202b904dd34e4ad Mon Sep 17 00:00:00 2001
From: Tshepang Mbambo 
Date: Wed, 12 Feb 2025 04:31:33 +0200
Subject: [PATCH 110/128] test cli functionality in all targets

---
 tests/ui/invalid-compile-flags/crate-type-flag.rs | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tests/ui/invalid-compile-flags/crate-type-flag.rs b/tests/ui/invalid-compile-flags/crate-type-flag.rs
index bc7a0bc46c3a..2b32f04da961 100644
--- a/tests/ui/invalid-compile-flags/crate-type-flag.rs
+++ b/tests/ui/invalid-compile-flags/crate-type-flag.rs
@@ -39,9 +39,7 @@
 //@[multivalue] compile-flags: --crate-type=lib,rlib,staticlib
 //@[multivalue] check-pass
 
-//@[multivalue_combined] ignore-musl (dylibs are not supported)
-//@[multivalue_combined] ignore-wasm (dylibs are not supported)
-//@[multivalue_combined] compile-flags: --crate-type=lib,rlib,staticlib --crate-type=dylib
+//@[multivalue_combined] compile-flags: --crate-type=lib,rlib --crate-type=staticlib
 //@[multivalue_combined] check-pass
 
 // `proc-macro` is accepted, but `proc_macro` is not.

From d5f645647f25fcc259a1b78cabe38cc23dc06d3b Mon Sep 17 00:00:00 2001
From: Tshepang Mbambo 
Date: Wed, 12 Feb 2025 04:41:14 +0200
Subject: [PATCH 111/128] clarify

Also, use signular form for consistency/simplicity
---
 tests/ui/invalid-compile-flags/crate-type-flag.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/ui/invalid-compile-flags/crate-type-flag.rs b/tests/ui/invalid-compile-flags/crate-type-flag.rs
index 2b32f04da961..07d853b33071 100644
--- a/tests/ui/invalid-compile-flags/crate-type-flag.rs
+++ b/tests/ui/invalid-compile-flags/crate-type-flag.rs
@@ -17,12 +17,12 @@
 //@[staticlib] compile-flags: --crate-type=staticlib
 //@[staticlib] check-pass
 
-//@[dylib] ignore-musl (dylibs are not supported)
-//@[dylib] ignore-wasm (dylibs are not supported)
+//@[dylib] ignore-musl (dylib is supported, but musl libc is statically linked by default)
+//@[dylib] ignore-wasm (dylib is not supported)
 //@[dylib] compile-flags: --crate-type=dylib
 //@[dylib] check-pass
 
-//@[cdylib] ignore-musl (cdylibs are not supported)
+//@[cdylib] ignore-musl (cdylib is supported, but musl libc is statically linked by default)
 //@[cdylib] compile-flags: --crate-type=cdylib
 //@[cdylib] check-pass
 

From d9c7abba55762f7ec25fc1d9a322f26896381e4f Mon Sep 17 00:00:00 2001
From: Jubilee Young 
Date: Sun, 9 Feb 2025 23:03:24 -0800
Subject: [PATCH 112/128] compiler: narrow scope of nightly cfg in rustc_abi

---
 compiler/rustc_abi/src/extern_abi.rs | 3 ++-
 compiler/rustc_abi/src/lib.rs        | 6 +-----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/compiler/rustc_abi/src/extern_abi.rs b/compiler/rustc_abi/src/extern_abi.rs
index f3cf7f583ceb..a4dc87247a08 100644
--- a/compiler/rustc_abi/src/extern_abi.rs
+++ b/compiler/rustc_abi/src/extern_abi.rs
@@ -1,5 +1,6 @@
 use std::fmt;
 
+#[cfg(feature = "nightly")]
 use rustc_macros::{Decodable, Encodable, HashStable_Generic};
 
 #[cfg(test)]
@@ -8,7 +9,7 @@ mod tests;
 use ExternAbi as Abi;
 
 #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Debug)]
-#[derive(HashStable_Generic, Encodable, Decodable)]
+#[cfg_attr(feature = "nightly", derive(HashStable_Generic, Encodable, Decodable))]
 pub enum ExternAbi {
     // Some of the ABIs come first because every time we add a new ABI, we have to re-bless all the
     // hashing tests. These are used in many places, so giving them stable values reduces test
diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs
index 259f1c18ea8e..1e4685dc2a39 100644
--- a/compiler/rustc_abi/src/lib.rs
+++ b/compiler/rustc_abi/src/lib.rs
@@ -52,20 +52,16 @@ use bitflags::bitflags;
 use rustc_data_structures::stable_hasher::StableOrd;
 use rustc_index::{Idx, IndexSlice, IndexVec};
 #[cfg(feature = "nightly")]
-use rustc_macros::HashStable_Generic;
-#[cfg(feature = "nightly")]
-use rustc_macros::{Decodable_Generic, Encodable_Generic};
+use rustc_macros::{Decodable_Generic, Encodable_Generic, HashStable_Generic};
 
 mod callconv;
 mod layout;
 #[cfg(test)]
 mod tests;
 
-#[cfg(feature = "nightly")]
 mod extern_abi;
 
 pub use callconv::{Heterogeneous, HomogeneousAggregate, Reg, RegKind};
-#[cfg(feature = "nightly")]
 pub use extern_abi::{AbiDatas, AbiUnsupported, ExternAbi, all_names, lookup};
 #[cfg(feature = "nightly")]
 pub use layout::{FIRST_VARIANT, FieldIdx, Layout, TyAbiInterface, TyAndLayout, VariantIdx};

From 038c183d5f94b5ca3bed351374b01be4b1c90176 Mon Sep 17 00:00:00 2001
From: Jubilee Young 
Date: Sun, 9 Feb 2025 23:55:16 -0800
Subject: [PATCH 113/128] compiler: remove rustc_target reexport of
 rustc_abi::HashStableContext

The last public reexport of rustc_abi in rustc_target is finally gone.
---
 Cargo.lock                                          | 3 +--
 compiler/rustc_ast_passes/Cargo.toml                | 1 -
 compiler/rustc_hir/src/stable_hash_impls.rs         | 4 +---
 compiler/rustc_query_system/Cargo.toml              | 2 +-
 compiler/rustc_query_system/src/ich/impls_syntax.rs | 2 +-
 compiler/rustc_target/src/lib.rs                    | 2 +-
 6 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 20b715e59a6e..d31ef9c4b17e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3409,7 +3409,6 @@ dependencies = [
  "rustc_parse",
  "rustc_session",
  "rustc_span",
- "rustc_target",
  "thin-vec",
 ]
 
@@ -4423,6 +4422,7 @@ version = "0.0.0"
 dependencies = [
  "parking_lot",
  "rustc-rayon-core",
+ "rustc_abi",
  "rustc_ast",
  "rustc_data_structures",
  "rustc_errors",
@@ -4434,7 +4434,6 @@ dependencies = [
  "rustc_serialize",
  "rustc_session",
  "rustc_span",
- "rustc_target",
  "smallvec",
  "thin-vec",
  "tracing",
diff --git a/compiler/rustc_ast_passes/Cargo.toml b/compiler/rustc_ast_passes/Cargo.toml
index 19c379c8599a..e4c227532085 100644
--- a/compiler/rustc_ast_passes/Cargo.toml
+++ b/compiler/rustc_ast_passes/Cargo.toml
@@ -18,6 +18,5 @@ rustc_macros = { path = "../rustc_macros" }
 rustc_parse = { path = "../rustc_parse" }
 rustc_session = { path = "../rustc_session" }
 rustc_span = { path = "../rustc_span" }
-rustc_target = { path = "../rustc_target" }
 thin-vec = "0.2.12"
 # tidy-alphabetical-end
diff --git a/compiler/rustc_hir/src/stable_hash_impls.rs b/compiler/rustc_hir/src/stable_hash_impls.rs
index db0d0fcf3b91..d7c8a3d5c0a5 100644
--- a/compiler/rustc_hir/src/stable_hash_impls.rs
+++ b/compiler/rustc_hir/src/stable_hash_impls.rs
@@ -10,9 +10,7 @@ use crate::hir_id::{HirId, ItemLocalId};
 /// Requirements for a `StableHashingContext` to be used in this crate.
 /// This is a hack to allow using the `HashStable_Generic` derive macro
 /// instead of implementing everything in `rustc_middle`.
-pub trait HashStableContext:
-    rustc_ast::HashStableContext + rustc_target::HashStableContext
-{
+pub trait HashStableContext: rustc_ast::HashStableContext + rustc_abi::HashStableContext {
     fn hash_attr(&mut self, _: &Attribute, hasher: &mut StableHasher);
 }
 
diff --git a/compiler/rustc_query_system/Cargo.toml b/compiler/rustc_query_system/Cargo.toml
index 96b210accdb3..a42329b4614f 100644
--- a/compiler/rustc_query_system/Cargo.toml
+++ b/compiler/rustc_query_system/Cargo.toml
@@ -7,6 +7,7 @@ edition = "2021"
 # tidy-alphabetical-start
 parking_lot = "0.12"
 rustc-rayon-core = { version = "0.5.0" }
+rustc_abi = { path = "../rustc_abi" }
 rustc_ast = { path = "../rustc_ast" }
 rustc_data_structures = { path = "../rustc_data_structures" }
 rustc_errors = { path = "../rustc_errors" }
@@ -18,7 +19,6 @@ rustc_macros = { path = "../rustc_macros" }
 rustc_serialize = { path = "../rustc_serialize" }
 rustc_session = { path = "../rustc_session" }
 rustc_span = { path = "../rustc_span" }
-rustc_target = { path = "../rustc_target" }
 smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
 thin-vec = "0.2.12"
 tracing = "0.1"
diff --git a/compiler/rustc_query_system/src/ich/impls_syntax.rs b/compiler/rustc_query_system/src/ich/impls_syntax.rs
index 480fd4977283..7d508b8201bd 100644
--- a/compiler/rustc_query_system/src/ich/impls_syntax.rs
+++ b/compiler/rustc_query_system/src/ich/impls_syntax.rs
@@ -8,7 +8,7 @@ use smallvec::SmallVec;
 
 use crate::ich::StableHashingContext;
 
-impl<'ctx> rustc_target::HashStableContext for StableHashingContext<'ctx> {}
+impl<'ctx> rustc_abi::HashStableContext for StableHashingContext<'ctx> {}
 impl<'ctx> rustc_ast::HashStableContext for StableHashingContext<'ctx> {}
 
 impl<'a> HashStable> for [hir::Attribute] {
diff --git a/compiler/rustc_target/src/lib.rs b/compiler/rustc_target/src/lib.rs
index bde4af643fa6..7ebe96960ed0 100644
--- a/compiler/rustc_target/src/lib.rs
+++ b/compiler/rustc_target/src/lib.rs
@@ -30,7 +30,7 @@ pub mod target_features;
 #[cfg(test)]
 mod tests;
 
-pub use rustc_abi::HashStableContext;
+use rustc_abi::HashStableContext;
 
 /// The name of rustc's own place to organize libraries.
 ///

From 32fd1a7b7205d1f8ccf168c22dada83ea38e3adb Mon Sep 17 00:00:00 2001
From: Jubilee Young 
Date: Tue, 11 Feb 2025 19:40:29 -0800
Subject: [PATCH 114/128] compiler: replace ExternAbi::name calls with
 formatters

Most of these just format the ABI string, so... just format ExternAbi?
This makes it more consistent and less jank when we can do it.
---
 compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs |  4 +---
 compiler/rustc_errors/src/diagnostic_impls.rs          |  1 +
 compiler/rustc_hir_analysis/messages.ftl               |  8 ++++----
 compiler/rustc_hir_analysis/src/errors.rs              |  5 +++--
 .../rustc_hir_analysis/src/hir_ty_lowering/cmse.rs     | 10 ++++------
 compiler/rustc_lint/src/early/diagnostics.rs           |  3 +--
 compiler/rustc_lint/src/lints.rs                       |  5 +++--
 .../src/function_item_references.rs                    |  7 +------
 .../ui/link-native-libs/suggest-libname-only-1.stderr  |  2 +-
 .../ui/link-native-libs/suggest-libname-only-2.stderr  |  2 +-
 tests/ui/lint/cli-lint-override.forbid_warn.stderr     |  2 +-
 tests/ui/lint/cli-lint-override.force_warn_deny.stderr |  2 +-
 tests/ui/lint/cli-lint-override.warn_deny.stderr       |  2 +-
 tests/ui/parser/bad-lit-suffixes.stderr                |  4 ++--
 tests/ui/parser/lit-err-in-macro.stderr                |  2 +-
 tests/ui/proc-macro/inner-attrs.stderr                 |  2 +-
 16 files changed, 27 insertions(+), 34 deletions(-)

diff --git a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
index 051753715913..53953b089c61 100644
--- a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
+++ b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
@@ -367,9 +367,7 @@ fn push_debuginfo_type_name<'tcx>(
                 output.push_str(sig.safety.prefix_str());
 
                 if sig.abi != rustc_abi::ExternAbi::Rust {
-                    output.push_str("extern \"");
-                    output.push_str(sig.abi.name());
-                    output.push_str("\" ");
+                    let _ = write!(output, "extern {} ", sig.abi);
                 }
 
                 output.push_str("fn(");
diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs
index 14baf7554bcf..7f383946c146 100644
--- a/compiler/rustc_errors/src/diagnostic_impls.rs
+++ b/compiler/rustc_errors/src/diagnostic_impls.rs
@@ -93,6 +93,7 @@ into_diag_arg_using_display!(
     SplitDebuginfo,
     ExitStatus,
     ErrCode,
+    rustc_abi::ExternAbi,
 );
 
 impl IntoDiagArg for rustc_type_ir::TraitRef {
diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl
index 258267c5ca92..d7b43a8126d8 100644
--- a/compiler/rustc_hir_analysis/messages.ftl
+++ b/compiler/rustc_hir_analysis/messages.ftl
@@ -72,17 +72,17 @@ hir_analysis_cmse_entry_generic =
     functions with the `"C-cmse-nonsecure-entry"` ABI cannot contain generics in their type
 
 hir_analysis_cmse_inputs_stack_spill =
-    arguments for `"{$abi_name}"` function too large to pass via registers
+    arguments for `{$abi}` function too large to pass via registers
     .label = {$plural ->
         [false] this argument doesn't
         *[true] these arguments don't
     } fit in the available registers
-    .note = functions with the `"{$abi_name}"` ABI must pass all their arguments via the 4 32-bit available argument registers
+    .note = functions with the `{$abi}` ABI must pass all their arguments via the 4 32-bit available argument registers
 
 hir_analysis_cmse_output_stack_spill =
-    return value of `"{$abi_name}"` function too large to pass via registers
+    return value of `{$abi}` function too large to pass via registers
     .label = this type doesn't fit in the available registers
-    .note1 = functions with the `"{$abi_name}"` ABI must pass their result via the available return registers
+    .note1 = functions with the `{$abi}` ABI must pass their result via the available return registers
     .note2 = the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size
 
 hir_analysis_coerce_pointee_no_field = `CoercePointee` can only be derived on `struct`s with at least one field
diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs
index 12750543f4bf..0d0fe9d981f9 100644
--- a/compiler/rustc_hir_analysis/src/errors.rs
+++ b/compiler/rustc_hir_analysis/src/errors.rs
@@ -1,5 +1,6 @@
 //! Errors emitted by `rustc_hir_analysis`.
 
+use rustc_abi::ExternAbi;
 use rustc_errors::codes::*;
 use rustc_errors::{
     Applicability, Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, MultiSpan,
@@ -1689,7 +1690,7 @@ pub(crate) struct CmseInputsStackSpill {
     #[label]
     pub span: Span,
     pub plural: bool,
-    pub abi_name: &'static str,
+    pub abi: ExternAbi,
 }
 
 #[derive(Diagnostic)]
@@ -1700,7 +1701,7 @@ pub(crate) struct CmseOutputStackSpill {
     #[primary_span]
     #[label]
     pub span: Span,
-    pub abi_name: &'static str,
+    pub abi: ExternAbi,
 }
 
 #[derive(Diagnostic)]
diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/cmse.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/cmse.rs
index 4c8f2735b979..5fed2e352879 100644
--- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/cmse.rs
+++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/cmse.rs
@@ -17,8 +17,6 @@ pub(crate) fn validate_cmse_abi<'tcx>(
     abi: ExternAbi,
     fn_sig: ty::PolyFnSig<'tcx>,
 ) {
-    let abi_name = abi.name();
-
     match abi {
         ExternAbi::CCmseNonSecureCall => {
             let hir_node = tcx.hir_node(hir_id);
@@ -56,7 +54,7 @@ pub(crate) fn validate_cmse_abi<'tcx>(
                         .to(bare_fn_ty.decl.inputs[index].span)
                         .to(bare_fn_ty.decl.inputs.last().unwrap().span);
                     let plural = bare_fn_ty.param_names.len() - index != 1;
-                    dcx.emit_err(errors::CmseInputsStackSpill { span, plural, abi_name });
+                    dcx.emit_err(errors::CmseInputsStackSpill { span, plural, abi });
                 }
                 Err(layout_err) => {
                     if should_emit_generic_error(abi, layout_err) {
@@ -69,7 +67,7 @@ pub(crate) fn validate_cmse_abi<'tcx>(
                 Ok(true) => {}
                 Ok(false) => {
                     let span = bare_fn_ty.decl.output.span();
-                    dcx.emit_err(errors::CmseOutputStackSpill { span, abi_name });
+                    dcx.emit_err(errors::CmseOutputStackSpill { span, abi });
                 }
                 Err(layout_err) => {
                     if should_emit_generic_error(abi, layout_err) {
@@ -92,7 +90,7 @@ pub(crate) fn validate_cmse_abi<'tcx>(
                     //                                      ^^^^^^
                     let span = decl.inputs[index].span.to(decl.inputs.last().unwrap().span);
                     let plural = decl.inputs.len() - index != 1;
-                    dcx.emit_err(errors::CmseInputsStackSpill { span, plural, abi_name });
+                    dcx.emit_err(errors::CmseInputsStackSpill { span, plural, abi });
                 }
                 Err(layout_err) => {
                     if should_emit_generic_error(abi, layout_err) {
@@ -105,7 +103,7 @@ pub(crate) fn validate_cmse_abi<'tcx>(
                 Ok(true) => {}
                 Ok(false) => {
                     let span = decl.output.span();
-                    dcx.emit_err(errors::CmseOutputStackSpill { span, abi_name });
+                    dcx.emit_err(errors::CmseOutputStackSpill { span, abi });
                 }
                 Err(layout_err) => {
                     if should_emit_generic_error(abi, layout_err) {
diff --git a/compiler/rustc_lint/src/early/diagnostics.rs b/compiler/rustc_lint/src/early/diagnostics.rs
index 92dbc76a7b5e..aeb5a03a4f7e 100644
--- a/compiler/rustc_lint/src/early/diagnostics.rs
+++ b/compiler/rustc_lint/src/early/diagnostics.rs
@@ -160,8 +160,7 @@ pub(super) fn decorate_lint(
             .decorate_lint(diag);
         }
         BuiltinLintDiag::MissingAbi(label_span, default_abi) => {
-            lints::MissingAbi { span: label_span, default_abi: default_abi.name() }
-                .decorate_lint(diag);
+            lints::MissingAbi { span: label_span, default_abi }.decorate_lint(diag);
         }
         BuiltinLintDiag::LegacyDeriveHelpers(label_span) => {
             lints::LegacyDeriveHelpers { span: label_span }.decorate_lint(diag);
diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs
index 09b0e1ed8bdb..368d36bfdd0b 100644
--- a/compiler/rustc_lint/src/lints.rs
+++ b/compiler/rustc_lint/src/lints.rs
@@ -2,6 +2,7 @@
 #![allow(rustc::untranslatable_diagnostic)]
 use std::num::NonZero;
 
+use rustc_abi::ExternAbi;
 use rustc_errors::codes::*;
 use rustc_errors::{
     Applicability, Diag, DiagArgValue, DiagMessage, DiagStyledString, ElidedLifetimeInPathSubdiag,
@@ -2833,9 +2834,9 @@ pub(crate) struct PatternsInFnsWithoutBodySub {
 #[derive(LintDiagnostic)]
 #[diag(lint_extern_without_abi)]
 pub(crate) struct MissingAbi {
-    #[suggestion(code = "extern \"{default_abi}\"", applicability = "machine-applicable")]
+    #[suggestion(code = "extern {default_abi}", applicability = "machine-applicable")]
     pub span: Span,
-    pub default_abi: &'static str,
+    pub default_abi: ExternAbi,
 }
 
 #[derive(LintDiagnostic)]
diff --git a/compiler/rustc_mir_transform/src/function_item_references.rs b/compiler/rustc_mir_transform/src/function_item_references.rs
index 7e88925b2e1b..73e47bb79f0b 100644
--- a/compiler/rustc_mir_transform/src/function_item_references.rs
+++ b/compiler/rustc_mir_transform/src/function_item_references.rs
@@ -161,12 +161,7 @@ impl<'tcx> FunctionItemRefChecker<'_, 'tcx> {
         let unsafety = fn_sig.safety().prefix_str();
         let abi = match fn_sig.abi() {
             ExternAbi::Rust => String::from(""),
-            other_abi => {
-                let mut s = String::from("extern \"");
-                s.push_str(other_abi.name());
-                s.push_str("\" ");
-                s
-            }
+            other_abi => format!("extern {other_abi} "),
         };
         let ident = self.tcx.item_ident(fn_id);
         let ty_params = fn_args.types().map(|ty| format!("{ty}"));
diff --git a/tests/ui/link-native-libs/suggest-libname-only-1.stderr b/tests/ui/link-native-libs/suggest-libname-only-1.stderr
index aae8f7de966a..47f7d92c9f9e 100644
--- a/tests/ui/link-native-libs/suggest-libname-only-1.stderr
+++ b/tests/ui/link-native-libs/suggest-libname-only-1.stderr
@@ -2,7 +2,7 @@ warning: extern declarations without an explicit ABI are deprecated
   --> $DIR/suggest-libname-only-1.rs:7:1
    |
 LL | extern { }
-   | ^^^^^^ help: explicitly specify the C ABI: `extern "C"`
+   | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
    |
    = note: `#[warn(missing_abi)]` on by default
 
diff --git a/tests/ui/link-native-libs/suggest-libname-only-2.stderr b/tests/ui/link-native-libs/suggest-libname-only-2.stderr
index a2adaee3f97f..a2d8f4c8191b 100644
--- a/tests/ui/link-native-libs/suggest-libname-only-2.stderr
+++ b/tests/ui/link-native-libs/suggest-libname-only-2.stderr
@@ -2,7 +2,7 @@ warning: extern declarations without an explicit ABI are deprecated
   --> $DIR/suggest-libname-only-2.rs:7:1
    |
 LL | extern { }
-   | ^^^^^^ help: explicitly specify the C ABI: `extern "C"`
+   | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
    |
    = note: `#[warn(missing_abi)]` on by default
 
diff --git a/tests/ui/lint/cli-lint-override.forbid_warn.stderr b/tests/ui/lint/cli-lint-override.forbid_warn.stderr
index 169be997b48c..fb8779ad4f15 100644
--- a/tests/ui/lint/cli-lint-override.forbid_warn.stderr
+++ b/tests/ui/lint/cli-lint-override.forbid_warn.stderr
@@ -2,7 +2,7 @@ error: extern declarations without an explicit ABI are deprecated
   --> $DIR/cli-lint-override.rs:12:1
    |
 LL | extern fn foo() {}
-   | ^^^^^^ help: explicitly specify the C ABI: `extern "C"`
+   | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
    |
    = note: requested on the command line with `-F missing-abi`
 
diff --git a/tests/ui/lint/cli-lint-override.force_warn_deny.stderr b/tests/ui/lint/cli-lint-override.force_warn_deny.stderr
index 574f2ca66a42..10fc13e3f52f 100644
--- a/tests/ui/lint/cli-lint-override.force_warn_deny.stderr
+++ b/tests/ui/lint/cli-lint-override.force_warn_deny.stderr
@@ -2,7 +2,7 @@ warning: extern declarations without an explicit ABI are deprecated
   --> $DIR/cli-lint-override.rs:12:1
    |
 LL | extern fn foo() {}
-   | ^^^^^^ help: explicitly specify the C ABI: `extern "C"`
+   | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
    |
    = note: requested on the command line with `--force-warn missing-abi`
 
diff --git a/tests/ui/lint/cli-lint-override.warn_deny.stderr b/tests/ui/lint/cli-lint-override.warn_deny.stderr
index bfec37ada95e..979ca22324f1 100644
--- a/tests/ui/lint/cli-lint-override.warn_deny.stderr
+++ b/tests/ui/lint/cli-lint-override.warn_deny.stderr
@@ -2,7 +2,7 @@ error: extern declarations without an explicit ABI are deprecated
   --> $DIR/cli-lint-override.rs:12:1
    |
 LL | extern fn foo() {}
-   | ^^^^^^ help: explicitly specify the C ABI: `extern "C"`
+   | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
    |
    = note: requested on the command line with `-D missing-abi`
 
diff --git a/tests/ui/parser/bad-lit-suffixes.stderr b/tests/ui/parser/bad-lit-suffixes.stderr
index 704f7363e81c..d6b50b0e0d1f 100644
--- a/tests/ui/parser/bad-lit-suffixes.stderr
+++ b/tests/ui/parser/bad-lit-suffixes.stderr
@@ -55,7 +55,7 @@ warning: extern declarations without an explicit ABI are deprecated
   --> $DIR/bad-lit-suffixes.rs:3:1
    |
 LL | extern
-   | ^^^^^^ help: explicitly specify the C ABI: `extern "C"`
+   | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
    |
    = note: `#[warn(missing_abi)]` on by default
 
@@ -63,7 +63,7 @@ warning: extern declarations without an explicit ABI are deprecated
   --> $DIR/bad-lit-suffixes.rs:7:1
    |
 LL | extern
-   | ^^^^^^ help: explicitly specify the C ABI: `extern "C"`
+   | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
 
 error: suffixes on string literals are invalid
   --> $DIR/bad-lit-suffixes.rs:12:5
diff --git a/tests/ui/parser/lit-err-in-macro.stderr b/tests/ui/parser/lit-err-in-macro.stderr
index fc2603d0b104..9422f22f9c8f 100644
--- a/tests/ui/parser/lit-err-in-macro.stderr
+++ b/tests/ui/parser/lit-err-in-macro.stderr
@@ -8,7 +8,7 @@ warning: extern declarations without an explicit ABI are deprecated
   --> $DIR/lit-err-in-macro.rs:3:9
    |
 LL |         extern $abi fn f() {}
-   |         ^^^^^^ help: explicitly specify the C ABI: `extern "C"`
+   |         ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
 ...
 LL | f!("Foo"__);
    | ----------- in this macro invocation
diff --git a/tests/ui/proc-macro/inner-attrs.stderr b/tests/ui/proc-macro/inner-attrs.stderr
index 3ab180be821a..8b5fec1b4c37 100644
--- a/tests/ui/proc-macro/inner-attrs.stderr
+++ b/tests/ui/proc-macro/inner-attrs.stderr
@@ -26,7 +26,7 @@ warning: extern declarations without an explicit ABI are deprecated
   --> $DIR/inner-attrs.rs:82:1
    |
 LL | extern {
-   | ^^^^^^ help: explicitly specify the C ABI: `extern "C"`
+   | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`
    |
    = note: `#[warn(missing_abi)]` on by default
 

From cafa646f21ec41d6b20b5495c25456c997206dc1 Mon Sep 17 00:00:00 2001
From: Jubilee Young 
Date: Tue, 11 Feb 2025 17:25:26 -0800
Subject: [PATCH 115/128] library: amend revert of extended_varargs_abi_support
 for beta diff

And leave a comment on the unusual `cfg_attr`

Co-authored-by: waffle 
---
 library/std/src/lib.rs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
index 378c2e18152f..aea81b4bddee 100644
--- a/library/std/src/lib.rs
+++ b/library/std/src/lib.rs
@@ -272,6 +272,9 @@
 //
 // Language features:
 // tidy-alphabetical-start
+
+// stabilization was reverted after it hit beta
+#![cfg_attr(not(bootstrap), feature(extended_varargs_abi_support))]
 #![feature(alloc_error_handler)]
 #![feature(allocator_internals)]
 #![feature(allow_internal_unsafe)]
@@ -289,7 +292,6 @@
 #![feature(doc_masked)]
 #![feature(doc_notable_trait)]
 #![feature(dropck_eyepatch)]
-#![feature(extended_varargs_abi_support)]
 #![feature(f128)]
 #![feature(f16)]
 #![feature(formatting_options)]

From 8abff35b41b8de89da35ab851f931d6a582f7670 Mon Sep 17 00:00:00 2001
From: Jubilee Young 
Date: Mon, 10 Feb 2025 03:57:32 -0800
Subject: [PATCH 116/128] compiler: compare and hash ExternAbi like its string

Directly map each ExternAbi variant to its string and back again.
This has a few advantages:
- By making the ABIs compare equal to their strings, we can easily
  lexicographically sort them and use that sorted slice at runtime.
- We no longer need a workaround to make sure the hashes remain stable,
  as they already naturally are (by being the hashes of unique strings).
- The compiler can carry around less &str wide pointers
---
 compiler/rustc_abi/src/extern_abi.rs          | 141 ++++++++++++++++--
 compiler/rustc_abi/src/extern_abi/tests.rs    |   8 +
 compiler/rustc_ast_lowering/src/stability.rs  |   9 +-
 compiler/rustc_driver_impl/src/lib.rs         |   3 +-
 tests/ui/symbol-names/basic.legacy.stderr     |   4 +-
 .../ui/symbol-names/issue-60925.legacy.stderr |   4 +-
 6 files changed, 144 insertions(+), 25 deletions(-)

diff --git a/compiler/rustc_abi/src/extern_abi.rs b/compiler/rustc_abi/src/extern_abi.rs
index a4dc87247a08..2355c64cfc98 100644
--- a/compiler/rustc_abi/src/extern_abi.rs
+++ b/compiler/rustc_abi/src/extern_abi.rs
@@ -1,15 +1,20 @@
+use std::cmp::Ordering;
 use std::fmt;
+use std::hash::{Hash, Hasher};
+use std::str::FromStr;
 
 #[cfg(feature = "nightly")]
-use rustc_macros::{Decodable, Encodable, HashStable_Generic};
+use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableOrd};
+#[cfg(feature = "nightly")]
+use rustc_macros::{Decodable, Encodable};
 
 #[cfg(test)]
 mod tests;
 
 use ExternAbi as Abi;
 
-#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Debug)]
-#[cfg_attr(feature = "nightly", derive(HashStable_Generic, Encodable, Decodable))]
+#[derive(Clone, Copy, Debug)]
+#[cfg_attr(feature = "nightly", derive(Encodable, Decodable))]
 pub enum ExternAbi {
     // Some of the ABIs come first because every time we add a new ABI, we have to re-bless all the
     // hashing tests. These are used in many places, so giving them stable values reduces test
@@ -69,7 +74,123 @@ pub enum ExternAbi {
     RiscvInterruptS,
 }
 
-impl Abi {
+macro_rules! abi_impls {
+    ($e_name:ident = {
+        $($variant:ident $({ unwind: $uw:literal })? =><= $tok:literal,)*
+    }) => {
+        impl $e_name {
+            pub const ALL_VARIANTS: &[Self] = &[
+                $($e_name::$variant $({ unwind: $uw })*,)*
+            ];
+            pub const fn as_str(&self) -> &'static str {
+                match self {
+                    $($e_name::$variant $( { unwind: $uw } )* => $tok,)*
+                }
+            }
+        }
+
+        impl ::core::str::FromStr for $e_name {
+            type Err = AbiFromStrErr;
+            fn from_str(s: &str) -> Result<$e_name, Self::Err> {
+                match s {
+                    $($tok => Ok($e_name::$variant $({ unwind: $uw })*),)*
+                    _ => Err(AbiFromStrErr::Unknown),
+                }
+            }
+        }
+    }
+}
+
+pub enum AbiFromStrErr {
+    Unknown,
+}
+
+abi_impls! {
+    ExternAbi = {
+            C { unwind: false } =><= "C",
+            CCmseNonSecureCall =><= "C-cmse-nonsecure-call",
+            CCmseNonSecureEntry =><= "C-cmse-nonsecure-entry",
+            C { unwind: true } =><= "C-unwind",
+            Rust =><= "Rust",
+            Aapcs { unwind: false } =><= "aapcs",
+            Aapcs { unwind: true } =><= "aapcs-unwind",
+            AvrInterrupt =><= "avr-interrupt",
+            AvrNonBlockingInterrupt =><= "avr-non-blocking-interrupt",
+            Cdecl { unwind: false } =><= "cdecl",
+            Cdecl { unwind: true } =><= "cdecl-unwind",
+            EfiApi =><= "efiapi",
+            Fastcall { unwind: false } =><= "fastcall",
+            Fastcall { unwind: true } =><= "fastcall-unwind",
+            GpuKernel =><= "gpu-kernel",
+            Msp430Interrupt =><= "msp430-interrupt",
+            PtxKernel =><= "ptx-kernel",
+            RiscvInterruptM =><= "riscv-interrupt-m",
+            RiscvInterruptS =><= "riscv-interrupt-s",
+            RustCall =><= "rust-call",
+            RustCold =><= "rust-cold",
+            RustIntrinsic =><= "rust-intrinsic",
+            Stdcall { unwind: false } =><= "stdcall",
+            Stdcall { unwind: true } =><= "stdcall-unwind",
+            System { unwind: false } =><= "system",
+            System { unwind: true } =><= "system-unwind",
+            SysV64 { unwind: false } =><= "sysv64",
+            SysV64 { unwind: true } =><= "sysv64-unwind",
+            Thiscall { unwind: false } =><= "thiscall",
+            Thiscall { unwind: true } =><= "thiscall-unwind",
+            Unadjusted =><= "unadjusted",
+            Vectorcall { unwind: false } =><= "vectorcall",
+            Vectorcall { unwind: true } =><= "vectorcall-unwind",
+            Win64 { unwind: false } =><= "win64",
+            Win64 { unwind: true } =><= "win64-unwind",
+            X86Interrupt =><= "x86-interrupt",
+    }
+}
+
+impl Ord for ExternAbi {
+    fn cmp(&self, rhs: &Self) -> Ordering {
+        self.as_str().cmp(rhs.as_str())
+    }
+}
+
+impl PartialOrd for ExternAbi {
+    fn partial_cmp(&self, rhs: &Self) -> Option {
+        Some(self.cmp(rhs))
+    }
+}
+
+impl PartialEq for ExternAbi {
+    fn eq(&self, rhs: &Self) -> bool {
+        self.cmp(rhs) == Ordering::Equal
+    }
+}
+
+impl Eq for ExternAbi {}
+
+impl Hash for ExternAbi {
+    fn hash(&self, state: &mut H) {
+        self.as_str().hash(state);
+        // double-assurance of a prefix breaker
+        u32::from_be_bytes(*b"ABI\0").hash(state);
+    }
+}
+
+#[cfg(feature = "nightly")]
+impl HashStable for ExternAbi {
+    #[inline]
+    fn hash_stable(&self, _: &mut C, hasher: &mut StableHasher) {
+        Hash::hash(self, hasher);
+    }
+}
+
+#[cfg(feature = "nightly")]
+impl StableOrd for ExternAbi {
+    const CAN_USE_UNSTABLE_SORT: bool = true;
+
+    // because each ABI is hashed like a string, there is no possible instability
+    const THIS_IMPLEMENTATION_HAS_BEEN_TRIPLE_CHECKED: () = ();
+}
+
+impl ExternAbi {
     pub fn supports_varargs(self) -> bool {
         // * C and Cdecl obviously support varargs.
         // * C can be based on Aapcs, SysV64 or Win64, so they must support varargs.
@@ -145,15 +266,11 @@ pub const AbiDatas: &[AbiData] = &[
 pub struct AbiUnsupported {}
 /// Returns the ABI with the given name (if any).
 pub fn lookup(name: &str) -> Result {
-    AbiDatas
-        .iter()
-        .find(|abi_data| name == abi_data.name)
-        .map(|&x| x.abi)
-        .ok_or_else(|| AbiUnsupported {})
+    ExternAbi::from_str(name).map_err(|_| AbiUnsupported {})
 }
 
 pub fn all_names() -> Vec<&'static str> {
-    AbiDatas.iter().map(|d| d.name).collect()
+    ExternAbi::ALL_VARIANTS.iter().map(|abi| abi.as_str()).collect()
 }
 
 impl Abi {
@@ -229,8 +346,8 @@ impl Abi {
     }
 }
 
-impl fmt::Display for Abi {
+impl fmt::Display for ExternAbi {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        write!(f, "\"{}\"", self.name())
+        write!(f, "\"{}\"", self.as_str())
     }
 }
diff --git a/compiler/rustc_abi/src/extern_abi/tests.rs b/compiler/rustc_abi/src/extern_abi/tests.rs
index 72c0f183d50c..44ea58d47c25 100644
--- a/compiler/rustc_abi/src/extern_abi/tests.rs
+++ b/compiler/rustc_abi/src/extern_abi/tests.rs
@@ -27,3 +27,11 @@ fn indices_are_correct() {
         assert_eq!(i, abi_data.abi.index());
     }
 }
+
+#[test]
+fn guarantee_lexicographic_ordering() {
+    let abis = ExternAbi::ALL_VARIANTS;
+    let mut sorted_abis = abis.to_vec();
+    sorted_abis.sort_unstable();
+    assert_eq!(abis, sorted_abis);
+}
diff --git a/compiler/rustc_ast_lowering/src/stability.rs b/compiler/rustc_ast_lowering/src/stability.rs
index e7c166850a46..14410600fab8 100644
--- a/compiler/rustc_ast_lowering/src/stability.rs
+++ b/compiler/rustc_ast_lowering/src/stability.rs
@@ -54,17 +54,12 @@ enum GateReason {
 impl fmt::Display for UnstableAbi {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         let Self { abi, .. } = self;
-        let name = abi.to_string();
-        let name = name.trim_matches('"');
         match self.explain {
             GateReason::Experimental => {
-                write!(f, r#"the extern "{name}" ABI is experimental and subject to change"#)
+                write!(f, "the extern {abi} ABI is experimental and subject to change")
             }
             GateReason::ImplDetail => {
-                write!(
-                    f,
-                    r#"the extern "{name}" ABI is an implementation detail and perma-unstable"#
-                )
+                write!(f, "the extern {abi} ABI is an implementation detail and perma-unstable")
             }
         }
     }
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs
index 6efd11a8c3c0..2bcc33241dfa 100644
--- a/compiler/rustc_driver_impl/src/lib.rs
+++ b/compiler/rustc_driver_impl/src/lib.rs
@@ -747,8 +747,7 @@ fn print_crate_info(
                 }
             }
             CallingConventions => {
-                let mut calling_conventions = rustc_abi::all_names();
-                calling_conventions.sort_unstable();
+                let calling_conventions = rustc_abi::all_names();
                 println_info!("{}", calling_conventions.join("\n"));
             }
             RelocationModels
diff --git a/tests/ui/symbol-names/basic.legacy.stderr b/tests/ui/symbol-names/basic.legacy.stderr
index 2f26c0cf0d3b..167262dcf06b 100644
--- a/tests/ui/symbol-names/basic.legacy.stderr
+++ b/tests/ui/symbol-names/basic.legacy.stderr
@@ -1,10 +1,10 @@
-error: symbol-name(_ZN5basic4main17h144191e1523a280eE)
+error: symbol-name(_ZN5basic4main17hc88b9d80a69d119aE)
   --> $DIR/basic.rs:8:1
    |
 LL | #[rustc_symbol_name]
    | ^^^^^^^^^^^^^^^^^^^^
 
-error: demangling(basic::main::h144191e1523a280e)
+error: demangling(basic::main::hc88b9d80a69d119a)
   --> $DIR/basic.rs:8:1
    |
 LL | #[rustc_symbol_name]
diff --git a/tests/ui/symbol-names/issue-60925.legacy.stderr b/tests/ui/symbol-names/issue-60925.legacy.stderr
index cc79cc8b5169..4e17bdc45777 100644
--- a/tests/ui/symbol-names/issue-60925.legacy.stderr
+++ b/tests/ui/symbol-names/issue-60925.legacy.stderr
@@ -1,10 +1,10 @@
-error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17h71f988fda3b6b180E)
+error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17hbddb77d6f71afb32E)
   --> $DIR/issue-60925.rs:21:9
    |
 LL |         #[rustc_symbol_name]
    |         ^^^^^^^^^^^^^^^^^^^^
 
-error: demangling(issue_60925::foo::Foo::foo::h71f988fda3b6b180)
+error: demangling(issue_60925::foo::Foo::foo::hbddb77d6f71afb32)
   --> $DIR/issue-60925.rs:21:9
    |
 LL |         #[rustc_symbol_name]

From edff4fe2cc7613a80624a768c0138671bcf97f7d Mon Sep 17 00:00:00 2001
From: Jubilee Young 
Date: Mon, 10 Feb 2025 16:41:02 -0800
Subject: [PATCH 117/128] compiler: remove AbiDatas

These were a way to ensure hashes were stable over time for ExternAbi,
but simply hashing the strings is more stable in the face of changes.
As a result, we can do away with them.
---
 compiler/rustc_abi/src/extern_abi.rs         | 116 +------------------
 compiler/rustc_abi/src/extern_abi/tests.rs   |  11 +-
 compiler/rustc_abi/src/lib.rs                |  13 +--
 compiler/rustc_ast_lowering/src/stability.rs |   8 +-
 compiler/rustc_symbol_mangling/src/v0.rs     |   2 +-
 5 files changed, 14 insertions(+), 136 deletions(-)

diff --git a/compiler/rustc_abi/src/extern_abi.rs b/compiler/rustc_abi/src/extern_abi.rs
index 2355c64cfc98..9ac3057e413a 100644
--- a/compiler/rustc_abi/src/extern_abi.rs
+++ b/compiler/rustc_abi/src/extern_abi.rs
@@ -214,54 +214,6 @@ impl ExternAbi {
     }
 }
 
-#[derive(Copy, Clone)]
-pub struct AbiData {
-    pub abi: Abi,
-
-    /// Name of this ABI as we like it called.
-    pub name: &'static str,
-}
-
-#[allow(non_upper_case_globals)]
-pub const AbiDatas: &[AbiData] = &[
-    AbiData { abi: Abi::Rust, name: "Rust" },
-    AbiData { abi: Abi::C { unwind: false }, name: "C" },
-    AbiData { abi: Abi::C { unwind: true }, name: "C-unwind" },
-    AbiData { abi: Abi::Cdecl { unwind: false }, name: "cdecl" },
-    AbiData { abi: Abi::Cdecl { unwind: true }, name: "cdecl-unwind" },
-    AbiData { abi: Abi::Stdcall { unwind: false }, name: "stdcall" },
-    AbiData { abi: Abi::Stdcall { unwind: true }, name: "stdcall-unwind" },
-    AbiData { abi: Abi::Fastcall { unwind: false }, name: "fastcall" },
-    AbiData { abi: Abi::Fastcall { unwind: true }, name: "fastcall-unwind" },
-    AbiData { abi: Abi::Vectorcall { unwind: false }, name: "vectorcall" },
-    AbiData { abi: Abi::Vectorcall { unwind: true }, name: "vectorcall-unwind" },
-    AbiData { abi: Abi::Thiscall { unwind: false }, name: "thiscall" },
-    AbiData { abi: Abi::Thiscall { unwind: true }, name: "thiscall-unwind" },
-    AbiData { abi: Abi::Aapcs { unwind: false }, name: "aapcs" },
-    AbiData { abi: Abi::Aapcs { unwind: true }, name: "aapcs-unwind" },
-    AbiData { abi: Abi::Win64 { unwind: false }, name: "win64" },
-    AbiData { abi: Abi::Win64 { unwind: true }, name: "win64-unwind" },
-    AbiData { abi: Abi::SysV64 { unwind: false }, name: "sysv64" },
-    AbiData { abi: Abi::SysV64 { unwind: true }, name: "sysv64-unwind" },
-    AbiData { abi: Abi::PtxKernel, name: "ptx-kernel" },
-    AbiData { abi: Abi::Msp430Interrupt, name: "msp430-interrupt" },
-    AbiData { abi: Abi::X86Interrupt, name: "x86-interrupt" },
-    AbiData { abi: Abi::GpuKernel, name: "gpu-kernel" },
-    AbiData { abi: Abi::EfiApi, name: "efiapi" },
-    AbiData { abi: Abi::AvrInterrupt, name: "avr-interrupt" },
-    AbiData { abi: Abi::AvrNonBlockingInterrupt, name: "avr-non-blocking-interrupt" },
-    AbiData { abi: Abi::CCmseNonSecureCall, name: "C-cmse-nonsecure-call" },
-    AbiData { abi: Abi::CCmseNonSecureEntry, name: "C-cmse-nonsecure-entry" },
-    AbiData { abi: Abi::System { unwind: false }, name: "system" },
-    AbiData { abi: Abi::System { unwind: true }, name: "system-unwind" },
-    AbiData { abi: Abi::RustIntrinsic, name: "rust-intrinsic" },
-    AbiData { abi: Abi::RustCall, name: "rust-call" },
-    AbiData { abi: Abi::Unadjusted, name: "unadjusted" },
-    AbiData { abi: Abi::RustCold, name: "rust-cold" },
-    AbiData { abi: Abi::RiscvInterruptM, name: "riscv-interrupt-m" },
-    AbiData { abi: Abi::RiscvInterruptS, name: "riscv-interrupt-s" },
-];
-
 #[derive(Copy, Clone, Debug)]
 pub struct AbiUnsupported {}
 /// Returns the ABI with the given name (if any).
@@ -273,76 +225,12 @@ pub fn all_names() -> Vec<&'static str> {
     ExternAbi::ALL_VARIANTS.iter().map(|abi| abi.as_str()).collect()
 }
 
-impl Abi {
+impl ExternAbi {
     /// Default ABI chosen for `extern fn` declarations without an explicit ABI.
     pub const FALLBACK: Abi = Abi::C { unwind: false };
 
-    #[inline]
-    pub fn index(self) -> usize {
-        // N.B., this ordering MUST match the AbiDatas array above.
-        // (This is ensured by the test indices_are_correct().)
-        use Abi::*;
-        let i = match self {
-            // Cross-platform ABIs
-            Rust => 0,
-            C { unwind: false } => 1,
-            C { unwind: true } => 2,
-            // Platform-specific ABIs
-            Cdecl { unwind: false } => 3,
-            Cdecl { unwind: true } => 4,
-            Stdcall { unwind: false } => 5,
-            Stdcall { unwind: true } => 6,
-            Fastcall { unwind: false } => 7,
-            Fastcall { unwind: true } => 8,
-            Vectorcall { unwind: false } => 9,
-            Vectorcall { unwind: true } => 10,
-            Thiscall { unwind: false } => 11,
-            Thiscall { unwind: true } => 12,
-            Aapcs { unwind: false } => 13,
-            Aapcs { unwind: true } => 14,
-            Win64 { unwind: false } => 15,
-            Win64 { unwind: true } => 16,
-            SysV64 { unwind: false } => 17,
-            SysV64 { unwind: true } => 18,
-            PtxKernel => 19,
-            Msp430Interrupt => 20,
-            X86Interrupt => 21,
-            GpuKernel => 22,
-            EfiApi => 23,
-            AvrInterrupt => 24,
-            AvrNonBlockingInterrupt => 25,
-            CCmseNonSecureCall => 26,
-            CCmseNonSecureEntry => 27,
-            // Cross-platform ABIs
-            System { unwind: false } => 28,
-            System { unwind: true } => 29,
-            RustIntrinsic => 30,
-            RustCall => 31,
-            Unadjusted => 32,
-            RustCold => 33,
-            RiscvInterruptM => 34,
-            RiscvInterruptS => 35,
-        };
-        debug_assert!(
-            AbiDatas
-                .iter()
-                .enumerate()
-                .find(|(_, AbiData { abi, .. })| *abi == self)
-                .map(|(index, _)| index)
-                .expect("abi variant has associated data")
-                == i,
-            "Abi index did not match `AbiDatas` ordering"
-        );
-        i
-    }
-
-    #[inline]
-    pub fn data(self) -> &'static AbiData {
-        &AbiDatas[self.index()]
-    }
-
     pub fn name(self) -> &'static str {
-        self.data().name
+        self.as_str()
     }
 }
 
diff --git a/compiler/rustc_abi/src/extern_abi/tests.rs b/compiler/rustc_abi/src/extern_abi/tests.rs
index 44ea58d47c25..5cc186aecb25 100644
--- a/compiler/rustc_abi/src/extern_abi/tests.rs
+++ b/compiler/rustc_abi/src/extern_abi/tests.rs
@@ -6,13 +6,13 @@ use super::*;
 #[test]
 fn lookup_Rust() {
     let abi = lookup("Rust");
-    assert!(abi.is_ok() && abi.unwrap().data().name == "Rust");
+    assert!(abi.is_ok() && abi.unwrap().as_str() == "Rust");
 }
 
 #[test]
 fn lookup_cdecl() {
     let abi = lookup("cdecl");
-    assert!(abi.is_ok() && abi.unwrap().data().name == "cdecl");
+    assert!(abi.is_ok() && abi.unwrap().as_str() == "cdecl");
 }
 
 #[test]
@@ -21,13 +21,6 @@ fn lookup_baz() {
     assert_matches!(abi, Err(AbiUnsupported {}));
 }
 
-#[test]
-fn indices_are_correct() {
-    for (i, abi_data) in AbiDatas.iter().enumerate() {
-        assert_eq!(i, abi_data.abi.index());
-    }
-}
-
 #[test]
 fn guarantee_lexicographic_ordering() {
     let abis = ExternAbi::ALL_VARIANTS;
diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs
index 1e4685dc2a39..6724b4211436 100644
--- a/compiler/rustc_abi/src/lib.rs
+++ b/compiler/rustc_abi/src/lib.rs
@@ -62,7 +62,7 @@ mod tests;
 mod extern_abi;
 
 pub use callconv::{Heterogeneous, HomogeneousAggregate, Reg, RegKind};
-pub use extern_abi::{AbiDatas, AbiUnsupported, ExternAbi, all_names, lookup};
+pub use extern_abi::{AbiUnsupported, ExternAbi, all_names, lookup};
 #[cfg(feature = "nightly")]
 pub use layout::{FIRST_VARIANT, FieldIdx, Layout, TyAbiInterface, TyAndLayout, VariantIdx};
 pub use layout::{LayoutCalculator, LayoutCalculatorError};
@@ -1178,13 +1178,10 @@ impl Scalar {
     #[inline]
     pub fn is_bool(&self) -> bool {
         use Integer::*;
-        matches!(
-            self,
-            Scalar::Initialized {
-                value: Primitive::Int(I8, false),
-                valid_range: WrappingRange { start: 0, end: 1 }
-            }
-        )
+        matches!(self, Scalar::Initialized {
+            value: Primitive::Int(I8, false),
+            valid_range: WrappingRange { start: 0, end: 1 }
+        })
     }
 
     /// Get the primitive representation of this type, ignoring the valid range and whether the
diff --git a/compiler/rustc_ast_lowering/src/stability.rs b/compiler/rustc_ast_lowering/src/stability.rs
index 14410600fab8..a2004bbb39f0 100644
--- a/compiler/rustc_ast_lowering/src/stability.rs
+++ b/compiler/rustc_ast_lowering/src/stability.rs
@@ -8,10 +8,10 @@ use rustc_span::symbol::sym;
 use rustc_span::{Span, Symbol};
 
 pub(crate) fn enabled_names(features: &rustc_feature::Features, span: Span) -> Vec<&'static str> {
-    rustc_abi::AbiDatas
-        .iter()
-        .filter(|data| extern_abi_enabled(features, span, data.abi).is_ok())
-        .map(|d| d.name)
+    ExternAbi::ALL_VARIANTS
+        .into_iter()
+        .filter(|abi| extern_abi_enabled(features, span, **abi).is_ok())
+        .map(|abi| abi.as_str())
         .collect()
 }
 
diff --git a/compiler/rustc_symbol_mangling/src/v0.rs b/compiler/rustc_symbol_mangling/src/v0.rs
index 0ac6f17b97bd..4fafd1ac3509 100644
--- a/compiler/rustc_symbol_mangling/src/v0.rs
+++ b/compiler/rustc_symbol_mangling/src/v0.rs
@@ -480,7 +480,7 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
                         ExternAbi::C { unwind: false } => cx.push("KC"),
                         abi => {
                             cx.push("K");
-                            let name = abi.name();
+                            let name = abi.as_str();
                             if name.contains('-') {
                                 cx.push_ident(&name.replace('-', "_"));
                             } else {

From f8570e8ac504324031c3ab41393ffb6a199b0479 Mon Sep 17 00:00:00 2001
From: Jubilee Young 
Date: Mon, 10 Feb 2025 23:03:10 -0800
Subject: [PATCH 118/128] compiler: remove rustc_abi::lookup and AbiUnsupported

These can be entirely replaced by the FromStr implementation.
---
 compiler/rustc_abi/src/extern_abi.rs       |  9 +--------
 compiler/rustc_abi/src/extern_abi/tests.rs |  9 +++++----
 compiler/rustc_abi/src/lib.rs              | 13 ++++++++-----
 compiler/rustc_ast_lowering/src/item.rs    |  2 +-
 4 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/compiler/rustc_abi/src/extern_abi.rs b/compiler/rustc_abi/src/extern_abi.rs
index 9ac3057e413a..c29db522511d 100644
--- a/compiler/rustc_abi/src/extern_abi.rs
+++ b/compiler/rustc_abi/src/extern_abi.rs
@@ -1,7 +1,6 @@
 use std::cmp::Ordering;
 use std::fmt;
 use std::hash::{Hash, Hasher};
-use std::str::FromStr;
 
 #[cfg(feature = "nightly")]
 use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableOrd};
@@ -101,6 +100,7 @@ macro_rules! abi_impls {
     }
 }
 
+#[derive(Debug)]
 pub enum AbiFromStrErr {
     Unknown,
 }
@@ -214,13 +214,6 @@ impl ExternAbi {
     }
 }
 
-#[derive(Copy, Clone, Debug)]
-pub struct AbiUnsupported {}
-/// Returns the ABI with the given name (if any).
-pub fn lookup(name: &str) -> Result {
-    ExternAbi::from_str(name).map_err(|_| AbiUnsupported {})
-}
-
 pub fn all_names() -> Vec<&'static str> {
     ExternAbi::ALL_VARIANTS.iter().map(|abi| abi.as_str()).collect()
 }
diff --git a/compiler/rustc_abi/src/extern_abi/tests.rs b/compiler/rustc_abi/src/extern_abi/tests.rs
index 5cc186aecb25..fc546a6570f0 100644
--- a/compiler/rustc_abi/src/extern_abi/tests.rs
+++ b/compiler/rustc_abi/src/extern_abi/tests.rs
@@ -1,24 +1,25 @@
 use std::assert_matches::assert_matches;
+use std::str::FromStr;
 
 use super::*;
 
 #[allow(non_snake_case)]
 #[test]
 fn lookup_Rust() {
-    let abi = lookup("Rust");
+    let abi = ExternAbi::from_str("Rust");
     assert!(abi.is_ok() && abi.unwrap().as_str() == "Rust");
 }
 
 #[test]
 fn lookup_cdecl() {
-    let abi = lookup("cdecl");
+    let abi = ExternAbi::from_str("cdecl");
     assert!(abi.is_ok() && abi.unwrap().as_str() == "cdecl");
 }
 
 #[test]
 fn lookup_baz() {
-    let abi = lookup("baz");
-    assert_matches!(abi, Err(AbiUnsupported {}));
+    let abi = ExternAbi::from_str("baz");
+    assert_matches!(abi, Err(AbiFromStrErr::Unknown));
 }
 
 #[test]
diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs
index 6724b4211436..da1c706d67cc 100644
--- a/compiler/rustc_abi/src/lib.rs
+++ b/compiler/rustc_abi/src/lib.rs
@@ -62,7 +62,7 @@ mod tests;
 mod extern_abi;
 
 pub use callconv::{Heterogeneous, HomogeneousAggregate, Reg, RegKind};
-pub use extern_abi::{AbiUnsupported, ExternAbi, all_names, lookup};
+pub use extern_abi::{ExternAbi, all_names};
 #[cfg(feature = "nightly")]
 pub use layout::{FIRST_VARIANT, FieldIdx, Layout, TyAbiInterface, TyAndLayout, VariantIdx};
 pub use layout::{LayoutCalculator, LayoutCalculatorError};
@@ -1178,10 +1178,13 @@ impl Scalar {
     #[inline]
     pub fn is_bool(&self) -> bool {
         use Integer::*;
-        matches!(self, Scalar::Initialized {
-            value: Primitive::Int(I8, false),
-            valid_range: WrappingRange { start: 0, end: 1 }
-        })
+        matches!(
+            self,
+            Scalar::Initialized {
+                value: Primitive::Int(I8, false),
+                valid_range: WrappingRange { start: 0, end: 1 }
+            }
+        )
     }
 
     /// Get the primitive representation of this type, ignoring the valid range and whether the
diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs
index 85642c8ccb56..bc2db4154698 100644
--- a/compiler/rustc_ast_lowering/src/item.rs
+++ b/compiler/rustc_ast_lowering/src/item.rs
@@ -1475,7 +1475,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
 
     pub(super) fn lower_abi(&mut self, abi_str: StrLit) -> ExternAbi {
         let ast::StrLit { symbol_unescaped, span, .. } = abi_str;
-        let extern_abi = rustc_abi::lookup(symbol_unescaped.as_str()).unwrap_or_else(|_| {
+        let extern_abi = symbol_unescaped.as_str().parse().unwrap_or_else(|_| {
             self.error_on_invalid_abi(abi_str);
             ExternAbi::Rust
         });

From 7564f3c8e638a5e78b176000c38c7a2504f2e392 Mon Sep 17 00:00:00 2001
From: Jubilee Young 
Date: Tue, 11 Feb 2025 21:54:35 -0800
Subject: [PATCH 119/128] compiler: Make middle errors `pub(crate)` and bury
 some dead code

---
 compiler/rustc_middle/messages.ftl |  3 ---
 compiler/rustc_middle/src/error.rs | 28 ++++++++++------------------
 2 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/compiler/rustc_middle/messages.ftl b/compiler/rustc_middle/messages.ftl
index ded1c5805727..09c16222be19 100644
--- a/compiler/rustc_middle/messages.ftl
+++ b/compiler/rustc_middle/messages.ftl
@@ -1,6 +1,3 @@
-middle_adjust_for_foreign_abi_error =
-    target architecture {$arch} does not support `extern {$abi}` ABI
-
 middle_assert_async_resume_after_panic = `async fn` resumed after panicking
 
 middle_assert_async_resume_after_return = `async fn` resumed after completion
diff --git a/compiler/rustc_middle/src/error.rs b/compiler/rustc_middle/src/error.rs
index b30d3a950c6a..91b18295b43b 100644
--- a/compiler/rustc_middle/src/error.rs
+++ b/compiler/rustc_middle/src/error.rs
@@ -11,7 +11,7 @@ use crate::ty::Ty;
 #[derive(Diagnostic)]
 #[diag(middle_drop_check_overflow, code = E0320)]
 #[note]
-pub struct DropCheckOverflow<'tcx> {
+pub(crate) struct DropCheckOverflow<'tcx> {
     #[primary_span]
     pub span: Span,
     pub ty: Ty<'tcx>,
@@ -20,14 +20,14 @@ pub struct DropCheckOverflow<'tcx> {
 
 #[derive(Diagnostic)]
 #[diag(middle_failed_writing_file)]
-pub struct FailedWritingFile<'a> {
+pub(crate) struct FailedWritingFile<'a> {
     pub path: &'a Path,
     pub error: io::Error,
 }
 
 #[derive(Diagnostic)]
 #[diag(middle_opaque_hidden_type_mismatch)]
-pub struct OpaqueHiddenTypeMismatch<'tcx> {
+pub(crate) struct OpaqueHiddenTypeMismatch<'tcx> {
     pub self_ty: Ty<'tcx>,
     pub other_ty: Ty<'tcx>,
     #[primary_span]
@@ -37,12 +37,14 @@ pub struct OpaqueHiddenTypeMismatch<'tcx> {
     pub sub: TypeMismatchReason,
 }
 
+// FIXME(autodiff): I should get used somewhere
 #[derive(Diagnostic)]
 #[diag(middle_unsupported_union)]
 pub struct UnsupportedUnion {
     pub ty_name: String,
 }
 
+// FIXME(autodiff): I should get used somewhere
 #[derive(Diagnostic)]
 #[diag(middle_autodiff_unsafe_inner_const_ref)]
 pub struct AutodiffUnsafeInnerConstRef {
@@ -67,7 +69,7 @@ pub enum TypeMismatchReason {
 
 #[derive(Diagnostic)]
 #[diag(middle_limit_invalid)]
-pub struct LimitInvalid<'a> {
+pub(crate) struct LimitInvalid<'a> {
     #[primary_span]
     pub span: Span,
     #[label]
@@ -78,14 +80,14 @@ pub struct LimitInvalid<'a> {
 #[derive(Diagnostic)]
 #[diag(middle_recursion_limit_reached)]
 #[help]
-pub struct RecursionLimitReached<'tcx> {
+pub(crate) struct RecursionLimitReached<'tcx> {
     pub ty: Ty<'tcx>,
     pub suggested_limit: rustc_session::Limit,
 }
 
 #[derive(Diagnostic)]
 #[diag(middle_const_eval_non_int)]
-pub struct ConstEvalNonIntError {
+pub(crate) struct ConstEvalNonIntError {
     #[primary_span]
     pub span: Span,
 }
@@ -159,27 +161,17 @@ pub enum LayoutError<'tcx> {
     ReferencesError,
 }
 
-#[derive(Diagnostic)]
-#[diag(middle_adjust_for_foreign_abi_error)]
-pub struct UnsupportedFnAbi {
-    pub arch: Symbol,
-    pub abi: &'static str,
-}
-
 #[derive(Diagnostic)]
 #[diag(middle_erroneous_constant)]
-pub struct ErroneousConstant {
+pub(crate) struct ErroneousConstant {
     #[primary_span]
     pub span: Span,
 }
 
-/// Used by `rustc_const_eval`
-pub use crate::fluent_generated::middle_adjust_for_foreign_abi_error;
-
 #[derive(Diagnostic)]
 #[diag(middle_type_length_limit)]
 #[help(middle_consider_type_length_limit)]
-pub struct TypeLengthLimit {
+pub(crate) struct TypeLengthLimit {
     #[primary_span]
     pub span: Span,
     pub shrunk: String,

From 2e2afff50cd96939627965efb1198683abcfaa2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= 
Date: Wed, 12 Feb 2025 09:51:14 +0100
Subject: [PATCH 120/128] Put kobzol back to review rotation

---
 triagebot.toml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/triagebot.toml b/triagebot.toml
index 169a6121615a..db86b6debbfe 100644
--- a/triagebot.toml
+++ b/triagebot.toml
@@ -1043,7 +1043,6 @@ users_on_vacation = [
     "jyn514",
     "nnethercote",
     "workingjubilee",
-    "kobzol",
 ]
 
 [[assign.warn_non_default_branch.exceptions]]

From 0ca8353651e6e100224001697f9bb93f0380b037 Mon Sep 17 00:00:00 2001
From: eyelash 
Date: Wed, 12 Feb 2025 09:54:33 +0100
Subject: [PATCH 121/128] `f16` is half-precision

---
 library/std/src/f16.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/library/std/src/f16.rs b/library/std/src/f16.rs
index cc523c93b4de..f6a553b1d0fa 100644
--- a/library/std/src/f16.rs
+++ b/library/std/src/f16.rs
@@ -1,4 +1,4 @@
-//! Constants for the `f16` double-precision floating point type.
+//! Constants for the `f16` half-precision floating point type.
 //!
 //! *[See also the `f16` primitive type](primitive@f16).*
 //!

From 4f37b458fc729c1f8b992cdda9f62f6b944b4106 Mon Sep 17 00:00:00 2001
From: eyelash 
Date: Wed, 12 Feb 2025 09:55:45 +0100
Subject: [PATCH 122/128] `f128` is quadruple-precision

---
 library/std/src/f128.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/library/std/src/f128.rs b/library/std/src/f128.rs
index 89612fa74755..cff0bf4ccf4c 100644
--- a/library/std/src/f128.rs
+++ b/library/std/src/f128.rs
@@ -1,4 +1,4 @@
-//! Constants for the `f128` double-precision floating point type.
+//! Constants for the `f128` quadruple-precision floating point type.
 //!
 //! *[See also the `f128` primitive type](primitive@f128).*
 //!

From 8a70219a38487a59de2449e920302d900506118d Mon Sep 17 00:00:00 2001
From: onur-ozkan 
Date: Wed, 12 Feb 2025 09:16:47 +0000
Subject: [PATCH 123/128] use cc archiver as default in `cc2ar`

We should remove entire `cc2ar` but `cc` doesn't seem to cover all the conditions that `cc2ar` handles.
For now, I replaced the `else` logic only, which is a bit hacky and unstable.

Signed-off-by: onur-ozkan 
---
 src/bootstrap/src/utils/cc_detect.rs | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/src/bootstrap/src/utils/cc_detect.rs b/src/bootstrap/src/utils/cc_detect.rs
index f6afd50afcef..45797c1276c5 100644
--- a/src/bootstrap/src/utils/cc_detect.rs
+++ b/src/bootstrap/src/utils/cc_detect.rs
@@ -29,11 +29,8 @@ use crate::core::config::TargetSelection;
 use crate::utils::exec::{BootstrapCommand, command};
 use crate::{Build, CLang, GitRepo};
 
-// The `cc` crate doesn't provide a way to obtain a path to the detected archiver,
-// so use some simplified logic here. First we respect the environment variable `AR`, then
-// try to infer the archiver path from the C compiler path.
-// In the future this logic should be replaced by calling into the `cc` crate.
-fn cc2ar(cc: &Path, target: TargetSelection) -> Option {
+/// FIXME(onur-ozkan): This logic should be replaced by calling into the `cc` crate.
+fn cc2ar(cc: &Path, target: TargetSelection, default_ar: PathBuf) -> Option {
     if let Some(ar) = env::var_os(format!("AR_{}", target.triple.replace('-', "_"))) {
         Some(PathBuf::from(ar))
     } else if let Some(ar) = env::var_os("AR") {
@@ -57,16 +54,7 @@ fn cc2ar(cc: &Path, target: TargetSelection) -> Option {
     } else if target.contains("android") || target.contains("-wasi") {
         Some(cc.parent().unwrap().join(PathBuf::from("llvm-ar")))
     } else {
-        let parent = cc.parent().unwrap();
-        let file = cc.file_name().unwrap().to_str().unwrap();
-        for suffix in &["gcc", "cc", "clang"] {
-            if let Some(idx) = file.rfind(suffix) {
-                let mut file = file[..idx].to_owned();
-                file.push_str("ar");
-                return Some(parent.join(&file));
-            }
-        }
-        Some(parent.join(file))
+        Some(default_ar)
     }
 }
 
@@ -138,7 +126,7 @@ pub fn find_target(build: &Build, target: TargetSelection) {
     let ar = if let ar @ Some(..) = config.and_then(|c| c.ar.clone()) {
         ar
     } else {
-        cc2ar(compiler.path(), target)
+        cc2ar(compiler.path(), target, PathBuf::from(cfg.get_archiver().get_program()))
     };
 
     build.cc.borrow_mut().insert(target, compiler.clone());

From d99d8c249d3c965ab8a006dfe10a46214395682d Mon Sep 17 00:00:00 2001
From: Yotam Ofek 
Date: Sun, 9 Feb 2025 18:24:52 +0000
Subject: [PATCH 124/128] =?UTF-8?q?Nuke=20`Buffer`=20abstraction=20from=20?=
 =?UTF-8?q?`librustdoc`=20=F0=9F=92=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/librustdoc/html/format.rs              | 123 +----
 src/librustdoc/html/highlight.rs           |  80 +--
 src/librustdoc/html/highlight/tests.rs     |  21 +-
 src/librustdoc/html/layout.rs              |  25 +-
 src/librustdoc/html/markdown.rs            |   5 +-
 src/librustdoc/html/render/context.rs      |  67 +--
 src/librustdoc/html/render/mod.rs          | 366 +++++++------
 src/librustdoc/html/render/print_item.rs   | 604 ++++++++++++---------
 src/librustdoc/html/render/sidebar.rs      |   3 +-
 src/librustdoc/html/render/tests.rs        |   6 +-
 src/librustdoc/html/render/write_shared.rs |  39 +-
 src/librustdoc/html/sources.rs             |  18 +-
 src/librustdoc/lib.rs                      |   1 +
 13 files changed, 710 insertions(+), 648 deletions(-)

diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index b6a73602a322..086a85aa616f 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -37,113 +37,8 @@ use crate::html::render::Context;
 use crate::joined::Joined as _;
 use crate::passes::collect_intra_doc_links::UrlFragment;
 
-pub(crate) trait Print {
-    fn print(self, buffer: &mut Buffer);
-}
-
-impl Print for F
-where
-    F: FnOnce(&mut Buffer),
-{
-    fn print(self, buffer: &mut Buffer) {
-        (self)(buffer)
-    }
-}
-
-impl Print for String {
-    fn print(self, buffer: &mut Buffer) {
-        buffer.write_str(&self);
-    }
-}
-
-impl Print for &'_ str {
-    fn print(self, buffer: &mut Buffer) {
-        buffer.write_str(self);
-    }
-}
-
-#[derive(Debug, Clone)]
-pub(crate) struct Buffer {
-    for_html: bool,
-    buffer: String,
-}
-
-impl core::fmt::Write for Buffer {
-    #[inline]
-    fn write_str(&mut self, s: &str) -> fmt::Result {
-        self.buffer.write_str(s)
-    }
-
-    #[inline]
-    fn write_char(&mut self, c: char) -> fmt::Result {
-        self.buffer.write_char(c)
-    }
-
-    #[inline]
-    fn write_fmt(&mut self, args: fmt::Arguments<'_>) -> fmt::Result {
-        self.buffer.write_fmt(args)
-    }
-}
-
-impl Buffer {
-    pub(crate) fn empty_from(v: &Buffer) -> Buffer {
-        Buffer { for_html: v.for_html, buffer: String::new() }
-    }
-
-    pub(crate) fn html() -> Buffer {
-        Buffer { for_html: true, buffer: String::new() }
-    }
-
-    pub(crate) fn new() -> Buffer {
-        Buffer { for_html: false, buffer: String::new() }
-    }
-
-    pub(crate) fn is_empty(&self) -> bool {
-        self.buffer.is_empty()
-    }
-
-    pub(crate) fn into_inner(self) -> String {
-        self.buffer
-    }
-
-    pub(crate) fn push(&mut self, c: char) {
-        self.buffer.push(c);
-    }
-
-    pub(crate) fn push_str(&mut self, s: &str) {
-        self.buffer.push_str(s);
-    }
-
-    pub(crate) fn push_buffer(&mut self, other: Buffer) {
-        self.buffer.push_str(&other.buffer);
-    }
-
-    // Intended for consumption by write! and writeln! (std::fmt) but without
-    // the fmt::Result return type imposed by fmt::Write (and avoiding the trait
-    // import).
-    pub(crate) fn write_str(&mut self, s: &str) {
-        self.buffer.push_str(s);
-    }
-
-    // Intended for consumption by write! and writeln! (std::fmt) but without
-    // the fmt::Result return type imposed by fmt::Write (and avoiding the trait
-    // import).
-    pub(crate) fn write_fmt(&mut self, v: fmt::Arguments<'_>) {
-        self.buffer.write_fmt(v).unwrap();
-    }
-
-    pub(crate) fn to_display(mut self, t: T) -> String {
-        t.print(&mut self);
-        self.into_inner()
-    }
-
-    pub(crate) fn reserve(&mut self, additional: usize) {
-        self.buffer.reserve(additional)
-    }
-
-    pub(crate) fn len(&self) -> usize {
-        self.buffer.len()
-    }
+pub(crate) fn write_str(s: &mut String, f: fmt::Arguments<'_>) {
+    s.write_fmt(f).unwrap();
 }
 
 pub(crate) fn print_generic_bounds<'a, 'tcx: 'a>(
@@ -772,7 +667,7 @@ pub(crate) fn link_tooltip(did: DefId, fragment: &Option, cx: &Cont
     else {
         return String::new();
     };
-    let mut buf = Buffer::new();
+    let mut buf = String::new();
     let fqp = if *shortty == ItemType::Primitive {
         // primitives are documented in a crate, but not actually part of it
         &fqp[fqp.len() - 1..]
@@ -780,19 +675,19 @@ pub(crate) fn link_tooltip(did: DefId, fragment: &Option, cx: &Cont
         fqp
     };
     if let &Some(UrlFragment::Item(id)) = fragment {
-        write!(buf, "{} ", cx.tcx().def_descr(id));
+        write_str(&mut buf, format_args!("{} ", cx.tcx().def_descr(id)));
         for component in fqp {
-            write!(buf, "{component}::");
+            write_str(&mut buf, format_args!("{component}::"));
         }
-        write!(buf, "{}", cx.tcx().item_name(id));
+        write_str(&mut buf, format_args!("{}", cx.tcx().item_name(id)));
     } else if !fqp.is_empty() {
         let mut fqp_it = fqp.iter();
-        write!(buf, "{shortty} {}", fqp_it.next().unwrap());
+        write_str(&mut buf, format_args!("{shortty} {}", fqp_it.next().unwrap()));
         for component in fqp_it {
-            write!(buf, "::{component}");
+            write_str(&mut buf, format_args!("::{component}"));
         }
     }
-    buf.into_inner()
+    buf
 }
 
 /// Used to render a [`clean::Path`].
diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs
index 15bf968e0fc7..ed4b97d36252 100644
--- a/src/librustdoc/html/highlight.rs
+++ b/src/librustdoc/html/highlight.rs
@@ -14,7 +14,7 @@ use rustc_span::edition::Edition;
 use rustc_span::symbol::Symbol;
 use rustc_span::{BytePos, DUMMY_SP, Span};
 
-use super::format::{self, Buffer};
+use super::format::{self, write_str};
 use crate::clean::PrimitiveType;
 use crate::html::escape::EscapeBodyText;
 use crate::html::render::{Context, LinkFromSrc};
@@ -48,7 +48,7 @@ pub(crate) enum Tooltip {
 /// Highlights `src` as an inline example, returning the HTML output.
 pub(crate) fn render_example_with_highlighting(
     src: &str,
-    out: &mut Buffer,
+    out: &mut String,
     tooltip: Tooltip,
     playground_button: Option<&str>,
     extra_classes: &[String],
@@ -59,61 +59,69 @@ pub(crate) fn render_example_with_highlighting(
 }
 
 fn write_header(
-    out: &mut Buffer,
+    out: &mut String,
     class: &str,
-    extra_content: Option,
+    extra_content: Option<&str>,
     tooltip: Tooltip,
     extra_classes: &[String],
 ) {
-    write!(
+    write_str(
         out,
-        "
", - match tooltip { - Tooltip::Ignore => " ignore", - Tooltip::CompileFail => " compile_fail", - Tooltip::ShouldPanic => " should_panic", - Tooltip::Edition(_) => " edition", - Tooltip::None => "", - }, + format_args!( + "
", + match tooltip { + Tooltip::Ignore => " ignore", + Tooltip::CompileFail => " compile_fail", + Tooltip::ShouldPanic => " should_panic", + Tooltip::Edition(_) => " edition", + Tooltip::None => "", + } + ), ); if tooltip != Tooltip::None { let edition_code; - write!( + write_str( out, - "", - match tooltip { - Tooltip::Ignore => "This example is not tested", - Tooltip::CompileFail => "This example deliberately fails to compile", - Tooltip::ShouldPanic => "This example panics", - Tooltip::Edition(edition) => { - edition_code = format!("This example runs with edition {edition}"); - &edition_code + format_args!( + "", + match tooltip { + Tooltip::Ignore => "This example is not tested", + Tooltip::CompileFail => "This example deliberately fails to compile", + Tooltip::ShouldPanic => "This example panics", + Tooltip::Edition(edition) => { + edition_code = format!("This example runs with edition {edition}"); + &edition_code + } + Tooltip::None => unreachable!(), } - Tooltip::None => unreachable!(), - }, + ), ); } if let Some(extra) = extra_content { - out.push_buffer(extra); + out.push_str(&extra); } if class.is_empty() { - write!( + write_str( out, - "
",
-            if extra_classes.is_empty() { "" } else { " " },
-            extra_classes.join(" "),
+            format_args!(
+                "
",
+                if extra_classes.is_empty() { "" } else { " " },
+                extra_classes.join(" ")
+            ),
         );
     } else {
-        write!(
+        write_str(
             out,
-            "
",
-            if extra_classes.is_empty() { "" } else { " " },
-            extra_classes.join(" "),
+            format_args!(
+                "
",
+                if extra_classes.is_empty() { "" } else { " " },
+                extra_classes.join(" ")
+            ),
         );
     }
-    write!(out, "");
+    write_str(out, format_args!(""));
 }
 
 /// Check if two `Class` can be merged together. In the following rules, "unclassified" means `None`
@@ -398,8 +406,8 @@ pub(super) fn write_code(
     });
 }
 
-fn write_footer(out: &mut Buffer, playground_button: Option<&str>) {
-    writeln!(out, "
{}
", playground_button.unwrap_or_default()); +fn write_footer(out: &mut String, playground_button: Option<&str>) { + write_str(out, format_args_nl!("
{}

= self.child.get(); + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-3702-2.stderr b/tests/ui/issues/issue-3702-2.stderr index 7ab6520a0cad..448263aafd44 100644 --- a/tests/ui/issues/issue-3702-2.stderr +++ b/tests/ui/issues/issue-3702-2.stderr @@ -16,12 +16,14 @@ LL | fn to_int(&self) -> isize { 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | Add::to_int(&self) + other.to_int() - | ~~~~~~~~~~~~~~~~~~ +LL - self.to_int() + other.to_int() +LL + Add::to_int(&self) + other.to_int() + | help: disambiguate the method for candidate #2 | -LL | ToPrimitive::to_int(&self) + other.to_int() - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - self.to_int() + other.to_int() +LL + ToPrimitive::to_int(&self) + other.to_int() + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-41652/issue-41652.stderr b/tests/ui/issues/issue-41652/issue-41652.stderr index a5a2fab2ede0..c8299f28d345 100644 --- a/tests/ui/issues/issue-41652/issue-41652.stderr +++ b/tests/ui/issues/issue-41652/issue-41652.stderr @@ -6,8 +6,9 @@ LL | 3.f() | help: you must specify a concrete type for this numeric value, like `i32` | -LL | 3_i32.f() - | ~~~~~ +LL - 3.f() +LL + 3_i32.f() + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-41726.stderr b/tests/ui/issues/issue-41726.stderr index 250bba222bfd..d5123ab679f8 100644 --- a/tests/ui/issues/issue-41726.stderr +++ b/tests/ui/issues/issue-41726.stderr @@ -7,8 +7,9 @@ LL | things[src.as_str()].sort(); = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap>` help: to modify a `HashMap>` use `.get_mut()` | -LL | if let Some(val) = things.get_mut(src.as_str()) { val.sort(); }; - | ++++++++++++++++++ ~~~~~~~~~ ~~~~~~~ +++ +LL - things[src.as_str()].sort(); +LL + if let Some(val) = things.get_mut(src.as_str()) { val.sort(); }; + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-42312.stderr b/tests/ui/issues/issue-42312.stderr index cbdc9ce0f834..68d9912e3b1f 100644 --- a/tests/ui/issues/issue-42312.stderr +++ b/tests/ui/issues/issue-42312.stderr @@ -25,8 +25,9 @@ LL | pub fn f(_: dyn ToString) {} = help: unsized fn params are gated as an unstable feature help: you can use `impl Trait` as the argument type | -LL | pub fn f(_: impl ToString) {} - | ~~~~ +LL - pub fn f(_: dyn ToString) {} +LL + pub fn f(_: impl ToString) {} + | help: function arguments must have a statically known size, borrowed types always have a known size | LL | pub fn f(_: &dyn ToString) {} diff --git a/tests/ui/issues/issue-44239.stderr b/tests/ui/issues/issue-44239.stderr index 1a047d4c63b6..8048e32f149a 100644 --- a/tests/ui/issues/issue-44239.stderr +++ b/tests/ui/issues/issue-44239.stderr @@ -6,8 +6,9 @@ LL | const N: usize = n; | help: consider using `const` instead of `let` | -LL | const n: usize = 0; - | ~~~~~ +LL - let n: usize = 0; +LL + const n: usize = 0; + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr b/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr index 0aa1ae7222f5..0a6fe24d5e34 100644 --- a/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr +++ b/tests/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr @@ -6,8 +6,9 @@ LL | let _condemned = justice.00; | help: a field with a similar name exists | -LL | let _condemned = justice.0; - | ~ +LL - let _condemned = justice.00; +LL + let _condemned = justice.0; + | error[E0609]: no field `001` on type `Verdict` --> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:10:31 diff --git a/tests/ui/issues/issue-4736.stderr b/tests/ui/issues/issue-4736.stderr index c1ae2c47b43a..b099e528ca8a 100644 --- a/tests/ui/issues/issue-4736.stderr +++ b/tests/ui/issues/issue-4736.stderr @@ -9,8 +9,9 @@ LL | let z = NonCopyable{ p: () }; | help: `NonCopyable` is a tuple struct, use the appropriate syntax | -LL | let z = NonCopyable(/* () */); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - let z = NonCopyable{ p: () }; +LL + let z = NonCopyable(/* () */); + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-50571.stderr b/tests/ui/issues/issue-50571.stderr index 12256ded1c0a..86709410670c 100644 --- a/tests/ui/issues/issue-50571.stderr +++ b/tests/ui/issues/issue-50571.stderr @@ -6,8 +6,9 @@ LL | fn foo([a, b]: [i32; 2]) {} | help: give this argument a name or use an underscore to ignore it | -LL | fn foo(_: [i32; 2]) {} - | ~ +LL - fn foo([a, b]: [i32; 2]) {} +LL + fn foo(_: [i32; 2]) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-51874.stderr b/tests/ui/issues/issue-51874.stderr index 5be3695dd454..18328450145b 100644 --- a/tests/ui/issues/issue-51874.stderr +++ b/tests/ui/issues/issue-51874.stderr @@ -6,8 +6,9 @@ LL | let a = (1.0).pow(1.0); | help: you must specify a concrete type for this numeric value, like `f32` | -LL | let a = (1.0_f32).pow(1.0); - | ~~~~~~~ +LL - let a = (1.0).pow(1.0); +LL + let a = (1.0_f32).pow(1.0); + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-5358-1.stderr b/tests/ui/issues/issue-5358-1.stderr index 1bb946ce4cb5..f598cf33911f 100644 --- a/tests/ui/issues/issue-5358-1.stderr +++ b/tests/ui/issues/issue-5358-1.stderr @@ -14,8 +14,9 @@ LL | S(Either::Right(_)) => {} | ++ + help: you might have meant to use field `0` whose type is `Either` | -LL | match S(Either::Left(5)).0 { - | ~~~~~~~~~~~~~~~~~~~~ +LL - match S(Either::Left(5)) { +LL + match S(Either::Left(5)).0 { + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-56175.stderr b/tests/ui/issues/issue-56175.stderr index 6ed35c3a3d3a..695aa2ac7969 100644 --- a/tests/ui/issues/issue-56175.stderr +++ b/tests/ui/issues/issue-56175.stderr @@ -16,8 +16,9 @@ LL + use reexported_trait::Trait; | help: there is a method `trait_method_b` with a similar name | -LL | reexported_trait::FooStruct.trait_method_b(); - | ~~~~~~~~~~~~~~ +LL - reexported_trait::FooStruct.trait_method(); +LL + reexported_trait::FooStruct.trait_method_b(); + | error[E0599]: no method named `trait_method_b` found for struct `FooStruct` in the current scope --> $DIR/issue-56175.rs:7:33 @@ -37,8 +38,9 @@ LL + use reexported_trait::TraitBRename; | help: there is a method `trait_method` with a similar name | -LL | reexported_trait::FooStruct.trait_method(); - | ~~~~~~~~~~~~ +LL - reexported_trait::FooStruct.trait_method_b(); +LL + reexported_trait::FooStruct.trait_method(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr index 3c19b68cffbb..713a19f6cb0f 100644 --- a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr +++ b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr @@ -10,8 +10,9 @@ LL | T::A(a) | T::B(a) => a, found enum `T` help: consider dereferencing the boxed value | -LL | let y = match *x { - | ~~ +LL - let y = match x { +LL + let y = match *x { + | error[E0308]: mismatched types --> $DIR/issue-57741.rs:20:19 @@ -25,8 +26,9 @@ LL | T::A(a) | T::B(a) => a, found enum `T` help: consider dereferencing the boxed value | -LL | let y = match *x { - | ~~ +LL - let y = match x { +LL + let y = match *x { + | error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:9 @@ -40,8 +42,9 @@ LL | S::A { a } | S::B { b: a } => a, found enum `S` help: consider dereferencing the boxed value | -LL | let y = match *x { - | ~~ +LL - let y = match x { +LL + let y = match *x { + | error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:22 @@ -55,8 +58,9 @@ LL | S::A { a } | S::B { b: a } => a, found enum `S` help: consider dereferencing the boxed value | -LL | let y = match *x { - | ~~ +LL - let y = match x { +LL + let y = match *x { + | error: aborting due to 4 previous errors diff --git a/tests/ui/issues/issue-5883.stderr b/tests/ui/issues/issue-5883.stderr index d7278ec32f53..2ca437b8c473 100644 --- a/tests/ui/issues/issue-5883.stderr +++ b/tests/ui/issues/issue-5883.stderr @@ -22,8 +22,9 @@ LL | r: dyn A + 'static = help: unsized fn params are gated as an unstable feature help: you can use `impl Trait` as the argument type | -LL | r: impl A + 'static - | ~~~~ +LL - r: dyn A + 'static +LL + r: impl A + 'static + | help: function arguments must have a statically known size, borrowed types always have a known size | LL | r: &dyn A + 'static diff --git a/tests/ui/issues/issue-69683.stderr b/tests/ui/issues/issue-69683.stderr index c428ea9ea2c5..b8e9e89e56eb 100644 --- a/tests/ui/issues/issue-69683.stderr +++ b/tests/ui/issues/issue-69683.stderr @@ -7,8 +7,9 @@ LL | 0u16.foo(b); = note: cannot satisfy `>::Array == [u8; 3]` help: try using a fully qualified path to specify the expected types | -LL | >::foo(0u16, b); - | +++++++++++++++++++++ ~ +LL - 0u16.foo(b); +LL + >::foo(0u16, b); + | error[E0283]: type annotations needed --> $DIR/issue-69683.rs:30:10 @@ -34,8 +35,9 @@ LL | fn foo(self, x: >::Array); | --- required by a bound in this associated function help: try using a fully qualified path to specify the expected types | -LL | >::foo(0u16, b); - | +++++++++++++++++++++ ~ +LL - 0u16.foo(b); +LL + >::foo(0u16, b); + | error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.stderr b/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.stderr index 8e77662b4ba3..eabb08421121 100644 --- a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.stderr +++ b/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.stderr @@ -6,8 +6,9 @@ LL | let foo::Foo {} = foo::Foo::default(); | help: ignore the inaccessible and unused fields | -LL | let foo::Foo { .. } = foo::Foo::default(); - | ~~~~~~ +LL - let foo::Foo {} = foo::Foo::default(); +LL + let foo::Foo { .. } = foo::Foo::default(); + | error: pattern requires `..` due to inaccessible fields --> $DIR/issue-76077-1.rs:16:9 diff --git a/tests/ui/issues/issue-76191.stderr b/tests/ui/issues/issue-76191.stderr index 3b89ec7cb9c9..a397d0821420 100644 --- a/tests/ui/issues/issue-76191.stderr +++ b/tests/ui/issues/issue-76191.stderr @@ -24,8 +24,9 @@ LL | RANGE => {} found struct `std::ops::RangeInclusive` help: you may want to move the range into the match block | -LL | 0..=255 => {} - | ~~~~~~~ +LL - RANGE => {} +LL + 0..=255 => {} + | error[E0308]: mismatched types --> $DIR/issue-76191.rs:16:9 diff --git a/tests/ui/issues/issue-78622.stderr b/tests/ui/issues/issue-78622.stderr index 985d6dde9f2a..432913a0fc9c 100644 --- a/tests/ui/issues/issue-78622.stderr +++ b/tests/ui/issues/issue-78622.stderr @@ -6,8 +6,9 @@ LL | S::A:: {} | help: if there were a trait named `Example` with associated type `A` implemented for `S`, you could use the fully-qualified path | -LL | ::A:: {} - | ~~~~~~~~~~~~~~~~~ +LL - S::A:: {} +LL + ::A:: {} + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-80607.stderr b/tests/ui/issues/issue-80607.stderr index d096910297b7..8f9f494c8b7a 100644 --- a/tests/ui/issues/issue-80607.stderr +++ b/tests/ui/issues/issue-80607.stderr @@ -9,8 +9,9 @@ LL | Enum::V1 { x } | help: `Enum::V1` is a tuple variant, use the appropriate syntax | -LL | Enum::V1(/* i32 */) - | ~~~~~~~~~~~ +LL - Enum::V1 { x } +LL + Enum::V1(/* i32 */) + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-8761.stderr b/tests/ui/issues/issue-8761.stderr index c70093bafb69..4a9db5689138 100644 --- a/tests/ui/issues/issue-8761.stderr +++ b/tests/ui/issues/issue-8761.stderr @@ -6,8 +6,9 @@ LL | A = 1i64, | help: change the type of the numeric literal from `i64` to `isize` | -LL | A = 1isize, - | ~~~~~ +LL - A = 1i64, +LL + A = 1isize, + | error[E0308]: mismatched types --> $DIR/issue-8761.rs:5:9 @@ -17,8 +18,9 @@ LL | B = 2u8 | help: change the type of the numeric literal from `u8` to `isize` | -LL | B = 2isize - | ~~~~~ +LL - B = 2u8 +LL + B = 2isize + | error: aborting due to 2 previous errors diff --git a/tests/ui/iterators/into-iter-on-arrays-2018.stderr b/tests/ui/iterators/into-iter-on-arrays-2018.stderr index 9d6bbf06c36b..d4055c74f7ce 100644 --- a/tests/ui/iterators/into-iter-on-arrays-2018.stderr +++ b/tests/ui/iterators/into-iter-on-arrays-2018.stderr @@ -9,12 +9,14 @@ LL | let _: Iter<'_, i32> = array.into_iter(); = note: `#[warn(array_into_iter)]` on by default help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | let _: Iter<'_, i32> = array.iter(); - | ~~~~ +LL - let _: Iter<'_, i32> = array.into_iter(); +LL + let _: Iter<'_, i32> = array.iter(); + | help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | -LL | let _: Iter<'_, i32> = IntoIterator::into_iter(array); - | ++++++++++++++++++++++++ ~ +LL - let _: Iter<'_, i32> = array.into_iter(); +LL + let _: Iter<'_, i32> = IntoIterator::into_iter(array); + | warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-2018.rs:18:44 @@ -53,8 +55,9 @@ LL | for _ in [1, 2, 3].into_iter() {} = note: for more information, see help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | for _ in [1, 2, 3].iter() {} - | ~~~~ +LL - for _ in [1, 2, 3].into_iter() {} +LL + for _ in [1, 2, 3].iter() {} + | help: or remove `.into_iter()` to iterate by value | LL - for _ in [1, 2, 3].into_iter() {} diff --git a/tests/ui/iterators/into-iter-on-arrays-lint.stderr b/tests/ui/iterators/into-iter-on-arrays-lint.stderr index da388d6b848d..fb8fe79c7c96 100644 --- a/tests/ui/iterators/into-iter-on-arrays-lint.stderr +++ b/tests/ui/iterators/into-iter-on-arrays-lint.stderr @@ -9,12 +9,14 @@ LL | small.into_iter(); = note: `#[warn(array_into_iter)]` on by default help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | small.iter(); - | ~~~~ +LL - small.into_iter(); +LL + small.iter(); + | help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | -LL | IntoIterator::into_iter(small); - | ++++++++++++++++++++++++ ~ +LL - small.into_iter(); +LL + IntoIterator::into_iter(small); + | warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:14:12 @@ -26,12 +28,14 @@ LL | [1, 2].into_iter(); = note: for more information, see help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | [1, 2].iter(); - | ~~~~ +LL - [1, 2].into_iter(); +LL + [1, 2].iter(); + | help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | -LL | IntoIterator::into_iter([1, 2]); - | ++++++++++++++++++++++++ ~ +LL - [1, 2].into_iter(); +LL + IntoIterator::into_iter([1, 2]); + | warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:17:9 @@ -43,12 +47,14 @@ LL | big.into_iter(); = note: for more information, see help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | big.iter(); - | ~~~~ +LL - big.into_iter(); +LL + big.iter(); + | help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | -LL | IntoIterator::into_iter(big); - | ++++++++++++++++++++++++ ~ +LL - big.into_iter(); +LL + IntoIterator::into_iter(big); + | warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:20:15 @@ -60,12 +66,14 @@ LL | [0u8; 33].into_iter(); = note: for more information, see help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | [0u8; 33].iter(); - | ~~~~ +LL - [0u8; 33].into_iter(); +LL + [0u8; 33].iter(); + | help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | -LL | IntoIterator::into_iter([0u8; 33]); - | ++++++++++++++++++++++++ ~ +LL - [0u8; 33].into_iter(); +LL + IntoIterator::into_iter([0u8; 33]); + | warning: this method call resolves to `<&[T; N] as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to `<[T; N] as IntoIterator>::into_iter` in Rust 2021 --> $DIR/into-iter-on-arrays-lint.rs:24:21 diff --git a/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr b/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr index e82980303995..7a5a2be5ef06 100644 --- a/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr +++ b/tests/ui/iterators/into-iter-on-boxed-slices-2021.stderr @@ -9,12 +9,14 @@ LL | let _: Iter<'_, i32> = boxed_slice.into_iter(); = note: `#[warn(boxed_slice_into_iter)]` on by default help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | let _: Iter<'_, i32> = boxed_slice.iter(); - | ~~~~ +LL - let _: Iter<'_, i32> = boxed_slice.into_iter(); +LL + let _: Iter<'_, i32> = boxed_slice.iter(); + | help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | -LL | let _: Iter<'_, i32> = IntoIterator::into_iter(boxed_slice); - | ++++++++++++++++++++++++ ~ +LL - let _: Iter<'_, i32> = boxed_slice.into_iter(); +LL + let _: Iter<'_, i32> = IntoIterator::into_iter(boxed_slice); + | warning: this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to ` as IntoIterator>::into_iter` in Rust 2024 --> $DIR/into-iter-on-boxed-slices-2021.rs:18:58 @@ -53,8 +55,9 @@ LL | for _ in (Box::new([1, 2, 3]) as Box<[_]>).into_iter() {} = note: for more information, see help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | for _ in (Box::new([1, 2, 3]) as Box<[_]>).iter() {} - | ~~~~ +LL - for _ in (Box::new([1, 2, 3]) as Box<[_]>).into_iter() {} +LL + for _ in (Box::new([1, 2, 3]) as Box<[_]>).iter() {} + | help: or remove `.into_iter()` to iterate by value | LL - for _ in (Box::new([1, 2, 3]) as Box<[_]>).into_iter() {} diff --git a/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr b/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr index 8a88c7816d25..6762ed28d368 100644 --- a/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr +++ b/tests/ui/iterators/into-iter-on-boxed-slices-lint.stderr @@ -9,12 +9,14 @@ LL | boxed.into_iter(); = note: `#[warn(boxed_slice_into_iter)]` on by default help: use `.iter()` instead of `.into_iter()` to avoid ambiguity | -LL | boxed.iter(); - | ~~~~ +LL - boxed.into_iter(); +LL + boxed.iter(); + | help: or use `IntoIterator::into_iter(..)` instead of `.into_iter()` to explicitly iterate by value | -LL | IntoIterator::into_iter(boxed); - | ++++++++++++++++++++++++ ~ +LL - boxed.into_iter(); +LL + IntoIterator::into_iter(boxed); + | warning: this method call resolves to `<&Box<[T]> as IntoIterator>::into_iter` (due to backwards compatibility), but will resolve to ` as IntoIterator>::into_iter` in Rust 2024 --> $DIR/into-iter-on-boxed-slices-lint.rs:13:29 diff --git a/tests/ui/label/label_misspelled.stderr b/tests/ui/label/label_misspelled.stderr index 4b5b9e92ca09..3f4020e7be0a 100644 --- a/tests/ui/label/label_misspelled.stderr +++ b/tests/ui/label/label_misspelled.stderr @@ -157,12 +157,14 @@ LL | break foo; | help: use `break` on its own without a value inside this `while` loop | -LL | break; - | ~~~~~ +LL - break foo; +LL + break; + | help: alternatively, you might have meant to use the available loop label | -LL | break 'while_loop; - | ~~~~~~~~~~~ +LL - break foo; +LL + break 'while_loop; + | error[E0571]: `break` with value from a `while` loop --> $DIR/label_misspelled.rs:54:9 @@ -175,12 +177,14 @@ LL | break foo; | help: use `break` on its own without a value inside this `while` loop | -LL | break; - | ~~~~~ +LL - break foo; +LL + break; + | help: alternatively, you might have meant to use the available loop label | -LL | break 'while_let; - | ~~~~~~~~~~ +LL - break foo; +LL + break 'while_let; + | error[E0571]: `break` with value from a `for` loop --> $DIR/label_misspelled.rs:59:9 @@ -193,12 +197,14 @@ LL | break foo; | help: use `break` on its own without a value inside this `for` loop | -LL | break; - | ~~~~~ +LL - break foo; +LL + break; + | help: alternatively, you might have meant to use the available loop label | -LL | break 'for_loop; - | ~~~~~~~~~ +LL - break foo; +LL + break 'for_loop; + | error: aborting due to 11 previous errors; 10 warnings emitted diff --git a/tests/ui/let-else/let-else-deref-coercion.stderr b/tests/ui/let-else/let-else-deref-coercion.stderr index da8b1f4c48e9..07347af76e4d 100644 --- a/tests/ui/let-else/let-else-deref-coercion.stderr +++ b/tests/ui/let-else/let-else-deref-coercion.stderr @@ -8,8 +8,9 @@ LL | let Bar::Present(z) = self else { | help: consider dereferencing to access the inner value using the Deref trait | -LL | let Bar::Present(z) = &**self else { - | ~~~~~~~ +LL - let Bar::Present(z) = self else { +LL + let Bar::Present(z) = &**self else { + | error[E0308]: mismatched types --> $DIR/let-else-deref-coercion.rs:68:13 @@ -21,8 +22,9 @@ LL | let Bar(z) = x; | help: consider dereferencing to access the inner value using the Deref trait | -LL | let Bar(z) = &**x; - | ~~~~ +LL - let Bar(z) = x; +LL + let Bar(z) = &**x; + | error: aborting due to 2 previous errors diff --git a/tests/ui/lexer/lex-bad-char-literals-1.stderr b/tests/ui/lexer/lex-bad-char-literals-1.stderr index 9dc0a3380631..49683c10237b 100644 --- a/tests/ui/lexer/lex-bad-char-literals-1.stderr +++ b/tests/ui/lexer/lex-bad-char-literals-1.stderr @@ -19,8 +19,9 @@ LL | '\●' = help: for more information, visit help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | -LL | r"\●" - | ~~~~~ +LL - '\●' +LL + r"\●" + | error: unknown character escape: `\u{25cf}` --> $DIR/lex-bad-char-literals-1.rs:14:7 @@ -31,8 +32,9 @@ LL | "\●" = help: for more information, visit help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | -LL | r"\●" - | ~~~~~ +LL - "\●" +LL + r"\●" + | error: aborting due to 4 previous errors diff --git a/tests/ui/lexer/lex-bad-char-literals-2.stderr b/tests/ui/lexer/lex-bad-char-literals-2.stderr index 76cde00404a1..fa0630728656 100644 --- a/tests/ui/lexer/lex-bad-char-literals-2.stderr +++ b/tests/ui/lexer/lex-bad-char-literals-2.stderr @@ -6,8 +6,9 @@ LL | 'nope' | help: if you meant to write a string literal, use double quotes | -LL | "nope" - | ~ ~ +LL - 'nope' +LL + "nope" + | error: aborting due to 1 previous error diff --git a/tests/ui/lexer/lex-bad-char-literals-3.stderr b/tests/ui/lexer/lex-bad-char-literals-3.stderr index 3f339b2ef7d9..d8ce17d13a99 100644 --- a/tests/ui/lexer/lex-bad-char-literals-3.stderr +++ b/tests/ui/lexer/lex-bad-char-literals-3.stderr @@ -6,8 +6,9 @@ LL | static c: char = '●●'; | help: if you meant to write a string literal, use double quotes | -LL | static c: char = "●●"; - | ~ ~ +LL - static c: char = '●●'; +LL + static c: char = "●●"; + | error: character literal may only contain one codepoint --> $DIR/lex-bad-char-literals-3.rs:5:20 @@ -17,8 +18,9 @@ LL | let ch: &str = '●●'; | help: if you meant to write a string literal, use double quotes | -LL | let ch: &str = "●●"; - | ~ ~ +LL - let ch: &str = '●●'; +LL + let ch: &str = "●●"; + | error: aborting due to 2 previous errors diff --git a/tests/ui/lexer/lex-bad-char-literals-5.stderr b/tests/ui/lexer/lex-bad-char-literals-5.stderr index 8004157e87f7..0322783871e6 100644 --- a/tests/ui/lexer/lex-bad-char-literals-5.stderr +++ b/tests/ui/lexer/lex-bad-char-literals-5.stderr @@ -6,8 +6,9 @@ LL | static c: char = '\x10\x10'; | help: if you meant to write a string literal, use double quotes | -LL | static c: char = "\x10\x10"; - | ~ ~ +LL - static c: char = '\x10\x10'; +LL + static c: char = "\x10\x10"; + | error: character literal may only contain one codepoint --> $DIR/lex-bad-char-literals-5.rs:5:20 @@ -17,8 +18,9 @@ LL | let ch: &str = '\x10\x10'; | help: if you meant to write a string literal, use double quotes | -LL | let ch: &str = "\x10\x10"; - | ~ ~ +LL - let ch: &str = '\x10\x10'; +LL + let ch: &str = "\x10\x10"; + | error: aborting due to 2 previous errors diff --git a/tests/ui/lexer/lex-bad-char-literals-6.stderr b/tests/ui/lexer/lex-bad-char-literals-6.stderr index 96d409d59bb2..e5fd62bc0a9a 100644 --- a/tests/ui/lexer/lex-bad-char-literals-6.stderr +++ b/tests/ui/lexer/lex-bad-char-literals-6.stderr @@ -6,8 +6,9 @@ LL | let x: &str = 'ab'; | help: if you meant to write a string literal, use double quotes | -LL | let x: &str = "ab"; - | ~ ~ +LL - let x: &str = 'ab'; +LL + let x: &str = "ab"; + | error: character literal may only contain one codepoint --> $DIR/lex-bad-char-literals-6.rs:4:19 @@ -17,8 +18,9 @@ LL | let y: char = 'cd'; | help: if you meant to write a string literal, use double quotes | -LL | let y: char = "cd"; - | ~ ~ +LL - let y: char = 'cd'; +LL + let y: char = "cd"; + | error: character literal may only contain one codepoint --> $DIR/lex-bad-char-literals-6.rs:6:13 @@ -28,8 +30,9 @@ LL | let z = 'ef'; | help: if you meant to write a string literal, use double quotes | -LL | let z = "ef"; - | ~ ~ +LL - let z = 'ef'; +LL + let z = "ef"; + | error[E0308]: mismatched types --> $DIR/lex-bad-char-literals-6.rs:13:20 diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-1.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-1.stderr index 57c5f82704ec..81ee697802b9 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-1.stderr +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-1.stderr @@ -6,8 +6,9 @@ LL | println!('1 + 1'); | help: if you meant to write a string literal, use double quotes | -LL | println!("1 + 1"); - | ~ ~ +LL - println!('1 + 1'); +LL + println!("1 + 1"); + | error: lifetimes cannot start with a number --> $DIR/lex-bad-str-literal-as-char-1.rs:3:14 diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-2.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-2.stderr index f64761af6419..ed1303cd4284 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-2.stderr +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-2.stderr @@ -6,8 +6,9 @@ LL | println!(' 1 + 1'); | help: if you meant to write a string literal, use double quotes | -LL | println!(" 1 + 1"); - | ~ ~ +LL - println!(' 1 + 1'); +LL + println!(" 1 + 1"); + | error: aborting due to 1 previous error diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr index 06f127426679..2f92225de1fb 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2015.stderr @@ -6,8 +6,9 @@ LL | println!('hello world'); | help: if you meant to write a string literal, use double quotes | -LL | println!("hello world"); - | ~ ~ +LL - println!('hello world'); +LL + println!("hello world"); + | error: aborting due to 1 previous error diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr index 06f127426679..2f92225de1fb 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2018.stderr @@ -6,8 +6,9 @@ LL | println!('hello world'); | help: if you meant to write a string literal, use double quotes | -LL | println!("hello world"); - | ~ ~ +LL - println!('hello world'); +LL + println!("hello world"); + | error: aborting due to 1 previous error diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr index 4170560cfcb0..e10046e58e45 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-3.rust2021.stderr @@ -7,8 +7,9 @@ LL | println!('hello world'); = note: prefixed identifiers and literals are reserved since Rust 2021 help: if you meant to write a string literal, use double quotes | -LL | println!("hello world"); - | ~ ~ +LL - println!('hello world'); +LL + println!("hello world"); + | error[E0762]: unterminated character literal --> $DIR/lex-bad-str-literal-as-char-3.rs:5:26 @@ -18,8 +19,9 @@ LL | println!('hello world'); | help: if you meant to write a string literal, use double quotes | -LL | println!("hello world"); - | ~ ~ +LL - println!('hello world'); +LL + println!("hello world"); + | error: aborting due to 2 previous errors diff --git a/tests/ui/lexer/lex-bad-str-literal-as-char-4.stderr b/tests/ui/lexer/lex-bad-str-literal-as-char-4.stderr index af42b5b7f7b7..5633783e7382 100644 --- a/tests/ui/lexer/lex-bad-str-literal-as-char-4.stderr +++ b/tests/ui/lexer/lex-bad-str-literal-as-char-4.stderr @@ -7,8 +7,9 @@ LL | println!('hello world'); = note: prefixed identifiers and literals are reserved since Rust 2021 help: if you meant to write a string literal, use double quotes | -LL | println!("hello world"); - | ~ ~ +LL - println!('hello world'); +LL + println!("hello world"); + | error[E0762]: unterminated character literal --> $DIR/lex-bad-str-literal-as-char-4.rs:4:30 @@ -18,8 +19,9 @@ LL | println!('hello world'); | help: if you meant to write a string literal, use double quotes | -LL | println!("hello world"); - | ~ ~ +LL - println!('hello world'); +LL + println!("hello world"); + | error: aborting due to 2 previous errors diff --git a/tests/ui/lifetimes/borrowck-let-suggestion.stderr b/tests/ui/lifetimes/borrowck-let-suggestion.stderr index cca7f52957e4..e0adb1641405 100644 --- a/tests/ui/lifetimes/borrowck-let-suggestion.stderr +++ b/tests/ui/lifetimes/borrowck-let-suggestion.stderr @@ -12,8 +12,9 @@ LL | x.use_mut(); = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider consuming the `Vec` when turning it into an `Iterator` | -LL | let mut x = vec![1].into_iter(); - | ~~~~~~~~~ +LL - let mut x = vec![1].iter(); +LL + let mut x = vec![1].into_iter(); + | help: consider using a `let` binding to create a longer lived value | LL ~ let binding = vec![1]; diff --git a/tests/ui/lifetimes/fullwidth-ampersand.stderr b/tests/ui/lifetimes/fullwidth-ampersand.stderr index 4645254f4b70..7fa7343620b0 100644 --- a/tests/ui/lifetimes/fullwidth-ampersand.stderr +++ b/tests/ui/lifetimes/fullwidth-ampersand.stderr @@ -6,8 +6,9 @@ LL | fn f(_: &&()) -> &() { todo!() } | help: Unicode character '&' (Fullwidth Ampersand) looks like '&' (Ampersand), but it is not | -LL | fn f(_: &&()) -> &() { todo!() } - | ~ +LL - fn f(_: &&()) -> &() { todo!() } +LL + fn f(_: &&()) -> &() { todo!() } + | error[E0106]: missing lifetime specifier --> $DIR/fullwidth-ampersand.rs:3:18 diff --git a/tests/ui/lifetimes/issue-26638.stderr b/tests/ui/lifetimes/issue-26638.stderr index dc18e0f1f7a1..8aa94f66812f 100644 --- a/tests/ui/lifetimes/issue-26638.stderr +++ b/tests/ui/lifetimes/issue-26638.stderr @@ -27,8 +27,9 @@ LL | fn parse_type_2(iter: &fn(&u8)->&u8) -> &str { iter() } | + help: ...or alternatively, you might want to return an owned value | -LL | fn parse_type_2(iter: fn(&u8)->&u8) -> String { iter() } - | ~~~~~~ +LL - fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } +LL + fn parse_type_2(iter: fn(&u8)->&u8) -> String { iter() } + | error[E0106]: missing lifetime specifier --> $DIR/issue-26638.rs:9:22 @@ -43,8 +44,9 @@ LL | fn parse_type_3() -> &'static str { unimplemented!() } | +++++++ help: instead, you are more likely to want to return an owned value | -LL | fn parse_type_3() -> String { unimplemented!() } - | ~~~~~~ +LL - fn parse_type_3() -> &str { unimplemented!() } +LL + fn parse_type_3() -> String { unimplemented!() } + | error[E0061]: this function takes 1 argument but 0 arguments were supplied --> $DIR/issue-26638.rs:4:47 @@ -54,8 +56,9 @@ LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } | help: provide the argument | -LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter(/* &u8 */) } - | ~~~~~~~~~~~ +LL - fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } +LL + fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter(/* &u8 */) } + | error[E0308]: mismatched types --> $DIR/issue-26638.rs:4:47 diff --git a/tests/ui/lifetimes/issue-90170-elision-mismatch.stderr b/tests/ui/lifetimes/issue-90170-elision-mismatch.stderr index 5e16c57a618f..e03910ec79e7 100644 --- a/tests/ui/lifetimes/issue-90170-elision-mismatch.stderr +++ b/tests/ui/lifetimes/issue-90170-elision-mismatch.stderr @@ -29,8 +29,9 @@ LL | pub fn foo2(x: &mut Vec<&'_ u8>, y: &u8) { x.push(y); } = help: see for more information about variance help: consider introducing a named lifetime parameter | -LL | pub fn foo2<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } - | ++++ ~~ ++ +LL - pub fn foo2(x: &mut Vec<&'_ u8>, y: &u8) { x.push(y); } +LL + pub fn foo2<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } + | error: lifetime may not live long enough --> $DIR/issue-90170-elision-mismatch.rs:7:63 diff --git a/tests/ui/lifetimes/raw/immediately-followed-by-lt.e2021.stderr b/tests/ui/lifetimes/raw/immediately-followed-by-lt.e2021.stderr index e600cc37fc42..f16c18f85d32 100644 --- a/tests/ui/lifetimes/raw/immediately-followed-by-lt.e2021.stderr +++ b/tests/ui/lifetimes/raw/immediately-followed-by-lt.e2021.stderr @@ -6,8 +6,9 @@ LL | w!('r#long'id); | help: if you meant to write a string literal, use double quotes | -LL | w!("r#long"id); - | ~ ~ +LL - w!('r#long'id); +LL + w!("r#long"id); + | error: aborting due to 1 previous error diff --git a/tests/ui/lint/ambiguous_wide_pointer_comparisons_suggestions.stderr b/tests/ui/lint/ambiguous_wide_pointer_comparisons_suggestions.stderr index d9190dbb8134..30d7683ef4b4 100644 --- a/tests/ui/lint/ambiguous_wide_pointer_comparisons_suggestions.stderr +++ b/tests/ui/lint/ambiguous_wide_pointer_comparisons_suggestions.stderr @@ -7,12 +7,14 @@ LL | let _ = a == b; = note: `#[warn(ambiguous_wide_pointer_comparisons)]` on by default help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a, b); - | ++++++++++++++++++ ~ + +LL - let _ = a == b; +LL + let _ = std::ptr::addr_eq(a, b); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = std::ptr::eq(a, b); - | +++++++++++++ ~ + +LL - let _ = a == b; +LL + let _ = std::ptr::eq(a, b); + | warning: 1 warning emitted diff --git a/tests/ui/lint/dead-code/tuple-struct-field.stderr b/tests/ui/lint/dead-code/tuple-struct-field.stderr index 434554d7ae5e..3e1d4e772745 100644 --- a/tests/ui/lint/dead-code/tuple-struct-field.stderr +++ b/tests/ui/lint/dead-code/tuple-struct-field.stderr @@ -33,8 +33,9 @@ LL | struct UnusedInTheMiddle(i32, f32, String, u8, u32); | help: consider changing the fields to be of unit type to suppress this warning while preserving the field numbering, or remove the fields | -LL | struct UnusedInTheMiddle(i32, (), (), u8, ()); - | ~~ ~~ ~~ +LL - struct UnusedInTheMiddle(i32, f32, String, u8, u32); +LL + struct UnusedInTheMiddle(i32, (), (), u8, ()); + | error: aborting due to 3 previous errors diff --git a/tests/ui/lint/elided-named-lifetimes/static.stderr b/tests/ui/lint/elided-named-lifetimes/static.stderr index fa2a2d3460fe..7ad08dbf04ba 100644 --- a/tests/ui/lint/elided-named-lifetimes/static.stderr +++ b/tests/ui/lint/elided-named-lifetimes/static.stderr @@ -44,8 +44,9 @@ LL | fn underscore(x: &'static u8) -> &'_ u8 { | help: consider specifying it explicitly | -LL | fn underscore(x: &'static u8) -> &'static u8 { - | ~~~~~~~ +LL - fn underscore(x: &'static u8) -> &'_ u8 { +LL + fn underscore(x: &'static u8) -> &'static u8 { + | error: aborting due to 4 previous errors diff --git a/tests/ui/lint/fn-ptr-comparisons.stderr b/tests/ui/lint/fn-ptr-comparisons.stderr index eaba23a461ab..e69933238986 100644 --- a/tests/ui/lint/fn-ptr-comparisons.stderr +++ b/tests/ui/lint/fn-ptr-comparisons.stderr @@ -10,8 +10,9 @@ LL | let _ = f == a; = note: `#[warn(unpredictable_function_pointer_comparisons)]` on by default help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(f, a as fn()); - | +++++++++++++++++++++ ~ ++++++++ +LL - let _ = f == a; +LL + let _ = std::ptr::fn_addr_eq(f, a as fn()); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:28:13 @@ -24,8 +25,9 @@ LL | let _ = f != a; = note: for more information visit help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = !std::ptr::fn_addr_eq(f, a as fn()); - | ++++++++++++++++++++++ ~ ++++++++ +LL - let _ = f != a; +LL + let _ = !std::ptr::fn_addr_eq(f, a as fn()); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:30:13 @@ -38,8 +40,9 @@ LL | let _ = f == g; = note: for more information visit help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(f, g); - | +++++++++++++++++++++ ~ + +LL - let _ = f == g; +LL + let _ = std::ptr::fn_addr_eq(f, g); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:32:13 @@ -52,8 +55,9 @@ LL | let _ = f == f; = note: for more information visit help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(f, f); - | +++++++++++++++++++++ ~ + +LL - let _ = f == f; +LL + let _ = std::ptr::fn_addr_eq(f, f); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:34:13 @@ -66,8 +70,9 @@ LL | let _ = g == g; = note: for more information visit help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(g, g); - | +++++++++++++++++++++ ~ + +LL - let _ = g == g; +LL + let _ = std::ptr::fn_addr_eq(g, g); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:36:13 @@ -80,8 +85,9 @@ LL | let _ = g == g; = note: for more information visit help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(g, g); - | +++++++++++++++++++++ ~ + +LL - let _ = g == g; +LL + let _ = std::ptr::fn_addr_eq(g, g); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:38:13 @@ -94,8 +100,9 @@ LL | let _ = &g == &g; = note: for more information visit help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(g, g); - | ~~~~~~~~~~~~~~~~~~~~~ ~ + +LL - let _ = &g == &g; +LL + let _ = std::ptr::fn_addr_eq(g, g); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:40:13 @@ -108,8 +115,9 @@ LL | let _ = a as fn() == g; = note: for more information visit help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(a as fn(), g); - | +++++++++++++++++++++ ~ + +LL - let _ = a as fn() == g; +LL + let _ = std::ptr::fn_addr_eq(a as fn(), g); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:44:13 @@ -122,8 +130,9 @@ LL | let _ = cfn == c; = note: for more information visit help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(cfn, c as extern "C" fn()); - | +++++++++++++++++++++ ~ +++++++++++++++++++ +LL - let _ = cfn == c; +LL + let _ = std::ptr::fn_addr_eq(cfn, c as extern "C" fn()); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:48:13 @@ -136,8 +145,9 @@ LL | let _ = argsfn == args; = note: for more information visit help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(argsfn, args as extern "C" fn(i32) -> i32); - | +++++++++++++++++++++ ~ +++++++++++++++++++++++++++++ +LL - let _ = argsfn == args; +LL + let _ = std::ptr::fn_addr_eq(argsfn, args as extern "C" fn(i32) -> i32); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:52:13 @@ -150,8 +160,9 @@ LL | let _ = t == test; = note: for more information visit help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(t, test as unsafe extern "C" fn()); - | +++++++++++++++++++++ ~ ++++++++++++++++++++++++++ +LL - let _ = t == test; +LL + let _ = std::ptr::fn_addr_eq(t, test as unsafe extern "C" fn()); + | warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique --> $DIR/fn-ptr-comparisons.rs:56:13 @@ -164,8 +175,9 @@ LL | let _ = a1.f == a2.f; = note: for more information visit help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint | -LL | let _ = std::ptr::fn_addr_eq(a1.f, a2.f); - | +++++++++++++++++++++ ~ + +LL - let _ = a1.f == a2.f; +LL + let _ = std::ptr::fn_addr_eq(a1.f, a2.f); + | warning: 12 warnings emitted diff --git a/tests/ui/lint/for_loop_over_fallibles.stderr b/tests/ui/lint/for_loop_over_fallibles.stderr index f695de082572..dae5e6428c8e 100644 --- a/tests/ui/lint/for_loop_over_fallibles.stderr +++ b/tests/ui/lint/for_loop_over_fallibles.stderr @@ -7,12 +7,14 @@ LL | for _ in Some(1) {} = note: `#[warn(for_loops_over_fallibles)]` on by default help: to check pattern in a loop use `while let` | -LL | while let Some(_) = Some(1) {} - | ~~~~~~~~~~~~~~~ ~~~ +LL - for _ in Some(1) {} +LL + while let Some(_) = Some(1) {} + | help: consider using `if let` to clear intent | -LL | if let Some(_) = Some(1) {} - | ~~~~~~~~~~~~ ~~~ +LL - for _ in Some(1) {} +LL + if let Some(_) = Some(1) {} + | warning: for loop over a `Result`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:9:14 @@ -22,12 +24,14 @@ LL | for _ in Ok::<_, ()>(1) {} | help: to check pattern in a loop use `while let` | -LL | while let Ok(_) = Ok::<_, ()>(1) {} - | ~~~~~~~~~~~~~ ~~~ +LL - for _ in Ok::<_, ()>(1) {} +LL + while let Ok(_) = Ok::<_, ()>(1) {} + | help: consider using `if let` to clear intent | -LL | if let Ok(_) = Ok::<_, ()>(1) {} - | ~~~~~~~~~~ ~~~ +LL - for _ in Ok::<_, ()>(1) {} +LL + if let Ok(_) = Ok::<_, ()>(1) {} + | warning: for loop over an `Option`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:15:14 @@ -37,12 +41,14 @@ LL | for _ in [0; 0].iter().next() {} | help: to iterate over `[0; 0].iter()` remove the call to `next` | -LL | for _ in [0; 0].iter().by_ref() {} - | ~~~~~~~~~ +LL - for _ in [0; 0].iter().next() {} +LL + for _ in [0; 0].iter().by_ref() {} + | help: consider using `if let` to clear intent | -LL | if let Some(_) = [0; 0].iter().next() {} - | ~~~~~~~~~~~~ ~~~ +LL - for _ in [0; 0].iter().next() {} +LL + if let Some(_) = [0; 0].iter().next() {} + | warning: for loop over a `Result`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:21:14 @@ -52,12 +58,14 @@ LL | for _ in Ok::<_, ()>([0; 0].iter()) {} | help: to check pattern in a loop use `while let` | -LL | while let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} - | ~~~~~~~~~~~~~ ~~~ +LL - for _ in Ok::<_, ()>([0; 0].iter()) {} +LL + while let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} + | help: consider using `if let` to clear intent | -LL | if let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} - | ~~~~~~~~~~ ~~~ +LL - for _ in Ok::<_, ()>([0; 0].iter()) {} +LL + if let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} + | warning: for loop over a `Result`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:29:14 @@ -67,16 +75,18 @@ LL | for _ in Ok::<_, ()>([0; 0].iter()) {} | help: to check pattern in a loop use `while let` | -LL | while let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} - | ~~~~~~~~~~~~~ ~~~ +LL - for _ in Ok::<_, ()>([0; 0].iter()) {} +LL + while let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} + | help: consider unwrapping the `Result` with `?` to iterate over its contents | LL | for _ in Ok::<_, ()>([0; 0].iter())? {} | + help: consider using `if let` to clear intent | -LL | if let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} - | ~~~~~~~~~~ ~~~ +LL - for _ in Ok::<_, ()>([0; 0].iter()) {} +LL + if let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} + | warning: for loop over a `Result`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:36:14 @@ -86,16 +96,18 @@ LL | for _ in Ok::<_, ()>([0; 0]) {} | help: to check pattern in a loop use `while let` | -LL | while let Ok(_) = Ok::<_, ()>([0; 0]) {} - | ~~~~~~~~~~~~~ ~~~ +LL - for _ in Ok::<_, ()>([0; 0]) {} +LL + while let Ok(_) = Ok::<_, ()>([0; 0]) {} + | help: consider unwrapping the `Result` with `?` to iterate over its contents | LL | for _ in Ok::<_, ()>([0; 0])? {} | + help: consider using `if let` to clear intent | -LL | if let Ok(_) = Ok::<_, ()>([0; 0]) {} - | ~~~~~~~~~~ ~~~ +LL - for _ in Ok::<_, ()>([0; 0]) {} +LL + if let Ok(_) = Ok::<_, ()>([0; 0]) {} + | warning: for loop over a `&Option`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:47:14 @@ -105,12 +117,14 @@ LL | for _ in &Some(1) {} | help: to check pattern in a loop use `while let` | -LL | while let Some(_) = &Some(1) {} - | ~~~~~~~~~~~~~~~ ~~~ +LL - for _ in &Some(1) {} +LL + while let Some(_) = &Some(1) {} + | help: consider using `if let` to clear intent | -LL | if let Some(_) = &Some(1) {} - | ~~~~~~~~~~~~ ~~~ +LL - for _ in &Some(1) {} +LL + if let Some(_) = &Some(1) {} + | warning: for loop over a `&Result`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:51:14 @@ -120,12 +134,14 @@ LL | for _ in &Ok::<_, ()>(1) {} | help: to check pattern in a loop use `while let` | -LL | while let Ok(_) = &Ok::<_, ()>(1) {} - | ~~~~~~~~~~~~~ ~~~ +LL - for _ in &Ok::<_, ()>(1) {} +LL + while let Ok(_) = &Ok::<_, ()>(1) {} + | help: consider using `if let` to clear intent | -LL | if let Ok(_) = &Ok::<_, ()>(1) {} - | ~~~~~~~~~~ ~~~ +LL - for _ in &Ok::<_, ()>(1) {} +LL + if let Ok(_) = &Ok::<_, ()>(1) {} + | warning: for loop over a `&mut Option`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:57:14 @@ -135,12 +151,14 @@ LL | for _ in &mut Some(1) {} | help: to check pattern in a loop use `while let` | -LL | while let Some(_) = &mut Some(1) {} - | ~~~~~~~~~~~~~~~ ~~~ +LL - for _ in &mut Some(1) {} +LL + while let Some(_) = &mut Some(1) {} + | help: consider using `if let` to clear intent | -LL | if let Some(_) = &mut Some(1) {} - | ~~~~~~~~~~~~ ~~~ +LL - for _ in &mut Some(1) {} +LL + if let Some(_) = &mut Some(1) {} + | warning: for loop over a `&mut Result`. This is more readably written as an `if let` statement --> $DIR/for_loop_over_fallibles.rs:61:14 @@ -150,12 +168,14 @@ LL | for _ in &mut Ok::<_, ()>(1) {} | help: to check pattern in a loop use `while let` | -LL | while let Ok(_) = &mut Ok::<_, ()>(1) {} - | ~~~~~~~~~~~~~ ~~~ +LL - for _ in &mut Ok::<_, ()>(1) {} +LL + while let Ok(_) = &mut Ok::<_, ()>(1) {} + | help: consider using `if let` to clear intent | -LL | if let Ok(_) = &mut Ok::<_, ()>(1) {} - | ~~~~~~~~~~ ~~~ +LL - for _ in &mut Ok::<_, ()>(1) {} +LL + if let Ok(_) = &mut Ok::<_, ()>(1) {} + | warning: 10 warnings emitted diff --git a/tests/ui/lint/issue-109152.stderr b/tests/ui/lint/issue-109152.stderr index a175964ccf63..01aa9068da56 100644 --- a/tests/ui/lint/issue-109152.stderr +++ b/tests/ui/lint/issue-109152.stderr @@ -16,8 +16,9 @@ LL | #![deny(map_unit_fn)] | ^^^^^^^^^^^ help: you might have meant to use `Iterator::for_each` | -LL | vec![42].iter().for_each(drop); - | ~~~~~~~~ +LL - vec![42].iter().map(drop); +LL + vec![42].iter().for_each(drop); + | error: aborting due to 1 previous error diff --git a/tests/ui/lint/issue-109529.stderr b/tests/ui/lint/issue-109529.stderr index 9e857d1b0ab5..51b71cb1007e 100644 --- a/tests/ui/lint/issue-109529.stderr +++ b/tests/ui/lint/issue-109529.stderr @@ -16,8 +16,9 @@ LL | for _ in 0..(256 as u8) {} | help: use an inclusive range instead | -LL | for _ in 0..=(255 as u8) {} - | + ~~~ +LL - for _ in 0..(256 as u8) {} +LL + for _ in 0..=(255 as u8) {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/lint/issue-35075.stderr b/tests/ui/lint/issue-35075.stderr index 08bdaa728583..f02f9e678b46 100644 --- a/tests/ui/lint/issue-35075.stderr +++ b/tests/ui/lint/issue-35075.stderr @@ -6,8 +6,9 @@ LL | inner: Foo | help: there is an enum variant `Baz::Foo`; try using the variant's enum | -LL | inner: Baz - | ~~~ +LL - inner: Foo +LL + inner: Baz + | error[E0412]: cannot find type `Foo` in this scope --> $DIR/issue-35075.rs:6:9 @@ -17,8 +18,9 @@ LL | Foo(Foo) | help: there is an enum variant `Baz::Foo`; try using the variant's enum | -LL | Foo(Baz) - | ~~~ +LL - Foo(Foo) +LL + Foo(Baz) + | error: aborting due to 2 previous errors diff --git a/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr b/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr index 70f9979556a3..a244d7604d7c 100644 --- a/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr +++ b/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr @@ -11,12 +11,14 @@ LL | #![deny(let_underscore_drop)] | ^^^^^^^^^^^^^^^^^^^ help: consider binding to an unused variable to avoid immediately dropping the value | -LL | let _unused = foo(); - | ~~~~~~~ +LL - let _ = foo(); +LL + let _unused = foo(); + | help: consider immediately dropping the value | -LL | drop(foo()); - | ~~~~~ + +LL - let _ = foo(); +LL + drop(foo()); + | error: aborting due to 1 previous error diff --git a/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr b/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr index e4b1872bba55..8773d5df4431 100644 --- a/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr +++ b/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr @@ -11,12 +11,14 @@ LL | #![deny(let_underscore_drop)] | ^^^^^^^^^^^^^^^^^^^ help: consider binding to an unused variable to avoid immediately dropping the value | -LL | let _unused = field; - | ~~~~~~~~~~~ +LL - _ = field; +LL + let _unused = field; + | help: consider immediately dropping the value | -LL | drop(field); - | ~~~~~ + +LL - _ = field; +LL + drop(field); + | error: non-binding let on a type that has a destructor --> $DIR/issue-119697-extra-let.rs:17:5 @@ -26,12 +28,14 @@ LL | let _ = field; | help: consider binding to an unused variable to avoid immediately dropping the value | -LL | let _unused = field; - | ~~~~~~~ +LL - let _ = field; +LL + let _unused = field; + | help: consider immediately dropping the value | -LL | drop(field); - | ~~~~~ + +LL - let _ = field; +LL + drop(field); + | error: aborting due to 2 previous errors diff --git a/tests/ui/lint/let_underscore/let_underscore_drop.stderr b/tests/ui/lint/let_underscore/let_underscore_drop.stderr index 09f2587063bb..c7984d629daa 100644 --- a/tests/ui/lint/let_underscore/let_underscore_drop.stderr +++ b/tests/ui/lint/let_underscore/let_underscore_drop.stderr @@ -11,12 +11,14 @@ LL | #![warn(let_underscore_drop)] | ^^^^^^^^^^^^^^^^^^^ help: consider binding to an unused variable to avoid immediately dropping the value | -LL | let _unused = NontrivialDrop; - | ~~~~~~~ +LL - let _ = NontrivialDrop; +LL + let _unused = NontrivialDrop; + | help: consider immediately dropping the value | -LL | drop(NontrivialDrop); - | ~~~~~ + +LL - let _ = NontrivialDrop; +LL + drop(NontrivialDrop); + | warning: 1 warning emitted diff --git a/tests/ui/lint/let_underscore/let_underscore_lock.stderr b/tests/ui/lint/let_underscore/let_underscore_lock.stderr index fb8b9ec22033..60d5ed649f5e 100644 --- a/tests/ui/lint/let_underscore/let_underscore_lock.stderr +++ b/tests/ui/lint/let_underscore/let_underscore_lock.stderr @@ -7,12 +7,14 @@ LL | let _ = data.lock().unwrap(); = note: `#[deny(let_underscore_lock)]` on by default help: consider binding to an unused variable to avoid immediately dropping the value | -LL | let _unused = data.lock().unwrap(); - | ~~~~~~~ +LL - let _ = data.lock().unwrap(); +LL + let _unused = data.lock().unwrap(); + | help: consider immediately dropping the value | -LL | drop(data.lock().unwrap()); - | ~~~~~ + +LL - let _ = data.lock().unwrap(); +LL + drop(data.lock().unwrap()); + | error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:12:9 @@ -22,12 +24,14 @@ LL | let _ = data.lock(); | help: consider binding to an unused variable to avoid immediately dropping the value | -LL | let _unused = data.lock(); - | ~~~~~~~ +LL - let _ = data.lock(); +LL + let _unused = data.lock(); + | help: consider immediately dropping the value | -LL | drop(data.lock()); - | ~~~~~ + +LL - let _ = data.lock(); +LL + drop(data.lock()); + | error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:14:10 @@ -38,8 +42,9 @@ LL | let (_, _) = (data.lock(), 1); = help: consider immediately dropping the value using `drop(..)` after the `let` statement help: consider binding to an unused variable to avoid immediately dropping the value | -LL | let (_unused, _) = (data.lock(), 1); - | ~~~~~~~ +LL - let (_, _) = (data.lock(), 1); +LL + let (_unused, _) = (data.lock(), 1); + | error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:16:26 @@ -50,8 +55,9 @@ LL | let (_a, Struct { a: _ }) = (0, Struct { a: data.lock() }); = help: consider immediately dropping the value using `drop(..)` after the `let` statement help: consider binding to an unused variable to avoid immediately dropping the value | -LL | let (_a, Struct { a: _unused }) = (0, Struct { a: data.lock() }); - | ~~~~~~~ +LL - let (_a, Struct { a: _ }) = (0, Struct { a: data.lock() }); +LL + let (_a, Struct { a: _unused }) = (0, Struct { a: data.lock() }); + | error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:18:6 diff --git a/tests/ui/lint/lint-strict-provenance-fuzzy-casts.stderr b/tests/ui/lint/lint-strict-provenance-fuzzy-casts.stderr index 24f2500abf82..f5eec6fc6566 100644 --- a/tests/ui/lint/lint-strict-provenance-fuzzy-casts.stderr +++ b/tests/ui/lint/lint-strict-provenance-fuzzy-casts.stderr @@ -12,8 +12,9 @@ LL | #![deny(fuzzy_provenance_casts)] | ^^^^^^^^^^^^^^^^^^^^^^ help: use `.with_addr()` to adjust a valid pointer in the same allocation, to this address | -LL | let dangling = (...).with_addr(16_usize); - | ++++++++++++++++ ~ +LL - let dangling = 16_usize as *const u8; +LL + let dangling = (...).with_addr(16_usize); + | error: aborting due to 1 previous error diff --git a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr index 390028b349e5..aeee69ae7afa 100644 --- a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr +++ b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr @@ -12,8 +12,9 @@ LL | #![deny(lossy_provenance_casts)] | ^^^^^^^^^^^^^^^^^^^^^^ help: use `.addr()` to obtain the address of a pointer | -LL | let addr: usize = (&x as *const u8).addr(); - | + ~~~~~~~~ +LL - let addr: usize = &x as *const u8 as usize; +LL + let addr: usize = (&x as *const u8).addr(); + | error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `u32` --> $DIR/lint-strict-provenance-lossy-casts.rs:9:22 @@ -24,8 +25,9 @@ LL | let addr_32bit = &x as *const u8 as u32; = help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_provenance()` instead help: use `.addr()` to obtain the address of a pointer | -LL | let addr_32bit = (&x as *const u8).addr() as u32; - | + ~~~~~~~~~~~~~~~ +LL - let addr_32bit = &x as *const u8 as u32; +LL + let addr_32bit = (&x as *const u8).addr() as u32; + | error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `usize` --> $DIR/lint-strict-provenance-lossy-casts.rs:14:20 diff --git a/tests/ui/lint/lint_map_unit_fn.stderr b/tests/ui/lint/lint_map_unit_fn.stderr index fbf689c54219..91542af0f6df 100644 --- a/tests/ui/lint/lint_map_unit_fn.stderr +++ b/tests/ui/lint/lint_map_unit_fn.stderr @@ -18,8 +18,9 @@ LL | #![deny(map_unit_fn)] | ^^^^^^^^^^^ help: you might have meant to use `Iterator::for_each` | -LL | x.iter_mut().for_each(foo); - | ~~~~~~~~ +LL - x.iter_mut().map(foo); +LL + x.iter_mut().for_each(foo); + | error: `Iterator::map` call that discard the iterator's values --> $DIR/lint_map_unit_fn.rs:11:18 @@ -41,8 +42,9 @@ LL | | | }); = note: `Iterator::map`, like many of the methods on `Iterator`, gets executed lazily, meaning that its effects won't be visible until it is iterated help: you might have meant to use `Iterator::for_each` | -LL | x.iter_mut().for_each(|items| { - | ~~~~~~~~ +LL - x.iter_mut().map(|items| { +LL + x.iter_mut().for_each(|items| { + | error: `Iterator::map` call that discard the iterator's values --> $DIR/lint_map_unit_fn.rs:18:18 @@ -59,8 +61,9 @@ LL | x.iter_mut().map(f); = note: `Iterator::map`, like many of the methods on `Iterator`, gets executed lazily, meaning that its effects won't be visible until it is iterated help: you might have meant to use `Iterator::for_each` | -LL | x.iter_mut().for_each(f); - | ~~~~~~~~ +LL - x.iter_mut().map(f); +LL + x.iter_mut().for_each(f); + | error: aborting due to 3 previous errors diff --git a/tests/ui/lint/non-snake-case/lint-non-snake-case-identifiers-suggestion-reserved.stderr b/tests/ui/lint/non-snake-case/lint-non-snake-case-identifiers-suggestion-reserved.stderr index 2841815ecf2b..ae2a00d3f90a 100644 --- a/tests/ui/lint/non-snake-case/lint-non-snake-case-identifiers-suggestion-reserved.stderr +++ b/tests/ui/lint/non-snake-case/lint-non-snake-case-identifiers-suggestion-reserved.stderr @@ -30,8 +30,9 @@ LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ help: rename the identifier or convert it to a snake case raw identifier | -LL | mod r#impl {} - | ~~~~~~ +LL - mod Impl {} +LL + mod r#impl {} + | error: function `While` should have a snake case name --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:8:4 @@ -41,8 +42,9 @@ LL | fn While() {} | help: rename the identifier or convert it to a snake case raw identifier | -LL | fn r#while() {} - | ~~~~~~~ +LL - fn While() {} +LL + fn r#while() {} + | error: variable `Mod` should have a snake case name --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:12:9 @@ -52,8 +54,9 @@ LL | let Mod: usize = 0; | help: rename the identifier or convert it to a snake case raw identifier | -LL | let r#mod: usize = 0; - | ~~~~~ +LL - let Mod: usize = 0; +LL + let r#mod: usize = 0; + | error: variable `Super` should have a snake case name --> $DIR/lint-non-snake-case-identifiers-suggestion-reserved.rs:16:9 diff --git a/tests/ui/lint/recommend-literal.stderr b/tests/ui/lint/recommend-literal.stderr index 424ecadd4b8c..263071ca9a75 100644 --- a/tests/ui/lint/recommend-literal.stderr +++ b/tests/ui/lint/recommend-literal.stderr @@ -33,12 +33,14 @@ LL | let v2: Bool = true; | help: a builtin type with a similar name exists | -LL | let v2: bool = true; - | ~~~~ +LL - let v2: Bool = true; +LL + let v2: bool = true; + | help: perhaps you intended to use this type | -LL | let v2: bool = true; - | ~~~~ +LL - let v2: Bool = true; +LL + let v2: bool = true; + | error[E0412]: cannot find type `boolean` in this scope --> $DIR/recommend-literal.rs:19:9 @@ -75,8 +77,9 @@ LL | depth: Option, | help: perhaps you intended to use this type | -LL | depth: Option, - | ~~~ +LL - depth: Option, +LL + depth: Option, + | help: you might be missing a type parameter | LL | struct Data { diff --git a/tests/ui/lint/static-mut-refs.e2021.stderr b/tests/ui/lint/static-mut-refs.e2021.stderr index 5a4e712b3c0d..abd579b336f0 100644 --- a/tests/ui/lint/static-mut-refs.e2021.stderr +++ b/tests/ui/lint/static-mut-refs.e2021.stderr @@ -9,8 +9,9 @@ LL | let _y = &X; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL | let _y = &raw const X; - | ~~~~~~~~~~ +LL - let _y = &X; +LL + let _y = &raw const X; + | warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:42:18 @@ -22,8 +23,9 @@ LL | let _y = &mut X; = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives help: use `&raw mut` instead to create a raw pointer | -LL | let _y = &raw mut X; - | ~~~~~~~~ +LL - let _y = &mut X; +LL + let _y = &raw mut X; + | warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:50:22 @@ -44,8 +46,9 @@ LL | let (_b, _c) = (&X, &Y); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL | let (_b, _c) = (&raw const X, &Y); - | ~~~~~~~~~~ +LL - let (_b, _c) = (&X, &Y); +LL + let (_b, _c) = (&raw const X, &Y); + | warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:54:29 @@ -57,8 +60,9 @@ LL | let (_b, _c) = (&X, &Y); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL | let (_b, _c) = (&X, &raw const Y); - | ~~~~~~~~~~ +LL - let (_b, _c) = (&X, &Y); +LL + let (_b, _c) = (&X, &raw const Y); + | warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:60:13 @@ -70,8 +74,9 @@ LL | foo(&X); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL | foo(&raw const X); - | ~~~~~~~~~~ +LL - foo(&X); +LL + foo(&raw const X); + | warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:66:17 @@ -101,8 +106,9 @@ LL | let _v = &A.value; = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL | let _v = &raw const A.value; - | ~~~~~~~~~~ +LL - let _v = &A.value; +LL + let _v = &raw const A.value; + | warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:80:18 @@ -114,8 +120,9 @@ LL | let _s = &A.s.value; = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL | let _s = &raw const A.s.value; - | ~~~~~~~~~~ +LL - let _s = &A.s.value; +LL + let _s = &raw const A.s.value; + | warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:84:22 diff --git a/tests/ui/lint/static-mut-refs.e2024.stderr b/tests/ui/lint/static-mut-refs.e2024.stderr index 1b549272bd5f..1387cdf0b324 100644 --- a/tests/ui/lint/static-mut-refs.e2024.stderr +++ b/tests/ui/lint/static-mut-refs.e2024.stderr @@ -9,8 +9,9 @@ LL | let _y = &X; = note: `#[deny(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL | let _y = &raw const X; - | ~~~~~~~~~~ +LL - let _y = &X; +LL + let _y = &raw const X; + | error: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:42:18 @@ -22,8 +23,9 @@ LL | let _y = &mut X; = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives help: use `&raw mut` instead to create a raw pointer | -LL | let _y = &raw mut X; - | ~~~~~~~~ +LL - let _y = &mut X; +LL + let _y = &raw mut X; + | error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:50:22 @@ -44,8 +46,9 @@ LL | let (_b, _c) = (&X, &Y); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL | let (_b, _c) = (&raw const X, &Y); - | ~~~~~~~~~~ +LL - let (_b, _c) = (&X, &Y); +LL + let (_b, _c) = (&raw const X, &Y); + | error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:54:29 @@ -57,8 +60,9 @@ LL | let (_b, _c) = (&X, &Y); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL | let (_b, _c) = (&X, &raw const Y); - | ~~~~~~~~~~ +LL - let (_b, _c) = (&X, &Y); +LL + let (_b, _c) = (&X, &raw const Y); + | error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:60:13 @@ -70,8 +74,9 @@ LL | foo(&X); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL | foo(&raw const X); - | ~~~~~~~~~~ +LL - foo(&X); +LL + foo(&raw const X); + | error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:66:17 @@ -101,8 +106,9 @@ LL | let _v = &A.value; = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL | let _v = &raw const A.value; - | ~~~~~~~~~~ +LL - let _v = &A.value; +LL + let _v = &raw const A.value; + | error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:80:18 @@ -114,8 +120,9 @@ LL | let _s = &A.s.value; = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL | let _s = &raw const A.s.value; - | ~~~~~~~~~~ +LL - let _s = &A.s.value; +LL + let _s = &raw const A.s.value; + | error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:84:22 diff --git a/tests/ui/lint/type-overflow.stderr b/tests/ui/lint/type-overflow.stderr index 9fdb05ed1c03..0ac67fddaa72 100644 --- a/tests/ui/lint/type-overflow.stderr +++ b/tests/ui/lint/type-overflow.stderr @@ -21,12 +21,14 @@ LL | let fail = 0b1000_0001i8; = note: the literal `0b1000_0001i8` (decimal `129`) does not fit into the type `i8` and will become `-127i8` help: consider using the type `u8` instead | -LL | let fail = 0b1000_0001u8; - | ~~~~~~~~~~~~~ +LL - let fail = 0b1000_0001i8; +LL + let fail = 0b1000_0001u8; + | help: to use as a negative number (decimal `-127`), consider using the type `u8` for the literal and cast it to `i8` | -LL | let fail = 0b1000_0001u8 as i8; - | ~~~~~~~~~~~~~~~~~~~ +LL - let fail = 0b1000_0001i8; +LL + let fail = 0b1000_0001u8 as i8; + | warning: literal out of range for `i64` --> $DIR/type-overflow.rs:15:16 @@ -37,12 +39,14 @@ LL | let fail = 0x8000_0000_0000_0000i64; = note: the literal `0x8000_0000_0000_0000i64` (decimal `9223372036854775808`) does not fit into the type `i64` and will become `-9223372036854775808i64` help: consider using the type `u64` instead | -LL | let fail = 0x8000_0000_0000_0000u64; - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let fail = 0x8000_0000_0000_0000i64; +LL + let fail = 0x8000_0000_0000_0000u64; + | help: to use as a negative number (decimal `-9223372036854775808`), consider using the type `u64` for the literal and cast it to `i64` | -LL | let fail = 0x8000_0000_0000_0000u64 as i64; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let fail = 0x8000_0000_0000_0000i64; +LL + let fail = 0x8000_0000_0000_0000u64 as i64; + | warning: literal out of range for `u32` --> $DIR/type-overflow.rs:19:16 @@ -62,8 +66,9 @@ LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000; = help: consider using the type `u128` instead help: to use as a negative number (decimal `-170141183460469231731687303715884105728`), consider using the type `u128` for the literal and cast it to `i128` | -LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000u128 as i128; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000; +LL + let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000u128 as i128; + | warning: literal out of range for `i32` --> $DIR/type-overflow.rs:27:16 @@ -112,8 +117,9 @@ LL | let fail = 0x8FFF_FFFF_FFFF_FFFE; = help: consider using the type `u64` instead help: to use as a negative number (decimal `-2`), consider using the type `u32` for the literal and cast it to `i32` | -LL | let fail = 0x8FFF_FFFF_FFFF_FFFEu32 as i32; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let fail = 0x8FFF_FFFF_FFFF_FFFE; +LL + let fail = 0x8FFF_FFFF_FFFF_FFFEu32 as i32; + | warning: literal out of range for `i8` --> $DIR/type-overflow.rs:46:17 diff --git a/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr b/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr index 8fc2d1bc88fd..8922f484d3e9 100644 --- a/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr +++ b/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr @@ -12,8 +12,9 @@ LL | #![deny(unused)] = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` help: try ignoring the field | -LL | A { i, j: _ } | B { i, j: _ } => { - | ~~~~ ~~~~ +LL - A { i, j } | B { i, j } => { +LL + A { i, j: _ } | B { i, j: _ } => { + | error: unused variable: `j` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:30:16 @@ -23,8 +24,9 @@ LL | A { i, ref j } | B { i, ref j } => { | help: try ignoring the field | -LL | A { i, j: _ } | B { i, j: _ } => { - | ~~~~ ~~~~ +LL - A { i, ref j } | B { i, ref j } => { +LL + A { i, j: _ } | B { i, j: _ } => { + | error: unused variable: `j` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:40:21 @@ -34,8 +36,9 @@ LL | Some(A { i, j } | B { i, j }) => { | help: try ignoring the field | -LL | Some(A { i, j: _ } | B { i, j: _ }) => { - | ~~~~ ~~~~ +LL - Some(A { i, j } | B { i, j }) => { +LL + Some(A { i, j: _ } | B { i, j: _ }) => { + | error: unused variable: `j` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:52:21 @@ -45,8 +48,9 @@ LL | Some(A { i, ref j } | B { i, ref j }) => { | help: try ignoring the field | -LL | Some(A { i, j: _ } | B { i, j: _ }) => { - | ~~~~ ~~~~ +LL - Some(A { i, ref j } | B { i, ref j }) => { +LL + Some(A { i, j: _ } | B { i, j: _ }) => { + | error: unused variable: `i` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:62:24 @@ -56,8 +60,9 @@ LL | MixedEnum::A { i } | MixedEnum::B(i) => { | help: try ignoring the field | -LL | MixedEnum::A { i: _ } | MixedEnum::B(_) => { - | ~~~~ ~ +LL - MixedEnum::A { i } | MixedEnum::B(i) => { +LL + MixedEnum::A { i: _ } | MixedEnum::B(_) => { + | error: unused variable: `i` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:70:24 @@ -67,8 +72,9 @@ LL | MixedEnum::A { ref i } | MixedEnum::B(ref i) => { | help: try ignoring the field | -LL | MixedEnum::A { i: _ } | MixedEnum::B(_) => { - | ~~~~ ~ +LL - MixedEnum::A { ref i } | MixedEnum::B(ref i) => { +LL + MixedEnum::A { i: _ } | MixedEnum::B(_) => { + | error: aborting due to 6 previous errors diff --git a/tests/ui/lint/wide_pointer_comparisons.stderr b/tests/ui/lint/wide_pointer_comparisons.stderr index 78548e308ed5..f5f8060902bd 100644 --- a/tests/ui/lint/wide_pointer_comparisons.stderr +++ b/tests/ui/lint/wide_pointer_comparisons.stderr @@ -7,8 +7,9 @@ LL | let _ = a == b; = note: `#[warn(ambiguous_wide_pointer_comparisons)]` on by default help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a, b); - | ++++++++++++++++++ ~ + +LL - let _ = a == b; +LL + let _ = std::ptr::addr_eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:22:13 @@ -18,8 +19,9 @@ LL | let _ = a != b; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(a, b); - | +++++++++++++++++++ ~ + +LL - let _ = a != b; +LL + let _ = !std::ptr::addr_eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:24:13 @@ -73,8 +75,9 @@ LL | let _ = PartialEq::eq(&a, &b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a, b); - | ~~~~~~~~~~~~~~~~~~ ~ +LL - let _ = PartialEq::eq(&a, &b); +LL + let _ = std::ptr::addr_eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:35:13 @@ -84,8 +87,9 @@ LL | let _ = PartialEq::ne(&a, &b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(a, b); - | ~~~~~~~~~~~~~~~~~~~ ~ +LL - let _ = PartialEq::ne(&a, &b); +LL + let _ = !std::ptr::addr_eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:37:13 @@ -95,8 +99,9 @@ LL | let _ = a.eq(&b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a, b); - | ++++++++++++++++++ ~ +LL - let _ = a.eq(&b); +LL + let _ = std::ptr::addr_eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:39:13 @@ -106,8 +111,9 @@ LL | let _ = a.ne(&b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(a, b); - | +++++++++++++++++++ ~ +LL - let _ = a.ne(&b); +LL + let _ = !std::ptr::addr_eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:41:13 @@ -183,8 +189,9 @@ LL | let _ = a == b; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a.as_ptr(), b.as_ptr()); - | ++++++++++++++++++ ~~~~~~~~~~ ++++++++++ +LL - let _ = a == b; +LL + let _ = std::ptr::addr_eq(a.as_ptr(), b.as_ptr()); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:59:17 @@ -205,8 +212,9 @@ LL | let _ = &a == &b; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a.as_ptr(), b.as_ptr()); - | ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ++++++++++ +LL - let _ = &a == &b; +LL + let _ = std::ptr::addr_eq(a.as_ptr(), b.as_ptr()); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:70:17 @@ -216,8 +224,9 @@ LL | let _ = a == b; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(*a, *b); - | +++++++++++++++++++ ~~~ + +LL - let _ = a == b; +LL + let _ = std::ptr::addr_eq(*a, *b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:72:17 @@ -227,8 +236,9 @@ LL | let _ = a != b; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(*a, *b); - | ++++++++++++++++++++ ~~~ + +LL - let _ = a != b; +LL + let _ = !std::ptr::addr_eq(*a, *b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:74:17 @@ -282,8 +292,9 @@ LL | let _ = PartialEq::eq(a, b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(*a, *b); - | ~~~~~~~~~~~~~~~~~~~ ~~~ +LL - let _ = PartialEq::eq(a, b); +LL + let _ = std::ptr::addr_eq(*a, *b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:85:17 @@ -293,8 +304,9 @@ LL | let _ = PartialEq::ne(a, b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(*a, *b); - | ~~~~~~~~~~~~~~~~~~~~ ~~~ +LL - let _ = PartialEq::ne(a, b); +LL + let _ = !std::ptr::addr_eq(*a, *b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:87:17 @@ -304,8 +316,9 @@ LL | let _ = PartialEq::eq(&a, &b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(*a, *b); - | ~~~~~~~~~~~~~~~~~~~ ~~~ +LL - let _ = PartialEq::eq(&a, &b); +LL + let _ = std::ptr::addr_eq(*a, *b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:89:17 @@ -315,8 +328,9 @@ LL | let _ = PartialEq::ne(&a, &b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(*a, *b); - | ~~~~~~~~~~~~~~~~~~~~ ~~~ +LL - let _ = PartialEq::ne(&a, &b); +LL + let _ = !std::ptr::addr_eq(*a, *b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:91:17 @@ -326,8 +340,9 @@ LL | let _ = a.eq(b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(*a, *b); - | +++++++++++++++++++ ~~~ +LL - let _ = a.eq(b); +LL + let _ = std::ptr::addr_eq(*a, *b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:93:17 @@ -337,8 +352,9 @@ LL | let _ = a.ne(b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(*a, *b); - | ++++++++++++++++++++ ~~~ +LL - let _ = a.ne(b); +LL + let _ = !std::ptr::addr_eq(*a, *b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:95:17 @@ -414,12 +430,14 @@ LL | let _ = s == s; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(s, s); - | ++++++++++++++++++ ~ + +LL - let _ = s == s; +LL + let _ = std::ptr::addr_eq(s, s); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = std::ptr::eq(s, s); - | +++++++++++++ ~ + +LL - let _ = s == s; +LL + let _ = std::ptr::eq(s, s); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:114:13 @@ -429,12 +447,14 @@ LL | let _ = s == s; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(s, s); - | ++++++++++++++++++ ~ + +LL - let _ = s == s; +LL + let _ = std::ptr::addr_eq(s, s); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = std::ptr::eq(s, s); - | +++++++++++++ ~ + +LL - let _ = s == s; +LL + let _ = std::ptr::eq(s, s); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:118:17 @@ -444,12 +464,14 @@ LL | let _ = a == b; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a, b); - | ++++++++++++++++++ ~ + +LL - let _ = a == b; +LL + let _ = std::ptr::addr_eq(a, b); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = std::ptr::eq(a, b); - | +++++++++++++ ~ + +LL - let _ = a == b; +LL + let _ = std::ptr::eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:120:17 @@ -459,12 +481,14 @@ LL | let _ = a != b; | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(a, b); - | +++++++++++++++++++ ~ + +LL - let _ = a != b; +LL + let _ = !std::ptr::addr_eq(a, b); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = !std::ptr::eq(a, b); - | ++++++++++++++ ~ + +LL - let _ = a != b; +LL + let _ = !std::ptr::eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:122:17 @@ -518,12 +542,14 @@ LL | let _ = PartialEq::eq(&a, &b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a, b); - | ~~~~~~~~~~~~~~~~~~ ~ +LL - let _ = PartialEq::eq(&a, &b); +LL + let _ = std::ptr::addr_eq(a, b); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = std::ptr::eq(a, b); - | ~~~~~~~~~~~~~ ~ +LL - let _ = PartialEq::eq(&a, &b); +LL + let _ = std::ptr::eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:133:17 @@ -533,12 +559,14 @@ LL | let _ = PartialEq::ne(&a, &b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(a, b); - | ~~~~~~~~~~~~~~~~~~~ ~ +LL - let _ = PartialEq::ne(&a, &b); +LL + let _ = !std::ptr::addr_eq(a, b); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = !std::ptr::eq(a, b); - | ~~~~~~~~~~~~~~ ~ +LL - let _ = PartialEq::ne(&a, &b); +LL + let _ = !std::ptr::eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:135:17 @@ -548,12 +576,14 @@ LL | let _ = a.eq(&b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = std::ptr::addr_eq(a, b); - | ++++++++++++++++++ ~ +LL - let _ = a.eq(&b); +LL + let _ = std::ptr::addr_eq(a, b); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = std::ptr::eq(a, b); - | +++++++++++++ ~ +LL - let _ = a.eq(&b); +LL + let _ = std::ptr::eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:137:17 @@ -563,12 +593,14 @@ LL | let _ = a.ne(&b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | let _ = !std::ptr::addr_eq(a, b); - | +++++++++++++++++++ ~ +LL - let _ = a.ne(&b); +LL + let _ = !std::ptr::addr_eq(a, b); + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | let _ = !std::ptr::eq(a, b); - | ++++++++++++++ ~ +LL - let _ = a.ne(&b); +LL + let _ = !std::ptr::eq(a, b); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:142:9 @@ -578,12 +610,14 @@ LL | &*a == &*b | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | std::ptr::addr_eq(*a, *b) - | ~~~~~~~~~~~~~~~~~~ ~ + +LL - &*a == &*b +LL + std::ptr::addr_eq(*a, *b) + | help: use explicit `std::ptr::eq` method to compare metadata and addresses | -LL | std::ptr::eq(*a, *b) - | ~~~~~~~~~~~~~ ~ + +LL - &*a == &*b +LL + std::ptr::eq(*a, *b) + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:153:14 @@ -593,8 +627,9 @@ LL | cmp!(a, b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | cmp!(std::ptr::addr_eq(a, b)); - | ++++++++++++++++++ + +LL - cmp!(a, b); +LL + cmp!(std::ptr::addr_eq(a, b)); + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:159:39 @@ -608,8 +643,9 @@ LL | cmp!(a, b); = note: this warning originates in the macro `cmp` (in Nightly builds, run with -Z macro-backtrace for more info) help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL | ($a:ident, $b:ident) => { std::ptr::addr_eq($a, $b) } - | ++++++++++++++++++ ~ + +LL - ($a:ident, $b:ident) => { $a == $b } +LL + ($a:ident, $b:ident) => { std::ptr::addr_eq($a, $b) } + | warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:169:37 diff --git a/tests/ui/loops/loop-break-value-no-repeat.stderr b/tests/ui/loops/loop-break-value-no-repeat.stderr index 946057d05439..918ea81a2ed5 100644 --- a/tests/ui/loops/loop-break-value-no-repeat.stderr +++ b/tests/ui/loops/loop-break-value-no-repeat.stderr @@ -8,8 +8,9 @@ LL | break 22 | help: use `break` on its own without a value inside this `for` loop | -LL | break - | ~~~~~ +LL - break 22 +LL + break + | error: aborting due to 1 previous error diff --git a/tests/ui/loops/loop-break-value.stderr b/tests/ui/loops/loop-break-value.stderr index 0912bdbb221e..3b9735510bd7 100644 --- a/tests/ui/loops/loop-break-value.stderr +++ b/tests/ui/loops/loop-break-value.stderr @@ -46,12 +46,14 @@ LL | break (); | help: use `break` on its own without a value inside this `while` loop | -LL | break; - | ~~~~~ +LL - break (); +LL + break; + | help: alternatively, you might have meant to use the available loop label | -LL | break 'while_loop; - | ~~~~~~~~~~~ +LL - break (); +LL + break 'while_loop; + | error[E0571]: `break` with value from a `while` loop --> $DIR/loop-break-value.rs:34:13 @@ -64,8 +66,9 @@ LL | break 'while_loop 123; | help: use `break` on its own without a value inside this `while` loop | -LL | break 'while_loop; - | ~~~~~~~~~~~~~~~~~ +LL - break 'while_loop 123; +LL + break 'while_loop; + | error[E0571]: `break` with value from a `while` loop --> $DIR/loop-break-value.rs:42:12 @@ -77,8 +80,9 @@ LL | if break () { | help: use `break` on its own without a value inside this `while` loop | -LL | if break { - | ~~~~~ +LL - if break () { +LL + if break { + | error[E0571]: `break` with value from a `while` loop --> $DIR/loop-break-value.rs:47:9 @@ -90,8 +94,9 @@ LL | break None; | help: use `break` on its own without a value inside this `while` loop | -LL | break; - | ~~~~~ +LL - break None; +LL + break; + | error[E0571]: `break` with value from a `while` loop --> $DIR/loop-break-value.rs:53:13 @@ -104,8 +109,9 @@ LL | break 'while_let_loop "nope"; | help: use `break` on its own without a value inside this `while` loop | -LL | break 'while_let_loop; - | ~~~~~~~~~~~~~~~~~~~~~ +LL - break 'while_let_loop "nope"; +LL + break 'while_let_loop; + | error[E0571]: `break` with value from a `for` loop --> $DIR/loop-break-value.rs:60:9 @@ -117,8 +123,9 @@ LL | break (); | help: use `break` on its own without a value inside this `for` loop | -LL | break; - | ~~~~~ +LL - break (); +LL + break; + | error[E0571]: `break` with value from a `for` loop --> $DIR/loop-break-value.rs:61:9 @@ -131,8 +138,9 @@ LL | break [()]; | help: use `break` on its own without a value inside this `for` loop | -LL | break; - | ~~~~~ +LL - break [()]; +LL + break; + | error[E0571]: `break` with value from a `for` loop --> $DIR/loop-break-value.rs:68:13 @@ -145,8 +153,9 @@ LL | break 'for_loop Some(17); | help: use `break` on its own without a value inside this `for` loop | -LL | break 'for_loop; - | ~~~~~~~~~~~~~~~ +LL - break 'for_loop Some(17); +LL + break 'for_loop; + | error[E0308]: mismatched types --> $DIR/loop-break-value.rs:4:31 diff --git a/tests/ui/macros/expand-full-no-resolution.stderr b/tests/ui/macros/expand-full-no-resolution.stderr index df6f20332bfd..b836ac51ad9e 100644 --- a/tests/ui/macros/expand-full-no-resolution.stderr +++ b/tests/ui/macros/expand-full-no-resolution.stderr @@ -9,8 +9,9 @@ LL | format_args!(a!()); | help: the leading underscore in `_a` marks it as unused, consider renaming it to `a` | -LL | macro_rules! a { - | ~ +LL - macro_rules! _a { +LL + macro_rules! a { + | error: cannot find macro `a` in this scope --> $DIR/expand-full-no-resolution.rs:19:10 @@ -23,8 +24,9 @@ LL | env!(a!()); | help: the leading underscore in `_a` marks it as unused, consider renaming it to `a` | -LL | macro_rules! a { - | ~ +LL - macro_rules! _a { +LL + macro_rules! a { + | error: aborting due to 2 previous errors diff --git a/tests/ui/macros/expr_2021_cargo_fix_edition.stderr b/tests/ui/macros/expr_2021_cargo_fix_edition.stderr index fe1fd4a26a02..8ab6938fe19c 100644 --- a/tests/ui/macros/expr_2021_cargo_fix_edition.stderr +++ b/tests/ui/macros/expr_2021_cargo_fix_edition.stderr @@ -13,8 +13,9 @@ LL | #![warn(edition_2024_expr_fragment_specifier)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: to keep the existing behavior, use the `expr_2021` fragment specifier | -LL | ($e:expr_2021) => { - | ~~~~~~~~~ +LL - ($e:expr) => { +LL + ($e:expr_2021) => { + | warning: the `expr` fragment specifier will accept more expressions in the 2024 edition --> $DIR/expr_2021_cargo_fix_edition.rs:11:11 @@ -26,8 +27,9 @@ LL | ($($i:expr)*) => { }; = note: for more information, see Migration Guide help: to keep the existing behavior, use the `expr_2021` fragment specifier | -LL | ($($i:expr_2021)*) => { }; - | ~~~~~~~~~ +LL - ($($i:expr)*) => { }; +LL + ($($i:expr_2021)*) => { }; + | warning: 2 warnings emitted diff --git a/tests/ui/macros/format-foreign.stderr b/tests/ui/macros/format-foreign.stderr index 7971c2ab2b9b..ccb6583615cf 100644 --- a/tests/ui/macros/format-foreign.stderr +++ b/tests/ui/macros/format-foreign.stderr @@ -11,8 +11,9 @@ LL | println!("%.*3$s %s!\n", "Hello,", "World", 4); = note: printf formatting is not supported; see the documentation for `std::fmt` help: format specifiers use curly braces | -LL | println!("{:.2$} {}!\n", "Hello,", "World", 4); - | ~~~~~~ ~~ +LL - println!("%.*3$s %s!\n", "Hello,", "World", 4); +LL + println!("{:.2$} {}!\n", "Hello,", "World", 4); + | error: argument never used --> $DIR/format-foreign.rs:3:29 @@ -75,8 +76,9 @@ LL | println!("$1 $0 $$ $NAME", 1, 2, NAME=3); = note: shell formatting is not supported; see the documentation for `std::fmt` help: format specifiers use curly braces | -LL | println!("{1} {0} $$ {NAME}", 1, 2, NAME=3); - | ~~~ ~~~ ~~~~~~ +LL - println!("$1 $0 $$ $NAME", 1, 2, NAME=3); +LL + println!("{1} {0} $$ {NAME}", 1, 2, NAME=3); + | error: aborting due to 6 previous errors diff --git a/tests/ui/macros/issue-103529.stderr b/tests/ui/macros/issue-103529.stderr index 61e322afc770..985d9ace8186 100644 --- a/tests/ui/macros/issue-103529.stderr +++ b/tests/ui/macros/issue-103529.stderr @@ -21,8 +21,9 @@ LL | m! { auto x } | help: write `let` instead of `auto` to introduce a new variable | -LL | m! { let x } - | ~~~ +LL - m! { auto x } +LL + m! { let x } + | error: invalid variable declaration --> $DIR/issue-103529.rs:10:6 @@ -32,8 +33,9 @@ LL | m! { var x } | help: write `let` instead of `var` to introduce a new variable | -LL | m! { let x } - | ~~~ +LL - m! { var x } +LL + m! { let x } + | error: aborting due to 4 previous errors diff --git a/tests/ui/macros/issue-109237.stderr b/tests/ui/macros/issue-109237.stderr index a335786df864..9d25420af256 100644 --- a/tests/ui/macros/issue-109237.stderr +++ b/tests/ui/macros/issue-109237.stderr @@ -11,8 +11,9 @@ LL | let _ = statement!(); = note: this error originates in the macro `statement` (in Nightly builds, run with -Z macro-backtrace for more info) help: surround the macro invocation with `{}` to interpret the expansion as a statement | -LL | let _ = { statement!(); }; - | ~~~~~~~~~~~~~~~~~ +LL - let _ = statement!(); +LL + let _ = { statement!(); }; + | error: aborting due to 1 previous error diff --git a/tests/ui/macros/issue-118786.stderr b/tests/ui/macros/issue-118786.stderr index 7fa5c2b83ddd..af4cc9ad8637 100644 --- a/tests/ui/macros/issue-118786.stderr +++ b/tests/ui/macros/issue-118786.stderr @@ -6,8 +6,9 @@ LL | make_macro!((meow)); | help: change the delimiters to curly braces | -LL | make_macro!({meow}); - | ~ ~ +LL - make_macro!((meow)); +LL + make_macro!({meow}); + | help: add a semicolon | LL | macro_rules! $macro_name; { diff --git a/tests/ui/macros/issue-99265.stderr b/tests/ui/macros/issue-99265.stderr index 9185dbff61ee..a4200bf02cfe 100644 --- a/tests/ui/macros/issue-99265.stderr +++ b/tests/ui/macros/issue-99265.stderr @@ -74,8 +74,9 @@ LL | println!("Hello {:1$}!", "x", width = 5); | help: use the named argument by name to avoid ambiguity | -LL | println!("Hello {:width$}!", "x", width = 5); - | ~~~~~~ +LL - println!("Hello {:1$}!", "x", width = 5); +LL + println!("Hello {:width$}!", "x", width = 5); + | warning: named argument `f` is not used by name --> $DIR/issue-99265.rs:23:33 @@ -100,8 +101,9 @@ LL | println!("Hello {:1$.2$}!", f = 0.02f32, width = 5, precision = 2); | help: use the named argument by name to avoid ambiguity | -LL | println!("Hello {:1$.precision$}!", f = 0.02f32, width = 5, precision = 2); - | ~~~~~~~~~~ +LL - println!("Hello {:1$.2$}!", f = 0.02f32, width = 5, precision = 2); +LL + println!("Hello {:1$.precision$}!", f = 0.02f32, width = 5, precision = 2); + | warning: named argument `width` is not used by name --> $DIR/issue-99265.rs:23:46 @@ -113,8 +115,9 @@ LL | println!("Hello {:1$.2$}!", f = 0.02f32, width = 5, precision = 2); | help: use the named argument by name to avoid ambiguity | -LL | println!("Hello {:width$.2$}!", f = 0.02f32, width = 5, precision = 2); - | ~~~~~~ +LL - println!("Hello {:1$.2$}!", f = 0.02f32, width = 5, precision = 2); +LL + println!("Hello {:width$.2$}!", f = 0.02f32, width = 5, precision = 2); + | warning: named argument `f` is not used by name --> $DIR/issue-99265.rs:31:34 @@ -126,8 +129,9 @@ LL | println!("Hello {0:1$.2$}!", f = 0.02f32, width = 5, precision = 2); | help: use the named argument by name to avoid ambiguity | -LL | println!("Hello {f:1$.2$}!", f = 0.02f32, width = 5, precision = 2); - | ~ +LL - println!("Hello {0:1$.2$}!", f = 0.02f32, width = 5, precision = 2); +LL + println!("Hello {f:1$.2$}!", f = 0.02f32, width = 5, precision = 2); + | warning: named argument `precision` is not used by name --> $DIR/issue-99265.rs:31:58 @@ -139,8 +143,9 @@ LL | println!("Hello {0:1$.2$}!", f = 0.02f32, width = 5, precision = 2); | help: use the named argument by name to avoid ambiguity | -LL | println!("Hello {0:1$.precision$}!", f = 0.02f32, width = 5, precision = 2); - | ~~~~~~~~~~ +LL - println!("Hello {0:1$.2$}!", f = 0.02f32, width = 5, precision = 2); +LL + println!("Hello {0:1$.precision$}!", f = 0.02f32, width = 5, precision = 2); + | warning: named argument `width` is not used by name --> $DIR/issue-99265.rs:31:47 @@ -152,8 +157,9 @@ LL | println!("Hello {0:1$.2$}!", f = 0.02f32, width = 5, precision = 2); | help: use the named argument by name to avoid ambiguity | -LL | println!("Hello {0:width$.2$}!", f = 0.02f32, width = 5, precision = 2); - | ~~~~~~ +LL - println!("Hello {0:1$.2$}!", f = 0.02f32, width = 5, precision = 2); +LL + println!("Hello {0:width$.2$}!", f = 0.02f32, width = 5, precision = 2); + | warning: named argument `f` is not used by name --> $DIR/issue-99265.rs:49:9 @@ -166,8 +172,9 @@ LL | f = 0.02f32, | help: use the named argument by name to avoid ambiguity | -LL | "{}, Hello {f:2$.3$} {4:5$.6$}! {1}", - | ~ +LL - "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", +LL + "{}, Hello {f:2$.3$} {4:5$.6$}! {1}", + | warning: named argument `precision` is not used by name --> $DIR/issue-99265.rs:54:9 @@ -180,8 +187,9 @@ LL | precision = 2, | help: use the named argument by name to avoid ambiguity | -LL | "{}, Hello {1:2$.precision$} {4:5$.6$}! {1}", - | ~~~~~~~~~~ +LL - "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", +LL + "{}, Hello {1:2$.precision$} {4:5$.6$}! {1}", + | warning: named argument `width` is not used by name --> $DIR/issue-99265.rs:52:9 @@ -194,8 +202,9 @@ LL | width = 5, | help: use the named argument by name to avoid ambiguity | -LL | "{}, Hello {1:width$.3$} {4:5$.6$}! {1}", - | ~~~~~~ +LL - "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", +LL + "{}, Hello {1:width$.3$} {4:5$.6$}! {1}", + | warning: named argument `g` is not used by name --> $DIR/issue-99265.rs:56:9 @@ -208,8 +217,9 @@ LL | g = 0.02f32, | help: use the named argument by name to avoid ambiguity | -LL | "{}, Hello {1:2$.3$} {g:5$.6$}! {1}", - | ~ +LL - "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", +LL + "{}, Hello {1:2$.3$} {g:5$.6$}! {1}", + | warning: named argument `precision2` is not used by name --> $DIR/issue-99265.rs:60:9 @@ -222,8 +232,9 @@ LL | precision2 = 2 | help: use the named argument by name to avoid ambiguity | -LL | "{}, Hello {1:2$.3$} {4:5$.precision2$}! {1}", - | ~~~~~~~~~~~ +LL - "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", +LL + "{}, Hello {1:2$.3$} {4:5$.precision2$}! {1}", + | warning: named argument `width2` is not used by name --> $DIR/issue-99265.rs:58:9 @@ -236,8 +247,9 @@ LL | width2 = 5, | help: use the named argument by name to avoid ambiguity | -LL | "{}, Hello {1:2$.3$} {4:width2$.6$}! {1}", - | ~~~~~~~ +LL - "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", +LL + "{}, Hello {1:2$.3$} {4:width2$.6$}! {1}", + | warning: named argument `f` is not used by name --> $DIR/issue-99265.rs:49:9 @@ -250,8 +262,9 @@ LL | f = 0.02f32, | help: use the named argument by name to avoid ambiguity | -LL | "{}, Hello {1:2$.3$} {4:5$.6$}! {f}", - | ~ +LL - "{}, Hello {1:2$.3$} {4:5$.6$}! {1}", +LL + "{}, Hello {1:2$.3$} {4:5$.6$}! {f}", + | warning: named argument `f` is not used by name --> $DIR/issue-99265.rs:64:31 @@ -276,8 +289,9 @@ LL | println!("Hello {0:0.1}!", f = 0.02f32); | help: use the named argument by name to avoid ambiguity | -LL | println!("Hello {f:0.1}!", f = 0.02f32); - | ~ +LL - println!("Hello {0:0.1}!", f = 0.02f32); +LL + println!("Hello {f:0.1}!", f = 0.02f32); + | warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:79:23 @@ -302,8 +316,9 @@ LL | println!("{:0$}", v = val); | help: use the named argument by name to avoid ambiguity | -LL | println!("{:v$}", v = val); - | ~~ +LL - println!("{:0$}", v = val); +LL + println!("{:v$}", v = val); + | warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:84:24 @@ -315,8 +330,9 @@ LL | println!("{0:0$}", v = val); | help: use the named argument by name to avoid ambiguity | -LL | println!("{v:0$}", v = val); - | ~ +LL - println!("{0:0$}", v = val); +LL + println!("{v:0$}", v = val); + | warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:84:24 @@ -328,8 +344,9 @@ LL | println!("{0:0$}", v = val); | help: use the named argument by name to avoid ambiguity | -LL | println!("{0:v$}", v = val); - | ~~ +LL - println!("{0:0$}", v = val); +LL + println!("{0:v$}", v = val); + | warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:89:26 @@ -354,8 +371,9 @@ LL | println!("{:0$.0$}", v = val); | help: use the named argument by name to avoid ambiguity | -LL | println!("{:0$.v$}", v = val); - | ~~ +LL - println!("{:0$.0$}", v = val); +LL + println!("{:0$.v$}", v = val); + | warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:89:26 @@ -367,8 +385,9 @@ LL | println!("{:0$.0$}", v = val); | help: use the named argument by name to avoid ambiguity | -LL | println!("{:v$.0$}", v = val); - | ~~ +LL - println!("{:0$.0$}", v = val); +LL + println!("{:v$.0$}", v = val); + | warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:96:27 @@ -380,8 +399,9 @@ LL | println!("{0:0$.0$}", v = val); | help: use the named argument by name to avoid ambiguity | -LL | println!("{v:0$.0$}", v = val); - | ~ +LL - println!("{0:0$.0$}", v = val); +LL + println!("{v:0$.0$}", v = val); + | warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:96:27 @@ -393,8 +413,9 @@ LL | println!("{0:0$.0$}", v = val); | help: use the named argument by name to avoid ambiguity | -LL | println!("{0:0$.v$}", v = val); - | ~~ +LL - println!("{0:0$.0$}", v = val); +LL + println!("{0:0$.v$}", v = val); + | warning: named argument `v` is not used by name --> $DIR/issue-99265.rs:96:27 @@ -406,8 +427,9 @@ LL | println!("{0:0$.0$}", v = val); | help: use the named argument by name to avoid ambiguity | -LL | println!("{0:v$.0$}", v = val); - | ~~ +LL - println!("{0:0$.0$}", v = val); +LL + println!("{0:v$.0$}", v = val); + | warning: named argument `a` is not used by name --> $DIR/issue-99265.rs:104:28 @@ -432,8 +454,9 @@ LL | println!("{} {a} {0}", a = 1); | help: use the named argument by name to avoid ambiguity | -LL | println!("{} {a} {a}", a = 1); - | ~ +LL - println!("{} {a} {0}", a = 1); +LL + println!("{} {a} {a}", a = 1); + | warning: named argument `a` is not used by name --> $DIR/issue-99265.rs:115:14 @@ -460,8 +483,9 @@ LL | a = 1.0, b = 1, c = 2, | help: use the named argument by name to avoid ambiguity | -LL | {:1$.c$}", - | ~~ +LL - {:1$.2$}", +LL + {:1$.c$}", + | warning: named argument `b` is not used by name --> $DIR/issue-99265.rs:115:23 @@ -474,8 +498,9 @@ LL | a = 1.0, b = 1, c = 2, | help: use the named argument by name to avoid ambiguity | -LL | {:b$.2$}", - | ~~ +LL - {:1$.2$}", +LL + {:b$.2$}", + | warning: named argument `a` is not used by name --> $DIR/issue-99265.rs:126:14 @@ -488,8 +513,9 @@ LL | a = 1.0, b = 1, c = 2, | help: use the named argument by name to avoid ambiguity | -LL | {a:1$.2$}", - | ~ +LL - {0:1$.2$}", +LL + {a:1$.2$}", + | warning: named argument `c` is not used by name --> $DIR/issue-99265.rs:126:30 @@ -502,8 +528,9 @@ LL | a = 1.0, b = 1, c = 2, | help: use the named argument by name to avoid ambiguity | -LL | {0:1$.c$}", - | ~~ +LL - {0:1$.2$}", +LL + {0:1$.c$}", + | warning: named argument `b` is not used by name --> $DIR/issue-99265.rs:126:23 @@ -516,8 +543,9 @@ LL | a = 1.0, b = 1, c = 2, | help: use the named argument by name to avoid ambiguity | -LL | {0:b$.2$}", - | ~~ +LL - {0:1$.2$}", +LL + {0:b$.2$}", + | warning: named argument `x` is not used by name --> $DIR/issue-99265.rs:132:30 @@ -542,8 +570,9 @@ LL | println!("{{{:1$.2$}}}", x = 1.0, width = 3, precision = 2); | help: use the named argument by name to avoid ambiguity | -LL | println!("{{{:1$.precision$}}}", x = 1.0, width = 3, precision = 2); - | ~~~~~~~~~~ +LL - println!("{{{:1$.2$}}}", x = 1.0, width = 3, precision = 2); +LL + println!("{{{:1$.precision$}}}", x = 1.0, width = 3, precision = 2); + | warning: named argument `width` is not used by name --> $DIR/issue-99265.rs:132:39 @@ -555,8 +584,9 @@ LL | println!("{{{:1$.2$}}}", x = 1.0, width = 3, precision = 2); | help: use the named argument by name to avoid ambiguity | -LL | println!("{{{:width$.2$}}}", x = 1.0, width = 3, precision = 2); - | ~~~~~~ +LL - println!("{{{:1$.2$}}}", x = 1.0, width = 3, precision = 2); +LL + println!("{{{:width$.2$}}}", x = 1.0, width = 3, precision = 2); + | warning: 42 warnings emitted diff --git a/tests/ui/macros/macro-backtrace-invalid-internals.stderr b/tests/ui/macros/macro-backtrace-invalid-internals.stderr index aa8f06a0df13..bb8250d58b06 100644 --- a/tests/ui/macros/macro-backtrace-invalid-internals.stderr +++ b/tests/ui/macros/macro-backtrace-invalid-internals.stderr @@ -43,8 +43,9 @@ LL | real_method_stmt!(); = note: this error originates in the macro `real_method_stmt` (in Nightly builds, run with -Z macro-backtrace for more info) help: you must specify a concrete type for this numeric value, like `f32` | -LL | 2.0_f32.neg() - | ~~~~~~~ +LL - 2.0.neg() +LL + 2.0_f32.neg() + | error[E0599]: no method named `fake` found for type `{integer}` in the current scope --> $DIR/macro-backtrace-invalid-internals.rs:23:13 @@ -91,8 +92,9 @@ LL | let _ = real_method_expr!(); = note: this error originates in the macro `real_method_expr` (in Nightly builds, run with -Z macro-backtrace for more info) help: you must specify a concrete type for this numeric value, like `f32` | -LL | 2.0_f32.neg() - | ~~~~~~~ +LL - 2.0.neg() +LL + 2.0_f32.neg() + | error: aborting due to 8 previous errors diff --git a/tests/ui/macros/macro-inner-attributes.stderr b/tests/ui/macros/macro-inner-attributes.stderr index 947e33b08f4a..d74b64db5aca 100644 --- a/tests/ui/macros/macro-inner-attributes.stderr +++ b/tests/ui/macros/macro-inner-attributes.stderr @@ -6,8 +6,9 @@ LL | a::bar(); | help: there is a crate or module with a similar name | -LL | b::bar(); - | ~ +LL - a::bar(); +LL + b::bar(); + | error: aborting due to 1 previous error diff --git a/tests/ui/macros/macro-use-wrong-name.stderr b/tests/ui/macros/macro-use-wrong-name.stderr index 89345866be80..c7f214db225b 100644 --- a/tests/ui/macros/macro-use-wrong-name.stderr +++ b/tests/ui/macros/macro-use-wrong-name.stderr @@ -11,8 +11,9 @@ LL | macro_rules! macro_one { () => ("one") } | help: a macro with a similar name exists | -LL | macro_one!(); - | ~~~~~~~~~ +LL - macro_two!(); +LL + macro_one!(); + | help: consider importing this macro | LL + use two_macros::macro_two; diff --git a/tests/ui/macros/recovery-allowed.stderr b/tests/ui/macros/recovery-allowed.stderr index 825f7a8faf8e..00bc65ed9148 100644 --- a/tests/ui/macros/recovery-allowed.stderr +++ b/tests/ui/macros/recovery-allowed.stderr @@ -6,8 +6,9 @@ LL | please_recover! { not 1 } | help: use `!` to perform bitwise not | -LL | please_recover! { !1 } - | ~ +LL - please_recover! { not 1 } +LL + please_recover! { !1 } + | error: aborting due to 1 previous error diff --git a/tests/ui/malformed/malformed-meta-delim.stderr b/tests/ui/malformed/malformed-meta-delim.stderr index 27636c3d546f..3f2357c435f0 100644 --- a/tests/ui/malformed/malformed-meta-delim.stderr +++ b/tests/ui/malformed/malformed-meta-delim.stderr @@ -6,8 +6,9 @@ LL | #[allow { foo_lint } ] | help: the delimiters should be `(` and `)` | -LL | #[allow ( foo_lint ) ] - | ~ ~ +LL - #[allow { foo_lint } ] +LL + #[allow ( foo_lint ) ] + | error: wrong meta list delimiters --> $DIR/malformed-meta-delim.rs:8:9 @@ -17,8 +18,9 @@ LL | #[allow [ foo_lint ] ] | help: the delimiters should be `(` and `)` | -LL | #[allow ( foo_lint ) ] - | ~ ~ +LL - #[allow [ foo_lint ] ] +LL + #[allow ( foo_lint ) ] + | error: aborting due to 2 previous errors diff --git a/tests/ui/malformed/malformed-special-attrs.stderr b/tests/ui/malformed/malformed-special-attrs.stderr index 8f2ce20593f5..a6220710cf91 100644 --- a/tests/ui/malformed/malformed-special-attrs.stderr +++ b/tests/ui/malformed/malformed-special-attrs.stderr @@ -7,8 +7,9 @@ LL | #[cfg_attr] = note: for more information, visit help: missing condition and attribute | -LL | #[cfg_attr(condition, attribute, other_attribute, ...)] - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - #[cfg_attr] +LL + #[cfg_attr(condition, attribute, other_attribute, ...)] + | error: malformed `cfg_attr` attribute input --> $DIR/malformed-special-attrs.rs:4:1 @@ -19,8 +20,9 @@ LL | #[cfg_attr = ""] = note: for more information, visit help: missing condition and attribute | -LL | #[cfg_attr(condition, attribute, other_attribute, ...)] - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - #[cfg_attr = ""] +LL + #[cfg_attr(condition, attribute, other_attribute, ...)] + | error: malformed `derive` attribute input --> $DIR/malformed-special-attrs.rs:7:1 diff --git a/tests/ui/match/issue-56685.stderr b/tests/ui/match/issue-56685.stderr index ccf357d4aa00..9655a3808116 100644 --- a/tests/ui/match/issue-56685.stderr +++ b/tests/ui/match/issue-56685.stderr @@ -11,8 +11,9 @@ LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore | -LL | E::A(_x) | E::B(_x) => {} - | ~~ ~~ +LL - E::A(x) | E::B(x) => {} +LL + E::A(_x) | E::B(_x) => {} + | error: unused variable: `x` --> $DIR/issue-56685.rs:25:14 @@ -22,8 +23,9 @@ LL | F::A(x, y) | F::B(x, y) => { y }, | help: if this is intentional, prefix it with an underscore | -LL | F::A(_x, y) | F::B(_x, y) => { y }, - | ~~ ~~ +LL - F::A(x, y) | F::B(x, y) => { y }, +LL + F::A(_x, y) | F::B(_x, y) => { y }, + | error: unused variable: `a` --> $DIR/issue-56685.rs:27:14 @@ -45,8 +47,9 @@ LL | let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) { | help: if this is intentional, prefix it with an underscore | -LL | let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { - | ~~ ~~ +LL - let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) { +LL + let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { + | error: unused variable: `x` --> $DIR/issue-56685.rs:39:20 @@ -56,8 +59,9 @@ LL | while let F::A(x, y) | F::B(x, y) = F::A(1, 2) { | help: if this is intentional, prefix it with an underscore | -LL | while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { - | ~~ ~~ +LL - while let F::A(x, y) | F::B(x, y) = F::A(1, 2) { +LL + while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { + | error: aborting due to 6 previous errors diff --git a/tests/ui/match/match-pattern-field-mismatch.stderr b/tests/ui/match/match-pattern-field-mismatch.stderr index cde7ac972ca8..ea5f6f0f22bb 100644 --- a/tests/ui/match/match-pattern-field-mismatch.stderr +++ b/tests/ui/match/match-pattern-field-mismatch.stderr @@ -13,8 +13,9 @@ LL | Color::Rgb(_, _, _) => { } | +++ help: use `..` to ignore all fields | -LL | Color::Rgb(..) => { } - | ~~ +LL - Color::Rgb(_, _) => { } +LL + Color::Rgb(..) => { } + | error: aborting due to 1 previous error diff --git a/tests/ui/meta/expected-error-correct-rev.a.stderr b/tests/ui/meta/expected-error-correct-rev.a.stderr index d5b7603d346d..ae8dd86d3600 100644 --- a/tests/ui/meta/expected-error-correct-rev.a.stderr +++ b/tests/ui/meta/expected-error-correct-rev.a.stderr @@ -8,8 +8,9 @@ LL | let x: u32 = 22_usize; | help: change the type of the numeric literal from `usize` to `u32` | -LL | let x: u32 = 22_u32; - | ~~~ +LL - let x: u32 = 22_usize; +LL + let x: u32 = 22_u32; + | error: aborting due to 1 previous error diff --git a/tests/ui/meta/meta-expected-error-wrong-rev.a.stderr b/tests/ui/meta/meta-expected-error-wrong-rev.a.stderr index a489040f32df..48fea28024f3 100644 --- a/tests/ui/meta/meta-expected-error-wrong-rev.a.stderr +++ b/tests/ui/meta/meta-expected-error-wrong-rev.a.stderr @@ -8,8 +8,9 @@ LL | let x: u32 = 22_usize; | help: change the type of the numeric literal from `usize` to `u32` | -LL | let x: u32 = 22_u32; - | ~~~ +LL - let x: u32 = 22_usize; +LL + let x: u32 = 22_u32; + | error: aborting due to 1 previous error diff --git a/tests/ui/methods/disambiguate-associated-function-first-arg.stderr b/tests/ui/methods/disambiguate-associated-function-first-arg.stderr index 341b7a910032..381e29667c82 100644 --- a/tests/ui/methods/disambiguate-associated-function-first-arg.stderr +++ b/tests/ui/methods/disambiguate-associated-function-first-arg.stderr @@ -25,16 +25,19 @@ LL | fn new(_a: Self, _b: i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function for candidate #1 | -LL | ::new(1); - | ~~~~~~~~~~~~~~~~ +LL - _a.new(1); +LL + ::new(1); + | help: disambiguate the associated function for candidate #2 | -LL | ::new(_a, 1); - | ~~~~~~~~~~~~~~~~~~~~ +LL - _a.new(1); +LL + ::new(_a, 1); + | help: disambiguate the associated function for candidate #3 | -LL | ::new(_a, 1); - | ~~~~~~~~~~~~~~~~~~~~ +LL - _a.new(1); +LL + ::new(_a, 1); + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-associated-function-first-arg.rs:47:7 @@ -54,12 +57,14 @@ LL | fn f(self) {} | ^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | TraitA::f(S); - | ~~~~~~~~~~~~ +LL - S.f(); +LL + TraitA::f(S); + | help: disambiguate the method for candidate #2 | -LL | TraitB::f(S); - | ~~~~~~~~~~~~ +LL - S.f(); +LL + TraitB::f(S); + | error: aborting due to 2 previous errors diff --git a/tests/ui/methods/disambiguate-multiple-blanket-impl.stderr b/tests/ui/methods/disambiguate-multiple-blanket-impl.stderr index ccdd9a95451b..1b81dc5aafb7 100644 --- a/tests/ui/methods/disambiguate-multiple-blanket-impl.stderr +++ b/tests/ui/methods/disambiguate-multiple-blanket-impl.stderr @@ -6,10 +6,12 @@ LL | let _: S::Type; | help: use fully-qualified syntax | -LL | let _: ::Type; - | ~~~~~~~~~~~~~~ -LL | let _: ::Type; - | ~~~~~~~~~~~~~~ +LL - let _: S::Type; +LL + let _: ::Type; + | +LL - let _: S::Type; +LL + let _: ::Type; + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-blanket-impl.rs:30:8 @@ -29,10 +31,12 @@ LL | fn foo(&self) {} | ^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | A::foo(&s); - | ~~~ -LL | B::foo(&s); - | ~~~ +LL - S::foo(&s); +LL + A::foo(&s); + | +LL - S::foo(&s); +LL + B::foo(&s); + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-blanket-impl.rs:33:8 @@ -52,10 +56,12 @@ LL | const CONST: usize = 2; | ^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | ::CONST; - | ~~~~~~~~~~ -LL | ::CONST; - | ~~~~~~~~~~ +LL - S::CONST; +LL + ::CONST; + | +LL - S::CONST; +LL + ::CONST; + | error: aborting due to 3 previous errors diff --git a/tests/ui/methods/disambiguate-multiple-impl.stderr b/tests/ui/methods/disambiguate-multiple-impl.stderr index 4172120770c6..2563c2327b7a 100644 --- a/tests/ui/methods/disambiguate-multiple-impl.stderr +++ b/tests/ui/methods/disambiguate-multiple-impl.stderr @@ -6,10 +6,12 @@ LL | let _: S::Type = (); | help: use fully-qualified syntax | -LL | let _: ::Type = (); - | ~~~~~~~~~~~~~~ -LL | let _: ::Type = (); - | ~~~~~~~~~~~~~~ +LL - let _: S::Type = (); +LL + let _: ::Type = (); + | +LL - let _: S::Type = (); +LL + let _: ::Type = (); + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-impl.rs:29:8 @@ -29,10 +31,12 @@ LL | fn foo(&self) {} | ^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | A::foo(&s); - | ~~~ -LL | B::foo(&s); - | ~~~ +LL - S::foo(&s); +LL + A::foo(&s); + | +LL - S::foo(&s); +LL + B::foo(&s); + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-impl.rs:34:16 @@ -52,10 +56,12 @@ LL | const CONST: usize = 2; | ^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | let _ = ::CONST; - | ~~~~~~~~~~ -LL | let _ = ::CONST; - | ~~~~~~~~~~ +LL - let _ = S::CONST; +LL + let _ = ::CONST; + | +LL - let _ = S::CONST; +LL + let _ = ::CONST; + | error: aborting due to 3 previous errors diff --git a/tests/ui/methods/disambiguate-multiple-trait-2.stderr b/tests/ui/methods/disambiguate-multiple-trait-2.stderr index 2778f254a561..08e264c20c89 100644 --- a/tests/ui/methods/disambiguate-multiple-trait-2.stderr +++ b/tests/ui/methods/disambiguate-multiple-trait-2.stderr @@ -12,12 +12,14 @@ LL | let _: T::Type; | help: use fully-qualified syntax to disambiguate | -LL | let _: ::Type; - | ~~~~~~~~~~ +LL - let _: T::Type; +LL + let _: ::Type; + | help: use fully-qualified syntax to disambiguate | -LL | let _: ::Type; - | ~~~~~~~~~~ +LL - let _: T::Type; +LL + let _: ::Type; + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-trait-2.rs:16:7 @@ -37,12 +39,14 @@ LL | fn foo(&self); | ^^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | A::foo(&t); - | ~~~~~~~~~~ +LL - t.foo(); +LL + A::foo(&t); + | help: disambiguate the method for candidate #2 | -LL | B::foo(&t); - | ~~~~~~~~~~ +LL - t.foo(); +LL + B::foo(&t); + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-trait-2.rs:20:16 @@ -62,10 +66,12 @@ LL | const CONST: usize; | ^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | let _ = ::CONST; - | ~~~~~~~~~~ -LL | let _ = ::CONST; - | ~~~~~~~~~~ +LL - let _ = T::CONST; +LL + let _ = ::CONST; + | +LL - let _ = T::CONST; +LL + let _ = ::CONST; + | error[E0223]: ambiguous associated type --> $DIR/disambiguate-multiple-trait-2.rs:52:12 @@ -75,10 +81,12 @@ LL | let _: S::Type; | help: use fully-qualified syntax | -LL | let _: ::Type; - | ~~~~~~~~~~~~~~ -LL | let _: ::Type; - | ~~~~~~~~~~~~~~ +LL - let _: S::Type; +LL + let _: ::Type; + | +LL - let _: S::Type; +LL + let _: ::Type; + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-trait-2.rs:46:8 @@ -98,10 +106,12 @@ LL | fn foo(&self) {} | ^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | A::foo(&s); - | ~~~ -LL | B::foo(&s); - | ~~~ +LL - S::foo(&s); +LL + A::foo(&s); + | +LL - S::foo(&s); +LL + B::foo(&s); + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-trait-2.rs:49:16 @@ -121,10 +131,12 @@ LL | const CONST: usize = 1; | ^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | let _ = ::CONST; - | ~~~~~~~~~~ -LL | let _ = ::CONST; - | ~~~~~~~~~~ +LL - let _ = S::CONST; +LL + let _ = ::CONST; + | +LL - let _ = S::CONST; +LL + let _ = ::CONST; + | error: aborting due to 6 previous errors diff --git a/tests/ui/methods/disambiguate-multiple-trait.stderr b/tests/ui/methods/disambiguate-multiple-trait.stderr index e00498ca62b4..a977fe2cd033 100644 --- a/tests/ui/methods/disambiguate-multiple-trait.stderr +++ b/tests/ui/methods/disambiguate-multiple-trait.stderr @@ -6,10 +6,12 @@ LL | let _: S::Type; | help: use fully-qualified syntax | -LL | let _: ::Type; - | ~~~~~~~~~~~~~~ -LL | let _: ::Type; - | ~~~~~~~~~~~~~~ +LL - let _: S::Type; +LL + let _: ::Type; + | +LL - let _: S::Type; +LL + let _: ::Type; + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-trait.rs:24:8 @@ -29,10 +31,12 @@ LL | fn foo(&self) {} | ^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | A::foo(&s); - | ~~~ -LL | B::foo(&s); - | ~~~ +LL - S::foo(&s); +LL + A::foo(&s); + | +LL - S::foo(&s); +LL + B::foo(&s); + | error[E0034]: multiple applicable items in scope --> $DIR/disambiguate-multiple-trait.rs:27:16 @@ -52,10 +56,12 @@ LL | const CONST: usize = 2; | ^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | let _ = ::CONST; - | ~~~~~~~~~~ -LL | let _ = ::CONST; - | ~~~~~~~~~~ +LL - let _ = S::CONST; +LL + let _ = ::CONST; + | +LL - let _ = S::CONST; +LL + let _ = ::CONST; + | error: aborting due to 3 previous errors diff --git a/tests/ui/methods/issues/issue-105732.stderr b/tests/ui/methods/issues/issue-105732.stderr index a4924b3e663b..6244f983550e 100644 --- a/tests/ui/methods/issues/issue-105732.stderr +++ b/tests/ui/methods/issues/issue-105732.stderr @@ -14,8 +14,9 @@ LL | self.g(); | help: there is a method `f` with a similar name | -LL | self.f(); - | ~ +LL - self.g(); +LL + self.f(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/methods/issues/issue-90315.stderr b/tests/ui/methods/issues/issue-90315.stderr index 0466bb0a0c99..e194a9188342 100644 --- a/tests/ui/methods/issues/issue-90315.stderr +++ b/tests/ui/methods/issues/issue-90315.stderr @@ -181,8 +181,9 @@ LL | let _res: i32 = ..6.take(2).sum(); | help: you must specify a concrete type for this numeric value, like `i32` | -LL | let _res: i32 = ..6_i32.take(2).sum(); - | ~~~~~ +LL - let _res: i32 = ..6.take(2).sum(); +LL + let _res: i32 = ..6_i32.take(2).sum(); + | error: aborting due to 18 previous errors diff --git a/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr b/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr index b2d2d039ff6a..a5f1b76702f5 100644 --- a/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr +++ b/tests/ui/methods/method-ambig-one-trait-unknown-int-type.stderr @@ -25,8 +25,9 @@ LL | impl Foo for Vec { | ^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | as Foo>::foo(&x); - | ++++++++++++++++++++++ ~ +LL - x.foo(); +LL + as Foo>::foo(&x); + | error[E0308]: mismatched types --> $DIR/method-ambig-one-trait-unknown-int-type.rs:33:20 diff --git a/tests/ui/methods/method-ambig-two-traits-cross-crate.stderr b/tests/ui/methods/method-ambig-two-traits-cross-crate.stderr index 0fc0c909ea8f..707c33c3d948 100644 --- a/tests/ui/methods/method-ambig-two-traits-cross-crate.stderr +++ b/tests/ui/methods/method-ambig-two-traits-cross-crate.stderr @@ -12,12 +12,14 @@ LL | impl Me2 for usize { fn me(&self) -> usize { *self } } = note: candidate #2 is defined in an impl of the trait `Me` for the type `usize` help: disambiguate the method for candidate #1 | -LL | fn main() { Me2::me(&1_usize); } - | ~~~~~~~~~~~~~~~~~ +LL - fn main() { 1_usize.me(); } +LL + fn main() { Me2::me(&1_usize); } + | help: disambiguate the method for candidate #2 | -LL | fn main() { Me::me(&1_usize); } - | ~~~~~~~~~~~~~~~~ +LL - fn main() { 1_usize.me(); } +LL + fn main() { Me::me(&1_usize); } + | error: aborting due to 1 previous error diff --git a/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr b/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr index 690f979fa37d..f3aa15823984 100644 --- a/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr +++ b/tests/ui/methods/method-ambig-two-traits-from-bounds.stderr @@ -16,12 +16,14 @@ LL | trait B { fn foo(&self); } | ^^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | A::foo(&t); - | ~~~~~~~~~~ +LL - t.foo(); +LL + A::foo(&t); + | help: disambiguate the method for candidate #2 | -LL | B::foo(&t); - | ~~~~~~~~~~ +LL - t.foo(); +LL + B::foo(&t); + | error: aborting due to 1 previous error diff --git a/tests/ui/methods/method-ambig-two-traits-from-impls.stderr b/tests/ui/methods/method-ambig-two-traits-from-impls.stderr index 8be6d6d64f7e..d1c50e8b3d01 100644 --- a/tests/ui/methods/method-ambig-two-traits-from-impls.stderr +++ b/tests/ui/methods/method-ambig-two-traits-from-impls.stderr @@ -16,12 +16,14 @@ LL | fn foo(self) {} | ^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | A::foo(AB {}); - | ~~~~~~~~~~~~~ +LL - AB {}.foo(); +LL + A::foo(AB {}); + | help: disambiguate the method for candidate #2 | -LL | B::foo(AB {}); - | ~~~~~~~~~~~~~ +LL - AB {}.foo(); +LL + B::foo(AB {}); + | error: aborting due to 1 previous error diff --git a/tests/ui/methods/method-ambig-two-traits-from-impls2.stderr b/tests/ui/methods/method-ambig-two-traits-from-impls2.stderr index 333520847f83..788f1a4c4b3b 100644 --- a/tests/ui/methods/method-ambig-two-traits-from-impls2.stderr +++ b/tests/ui/methods/method-ambig-two-traits-from-impls2.stderr @@ -16,10 +16,12 @@ LL | fn foo() {} | ^^^^^^^^ help: use fully-qualified syntax to disambiguate | -LL | ::foo(); - | ~~~~~~~~~~~ -LL | ::foo(); - | ~~~~~~~~~~~ +LL - AB::foo(); +LL + ::foo(); + | +LL - AB::foo(); +LL + ::foo(); + | error: aborting due to 1 previous error diff --git a/tests/ui/methods/method-ambig-two-traits-with-default-method.stderr b/tests/ui/methods/method-ambig-two-traits-with-default-method.stderr index b36ef77fb7ea..605c2a85b070 100644 --- a/tests/ui/methods/method-ambig-two-traits-with-default-method.stderr +++ b/tests/ui/methods/method-ambig-two-traits-with-default-method.stderr @@ -16,12 +16,14 @@ LL | trait Foo { fn method(&self) {} } | ^^^^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | Bar::method(&1_usize); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - 1_usize.method(); +LL + Bar::method(&1_usize); + | help: disambiguate the method for candidate #2 | -LL | Foo::method(&1_usize); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - 1_usize.method(); +LL + Foo::method(&1_usize); + | error: aborting due to 1 previous error diff --git a/tests/ui/methods/method-ambiguity-no-rcvr.stderr b/tests/ui/methods/method-ambiguity-no-rcvr.stderr index 3b6eb07393ac..c1a77a997398 100644 --- a/tests/ui/methods/method-ambiguity-no-rcvr.stderr +++ b/tests/ui/methods/method-ambiguity-no-rcvr.stderr @@ -20,12 +20,14 @@ LL | fn foo() {} | ^^^^^^^^ help: disambiguate the associated function for candidate #1 | -LL | ::foo(); - | ~~~~~~~~~~~~~~~~~~~ +LL - Qux.foo(); +LL + ::foo(); + | help: disambiguate the associated function for candidate #2 | -LL | ::foo(); - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - Qux.foo(); +LL + ::foo(); + | error: aborting due to 1 previous error diff --git a/tests/ui/methods/method-call-err-msg.stderr b/tests/ui/methods/method-call-err-msg.stderr index c17c4a23a3a2..7cda928aca9d 100644 --- a/tests/ui/methods/method-call-err-msg.stderr +++ b/tests/ui/methods/method-call-err-msg.stderr @@ -28,8 +28,9 @@ LL | fn one(self, _: isize) -> Foo { self } | ^^^ -------- help: provide the argument | -LL | .one(/* isize */) - | ~~~~~~~~~~~~~ +LL - .one() +LL + .one(/* isize */) + | error[E0061]: this method takes 2 arguments but 1 argument was supplied --> $DIR/method-call-err-msg.rs:15:7 @@ -44,8 +45,9 @@ LL | fn two(self, _: isize, _: isize) -> Foo { self } | ^^^ -------- help: provide the argument | -LL | .two(0, /* isize */); - | ~~~~~~~~~~~~~~~~ +LL - .two(0); +LL + .two(0, /* isize */); + | error[E0599]: `Foo` is not an iterator --> $DIR/method-call-err-msg.rs:19:7 @@ -82,8 +84,9 @@ LL | fn three(self, _: T, _: T, _: T) -> Foo { self } | ^^^^^ ---- ---- ---- help: provide the arguments | -LL | y.three::(/* usize */, /* usize */, /* usize */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - y.three::(); +LL + y.three::(/* usize */, /* usize */, /* usize */); + | error: aborting due to 5 previous errors diff --git a/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr b/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr index 6159d87c73e7..d6da3f2cc398 100644 --- a/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr +++ b/tests/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr @@ -46,16 +46,19 @@ LL | fn foo(self: Smaht) -> u64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | let z = FinalFoo::foo(&x); - | ~~~~~~~~~~~~~~~~~ +LL - let z = x.foo(); +LL + let z = FinalFoo::foo(&x); + | help: disambiguate the method for candidate #2 | -LL | let z = NuisanceFoo::foo(x); - | ~~~~~~~~~~~~~~~~~~~ +LL - let z = x.foo(); +LL + let z = NuisanceFoo::foo(x); + | help: disambiguate the method for candidate #3 | -LL | let z = X::foo(x); - | ~~~~~~~~~ +LL - let z = x.foo(); +LL + let z = X::foo(x); + | error[E0308]: mismatched types --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:139:24 diff --git a/tests/ui/methods/method-not-found-but-doc-alias.stderr b/tests/ui/methods/method-not-found-but-doc-alias.stderr index c49ffa8971f7..2164b7cbbf81 100644 --- a/tests/ui/methods/method-not-found-but-doc-alias.stderr +++ b/tests/ui/methods/method-not-found-but-doc-alias.stderr @@ -9,8 +9,9 @@ LL | Foo.quux(); | help: there is a method `bar` with a similar name | -LL | Foo.bar(); - | ~~~ +LL - Foo.quux(); +LL + Foo.bar(); + | error: aborting due to 1 previous error diff --git a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr index 124270402727..d688bcc90c8d 100644 --- a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr +++ b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr @@ -6,8 +6,9 @@ LL | let x = 2.0.neg(); | help: you must specify a concrete type for this numeric value, like `f32` | -LL | let x = 2.0_f32.neg(); - | ~~~~~~~ +LL - let x = 2.0.neg(); +LL + let x = 2.0_f32.neg(); + | error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` --> $DIR/method-on-ambiguous-numeric-type.rs:17:15 diff --git a/tests/ui/methods/suggest-convert-ptr-to-ref.stderr b/tests/ui/methods/suggest-convert-ptr-to-ref.stderr index 0e1565e251ad..7d52b20121e9 100644 --- a/tests/ui/methods/suggest-convert-ptr-to-ref.stderr +++ b/tests/ui/methods/suggest-convert-ptr-to-ref.stderr @@ -47,8 +47,9 @@ LL | let _ = t.as_mut_ref(); | help: there is a method `as_mut` with a similar name | -LL | let _ = t.as_mut(); - | ~~~~~~ +LL - let _ = t.as_mut_ref(); +LL + let _ = t.as_mut(); + | error[E0599]: no method named `as_ref_mut` found for raw pointer `*mut u8` in the current scope --> $DIR/suggest-convert-ptr-to-ref.rs:13:15 @@ -58,8 +59,9 @@ LL | let _ = t.as_ref_mut(); | help: there is a method `as_mut` with a similar name | -LL | let _ = t.as_mut(); - | ~~~~~~ +LL - let _ = t.as_ref_mut(); +LL + let _ = t.as_mut(); + | error[E0599]: no method named `make_ascii_lowercase` found for raw pointer `*const u8` in the current scope --> $DIR/suggest-convert-ptr-to-ref.rs:16:7 diff --git a/tests/ui/mir/issue-106062.stderr b/tests/ui/mir/issue-106062.stderr index 30635148dae6..19a1d06e0be0 100644 --- a/tests/ui/mir/issue-106062.stderr +++ b/tests/ui/mir/issue-106062.stderr @@ -6,10 +6,12 @@ LL | async fn connection_handler(handler: impl Sized) -> Result Result { - | ~~~~~~~~~~~~~~~~~~~~ -LL | async fn connection_handler(handler: impl Sized) -> Result { - | ~~~~~~~~~~~~~~~~~~~ +LL - async fn connection_handler(handler: impl Sized) -> Result { +LL + async fn connection_handler(handler: impl Sized) -> Result { + | +LL - async fn connection_handler(handler: impl Sized) -> Result { +LL + async fn connection_handler(handler: impl Sized) -> Result { + | error: aborting due to 1 previous error diff --git a/tests/ui/mir/issue-112269.stderr b/tests/ui/mir/issue-112269.stderr index 80f329e2ce02..29b69cb7e208 100644 --- a/tests/ui/mir/issue-112269.stderr +++ b/tests/ui/mir/issue-112269.stderr @@ -11,8 +11,9 @@ LL | let x: i32 = 3; = note: the matched value is of type `i32` help: introduce a variable instead | -LL | let x_var: i32 = 3; - | ~~~~~ +LL - let x: i32 = 3; +LL + let x_var: i32 = 3; + | error[E0005]: refutable pattern in local binding --> $DIR/issue-112269.rs:7:9 @@ -27,8 +28,9 @@ LL | let y = 4; = note: the matched value is of type `i32` help: introduce a variable instead | -LL | let y_var = 4; - | ~~~~~ +LL - let y = 4; +LL + let y_var = 4; + | error: aborting due to 2 previous errors diff --git a/tests/ui/mismatched_types/E0053.stderr b/tests/ui/mismatched_types/E0053.stderr index 2559d4487491..32452af5ceda 100644 --- a/tests/ui/mismatched_types/E0053.stderr +++ b/tests/ui/mismatched_types/E0053.stderr @@ -13,8 +13,9 @@ LL | fn foo(x: u16); found signature `fn(i16)` help: change the parameter type to match the trait | -LL | fn foo(x: u16) { } - | ~~~ +LL - fn foo(x: i16) { } +LL + fn foo(x: u16) { } + | error[E0053]: method `bar` has an incompatible type for trait --> $DIR/E0053.rs:11:12 @@ -31,8 +32,9 @@ LL | fn bar(&self); found signature `fn(&mut Bar)` help: change the self-receiver type to match the trait | -LL | fn bar(&self) { } - | ~~~~~ +LL - fn bar(&mut self) { } +LL + fn bar(&self) { } + | error: aborting due to 2 previous errors diff --git a/tests/ui/mismatched_types/cast-rfc0401.stderr b/tests/ui/mismatched_types/cast-rfc0401.stderr index 2e5cbb900364..a42763959441 100644 --- a/tests/ui/mismatched_types/cast-rfc0401.stderr +++ b/tests/ui/mismatched_types/cast-rfc0401.stderr @@ -90,8 +90,9 @@ LL | let _ = 3_i32 as bool; | help: compare with zero instead | -LL | let _ = 3_i32 != 0; - | ~~~~ +LL - let _ = 3_i32 as bool; +LL + let _ = 3_i32 != 0; + | error[E0054]: cannot cast `E` as `bool` --> $DIR/cast-rfc0401.rs:40:13 diff --git a/tests/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.stderr b/tests/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.stderr index 801e8a0ff1d0..b29abfe59c51 100644 --- a/tests/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.stderr +++ b/tests/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.stderr @@ -8,8 +8,9 @@ LL | let _n = m.iter().map(|_, b| { | help: change the closure to accept a tuple instead of individual arguments | -LL | let _n = m.iter().map(|(_, b)| { - | ~~~~~~~~ +LL - let _n = m.iter().map(|_, b| { +LL + let _n = m.iter().map(|(_, b)| { + | error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/closure-arg-count.stderr b/tests/ui/mismatched_types/closure-arg-count.stderr index 0e2ca8feec54..8704d0f661be 100644 --- a/tests/ui/mismatched_types/closure-arg-count.stderr +++ b/tests/ui/mismatched_types/closure-arg-count.stderr @@ -8,8 +8,9 @@ LL | [1, 2, 3].sort_by(|| panic!()); | help: consider changing the closure to take and ignore the expected arguments | -LL | [1, 2, 3].sort_by(|_, _| panic!()); - | ~~~~~~ +LL - [1, 2, 3].sort_by(|| panic!()); +LL + [1, 2, 3].sort_by(|_, _| panic!()); + | error[E0593]: closure is expected to take 2 arguments, but it takes 1 argument --> $DIR/closure-arg-count.rs:7:15 @@ -29,8 +30,9 @@ LL | [1, 2, 3].sort_by(|(tuple, tuple2)| panic!()); | help: change the closure to take multiple arguments instead of a single tuple | -LL | [1, 2, 3].sort_by(|tuple, tuple2| panic!()); - | ~~~~~~~~~~~~~~~ +LL - [1, 2, 3].sort_by(|(tuple, tuple2)| panic!()); +LL + [1, 2, 3].sort_by(|tuple, tuple2| panic!()); + | error[E0593]: closure is expected to take 2 distinct arguments, but it takes a single 2-tuple as argument --> $DIR/closure-arg-count.rs:11:15 @@ -42,8 +44,9 @@ LL | [1, 2, 3].sort_by(|(tuple, tuple2): (usize, _)| panic!()); | help: change the closure to take multiple arguments instead of a single tuple | -LL | [1, 2, 3].sort_by(|tuple, tuple2| panic!()); - | ~~~~~~~~~~~~~~~ +LL - [1, 2, 3].sort_by(|(tuple, tuple2): (usize, _)| panic!()); +LL + [1, 2, 3].sort_by(|tuple, tuple2| panic!()); + | error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments --> $DIR/closure-arg-count.rs:13:5 @@ -61,8 +64,9 @@ LL | fn f>(_: F) {} | ^^^^^^^^^^^^ required by this bound in `f` help: consider changing the closure to take and ignore the expected argument | -LL | f(|_| panic!()); - | ~~~ +LL - f(|| panic!()); +LL + f(|_| panic!()); + | error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments --> $DIR/closure-arg-count.rs:15:5 @@ -80,8 +84,9 @@ LL | fn f>(_: F) {} | ^^^^^^^^^^^^ required by this bound in `f` help: consider changing the closure to take and ignore the expected argument | -LL | f( move |_| panic!()); - | ~~~ +LL - f( move || panic!()); +LL + f( move |_| panic!()); + | error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments --> $DIR/closure-arg-count.rs:18:53 @@ -93,8 +98,9 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i); | help: change the closure to accept a tuple instead of individual arguments | -LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i); - | ~~~~~~~~ +LL - let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i); +LL + let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i); + | error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments --> $DIR/closure-arg-count.rs:20:53 @@ -106,8 +112,9 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i); | help: change the closure to accept a tuple instead of individual arguments | -LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i); - | ~~~~~~~~ +LL - let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i); +LL + let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i); + | error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments --> $DIR/closure-arg-count.rs:22:53 diff --git a/tests/ui/mismatched_types/float-literal-inference-restrictions.stderr b/tests/ui/mismatched_types/float-literal-inference-restrictions.stderr index 6b3e0cb505fe..b345d5e049e4 100644 --- a/tests/ui/mismatched_types/float-literal-inference-restrictions.stderr +++ b/tests/ui/mismatched_types/float-literal-inference-restrictions.stderr @@ -21,8 +21,9 @@ LL | let y: f32 = 1f64; | help: change the type of the numeric literal from `f64` to `f32` | -LL | let y: f32 = 1f32; - | ~~~ +LL - let y: f32 = 1f64; +LL + let y: f32 = 1f32; + | error: aborting due to 2 previous errors diff --git a/tests/ui/mismatched_types/issue-106182.stderr b/tests/ui/mismatched_types/issue-106182.stderr index 2f33628a4916..647a73133442 100644 --- a/tests/ui/mismatched_types/issue-106182.stderr +++ b/tests/ui/mismatched_types/issue-106182.stderr @@ -10,8 +10,9 @@ LL | _S(& (mut _y), _v) => { found reference `&_` help: consider removing `&` from the pattern | -LL | _S(mut _y, _v) => { - | ~~~~~~ +LL - _S(& (mut _y), _v) => { +LL + _S(mut _y, _v) => { + | error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/issue-112036.stderr b/tests/ui/mismatched_types/issue-112036.stderr index bd446b3d78cb..29559980cb45 100644 --- a/tests/ui/mismatched_types/issue-112036.stderr +++ b/tests/ui/mismatched_types/issue-112036.stderr @@ -8,8 +8,9 @@ LL | fn drop(self) {} found signature `fn(Foo)` help: change the self-receiver type to match the trait | -LL | fn drop(&mut self) {} - | ~~~~~~~~~ +LL - fn drop(self) {} +LL + fn drop(&mut self) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/issue-13033.stderr b/tests/ui/mismatched_types/issue-13033.stderr index 2a266d40e771..7756217b5600 100644 --- a/tests/ui/mismatched_types/issue-13033.stderr +++ b/tests/ui/mismatched_types/issue-13033.stderr @@ -13,8 +13,9 @@ LL | fn bar(&mut self, other: &mut dyn Foo); found signature `fn(&mut Baz, &dyn Foo)` help: change the parameter type to match the trait | -LL | fn bar(&mut self, other: &mut dyn Foo) {} - | ~~~~~~~~~~~~ +LL - fn bar(&mut self, other: &dyn Foo) {} +LL + fn bar(&mut self, other: &mut dyn Foo) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/issue-1362.stderr b/tests/ui/mismatched_types/issue-1362.stderr index 6f6fdff66788..4a2d4c1b4591 100644 --- a/tests/ui/mismatched_types/issue-1362.stderr +++ b/tests/ui/mismatched_types/issue-1362.stderr @@ -8,8 +8,9 @@ LL | let x: u32 = 20i32; | help: change the type of the numeric literal from `i32` to `u32` | -LL | let x: u32 = 20u32; - | ~~~ +LL - let x: u32 = 20i32; +LL + let x: u32 = 20u32; + | error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/issue-1448-2.stderr b/tests/ui/mismatched_types/issue-1448-2.stderr index a6f1daefe636..85730a18d9d2 100644 --- a/tests/ui/mismatched_types/issue-1448-2.stderr +++ b/tests/ui/mismatched_types/issue-1448-2.stderr @@ -13,8 +13,9 @@ LL | fn foo(a: u32) -> u32 { a } | ^^^ ------ help: change the type of the numeric literal from `i32` to `u32` | -LL | println!("{}", foo(10u32)); - | ~~~ +LL - println!("{}", foo(10i32)); +LL + println!("{}", foo(10u32)); + | error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/mismatch-args-crash-issue-128848.stderr b/tests/ui/mismatched_types/mismatch-args-crash-issue-128848.stderr index 899cf435ddf5..dbd313fada99 100644 --- a/tests/ui/mismatched_types/mismatch-args-crash-issue-128848.stderr +++ b/tests/ui/mismatched_types/mismatch-args-crash-issue-128848.stderr @@ -8,8 +8,9 @@ note: method defined here --> $SRC_DIR/core/src/ops/function.rs:LL:COL help: provide the argument | -LL | f.call_once(/* args */) - | ~~~~~~~~~~~~ +LL - f.call_once() +LL + f.call_once(/* args */) + | error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/mismatch-args-crash-issue-130400.stderr b/tests/ui/mismatched_types/mismatch-args-crash-issue-130400.stderr index 0e4b94b98e26..d9d99f3d1cf5 100644 --- a/tests/ui/mismatched_types/mismatch-args-crash-issue-130400.stderr +++ b/tests/ui/mismatched_types/mismatch-args-crash-issue-130400.stderr @@ -11,8 +11,9 @@ LL | fn foo(&mut self) -> _ { | ^^^ --------- help: provide the argument | -LL | Self::foo(/* value */) - | ~~~~~~~~~~~~~ +LL - Self::foo() +LL + Self::foo(/* value */) + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/mismatch-args-crash-issue-130400.rs:2:26 diff --git a/tests/ui/mismatched_types/mismatch-args-vargs-issue-130372.stderr b/tests/ui/mismatched_types/mismatch-args-vargs-issue-130372.stderr index 38f769703582..7acc361fdb8d 100644 --- a/tests/ui/mismatched_types/mismatch-args-vargs-issue-130372.stderr +++ b/tests/ui/mismatched_types/mismatch-args-vargs-issue-130372.stderr @@ -11,8 +11,9 @@ LL | unsafe extern "C" fn test_va_copy(_: u64, mut ap: ...) {} | ^^^^^^^^^^^^ ------ help: provide the argument | -LL | test_va_copy(/* u64 */); - | ~~~~~~~~~~~ +LL - test_va_copy(); +LL + test_va_copy(/* u64 */); + | error: aborting due to 1 previous error diff --git a/tests/ui/mismatched_types/numeric-literal-cast.stderr b/tests/ui/mismatched_types/numeric-literal-cast.stderr index fcf3eccbcba2..8ddadcc5a947 100644 --- a/tests/ui/mismatched_types/numeric-literal-cast.stderr +++ b/tests/ui/mismatched_types/numeric-literal-cast.stderr @@ -13,8 +13,9 @@ LL | fn foo(_: u16) {} | ^^^ ------ help: change the type of the numeric literal from `u8` to `u16` | -LL | foo(1u16); - | ~~~ +LL - foo(1u8); +LL + foo(1u16); + | error[E0308]: mismatched types --> $DIR/numeric-literal-cast.rs:8:10 @@ -31,8 +32,9 @@ LL | fn foo1(_: f64) {} | ^^^^ ------ help: change the type of the numeric literal from `f32` to `f64` | -LL | foo1(2f64); - | ~~~ +LL - foo1(2f32); +LL + foo1(2f64); + | error[E0308]: mismatched types --> $DIR/numeric-literal-cast.rs:10:10 @@ -49,8 +51,9 @@ LL | fn foo2(_: i32) {} | ^^^^ ------ help: change the type of the numeric literal from `i16` to `i32` | -LL | foo2(3i32); - | ~~~ +LL - foo2(3i16); +LL + foo2(3i32); + | error: aborting due to 3 previous errors diff --git a/tests/ui/mismatched_types/overloaded-calls-bad.stderr b/tests/ui/mismatched_types/overloaded-calls-bad.stderr index c52fa7136153..9f5c35a30097 100644 --- a/tests/ui/mismatched_types/overloaded-calls-bad.stderr +++ b/tests/ui/mismatched_types/overloaded-calls-bad.stderr @@ -25,8 +25,9 @@ LL | impl FnMut<(isize,)> for S { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: provide the argument | -LL | let ans = s(/* isize */); - | ~~~~~~~~~~~~~ +LL - let ans = s(); +LL + let ans = s(/* isize */); + | error[E0057]: this function takes 1 argument but 2 arguments were supplied --> $DIR/overloaded-calls-bad.rs:37:15 diff --git a/tests/ui/mismatched_types/ref-pat-suggestions.stderr b/tests/ui/mismatched_types/ref-pat-suggestions.stderr index 148ed00b01d1..d3b605fabf5c 100644 --- a/tests/ui/mismatched_types/ref-pat-suggestions.stderr +++ b/tests/ui/mismatched_types/ref-pat-suggestions.stderr @@ -336,8 +336,9 @@ LL | let S(&mut _b) = S(0); | ^^^^^^^ help: consider removing `&mut` from the pattern | -LL | let S(_b) = S(0); - | ~~ +LL - let S(&mut _b) = S(0); +LL + let S(_b) = S(0); + | error[E0308]: mismatched types --> $DIR/ref-pat-suggestions.rs:31:14 diff --git a/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr b/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr index 40182a75a989..3f58efe19f5b 100644 --- a/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr +++ b/tests/ui/mismatched_types/suggest-boxed-trait-objects-instead-of-impl-trait.stderr @@ -12,8 +12,9 @@ LL | | } | help: you could change the return type to be a boxed trait object | -LL | fn foo() -> Box { - | ~~~~~~~ + +LL - fn foo() -> impl Trait { +LL + fn foo() -> Box { + | help: if you change the return type to expect trait objects, box the returned expressions | LL ~ Box::new(S) @@ -34,8 +35,9 @@ LL | | } | help: you could change the return type to be a boxed trait object | -LL | fn bar() -> Box { - | ~~~~~~~ + +LL - fn bar() -> impl Trait { +LL + fn bar() -> Box { + | help: if you change the return type to expect trait objects, box the returned expressions | LL ~ true => Box::new(S), diff --git a/tests/ui/mismatched_types/trait-impl-fn-incompatibility.stderr b/tests/ui/mismatched_types/trait-impl-fn-incompatibility.stderr index 2e544a62223a..d232cc50e523 100644 --- a/tests/ui/mismatched_types/trait-impl-fn-incompatibility.stderr +++ b/tests/ui/mismatched_types/trait-impl-fn-incompatibility.stderr @@ -13,8 +13,9 @@ LL | fn foo(x: u16); found signature `fn(i16)` help: change the parameter type to match the trait | -LL | fn foo(x: u16) { } - | ~~~ +LL - fn foo(x: i16) { } +LL + fn foo(x: u16) { } + | error[E0053]: method `bar` has an incompatible type for trait --> $DIR/trait-impl-fn-incompatibility.rs:10:28 @@ -31,8 +32,9 @@ LL | fn bar(&mut self, bar: &mut Bar); found signature `fn(&mut Bar, &Bar)` help: change the parameter type to match the trait | -LL | fn bar(&mut self, bar: &mut Bar) { } - | ~~~~~~~~ +LL - fn bar(&mut self, bar: &Bar) { } +LL + fn bar(&mut self, bar: &mut Bar) { } + | error: aborting due to 2 previous errors diff --git a/tests/ui/mismatched_types/transforming-option-ref-issue-127545.stderr b/tests/ui/mismatched_types/transforming-option-ref-issue-127545.stderr index ad423f86ef9e..9a18798db213 100644 --- a/tests/ui/mismatched_types/transforming-option-ref-issue-127545.stderr +++ b/tests/ui/mismatched_types/transforming-option-ref-issue-127545.stderr @@ -34,8 +34,9 @@ note: method defined here --> $SRC_DIR/core/src/option.rs:LL:COL help: use `Option::map_or` to deref inner value of `Option` | -LL | arg.map_or(&[], |v| v) - | ~~~~~~ +++++++ +LL - arg.unwrap_or(&[]) +LL + arg.map_or(&[], |v| v) + | error[E0308]: mismatched types --> $DIR/transforming-option-ref-issue-127545.rs:13:19 @@ -58,8 +59,9 @@ note: method defined here --> $SRC_DIR/core/src/option.rs:LL:COL help: use `Option::map_or` to deref inner value of `Option` | -LL | arg.map_or(v, |v| v) - | ~~~~~~ +++++++ +LL - arg.unwrap_or(v) +LL + arg.map_or(v, |v| v) + | error[E0308]: mismatched types --> $DIR/transforming-option-ref-issue-127545.rs:17:19 @@ -82,8 +84,9 @@ note: method defined here --> $SRC_DIR/core/src/result.rs:LL:COL help: use `Result::map_or` to deref inner value of `Result` | -LL | arg.map_or(&[], |v| v) - | ~~~~~~ +++++++ +LL - arg.unwrap_or(&[]) +LL + arg.map_or(&[], |v| v) + | error: aborting due to 4 previous errors diff --git a/tests/ui/missing/missing-block-hint.stderr b/tests/ui/missing/missing-block-hint.stderr index 7a08d70d0ce5..15bf59f1482c 100644 --- a/tests/ui/missing/missing-block-hint.stderr +++ b/tests/ui/missing/missing-block-hint.stderr @@ -11,8 +11,9 @@ LL | if (foo) => {} | ^^^^^ help: you might have meant to write a "greater than or equal to" comparison | -LL | if (foo) >= {} - | ~~ +LL - if (foo) => {} +LL + if (foo) >= {} + | error: expected `{`, found `bar` --> $DIR/missing-block-hint.rs:7:13 diff --git a/tests/ui/missing/missing-fields-in-struct-pattern.stderr b/tests/ui/missing/missing-fields-in-struct-pattern.stderr index 91a7bd3540e3..1c69592985f2 100644 --- a/tests/ui/missing/missing-fields-in-struct-pattern.stderr +++ b/tests/ui/missing/missing-fields-in-struct-pattern.stderr @@ -6,8 +6,9 @@ LL | if let S { a, b, c, d } = S(1, 2, 3, 4) { | help: use the tuple variant pattern syntax instead | -LL | if let S(a, b, c, d) = S(1, 2, 3, 4) { - | ~~~~~~~~~~~~ +LL - if let S { a, b, c, d } = S(1, 2, 3, 4) { +LL + if let S(a, b, c, d) = S(1, 2, 3, 4) { + | error: aborting due to 1 previous error diff --git a/tests/ui/missing/missing-items/missing-const-parameter.stderr b/tests/ui/missing/missing-items/missing-const-parameter.stderr index d9fea1306514..c873e2448158 100644 --- a/tests/ui/missing/missing-items/missing-const-parameter.stderr +++ b/tests/ui/missing/missing-items/missing-const-parameter.stderr @@ -52,8 +52,9 @@ LL | struct Image([[u32; C]; R]); | help: a const parameter with a similar name exists | -LL | struct Image([[u32; R]; R]); - | ~ +LL - struct Image([[u32; C]; R]); +LL + struct Image([[u32; R]; R]); + | help: you might be missing a const parameter | LL | struct Image([[u32; C]; R]); diff --git a/tests/ui/missing/missing-items/missing-type-parameter2.stderr b/tests/ui/missing/missing-items/missing-type-parameter2.stderr index f33951c98bfb..f6418de20b6a 100644 --- a/tests/ui/missing/missing-items/missing-type-parameter2.stderr +++ b/tests/ui/missing/missing-items/missing-type-parameter2.stderr @@ -9,8 +9,9 @@ LL | impl X {} | help: a struct with a similar name exists | -LL | impl X {} - | ~ +LL - impl X {} +LL + impl X {} + | help: you might be missing a type parameter | LL | impl X {} @@ -26,8 +27,9 @@ LL | impl X {} | help: a type parameter with a similar name exists | -LL | impl X {} - | ~ +LL - impl X {} +LL + impl X {} + | help: you might be missing a type parameter | LL | impl X {} @@ -44,8 +46,9 @@ LL | fn foo(_: T) where T: Send {} | help: a struct with a similar name exists | -LL | fn foo(_: T) where X: Send {} - | ~ +LL - fn foo(_: T) where T: Send {} +LL + fn foo(_: T) where X: Send {} + | help: you might be missing a type parameter | LL | fn foo(_: T) where T: Send {} @@ -62,8 +65,9 @@ LL | fn foo(_: T) where T: Send {} | help: a struct with a similar name exists | -LL | fn foo(_: X) where T: Send {} - | ~ +LL - fn foo(_: T) where T: Send {} +LL + fn foo(_: X) where T: Send {} + | help: you might be missing a type parameter | LL | fn foo(_: T) where T: Send {} @@ -80,8 +84,9 @@ LL | fn bar(_: A) {} | help: a struct with a similar name exists | -LL | fn bar(_: X) {} - | ~ +LL - fn bar(_: A) {} +LL + fn bar(_: X) {} + | help: you might be missing a type parameter | LL | fn bar(_: A) {} diff --git a/tests/ui/moves/needs-clone-through-deref.stderr b/tests/ui/moves/needs-clone-through-deref.stderr index 1f9aefeb4dd7..9890ad480a6f 100644 --- a/tests/ui/moves/needs-clone-through-deref.stderr +++ b/tests/ui/moves/needs-clone-through-deref.stderr @@ -10,8 +10,9 @@ note: `into_iter` takes ownership of the receiver `self`, which moves value --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL help: you can `clone` the value and consume it, but this might not be your desired behavior | -LL | for _ in as Clone>::clone(&self).into_iter() {} - | ++++++++++++++++++++++++++++++ ~ +LL - for _ in self.clone().into_iter() {} +LL + for _ in as Clone>::clone(&self).into_iter() {} + | error: aborting due to 1 previous error diff --git a/tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.stderr b/tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.stderr index 755bbc5c21bd..c626796e01d2 100644 --- a/tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.stderr +++ b/tests/ui/moves/suggest-clone-when-some-obligation-is-unmet.stderr @@ -10,8 +10,9 @@ note: `HashMap::::into_values` takes ownership of the receiver `self`, --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL help: you could `clone` the value and consume it, if the `Hash128_1: Clone` trait bound could be satisfied | -LL | let mut copy: Vec = as Clone>::clone(&map).into_values().collect(); - | ++++++++++++++++++++++++++++++++++++++++++++ ~ +LL - let mut copy: Vec = map.clone().into_values().collect(); +LL + let mut copy: Vec = as Clone>::clone(&map).into_values().collect(); + | help: consider annotating `Hash128_1` with `#[derive(Clone)]` | LL + #[derive(Clone)] diff --git a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr index 784945dbbaea..62f087ca6b73 100644 --- a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr +++ b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr @@ -195,8 +195,9 @@ LL | [t, t]; | - you could clone this value help: consider further restricting type parameter `T` with trait `Copy` | -LL | T:, T: Copy - | ~~~~~~~~~ +LL - T:, +LL + T:, T: Copy + | error: aborting due to 11 previous errors diff --git a/tests/ui/namespace/namespace-mix.stderr b/tests/ui/namespace/namespace-mix.stderr index b80363fe8f84..41891c5144ba 100644 --- a/tests/ui/namespace/namespace-mix.stderr +++ b/tests/ui/namespace/namespace-mix.stderr @@ -10,8 +10,9 @@ LL | check(m1::S); = note: can't use a type alias as a constructor help: a tuple struct with a similar name exists | -LL | check(m1::TS); - | ~~ +LL - check(m1::S); +LL + check(m1::TS); + | help: consider importing one of these constants instead | LL + use m2::S; @@ -38,8 +39,9 @@ LL | pub struct TS(); = note: can't use a type alias as a constructor help: a tuple struct with a similar name exists | -LL | check(xm1::TS); - | ~~ +LL - check(xm1::S); +LL + check(xm1::TS); + | help: consider importing one of these constants instead | LL + use m2::S; @@ -64,8 +66,9 @@ LL | check(m7::V); = note: can't use a type alias as a constructor help: a tuple variant with a similar name exists | -LL | check(m7::TV); - | ~~ +LL - check(m7::V); +LL + check(m7::TV); + | help: consider importing one of these constants instead | LL + use m8::V; @@ -92,8 +95,9 @@ LL | TV(), = note: can't use a type alias as a constructor help: a tuple variant with a similar name exists | -LL | check(xm7::TV); - | ~~ +LL - check(xm7::V); +LL + check(xm7::TV); + | help: consider importing one of these constants instead | LL + use m8::V; diff --git a/tests/ui/never_type/dependency-on-fallback-to-unit.stderr b/tests/ui/never_type/dependency-on-fallback-to-unit.stderr index ea3b39c3000f..bf37cc7b4b47 100644 --- a/tests/ui/never_type/dependency-on-fallback-to-unit.stderr +++ b/tests/ui/never_type/dependency-on-fallback-to-unit.stderr @@ -15,8 +15,9 @@ LL | false => <_>::default(), = note: `#[warn(dependency_on_unit_never_type_fallback)]` on by default help: use `()` annotations to avoid fallback changes | -LL | false => <()>::default(), - | ~~ +LL - false => <_>::default(), +LL + false => <()>::default(), + | warning: this function depends on never type fallback being `()` --> $DIR/dependency-on-fallback-to-unit.rs:19:1 diff --git a/tests/ui/never_type/issue-96335.stderr b/tests/ui/never_type/issue-96335.stderr index c3d80a425e05..1193973d5ee8 100644 --- a/tests/ui/never_type/issue-96335.stderr +++ b/tests/ui/never_type/issue-96335.stderr @@ -6,12 +6,14 @@ LL | 0.....{loop{}1}; | help: use `..` for an exclusive range | -LL | 0....{loop{}1}; - | ~~ +LL - 0.....{loop{}1}; +LL + 0....{loop{}1}; + | help: or `..=` for an inclusive range | -LL | 0..=..{loop{}1}; - | ~~~ +LL - 0.....{loop{}1}; +LL + 0..=..{loop{}1}; + | error[E0308]: mismatched types --> $DIR/issue-96335.rs:2:9 diff --git a/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.stderr b/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.stderr index 1f01d3e82609..7e11b23d681b 100644 --- a/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.stderr +++ b/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.stderr @@ -9,8 +9,9 @@ LL | S1 { a: unsafe { &mut X1 } } = note: `#[warn(static_mut_refs)]` on by default help: use `&raw mut` instead to create a raw pointer | -LL | S1 { a: unsafe { &raw mut X1 } } - | ~~~~~~~~ +LL - S1 { a: unsafe { &mut X1 } } +LL + S1 { a: unsafe { &raw mut X1 } } + | warning: 1 warning emitted diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr index 4f93fb4eaea3..980670fee697 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -33,8 +33,9 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | help: consider adding an explicit lifetime bound | -LL | T: Iterator, ::Item: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - T: Iterator, +LL + T: Iterator, ::Item: 'a + | note: external requirements --> $DIR/projection-no-regions-closure.rs:34:23 @@ -95,8 +96,9 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | help: consider adding an explicit lifetime bound | -LL | T: 'b + Iterator, ::Item: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - T: 'b + Iterator, +LL + T: 'b + Iterator, ::Item: 'a + | note: external requirements --> $DIR/projection-no-regions-closure.rs:52:23 diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr index da76ac1c474a..53da981d7029 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr +++ b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr @@ -9,8 +9,9 @@ LL | Box::new(x.next()) | help: consider adding an explicit lifetime bound | -LL | T: Iterator, ::Item: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - T: Iterator, +LL + T: Iterator, ::Item: 'a + | error[E0309]: the associated type `::Item` may not live long enough --> $DIR/projection-no-regions-fn.rs:28:5 @@ -23,8 +24,9 @@ LL | Box::new(x.next()) | help: consider adding an explicit lifetime bound | -LL | T: 'b + Iterator, ::Item: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - T: 'b + Iterator, +LL + T: 'b + Iterator, ::Item: 'a + | error: aborting due to 2 previous errors diff --git a/tests/ui/non-fmt-panic.stderr b/tests/ui/non-fmt-panic.stderr index 162802b7f610..0134a8ddf292 100644 --- a/tests/ui/non-fmt-panic.stderr +++ b/tests/ui/non-fmt-panic.stderr @@ -184,8 +184,9 @@ LL | std::panic!("{}", 123); | +++++ help: or use std::panic::panic_any instead | -LL | std::panic::panic_any(123); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - std::panic!(123); +LL + std::panic::panic_any(123); + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:31:18 @@ -214,8 +215,9 @@ LL | panic!("{:?}", Some(123)); | +++++++ help: or use std::panic::panic_any instead | -LL | std::panic::panic_any(Some(123)); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - panic!(Some(123)); +LL + std::panic::panic_any(Some(123)); + | warning: panic message contains an unused formatting placeholder --> $DIR/non-fmt-panic.rs:33:12 @@ -267,8 +269,9 @@ LL | panic!("{}", a!()); | +++++ help: or use std::panic::panic_any instead | -LL | std::panic::panic_any(a!()); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - panic!(a!()); +LL + std::panic::panic_any(a!()); + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:47:18 @@ -357,8 +360,9 @@ LL | panic!["{}", 123]; | +++++ help: or use std::panic::panic_any instead | -LL | std::panic::panic_any(123); - | ~~~~~~~~~~~~~~~~~~~~~~ ~ +LL - panic![123]; +LL + std::panic::panic_any(123); + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:55:12 @@ -374,8 +378,9 @@ LL | panic!{"{}", 123}; | +++++ help: or use std::panic::panic_any instead | -LL | std::panic::panic_any(123); - | ~~~~~~~~~~~~~~~~~~~~~~ ~ +LL - panic!{123}; +LL + std::panic::panic_any(123); + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:72:12 @@ -411,8 +416,9 @@ LL | panic!("{:?}", v); | +++++++ help: or use std::panic::panic_any instead | -LL | std::panic::panic_any(v); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - panic!(v); +LL + std::panic::panic_any(v); + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:78:20 @@ -441,8 +447,9 @@ LL | panic!("{}", v); | +++++ help: or use std::panic::panic_any instead | -LL | std::panic::panic_any(v); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - panic!(v); +LL + std::panic::panic_any(v); + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:83:20 @@ -471,8 +478,9 @@ LL | panic!("{}", v); | +++++ help: or use std::panic::panic_any instead | -LL | std::panic::panic_any(v); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - panic!(v); +LL + std::panic::panic_any(v); + | warning: panic message is not a string literal --> $DIR/non-fmt-panic.rs:88:20 diff --git a/tests/ui/not-enough-arguments.stderr b/tests/ui/not-enough-arguments.stderr index 66c96ba43c80..637c2774d5a3 100644 --- a/tests/ui/not-enough-arguments.stderr +++ b/tests/ui/not-enough-arguments.stderr @@ -11,8 +11,9 @@ LL | fn foo(a: isize, b: isize, c: isize, d:isize) { | ^^^ ------- help: provide the argument | -LL | foo(1, 2, 3, /* isize */); - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - foo(1, 2, 3); +LL + foo(1, 2, 3, /* isize */); + | error[E0061]: this function takes 6 arguments but 3 arguments were supplied --> $DIR/not-enough-arguments.rs:29:3 @@ -34,8 +35,9 @@ LL | f: i32, | ------ help: provide the arguments | -LL | bar(1, 2, 3, /* i32 */, /* i32 */, /* i32 */); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - bar(1, 2, 3); +LL + bar(1, 2, 3, /* i32 */, /* i32 */, /* i32 */); + | error: aborting due to 2 previous errors diff --git a/tests/ui/numeric/const-scope.stderr b/tests/ui/numeric/const-scope.stderr index 4e4bcdf234dc..2c8d4da9d218 100644 --- a/tests/ui/numeric/const-scope.stderr +++ b/tests/ui/numeric/const-scope.stderr @@ -6,8 +6,9 @@ LL | const C: i32 = 1i8; | help: change the type of the numeric literal from `i8` to `i32` | -LL | const C: i32 = 1i32; - | ~~~ +LL - const C: i32 = 1i8; +LL + const C: i32 = 1i32; + | error[E0308]: mismatched types --> $DIR/const-scope.rs:2:15 @@ -25,8 +26,9 @@ LL | let c: i32 = 1i8; | help: change the type of the numeric literal from `i8` to `i32` | -LL | let c: i32 = 1i32; - | ~~~ +LL - let c: i32 = 1i8; +LL + let c: i32 = 1i32; + | error[E0308]: mismatched types --> $DIR/const-scope.rs:6:17 @@ -46,8 +48,9 @@ LL | let c: i32 = 1i8; | help: change the type of the numeric literal from `i8` to `i32` | -LL | let c: i32 = 1i32; - | ~~~ +LL - let c: i32 = 1i8; +LL + let c: i32 = 1i32; + | error[E0308]: mismatched types --> $DIR/const-scope.rs:11:17 diff --git a/tests/ui/numeric/numeric-fields.stderr b/tests/ui/numeric/numeric-fields.stderr index 8ab1718ff5e8..6877bb3bef4e 100644 --- a/tests/ui/numeric/numeric-fields.stderr +++ b/tests/ui/numeric/numeric-fields.stderr @@ -9,8 +9,9 @@ LL | let s = S{0b1: 10, 0: 11}; | help: `S` is a tuple struct, use the appropriate syntax | -LL | let s = S(/* u8 */, /* u16 */); - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - let s = S{0b1: 10, 0: 11}; +LL + let s = S(/* u8 */, /* u16 */); + | error[E0026]: struct `S` does not have a field named `0x1` --> $DIR/numeric-fields.rs:7:17 diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-i32.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-i32.stderr index f4fb14e79923..6c6b8b51c226 100644 --- a/tests/ui/numeric/numeric-suffix/numeric-suffix-i32.stderr +++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-i32.stderr @@ -13,8 +13,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `i32` | -LL | foo::(42_i32); - | ~~~ +LL - foo::(42_usize); +LL + foo::(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:32:16 @@ -31,8 +32,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `i32` | -LL | foo::(42_i32); - | ~~~ +LL - foo::(42_u64); +LL + foo::(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:36:16 @@ -49,8 +51,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `i32` | -LL | foo::(42_i32); - | ~~~ +LL - foo::(42_u32); +LL + foo::(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:40:16 @@ -67,8 +70,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `i32` | -LL | foo::(42_i32); - | ~~~ +LL - foo::(42_u16); +LL + foo::(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:44:16 @@ -85,8 +89,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `i32` | -LL | foo::(42_i32); - | ~~~ +LL - foo::(42_u8); +LL + foo::(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:48:16 @@ -103,8 +108,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `i32` | -LL | foo::(42_i32); - | ~~~ +LL - foo::(42_isize); +LL + foo::(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:52:16 @@ -121,8 +127,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `i32` | -LL | foo::(42_i32); - | ~~~ +LL - foo::(42_i64); +LL + foo::(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:57:16 @@ -139,8 +146,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `i32` | -LL | foo::(42_i32); - | ~~~ +LL - foo::(42_i16); +LL + foo::(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:61:16 @@ -157,8 +165,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `i32` | -LL | foo::(42_i32); - | ~~~ +LL - foo::(42_i8); +LL + foo::(42_i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:65:16 @@ -175,8 +184,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `i32` | -LL | foo::(42i32); - | ~~~ +LL - foo::(42.0_f64); +LL + foo::(42i32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i32.rs:69:16 @@ -193,8 +203,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `i32` | -LL | foo::(42i32); - | ~~~ +LL - foo::(42.0_f32); +LL + foo::(42i32); + | error: aborting due to 11 previous errors diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-i64.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-i64.stderr index 47efe9f08bbd..7c26dd7be1c6 100644 --- a/tests/ui/numeric/numeric-suffix/numeric-suffix-i64.stderr +++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-i64.stderr @@ -13,8 +13,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `i64` | -LL | foo::(42_i64); - | ~~~ +LL - foo::(42_usize); +LL + foo::(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:32:16 @@ -31,8 +32,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `i64` | -LL | foo::(42_i64); - | ~~~ +LL - foo::(42_u64); +LL + foo::(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:36:16 @@ -49,8 +51,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `i64` | -LL | foo::(42_i64); - | ~~~ +LL - foo::(42_u32); +LL + foo::(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:40:16 @@ -67,8 +70,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `i64` | -LL | foo::(42_i64); - | ~~~ +LL - foo::(42_u16); +LL + foo::(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:44:16 @@ -85,8 +89,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `i64` | -LL | foo::(42_i64); - | ~~~ +LL - foo::(42_u8); +LL + foo::(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:48:16 @@ -103,8 +108,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `i64` | -LL | foo::(42_i64); - | ~~~ +LL - foo::(42_isize); +LL + foo::(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:53:16 @@ -121,8 +127,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `i64` | -LL | foo::(42_i64); - | ~~~ +LL - foo::(42_i32); +LL + foo::(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:57:16 @@ -139,8 +146,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `i64` | -LL | foo::(42_i64); - | ~~~ +LL - foo::(42_i16); +LL + foo::(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:61:16 @@ -157,8 +165,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `i64` | -LL | foo::(42_i64); - | ~~~ +LL - foo::(42_i8); +LL + foo::(42_i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:65:16 @@ -175,8 +184,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `i64` | -LL | foo::(42i64); - | ~~~ +LL - foo::(42.0_f64); +LL + foo::(42i64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-i64.rs:69:16 @@ -193,8 +203,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `i64` | -LL | foo::(42i64); - | ~~~ +LL - foo::(42.0_f32); +LL + foo::(42i64); + | error: aborting due to 11 previous errors diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-isize.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-isize.stderr index 28b79413f68d..8365350f2bfe 100644 --- a/tests/ui/numeric/numeric-suffix/numeric-suffix-isize.stderr +++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-isize.stderr @@ -13,8 +13,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `isize` | -LL | foo::(42_isize); - | ~~~~~ +LL - foo::(42_usize); +LL + foo::(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:32:18 @@ -31,8 +32,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `isize` | -LL | foo::(42_isize); - | ~~~~~ +LL - foo::(42_u64); +LL + foo::(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:36:18 @@ -49,8 +51,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `isize` | -LL | foo::(42_isize); - | ~~~~~ +LL - foo::(42_u32); +LL + foo::(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:40:18 @@ -67,8 +70,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `isize` | -LL | foo::(42_isize); - | ~~~~~ +LL - foo::(42_u16); +LL + foo::(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:44:18 @@ -85,8 +89,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `isize` | -LL | foo::(42_isize); - | ~~~~~ +LL - foo::(42_u8); +LL + foo::(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:49:18 @@ -103,8 +108,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `isize` | -LL | foo::(42_isize); - | ~~~~~ +LL - foo::(42_i64); +LL + foo::(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:53:18 @@ -121,8 +127,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `isize` | -LL | foo::(42_isize); - | ~~~~~ +LL - foo::(42_i32); +LL + foo::(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:57:18 @@ -139,8 +146,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `isize` | -LL | foo::(42_isize); - | ~~~~~ +LL - foo::(42_i16); +LL + foo::(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:61:18 @@ -157,8 +165,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `isize` | -LL | foo::(42_isize); - | ~~~~~ +LL - foo::(42_i8); +LL + foo::(42_isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:65:18 @@ -175,8 +184,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `isize` | -LL | foo::(42isize); - | ~~~~~ +LL - foo::(42.0_f64); +LL + foo::(42isize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-isize.rs:69:18 @@ -193,8 +203,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `isize` | -LL | foo::(42isize); - | ~~~~~ +LL - foo::(42.0_f32); +LL + foo::(42isize); + | error: aborting due to 11 previous errors diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-u32.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-u32.stderr index d966893a83b4..610e6ece2769 100644 --- a/tests/ui/numeric/numeric-suffix/numeric-suffix-u32.stderr +++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-u32.stderr @@ -13,8 +13,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `u32` | -LL | foo::(42_u32); - | ~~~ +LL - foo::(42_usize); +LL + foo::(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:32:16 @@ -31,8 +32,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `u32` | -LL | foo::(42_u32); - | ~~~ +LL - foo::(42_u64); +LL + foo::(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:37:16 @@ -49,8 +51,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `u32` | -LL | foo::(42_u32); - | ~~~ +LL - foo::(42_u16); +LL + foo::(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:41:16 @@ -67,8 +70,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `u32` | -LL | foo::(42_u32); - | ~~~ +LL - foo::(42_u8); +LL + foo::(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:45:16 @@ -85,8 +89,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `u32` | -LL | foo::(42_u32); - | ~~~ +LL - foo::(42_isize); +LL + foo::(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:49:16 @@ -103,8 +108,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `u32` | -LL | foo::(42_u32); - | ~~~ +LL - foo::(42_i64); +LL + foo::(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:53:16 @@ -121,8 +127,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `u32` | -LL | foo::(42_u32); - | ~~~ +LL - foo::(42_i32); +LL + foo::(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:57:16 @@ -139,8 +146,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `u32` | -LL | foo::(42_u32); - | ~~~ +LL - foo::(42_i16); +LL + foo::(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:61:16 @@ -157,8 +165,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `u32` | -LL | foo::(42_u32); - | ~~~ +LL - foo::(42_i8); +LL + foo::(42_u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:65:16 @@ -175,8 +184,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `u32` | -LL | foo::(42u32); - | ~~~ +LL - foo::(42.0_f64); +LL + foo::(42u32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u32.rs:69:16 @@ -193,8 +203,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `u32` | -LL | foo::(42u32); - | ~~~ +LL - foo::(42.0_f32); +LL + foo::(42u32); + | error: aborting due to 11 previous errors diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-u64.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-u64.stderr index ff332fa914dd..112dddccd6f4 100644 --- a/tests/ui/numeric/numeric-suffix/numeric-suffix-u64.stderr +++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-u64.stderr @@ -13,8 +13,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `u64` | -LL | foo::(42_u64); - | ~~~ +LL - foo::(42_usize); +LL + foo::(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:33:16 @@ -31,8 +32,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `u64` | -LL | foo::(42_u64); - | ~~~ +LL - foo::(42_u32); +LL + foo::(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:37:16 @@ -49,8 +51,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `u64` | -LL | foo::(42_u64); - | ~~~ +LL - foo::(42_u16); +LL + foo::(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:41:16 @@ -67,8 +70,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `u64` | -LL | foo::(42_u64); - | ~~~ +LL - foo::(42_u8); +LL + foo::(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:45:16 @@ -85,8 +89,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `u64` | -LL | foo::(42_u64); - | ~~~ +LL - foo::(42_isize); +LL + foo::(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:49:16 @@ -103,8 +108,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `u64` | -LL | foo::(42_u64); - | ~~~ +LL - foo::(42_i64); +LL + foo::(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:53:16 @@ -121,8 +127,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `u64` | -LL | foo::(42_u64); - | ~~~ +LL - foo::(42_i32); +LL + foo::(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:57:16 @@ -139,8 +146,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `u64` | -LL | foo::(42_u64); - | ~~~ +LL - foo::(42_i16); +LL + foo::(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:61:16 @@ -157,8 +165,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `u64` | -LL | foo::(42_u64); - | ~~~ +LL - foo::(42_i8); +LL + foo::(42_u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:65:16 @@ -175,8 +184,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `u64` | -LL | foo::(42u64); - | ~~~ +LL - foo::(42.0_f64); +LL + foo::(42u64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-u64.rs:69:16 @@ -193,8 +203,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `u64` | -LL | foo::(42u64); - | ~~~ +LL - foo::(42.0_f32); +LL + foo::(42u64); + | error: aborting due to 11 previous errors diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix-usize.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix-usize.stderr index 4889abee69c2..e7d6a04f18ef 100644 --- a/tests/ui/numeric/numeric-suffix/numeric-suffix-usize.stderr +++ b/tests/ui/numeric/numeric-suffix/numeric-suffix-usize.stderr @@ -13,8 +13,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `usize` | -LL | foo::(42_usize); - | ~~~~~ +LL - foo::(42_u64); +LL + foo::(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:33:18 @@ -31,8 +32,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `usize` | -LL | foo::(42_usize); - | ~~~~~ +LL - foo::(42_u32); +LL + foo::(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:37:18 @@ -49,8 +51,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `usize` | -LL | foo::(42_usize); - | ~~~~~ +LL - foo::(42_u16); +LL + foo::(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:41:18 @@ -67,8 +70,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `usize` | -LL | foo::(42_usize); - | ~~~~~ +LL - foo::(42_u8); +LL + foo::(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:45:18 @@ -85,8 +89,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `usize` | -LL | foo::(42_usize); - | ~~~~~ +LL - foo::(42_isize); +LL + foo::(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:49:18 @@ -103,8 +108,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `usize` | -LL | foo::(42_usize); - | ~~~~~ +LL - foo::(42_i64); +LL + foo::(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:53:18 @@ -121,8 +127,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `usize` | -LL | foo::(42_usize); - | ~~~~~ +LL - foo::(42_i32); +LL + foo::(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:57:18 @@ -139,8 +146,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `usize` | -LL | foo::(42_usize); - | ~~~~~ +LL - foo::(42_i16); +LL + foo::(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:61:18 @@ -157,8 +165,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `usize` | -LL | foo::(42_usize); - | ~~~~~ +LL - foo::(42_i8); +LL + foo::(42_usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:65:18 @@ -175,8 +184,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `usize` | -LL | foo::(42usize); - | ~~~~~ +LL - foo::(42.0_f64); +LL + foo::(42usize); + | error[E0308]: mismatched types --> $DIR/numeric-suffix-usize.rs:69:18 @@ -193,8 +203,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `usize` | -LL | foo::(42usize); - | ~~~~~ +LL - foo::(42.0_f32); +LL + foo::(42usize); + | error: aborting due to 11 previous errors diff --git a/tests/ui/numeric/numeric-suffix/numeric-suffix.stderr b/tests/ui/numeric/numeric-suffix/numeric-suffix.stderr index e05913b9c621..d26639a76f0f 100644 --- a/tests/ui/numeric/numeric-suffix/numeric-suffix.stderr +++ b/tests/ui/numeric/numeric-suffix/numeric-suffix.stderr @@ -13,8 +13,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `u16` | -LL | foo::(42_u16); - | ~~~ +LL - foo::(42_usize); +LL + foo::(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:147:16 @@ -31,8 +32,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `u16` | -LL | foo::(42_u16); - | ~~~ +LL - foo::(42_u64); +LL + foo::(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:151:16 @@ -49,8 +51,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `u16` | -LL | foo::(42_u16); - | ~~~ +LL - foo::(42_u32); +LL + foo::(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:156:16 @@ -67,8 +70,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `u16` | -LL | foo::(42_u16); - | ~~~ +LL - foo::(42_u8); +LL + foo::(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:160:16 @@ -85,8 +89,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `u16` | -LL | foo::(42_u16); - | ~~~ +LL - foo::(42_isize); +LL + foo::(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:164:16 @@ -103,8 +108,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `u16` | -LL | foo::(42_u16); - | ~~~ +LL - foo::(42_i64); +LL + foo::(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:168:16 @@ -121,8 +127,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `u16` | -LL | foo::(42_u16); - | ~~~ +LL - foo::(42_i32); +LL + foo::(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:172:16 @@ -139,8 +146,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `u16` | -LL | foo::(42_u16); - | ~~~ +LL - foo::(42_i16); +LL + foo::(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:176:16 @@ -157,8 +165,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `u16` | -LL | foo::(42_u16); - | ~~~ +LL - foo::(42_i8); +LL + foo::(42_u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:180:16 @@ -175,8 +184,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `u16` | -LL | foo::(42u16); - | ~~~ +LL - foo::(42.0_f64); +LL + foo::(42u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:184:16 @@ -193,8 +203,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `u16` | -LL | foo::(42u16); - | ~~~ +LL - foo::(42.0_f32); +LL + foo::(42u16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:189:16 @@ -211,8 +222,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `i16` | -LL | foo::(42_i16); - | ~~~ +LL - foo::(42_usize); +LL + foo::(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:193:16 @@ -229,8 +241,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `i16` | -LL | foo::(42_i16); - | ~~~ +LL - foo::(42_u64); +LL + foo::(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:197:16 @@ -247,8 +260,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `i16` | -LL | foo::(42_i16); - | ~~~ +LL - foo::(42_u32); +LL + foo::(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:201:16 @@ -265,8 +279,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `i16` | -LL | foo::(42_i16); - | ~~~ +LL - foo::(42_u16); +LL + foo::(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:205:16 @@ -283,8 +298,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `i16` | -LL | foo::(42_i16); - | ~~~ +LL - foo::(42_u8); +LL + foo::(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:209:16 @@ -301,8 +317,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `i16` | -LL | foo::(42_i16); - | ~~~ +LL - foo::(42_isize); +LL + foo::(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:213:16 @@ -319,8 +336,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `i16` | -LL | foo::(42_i16); - | ~~~ +LL - foo::(42_i64); +LL + foo::(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:217:16 @@ -337,8 +355,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `i16` | -LL | foo::(42_i16); - | ~~~ +LL - foo::(42_i32); +LL + foo::(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:222:16 @@ -355,8 +374,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `i16` | -LL | foo::(42_i16); - | ~~~ +LL - foo::(42_i8); +LL + foo::(42_i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:226:16 @@ -373,8 +393,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `i16` | -LL | foo::(42i16); - | ~~~ +LL - foo::(42.0_f64); +LL + foo::(42i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:230:16 @@ -391,8 +412,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `i16` | -LL | foo::(42i16); - | ~~~ +LL - foo::(42.0_f32); +LL + foo::(42i16); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:235:15 @@ -409,8 +431,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `u8` | -LL | foo::(42_u8); - | ~~ +LL - foo::(42_usize); +LL + foo::(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:239:15 @@ -427,8 +450,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `u8` | -LL | foo::(42_u8); - | ~~ +LL - foo::(42_u64); +LL + foo::(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:243:15 @@ -445,8 +469,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `u8` | -LL | foo::(42_u8); - | ~~ +LL - foo::(42_u32); +LL + foo::(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:247:15 @@ -463,8 +488,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `u8` | -LL | foo::(42_u8); - | ~~ +LL - foo::(42_u16); +LL + foo::(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:252:15 @@ -481,8 +507,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `u8` | -LL | foo::(42_u8); - | ~~ +LL - foo::(42_isize); +LL + foo::(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:256:15 @@ -499,8 +526,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `u8` | -LL | foo::(42_u8); - | ~~ +LL - foo::(42_i64); +LL + foo::(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:260:15 @@ -517,8 +545,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `u8` | -LL | foo::(42_u8); - | ~~ +LL - foo::(42_i32); +LL + foo::(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:264:15 @@ -535,8 +564,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `u8` | -LL | foo::(42_u8); - | ~~ +LL - foo::(42_i16); +LL + foo::(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:268:15 @@ -553,8 +583,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i8` to `u8` | -LL | foo::(42_u8); - | ~~ +LL - foo::(42_i8); +LL + foo::(42_u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:272:15 @@ -571,8 +602,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `u8` | -LL | foo::(42u8); - | ~~ +LL - foo::(42.0_f64); +LL + foo::(42u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:276:15 @@ -589,8 +621,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `u8` | -LL | foo::(42u8); - | ~~ +LL - foo::(42.0_f32); +LL + foo::(42u8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:281:15 @@ -607,8 +640,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `i8` | -LL | foo::(42_i8); - | ~~ +LL - foo::(42_usize); +LL + foo::(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:285:15 @@ -625,8 +659,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `i8` | -LL | foo::(42_i8); - | ~~ +LL - foo::(42_u64); +LL + foo::(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:289:15 @@ -643,8 +678,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `i8` | -LL | foo::(42_i8); - | ~~ +LL - foo::(42_u32); +LL + foo::(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:293:15 @@ -661,8 +697,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u16` to `i8` | -LL | foo::(42_i8); - | ~~ +LL - foo::(42_u16); +LL + foo::(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:297:15 @@ -679,8 +716,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u8` to `i8` | -LL | foo::(42_i8); - | ~~ +LL - foo::(42_u8); +LL + foo::(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:301:15 @@ -697,8 +735,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `i8` | -LL | foo::(42_i8); - | ~~ +LL - foo::(42_isize); +LL + foo::(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:305:15 @@ -715,8 +754,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `i8` | -LL | foo::(42_i8); - | ~~ +LL - foo::(42_i64); +LL + foo::(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:309:15 @@ -733,8 +773,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `i8` | -LL | foo::(42_i8); - | ~~ +LL - foo::(42_i32); +LL + foo::(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:313:15 @@ -751,8 +792,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i16` to `i8` | -LL | foo::(42_i8); - | ~~ +LL - foo::(42_i16); +LL + foo::(42_i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:318:15 @@ -769,8 +811,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `i8` | -LL | foo::(42i8); - | ~~ +LL - foo::(42.0_f64); +LL + foo::(42i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:322:15 @@ -787,8 +830,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `i8` | -LL | foo::(42i8); - | ~~ +LL - foo::(42.0_f32); +LL + foo::(42i8); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:327:16 @@ -805,8 +849,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `f64` | -LL | foo::(42_f64); - | ~~~ +LL - foo::(42_usize); +LL + foo::(42_f64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:331:16 @@ -823,8 +868,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `f64` | -LL | foo::(42_f64); - | ~~~ +LL - foo::(42_u64); +LL + foo::(42_f64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:335:16 @@ -895,8 +941,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `f64` | -LL | foo::(42_f64); - | ~~~ +LL - foo::(42_isize); +LL + foo::(42_f64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:351:16 @@ -913,8 +960,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `f64` | -LL | foo::(42_f64); - | ~~~ +LL - foo::(42_i64); +LL + foo::(42_f64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:355:16 @@ -985,8 +1033,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f32` to `f64` | -LL | foo::(42.0_f64); - | ~~~ +LL - foo::(42.0_f32); +LL + foo::(42.0_f64); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:373:16 @@ -1003,8 +1052,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `usize` to `f32` | -LL | foo::(42_f32); - | ~~~ +LL - foo::(42_usize); +LL + foo::(42_f32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:377:16 @@ -1021,8 +1071,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u64` to `f32` | -LL | foo::(42_f32); - | ~~~ +LL - foo::(42_u64); +LL + foo::(42_f32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:381:16 @@ -1039,8 +1090,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `u32` to `f32` | -LL | foo::(42_f32); - | ~~~ +LL - foo::(42_u32); +LL + foo::(42_f32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:385:16 @@ -1093,8 +1145,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `isize` to `f32` | -LL | foo::(42_f32); - | ~~~ +LL - foo::(42_isize); +LL + foo::(42_f32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:397:16 @@ -1111,8 +1164,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i64` to `f32` | -LL | foo::(42_f32); - | ~~~ +LL - foo::(42_i64); +LL + foo::(42_f32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:401:16 @@ -1129,8 +1183,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `i32` to `f32` | -LL | foo::(42_f32); - | ~~~ +LL - foo::(42_i32); +LL + foo::(42_f32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:405:16 @@ -1183,8 +1238,9 @@ LL | fn foo(_x: N) {} | ^^^ ----- help: change the type of the numeric literal from `f64` to `f32` | -LL | foo::(42.0_f32); - | ~~~ +LL - foo::(42.0_f64); +LL + foo::(42.0_f32); + | error[E0308]: mismatched types --> $DIR/numeric-suffix.rs:419:16 diff --git a/tests/ui/object-pointer-types.stderr b/tests/ui/object-pointer-types.stderr index 7d915ebdab65..7e3a13dd90be 100644 --- a/tests/ui/object-pointer-types.stderr +++ b/tests/ui/object-pointer-types.stderr @@ -9,8 +9,9 @@ LL | x.owned(); | help: there is a method `to_owned` with a similar name | -LL | x.to_owned(); - | ~~~~~~~~ +LL - x.owned(); +LL + x.to_owned(); + | error[E0599]: no method named `owned` found for mutable reference `&mut dyn Foo` in the current scope --> $DIR/object-pointer-types.rs:17:7 diff --git a/tests/ui/obsolete-in-place/bad.stderr b/tests/ui/obsolete-in-place/bad.stderr index 363dfb77628c..1409a6637890 100644 --- a/tests/ui/obsolete-in-place/bad.stderr +++ b/tests/ui/obsolete-in-place/bad.stderr @@ -6,8 +6,9 @@ LL | x <- y; | help: if you meant to write a comparison against a negative value, add a space in between `<` and `-` | -LL | x < - y; - | ~~~ +LL - x <- y; +LL + x < - y; + | error: expected expression, found keyword `in` --> $DIR/bad.rs:10:5 diff --git a/tests/ui/on-unimplemented/bad-annotation.stderr b/tests/ui/on-unimplemented/bad-annotation.stderr index 9bb9423788c2..0482a5c58559 100644 --- a/tests/ui/on-unimplemented/bad-annotation.stderr +++ b/tests/ui/on-unimplemented/bad-annotation.stderr @@ -6,9 +6,11 @@ LL | #[rustc_on_unimplemented] | help: the following are the possible correct uses | -LL | #[rustc_on_unimplemented = "message"] +LL - #[rustc_on_unimplemented] +LL + #[rustc_on_unimplemented = "message"] | -LL | #[rustc_on_unimplemented(/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...")] +LL - #[rustc_on_unimplemented] +LL + #[rustc_on_unimplemented(/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...")] | error[E0230]: there is no parameter `C` on trait `BadAnnotation2` diff --git a/tests/ui/on-unimplemented/issue-104140.stderr b/tests/ui/on-unimplemented/issue-104140.stderr index 4ba5475d9eca..5c9d5e8d5539 100644 --- a/tests/ui/on-unimplemented/issue-104140.stderr +++ b/tests/ui/on-unimplemented/issue-104140.stderr @@ -6,10 +6,12 @@ LL | #[rustc_on_unimplemented] | help: the following are the possible correct uses | -LL | #[rustc_on_unimplemented = "message"] - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | #[rustc_on_unimplemented(/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...")] - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - #[rustc_on_unimplemented] +LL + #[rustc_on_unimplemented = "message"] + | +LL - #[rustc_on_unimplemented] +LL + #[rustc_on_unimplemented(/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...")] + | error: aborting due to 1 previous error diff --git a/tests/ui/operator-recovery/less-than-greater-than.stderr b/tests/ui/operator-recovery/less-than-greater-than.stderr index 36a4a81035f1..429bda9cefcd 100644 --- a/tests/ui/operator-recovery/less-than-greater-than.stderr +++ b/tests/ui/operator-recovery/less-than-greater-than.stderr @@ -6,8 +6,9 @@ LL | println!("{}", 1 <> 2); | help: `<>` is not a valid comparison operator, use `!=` | -LL | println!("{}", 1 != 2); - | ~~ +LL - println!("{}", 1 <> 2); +LL + println!("{}", 1 != 2); + | error: aborting due to 1 previous error diff --git a/tests/ui/or-patterns/multiple-pattern-typo.stderr b/tests/ui/or-patterns/multiple-pattern-typo.stderr index 2e66f54979b0..fea3ed766919 100644 --- a/tests/ui/or-patterns/multiple-pattern-typo.stderr +++ b/tests/ui/or-patterns/multiple-pattern-typo.stderr @@ -8,8 +8,9 @@ LL | 1 | 2 || 3 => (), | help: use a single `|` to separate multiple alternative patterns | -LL | 1 | 2 | 3 => (), - | ~ +LL - 1 | 2 || 3 => (), +LL + 1 | 2 | 3 => (), + | error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:12:16 @@ -21,8 +22,9 @@ LL | (1 | 2 || 3) => (), | help: use a single `|` to separate multiple alternative patterns | -LL | (1 | 2 | 3) => (), - | ~ +LL - (1 | 2 || 3) => (), +LL + (1 | 2 | 3) => (), + | error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:17:16 @@ -34,8 +36,9 @@ LL | (1 | 2 || 3,) => (), | help: use a single `|` to separate multiple alternative patterns | -LL | (1 | 2 | 3,) => (), - | ~ +LL - (1 | 2 || 3,) => (), +LL + (1 | 2 | 3,) => (), + | error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:24:18 @@ -47,8 +50,9 @@ LL | TS(1 | 2 || 3) => (), | help: use a single `|` to separate multiple alternative patterns | -LL | TS(1 | 2 | 3) => (), - | ~ +LL - TS(1 | 2 || 3) => (), +LL + TS(1 | 2 | 3) => (), + | error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:31:23 @@ -60,8 +64,9 @@ LL | NS { f: 1 | 2 || 3 } => (), | help: use a single `|` to separate multiple alternative patterns | -LL | NS { f: 1 | 2 | 3 } => (), - | ~ +LL - NS { f: 1 | 2 || 3 } => (), +LL + NS { f: 1 | 2 | 3 } => (), + | error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:36:16 @@ -73,8 +78,9 @@ LL | [1 | 2 || 3] => (), | help: use a single `|` to separate multiple alternative patterns | -LL | [1 | 2 | 3] => (), - | ~ +LL - [1 | 2 || 3] => (), +LL + [1 | 2 | 3] => (), + | error: unexpected token `||` in pattern --> $DIR/multiple-pattern-typo.rs:41:9 @@ -84,8 +90,9 @@ LL | || 1 | 2 | 3 => (), | help: use a single `|` to separate multiple alternative patterns | -LL | | 1 | 2 | 3 => (), - | ~ +LL - || 1 | 2 | 3 => (), +LL + | 1 | 2 | 3 => (), + | error: aborting due to 7 previous errors diff --git a/tests/ui/or-patterns/remove-leading-vert.stderr b/tests/ui/or-patterns/remove-leading-vert.stderr index 5177e98f0d90..b92fcb89a404 100644 --- a/tests/ui/or-patterns/remove-leading-vert.stderr +++ b/tests/ui/or-patterns/remove-leading-vert.stderr @@ -31,8 +31,9 @@ LL | let ( || A): (E); | help: use a single `|` to separate multiple alternative patterns | -LL | let ( | A): (E); - | ~ +LL - let ( || A): (E); +LL + let ( | A): (E); + | error: unexpected token `||` in pattern --> $DIR/remove-leading-vert.rs:17:11 @@ -42,8 +43,9 @@ LL | let [ || A ]: [E; 1]; | help: use a single `|` to separate multiple alternative patterns | -LL | let [ | A ]: [E; 1]; - | ~ +LL - let [ || A ]: [E; 1]; +LL + let [ | A ]: [E; 1]; + | error: unexpected token `||` in pattern --> $DIR/remove-leading-vert.rs:19:13 @@ -53,8 +55,9 @@ LL | let TS( || A ): TS; | help: use a single `|` to separate multiple alternative patterns | -LL | let TS( | A ): TS; - | ~ +LL - let TS( || A ): TS; +LL + let TS( | A ): TS; + | error: unexpected token `||` in pattern --> $DIR/remove-leading-vert.rs:21:17 @@ -64,8 +67,9 @@ LL | let NS { f: || A }: NS; | help: use a single `|` to separate multiple alternative patterns | -LL | let NS { f: | A }: NS; - | ~ +LL - let NS { f: || A }: NS; +LL + let NS { f: | A }: NS; + | error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:26:13 @@ -147,8 +151,9 @@ LL | let ( A || B | ): E; | help: use a single `|` to separate multiple alternative patterns | -LL | let ( A | B | ): E; - | ~ +LL - let ( A || B | ): E; +LL + let ( A | B | ): E; + | error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:31:18 @@ -203,8 +208,9 @@ LL | A || B | => {} | help: use a single `|` to separate multiple alternative patterns | -LL | A | B | => {} - | ~ +LL - A || B | => {} +LL + A | B | => {} + | error: a trailing `|` is not allowed in an or-pattern --> $DIR/remove-leading-vert.rs:36:16 diff --git a/tests/ui/panic-handler/weak-lang-item.stderr b/tests/ui/panic-handler/weak-lang-item.stderr index de351d2c3e4a..e9d444c1c4d8 100644 --- a/tests/ui/panic-handler/weak-lang-item.stderr +++ b/tests/ui/panic-handler/weak-lang-item.stderr @@ -7,7 +7,8 @@ LL | extern crate core; = note: `core` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | extern crate core as other_core; +LL - extern crate core; +LL + extern crate core as other_core; | error: `#[panic_handler]` function required, but not found diff --git a/tests/ui/parser/bad-char-literals.stderr b/tests/ui/parser/bad-char-literals.stderr index 5a81ede0336f..3513055cb550 100644 --- a/tests/ui/parser/bad-char-literals.stderr +++ b/tests/ui/parser/bad-char-literals.stderr @@ -6,8 +6,9 @@ LL | '''; | help: escape the character | -LL | '\''; - | ~~ +LL - '''; +LL + '\''; + | error: character constant must be escaped: `\n` --> $DIR/bad-char-literals.rs:10:6 @@ -41,8 +42,9 @@ LL | '-␀-'; | help: if you meant to write a string literal, use double quotes | -LL | "-␀-"; - | ~ ~ +LL - '-␀-'; +LL + "-␀-"; + | error: character constant must be escaped: `\t` --> $DIR/bad-char-literals.rs:21:6 diff --git a/tests/ui/parser/bad-crate-name.stderr b/tests/ui/parser/bad-crate-name.stderr index c98a620f1237..2218062fa28e 100644 --- a/tests/ui/parser/bad-crate-name.stderr +++ b/tests/ui/parser/bad-crate-name.stderr @@ -6,8 +6,9 @@ LL | extern crate krate-name-here; | help: if the original crate name uses dashes you need to use underscores in the code | -LL | extern crate krate_name_here; - | ~ ~ +LL - extern crate krate-name-here; +LL + extern crate krate_name_here; + | error[E0463]: can't find crate for `krate_name_here` --> $DIR/bad-crate-name.rs:1:1 diff --git a/tests/ui/parser/bad-escape-suggest-raw-string.stderr b/tests/ui/parser/bad-escape-suggest-raw-string.stderr index 6dd4ad512a8e..5afa1f4a7f80 100644 --- a/tests/ui/parser/bad-escape-suggest-raw-string.stderr +++ b/tests/ui/parser/bad-escape-suggest-raw-string.stderr @@ -7,8 +7,9 @@ LL | let bad = "ab\[c"; = help: for more information, visit help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | -LL | let bad = r"ab\[c"; - | ~~~~~~~~ +LL - let bad = "ab\[c"; +LL + let bad = r"ab\[c"; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/bad-let-else-statement.stderr b/tests/ui/parser/bad-let-else-statement.stderr index 79d722bb7ac4..ba5645299831 100644 --- a/tests/ui/parser/bad-let-else-statement.stderr +++ b/tests/ui/parser/bad-let-else-statement.stderr @@ -225,8 +225,9 @@ LL | let bad = format_args! {""} else { return; }; | help: use parentheses instead of braces for this macro | -LL | let bad = format_args! ("") else { return; }; - | ~ ~ +LL - let bad = format_args! {""} else { return; }; +LL + let bad = format_args! ("") else { return; }; + | error: right curly brace `}` before `else` in a `let...else` statement not allowed --> $DIR/bad-let-else-statement.rs:207:5 @@ -254,8 +255,9 @@ LL | b!(2); = note: this error originates in the macro `b` (in Nightly builds, run with -Z macro-backtrace for more info) help: use parentheses instead of braces for this macro | -LL | let 0 = a! () else { return; }; - | ~~ +LL - let 0 = a! {} else { return; }; +LL + let 0 = a! () else { return; }; + | warning: irrefutable `let...else` pattern --> $DIR/bad-let-else-statement.rs:95:5 diff --git a/tests/ui/parser/bad-lit-suffixes.stderr b/tests/ui/parser/bad-lit-suffixes.stderr index 121db2058f10..704f7363e81c 100644 --- a/tests/ui/parser/bad-lit-suffixes.stderr +++ b/tests/ui/parser/bad-lit-suffixes.stderr @@ -30,9 +30,11 @@ LL | #[must_use = "string"suffix] | help: the following are the possible correct uses | -LL | #[must_use = "reason"] +LL - #[must_use = "string"suffix] +LL + #[must_use = "reason"] | -LL | #[must_use] +LL - #[must_use = "string"suffix] +LL + #[must_use] | error: suffixes on string literals are invalid diff --git a/tests/ui/parser/byte-literals.stderr b/tests/ui/parser/byte-literals.stderr index 25e319954418..fe3cfb23de85 100644 --- a/tests/ui/parser/byte-literals.stderr +++ b/tests/ui/parser/byte-literals.stderr @@ -39,8 +39,9 @@ LL | b'''; | help: escape the character | -LL | b'\''; - | ~~ +LL - b'''; +LL + b'\''; + | error: non-ASCII character in byte literal --> $DIR/byte-literals.rs:10:7 @@ -50,8 +51,9 @@ LL | b'é'; | help: if you meant to use the unicode code point for 'é', use a \xHH escape | -LL | b'\xE9'; - | ~~~~ +LL - b'é'; +LL + b'\xE9'; + | error[E0763]: unterminated byte constant --> $DIR/byte-literals.rs:11:6 diff --git a/tests/ui/parser/byte-string-literals.stderr b/tests/ui/parser/byte-string-literals.stderr index 24e0eaac8fa9..086337425577 100644 --- a/tests/ui/parser/byte-string-literals.stderr +++ b/tests/ui/parser/byte-string-literals.stderr @@ -28,8 +28,9 @@ LL | b"é"; | help: if you meant to use the unicode code point for 'é', use a \xHH escape | -LL | b"\xE9"; - | ~~~~ +LL - b"é"; +LL + b"\xE9"; + | error: non-ASCII character in raw byte string literal --> $DIR/byte-string-literals.rs:7:10 diff --git a/tests/ui/parser/char/whitespace-character-literal.stderr b/tests/ui/parser/char/whitespace-character-literal.stderr index f273b5d61d57..53f2eb3ecbab 100644 --- a/tests/ui/parser/char/whitespace-character-literal.stderr +++ b/tests/ui/parser/char/whitespace-character-literal.stderr @@ -11,8 +11,9 @@ LL | let _hair_space_around = ' x​'; | ^^ help: consider removing the non-printing characters | -LL | let _hair_space_around = 'x​'; - | ~ +LL - let _hair_space_around = ' x​'; +LL + let _hair_space_around = 'x​'; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/const-param-decl-on-type-instead-of-impl.stderr b/tests/ui/parser/const-param-decl-on-type-instead-of-impl.stderr index 104dbd02685b..855163e3d3bd 100644 --- a/tests/ui/parser/const-param-decl-on-type-instead-of-impl.stderr +++ b/tests/ui/parser/const-param-decl-on-type-instead-of-impl.stderr @@ -6,8 +6,9 @@ LL | impl NInts {} | help: `const` parameters must be declared for the `impl` | -LL | impl NInts {} - | ++++++++++++++++ ~ +LL - impl NInts {} +LL + impl NInts {} + | error: unexpected `const` parameter declaration --> $DIR/const-param-decl-on-type-instead-of-impl.rs:8:17 diff --git a/tests/ui/parser/default-on-wrong-item-kind.stderr b/tests/ui/parser/default-on-wrong-item-kind.stderr index 392c85e0c43d..56641565b166 100644 --- a/tests/ui/parser/default-on-wrong-item-kind.stderr +++ b/tests/ui/parser/default-on-wrong-item-kind.stderr @@ -159,8 +159,9 @@ LL | default const foo: u8; = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html help: try using a static value | -LL | static foo: u8; - | ~~~~~~ +LL - default const foo: u8; +LL + static foo: u8; + | error: a module cannot be `default` --> $DIR/default-on-wrong-item-kind.rs:41:5 diff --git a/tests/ui/parser/do-catch-suggests-try.stderr b/tests/ui/parser/do-catch-suggests-try.stderr index fd3406ae29f8..2eaab8360759 100644 --- a/tests/ui/parser/do-catch-suggests-try.stderr +++ b/tests/ui/parser/do-catch-suggests-try.stderr @@ -7,8 +7,9 @@ LL | let _: Option<()> = do catch {}; = note: following RFC #2388, the new non-placeholder syntax is `try` help: replace with the new syntax | -LL | let _: Option<()> = try {}; - | ~~~ +LL - let _: Option<()> = do catch {}; +LL + let _: Option<()> = try {}; + | error[E0308]: mismatched types --> $DIR/do-catch-suggests-try.rs:9:33 diff --git a/tests/ui/parser/dotdotdot-expr.stderr b/tests/ui/parser/dotdotdot-expr.stderr index 208c04bd3df5..f0bc57264a60 100644 --- a/tests/ui/parser/dotdotdot-expr.stderr +++ b/tests/ui/parser/dotdotdot-expr.stderr @@ -6,12 +6,14 @@ LL | let _redemptive = 1...21; | help: use `..` for an exclusive range | -LL | let _redemptive = 1..21; - | ~~ +LL - let _redemptive = 1...21; +LL + let _redemptive = 1..21; + | help: or `..=` for an inclusive range | -LL | let _redemptive = 1..=21; - | ~~~ +LL - let _redemptive = 1...21; +LL + let _redemptive = 1..=21; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/duplicate-where-clauses.stderr b/tests/ui/parser/duplicate-where-clauses.stderr index 8250d4f1e056..298cdab0c68c 100644 --- a/tests/ui/parser/duplicate-where-clauses.stderr +++ b/tests/ui/parser/duplicate-where-clauses.stderr @@ -8,8 +8,9 @@ LL | struct A where (): Sized where (): Sized {} | help: consider joining the two `where` clauses into one | -LL | struct A where (): Sized, (): Sized {} - | ~ +LL - struct A where (): Sized where (): Sized {} +LL + struct A where (): Sized, (): Sized {} + | error: cannot define duplicate `where` clauses on an item --> $DIR/duplicate-where-clauses.rs:4:30 @@ -21,8 +22,9 @@ LL | fn b() where (): Sized where (): Sized {} | help: consider joining the two `where` clauses into one | -LL | fn b() where (): Sized, (): Sized {} - | ~ +LL - fn b() where (): Sized where (): Sized {} +LL + fn b() where (): Sized, (): Sized {} + | error: cannot define duplicate `where` clauses on an item --> $DIR/duplicate-where-clauses.rs:7:30 @@ -34,8 +36,9 @@ LL | enum C where (): Sized where (): Sized {} | help: consider joining the two `where` clauses into one | -LL | enum C where (): Sized, (): Sized {} - | ~ +LL - enum C where (): Sized where (): Sized {} +LL + enum C where (): Sized, (): Sized {} + | error: cannot define duplicate `where` clauses on an item --> $DIR/duplicate-where-clauses.rs:10:33 @@ -47,8 +50,9 @@ LL | struct D where (): Sized, where (): Sized {} | help: consider joining the two `where` clauses into one | -LL | struct D where (): Sized, (): Sized {} - | ~ +LL - struct D where (): Sized, where (): Sized {} +LL + struct D where (): Sized, (): Sized {} + | error: cannot define duplicate `where` clauses on an item --> $DIR/duplicate-where-clauses.rs:13:31 @@ -60,8 +64,9 @@ LL | fn e() where (): Sized, where (): Sized {} | help: consider joining the two `where` clauses into one | -LL | fn e() where (): Sized, (): Sized {} - | ~ +LL - fn e() where (): Sized, where (): Sized {} +LL + fn e() where (): Sized, (): Sized {} + | error: cannot define duplicate `where` clauses on an item --> $DIR/duplicate-where-clauses.rs:16:31 @@ -73,8 +78,9 @@ LL | enum F where (): Sized, where (): Sized {} | help: consider joining the two `where` clauses into one | -LL | enum F where (): Sized, (): Sized {} - | ~ +LL - enum F where (): Sized, where (): Sized {} +LL + enum F where (): Sized, (): Sized {} + | error: aborting due to 6 previous errors diff --git a/tests/ui/parser/emoji-identifiers.stderr b/tests/ui/parser/emoji-identifiers.stderr index 536afc53f0ce..f0e90082bff9 100644 --- a/tests/ui/parser/emoji-identifiers.stderr +++ b/tests/ui/parser/emoji-identifiers.stderr @@ -6,8 +6,9 @@ LL | let _ = i_like_to_😄_a_lot() ➖ 4; | help: Unicode character '➖' (Heavy Minus Sign) looks like '-' (Minus/Hyphen), but it is not | -LL | let _ = i_like_to_😄_a_lot() - 4; - | ~ +LL - let _ = i_like_to_😄_a_lot() ➖ 4; +LL + let _ = i_like_to_😄_a_lot() - 4; + | error: identifiers cannot contain emoji: `ABig👩👩👧👧Family` --> $DIR/emoji-identifiers.rs:1:8 @@ -80,8 +81,9 @@ LL | fn full_of_✨() -> 👀 { | ^^^^^^^^^^^^^^^^^^^^^ help: there is an associated function `full_of_✨` with a similar name | -LL | 👀::full_of_✨() - | ~~~~~~~~~~ +LL - 👀::full_of✨() +LL + 👀::full_of_✨() + | error[E0425]: cannot find function `i_like_to_😄_a_lot` in this scope --> $DIR/emoji-identifiers.rs:13:13 diff --git a/tests/ui/parser/eq-gt-to-gt-eq.stderr b/tests/ui/parser/eq-gt-to-gt-eq.stderr index 73f465f7b9b2..aa47ddecce9e 100644 --- a/tests/ui/parser/eq-gt-to-gt-eq.stderr +++ b/tests/ui/parser/eq-gt-to-gt-eq.stderr @@ -11,8 +11,9 @@ LL | if a => b {} | ^ help: you might have meant to write a "greater than or equal to" comparison | -LL | if a >= b {} - | ~~ +LL - if a => b {} +LL + if a >= b {} + | error: expected `{`, found `=>` --> $DIR/eq-gt-to-gt-eq.rs:13:10 @@ -27,8 +28,9 @@ LL | if a => 1 {} | ^ help: you might have meant to write a "greater than or equal to" comparison | -LL | if a >= 1 {} - | ~~ +LL - if a => 1 {} +LL + if a >= 1 {} + | error: expected `{`, found `=>` --> $DIR/eq-gt-to-gt-eq.rs:18:10 @@ -43,8 +45,9 @@ LL | if 1 => a {} | ^ help: you might have meant to write a "greater than or equal to" comparison | -LL | if 1 >= a {} - | ~~ +LL - if 1 => a {} +LL + if 1 >= a {} + | error: expected `{`, found `=>` --> $DIR/eq-gt-to-gt-eq.rs:24:10 @@ -59,8 +62,9 @@ LL | if a => b && a != b {} | ^ help: you might have meant to write a "greater than or equal to" comparison | -LL | if a >= b && a != b {} - | ~~ +LL - if a => b && a != b {} +LL + if a >= b && a != b {} + | error: expected `{`, found `=>` --> $DIR/eq-gt-to-gt-eq.rs:30:20 @@ -75,8 +79,9 @@ LL | if a != b && a => b {} | ^^^^^^^^^^^ help: you might have meant to write a "greater than or equal to" comparison | -LL | if a != b && a >= b {} - | ~~ +LL - if a != b && a => b {} +LL + if a != b && a >= b {} + | error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `=>` --> $DIR/eq-gt-to-gt-eq.rs:36:15 @@ -86,8 +91,9 @@ LL | let _ = a => b; | help: you might have meant to write a "greater than or equal to" comparison | -LL | let _ = a >= b; - | ~~ +LL - let _ = a => b; +LL + let _ = a >= b; + | error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `=>` --> $DIR/eq-gt-to-gt-eq.rs:42:13 @@ -99,8 +105,9 @@ LL | match a => b { | help: you might have meant to write a "greater than or equal to" comparison | -LL | match a >= b { - | ~~ +LL - match a => b { +LL + match a >= b { + | error: aborting due to 7 previous errors diff --git a/tests/ui/parser/expr-rarrow-call.stderr b/tests/ui/parser/expr-rarrow-call.stderr index 221e3a74d79f..2e168ca26fec 100644 --- a/tests/ui/parser/expr-rarrow-call.stderr +++ b/tests/ui/parser/expr-rarrow-call.stderr @@ -7,8 +7,9 @@ LL | named->foo; = help: the `.` operator will dereference the value if needed help: try using `.` instead | -LL | named.foo; - | ~ +LL - named->foo; +LL + named.foo; + | error: `->` used for field access or method call --> $DIR/expr-rarrow-call.rs:18:12 @@ -19,8 +20,9 @@ LL | unnamed->0; = help: the `.` operator will dereference the value if needed help: try using `.` instead | -LL | unnamed.0; - | ~ +LL - unnamed->0; +LL + unnamed.0; + | error: `->` used for field access or method call --> $DIR/expr-rarrow-call.rs:22:6 @@ -31,8 +33,9 @@ LL | t->0; = help: the `.` operator will dereference the value if needed help: try using `.` instead | -LL | t.0; - | ~ +LL - t->0; +LL + t.0; + | error: `->` used for field access or method call --> $DIR/expr-rarrow-call.rs:23:6 @@ -43,8 +46,9 @@ LL | t->1; = help: the `.` operator will dereference the value if needed help: try using `.` instead | -LL | t.1; - | ~ +LL - t->1; +LL + t.1; + | error: `->` used for field access or method call --> $DIR/expr-rarrow-call.rs:30:8 @@ -55,8 +59,9 @@ LL | foo->clone(); = help: the `.` operator will dereference the value if needed help: try using `.` instead | -LL | foo.clone(); - | ~ +LL - foo->clone(); +LL + foo.clone(); + | error: aborting due to 5 previous errors diff --git a/tests/ui/parser/extern-crate-unexpected-token.stderr b/tests/ui/parser/extern-crate-unexpected-token.stderr index 951b0274b0d4..3d48f0adfa11 100644 --- a/tests/ui/parser/extern-crate-unexpected-token.stderr +++ b/tests/ui/parser/extern-crate-unexpected-token.stderr @@ -6,8 +6,9 @@ LL | extern crte foo; | help: there is a keyword `crate` with a similar name | -LL | extern crate foo; - | ~~~~~ +LL - extern crte foo; +LL + extern crate foo; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/extern-no-fn.stderr b/tests/ui/parser/extern-no-fn.stderr index 03826e4a93b7..2ee905429c4a 100644 --- a/tests/ui/parser/extern-no-fn.stderr +++ b/tests/ui/parser/extern-no-fn.stderr @@ -11,8 +11,9 @@ LL | } | help: if you meant to call a macro, try | -LL | f!(); - | ~~ +LL - f(); +LL + f!(); + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/fn-body-eq-expr-semi.stderr b/tests/ui/parser/fn-body-eq-expr-semi.stderr index f1255d8642a6..adcb4fef0a37 100644 --- a/tests/ui/parser/fn-body-eq-expr-semi.stderr +++ b/tests/ui/parser/fn-body-eq-expr-semi.stderr @@ -6,8 +6,9 @@ LL | fn foo() = 42; | help: surround the expression with `{` and `}` instead of `=` and `;` | -LL | fn foo() { 42 } - | ~ ~ +LL - fn foo() = 42; +LL + fn foo() { 42 } + | error: function body cannot be `= expression;` --> $DIR/fn-body-eq-expr-semi.rs:5:20 @@ -17,8 +18,9 @@ LL | fn bar() -> u8 = 42; | help: surround the expression with `{` and `}` instead of `=` and `;` | -LL | fn bar() -> u8 { 42 } - | ~ ~ +LL - fn bar() -> u8 = 42; +LL + fn bar() -> u8 { 42 } + | error: function body cannot be `= expression;` --> $DIR/fn-body-eq-expr-semi.rs:9:14 @@ -28,8 +30,9 @@ LL | fn foo() = 42; | help: surround the expression with `{` and `}` instead of `=` and `;` | -LL | fn foo() { 42 } - | ~ ~ +LL - fn foo() = 42; +LL + fn foo() { 42 } + | error: function body cannot be `= expression;` --> $DIR/fn-body-eq-expr-semi.rs:11:20 @@ -39,8 +42,9 @@ LL | fn bar() -> u8 = 42; | help: surround the expression with `{` and `}` instead of `=` and `;` | -LL | fn bar() -> u8 { 42 } - | ~ ~ +LL - fn bar() -> u8 = 42; +LL + fn bar() -> u8 { 42 } + | error: function body cannot be `= expression;` --> $DIR/fn-body-eq-expr-semi.rs:16:14 @@ -50,8 +54,9 @@ LL | fn foo() = 42; | help: surround the expression with `{` and `}` instead of `=` and `;` | -LL | fn foo() { 42 } - | ~ ~ +LL - fn foo() = 42; +LL + fn foo() { 42 } + | error: function body cannot be `= expression;` --> $DIR/fn-body-eq-expr-semi.rs:17:20 @@ -61,8 +66,9 @@ LL | fn bar() -> u8 = 42; | help: surround the expression with `{` and `}` instead of `=` and `;` | -LL | fn bar() -> u8 { 42 } - | ~ ~ +LL - fn bar() -> u8 = 42; +LL + fn bar() -> u8 { 42 } + | error: function body cannot be `= expression;` --> $DIR/fn-body-eq-expr-semi.rs:21:14 @@ -72,8 +78,9 @@ LL | fn foo() = 42; | help: surround the expression with `{` and `}` instead of `=` and `;` | -LL | fn foo() { 42 } - | ~ ~ +LL - fn foo() = 42; +LL + fn foo() { 42 } + | error: function body cannot be `= expression;` --> $DIR/fn-body-eq-expr-semi.rs:22:20 @@ -83,8 +90,9 @@ LL | fn bar() -> u8 = 42; | help: surround the expression with `{` and `}` instead of `=` and `;` | -LL | fn bar() -> u8 { 42 } - | ~ ~ +LL - fn bar() -> u8 = 42; +LL + fn bar() -> u8 { 42 } + | error: incorrect function inside `extern` block --> $DIR/fn-body-eq-expr-semi.rs:9:8 diff --git a/tests/ui/parser/fn-colon-return-type.stderr b/tests/ui/parser/fn-colon-return-type.stderr index c1cdf4d4975a..d6d30c5fd074 100644 --- a/tests/ui/parser/fn-colon-return-type.stderr +++ b/tests/ui/parser/fn-colon-return-type.stderr @@ -6,8 +6,9 @@ LL | fn foo(x: i32): i32 { | help: use `->` instead | -LL | fn foo(x: i32) -> i32 { - | ~~ +LL - fn foo(x: i32): i32 { +LL + fn foo(x: i32) -> i32 { + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/foreign-const-semantic-fail.stderr b/tests/ui/parser/foreign-const-semantic-fail.stderr index d317847f98ad..b2240738c497 100644 --- a/tests/ui/parser/foreign-const-semantic-fail.stderr +++ b/tests/ui/parser/foreign-const-semantic-fail.stderr @@ -7,8 +7,9 @@ LL | const A: isize; = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html help: try using a static value | -LL | static A: isize; - | ~~~~~~ +LL - const A: isize; +LL + static A: isize; + | error: extern items cannot be `const` --> $DIR/foreign-const-semantic-fail.rs:6:11 @@ -19,8 +20,9 @@ LL | const B: isize = 42; = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html help: try using a static value | -LL | static B: isize = 42; - | ~~~~~~ +LL - const B: isize = 42; +LL + static B: isize = 42; + | error: incorrect `static` inside `extern` block --> $DIR/foreign-const-semantic-fail.rs:6:11 diff --git a/tests/ui/parser/foreign-const-syntactic-fail.stderr b/tests/ui/parser/foreign-const-syntactic-fail.stderr index 7da2c0190228..f7466d5d6cd2 100644 --- a/tests/ui/parser/foreign-const-syntactic-fail.stderr +++ b/tests/ui/parser/foreign-const-syntactic-fail.stderr @@ -7,8 +7,9 @@ LL | const A: isize; = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html help: try using a static value | -LL | static A: isize; - | ~~~~~~ +LL - const A: isize; +LL + static A: isize; + | error: extern items cannot be `const` --> $DIR/foreign-const-syntactic-fail.rs:8:11 @@ -19,8 +20,9 @@ LL | const B: isize = 42; = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html help: try using a static value | -LL | static B: isize = 42; - | ~~~~~~ +LL - const B: isize = 42; +LL + static B: isize = 42; + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/increment-autofix-2.stderr b/tests/ui/parser/increment-autofix-2.stderr index 11e985480d69..3fee96727962 100644 --- a/tests/ui/parser/increment-autofix-2.stderr +++ b/tests/ui/parser/increment-autofix-2.stderr @@ -6,8 +6,9 @@ LL | i++; | help: use `+= 1` instead | -LL | i += 1; - | ~~~~ +LL - i++; +LL + i += 1; + | error: Rust has no postfix increment operator --> $DIR/increment-autofix-2.rs:19:12 @@ -19,8 +20,9 @@ LL | while i++ < 5 { | help: use `+= 1` instead | -LL | while { let tmp = i; i += 1; tmp } < 5 { - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - while i++ < 5 { +LL + while { let tmp = i; i += 1; tmp } < 5 { + | error: Rust has no postfix increment operator --> $DIR/increment-autofix-2.rs:27:8 @@ -30,8 +32,9 @@ LL | tmp++; | help: use `+= 1` instead | -LL | tmp += 1; - | ~~~~ +LL - tmp++; +LL + tmp += 1; + | error: Rust has no postfix increment operator --> $DIR/increment-autofix-2.rs:33:14 @@ -43,8 +46,9 @@ LL | while tmp++ < 5 { | help: use `+= 1` instead | -LL | while { let tmp_ = tmp; tmp += 1; tmp_ } < 5 { - | ++++++++++++ ~~~~~~~~~~~~~~~~~~ +LL - while tmp++ < 5 { +LL + while { let tmp_ = tmp; tmp += 1; tmp_ } < 5 { + | error: Rust has no postfix increment operator --> $DIR/increment-autofix-2.rs:41:16 @@ -54,8 +58,9 @@ LL | foo.bar.qux++; | help: use `+= 1` instead | -LL | foo.bar.qux += 1; - | ~~~~ +LL - foo.bar.qux++; +LL + foo.bar.qux += 1; + | error: Rust has no postfix increment operator --> $DIR/increment-autofix-2.rs:51:10 @@ -65,8 +70,9 @@ LL | s.tmp++; | help: use `+= 1` instead | -LL | s.tmp += 1; - | ~~~~ +LL - s.tmp++; +LL + s.tmp += 1; + | error: Rust has no prefix increment operator --> $DIR/increment-autofix-2.rs:58:5 diff --git a/tests/ui/parser/increment-autofix.stderr b/tests/ui/parser/increment-autofix.stderr index 1dc69fd9f465..ffff91abee95 100644 --- a/tests/ui/parser/increment-autofix.stderr +++ b/tests/ui/parser/increment-autofix.stderr @@ -20,8 +20,9 @@ LL | while ++i < 5 { | help: use `+= 1` instead | -LL | while { i += 1; i } < 5 { - | ~ +++++++++ +LL - while ++i < 5 { +LL + while { i += 1; i } < 5 { + | error: Rust has no prefix increment operator --> $DIR/increment-autofix.rs:19:5 @@ -45,8 +46,9 @@ LL | while ++tmp < 5 { | help: use `+= 1` instead | -LL | while { tmp += 1; tmp } < 5 { - | ~ +++++++++++ +LL - while ++tmp < 5 { +LL + while { tmp += 1; tmp } < 5 { + | error: aborting due to 4 previous errors diff --git a/tests/ui/parser/intersection-patterns-1.stderr b/tests/ui/parser/intersection-patterns-1.stderr index ed2466b21a75..c191b46fa45d 100644 --- a/tests/ui/parser/intersection-patterns-1.stderr +++ b/tests/ui/parser/intersection-patterns-1.stderr @@ -9,8 +9,9 @@ LL | Some(x) @ y => {} | help: switch the order | -LL | y @ Some(x) => {} - | ~~~~~~~~~~~ +LL - Some(x) @ y => {} +LL + y @ Some(x) => {} + | error: pattern on wrong side of `@` --> $DIR/intersection-patterns-1.rs:27:9 @@ -23,8 +24,9 @@ LL | 1 ..= 5 @ e => {} | help: switch the order | -LL | e @ 1..=5 => {} - | ~~~~~~~~~ +LL - 1 ..= 5 @ e => {} +LL + e @ 1..=5 => {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-100197-mut-let.stderr b/tests/ui/parser/issues/issue-100197-mut-let.stderr index 252ed7d0715d..e43d5f68607d 100644 --- a/tests/ui/parser/issues/issue-100197-mut-let.stderr +++ b/tests/ui/parser/issues/issue-100197-mut-let.stderr @@ -6,8 +6,9 @@ LL | mut let _x = 123; | help: switch the order of `mut` and `let` | -LL | let mut _x = 123; - | ~~~~~~~ +LL - mut let _x = 123; +LL + let mut _x = 123; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-101477-enum.stderr b/tests/ui/parser/issues/issue-101477-enum.stderr index 8d4efdd17f7b..c6dadeab8b33 100644 --- a/tests/ui/parser/issues/issue-101477-enum.stderr +++ b/tests/ui/parser/issues/issue-101477-enum.stderr @@ -7,8 +7,9 @@ LL | B == 2 = help: enum variants can be `Variant`, `Variant = `, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` help: try using `=` instead | -LL | B = 2 - | ~ +LL - B == 2 +LL + B = 2 + | error: expected item, found `==` --> $DIR/issue-101477-enum.rs:6:7 diff --git a/tests/ui/parser/issues/issue-101477-let.stderr b/tests/ui/parser/issues/issue-101477-let.stderr index d2671abbdea9..59e90c8102f7 100644 --- a/tests/ui/parser/issues/issue-101477-let.stderr +++ b/tests/ui/parser/issues/issue-101477-let.stderr @@ -6,8 +6,9 @@ LL | let x == 2; | help: try using `=` instead | -LL | let x = 2; - | ~ +LL - let x == 2; +LL + let x = 2; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-102806.stderr b/tests/ui/parser/issues/issue-102806.stderr index ba8174a823b2..cd447c6dec0d 100644 --- a/tests/ui/parser/issues/issue-102806.stderr +++ b/tests/ui/parser/issues/issue-102806.stderr @@ -6,8 +6,9 @@ LL | let _ = V3 { z: 0.0, ...v}; | help: use `..` to fill in the rest of the fields | -LL | let _ = V3 { z: 0.0, ..v}; - | ~~ +LL - let _ = V3 { z: 0.0, ...v}; +LL + let _ = V3 { z: 0.0, ..v}; + | error: expected `..`, found `...` --> $DIR/issue-102806.rs:14:26 @@ -17,8 +18,9 @@ LL | let _ = V3 { z: 0.0, ...Default::default() }; | help: use `..` to fill in the rest of the fields | -LL | let _ = V3 { z: 0.0, ..Default::default() }; - | ~~ +LL - let _ = V3 { z: 0.0, ...Default::default() }; +LL + let _ = V3 { z: 0.0, ..Default::default() }; + | error: expected identifier, found `...` --> $DIR/issue-102806.rs:17:26 @@ -36,8 +38,9 @@ LL | let V3 { z: val, ... } = v; | help: to omit remaining fields, use `..` | -LL | let V3 { z: val, .. } = v; - | ~~ +LL - let V3 { z: val, ... } = v; +LL + let V3 { z: val, .. } = v; + | error[E0063]: missing fields `x` and `y` in initializer of `V3` --> $DIR/issue-102806.rs:17:13 diff --git a/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr index b0d8b03ae08c..97a73b4fd5ed 100644 --- a/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr +++ b/tests/ui/parser/issues/issue-103748-ICE-wrong-braces.stderr @@ -6,8 +6,9 @@ LL | struct Apple((Apple, Option(Banana ? Citron))); | help: if you meant to express that the type might not contain a value, use the `Option` wrapper type | -LL | struct Apple((Apple, Option(Option Citron))); - | +++++++ ~ +LL - struct Apple((Apple, Option(Banana ? Citron))); +LL + struct Apple((Apple, Option(Option Citron))); + | error: expected one of `)` or `,`, found `Citron` --> $DIR/issue-103748-ICE-wrong-braces.rs:3:38 @@ -31,8 +32,9 @@ LL | struct Apple((Apple, Option(Banana ? Citron))); | help: use angle brackets instead | -LL | struct Apple((Apple, Option)); - | ~ ~ +LL - struct Apple((Apple, Option(Banana ? Citron))); +LL + struct Apple((Apple, Option)); + | error[E0072]: recursive type `Apple` has infinite size --> $DIR/issue-103748-ICE-wrong-braces.rs:3:1 diff --git a/tests/ui/parser/issues/issue-104867-inc-dec-2.stderr b/tests/ui/parser/issues/issue-104867-inc-dec-2.stderr index 4e2d0546851e..f2412dda050c 100644 --- a/tests/ui/parser/issues/issue-104867-inc-dec-2.stderr +++ b/tests/ui/parser/issues/issue-104867-inc-dec-2.stderr @@ -6,8 +6,9 @@ LL | let _ = i + ++i; | help: use `+= 1` instead | -LL | let _ = i + { i += 1; i }; - | ~ +++++++++ +LL - let _ = i + ++i; +LL + let _ = i + { i += 1; i }; + | error: Rust has no prefix increment operator --> $DIR/issue-104867-inc-dec-2.rs:8:13 @@ -17,8 +18,9 @@ LL | let _ = ++i + i; | help: use `+= 1` instead | -LL | let _ = { i += 1; i } + i; - | ~ +++++++++ +LL - let _ = ++i + i; +LL + let _ = { i += 1; i } + i; + | error: Rust has no prefix increment operator --> $DIR/issue-104867-inc-dec-2.rs:13:13 @@ -28,8 +30,9 @@ LL | let _ = ++i + ++i; | help: use `+= 1` instead | -LL | let _ = { i += 1; i } + ++i; - | ~ +++++++++ +LL - let _ = ++i + ++i; +LL + let _ = { i += 1; i } + ++i; + | error: Rust has no postfix increment operator --> $DIR/issue-104867-inc-dec-2.rs:18:18 @@ -45,8 +48,9 @@ LL | let _ = i++ + i; | help: use `+= 1` instead | -LL | let _ = { let tmp = i; i += 1; tmp } + i; - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - let _ = i++ + i; +LL + let _ = { let tmp = i; i += 1; tmp } + i; + | error: Rust has no postfix increment operator --> $DIR/issue-104867-inc-dec-2.rs:29:14 @@ -56,8 +60,9 @@ LL | let _ = i++ + i++; | help: use `+= 1` instead | -LL | let _ = { let tmp = i; i += 1; tmp } + i++; - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - let _ = i++ + i++; +LL + let _ = { let tmp = i; i += 1; tmp } + i++; + | error: Rust has no prefix increment operator --> $DIR/issue-104867-inc-dec-2.rs:34:13 @@ -67,8 +72,9 @@ LL | let _ = ++i + i++; | help: use `+= 1` instead | -LL | let _ = { i += 1; i } + i++; - | ~ +++++++++ +LL - let _ = ++i + i++; +LL + let _ = { i += 1; i } + i++; + | error: Rust has no postfix increment operator --> $DIR/issue-104867-inc-dec-2.rs:39:14 @@ -78,8 +84,9 @@ LL | let _ = i++ + ++i; | help: use `+= 1` instead | -LL | let _ = { let tmp = i; i += 1; tmp } + ++i; - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - let _ = i++ + ++i; +LL + let _ = { let tmp = i; i += 1; tmp } + ++i; + | error: Rust has no postfix increment operator --> $DIR/issue-104867-inc-dec-2.rs:44:24 @@ -89,8 +96,9 @@ LL | let _ = (1 + 2 + i)++; | help: use `+= 1` instead | -LL | let _ = { let tmp = (1 + 2 + i); (1 + 2 + i) += 1; tmp }; - | +++++++++++ ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _ = (1 + 2 + i)++; +LL + let _ = { let tmp = (1 + 2 + i); (1 + 2 + i) += 1; tmp }; + | error: Rust has no postfix increment operator --> $DIR/issue-104867-inc-dec-2.rs:49:15 @@ -100,8 +108,9 @@ LL | let _ = (i++ + 1) + 2; | help: use `+= 1` instead | -LL | let _ = ({ let tmp = i; i += 1; tmp } + 1) + 2; - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - let _ = (i++ + 1) + 2; +LL + let _ = ({ let tmp = i; i += 1; tmp } + 1) + 2; + | error: aborting due to 10 previous errors diff --git a/tests/ui/parser/issues/issue-104867-inc-dec.stderr b/tests/ui/parser/issues/issue-104867-inc-dec.stderr index 78bfd3e82f0d..309f8b569337 100644 --- a/tests/ui/parser/issues/issue-104867-inc-dec.stderr +++ b/tests/ui/parser/issues/issue-104867-inc-dec.stderr @@ -6,8 +6,9 @@ LL | i++; | help: use `+= 1` instead | -LL | i += 1; - | ~~~~ +LL - i++; +LL + i += 1; + | error: Rust has no postfix increment operator --> $DIR/issue-104867-inc-dec.rs:12:8 @@ -17,8 +18,9 @@ LL | s.x++; | help: use `+= 1` instead | -LL | s.x += 1; - | ~~~~ +LL - s.x++; +LL + s.x += 1; + | error: Rust has no postfix increment operator --> $DIR/issue-104867-inc-dec.rs:17:9 @@ -28,8 +30,9 @@ LL | if i++ == 1 {} | help: use `+= 1` instead | -LL | if { let tmp = i; i += 1; tmp } == 1 {} - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - if i++ == 1 {} +LL + if { let tmp = i; i += 1; tmp } == 1 {} + | error: Rust has no prefix increment operator --> $DIR/issue-104867-inc-dec.rs:22:5 @@ -51,8 +54,9 @@ LL | if ++i == 1 { } | help: use `+= 1` instead | -LL | if { i += 1; i } == 1 { } - | ~ +++++++++ +LL - if ++i == 1 { } +LL + if { i += 1; i } == 1 { } + | error: Rust has no postfix increment operator --> $DIR/issue-104867-inc-dec.rs:33:6 @@ -62,8 +66,9 @@ LL | i++; | help: use `+= 1` instead | -LL | i += 1; - | ~~~~ +LL - i++; +LL + i += 1; + | error: Rust has no prefix increment operator --> $DIR/issue-104867-inc-dec.rs:41:5 diff --git a/tests/ui/parser/issues/issue-105366.stderr b/tests/ui/parser/issues/issue-105366.stderr index 18c04dfaf208..d8c79a0e0eaf 100644 --- a/tests/ui/parser/issues/issue-105366.stderr +++ b/tests/ui/parser/issues/issue-105366.stderr @@ -6,8 +6,9 @@ LL | fn From for Foo { | help: replace `fn` with `impl` here | -LL | impl From for Foo { - | ~~~~ +LL - fn From for Foo { +LL + impl From for Foo { + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-108495-dec.stderr b/tests/ui/parser/issues/issue-108495-dec.stderr index 85b29038f7c7..b058dae4a6fd 100644 --- a/tests/ui/parser/issues/issue-108495-dec.stderr +++ b/tests/ui/parser/issues/issue-108495-dec.stderr @@ -12,8 +12,9 @@ LL | let _ = i-- + i--; | help: use `-= 1` instead | -LL | let _ = { let tmp = i; i -= 1; tmp } + i--; - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - let _ = i-- + i--; +LL + let _ = { let tmp = i; i -= 1; tmp } + i--; + | error: Rust has no postfix decrement operator --> $DIR/issue-108495-dec.rs:14:20 @@ -29,8 +30,9 @@ LL | let _ = i-- + --i; | help: use `-= 1` instead | -LL | let _ = { let tmp = i; i -= 1; tmp } + --i; - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - let _ = i-- + --i; +LL + let _ = { let tmp = i; i -= 1; tmp } + --i; + | error: Rust has no postfix decrement operator --> $DIR/issue-108495-dec.rs:24:24 @@ -40,8 +42,9 @@ LL | let _ = (1 + 2 + i)--; | help: use `-= 1` instead | -LL | let _ = { let tmp = (1 + 2 + i); (1 + 2 + i) -= 1; tmp }; - | +++++++++++ ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _ = (1 + 2 + i)--; +LL + let _ = { let tmp = (1 + 2 + i); (1 + 2 + i) -= 1; tmp }; + | error: Rust has no postfix decrement operator --> $DIR/issue-108495-dec.rs:29:15 @@ -51,8 +54,9 @@ LL | let _ = (i-- + 1) + 2; | help: use `-= 1` instead | -LL | let _ = ({ let tmp = i; i -= 1; tmp } + 1) + 2; - | +++++++++++ ~~~~~~~~~~~~~~~ +LL - let _ = (i-- + 1) + 2; +LL + let _ = ({ let tmp = i; i -= 1; tmp } + 1) + 2; + | error: Rust has no postfix decrement operator --> $DIR/issue-108495-dec.rs:35:10 @@ -62,8 +66,9 @@ LL | i--; | help: use `-= 1` instead | -LL | i -= 1; - | ~~~~ +LL - i--; +LL + i -= 1; + | error: aborting due to 7 previous errors diff --git a/tests/ui/parser/issues/issue-110014.stderr b/tests/ui/parser/issues/issue-110014.stderr index 7f1dd592e123..57420bb34960 100644 --- a/tests/ui/parser/issues/issue-110014.stderr +++ b/tests/ui/parser/issues/issue-110014.stderr @@ -6,8 +6,9 @@ LL | fn`2222222222222222222222222222222222222222() {} | help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not | -LL | fn'2222222222222222222222222222222222222222() {} - | ~ +LL - fn`2222222222222222222222222222222222222222() {} +LL + fn'2222222222222222222222222222222222222222() {} + | error: expected identifier, found `2222222222222222222222222222222222222222` --> $DIR/issue-110014.rs:1:4 diff --git a/tests/ui/parser/issues/issue-111416.stderr b/tests/ui/parser/issues/issue-111416.stderr index 36f6c5b018fe..50ff209afffd 100644 --- a/tests/ui/parser/issues/issue-111416.stderr +++ b/tests/ui/parser/issues/issue-111416.stderr @@ -6,8 +6,9 @@ LL | let my = monad_bind(mx, T: Try); | help: if `monad_bind` is a struct, use braces as delimiters | -LL | let my = monad_bind { mx, T: Try }; - | ~ ~ +LL - let my = monad_bind(mx, T: Try); +LL + let my = monad_bind { mx, T: Try }; + | help: if `monad_bind` is a function, use the arguments directly | LL - let my = monad_bind(mx, T: Try); diff --git a/tests/ui/parser/issues/issue-118530-ice.stderr b/tests/ui/parser/issues/issue-118530-ice.stderr index 3519fb8777f4..72c0397e9c95 100644 --- a/tests/ui/parser/issues/issue-118530-ice.stderr +++ b/tests/ui/parser/issues/issue-118530-ice.stderr @@ -42,8 +42,9 @@ LL | attr::fn bar() -> String { = help: the `.` operator will dereference the value if needed help: try using `.` instead | -LL | attr::fn bar() . String { - | ~ +LL - attr::fn bar() -> String { +LL + attr::fn bar() . String { + | error: expected one of `(`, `.`, `::`, `;`, `?`, `}`, or an operator, found `{` --> $DIR/issue-118530-ice.rs:5:30 diff --git a/tests/ui/parser/issues/issue-17718-const-mut.stderr b/tests/ui/parser/issues/issue-17718-const-mut.stderr index 54b819c3cfb8..16eb773e7f6e 100644 --- a/tests/ui/parser/issues/issue-17718-const-mut.stderr +++ b/tests/ui/parser/issues/issue-17718-const-mut.stderr @@ -6,7 +6,8 @@ LL | mut | help: you might want to declare a static instead | -LL | static +LL - const +LL + static | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-23620-invalid-escapes.stderr b/tests/ui/parser/issues/issue-23620-invalid-escapes.stderr index 4a3743579e7a..0cedc178001c 100644 --- a/tests/ui/parser/issues/issue-23620-invalid-escapes.stderr +++ b/tests/ui/parser/issues/issue-23620-invalid-escapes.stderr @@ -90,8 +90,9 @@ LL | let _ = "\u8f"; | help: format of unicode escape sequences uses braces | -LL | let _ = "\u{8f}"; - | ~~~~~~ +LL - let _ = "\u8f"; +LL + let _ = "\u{8f}"; + | error: aborting due to 13 previous errors diff --git a/tests/ui/parser/issues/issue-24375.stderr b/tests/ui/parser/issues/issue-24375.stderr index 03cd33f18751..2af57a52035c 100644 --- a/tests/ui/parser/issues/issue-24375.stderr +++ b/tests/ui/parser/issues/issue-24375.stderr @@ -7,8 +7,9 @@ LL | tmp[0] => {} = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == tmp[0] => {} - | ~~~ ++++++++++++++++ +LL - tmp[0] => {} +LL + val if val == tmp[0] => {} + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = tmp[0]; diff --git a/tests/ui/parser/issues/issue-30318.stderr b/tests/ui/parser/issues/issue-30318.stderr index 56bc200db1d3..cd03bd5fecc4 100644 --- a/tests/ui/parser/issues/issue-30318.stderr +++ b/tests/ui/parser/issues/issue-30318.stderr @@ -9,8 +9,9 @@ LL | fn bar() { } | help: to annotate the function, change the doc comment from inner to outer style | -LL | /// Misplaced comment... - | ~ +LL - //! Misplaced comment... +LL + /// Misplaced comment... + | error: an inner attribute is not permitted in this context --> $DIR/issue-30318.rs:9:1 @@ -38,8 +39,9 @@ LL | fn bat() { } | help: to annotate the function, change the doc comment from inner to outer style | -LL | /** Misplaced comment... */ - | ~ +LL - /*! Misplaced comment... */ +LL + /** Misplaced comment... */ + | error[E0753]: expected outer doc comment --> $DIR/issue-30318.rs:19:1 diff --git a/tests/ui/parser/issues/issue-32214.stderr b/tests/ui/parser/issues/issue-32214.stderr index 2ef4305dfd0e..5ccd651bb96a 100644 --- a/tests/ui/parser/issues/issue-32214.stderr +++ b/tests/ui/parser/issues/issue-32214.stderr @@ -8,8 +8,9 @@ LL | pub fn test >() {} | help: move the constraint after the generic argument | -LL | pub fn test >() {} - | ~~~~~~~~~~~~~~ +LL - pub fn test >() {} +LL + pub fn test >() {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-34255-1.stderr b/tests/ui/parser/issues/issue-34255-1.stderr index 1e72f040b036..cd2baaee408c 100644 --- a/tests/ui/parser/issues/issue-34255-1.stderr +++ b/tests/ui/parser/issues/issue-34255-1.stderr @@ -6,8 +6,9 @@ LL | Test::Drill(field: 42); | help: if `Test::Drill` is a struct, use braces as delimiters | -LL | Test::Drill { field: 42 }; - | ~ ~ +LL - Test::Drill(field: 42); +LL + Test::Drill { field: 42 }; + | help: if `Test::Drill` is a function, use the arguments directly | LL - Test::Drill(field: 42); diff --git a/tests/ui/parser/issues/issue-44406.stderr b/tests/ui/parser/issues/issue-44406.stderr index 78cde9b6dcac..b2367ce15ea8 100644 --- a/tests/ui/parser/issues/issue-44406.stderr +++ b/tests/ui/parser/issues/issue-44406.stderr @@ -10,8 +10,9 @@ LL | foo!(true); = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) help: if `bar` is a struct, use braces as delimiters | -LL | bar { baz: $rest } - | ~ ~ +LL - bar(baz: $rest) +LL + bar { baz: $rest } + | help: if `bar` is a function, use the arguments directly | LL - bar(baz: $rest) diff --git a/tests/ui/parser/issues/issue-57684.stderr b/tests/ui/parser/issues/issue-57684.stderr index 39e1c8cd7cc7..5fc55efff0a3 100644 --- a/tests/ui/parser/issues/issue-57684.stderr +++ b/tests/ui/parser/issues/issue-57684.stderr @@ -6,8 +6,9 @@ LL | let _ = X { f1 = 5 }; | help: replace equals symbol with a colon | -LL | let _ = X { f1: 5 }; - | ~ +LL - let _ = X { f1 = 5 }; +LL + let _ = X { f1: 5 }; + | error: expected `:`, found `=` --> $DIR/issue-57684.rs:32:12 @@ -17,8 +18,9 @@ LL | f1 = 5, | help: replace equals symbol with a colon | -LL | f1: 5, - | ~ +LL - f1 = 5, +LL + f1: 5, + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-64732.stderr b/tests/ui/parser/issues/issue-64732.stderr index 7ec2df6d3bf7..d9f8091d2df4 100644 --- a/tests/ui/parser/issues/issue-64732.stderr +++ b/tests/ui/parser/issues/issue-64732.stderr @@ -6,8 +6,9 @@ LL | let _foo = b'hello\0'; | help: if you meant to write a byte string literal, use double quotes | -LL | let _foo = b"hello\0"; - | ~~ ~ +LL - let _foo = b'hello\0'; +LL + let _foo = b"hello\0"; + | error: character literal may only contain one codepoint --> $DIR/issue-64732.rs:6:16 @@ -17,8 +18,9 @@ LL | let _bar = 'hello'; | help: if you meant to write a string literal, use double quotes | -LL | let _bar = "hello"; - | ~ ~ +LL - let _bar = 'hello'; +LL + let _bar = "hello"; + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr index 49d091cf3914..767f63d69582 100644 --- a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr +++ b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr @@ -6,8 +6,9 @@ LL | auto n = 0; | help: write `let` instead of `auto` to introduce a new variable | -LL | let n = 0; - | ~~~ +LL - auto n = 0; +LL + let n = 0; + | error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:4:5 @@ -17,8 +18,9 @@ LL | auto m; | help: write `let` instead of `auto` to introduce a new variable | -LL | let m; - | ~~~ +LL - auto m; +LL + let m; + | error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:8:5 @@ -28,8 +30,9 @@ LL | var n = 0; | help: write `let` instead of `var` to introduce a new variable | -LL | let n = 0; - | ~~~ +LL - var n = 0; +LL + let n = 0; + | error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:10:5 @@ -39,8 +42,9 @@ LL | var m; | help: write `let` instead of `var` to introduce a new variable | -LL | let m; - | ~~~ +LL - var m; +LL + let m; + | error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:14:5 @@ -50,8 +54,9 @@ LL | mut n = 0; | help: missing keyword | -LL | let mut n = 0; - | ~~~~~~~ +LL - mut n = 0; +LL + let mut n = 0; + | error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:16:5 @@ -61,8 +66,9 @@ LL | mut var; | help: missing keyword | -LL | let mut var; - | ~~~~~~~ +LL - mut var; +LL + let mut var; + | error[E0308]: mismatched types --> $DIR/issue-65257-invalid-var-decl-recovery.rs:20:33 diff --git a/tests/ui/parser/issues/issue-68730.stderr b/tests/ui/parser/issues/issue-68730.stderr index 9bd98287db34..838a6569bdc3 100644 --- a/tests/ui/parser/issues/issue-68730.stderr +++ b/tests/ui/parser/issues/issue-68730.stderr @@ -23,8 +23,9 @@ LL | enum␀em␀˂˂ = note: character appears once more help: Unicode character '˂' (Modifier Letter Left Arrowhead) looks like '<' (Less-Than Sign), but it is not | -LL | enum␀em␀<< - | ~~ +LL - enum␀em␀˂˂ +LL + enum␀em␀<< + | error: unknown start of token: \u{2c2} --> $DIR/issue-68730.rs:5:10 @@ -34,8 +35,9 @@ LL | enum␀em␀˂˂ | help: Unicode character '˂' (Modifier Letter Left Arrowhead) looks like '<' (Less-Than Sign), but it is not | -LL | enum␀em␀˂< - | ~ +LL - enum␀em␀˂˂ +LL + enum␀em␀˂< + | error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `<` --> $DIR/issue-68730.rs:5:10 diff --git a/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr b/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr index c2c0faa21d15..9c632a8332a1 100644 --- a/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr +++ b/tests/ui/parser/issues/issue-70549-resolve-after-recovered-self-ctor.stderr @@ -12,8 +12,9 @@ LL | fn foo(&mur Self) {} | help: there is a keyword `mut` with a similar name | -LL | fn foo(&mut Self) {} - | ~~~ +LL - fn foo(&mur Self) {} +LL + fn foo(&mut Self) {} + | error: unexpected lifetime `'static` in pattern --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:8:13 @@ -41,8 +42,9 @@ LL | fn bar(&'static mur Self) {} | help: there is a keyword `mut` with a similar name | -LL | fn bar(&'static mut Self) {} - | ~~~ +LL - fn bar(&'static mur Self) {} +LL + fn bar(&'static mut Self) {} + | error: expected one of `:`, `@`, or `|`, found keyword `Self` --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:14:17 @@ -52,8 +54,9 @@ LL | fn baz(&mur Self @ _) {} | help: there is a keyword `mut` with a similar name | -LL | fn baz(&mut Self @ _) {} - | ~~~ +LL - fn baz(&mur Self @ _) {} +LL + fn baz(&mut Self @ _) {} + | error[E0533]: expected unit struct, found self constructor `Self` --> $DIR/issue-70549-resolve-after-recovered-self-ctor.rs:4:17 diff --git a/tests/ui/parser/issues/issue-73568-lifetime-after-mut.stderr b/tests/ui/parser/issues/issue-73568-lifetime-after-mut.stderr index 2f8728bd78b4..6b8f8e4fe4ee 100644 --- a/tests/ui/parser/issues/issue-73568-lifetime-after-mut.stderr +++ b/tests/ui/parser/issues/issue-73568-lifetime-after-mut.stderr @@ -6,8 +6,9 @@ LL | fn x<'a>(x: &mut 'a i32){} | help: place the lifetime before `mut` | -LL | fn x<'a>(x: &'a mut i32){} - | ~~~~~~~ +LL - fn x<'a>(x: &mut 'a i32){} +LL + fn x<'a>(x: &'a mut i32){} + | error[E0178]: expected a path on the left-hand side of `+`, not `&mut 'a` --> $DIR/issue-73568-lifetime-after-mut.rs:14:13 @@ -32,8 +33,9 @@ LL | mac!('a); = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) help: place the lifetime before `mut` | -LL | fn w<$lt>(w: &$lt mut i32) {} - | ~~~~~~~~ +LL - fn w<$lt>(w: &mut $lt i32) {} +LL + fn w<$lt>(w: &$lt mut i32) {} + | error[E0423]: expected value, found trait `Send` --> $DIR/issue-73568-lifetime-after-mut.rs:17:28 diff --git a/tests/ui/parser/issues/issue-84117.stderr b/tests/ui/parser/issues/issue-84117.stderr index 9f603b84434b..e358bc4a2fb9 100644 --- a/tests/ui/parser/issues/issue-84117.stderr +++ b/tests/ui/parser/issues/issue-84117.stderr @@ -12,8 +12,9 @@ LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str>, } | + help: use `=` if you meant to assign | -LL | let outer_local:e_outer<&str, { let inner_local =e_inner<&str, } - | ~ +LL - let outer_local:e_outer<&str, { let inner_local:e_inner<&str, } +LL + let outer_local:e_outer<&str, { let inner_local =e_inner<&str, } + | error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,` --> $DIR/issue-84117.rs:2:65 @@ -36,8 +37,9 @@ LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str, }> | + help: use `=` if you meant to assign | -LL | let outer_local =e_outer<&str, { let inner_local:e_inner<&str, } - | ~ +LL - let outer_local:e_outer<&str, { let inner_local:e_inner<&str, } +LL + let outer_local =e_outer<&str, { let inner_local:e_inner<&str, } + | error: expected one of `>`, a const expression, lifetime, or type, found `}` --> $DIR/issue-84117.rs:2:67 @@ -54,8 +56,9 @@ LL | let outer_local:e_outer<&str, { let inner_local:e_inner<&str>, } | + help: use `=` if you meant to assign | -LL | let outer_local:e_outer<&str, { let inner_local =e_inner<&str, } - | ~ +LL - let outer_local:e_outer<&str, { let inner_local:e_inner<&str, } +LL + let outer_local:e_outer<&str, { let inner_local =e_inner<&str, } + | error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `,` --> $DIR/issue-84117.rs:2:65 diff --git a/tests/ui/parser/issues/issue-84148-1.stderr b/tests/ui/parser/issues/issue-84148-1.stderr index 9261067c2215..ebe9807dfe36 100644 --- a/tests/ui/parser/issues/issue-84148-1.stderr +++ b/tests/ui/parser/issues/issue-84148-1.stderr @@ -6,8 +6,9 @@ LL | fn f(t:for<>t?) | help: if you meant to express that the type might not contain a value, use the `Option` wrapper type | -LL | fn f(t:Optiont>) - | +++++++ ~ +LL - fn f(t:for<>t?) +LL + fn f(t:Optiont>) + | error: expected one of `->`, `where`, or `{`, found `` --> $DIR/issue-84148-1.rs:1:15 diff --git a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr index b6e24faf5dab..fa8483689459 100644 --- a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr +++ b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr @@ -8,8 +8,9 @@ LL | Foo:Bar => {} | help: maybe write a path separator here | -LL | Foo::Bar => {} - | ~~ +LL - Foo:Bar => {} +LL + Foo::Bar => {} + | error: expected one of `!`, `(`, `...`, `..=`, `..`, `::`, `{`, or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:23:17 @@ -21,8 +22,9 @@ LL | qux::Foo:Bar => {} | help: maybe write a path separator here | -LL | qux::Foo::Bar => {} - | ~~ +LL - qux::Foo:Bar => {} +LL + qux::Foo::Bar => {} + | error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:29:12 @@ -34,8 +36,9 @@ LL | qux:Foo::Baz => {} | help: maybe write a path separator here | -LL | qux::Foo::Baz => {} - | ~~ +LL - qux:Foo::Baz => {} +LL + qux::Foo::Baz => {} + | error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:35:12 @@ -47,8 +50,9 @@ LL | qux: Foo::Baz if true => {} | help: maybe write a path separator here | -LL | qux::Foo::Baz if true => {} - | ~~ +LL - qux: Foo::Baz if true => {} +LL + qux::Foo::Baz if true => {} + | error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:40:15 @@ -60,8 +64,9 @@ LL | if let Foo:Bar = f() { | help: maybe write a path separator here | -LL | if let Foo::Bar = f() { - | ~~ +LL - if let Foo:Bar = f() { +LL + if let Foo::Bar = f() { + | error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:49:16 @@ -73,8 +78,9 @@ LL | ref qux: Foo::Baz => {} | help: maybe write a path separator here | -LL | ref qux::Foo::Baz => {} - | ~~ +LL - ref qux: Foo::Baz => {} +LL + ref qux::Foo::Baz => {} + | error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:58:16 @@ -86,8 +92,9 @@ LL | mut qux: Foo::Baz => {} | help: maybe write a path separator here | -LL | mut qux::Foo::Baz => {} - | ~~ +LL - mut qux: Foo::Baz => {} +LL + mut qux::Foo::Baz => {} + | error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:69:12 @@ -99,8 +106,9 @@ LL | Foo:Bar::Baz => {} | help: maybe write a path separator here | -LL | Foo::Bar::Baz => {} - | ~~ +LL - Foo:Bar::Baz => {} +LL + Foo::Bar::Baz => {} + | error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:75:12 @@ -112,8 +120,9 @@ LL | Foo:Bar => {} | help: maybe write a path separator here | -LL | Foo::Bar => {} - | ~~ +LL - Foo:Bar => {} +LL + Foo::Bar => {} + | warning: irrefutable `if let` pattern --> $DIR/issue-87086-colon-path-sep.rs:40:8 diff --git a/tests/ui/parser/issues/issue-90993.stderr b/tests/ui/parser/issues/issue-90993.stderr index a18e93f1f1a9..e9ecc59ec493 100644 --- a/tests/ui/parser/issues/issue-90993.stderr +++ b/tests/ui/parser/issues/issue-90993.stderr @@ -6,12 +6,14 @@ LL | ...=. | help: use `..` for an exclusive range | -LL | ..=. - | ~~ +LL - ...=. +LL + ..=. + | help: or `..=` for an inclusive range | -LL | ..==. - | ~~~ +LL - ...=. +LL + ..==. + | error: unexpected `=` after inclusive range --> $DIR/issue-90993.rs:2:5 @@ -22,8 +24,9 @@ LL | ...=. = note: inclusive ranges end with a single equals sign (`..=`) help: use `..=` instead | -LL | ..=. - | ~~~ +LL - ...=. +LL + ..=. + | error: expected one of `-`, `;`, `}`, or path, found `.` --> $DIR/issue-90993.rs:2:9 diff --git a/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr index c98b8fa1f1ee..a4e0efcaeb0d 100644 --- a/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr +++ b/tests/ui/parser/issues/issue-99625-enum-struct-mutually-exclusive.stderr @@ -6,8 +6,9 @@ LL | pub enum struct Range { | help: replace `enum struct` with | -LL | pub enum Range { - | ~~~~ +LL - pub enum struct Range { +LL + pub enum Range { + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr index 1ccf44a350d9..73043de52902 100644 --- a/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr +++ b/tests/ui/parser/issues/issue-99910-const-let-mutually-exclusive.stderr @@ -6,8 +6,9 @@ LL | const let _FOO: i32 = 123; | help: remove `let` | -LL | const _FOO: i32 = 123; - | ~~~~~ +LL - const let _FOO: i32 = 123; +LL + const _FOO: i32 = 123; + | error: `const` and `let` are mutually exclusive --> $DIR/issue-99910-const-let-mutually-exclusive.rs:6:5 @@ -17,8 +18,9 @@ LL | let const _BAR: i32 = 123; | help: remove `let` | -LL | const _BAR: i32 = 123; - | ~~~~~ +LL - let const _BAR: i32 = 123; +LL + const _BAR: i32 = 123; + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/issues/recover-ge-as-fat-arrow.stderr b/tests/ui/parser/issues/recover-ge-as-fat-arrow.stderr index 2df5cca24f06..997d080f1dee 100644 --- a/tests/ui/parser/issues/recover-ge-as-fat-arrow.stderr +++ b/tests/ui/parser/issues/recover-ge-as-fat-arrow.stderr @@ -17,8 +17,9 @@ LL | _ => { let _: u16 = 2u8; } | help: change the type of the numeric literal from `u8` to `u16` | -LL | _ => { let _: u16 = 2u16; } - | ~~~ +LL - _ => { let _: u16 = 2u8; } +LL + _ => { let _: u16 = 2u16; } + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/item-kw-case-mismatch.stderr b/tests/ui/parser/item-kw-case-mismatch.stderr index 36df72b5cad1..df39eb10fdbe 100644 --- a/tests/ui/parser/item-kw-case-mismatch.stderr +++ b/tests/ui/parser/item-kw-case-mismatch.stderr @@ -6,8 +6,9 @@ LL | Use std::ptr::read; | help: write it in the correct case (notice the capitalization difference) | -LL | use std::ptr::read; - | ~~~ +LL - Use std::ptr::read; +LL + use std::ptr::read; + | error: keyword `use` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:8:1 @@ -17,8 +18,9 @@ LL | USE std::ptr::write; | help: write it in the correct case | -LL | use std::ptr::write; - | ~~~ +LL - USE std::ptr::write; +LL + use std::ptr::write; + | error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:10:7 @@ -28,8 +30,9 @@ LL | async Fn _a() {} | help: write it in the correct case (notice the capitalization difference) | -LL | async fn _a() {} - | ~~ +LL - async Fn _a() {} +LL + async fn _a() {} + | error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:13:1 @@ -39,8 +42,9 @@ LL | Fn _b() {} | help: write it in the correct case (notice the capitalization difference) | -LL | fn _b() {} - | ~~ +LL - Fn _b() {} +LL + fn _b() {} + | error: keyword `async` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:16:1 @@ -50,8 +54,9 @@ LL | aSYNC fN _c() {} | help: write it in the correct case | -LL | async fN _c() {} - | ~~~~~ +LL - aSYNC fN _c() {} +LL + async fN _c() {} + | error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:16:7 @@ -61,8 +66,9 @@ LL | aSYNC fN _c() {} | help: write it in the correct case | -LL | aSYNC fn _c() {} - | ~~ +LL - aSYNC fN _c() {} +LL + aSYNC fn _c() {} + | error: keyword `async` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:20:1 @@ -72,8 +78,9 @@ LL | Async fn _d() {} | help: write it in the correct case | -LL | async fn _d() {} - | ~~~~~ +LL - Async fn _d() {} +LL + async fn _d() {} + | error: keyword `const` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:23:1 @@ -83,8 +90,9 @@ LL | CONST UNSAFE FN _e() {} | help: write it in the correct case | -LL | const UNSAFE FN _e() {} - | ~~~~~ +LL - CONST UNSAFE FN _e() {} +LL + const UNSAFE FN _e() {} + | error: keyword `unsafe` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:23:7 @@ -94,8 +102,9 @@ LL | CONST UNSAFE FN _e() {} | help: write it in the correct case | -LL | CONST unsafe FN _e() {} - | ~~~~~~ +LL - CONST UNSAFE FN _e() {} +LL + CONST unsafe FN _e() {} + | error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:23:14 @@ -105,8 +114,9 @@ LL | CONST UNSAFE FN _e() {} | help: write it in the correct case | -LL | CONST UNSAFE fn _e() {} - | ~~ +LL - CONST UNSAFE FN _e() {} +LL + CONST UNSAFE fn _e() {} + | error: keyword `unsafe` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:28:1 @@ -116,8 +126,9 @@ LL | unSAFE EXTern "C" fn _f() {} | help: write it in the correct case | -LL | unsafe EXTern "C" fn _f() {} - | ~~~~~~ +LL - unSAFE EXTern "C" fn _f() {} +LL + unsafe EXTern "C" fn _f() {} + | error: keyword `extern` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:28:8 @@ -127,8 +138,9 @@ LL | unSAFE EXTern "C" fn _f() {} | help: write it in the correct case | -LL | unSAFE extern "C" fn _f() {} - | ~~~~~~ +LL - unSAFE EXTern "C" fn _f() {} +LL + unSAFE extern "C" fn _f() {} + | error: keyword `extern` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:32:1 @@ -138,8 +150,9 @@ LL | EXTERN "C" FN _g() {} | help: write it in the correct case | -LL | extern "C" FN _g() {} - | ~~~~~~ +LL - EXTERN "C" FN _g() {} +LL + extern "C" FN _g() {} + | error: keyword `fn` is written in the wrong case --> $DIR/item-kw-case-mismatch.rs:32:12 @@ -149,8 +162,9 @@ LL | EXTERN "C" FN _g() {} | help: write it in the correct case | -LL | EXTERN "C" fn _g() {} - | ~~ +LL - EXTERN "C" FN _g() {} +LL + EXTERN "C" fn _g() {} + | error: aborting due to 14 previous errors diff --git a/tests/ui/parser/kw-in-trait-bounds.stderr b/tests/ui/parser/kw-in-trait-bounds.stderr index 3c54e0319503..1892d0b62265 100644 --- a/tests/ui/parser/kw-in-trait-bounds.stderr +++ b/tests/ui/parser/kw-in-trait-bounds.stderr @@ -6,8 +6,9 @@ LL | fn _f(_: impl fn(), _: &dyn fn()) | help: use `Fn` to refer to the trait (notice the capitalization difference) | -LL | fn _f(_: impl fn(), _: &dyn fn()) - | ~~ +LL - fn _f(_: impl fn(), _: &dyn fn()) +LL + fn _f(_: impl fn(), _: &dyn fn()) + | error: expected identifier, found keyword `fn` --> $DIR/kw-in-trait-bounds.rs:3:27 @@ -17,8 +18,9 @@ LL | fn _f(_: impl fn(), _: &dyn fn()) | help: use `Fn` to refer to the trait (notice the capitalization difference) | -LL | fn _f(_: impl Fn(), _: &dyn fn()) - | ~~ +LL - fn _f(_: impl fn(), _: &dyn fn()) +LL + fn _f(_: impl Fn(), _: &dyn fn()) + | error: expected identifier, found keyword `fn` --> $DIR/kw-in-trait-bounds.rs:3:41 @@ -28,8 +30,9 @@ LL | fn _f(_: impl fn(), _: &dyn fn()) | help: use `Fn` to refer to the trait (notice the capitalization difference) | -LL | fn _f(_: impl fn(), _: &dyn Fn()) - | ~~ +LL - fn _f(_: impl fn(), _: &dyn fn()) +LL + fn _f(_: impl fn(), _: &dyn Fn()) + | error: expected identifier, found keyword `fn` --> $DIR/kw-in-trait-bounds.rs:11:4 @@ -39,8 +42,9 @@ LL | G: fn(), | help: use `Fn` to refer to the trait (notice the capitalization difference) | -LL | G: Fn(), - | ~~ +LL - G: fn(), +LL + G: Fn(), + | error: expected identifier, found keyword `struct` --> $DIR/kw-in-trait-bounds.rs:16:10 diff --git a/tests/ui/parser/lifetime-in-pattern.stderr b/tests/ui/parser/lifetime-in-pattern.stderr index 55f9e56a4292..ffda28b202bd 100644 --- a/tests/ui/parser/lifetime-in-pattern.stderr +++ b/tests/ui/parser/lifetime-in-pattern.stderr @@ -23,8 +23,9 @@ LL | fn test(self: &'a str) { | +++++ help: if this is a parameter name, give it a type | -LL | fn test(str: &TypeName) { - | ~~~~~~~~~~~~~~ +LL - fn test(&'a str) { +LL + fn test(str: &TypeName) { + | help: if this is a type, explicitly ignore the parameter name | LL | fn test(_: &'a str) { diff --git a/tests/ui/parser/lifetime-semicolon.stderr b/tests/ui/parser/lifetime-semicolon.stderr index 4f8e2835e085..f0e42c36c5a6 100644 --- a/tests/ui/parser/lifetime-semicolon.stderr +++ b/tests/ui/parser/lifetime-semicolon.stderr @@ -6,8 +6,9 @@ LL | fn foo<'a, 'b>(_x: &mut Foo<'a; 'b>) {} | help: use a comma to separate type parameters | -LL | fn foo<'a, 'b>(_x: &mut Foo<'a, 'b>) {} - | ~ +LL - fn foo<'a, 'b>(_x: &mut Foo<'a; 'b>) {} +LL + fn foo<'a, 'b>(_x: &mut Foo<'a, 'b>) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/macros-no-semicolon-items.stderr b/tests/ui/parser/macros-no-semicolon-items.stderr index 6d2431c4aec4..07fa2439df50 100644 --- a/tests/ui/parser/macros-no-semicolon-items.stderr +++ b/tests/ui/parser/macros-no-semicolon-items.stderr @@ -6,8 +6,9 @@ LL | macro_rules! foo() | help: change the delimiters to curly braces | -LL | macro_rules! foo{} - | ~~ +LL - macro_rules! foo() +LL + macro_rules! foo{} + | help: add a semicolon | LL | macro_rules! foo(); diff --git a/tests/ui/parser/match-arm-without-body.stderr b/tests/ui/parser/match-arm-without-body.stderr index 53cf3480dbf9..9df8485972f3 100644 --- a/tests/ui/parser/match-arm-without-body.stderr +++ b/tests/ui/parser/match-arm-without-body.stderr @@ -18,7 +18,8 @@ LL | (Some(_),) | + + help: ...or a vertical bar to match on multiple alternatives | -LL | Some(_) | +LL - Some(_), +LL + Some(_) | | error: unexpected `,` in pattern diff --git a/tests/ui/parser/match-arm-without-braces.stderr b/tests/ui/parser/match-arm-without-braces.stderr index 4a4a154d8609..70cbdcfde0b5 100644 --- a/tests/ui/parser/match-arm-without-braces.stderr +++ b/tests/ui/parser/match-arm-without-braces.stderr @@ -8,8 +8,9 @@ LL | Some(Val::Foo) => 3; | help: replace `;` with `,` to end a `match` arm expression | -LL | Some(Val::Foo) => 3, - | ~ +LL - Some(Val::Foo) => 3; +LL + Some(Val::Foo) => 3, + | error: `match` arm body without braces --> $DIR/match-arm-without-braces.rs:31:11 diff --git a/tests/ui/parser/missing-fn-issue-65381-2.stderr b/tests/ui/parser/missing-fn-issue-65381-2.stderr index e13d395d70d7..ba2cf497df23 100644 --- a/tests/ui/parser/missing-fn-issue-65381-2.stderr +++ b/tests/ui/parser/missing-fn-issue-65381-2.stderr @@ -6,8 +6,9 @@ LL | main(); | help: if you meant to call a macro, try | -LL | main!(); - | ~~~~~ +LL - main(); +LL + main!(); + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/assoc-type.stderr b/tests/ui/parser/misspelled-keywords/assoc-type.stderr index 677da53e3400..e529b477c05b 100644 --- a/tests/ui/parser/misspelled-keywords/assoc-type.stderr +++ b/tests/ui/parser/misspelled-keywords/assoc-type.stderr @@ -11,8 +11,9 @@ LL | } | help: write keyword `type` in lowercase | -LL | type Result = u8; - | ~~~~ +LL - Type Result = u8; +LL + type Result = u8; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/async-move.stderr b/tests/ui/parser/misspelled-keywords/async-move.stderr index 4be4b56e5056..a002d54dc911 100644 --- a/tests/ui/parser/misspelled-keywords/async-move.stderr +++ b/tests/ui/parser/misspelled-keywords/async-move.stderr @@ -6,8 +6,9 @@ LL | async Move {} | help: write keyword `move` in lowercase | -LL | async move {} - | ~~~~ +LL - async Move {} +LL + async move {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/const-fn.stderr b/tests/ui/parser/misspelled-keywords/const-fn.stderr index 5646b26143c4..46a6d8ca779f 100644 --- a/tests/ui/parser/misspelled-keywords/const-fn.stderr +++ b/tests/ui/parser/misspelled-keywords/const-fn.stderr @@ -6,8 +6,9 @@ LL | cnst fn code() {} | help: there is a keyword `const` with a similar name | -LL | const fn code() {} - | ~~~~~ +LL - cnst fn code() {} +LL + const fn code() {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/const-generics.stderr b/tests/ui/parser/misspelled-keywords/const-generics.stderr index fd59999ab635..2d37656278e3 100644 --- a/tests/ui/parser/misspelled-keywords/const-generics.stderr +++ b/tests/ui/parser/misspelled-keywords/const-generics.stderr @@ -6,8 +6,9 @@ LL | fn foo(_arr: [i32; N]) {} | help: there is a keyword `const` with a similar name | -LL | fn foo(_arr: [i32; N]) {} - | ~~~~~ +LL - fn foo(_arr: [i32; N]) {} +LL + fn foo(_arr: [i32; N]) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/const.stderr b/tests/ui/parser/misspelled-keywords/const.stderr index 35e4d731db76..ca76f51f4ed3 100644 --- a/tests/ui/parser/misspelled-keywords/const.stderr +++ b/tests/ui/parser/misspelled-keywords/const.stderr @@ -6,8 +6,9 @@ LL | cons A: u8 = 10; | help: there is a keyword `const` with a similar name | -LL | const A: u8 = 10; - | ~~~~~ +LL - cons A: u8 = 10; +LL + const A: u8 = 10; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/for-loop.stderr b/tests/ui/parser/misspelled-keywords/for-loop.stderr index d2236ab074da..6b94e60452a3 100644 --- a/tests/ui/parser/misspelled-keywords/for-loop.stderr +++ b/tests/ui/parser/misspelled-keywords/for-loop.stderr @@ -6,8 +6,9 @@ LL | form i in 1..10 {} | help: there is a keyword `for` with a similar name | -LL | for i in 1..10 {} - | ~~~ +LL - form i in 1..10 {} +LL + for i in 1..10 {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/hrdt.stderr b/tests/ui/parser/misspelled-keywords/hrdt.stderr index 5393a730506d..e5fc1a503820 100644 --- a/tests/ui/parser/misspelled-keywords/hrdt.stderr +++ b/tests/ui/parser/misspelled-keywords/hrdt.stderr @@ -6,8 +6,9 @@ LL | Where for<'a> F: Fn(&'a (u8, u16)) -> &'a u8, | help: write keyword `where` in lowercase (notice the capitalization difference) | -LL | where for<'a> F: Fn(&'a (u8, u16)) -> &'a u8, - | ~~~~~ +LL - Where for<'a> F: Fn(&'a (u8, u16)) -> &'a u8, +LL + where for<'a> F: Fn(&'a (u8, u16)) -> &'a u8, + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/impl-block.stderr b/tests/ui/parser/misspelled-keywords/impl-block.stderr index d86ae326ce2e..8219ed6bfe94 100644 --- a/tests/ui/parser/misspelled-keywords/impl-block.stderr +++ b/tests/ui/parser/misspelled-keywords/impl-block.stderr @@ -6,8 +6,9 @@ LL | ipml Human {} | help: there is a keyword `impl` with a similar name | -LL | impl Human {} - | ~~~~ +LL - ipml Human {} +LL + impl Human {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/impl-return.stderr b/tests/ui/parser/misspelled-keywords/impl-return.stderr index 883f5cea73ef..ff5391461a9f 100644 --- a/tests/ui/parser/misspelled-keywords/impl-return.stderr +++ b/tests/ui/parser/misspelled-keywords/impl-return.stderr @@ -6,8 +6,9 @@ LL | fn code() -> Impl Display {} | help: write keyword `impl` in lowercase (notice the capitalization difference) | -LL | fn code() -> impl Display {} - | ~~~~ +LL - fn code() -> Impl Display {} +LL + fn code() -> impl Display {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/impl-trait-for.stderr b/tests/ui/parser/misspelled-keywords/impl-trait-for.stderr index 8dd5a4645f36..fe2356da4bdd 100644 --- a/tests/ui/parser/misspelled-keywords/impl-trait-for.stderr +++ b/tests/ui/parser/misspelled-keywords/impl-trait-for.stderr @@ -6,8 +6,9 @@ LL | impl Debug form Human {} | help: there is a keyword `for` with a similar name | -LL | impl Debug for Human {} - | ~~~ +LL - impl Debug form Human {} +LL + impl Debug for Human {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/impl-trait.stderr b/tests/ui/parser/misspelled-keywords/impl-trait.stderr index 02a0c8083110..4b0c9222a8c9 100644 --- a/tests/ui/parser/misspelled-keywords/impl-trait.stderr +++ b/tests/ui/parser/misspelled-keywords/impl-trait.stderr @@ -6,8 +6,9 @@ LL | fn code() -> u8 {} | help: there is a keyword `impl` with a similar name | -LL | fn code() -> u8 {} - | ~~~~ +LL - fn code() -> u8 {} +LL + fn code() -> u8 {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/let-else.stderr b/tests/ui/parser/misspelled-keywords/let-else.stderr index 6f41a0d99dba..1dde67638ce0 100644 --- a/tests/ui/parser/misspelled-keywords/let-else.stderr +++ b/tests/ui/parser/misspelled-keywords/let-else.stderr @@ -6,8 +6,9 @@ LL | let Some(a) = Some(10) elze {} | help: there is a keyword `else` with a similar name | -LL | let Some(a) = Some(10) else {} - | ~~~~ +LL - let Some(a) = Some(10) elze {} +LL + let Some(a) = Some(10) else {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/let-mut.stderr b/tests/ui/parser/misspelled-keywords/let-mut.stderr index 766d2a049090..aee457e135ba 100644 --- a/tests/ui/parser/misspelled-keywords/let-mut.stderr +++ b/tests/ui/parser/misspelled-keywords/let-mut.stderr @@ -6,8 +6,9 @@ LL | let muta a = 10; | help: there is a keyword `mut` with a similar name | -LL | let mut a = 10; - | ~~~ +LL - let muta a = 10; +LL + let mut a = 10; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/let.stderr b/tests/ui/parser/misspelled-keywords/let.stderr index c2dcdef541d8..9ebc4b5afa64 100644 --- a/tests/ui/parser/misspelled-keywords/let.stderr +++ b/tests/ui/parser/misspelled-keywords/let.stderr @@ -6,8 +6,9 @@ LL | Let a = 10; | help: write keyword `let` in lowercase | -LL | let a = 10; - | ~~~ +LL - Let a = 10; +LL + let a = 10; + | error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `a` --> $DIR/let.rs:7:10 @@ -17,8 +18,9 @@ LL | lett a = 10; | help: there is a keyword `let` with a similar name | -LL | let a = 10; - | ~~~ +LL - lett a = 10; +LL + let a = 10; + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/misspelled-keywords/match.stderr b/tests/ui/parser/misspelled-keywords/match.stderr index 90780ebd38ef..1ec8f7c3b81c 100644 --- a/tests/ui/parser/misspelled-keywords/match.stderr +++ b/tests/ui/parser/misspelled-keywords/match.stderr @@ -6,8 +6,9 @@ LL | matche a {} | help: there is a keyword `match` with a similar name | -LL | match a {} - | ~~~~~ +LL - matche a {} +LL + match a {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/mod.stderr b/tests/ui/parser/misspelled-keywords/mod.stderr index 6daeb4e5a152..1c1866279ce5 100644 --- a/tests/ui/parser/misspelled-keywords/mod.stderr +++ b/tests/ui/parser/misspelled-keywords/mod.stderr @@ -6,8 +6,9 @@ LL | mode parser; | help: there is a keyword `mod` with a similar name | -LL | mod parser; - | ~~~ +LL - mode parser; +LL + mod parser; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/pub-fn.stderr b/tests/ui/parser/misspelled-keywords/pub-fn.stderr index 82ca7105a496..1123c652c0ee 100644 --- a/tests/ui/parser/misspelled-keywords/pub-fn.stderr +++ b/tests/ui/parser/misspelled-keywords/pub-fn.stderr @@ -6,8 +6,9 @@ LL | puB fn code() {} | help: write keyword `pub` in lowercase | -LL | pub fn code() {} - | ~~~ +LL - puB fn code() {} +LL + pub fn code() {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/ref.stderr b/tests/ui/parser/misspelled-keywords/ref.stderr index 398d9d6bb99b..21b99d6e6638 100644 --- a/tests/ui/parser/misspelled-keywords/ref.stderr +++ b/tests/ui/parser/misspelled-keywords/ref.stderr @@ -6,8 +6,9 @@ LL | Some(refe list) => println!("{list:?}"), | help: there is a keyword `ref` with a similar name | -LL | Some(ref list) => println!("{list:?}"), - | ~~~ +LL - Some(refe list) => println!("{list:?}"), +LL + Some(ref list) => println!("{list:?}"), + | error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has 1 field --> $DIR/ref.rs:4:14 diff --git a/tests/ui/parser/misspelled-keywords/return.stderr b/tests/ui/parser/misspelled-keywords/return.stderr index efa45f322990..21188ff8cb77 100644 --- a/tests/ui/parser/misspelled-keywords/return.stderr +++ b/tests/ui/parser/misspelled-keywords/return.stderr @@ -6,8 +6,9 @@ LL | returnn a; | help: there is a keyword `return` with a similar name | -LL | return a; - | ~~~~~~ +LL - returnn a; +LL + return a; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/static-mut.stderr b/tests/ui/parser/misspelled-keywords/static-mut.stderr index 3c25af548a3d..10cdfe1adc60 100644 --- a/tests/ui/parser/misspelled-keywords/static-mut.stderr +++ b/tests/ui/parser/misspelled-keywords/static-mut.stderr @@ -6,8 +6,9 @@ LL | static muta a: u8 = 0; | help: there is a keyword `mut` with a similar name | -LL | static mut a: u8 = 0; - | ~~~ +LL - static muta a: u8 = 0; +LL + static mut a: u8 = 0; + | error: missing type for `static` item --> $DIR/static-mut.rs:1:12 diff --git a/tests/ui/parser/misspelled-keywords/static.stderr b/tests/ui/parser/misspelled-keywords/static.stderr index 003aa3929bc2..e559f2be1091 100644 --- a/tests/ui/parser/misspelled-keywords/static.stderr +++ b/tests/ui/parser/misspelled-keywords/static.stderr @@ -6,8 +6,9 @@ LL | Static a = 0; | help: write keyword `static` in lowercase (notice the capitalization difference) | -LL | static a = 0; - | ~~~~~~ +LL - Static a = 0; +LL + static a = 0; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/struct.stderr b/tests/ui/parser/misspelled-keywords/struct.stderr index 559182f9c8f6..edbec3b9456b 100644 --- a/tests/ui/parser/misspelled-keywords/struct.stderr +++ b/tests/ui/parser/misspelled-keywords/struct.stderr @@ -6,8 +6,9 @@ LL | Struct Foor { | help: write keyword `struct` in lowercase (notice the capitalization difference) | -LL | struct Foor { - | ~~~~~~ +LL - Struct Foor { +LL + struct Foor { + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/unsafe-fn.stderr b/tests/ui/parser/misspelled-keywords/unsafe-fn.stderr index b13281b03951..679dbb6af372 100644 --- a/tests/ui/parser/misspelled-keywords/unsafe-fn.stderr +++ b/tests/ui/parser/misspelled-keywords/unsafe-fn.stderr @@ -6,8 +6,9 @@ LL | unsafee fn code() {} | help: there is a keyword `unsafe` with a similar name | -LL | unsafe fn code() {} - | ~~~~~~ +LL - unsafee fn code() {} +LL + unsafe fn code() {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/use.stderr b/tests/ui/parser/misspelled-keywords/use.stderr index db6dffdb613c..40584c835b7a 100644 --- a/tests/ui/parser/misspelled-keywords/use.stderr +++ b/tests/ui/parser/misspelled-keywords/use.stderr @@ -6,8 +6,9 @@ LL | usee a::b; | help: there is a keyword `use` with a similar name | -LL | use a::b; - | ~~~ +LL - usee a::b; +LL + use a::b; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/where-clause.stderr b/tests/ui/parser/misspelled-keywords/where-clause.stderr index 5143c30ca510..f0835f6e7dab 100644 --- a/tests/ui/parser/misspelled-keywords/where-clause.stderr +++ b/tests/ui/parser/misspelled-keywords/where-clause.stderr @@ -8,7 +8,8 @@ LL | wheree | help: there is a keyword `where` with a similar name | -LL | where +LL - wheree +LL + where | error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/while-loop.stderr b/tests/ui/parser/misspelled-keywords/while-loop.stderr index 7d150443f57e..2d1136285c84 100644 --- a/tests/ui/parser/misspelled-keywords/while-loop.stderr +++ b/tests/ui/parser/misspelled-keywords/while-loop.stderr @@ -6,8 +6,9 @@ LL | whilee a < b { | help: there is a keyword `while` with a similar name | -LL | while a < b { - | ~~~~~ +LL - whilee a < b { +LL + while a < b { + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/mut-patterns.stderr b/tests/ui/parser/mut-patterns.stderr index ad19a60af34e..43f6a344bf39 100644 --- a/tests/ui/parser/mut-patterns.stderr +++ b/tests/ui/parser/mut-patterns.stderr @@ -33,8 +33,9 @@ LL | let mut (x @ y) = 0; = note: `mut` may be followed by `variable` and `variable @ pattern` help: add `mut` to each binding | -LL | let (mut x @ mut y) = 0; - | ~~~~~~~~~~~~~~~ +LL - let mut (x @ y) = 0; +LL + let (mut x @ mut y) = 0; + | error: `mut` on a binding may not be repeated --> $DIR/mut-patterns.rs:14:13 @@ -69,8 +70,9 @@ LL | let mut Foo { x: x } = Foo { x: 3 }; = note: `mut` may be followed by `variable` and `variable @ pattern` help: add `mut` to each binding | -LL | let Foo { x: mut x } = Foo { x: 3 }; - | ~~~~~~~~~~~~~~~~ +LL - let mut Foo { x: x } = Foo { x: 3 }; +LL + let Foo { x: mut x } = Foo { x: 3 }; + | error: `mut` must be attached to each individual binding --> $DIR/mut-patterns.rs:27:9 @@ -81,8 +83,9 @@ LL | let mut Foo { x } = Foo { x: 3 }; = note: `mut` may be followed by `variable` and `variable @ pattern` help: add `mut` to each binding | -LL | let Foo { mut x } = Foo { x: 3 }; - | ~~~~~~~~~~~~~ +LL - let mut Foo { x } = Foo { x: 3 }; +LL + let Foo { mut x } = Foo { x: 3 }; + | error: `mut` on a binding may not be repeated --> $DIR/mut-patterns.rs:32:13 @@ -151,8 +154,9 @@ LL | let mut W(mut a, W(b, W(ref c, W(d, B { box f })))) = note: `mut` may be followed by `variable` and `variable @ pattern` help: add `mut` to each binding | -LL | let W(mut a, W(mut b, W(ref c, W(mut d, B { box mut f })))) - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let mut W(mut a, W(b, W(ref c, W(d, B { box f })))) +LL + let W(mut a, W(mut b, W(ref c, W(mut d, B { box mut f })))) + | error: expected identifier, found `x` --> $DIR/mut-patterns.rs:48:21 diff --git a/tests/ui/parser/not-a-pred.stderr b/tests/ui/parser/not-a-pred.stderr index 6f6a332cb815..9fedd208e1af 100644 --- a/tests/ui/parser/not-a-pred.stderr +++ b/tests/ui/parser/not-a-pred.stderr @@ -6,8 +6,9 @@ LL | fn f(a: isize, b: isize) : lt(a, b) { } | help: use `->` instead | -LL | fn f(a: isize, b: isize) -> lt(a, b) { } - | ~~ +LL - fn f(a: isize, b: isize) : lt(a, b) { } +LL + fn f(a: isize, b: isize) -> lt(a, b) { } + | error[E0573]: expected type, found function `lt` --> $DIR/not-a-pred.rs:1:28 diff --git a/tests/ui/parser/public-instead-of-pub-1.stderr b/tests/ui/parser/public-instead-of-pub-1.stderr index 3fbe8d0b164e..5695624d3b6a 100644 --- a/tests/ui/parser/public-instead-of-pub-1.stderr +++ b/tests/ui/parser/public-instead-of-pub-1.stderr @@ -6,8 +6,9 @@ LL | public enum Test { | help: write `pub` instead of `public` to make the item public | -LL | pub enum Test { - | ~~~ +LL - public enum Test { +LL + pub enum Test { + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/public-instead-of-pub-3.stderr b/tests/ui/parser/public-instead-of-pub-3.stderr index b9b924e670a4..856bdf185704 100644 --- a/tests/ui/parser/public-instead-of-pub-3.stderr +++ b/tests/ui/parser/public-instead-of-pub-3.stderr @@ -6,8 +6,9 @@ LL | public const X: i32 = 123; | help: write `pub` instead of `public` to make the item public | -LL | pub const X: i32 = 123; - | ~~~ +LL - public const X: i32 = 123; +LL + pub const X: i32 = 123; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/public-instead-of-pub.stderr b/tests/ui/parser/public-instead-of-pub.stderr index c98f8a9914e6..29a208cd4847 100644 --- a/tests/ui/parser/public-instead-of-pub.stderr +++ b/tests/ui/parser/public-instead-of-pub.stderr @@ -6,8 +6,9 @@ LL | public struct X; | help: write `pub` instead of `public` to make the item public | -LL | pub struct X; - | ~~~ +LL - public struct X; +LL + pub struct X; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/range-inclusive-extra-equals.stderr b/tests/ui/parser/range-inclusive-extra-equals.stderr index a573cdf950cd..db18cef81b17 100644 --- a/tests/ui/parser/range-inclusive-extra-equals.stderr +++ b/tests/ui/parser/range-inclusive-extra-equals.stderr @@ -7,8 +7,9 @@ LL | if let 1..==3 = 1 {} = note: inclusive ranges end with a single equals sign (`..=`) help: use `..=` instead | -LL | if let 1..=3 = 1 {} - | ~~~ +LL - if let 1..==3 = 1 {} +LL + if let 1..=3 = 1 {} + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/range_inclusive_dotdotdot.stderr b/tests/ui/parser/range_inclusive_dotdotdot.stderr index 2dc2c87eb7ba..069133a43a38 100644 --- a/tests/ui/parser/range_inclusive_dotdotdot.stderr +++ b/tests/ui/parser/range_inclusive_dotdotdot.stderr @@ -6,12 +6,14 @@ LL | return ...1; | help: use `..` for an exclusive range | -LL | return ..1; - | ~~ +LL - return ...1; +LL + return ..1; + | help: or `..=` for an inclusive range | -LL | return ..=1; - | ~~~ +LL - return ...1; +LL + return ..=1; + | error: unexpected token: `...` --> $DIR/range_inclusive_dotdotdot.rs:12:13 @@ -21,12 +23,14 @@ LL | let x = ...0; | help: use `..` for an exclusive range | -LL | let x = ..0; - | ~~ +LL - let x = ...0; +LL + let x = ..0; + | help: or `..=` for an inclusive range | -LL | let x = ..=0; - | ~~~ +LL - let x = ...0; +LL + let x = ..=0; + | error: unexpected token: `...` --> $DIR/range_inclusive_dotdotdot.rs:16:14 @@ -36,12 +40,14 @@ LL | let x = 5...5; | help: use `..` for an exclusive range | -LL | let x = 5..5; - | ~~ +LL - let x = 5...5; +LL + let x = 5..5; + | help: or `..=` for an inclusive range | -LL | let x = 5..=5; - | ~~~ +LL - let x = 5...5; +LL + let x = 5..=5; + | error: unexpected token: `...` --> $DIR/range_inclusive_dotdotdot.rs:20:15 @@ -51,12 +57,14 @@ LL | for _ in 0...1 {} | help: use `..` for an exclusive range | -LL | for _ in 0..1 {} - | ~~ +LL - for _ in 0...1 {} +LL + for _ in 0..1 {} + | help: or `..=` for an inclusive range | -LL | for _ in 0..=1 {} - | ~~~ +LL - for _ in 0...1 {} +LL + for _ in 0..=1 {} + | error: aborting due to 4 previous errors diff --git a/tests/ui/parser/recover/recover-assoc-lifetime-constraint.stderr b/tests/ui/parser/recover/recover-assoc-lifetime-constraint.stderr index 606b737e7231..d1c803863a2a 100644 --- a/tests/ui/parser/recover/recover-assoc-lifetime-constraint.stderr +++ b/tests/ui/parser/recover/recover-assoc-lifetime-constraint.stderr @@ -10,8 +10,9 @@ LL | bar::(); = help: if you meant to specify a trait object, write `dyn /* Trait */ + 'a` help: you might have meant to write a bound here | -LL | bar::(); - | ~ +LL - bar::(); +LL + bar::(); + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr b/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr index aee31d08fe0e..4e1fcaf49368 100644 --- a/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr +++ b/tests/ui/parser/recover/recover-fn-trait-from-fn-kw.stderr @@ -6,8 +6,9 @@ LL | fn foo(_: impl fn() -> i32) {} | help: use `Fn` to refer to the trait (notice the capitalization difference) | -LL | fn foo(_: impl Fn() -> i32) {} - | ~~ +LL - fn foo(_: impl fn() -> i32) {} +LL + fn foo(_: impl Fn() -> i32) {} + | error: expected identifier, found keyword `fn` --> $DIR/recover-fn-trait-from-fn-kw.rs:4:12 @@ -17,8 +18,9 @@ LL | fn foo2(_: T) {} | help: use `Fn` to refer to the trait (notice the capitalization difference) | -LL | fn foo2(_: T) {} - | ~~ +LL - fn foo2(_: T) {} +LL + fn foo2(_: T) {} + | error[E0308]: mismatched types --> $DIR/recover-fn-trait-from-fn-kw.rs:8:12 diff --git a/tests/ui/parser/recover/recover-for-loop-parens-around-head.stderr b/tests/ui/parser/recover/recover-for-loop-parens-around-head.stderr index beaa346e76c5..2bc7952def79 100644 --- a/tests/ui/parser/recover/recover-for-loop-parens-around-head.stderr +++ b/tests/ui/parser/recover/recover-for-loop-parens-around-head.stderr @@ -18,8 +18,9 @@ LL | const _RECOVERY_WITNESS: u32 = 0u8; | help: change the type of the numeric literal from `u8` to `u32` | -LL | const _RECOVERY_WITNESS: u32 = 0u32; - | ~~~ +LL - const _RECOVERY_WITNESS: u32 = 0u8; +LL + const _RECOVERY_WITNESS: u32 = 0u32; + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/recover/recover-from-bad-variant.stderr b/tests/ui/parser/recover/recover-from-bad-variant.stderr index 0339f8695154..9359ede1346a 100644 --- a/tests/ui/parser/recover/recover-from-bad-variant.stderr +++ b/tests/ui/parser/recover/recover-from-bad-variant.stderr @@ -6,8 +6,9 @@ LL | let x = Enum::Foo(a: 3, b: 4); | help: if `Enum::Foo` is a struct, use braces as delimiters | -LL | let x = Enum::Foo { a: 3, b: 4 }; - | ~ ~ +LL - let x = Enum::Foo(a: 3, b: 4); +LL + let x = Enum::Foo { a: 3, b: 4 }; + | help: if `Enum::Foo` is a function, use the arguments directly | LL - let x = Enum::Foo(a: 3, b: 4); @@ -22,8 +23,9 @@ LL | Enum::Foo(a, b) => {} | help: the struct variant's fields are being ignored | -LL | Enum::Foo { a: _, b: _ } => {} - | ~~~~~~~~~~~~~~ +LL - Enum::Foo(a, b) => {} +LL + Enum::Foo { a: _, b: _ } => {} + | error[E0769]: tuple variant `Enum::Bar` written as struct variant --> $DIR/recover-from-bad-variant.rs:12:9 @@ -33,8 +35,9 @@ LL | Enum::Bar { a, b } => {} | help: use the tuple variant pattern syntax instead | -LL | Enum::Bar(a, b) => {} - | ~~~~~~ +LL - Enum::Bar { a, b } => {} +LL + Enum::Bar(a, b) => {} + | error: aborting due to 3 previous errors diff --git a/tests/ui/parser/recover/recover-from-homoglyph.stderr b/tests/ui/parser/recover/recover-from-homoglyph.stderr index f11ca9fd5840..38ca0259366c 100644 --- a/tests/ui/parser/recover/recover-from-homoglyph.stderr +++ b/tests/ui/parser/recover/recover-from-homoglyph.stderr @@ -6,8 +6,9 @@ LL | println!(""); | help: Unicode character ';' (Greek Question Mark) looks like ';' (Semicolon), but it is not | -LL | println!(""); - | ~ +LL - println!(""); +LL + println!(""); + | error[E0308]: mismatched types --> $DIR/recover-from-homoglyph.rs:3:20 diff --git a/tests/ui/parser/recover/recover-pat-exprs.stderr b/tests/ui/parser/recover/recover-pat-exprs.stderr index 281eeced4024..dcc1945d569c 100644 --- a/tests/ui/parser/recover/recover-pat-exprs.stderr +++ b/tests/ui/parser/recover/recover-pat-exprs.stderr @@ -7,8 +7,9 @@ LL | x.y => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == x.y => (), - | ~~~ +++++++++++++ +LL - x.y => (), +LL + val if val == x.y => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.y; @@ -30,8 +31,9 @@ LL | x.0 => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == x.0 => (), - | ~~~ +++++++++++++ +LL - x.0 => (), +LL + val if val == x.0 => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.0; @@ -54,8 +56,9 @@ LL | x._0 => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == x._0 => (), - | ~~~ ++++++++++++++ +LL - x._0 => (), +LL + val if val == x._0 => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x._0; @@ -79,8 +82,9 @@ LL | x.0.1 => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == x.0.1 => (), - | ~~~ +++++++++++++++ +LL - x.0.1 => (), +LL + val if val == x.0.1 => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.0.1; @@ -104,8 +108,9 @@ LL | x.4.y.17.__z => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == x.4.y.17.__z => (), - | ~~~ ++++++++++++++++++++++ +LL - x.4.y.17.__z => (), +LL + val if val == x.4.y.17.__z => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.4.y.17.__z; @@ -159,8 +164,9 @@ LL | x[0] => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == x[0] => (), - | ~~~ ++++++++++++++ +LL - x[0] => (), +LL + val if val == x[0] => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x[0]; @@ -181,8 +187,9 @@ LL | x[..] => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == x[..] => (), - | ~~~ +++++++++++++++ +LL - x[..] => (), +LL + val if val == x[..] => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x[..]; @@ -231,8 +238,9 @@ LL | x.f() => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == x.f() => (), - | ~~~ +++++++++++++++ +LL - x.f() => (), +LL + val if val == x.f() => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.f(); @@ -253,8 +261,9 @@ LL | x._f() => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == x._f() => (), - | ~~~ ++++++++++++++++ +LL - x._f() => (), +LL + val if val == x._f() => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x._f(); @@ -276,8 +285,9 @@ LL | x? => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == x? => (), - | ~~~ ++++++++++++ +LL - x? => (), +LL + val if val == x? => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x?; @@ -300,8 +310,9 @@ LL | ().f() => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == ().f() => (), - | ~~~ ++++++++++++++++ +LL - ().f() => (), +LL + val if val == ().f() => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = ().f(); @@ -325,8 +336,9 @@ LL | (0, x)?.f() => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == (0, x)?.f() => (), - | ~~~ +++++++++++++++++++++ +LL - (0, x)?.f() => (), +LL + val if val == (0, x)?.f() => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = (0, x)?.f(); @@ -350,8 +362,9 @@ LL | x.f().g() => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == x.f().g() => (), - | ~~~ +++++++++++++++++++ +LL - x.f().g() => (), +LL + val if val == x.f().g() => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.f().g(); @@ -375,8 +388,9 @@ LL | 0.f()?.g()?? => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == 0.f()?.g()?? => (), - | ~~~ ++++++++++++++++++++++ +LL - 0.f()?.g()?? => (), +LL + val if val == 0.f()?.g()?? => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = 0.f()?.g()??; @@ -400,8 +414,9 @@ LL | x as usize => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == x as usize => (), - | ~~~ ++++++++++++++++++++ +LL - x as usize => (), +LL + val if val == x as usize => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x as usize; @@ -422,8 +437,9 @@ LL | 0 as usize => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == 0 as usize => (), - | ~~~ ++++++++++++++++++++ +LL - 0 as usize => (), +LL + val if val == 0 as usize => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = 0 as usize; @@ -445,8 +461,9 @@ LL | x.f().0.4 as f32 => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == x.f().0.4 as f32 => (), - | ~~~ ++++++++++++++++++++++++++ +LL - x.f().0.4 as f32 => (), +LL + val if val == x.f().0.4 as f32 => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.f().0.4 as f32; @@ -469,8 +486,9 @@ LL | 1 + 1 => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == 1 + 1 => (), - | ~~~ +++++++++++++++ +LL - 1 + 1 => (), +LL + val if val == 1 + 1 => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = 1 + 1; @@ -491,8 +509,9 @@ LL | (1 + 2) * 3 => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == (1 + 2) * 3 => (), - | ~~~ +++++++++++++++++++++ +LL - (1 + 2) * 3 => (), +LL + val if val == (1 + 2) * 3 => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = (1 + 2) * 3; @@ -514,8 +533,9 @@ LL | x.0 > 2 => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == (x.0 > 2) => (), - | ~~~ +++++++++++++++++++ +LL - x.0 > 2 => (), +LL + val if val == (x.0 > 2) => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.0 > 2; @@ -539,8 +559,9 @@ LL | x.0 == 2 => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == (x.0 == 2) => (), - | ~~~ ++++++++++++++++++++ +LL - x.0 == 2 => (), +LL + val if val == (x.0 == 2) => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = x.0 == 2; @@ -564,8 +585,9 @@ LL | (x, y.0 > 2) if x != 0 => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to the match arm guard | -LL | (x, val) if x != 0 && val == (y.0 > 2) => (), - | ~~~ +++++++++++++++++++ +LL - (x, y.0 > 2) if x != 0 => (), +LL + (x, val) if x != 0 && val == (y.0 > 2) => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = y.0 > 2; @@ -586,8 +608,9 @@ LL | (x, y.0 > 2) if x != 0 || x != 1 => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to the match arm guard | -LL | (x, val) if (x != 0 || x != 1) && val == (y.0 > 2) => (), - | ~~~ + +++++++++++++++++++++ +LL - (x, y.0 > 2) if x != 0 || x != 1 => (), +LL + (x, val) if (x != 0 || x != 1) && val == (y.0 > 2) => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = y.0 > 2; @@ -626,8 +649,9 @@ LL | u8::MAX.abs() => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == u8::MAX.abs() => (), - | ~~~ +++++++++++++++++++++++ +LL - u8::MAX.abs() => (), +LL + val if val == u8::MAX.abs() => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = u8::MAX.abs(); @@ -648,8 +672,9 @@ LL | z @ w @ v.u() => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | z @ w @ val if val == v.u() => (), - | ~~~ +++++++++++++++ +LL - z @ w @ v.u() => (), +LL + z @ w @ val if val == v.u() => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = v.u(); @@ -673,8 +698,9 @@ LL | y.ilog(3) => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == y.ilog(3) => (), - | ~~~ +++++++++++++++++++ +LL - y.ilog(3) => (), +LL + val if val == y.ilog(3) => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = y.ilog(3); @@ -698,8 +724,9 @@ LL | n + 1 => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == n + 1 => (), - | ~~~ +++++++++++++++ +LL - n + 1 => (), +LL + val if val == n + 1 => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = n + 1; @@ -723,8 +750,9 @@ LL | ("".f() + 14 * 8) => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | (val) if val == "".f() + 14 * 8 => (), - | ~~~ +++++++++++++++++++++++++ +LL - ("".f() + 14 * 8) => (), +LL + (val) if val == "".f() + 14 * 8 => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = "".f() + 14 * 8; @@ -748,8 +776,9 @@ LL | f?() => (), = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | val if val == f?() => (), - | ~~~ ++++++++++++++ +LL - f?() => (), +LL + val if val == f?() => (), + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = f?(); diff --git a/tests/ui/parser/recover/recover-pat-issues.stderr b/tests/ui/parser/recover/recover-pat-issues.stderr index bdd0b2b260e7..0c65b16dd951 100644 --- a/tests/ui/parser/recover/recover-pat-issues.stderr +++ b/tests/ui/parser/recover/recover-pat-issues.stderr @@ -7,8 +7,9 @@ LL | Foo("hi".to_owned()) => true, = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | Foo(val) if val == "hi".to_owned() => true, - | ~~~ +++++++++++++++++++++++++ +LL - Foo("hi".to_owned()) => true, +LL + Foo(val) if val == "hi".to_owned() => true, + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = "hi".to_owned(); @@ -29,8 +30,9 @@ LL | Bar { baz: "hi".to_owned() } => true, = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | Bar { baz } if baz == "hi".to_owned() => true, - | ~~~ +++++++++++++++++++++++++ +LL - Bar { baz: "hi".to_owned() } => true, +LL + Bar { baz } if baz == "hi".to_owned() => true, + | help: consider extracting the expression into a `const` | LL + const BAZ: /* Type */ = "hi".to_owned(); @@ -51,8 +53,9 @@ LL | &["foo".to_string()] => {} = note: arbitrary expressions are not allowed in patterns: help: consider moving the expression to a match arm guard | -LL | &[val] if val == "foo".to_string() => {} - | ~~~ +++++++++++++++++++++++++++ +LL - &["foo".to_string()] => {} +LL + &[val] if val == "foo".to_string() => {} + | help: consider extracting the expression into a `const` | LL + const VAL: /* Type */ = "foo".to_string(); diff --git a/tests/ui/parser/recover/recover-range-pats.stderr b/tests/ui/parser/recover/recover-range-pats.stderr index 5c134bd4a82a..a2f3ba4dd94f 100644 --- a/tests/ui/parser/recover/recover-range-pats.stderr +++ b/tests/ui/parser/recover/recover-range-pats.stderr @@ -231,8 +231,9 @@ LL | if let ...3 = 0 {} | help: use `..=` instead | -LL | if let ..=3 = 0 {} - | ~~~ +LL - if let ...3 = 0 {} +LL + if let ..=3 = 0 {} + | error: range-to patterns with `...` are not allowed --> $DIR/recover-range-pats.rs:121:12 @@ -242,8 +243,9 @@ LL | if let ...Y = 0 {} | help: use `..=` instead | -LL | if let ..=Y = 0 {} - | ~~~ +LL - if let ...Y = 0 {} +LL + if let ..=Y = 0 {} + | error: range-to patterns with `...` are not allowed --> $DIR/recover-range-pats.rs:123:12 @@ -253,8 +255,9 @@ LL | if let ...true = 0 {} | help: use `..=` instead | -LL | if let ..=true = 0 {} - | ~~~ +LL - if let ...true = 0 {} +LL + if let ..=true = 0 {} + | error: float literals must have an integer part --> $DIR/recover-range-pats.rs:126:15 @@ -275,8 +278,9 @@ LL | if let ....3 = 0 {} | help: use `..=` instead | -LL | if let ..=.3 = 0 {} - | ~~~ +LL - if let ....3 = 0 {} +LL + if let ..=.3 = 0 {} + | error: range-to patterns with `...` are not allowed --> $DIR/recover-range-pats.rs:152:17 @@ -290,8 +294,9 @@ LL | mac!(0); = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info) help: use `..=` instead | -LL | let ..=$e; - | ~~~ +LL - let ...$e; +LL + let ..=$e; + | error[E0586]: inclusive range with no end --> $DIR/recover-range-pats.rs:159:19 diff --git a/tests/ui/parser/recover/recover-ref-dyn-mut.stderr b/tests/ui/parser/recover/recover-ref-dyn-mut.stderr index bb0f0b0214c4..2f1649f01c9e 100644 --- a/tests/ui/parser/recover/recover-ref-dyn-mut.stderr +++ b/tests/ui/parser/recover/recover-ref-dyn-mut.stderr @@ -6,8 +6,9 @@ LL | let r: &dyn mut Trait; | help: place `mut` before `dyn` | -LL | let r: &mut dyn Trait; - | ~~~~~~~~ +LL - let r: &dyn mut Trait; +LL + let r: &mut dyn Trait; + | error[E0405]: cannot find trait `Trait` in this scope --> $DIR/recover-ref-dyn-mut.rs:5:21 diff --git a/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr index 551b2e3ff09b..15866211954b 100644 --- a/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr +++ b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr @@ -7,8 +7,9 @@ LL | let x = Tr; = note: type ascription syntax has been removed, see issue #101728 help: maybe write a path separator here | -LL | let x = Tr; - | ~~ +LL - let x = Tr; +LL + let x = Tr; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover/unicode-double-equals-recovery.stderr b/tests/ui/parser/recover/unicode-double-equals-recovery.stderr index 6e10dcce04a3..1931fd4ee45f 100644 --- a/tests/ui/parser/recover/unicode-double-equals-recovery.stderr +++ b/tests/ui/parser/recover/unicode-double-equals-recovery.stderr @@ -6,8 +6,9 @@ LL | const A: usize ⩵ 2; | help: Unicode character '⩵' (Two Consecutive Equals Signs) looks like '==' (Double Equals Sign), but it is not | -LL | const A: usize == 2; - | ~~ +LL - const A: usize ⩵ 2; +LL + const A: usize == 2; + | error: unexpected `==` --> $DIR/unicode-double-equals-recovery.rs:1:16 @@ -17,8 +18,9 @@ LL | const A: usize ⩵ 2; | help: try using `=` instead | -LL | const A: usize = 2; - | ~ +LL - const A: usize ⩵ 2; +LL + const A: usize = 2; + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/removed-syntax/removed-syntax-box.stderr b/tests/ui/parser/removed-syntax/removed-syntax-box.stderr index 60c39fd37c43..04e84a10fad6 100644 --- a/tests/ui/parser/removed-syntax/removed-syntax-box.stderr +++ b/tests/ui/parser/removed-syntax/removed-syntax-box.stderr @@ -6,8 +6,9 @@ LL | let _ = box (); | help: use `Box::new()` instead | -LL | let _ = Box::new(()); - | ~~~~~~~~~ + +LL - let _ = box (); +LL + let _ = Box::new(()); + | error: `box_syntax` has been removed --> $DIR/removed-syntax-box.rs:10:13 @@ -17,8 +18,9 @@ LL | let _ = box 1; | help: use `Box::new()` instead | -LL | let _ = Box::new(1); - | ~~~~~~~~~ + +LL - let _ = box 1; +LL + let _ = Box::new(1); + | error: `box_syntax` has been removed --> $DIR/removed-syntax-box.rs:11:13 @@ -28,8 +30,9 @@ LL | let _ = box T { a: 12, b: 18 }; | help: use `Box::new()` instead | -LL | let _ = Box::new(T { a: 12, b: 18 }); - | ~~~~~~~~~ + +LL - let _ = box T { a: 12, b: 18 }; +LL + let _ = Box::new(T { a: 12, b: 18 }); + | error: `box_syntax` has been removed --> $DIR/removed-syntax-box.rs:12:13 @@ -39,8 +42,9 @@ LL | let _ = box [5; 30]; | help: use `Box::new()` instead | -LL | let _ = Box::new([5; 30]); - | ~~~~~~~~~ + +LL - let _ = box [5; 30]; +LL + let _ = Box::new([5; 30]); + | error: `box_syntax` has been removed --> $DIR/removed-syntax-box.rs:13:22 @@ -50,8 +54,9 @@ LL | let _: Box<()> = box (); | help: use `Box::new()` instead | -LL | let _: Box<()> = Box::new(()); - | ~~~~~~~~~ + +LL - let _: Box<()> = box (); +LL + let _: Box<()> = Box::new(()); + | error: aborting due to 5 previous errors diff --git a/tests/ui/parser/suggest-assoc-const.stderr b/tests/ui/parser/suggest-assoc-const.stderr index 70ebeded3137..8cb304ced372 100644 --- a/tests/ui/parser/suggest-assoc-const.stderr +++ b/tests/ui/parser/suggest-assoc-const.stderr @@ -6,8 +6,9 @@ LL | let _X: i32; | help: consider using `const` instead of `let` for associated const | -LL | const _X: i32; - | ~~~~~ +LL - let _X: i32; +LL + const _X: i32; + | error: aborting due to 1 previous error diff --git a/tests/ui/parser/suggest-remove-compount-assign-let-ice.stderr b/tests/ui/parser/suggest-remove-compount-assign-let-ice.stderr index 59716d69b50f..477ec516d665 100644 --- a/tests/ui/parser/suggest-remove-compount-assign-let-ice.stderr +++ b/tests/ui/parser/suggest-remove-compount-assign-let-ice.stderr @@ -6,8 +6,9 @@ LL | let x ➖= 1; | help: Unicode character '➖' (Heavy Minus Sign) looks like '-' (Minus/Hyphen), but it is not | -LL | let x -= 1; - | ~ +LL - let x ➖= 1; +LL + let x -= 1; + | error: can't reassign to an uninitialized variable --> $DIR/suggest-remove-compount-assign-let-ice.rs:13:11 diff --git a/tests/ui/parser/trailing-question-in-type.stderr b/tests/ui/parser/trailing-question-in-type.stderr index a3cd419c0c71..066c38d4c4fa 100644 --- a/tests/ui/parser/trailing-question-in-type.stderr +++ b/tests/ui/parser/trailing-question-in-type.stderr @@ -6,8 +6,9 @@ LL | fn foo() -> i32? { | help: if you meant to express that the type might not contain a value, use the `Option` wrapper type | -LL | fn foo() -> Option { - | +++++++ ~ +LL - fn foo() -> i32? { +LL + fn foo() -> Option { + | error: invalid `?` in type --> $DIR/trailing-question-in-type.rs:4:15 @@ -17,8 +18,9 @@ LL | let x: i32? = Some(1); | help: if you meant to express that the type might not contain a value, use the `Option` wrapper type | -LL | let x: Option = Some(1); - | +++++++ ~ +LL - let x: i32? = Some(1); +LL + let x: Option = Some(1); + | error: aborting due to 2 previous errors diff --git a/tests/ui/parser/type-ascription-in-pattern.stderr b/tests/ui/parser/type-ascription-in-pattern.stderr index 091907549936..d29c76baa7b5 100644 --- a/tests/ui/parser/type-ascription-in-pattern.stderr +++ b/tests/ui/parser/type-ascription-in-pattern.stderr @@ -8,8 +8,9 @@ LL | x: i32 => x, | help: maybe write a path separator here | -LL | x::i32 => x, - | ~~ +LL - x: i32 => x, +LL + x::i32 => x, + | error: expected one of `...`, `..=`, `..`, or `|`, found `:` --> $DIR/type-ascription-in-pattern.rs:12:11 @@ -37,8 +38,9 @@ LL | x: i32 => (), | help: maybe write a path separator here | -LL | x::i32 => (), - | ~~ +LL - x: i32 => (), +LL + x::i32 => (), + | error[E0308]: mismatched types --> $DIR/type-ascription-in-pattern.rs:3:19 diff --git a/tests/ui/parser/typod-const-in-const-param-def.stderr b/tests/ui/parser/typod-const-in-const-param-def.stderr index 80c0f1deae6f..bf7168a01573 100644 --- a/tests/ui/parser/typod-const-in-const-param-def.stderr +++ b/tests/ui/parser/typod-const-in-const-param-def.stderr @@ -6,8 +6,9 @@ LL | pub fn foo() {} | help: use the `const` keyword (notice the capitalization difference) | -LL | pub fn foo() {} - | ~~~~~ +LL - pub fn foo() {} +LL + pub fn foo() {} + | error: `const` keyword was mistyped as `Const` --> $DIR/typod-const-in-const-param-def.rs:7:12 @@ -17,8 +18,9 @@ LL | pub fn baz() {} | help: use the `const` keyword (notice the capitalization difference) | -LL | pub fn baz() {} - | ~~~~~ +LL - pub fn baz() {} +LL + pub fn baz() {} + | error: `const` keyword was mistyped as `Const` --> $DIR/typod-const-in-const-param-def.rs:10:15 @@ -28,8 +30,9 @@ LL | pub fn qux() {} | help: use the `const` keyword (notice the capitalization difference) | -LL | pub fn qux() {} - | ~~~~~ +LL - pub fn qux() {} +LL + pub fn qux() {} + | error: `const` keyword was mistyped as `Const` --> $DIR/typod-const-in-const-param-def.rs:13:16 @@ -39,8 +42,9 @@ LL | pub fn quux() {} | help: use the `const` keyword (notice the capitalization difference) | -LL | pub fn quux() {} - | ~~~~~ +LL - pub fn quux() {} +LL + pub fn quux() {} + | error: aborting due to 4 previous errors diff --git a/tests/ui/parser/unicode-character-literal.stderr b/tests/ui/parser/unicode-character-literal.stderr index a1561e7f04b0..8ce2354f0b9c 100644 --- a/tests/ui/parser/unicode-character-literal.stderr +++ b/tests/ui/parser/unicode-character-literal.stderr @@ -11,8 +11,9 @@ LL | let _spade = '♠️'; | ^ help: if you meant to write a string literal, use double quotes | -LL | let _spade = "♠️"; - | ~ ~ +LL - let _spade = '♠️'; +LL + let _spade = "♠️"; + | error: character literal may only contain one codepoint --> $DIR/unicode-character-literal.rs:12:14 @@ -27,8 +28,9 @@ LL | let _s = 'ṩ̂̊'; | ^ help: if you meant to write a string literal, use double quotes | -LL | let _s = "ṩ̂̊"; - | ~ ~ +LL - let _s = 'ṩ̂̊'; +LL + let _s = "ṩ̂̊"; + | error: character literal may only contain one codepoint --> $DIR/unicode-character-literal.rs:17:14 @@ -43,8 +45,9 @@ LL | let _a = 'Å'; | ^ help: consider using the normalized form `\u{c5}` of this character | -LL | let _a = 'Å'; - | ~ +LL - let _a = 'Å'; +LL + let _a = 'Å'; + | error: aborting due to 3 previous errors diff --git a/tests/ui/parser/unicode-chars.stderr b/tests/ui/parser/unicode-chars.stderr index 086de5ec0997..a18a6ad10dd6 100644 --- a/tests/ui/parser/unicode-chars.stderr +++ b/tests/ui/parser/unicode-chars.stderr @@ -6,8 +6,9 @@ LL | let y = 0; | help: Unicode character ';' (Greek Question Mark) looks like ';' (Semicolon), but it is not | -LL | let y = 0; - | ~ +LL - let y = 0; +LL + let y = 0; + | error: unknown start of token: \u{a0} --> $DIR/unicode-chars.rs:5:5 @@ -29,8 +30,9 @@ LL | let _ = 1 ⩵ 2; | help: Unicode character '⩵' (Two Consecutive Equals Signs) looks like '==' (Double Equals Sign), but it is not | -LL | let _ = 1 == 2; - | ~~ +LL - let _ = 1 ⩵ 2; +LL + let _ = 1 == 2; + | error: aborting due to 3 previous errors diff --git a/tests/ui/parser/unicode-control-codepoints.stderr b/tests/ui/parser/unicode-control-codepoints.stderr index 2893194308ed..27b95f9ac611 100644 --- a/tests/ui/parser/unicode-control-codepoints.stderr +++ b/tests/ui/parser/unicode-control-codepoints.stderr @@ -22,8 +22,9 @@ LL | println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); | help: if you meant to use the UTF-8 encoding of '\u{202e}', use \xHH escapes | -LL | println!("{:?}", b"/*\xE2\x80\xAE } �if isAdmin� � begin admins only "); - | ~~~~~~~~~~~~ +LL - println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); +LL + println!("{:?}", b"/*\xE2\x80\xAE } �if isAdmin� � begin admins only "); + | error: non-ASCII character in byte string literal --> $DIR/unicode-control-codepoints.rs:18:30 @@ -33,8 +34,9 @@ LL | println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); | help: if you meant to use the UTF-8 encoding of '\u{2066}', use \xHH escapes | -LL | println!("{:?}", b"/*� } \xE2\x81\xA6if isAdmin� � begin admins only "); - | ~~~~~~~~~~~~ +LL - println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); +LL + println!("{:?}", b"/*� } \xE2\x81\xA6if isAdmin� � begin admins only "); + | error: non-ASCII character in byte string literal --> $DIR/unicode-control-codepoints.rs:18:41 @@ -44,8 +46,9 @@ LL | println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); | help: if you meant to use the UTF-8 encoding of '\u{2069}', use \xHH escapes | -LL | println!("{:?}", b"/*� } �if isAdmin\xE2\x81\xA9 � begin admins only "); - | ~~~~~~~~~~~~ +LL - println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); +LL + println!("{:?}", b"/*� } �if isAdmin\xE2\x81\xA9 � begin admins only "); + | error: non-ASCII character in byte string literal --> $DIR/unicode-control-codepoints.rs:18:43 @@ -55,8 +58,9 @@ LL | println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); | help: if you meant to use the UTF-8 encoding of '\u{2066}', use \xHH escapes | -LL | println!("{:?}", b"/*� } �if isAdmin� \xE2\x81\xA6 begin admins only "); - | ~~~~~~~~~~~~ +LL - println!("{:?}", b"/*� } �if isAdmin� � begin admins only "); +LL + println!("{:?}", b"/*� } �if isAdmin� \xE2\x81\xA6 begin admins only "); + | error: non-ASCII character in raw byte string literal --> $DIR/unicode-control-codepoints.rs:23:29 @@ -128,8 +132,9 @@ LL | println!("{:?}", "/*� } �if isAdmin� � begin admins only "); = help: if their presence wasn't intentional, you can remove them help: if you want to keep them but make them visible in your source code, you can escape them | -LL | println!("{:?}", "/*\u{202e} } \u{2066}if isAdmin\u{2069} \u{2066} begin admins only "); - | ~~~~~~~~ ~~~~~~~~ ~~~~~~~~ ~~~~~~~~ +LL - println!("{:?}", "/*� } �if isAdmin� � begin admins only "); +LL + println!("{:?}", "/*\u{202e} } \u{2066}if isAdmin\u{2069} \u{2066} begin admins only "); + | error: unicode codepoint changing visible direction of text present in literal --> $DIR/unicode-control-codepoints.rs:16:22 @@ -147,8 +152,9 @@ LL | println!("{:?}", r##"/*� } �if isAdmin� � begin admins only "## = help: if their presence wasn't intentional, you can remove them help: if you want to keep them but make them visible in your source code, you can escape them | -LL | println!("{:?}", r##"/*\u{202e} } \u{2066}if isAdmin\u{2069} \u{2066} begin admins only "##); - | ~~~~~~~~ ~~~~~~~~ ~~~~~~~~ ~~~~~~~~ +LL - println!("{:?}", r##"/*� } �if isAdmin� � begin admins only "##); +LL + println!("{:?}", r##"/*\u{202e} } \u{2066}if isAdmin\u{2069} \u{2066} begin admins only "##); + | error: unicode codepoint changing visible direction of text present in literal --> $DIR/unicode-control-codepoints.rs:28:22 @@ -163,8 +169,9 @@ LL | println!("{:?}", '�'); = help: if their presence wasn't intentional, you can remove them help: if you want to keep them but make them visible in your source code, you can escape them | -LL | println!("{:?}", '\u{202e}'); - | ~~~~~~~~ +LL - println!("{:?}", '�'); +LL + println!("{:?}", '\u{202e}'); + | error: unicode codepoint changing visible direction of text present in literal --> $DIR/unicode-control-codepoints.rs:31:13 @@ -179,8 +186,9 @@ LL | let _ = c"�"; = help: if their presence wasn't intentional, you can remove them help: if you want to keep them but make them visible in your source code, you can escape them | -LL | let _ = c"\u{202e}"; - | ~~~~~~~~ +LL - let _ = c"�"; +LL + let _ = c"\u{202e}"; + | error: unicode codepoint changing visible direction of text present in literal --> $DIR/unicode-control-codepoints.rs:33:13 @@ -195,8 +203,9 @@ LL | let _ = cr#"�"#; = help: if their presence wasn't intentional, you can remove them help: if you want to keep them but make them visible in your source code, you can escape them | -LL | let _ = cr#"\u{202e}"#; - | ~~~~~~~~ +LL - let _ = cr#"�"#; +LL + let _ = cr#"\u{202e}"#; + | error: unicode codepoint changing visible direction of text present in format string --> $DIR/unicode-control-codepoints.rs:36:14 @@ -211,8 +220,9 @@ LL | println!("{{�}}"); = help: if their presence wasn't intentional, you can remove them help: if you want to keep them but make them visible in your source code, you can escape them | -LL | println!("{{\u{202e}}}"); - | ~~~~~~~~ +LL - println!("{{�}}"); +LL + println!("{{\u{202e}}}"); + | error: unicode codepoint changing visible direction of text present in doc comment --> $DIR/unicode-control-codepoints.rs:43:1 diff --git a/tests/ui/parser/unicode-quote-chars.stderr b/tests/ui/parser/unicode-quote-chars.stderr index 092abeb53cd4..0ffb204d64af 100644 --- a/tests/ui/parser/unicode-quote-chars.stderr +++ b/tests/ui/parser/unicode-quote-chars.stderr @@ -6,8 +6,9 @@ LL | println!(“hello world”); | help: Unicode characters '“' (Left Double Quotation Mark) and '”' (Right Double Quotation Mark) look like '"' (Quotation Mark), but are not | -LL | println!("hello world"); - | ~~~~~~~~~~~~~ +LL - println!(“hello world”); +LL + println!("hello world"); + | error: unknown start of token: \u{201d} --> $DIR/unicode-quote-chars.rs:2:26 @@ -17,8 +18,9 @@ LL | println!(“hello world”); | help: Unicode character '”' (Right Double Quotation Mark) looks like '"' (Quotation Mark), but it is not | -LL | println!(“hello world"); - | ~ +LL - println!(“hello world”); +LL + println!(“hello world"); + | error: expected `,`, found `world` --> $DIR/unicode-quote-chars.rs:2:21 diff --git a/tests/ui/parser/unnecessary-let.stderr b/tests/ui/parser/unnecessary-let.stderr index 0b28123747a0..d75d1943f2f4 100644 --- a/tests/ui/parser/unnecessary-let.stderr +++ b/tests/ui/parser/unnecessary-let.stderr @@ -18,8 +18,9 @@ LL | for let _x of [1, 2, 3] {} | help: try using `in` here instead | -LL | for let _x in [1, 2, 3] {} - | ~~ +LL - for let _x of [1, 2, 3] {} +LL + for let _x in [1, 2, 3] {} + | error: expected pattern, found `let` --> $DIR/unnecessary-let.rs:9:9 diff --git a/tests/ui/parser/use-colon-as-mod-sep.stderr b/tests/ui/parser/use-colon-as-mod-sep.stderr index 347b271df990..f25a779f31f3 100644 --- a/tests/ui/parser/use-colon-as-mod-sep.stderr +++ b/tests/ui/parser/use-colon-as-mod-sep.stderr @@ -7,8 +7,9 @@ LL | use std::process:Command; = note: import paths are delimited using `::` help: use double colon | -LL | use std::process::Command; - | ~~ +LL - use std::process:Command; +LL + use std::process::Command; + | error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:5:8 @@ -19,8 +20,9 @@ LL | use std:fs::File; = note: import paths are delimited using `::` help: use double colon | -LL | use std::fs::File; - | ~~ +LL - use std:fs::File; +LL + use std::fs::File; + | error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:8 @@ -31,8 +33,9 @@ LL | use std:collections:HashMap; = note: import paths are delimited using `::` help: use double colon | -LL | use std::collections:HashMap; - | ~~ +LL - use std:collections:HashMap; +LL + use std::collections:HashMap; + | error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:20 @@ -43,8 +46,9 @@ LL | use std:collections:HashMap; = note: import paths are delimited using `::` help: use double colon | -LL | use std:collections::HashMap; - | ~~ +LL - use std:collections:HashMap; +LL + use std:collections::HashMap; + | error: aborting due to 4 previous errors diff --git a/tests/ui/parser/utf16-be-without-bom.stderr b/tests/ui/parser/utf16-be-without-bom.stderr index b915c7941b3b..0493bcbc77a4 100644 --- a/tests/ui/parser/utf16-be-without-bom.stderr +++ b/tests/ui/parser/utf16-be-without-bom.stderr @@ -110,8 +110,9 @@ LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | help: consider removing the space to spell keyword `fn` | -LL | ␀fn␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ - | ~~ +LL - ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ +LL + ␀fn␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ + | error: aborting due to 14 previous errors diff --git a/tests/ui/parser/utf16-le-without-bom.stderr b/tests/ui/parser/utf16-le-without-bom.stderr index d937a07bc660..4b195ed0da1a 100644 --- a/tests/ui/parser/utf16-le-without-bom.stderr +++ b/tests/ui/parser/utf16-le-without-bom.stderr @@ -110,8 +110,9 @@ LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ | help: consider removing the space to spell keyword `fn` | -LL | fn␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ - | ~~ +LL - f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ +LL + fn␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀ + | error: aborting due to 14 previous errors diff --git a/tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.stderr b/tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.stderr index 1599edd7a992..0960af705ce4 100644 --- a/tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.stderr +++ b/tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.stderr @@ -9,8 +9,9 @@ LL | let _ @ a = 0; | help: switch the order | -LL | let a @ _ = 0; - | ~~~~~ +LL - let _ @ a = 0; +LL + let a @ _ = 0; + | error: pattern on wrong side of `@` --> $DIR/wild-before-at-syntactically-rejected.rs:10:9 @@ -23,8 +24,9 @@ LL | let _ @ ref a = 0; | help: switch the order | -LL | let ref a @ _ = 0; - | ~~~~~~~~~ +LL - let _ @ ref a = 0; +LL + let ref a @ _ = 0; + | error: pattern on wrong side of `@` --> $DIR/wild-before-at-syntactically-rejected.rs:12:9 @@ -37,8 +39,9 @@ LL | let _ @ ref mut a = 0; | help: switch the order | -LL | let ref mut a @ _ = 0; - | ~~~~~~~~~~~~~ +LL - let _ @ ref mut a = 0; +LL + let ref mut a @ _ = 0; + | error: left-hand side of `@` must be a binding --> $DIR/wild-before-at-syntactically-rejected.rs:14:9 diff --git a/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.stderr b/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.stderr index e80789253c0b..31f8feb1a710 100644 --- a/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.stderr +++ b/tests/ui/pattern/incorrect-placement-of-pattern-modifiers.stderr @@ -50,8 +50,9 @@ LL | let _: usize = 3u8; | help: change the type of the numeric literal from `u8` to `usize` | -LL | let _: usize = 3usize; - | ~~~~~ +LL - let _: usize = 3u8; +LL + let _: usize = 3usize; + | error: aborting due to 4 previous errors diff --git a/tests/ui/pattern/issue-72574-1.stderr b/tests/ui/pattern/issue-72574-1.stderr index 653869a237d8..a9076c3dff63 100644 --- a/tests/ui/pattern/issue-72574-1.stderr +++ b/tests/ui/pattern/issue-72574-1.stderr @@ -7,8 +7,9 @@ LL | (_a, _x @ ..) => {} = help: remove this and bind each tuple field independently help: if you don't need to use the contents of _x, discard the tuple's remaining fields | -LL | (_a, ..) => {} - | ~~ +LL - (_a, _x @ ..) => {} +LL + (_a, ..) => {} + | error: `..` patterns are not allowed here --> $DIR/issue-72574-1.rs:4:19 diff --git a/tests/ui/pattern/issue-72574-2.stderr b/tests/ui/pattern/issue-72574-2.stderr index 05650f05cbf5..8edc2634eed6 100644 --- a/tests/ui/pattern/issue-72574-2.stderr +++ b/tests/ui/pattern/issue-72574-2.stderr @@ -7,8 +7,9 @@ LL | Binder(_a, _x @ ..) => {} = help: remove this and bind each tuple field independently help: if you don't need to use the contents of _x, discard the tuple's remaining fields | -LL | Binder(_a, ..) => {} - | ~~ +LL - Binder(_a, _x @ ..) => {} +LL + Binder(_a, ..) => {} + | error: `..` patterns are not allowed here --> $DIR/issue-72574-2.rs:6:25 diff --git a/tests/ui/pattern/issue-74539.stderr b/tests/ui/pattern/issue-74539.stderr index 7443946c013f..b6bd084ca4ba 100644 --- a/tests/ui/pattern/issue-74539.stderr +++ b/tests/ui/pattern/issue-74539.stderr @@ -7,8 +7,9 @@ LL | E::A(x @ ..) => { = help: remove this and bind each tuple field independently help: if you don't need to use the contents of x, discard the tuple's remaining fields | -LL | E::A(..) => { - | ~~ +LL - E::A(x @ ..) => { +LL + E::A(..) => { + | error: `..` patterns are not allowed here --> $DIR/issue-74539.rs:8:18 diff --git a/tests/ui/pattern/issue-74702.stderr b/tests/ui/pattern/issue-74702.stderr index f2e2c8f021ba..5bb58de1c6e8 100644 --- a/tests/ui/pattern/issue-74702.stderr +++ b/tests/ui/pattern/issue-74702.stderr @@ -7,8 +7,9 @@ LL | let (foo @ ..,) = (0, 0); = help: remove this and bind each tuple field independently help: if you don't need to use the contents of foo, discard the tuple's remaining fields | -LL | let (..,) = (0, 0); - | ~~ +LL - let (foo @ ..,) = (0, 0); +LL + let (..,) = (0, 0); + | error: `..` patterns are not allowed here --> $DIR/issue-74702.rs:2:16 diff --git a/tests/ui/pattern/issue-80186-mut-binding-help-suggestion.stderr b/tests/ui/pattern/issue-80186-mut-binding-help-suggestion.stderr index 622358126b09..b61f8dbab009 100644 --- a/tests/ui/pattern/issue-80186-mut-binding-help-suggestion.stderr +++ b/tests/ui/pattern/issue-80186-mut-binding-help-suggestion.stderr @@ -7,8 +7,9 @@ LL | let mut &x = &0; = note: `mut` may be followed by `variable` and `variable @ pattern` help: add `mut` to each binding | -LL | let &(mut x) = &0; - | ~~~~~~~~ +LL - let mut &x = &0; +LL + let &(mut x) = &0; + | error: aborting due to 1 previous error diff --git a/tests/ui/pattern/pat-tuple-field-count-cross.stderr b/tests/ui/pattern/pat-tuple-field-count-cross.stderr index 0d7f2e4af69a..c084ec0b532e 100644 --- a/tests/ui/pattern/pat-tuple-field-count-cross.stderr +++ b/tests/ui/pattern/pat-tuple-field-count-cross.stderr @@ -25,12 +25,14 @@ LL | pub struct Z1(); | help: use this syntax instead | -LL | Z0 => {} - | ~~ +LL - Z0() => {} +LL + Z0 => {} + | help: a tuple struct with a similar name exists | -LL | Z1() => {} - | ~~ +LL - Z0() => {} +LL + Z1() => {} + | error[E0532]: expected tuple struct or tuple variant, found unit struct `Z0` --> $DIR/pat-tuple-field-count-cross.rs:10:9 @@ -47,12 +49,14 @@ LL | pub struct Z1(); | help: use this syntax instead | -LL | Z0 => {} - | ~~ +LL - Z0(x) => {} +LL + Z0 => {} + | help: a tuple struct with a similar name exists | -LL | Z1(x) => {} - | ~~ +LL - Z0(x) => {} +LL + Z1(x) => {} + | error[E0532]: expected tuple struct or tuple variant, found unit variant `E1::Z0` --> $DIR/pat-tuple-field-count-cross.rs:31:9 @@ -69,12 +73,14 @@ LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) } | help: use this syntax instead | -LL | E1::Z0 => {} - | ~~~~~~ +LL - E1::Z0() => {} +LL + E1::Z0 => {} + | help: a tuple variant with a similar name exists | -LL | E1::Z1() => {} - | ~~ +LL - E1::Z0() => {} +LL + E1::Z1() => {} + | error[E0532]: expected tuple struct or tuple variant, found unit variant `E1::Z0` --> $DIR/pat-tuple-field-count-cross.rs:32:9 @@ -91,12 +97,14 @@ LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) } | help: use this syntax instead | -LL | E1::Z0 => {} - | ~~~~~~ +LL - E1::Z0(x) => {} +LL + E1::Z0 => {} + | help: a tuple variant with a similar name exists | -LL | E1::Z1(x) => {} - | ~~ +LL - E1::Z0(x) => {} +LL + E1::Z1(x) => {} + | error[E0532]: expected unit struct, unit variant or constant, found tuple variant `E1::Z1` --> $DIR/pat-tuple-field-count-cross.rs:35:9 @@ -113,12 +121,14 @@ LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) } | help: use the tuple variant pattern syntax instead | -LL | E1::Z1() => {} - | ~~~~~~~~ +LL - E1::Z1 => {} +LL + E1::Z1() => {} + | help: a unit variant with a similar name exists | -LL | E1::Z0 => {} - | ~~ +LL - E1::Z1 => {} +LL + E1::Z0 => {} + | error[E0023]: this pattern has 1 field, but the corresponding tuple struct has 0 fields --> $DIR/pat-tuple-field-count-cross.rs:14:12 diff --git a/tests/ui/pattern/pat-tuple-overfield.stderr b/tests/ui/pattern/pat-tuple-overfield.stderr index 54d89e03101d..4e8261cb15b8 100644 --- a/tests/ui/pattern/pat-tuple-overfield.stderr +++ b/tests/ui/pattern/pat-tuple-overfield.stderr @@ -23,12 +23,14 @@ LL | Z0() => {} | help: use this syntax instead | -LL | Z0 => {} - | ~~ +LL - Z0() => {} +LL + Z0 => {} + | help: a tuple struct with a similar name exists | -LL | Z1() => {} - | ~~ +LL - Z0() => {} +LL + Z1() => {} + | error[E0532]: expected tuple struct or tuple variant, found unit struct `Z0` --> $DIR/pat-tuple-overfield.rs:53:9 @@ -43,12 +45,14 @@ LL | Z0(_) => {} | help: use this syntax instead | -LL | Z0 => {} - | ~~ +LL - Z0(_) => {} +LL + Z0 => {} + | help: a tuple struct with a similar name exists | -LL | Z1(_) => {} - | ~~ +LL - Z0(_) => {} +LL + Z1(_) => {} + | error[E0532]: expected tuple struct or tuple variant, found unit struct `Z0` --> $DIR/pat-tuple-overfield.rs:54:9 @@ -63,12 +67,14 @@ LL | Z0(_, _) => {} | help: use this syntax instead | -LL | Z0 => {} - | ~~ +LL - Z0(_, _) => {} +LL + Z0 => {} + | help: a tuple struct with a similar name exists | -LL | Z1(_, _) => {} - | ~~ +LL - Z0(_, _) => {} +LL + Z1(_, _) => {} + | error[E0532]: expected tuple struct or tuple variant, found unit variant `E1::Z0` --> $DIR/pat-tuple-overfield.rs:64:9 @@ -83,12 +89,14 @@ LL | E1::Z0() => {} | help: use this syntax instead | -LL | E1::Z0 => {} - | ~~~~~~ +LL - E1::Z0() => {} +LL + E1::Z0 => {} + | help: a tuple variant with a similar name exists | -LL | E1::Z1() => {} - | ~~ +LL - E1::Z0() => {} +LL + E1::Z1() => {} + | error[E0532]: expected tuple struct or tuple variant, found unit variant `E1::Z0` --> $DIR/pat-tuple-overfield.rs:65:9 @@ -103,12 +111,14 @@ LL | E1::Z0(_) => {} | help: use this syntax instead | -LL | E1::Z0 => {} - | ~~~~~~ +LL - E1::Z0(_) => {} +LL + E1::Z0 => {} + | help: a tuple variant with a similar name exists | -LL | E1::Z1(_) => {} - | ~~ +LL - E1::Z0(_) => {} +LL + E1::Z1(_) => {} + | error[E0532]: expected tuple struct or tuple variant, found unit variant `E1::Z0` --> $DIR/pat-tuple-overfield.rs:66:9 @@ -123,12 +133,14 @@ LL | E1::Z0(_, _) => {} | help: use this syntax instead | -LL | E1::Z0 => {} - | ~~~~~~ +LL - E1::Z0(_, _) => {} +LL + E1::Z0 => {} + | help: a tuple variant with a similar name exists | -LL | E1::Z1(_, _) => {} - | ~~ +LL - E1::Z0(_, _) => {} +LL + E1::Z1(_, _) => {} + | error[E0532]: expected unit struct, unit variant or constant, found tuple variant `E1::Z1` --> $DIR/pat-tuple-overfield.rs:69:9 @@ -143,12 +155,14 @@ LL | E1::Z1 => {} | help: use the tuple variant pattern syntax instead | -LL | E1::Z1() => {} - | ~~~~~~~~ +LL - E1::Z1 => {} +LL + E1::Z1() => {} + | help: a unit variant with a similar name exists | -LL | E1::Z0 => {} - | ~~ +LL - E1::Z1 => {} +LL + E1::Z0 => {} + | error[E0308]: mismatched types --> $DIR/pat-tuple-overfield.rs:19:9 diff --git a/tests/ui/pattern/pat-tuple-underfield.stderr b/tests/ui/pattern/pat-tuple-underfield.stderr index e75f9b38da56..c8620fe85c3c 100644 --- a/tests/ui/pattern/pat-tuple-underfield.stderr +++ b/tests/ui/pattern/pat-tuple-underfield.stderr @@ -36,8 +36,9 @@ LL | S(_, _) => {} | +++ help: use `..` to ignore all fields | -LL | S(..) => {} - | ~~ +LL - S(_) => {} +LL + S(..) => {} + | error[E0023]: this pattern has 0 fields, but the corresponding tuple struct has 2 fields --> $DIR/pat-tuple-underfield.rs:20:9 @@ -104,8 +105,9 @@ LL | E::S(_, _) => {} | +++ help: use `..` to ignore all fields | -LL | E::S(..) => {} - | ~~ +LL - E::S(_) => {} +LL + E::S(..) => {} + | error[E0023]: this pattern has 0 fields, but the corresponding tuple variant has 2 fields --> $DIR/pat-tuple-underfield.rs:44:9 @@ -158,8 +160,9 @@ LL | Point4( a , _ , _, _) => {} | ++++++ help: use `..` to ignore the rest of the fields | -LL | Point4( a, ..) => {} - | ~~~~ +LL - Point4( a , _ ) => {} +LL + Point4( a, ..) => {} + | error: aborting due to 10 previous errors diff --git a/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr b/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr index e9c2fccaba28..a12b94176c07 100644 --- a/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr +++ b/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr @@ -6,8 +6,9 @@ LL | b.make_ascii_uppercase(); | help: consider changing this to be mutable | -LL | let &(mut b) = a; - | ~~~~~ + +LL - let &b = a; +LL + let &(mut b) = a; + | error: aborting due to 1 previous error diff --git a/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr b/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr index e93b8bbacccd..68141af49106 100644 --- a/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr +++ b/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr @@ -6,8 +6,9 @@ LL | mutate(&mut x); | help: consider changing this to be mutable | -LL | fn foo(&(mut x): &i32) { - | ~~~~~ + +LL - fn foo(&x: &i32) { +LL + fn foo(&(mut x): &i32) { + | error: aborting due to 1 previous error diff --git a/tests/ui/pattern/pattern-bad-ref-box-order.stderr b/tests/ui/pattern/pattern-bad-ref-box-order.stderr index a89d3ed21b62..6f47f704688b 100644 --- a/tests/ui/pattern/pattern-bad-ref-box-order.stderr +++ b/tests/ui/pattern/pattern-bad-ref-box-order.stderr @@ -6,8 +6,9 @@ LL | Some(ref box _i) => {}, | help: swap them | -LL | Some(box ref _i) => {}, - | ~~~~~~~ +LL - Some(ref box _i) => {}, +LL + Some(box ref _i) => {}, + | error: aborting due to 1 previous error diff --git a/tests/ui/pattern/pattern-error-continue.stderr b/tests/ui/pattern/pattern-error-continue.stderr index 10fcccb03016..bb5582dd873a 100644 --- a/tests/ui/pattern/pattern-error-continue.stderr +++ b/tests/ui/pattern/pattern-error-continue.stderr @@ -12,12 +12,14 @@ LL | A::D(_) => (), | help: use this syntax instead | -LL | A::D => (), - | ~~~~ +LL - A::D(_) => (), +LL + A::D => (), + | help: a tuple variant with a similar name exists | -LL | A::B(_) => (), - | ~ +LL - A::D(_) => (), +LL + A::B(_) => (), + | error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields --> $DIR/pattern-error-continue.rs:17:14 diff --git a/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr b/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr index 9d642b9245a2..37b2d96bb019 100644 --- a/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr +++ b/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr @@ -6,8 +6,9 @@ LL | [_, ...tail] => println!("{tail}"), | help: use `..=` instead | -LL | [_, ..=tail] => println!("{tail}"), - | ~~~ +LL - [_, ...tail] => println!("{tail}"), +LL + [_, ..=tail] => println!("{tail}"), + | error[E0425]: cannot find value `rest` in this scope --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:3:13 @@ -34,8 +35,9 @@ LL | [_, ..tail] => println!("{tail}"), | help: if you meant to collect the rest of the slice in `tail`, use the at operator | -LL | [_, tail @ ..] => println!("{tail}"), - | ~~~~~~~~~ +LL - [_, ..tail] => println!("{tail}"), +LL + [_, tail @ ..] => println!("{tail}"), + | error[E0425]: cannot find value `tail` in this scope --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:11:35 @@ -51,8 +53,9 @@ LL | [_, ...tail] => println!("{tail}"), | help: if you meant to collect the rest of the slice in `tail`, use the at operator | -LL | [_, tail @ ..] => println!("{tail}"), - | ~~~~~~~~~ +LL - [_, ...tail] => println!("{tail}"), +LL + [_, tail @ ..] => println!("{tail}"), + | error[E0425]: cannot find value `tail` in this scope --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:17:36 diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/feature-gate-ref_pat_eat_one_layer_2024.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/feature-gate-ref_pat_eat_one_layer_2024.stderr index 132fe421a18d..912eeb1c9c04 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/feature-gate-ref_pat_eat_one_layer_2024.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/feature-gate-ref_pat_eat_one_layer_2024.stderr @@ -10,8 +10,9 @@ LL | if let Some(Some(&x)) = &Some(&Some(0)) { found reference `&_` help: consider removing `&` from the pattern | -LL | if let Some(Some(x)) = &Some(&Some(0)) { - | ~ +LL - if let Some(Some(&x)) = &Some(&Some(0)) { +LL + if let Some(Some(x)) = &Some(&Some(0)) { + | error[E0308]: mismatched types --> $DIR/feature-gate-ref_pat_eat_one_layer_2024.rs:10:23 @@ -70,8 +71,9 @@ LL | if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { | ^^^^^^ help: consider removing `&mut` from the pattern | -LL | if let Some(Some(x)) = &mut Some(&mut Some(0)) { - | ~ +LL - if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { +LL + if let Some(Some(x)) = &mut Some(&mut Some(0)) { + | error[E0308]: mismatched types --> $DIR/feature-gate-ref_pat_eat_one_layer_2024.rs:25:22 @@ -85,8 +87,9 @@ LL | if let Some(Some(&x)) = &Some(&Some(0)) { found reference `&_` help: consider removing `&` from the pattern | -LL | if let Some(Some(x)) = &Some(&Some(0)) { - | ~ +LL - if let Some(Some(&x)) = &Some(&Some(0)) { +LL + if let Some(Some(x)) = &Some(&Some(0)) { + | error[E0308]: mismatched types --> $DIR/feature-gate-ref_pat_eat_one_layer_2024.rs:29:27 @@ -100,8 +103,9 @@ LL | if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { found reference `&_` help: consider removing `&` from the pattern | -LL | if let Some(&mut Some(x)) = &Some(&mut Some(0)) { - | ~ +LL - if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { +LL + if let Some(&mut Some(x)) = &Some(&mut Some(0)) { + | error[E0308]: mismatched types --> $DIR/feature-gate-ref_pat_eat_one_layer_2024.rs:33:23 @@ -120,8 +124,9 @@ LL | if let Some(&Some(&mut x)) = &mut Some(&Some(0)) { | ^^^^^^ help: consider removing `&mut` from the pattern | -LL | if let Some(&Some(x)) = &mut Some(&Some(0)) { - | ~ +LL - if let Some(&Some(&mut x)) = &mut Some(&Some(0)) { +LL + if let Some(&Some(x)) = &mut Some(&Some(0)) { + | error: aborting due to 8 previous errors diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.classic2024.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.classic2024.stderr index afaa925a7577..fa95b2b5a575 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.classic2024.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/mut-ref-mut.classic2024.stderr @@ -27,8 +27,9 @@ LL | let [&mut mut x] = &[&mut 0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let [&mut x] = &[&mut 0]; - | ~ +LL - let [&mut mut x] = &[&mut 0]; +LL + let [&mut x] = &[&mut 0]; + | error: aborting due to 3 previous errors diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.classic2024.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.classic2024.stderr index 3a124dcead52..6726a7263153 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.classic2024.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.classic2024.stderr @@ -7,8 +7,9 @@ LL | if let Some(&mut x) = &Some(&mut 0) { = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&x) = &Some(&mut 0) { - | ~ +LL - if let Some(&mut x) = &Some(&mut 0) { +LL + if let Some(&x) = &Some(&mut 0) { + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:18:17 @@ -19,8 +20,9 @@ LL | if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&Some(&x)) = &Some(&mut Some(0)) { - | ~ +LL - if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { +LL + if let Some(&Some(&x)) = &Some(&mut Some(0)) { + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:24:22 @@ -31,8 +33,9 @@ LL | if let Some(Some(&mut x)) = &Some(Some(&mut 0)) { = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(Some(&x)) = &Some(Some(&mut 0)) { - | ~ +LL - if let Some(Some(&mut x)) = &Some(Some(&mut 0)) { +LL + if let Some(Some(&x)) = &Some(Some(&mut 0)) { + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:31:17 @@ -43,8 +46,9 @@ LL | if let Some(&mut Some(&_)) = &Some(&Some(0)) { = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&Some(&_)) = &Some(&Some(0)) { - | ~ +LL - if let Some(&mut Some(&_)) = &Some(&Some(0)) { +LL + if let Some(&Some(&_)) = &Some(&Some(0)) { + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:41:23 @@ -55,8 +59,9 @@ LL | if let Some(&Some(&mut _)) = &mut Some(&Some(0)) { = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&Some(&_)) = &mut Some(&Some(0)) { - | ~ +LL - if let Some(&Some(&mut _)) = &mut Some(&Some(0)) { +LL + if let Some(&Some(&_)) = &mut Some(&Some(0)) { + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:51:17 @@ -67,8 +72,9 @@ LL | if let Some(&mut Some(x)) = &Some(Some(0)) { = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&Some(x)) = &Some(Some(0)) { - | ~ +LL - if let Some(&mut Some(x)) = &Some(Some(0)) { +LL + if let Some(&Some(x)) = &Some(Some(0)) { + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:147:10 @@ -79,8 +85,9 @@ LL | let [&mut x] = &[&mut 0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let [&x] = &[&mut 0]; - | ~ +LL - let [&mut x] = &[&mut 0]; +LL + let [&x] = &[&mut 0]; + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:153:10 @@ -91,8 +98,9 @@ LL | let [&mut &x] = &[&mut 0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let [&&x] = &[&mut 0]; - | ~ +LL - let [&mut &x] = &[&mut 0]; +LL + let [&&x] = &[&mut 0]; + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:159:10 @@ -103,8 +111,9 @@ LL | let [&mut &ref x] = &[&mut 0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let [&&ref x] = &[&mut 0]; - | ~ +LL - let [&mut &ref x] = &[&mut 0]; +LL + let [&&ref x] = &[&mut 0]; + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:165:10 @@ -115,8 +124,9 @@ LL | let [&mut &(mut x)] = &[&mut 0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let [&&(mut x)] = &[&mut 0]; - | ~ +LL - let [&mut &(mut x)] = &[&mut 0]; +LL + let [&&(mut x)] = &[&mut 0]; + | error: aborting due to 10 previous errors diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.stable2021.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.stable2021.stderr index e7eb1813846e..ad19b122c20d 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.stable2021.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.stable2021.stderr @@ -10,8 +10,9 @@ LL | if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { found reference `&_` help: consider removing `&` from the pattern | -LL | if let Some(&mut Some(x)) = &Some(&mut Some(0)) { - | ~ +LL - if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { +LL + if let Some(&mut Some(x)) = &Some(&mut Some(0)) { + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:31:17 diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.structural2024.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.structural2024.stderr index 861ed2216cd9..fdf48a5a71b5 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.structural2024.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/pattern-errors.structural2024.stderr @@ -7,8 +7,9 @@ LL | if let Some(&mut Some(&_)) = &Some(&Some(0)) { = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&Some(&_)) = &Some(&Some(0)) { - | ~ +LL - if let Some(&mut Some(&_)) = &Some(&Some(0)) { +LL + if let Some(&Some(&_)) = &Some(&Some(0)) { + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:36:23 @@ -19,8 +20,9 @@ LL | if let Some(&Some(&mut _)) = &Some(&mut Some(0)) { = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&Some(&_)) = &Some(&mut Some(0)) { - | ~ +LL - if let Some(&Some(&mut _)) = &Some(&mut Some(0)) { +LL + if let Some(&Some(&_)) = &Some(&mut Some(0)) { + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:41:23 @@ -31,8 +33,9 @@ LL | if let Some(&Some(&mut _)) = &mut Some(&Some(0)) { = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&Some(&_)) = &mut Some(&Some(0)) { - | ~ +LL - if let Some(&Some(&mut _)) = &mut Some(&Some(0)) { +LL + if let Some(&Some(&_)) = &mut Some(&Some(0)) { + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:46:28 @@ -43,8 +46,9 @@ LL | if let Some(&Some(Some(&mut _))) = &Some(Some(&mut Some(0))) { = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&Some(Some(&_))) = &Some(Some(&mut Some(0))) { - | ~ +LL - if let Some(&Some(Some(&mut _))) = &Some(Some(&mut Some(0))) { +LL + if let Some(&Some(Some(&_))) = &Some(Some(&mut Some(0))) { + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:51:17 @@ -55,8 +59,9 @@ LL | if let Some(&mut Some(x)) = &Some(Some(0)) { = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | if let Some(&Some(x)) = &Some(Some(0)) { - | ~ +LL - if let Some(&mut Some(x)) = &Some(Some(0)) { +LL + if let Some(&Some(x)) = &Some(Some(0)) { + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:59:11 @@ -67,8 +72,9 @@ LL | let &[&mut x] = &&mut [0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let &[&x] = &&mut [0]; - | ~ +LL - let &[&mut x] = &&mut [0]; +LL + let &[&x] = &&mut [0]; + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:65:11 @@ -79,8 +85,9 @@ LL | let &[&mut x] = &mut &mut [0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let &[&x] = &mut &mut [0]; - | ~ +LL - let &[&mut x] = &mut &mut [0]; +LL + let &[&x] = &mut &mut [0]; + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:71:11 @@ -91,8 +98,9 @@ LL | let &[&mut ref x] = &&mut [0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let &[&ref x] = &&mut [0]; - | ~ +LL - let &[&mut ref x] = &&mut [0]; +LL + let &[&ref x] = &&mut [0]; + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:77:11 @@ -103,8 +111,9 @@ LL | let &[&mut ref x] = &mut &mut [0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let &[&ref x] = &mut &mut [0]; - | ~ +LL - let &[&mut ref x] = &mut &mut [0]; +LL + let &[&ref x] = &mut &mut [0]; + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:83:11 @@ -115,8 +124,9 @@ LL | let &[&mut mut x] = &&mut [0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let &[&mut x] = &&mut [0]; - | ~ +LL - let &[&mut mut x] = &&mut [0]; +LL + let &[&mut x] = &&mut [0]; + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:89:11 @@ -127,8 +137,9 @@ LL | let &[&mut mut x] = &mut &mut [0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let &[&mut x] = &mut &mut [0]; - | ~ +LL - let &[&mut mut x] = &mut &mut [0]; +LL + let &[&mut x] = &mut &mut [0]; + | error[E0658]: binding cannot be both mutable and by-reference --> $DIR/pattern-errors.rs:97:12 @@ -159,8 +170,9 @@ LL | let [&&mut x] = &[&mut 0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let [&&x] = &[&mut 0]; - | ~ +LL - let [&&mut x] = &[&mut 0]; +LL + let [&&x] = &[&mut 0]; + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:115:11 @@ -171,8 +183,9 @@ LL | let [&&mut x] = &mut [&mut 0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let [&&x] = &mut [&mut 0]; - | ~ +LL - let [&&mut x] = &mut [&mut 0]; +LL + let [&&x] = &mut [&mut 0]; + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:121:11 @@ -183,8 +196,9 @@ LL | let [&&mut ref x] = &[&mut 0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let [&&ref x] = &[&mut 0]; - | ~ +LL - let [&&mut ref x] = &[&mut 0]; +LL + let [&&ref x] = &[&mut 0]; + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:127:11 @@ -195,8 +209,9 @@ LL | let [&&mut ref x] = &mut [&mut 0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let [&&ref x] = &mut [&mut 0]; - | ~ +LL - let [&&mut ref x] = &mut [&mut 0]; +LL + let [&&ref x] = &mut [&mut 0]; + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:133:11 @@ -207,8 +222,9 @@ LL | let [&&mut mut x] = &[&mut 0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let [&&mut x] = &[&mut 0]; - | ~ +LL - let [&&mut mut x] = &[&mut 0]; +LL + let [&&mut x] = &[&mut 0]; + | error[E0308]: mismatched types --> $DIR/pattern-errors.rs:139:11 @@ -219,8 +235,9 @@ LL | let [&&mut mut x] = &mut [&mut 0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let [&&mut x] = &mut [&mut 0]; - | ~ +LL - let [&&mut mut x] = &mut [&mut 0]; +LL + let [&&mut x] = &mut [&mut 0]; + | error: aborting due to 19 previous errors diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.classic2024.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.classic2024.stderr index b7fb70dfd246..56125be2d6fc 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.classic2024.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.classic2024.stderr @@ -7,8 +7,9 @@ LL | let [&mut ref x] = &[&mut 0]; = note: cannot match inherited `&` with `&mut` pattern help: replace this `&mut` pattern with `&` | -LL | let [&ref x] = &[&mut 0]; - | ~ +LL - let [&mut ref x] = &[&mut 0]; +LL + let [&ref x] = &[&mut 0]; + | error: binding modifiers may only be written when the default binding mode is `move` --> $DIR/ref-binding-on-inh-ref-errors.rs:67:10 diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref_pat_eat_one_layer_2021_fail.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref_pat_eat_one_layer_2021_fail.stderr index 1a921234ea06..0158ed0f4235 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref_pat_eat_one_layer_2021_fail.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref_pat_eat_one_layer_2021_fail.stderr @@ -10,8 +10,9 @@ LL | if let Some(Some(&x)) = &Some(&Some(0)) { found reference `&_` help: consider removing `&` from the pattern | -LL | if let Some(Some(x)) = &Some(&Some(0)) { - | ~ +LL - if let Some(Some(&x)) = &Some(&Some(0)) { +LL + if let Some(Some(x)) = &Some(&Some(0)) { + | error[E0308]: mismatched types --> $DIR/ref_pat_eat_one_layer_2021_fail.rs:10:23 @@ -70,8 +71,9 @@ LL | if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { | ^^^^^^ help: consider removing `&mut` from the pattern | -LL | if let Some(Some(x)) = &mut Some(&mut Some(0)) { - | ~ +LL - if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { +LL + if let Some(Some(x)) = &mut Some(&mut Some(0)) { + | error[E0308]: mismatched types --> $DIR/ref_pat_eat_one_layer_2021_fail.rs:25:22 @@ -85,8 +87,9 @@ LL | if let Some(Some(&x)) = &Some(&Some(0)) { found reference `&_` help: consider removing `&` from the pattern | -LL | if let Some(Some(x)) = &Some(&Some(0)) { - | ~ +LL - if let Some(Some(&x)) = &Some(&Some(0)) { +LL + if let Some(Some(x)) = &Some(&Some(0)) { + | error[E0308]: mismatched types --> $DIR/ref_pat_eat_one_layer_2021_fail.rs:29:27 @@ -100,8 +103,9 @@ LL | if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { found reference `&_` help: consider removing `&` from the pattern | -LL | if let Some(&mut Some(x)) = &Some(&mut Some(0)) { - | ~ +LL - if let Some(&mut Some(&x)) = &Some(&mut Some(0)) { +LL + if let Some(&mut Some(x)) = &Some(&mut Some(0)) { + | error[E0308]: mismatched types --> $DIR/ref_pat_eat_one_layer_2021_fail.rs:33:23 @@ -120,8 +124,9 @@ LL | if let Some(&Some(&mut x)) = &mut Some(&Some(0)) { | ^^^^^^ help: consider removing `&mut` from the pattern | -LL | if let Some(&Some(x)) = &mut Some(&Some(0)) { - | ~ +LL - if let Some(&Some(&mut x)) = &mut Some(&Some(0)) { +LL + if let Some(&Some(x)) = &mut Some(&Some(0)) { + | error: aborting due to 8 previous errors diff --git a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.stable2021.stderr b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.stable2021.stderr index e9c338de2431..b1a8024397bd 100644 --- a/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.stable2021.stderr +++ b/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/well-typed-edition-2024.stable2021.stderr @@ -26,8 +26,9 @@ LL | if let Some(Some(&x)) = &Some(&Some(0)) { found reference `&_` help: consider removing `&` from the pattern | -LL | if let Some(Some(x)) = &Some(&Some(0)) { - | ~ +LL - if let Some(Some(&x)) = &Some(&Some(0)) { +LL + if let Some(Some(x)) = &Some(&Some(0)) { + | error[E0308]: mismatched types --> $DIR/well-typed-edition-2024.rs:42:17 @@ -57,8 +58,9 @@ LL | if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { | ^^^^^^ help: consider removing `&mut` from the pattern | -LL | if let Some(Some(x)) = &mut Some(&mut Some(0)) { - | ~ +LL - if let Some(Some(&mut x)) = &mut Some(&mut Some(0)) { +LL + if let Some(Some(x)) = &mut Some(&mut Some(0)) { + | error[E0308]: mismatched types --> $DIR/well-typed-edition-2024.rs:54:23 @@ -72,8 +74,9 @@ LL | if let Some(&Some(&x)) = Some(&Some(&mut 0)) { found reference `&_` help: consider removing `&` from the pattern | -LL | if let Some(&Some(x)) = Some(&Some(&mut 0)) { - | ~ +LL - if let Some(&Some(&x)) = Some(&Some(&mut 0)) { +LL + if let Some(&Some(x)) = Some(&Some(&mut 0)) { + | error[E0308]: mismatched types --> $DIR/well-typed-edition-2024.rs:61:23 @@ -87,8 +90,9 @@ LL | if let Some(&Some(&x)) = &Some(&Some(0)) { found reference `&_` help: consider removing `&` from the pattern | -LL | if let Some(&Some(x)) = &Some(&Some(0)) { - | ~ +LL - if let Some(&Some(&x)) = &Some(&Some(0)) { +LL + if let Some(&Some(x)) = &Some(&Some(0)) { + | error[E0308]: mismatched types --> $DIR/well-typed-edition-2024.rs:68:17 @@ -135,8 +139,9 @@ LL | if let Some(&Some(&x)) = &mut Some(&Some(0)) { found reference `&_` help: consider removing `&` from the pattern | -LL | if let Some(&Some(x)) = &mut Some(&Some(0)) { - | ~ +LL - if let Some(&Some(&x)) = &mut Some(&Some(0)) { +LL + if let Some(&Some(x)) = &mut Some(&Some(0)) { + | error[E0308]: mismatched types --> $DIR/well-typed-edition-2024.rs:93:10 diff --git a/tests/ui/pattern/slice-pattern-refutable.stderr b/tests/ui/pattern/slice-pattern-refutable.stderr index 3d9f769d1341..ece5e0283e27 100644 --- a/tests/ui/pattern/slice-pattern-refutable.stderr +++ b/tests/ui/pattern/slice-pattern-refutable.stderr @@ -8,8 +8,9 @@ LL | let [a, b, c] = Zeroes.into() else { | help: try using a fully qualified path to specify the expected types | -LL | let [a, b, c] = >::into(Zeroes) else { - | ++++++++++++++++++++++++++ ~ +LL - let [a, b, c] = Zeroes.into() else { +LL + let [a, b, c] = >::into(Zeroes) else { + | error[E0282]: type annotations needed --> $DIR/slice-pattern-refutable.rs:21:31 @@ -21,8 +22,9 @@ LL | if let [a, b, c] = Zeroes.into() { | help: try using a fully qualified path to specify the expected types | -LL | if let [a, b, c] = >::into(Zeroes) { - | ++++++++++++++++++++++++++ ~ +LL - if let [a, b, c] = Zeroes.into() { +LL + if let [a, b, c] = >::into(Zeroes) { + | error[E0282]: type annotations needed --> $DIR/slice-pattern-refutable.rs:28:31 @@ -34,8 +36,9 @@ LL | if let [a, b, c] = Zeroes.into() { | help: try using a fully qualified path to specify the expected types | -LL | if let [a, b, c] = >::into(Zeroes) { - | ++++++++++++++++++++++++++ ~ +LL - if let [a, b, c] = Zeroes.into() { +LL + if let [a, b, c] = >::into(Zeroes) { + | error: aborting due to 3 previous errors diff --git a/tests/ui/pattern/slice-patterns-ambiguity.stderr b/tests/ui/pattern/slice-patterns-ambiguity.stderr index 690776196ce1..539afed0bc00 100644 --- a/tests/ui/pattern/slice-patterns-ambiguity.stderr +++ b/tests/ui/pattern/slice-patterns-ambiguity.stderr @@ -8,8 +8,9 @@ LL | let &[a, b] = Zeroes.into() else { | help: try using a fully qualified path to specify the expected types | -LL | let &[a, b] = >::into(Zeroes) else { - | +++++++++++++++++++++++++++ ~ +LL - let &[a, b] = Zeroes.into() else { +LL + let &[a, b] = >::into(Zeroes) else { + | error[E0282]: type annotations needed --> $DIR/slice-patterns-ambiguity.rs:32:29 @@ -21,8 +22,9 @@ LL | if let &[a, b] = Zeroes.into() { | help: try using a fully qualified path to specify the expected types | -LL | if let &[a, b] = >::into(Zeroes) { - | +++++++++++++++++++++++++++ ~ +LL - if let &[a, b] = Zeroes.into() { +LL + if let &[a, b] = >::into(Zeroes) { + | error[E0282]: type annotations needed --> $DIR/slice-patterns-ambiguity.rs:39:29 @@ -34,8 +36,9 @@ LL | if let &[a, b] = Zeroes.into() { | help: try using a fully qualified path to specify the expected types | -LL | if let &[a, b] = >::into(Zeroes) { - | +++++++++++++++++++++++++++ ~ +LL - if let &[a, b] = Zeroes.into() { +LL + if let &[a, b] = >::into(Zeroes) { + | error: aborting due to 3 previous errors diff --git a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr index 158eac9a1bd1..2f53ebe6f3f5 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr +++ b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr @@ -17,16 +17,19 @@ LL | let HiddenStruct { one } = HiddenStruct::default(); | help: include the missing field in the pattern and ignore the inaccessible fields | -LL | let HiddenStruct { one, two, .. } = HiddenStruct::default(); - | ~~~~~~~~~~~ +LL - let HiddenStruct { one } = HiddenStruct::default(); +LL + let HiddenStruct { one, two, .. } = HiddenStruct::default(); + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | let HiddenStruct { one, two: _, .. } = HiddenStruct::default(); - | ~~~~~~~~~~~~~~ +LL - let HiddenStruct { one } = HiddenStruct::default(); +LL + let HiddenStruct { one, two: _, .. } = HiddenStruct::default(); + | help: or always ignore missing fields here | -LL | let HiddenStruct { one, .. } = HiddenStruct::default(); - | ~~~~~~ +LL - let HiddenStruct { one } = HiddenStruct::default(); +LL + let HiddenStruct { one, .. } = HiddenStruct::default(); + | error[E0027]: pattern does not mention field `two` --> $DIR/doc-hidden-fields.rs:21:9 @@ -36,16 +39,19 @@ LL | let HiddenStruct { one, hide } = HiddenStruct::default(); | help: include the missing field in the pattern | -LL | let HiddenStruct { one, hide, two } = HiddenStruct::default(); - | ~~~~~~~ +LL - let HiddenStruct { one, hide } = HiddenStruct::default(); +LL + let HiddenStruct { one, hide, two } = HiddenStruct::default(); + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | let HiddenStruct { one, hide, two: _ } = HiddenStruct::default(); - | ~~~~~~~~~~ +LL - let HiddenStruct { one, hide } = HiddenStruct::default(); +LL + let HiddenStruct { one, hide, two: _ } = HiddenStruct::default(); + | help: or always ignore missing fields here | -LL | let HiddenStruct { one, hide, .. } = HiddenStruct::default(); - | ~~~~~~ +LL - let HiddenStruct { one, hide } = HiddenStruct::default(); +LL + let HiddenStruct { one, hide, .. } = HiddenStruct::default(); + | error[E0027]: pattern does not mention field `im_hidden` --> $DIR/doc-hidden-fields.rs:24:9 @@ -55,16 +61,19 @@ LL | let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; | help: include the missing field in the pattern | -LL | let InCrate { a, b, im_hidden } = InCrate { a: 0, b: false, im_hidden: 0 }; - | ~~~~~~~~~~~~~ +LL - let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; +LL + let InCrate { a, b, im_hidden } = InCrate { a: 0, b: false, im_hidden: 0 }; + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | let InCrate { a, b, im_hidden: _ } = InCrate { a: 0, b: false, im_hidden: 0 }; - | ~~~~~~~~~~~~~~~~ +LL - let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; +LL + let InCrate { a, b, im_hidden: _ } = InCrate { a: 0, b: false, im_hidden: 0 }; + | help: or always ignore missing fields here | -LL | let InCrate { a, b, .. } = InCrate { a: 0, b: false, im_hidden: 0 }; - | ~~~~~~ +LL - let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; +LL + let InCrate { a, b, .. } = InCrate { a: 0, b: false, im_hidden: 0 }; + | error: aborting due to 4 previous errors diff --git a/tests/ui/pattern/usefulness/stable-gated-fields.stderr b/tests/ui/pattern/usefulness/stable-gated-fields.stderr index d6e9bac7c136..7b44bc79acff 100644 --- a/tests/ui/pattern/usefulness/stable-gated-fields.stderr +++ b/tests/ui/pattern/usefulness/stable-gated-fields.stderr @@ -6,16 +6,19 @@ LL | let UnstableStruct { stable } = UnstableStruct::default(); | help: include the missing field in the pattern and ignore the inaccessible fields | -LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); - | ~~~~~~~~~~~~~~~ +LL - let UnstableStruct { stable } = UnstableStruct::default(); +LL + let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | let UnstableStruct { stable, stable2: _, .. } = UnstableStruct::default(); - | ~~~~~~~~~~~~~~~~~~ +LL - let UnstableStruct { stable } = UnstableStruct::default(); +LL + let UnstableStruct { stable, stable2: _, .. } = UnstableStruct::default(); + | help: or always ignore missing fields here | -LL | let UnstableStruct { stable, .. } = UnstableStruct::default(); - | ~~~~~~ +LL - let UnstableStruct { stable } = UnstableStruct::default(); +LL + let UnstableStruct { stable, .. } = UnstableStruct::default(); + | error: pattern requires `..` due to inaccessible fields --> $DIR/stable-gated-fields.rs:11:9 diff --git a/tests/ui/pattern/usefulness/unstable-gated-fields.stderr b/tests/ui/pattern/usefulness/unstable-gated-fields.stderr index bb10e439ee23..4487f2735345 100644 --- a/tests/ui/pattern/usefulness/unstable-gated-fields.stderr +++ b/tests/ui/pattern/usefulness/unstable-gated-fields.stderr @@ -6,16 +6,19 @@ LL | let UnstableStruct { stable, stable2, } = UnstableStruct::default(); | help: include the missing field in the pattern | -LL | let UnstableStruct { stable, stable2, unstable } = UnstableStruct::default(); - | ~~~~~~~~~~~~ +LL - let UnstableStruct { stable, stable2, } = UnstableStruct::default(); +LL + let UnstableStruct { stable, stable2, unstable } = UnstableStruct::default(); + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | let UnstableStruct { stable, stable2, unstable: _ } = UnstableStruct::default(); - | ~~~~~~~~~~~~~~~ +LL - let UnstableStruct { stable, stable2, } = UnstableStruct::default(); +LL + let UnstableStruct { stable, stable2, unstable: _ } = UnstableStruct::default(); + | help: or always ignore missing fields here | -LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); - | ~~~~~~ +LL - let UnstableStruct { stable, stable2, } = UnstableStruct::default(); +LL + let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); + | error[E0027]: pattern does not mention field `stable2` --> $DIR/unstable-gated-fields.rs:13:9 @@ -25,16 +28,19 @@ LL | let UnstableStruct { stable, unstable, } = UnstableStruct::default(); | help: include the missing field in the pattern | -LL | let UnstableStruct { stable, unstable, stable2 } = UnstableStruct::default(); - | ~~~~~~~~~~~ +LL - let UnstableStruct { stable, unstable, } = UnstableStruct::default(); +LL + let UnstableStruct { stable, unstable, stable2 } = UnstableStruct::default(); + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | let UnstableStruct { stable, unstable, stable2: _ } = UnstableStruct::default(); - | ~~~~~~~~~~~~~~ +LL - let UnstableStruct { stable, unstable, } = UnstableStruct::default(); +LL + let UnstableStruct { stable, unstable, stable2: _ } = UnstableStruct::default(); + | help: or always ignore missing fields here | -LL | let UnstableStruct { stable, unstable, .. } = UnstableStruct::default(); - | ~~~~~~ +LL - let UnstableStruct { stable, unstable, } = UnstableStruct::default(); +LL + let UnstableStruct { stable, unstable, .. } = UnstableStruct::default(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/pptypedef.stderr b/tests/ui/pptypedef.stderr index 08b90b365e32..96327cfcc653 100644 --- a/tests/ui/pptypedef.stderr +++ b/tests/ui/pptypedef.stderr @@ -8,8 +8,9 @@ LL | let_in(3u32, |i| { assert!(i == 3i32); }); | help: change the type of the numeric literal from `i32` to `u32` | -LL | let_in(3u32, |i| { assert!(i == 3u32); }); - | ~~~ +LL - let_in(3u32, |i| { assert!(i == 3i32); }); +LL + let_in(3u32, |i| { assert!(i == 3u32); }); + | error[E0308]: mismatched types --> $DIR/pptypedef.rs:8:37 @@ -21,8 +22,9 @@ LL | let_in(3i32, |i| { assert!(i == 3u32); }); | help: change the type of the numeric literal from `u32` to `i32` | -LL | let_in(3i32, |i| { assert!(i == 3i32); }); - | ~~~ +LL - let_in(3i32, |i| { assert!(i == 3u32); }); +LL + let_in(3i32, |i| { assert!(i == 3i32); }); + | error: aborting due to 2 previous errors diff --git a/tests/ui/privacy/issue-75907.stderr b/tests/ui/privacy/issue-75907.stderr index 3121cc04478a..8a6484979c00 100644 --- a/tests/ui/privacy/issue-75907.stderr +++ b/tests/ui/privacy/issue-75907.stderr @@ -13,8 +13,9 @@ LL | let Bar(x, y, Foo(z)) = make_bar(); | private field help: consider making the fields publicly accessible | -LL | pub(crate) struct Bar(pub u8, pub u8, pub Foo); - | ~~~ +++ +LL - pub(crate) struct Bar(pub u8, pub(in crate::foo) u8, Foo); +LL + pub(crate) struct Bar(pub u8, pub u8, pub Foo); + | error[E0532]: cannot match against a tuple struct which contains private fields --> $DIR/issue-75907.rs:15:19 diff --git a/tests/ui/privacy/privacy-in-paths.stderr b/tests/ui/privacy/privacy-in-paths.stderr index 9c3d5e97c62a..e6ece35865d4 100644 --- a/tests/ui/privacy/privacy-in-paths.stderr +++ b/tests/ui/privacy/privacy-in-paths.stderr @@ -25,8 +25,9 @@ LL | mod bar { | ^^^^^^^ help: consider importing this struct through its public re-export instead | -LL | foo::S::f(); - | ~~~~~~ +LL - ::foo::bar::S::f(); +LL + foo::S::f(); + | error[E0603]: trait `T` is private --> $DIR/privacy-in-paths.rs:26:23 diff --git a/tests/ui/privacy/privacy-ns1.stderr b/tests/ui/privacy/privacy-ns1.stderr index 9710cc48637b..3396330c993c 100644 --- a/tests/ui/privacy/privacy-ns1.stderr +++ b/tests/ui/privacy/privacy-ns1.stderr @@ -9,8 +9,9 @@ LL | Bar(); | help: a unit struct with a similar name exists | -LL | Baz(); - | ~~~ +LL - Bar(); +LL + Baz(); + | help: consider importing this function instead | LL + use foo2::Bar; @@ -27,8 +28,9 @@ LL | Bar(); | help: a unit struct with a similar name exists | -LL | Baz(); - | ~~~ +LL - Bar(); +LL + Baz(); + | help: consider importing this function | LL + use foo2::Bar; @@ -45,8 +47,9 @@ LL | let _x: Box; | help: a struct with a similar name exists | -LL | let _x: Box; - | ~~~ +LL - let _x: Box; +LL + let _x: Box; + | help: consider importing this trait | LL + use foo1::Bar; diff --git a/tests/ui/privacy/privacy-ns2.stderr b/tests/ui/privacy/privacy-ns2.stderr index 75e735e1e6a2..ac98682b2b39 100644 --- a/tests/ui/privacy/privacy-ns2.stderr +++ b/tests/ui/privacy/privacy-ns2.stderr @@ -20,8 +20,9 @@ LL | Bar(); | help: a unit struct with a similar name exists | -LL | Baz(); - | ~~~ +LL - Bar(); +LL + Baz(); + | help: consider importing this function instead | LL + use foo2::Bar; @@ -35,8 +36,9 @@ LL | let _x : Bar(); | help: use `=` if you meant to assign | -LL | let _x = Bar(); - | ~ +LL - let _x : Bar(); +LL + let _x = Bar(); + | help: consider importing this trait instead | LL + use foo1::Bar; diff --git a/tests/ui/privacy/privacy1.stderr b/tests/ui/privacy/privacy1.stderr index a3552e146a65..cb7b858e54dc 100644 --- a/tests/ui/privacy/privacy1.stderr +++ b/tests/ui/privacy/privacy1.stderr @@ -142,8 +142,9 @@ LL | mod baz { | ^^^^^^^ help: consider importing this function through its public re-export instead | -LL | bar::foo(); - | ~~~~~~~~ +LL - ::bar::baz::foo(); +LL + bar::foo(); + | error[E0603]: module `baz` is private --> $DIR/privacy1.rs:128:16 @@ -158,8 +159,9 @@ LL | mod baz { | ^^^^^^^ help: consider importing this function through its public re-export instead | -LL | bar::bar(); - | ~~~~~~~~ +LL - ::bar::baz::bar(); +LL + bar::bar(); + | error[E0603]: trait `B` is private --> $DIR/privacy1.rs:157:17 diff --git a/tests/ui/privacy/privacy5.stderr b/tests/ui/privacy/privacy5.stderr index ec3abe9b8162..8f28f629ba3b 100644 --- a/tests/ui/privacy/privacy5.stderr +++ b/tests/ui/privacy/privacy5.stderr @@ -52,8 +52,9 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL | pub struct C(pub isize, pub isize); - | +++ +LL - pub struct C(pub isize, isize); +LL + pub struct C(pub isize, pub isize); + | error[E0603]: tuple struct constructor `A` is private --> $DIR/privacy5.rs:56:12 @@ -261,8 +262,9 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL | pub struct C(pub isize, pub isize); - | +++ +LL - pub struct C(pub isize, isize); +LL + pub struct C(pub isize, pub isize); + | error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:69:12 @@ -280,8 +282,9 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL | pub struct C(pub isize, pub isize); - | +++ +LL - pub struct C(pub isize, isize); +LL + pub struct C(pub isize, pub isize); + | error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:70:12 @@ -299,8 +302,9 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL | pub struct C(pub isize, pub isize); - | +++ +LL - pub struct C(pub isize, isize); +LL + pub struct C(pub isize, pub isize); + | error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:71:12 @@ -318,8 +322,9 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL | pub struct C(pub isize, pub isize); - | +++ +LL - pub struct C(pub isize, isize); +LL + pub struct C(pub isize, pub isize); + | error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:72:18 @@ -337,8 +342,9 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL | pub struct C(pub isize, pub isize); - | +++ +LL - pub struct C(pub isize, isize); +LL + pub struct C(pub isize, pub isize); + | error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:73:18 @@ -356,8 +362,9 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL | pub struct C(pub isize, pub isize); - | +++ +LL - pub struct C(pub isize, isize); +LL + pub struct C(pub isize, pub isize); + | error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:74:18 @@ -375,8 +382,9 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL | pub struct C(pub isize, pub isize); - | +++ +LL - pub struct C(pub isize, isize); +LL + pub struct C(pub isize, pub isize); + | error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:75:18 @@ -394,8 +402,9 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL | pub struct C(pub isize, pub isize); - | +++ +LL - pub struct C(pub isize, isize); +LL + pub struct C(pub isize, pub isize); + | error[E0603]: tuple struct constructor `A` is private --> $DIR/privacy5.rs:83:17 @@ -451,8 +460,9 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL | pub struct C(pub isize, pub isize); - | +++ +LL - pub struct C(pub isize, isize); +LL + pub struct C(pub isize, pub isize); + | error[E0603]: tuple struct constructor `A` is private --> $DIR/privacy5.rs:90:20 diff --git a/tests/ui/privacy/sealed-traits/re-exported-trait.stderr b/tests/ui/privacy/sealed-traits/re-exported-trait.stderr index 6e2f36e3f381..368389af0b92 100644 --- a/tests/ui/privacy/sealed-traits/re-exported-trait.stderr +++ b/tests/ui/privacy/sealed-traits/re-exported-trait.stderr @@ -11,8 +11,9 @@ LL | mod b { | ^^^^^ help: consider importing this trait through its public re-export instead | -LL | impl a::Trait for S {} - | ~~~~~~~~ +LL - impl a::b::Trait for S {} +LL + impl a::Trait for S {} + | error: aborting due to 1 previous error diff --git a/tests/ui/privacy/suggest-box-new.stderr b/tests/ui/privacy/suggest-box-new.stderr index 1e28b9fbd86b..da8405fd0e85 100644 --- a/tests/ui/privacy/suggest-box-new.stderr +++ b/tests/ui/privacy/suggest-box-new.stderr @@ -9,18 +9,23 @@ LL | let _ = std::collections::HashMap(); | help: you might have meant to use an associated function to build this type | -LL | let _ = std::collections::HashMap::new(); - | ~~~~~~~ -LL | let _ = std::collections::HashMap::with_capacity(_); - | ~~~~~~~~~~~~~~~~~~ -LL | let _ = std::collections::HashMap::with_hasher(_); - | ~~~~~~~~~~~~~~~~ -LL | let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _ = std::collections::HashMap(); +LL + let _ = std::collections::HashMap::new(); + | +LL - let _ = std::collections::HashMap(); +LL + let _ = std::collections::HashMap::with_capacity(_); + | +LL - let _ = std::collections::HashMap(); +LL + let _ = std::collections::HashMap::with_hasher(_); + | +LL - let _ = std::collections::HashMap(); +LL + let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); + | help: consider using the `Default` trait | -LL | let _ = ::default(); - | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _ = std::collections::HashMap(); +LL + let _ = ::default(); + | error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/suggest-box-new.rs:8:19 @@ -36,19 +41,36 @@ note: constructor is not visible here due to private fields = note: private field help: you might have meant to use an associated function to build this type | -LL | wtf: Some(Box::new(_)), - | ~~~~~~~~ -LL | wtf: Some(Box::new_uninit()), - | ~~~~~~~~~~~~~~ -LL | wtf: Some(Box::new_zeroed()), - | ~~~~~~~~~~~~~~ -LL | wtf: Some(Box::new_in(_, _)), - | ~~~~~~~~~~~~~~ +LL - wtf: Some(Box(U { +LL - wtf: None, +LL - x: (), +LL - })), +LL + wtf: Some(Box::new(_)), + | +LL - wtf: Some(Box(U { +LL - wtf: None, +LL - x: (), +LL - })), +LL + wtf: Some(Box::new_uninit()), + | +LL - wtf: Some(Box(U { +LL - wtf: None, +LL - x: (), +LL - })), +LL + wtf: Some(Box::new_zeroed()), + | +LL - wtf: Some(Box(U { +LL - wtf: None, +LL - x: (), +LL - })), +LL + wtf: Some(Box::new_in(_, _)), + | and 12 other candidates help: consider using the `Default` trait | -LL | wtf: Some(::default()), - | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - wtf: Some(Box(U { +LL + wtf: Some(::default()), + | error: cannot construct `HashMap<_, _, _>` with struct literal syntax due to private fields --> $DIR/suggest-box-new.rs:16:13 @@ -59,18 +81,23 @@ LL | let _ = std::collections::HashMap {}; = note: private field `base` that was not provided help: you might have meant to use an associated function to build this type | -LL | let _ = std::collections::HashMap::new(); - | ~~~~~~~ -LL | let _ = std::collections::HashMap::with_capacity(_); - | ~~~~~~~~~~~~~~~~~~ -LL | let _ = std::collections::HashMap::with_hasher(_); - | ~~~~~~~~~~~~~~~~ -LL | let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _ = std::collections::HashMap {}; +LL + let _ = std::collections::HashMap::new(); + | +LL - let _ = std::collections::HashMap {}; +LL + let _ = std::collections::HashMap::with_capacity(_); + | +LL - let _ = std::collections::HashMap {}; +LL + let _ = std::collections::HashMap::with_hasher(_); + | +LL - let _ = std::collections::HashMap {}; +LL + let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); + | help: consider using the `Default` trait | -LL | let _ = ::default(); - | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _ = std::collections::HashMap {}; +LL + let _ = ::default(); + | error: cannot construct `Box<_, _>` with struct literal syntax due to private fields --> $DIR/suggest-box-new.rs:18:13 @@ -81,19 +108,24 @@ LL | let _ = Box {}; = note: private fields `0` and `1` that were not provided help: you might have meant to use an associated function to build this type | -LL | let _ = Box::new(_); - | ~~~~~~~~ -LL | let _ = Box::new_uninit(); - | ~~~~~~~~~~~~~~ -LL | let _ = Box::new_zeroed(); - | ~~~~~~~~~~~~~~ -LL | let _ = Box::new_in(_, _); - | ~~~~~~~~~~~~~~ +LL - let _ = Box {}; +LL + let _ = Box::new(_); + | +LL - let _ = Box {}; +LL + let _ = Box::new_uninit(); + | +LL - let _ = Box {}; +LL + let _ = Box::new_zeroed(); + | +LL - let _ = Box {}; +LL + let _ = Box::new_in(_, _); + | and 12 other candidates help: consider using the `Default` trait | -LL | let _ = ::default(); - | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _ = Box {}; +LL + let _ = ::default(); + | error: aborting due to 4 previous errors diff --git a/tests/ui/privacy/suggest-making-field-public.stderr b/tests/ui/privacy/suggest-making-field-public.stderr index e92e9aae310e..3e52232dd59b 100644 --- a/tests/ui/privacy/suggest-making-field-public.stderr +++ b/tests/ui/privacy/suggest-making-field-public.stderr @@ -14,8 +14,9 @@ LL | pub struct A(pub(self)String); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the field publicly accessible | -LL | pub struct A(pub String); - | ~~~ +LL - pub struct A(pub(self)String); +LL + pub struct A(pub String); + | error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/suggest-making-field-public.rs:9:9 @@ -30,8 +31,9 @@ LL | pub struct A(pub(self)String); | ^^^^^^^^^^^^^^^ private field help: consider making the field publicly accessible | -LL | pub struct A(pub String); - | ~~~ +LL - pub struct A(pub(self)String); +LL + pub struct A(pub String); + | error: aborting due to 2 previous errors diff --git a/tests/ui/privacy/sysroot-private.default.stderr b/tests/ui/privacy/sysroot-private.default.stderr index fef88d107e63..692b1bbd4db3 100644 --- a/tests/ui/privacy/sysroot-private.default.stderr +++ b/tests/ui/privacy/sysroot-private.default.stderr @@ -14,8 +14,9 @@ LL | fn trait_member(val: &T, key: &K) -> bool { | help: a type parameter with a similar name exists | -LL | fn trait_member(val: &T, key: &T) -> bool { - | ~ +LL - fn trait_member(val: &T, key: &K) -> bool { +LL + fn trait_member(val: &T, key: &T) -> bool { + | help: you might be missing a type parameter | LL | fn trait_member(val: &T, key: &K) -> bool { diff --git a/tests/ui/privacy/sysroot-private.rustc_private_enabled.stderr b/tests/ui/privacy/sysroot-private.rustc_private_enabled.stderr index 4b54b59714aa..dc2d890a082c 100644 --- a/tests/ui/privacy/sysroot-private.rustc_private_enabled.stderr +++ b/tests/ui/privacy/sysroot-private.rustc_private_enabled.stderr @@ -14,8 +14,9 @@ LL | fn trait_member(val: &T, key: &K) -> bool { | help: a type parameter with a similar name exists | -LL | fn trait_member(val: &T, key: &T) -> bool { - | ~ +LL - fn trait_member(val: &T, key: &K) -> bool { +LL + fn trait_member(val: &T, key: &T) -> bool { + | help: you might be missing a type parameter | LL | fn trait_member(val: &T, key: &K) -> bool { diff --git a/tests/ui/proc-macro/disappearing-resolution.stderr b/tests/ui/proc-macro/disappearing-resolution.stderr index e66f721444fc..734e0cd2ab6d 100644 --- a/tests/ui/proc-macro/disappearing-resolution.stderr +++ b/tests/ui/proc-macro/disappearing-resolution.stderr @@ -22,8 +22,9 @@ LL | pub fn empty_derive(_: TokenStream) -> TokenStream { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ you could import this directly help: import `Empty` directly | -LL | use test_macros::Empty; - | ~~~~~~~~~~~~~~~~~~ +LL - use m::Empty; +LL + use test_macros::Empty; + | error: aborting due to 2 previous errors diff --git a/tests/ui/proc-macro/issue-66286.stderr b/tests/ui/proc-macro/issue-66286.stderr index c92bed1b5634..fe6bec221644 100644 --- a/tests/ui/proc-macro/issue-66286.stderr +++ b/tests/ui/proc-macro/issue-66286.stderr @@ -6,8 +6,9 @@ LL | pub extern "C" fn foo(_: Vec(u32)) -> u32 { | help: use angle brackets instead | -LL | pub extern "C" fn foo(_: Vec) -> u32 { - | ~ ~ +LL - pub extern "C" fn foo(_: Vec(u32)) -> u32 { +LL + pub extern "C" fn foo(_: Vec) -> u32 { + | error: aborting due to 1 previous error diff --git a/tests/ui/proc-macro/issue-86781-bad-inner-doc.stderr b/tests/ui/proc-macro/issue-86781-bad-inner-doc.stderr index aeb824303e71..835648ab435e 100644 --- a/tests/ui/proc-macro/issue-86781-bad-inner-doc.stderr +++ b/tests/ui/proc-macro/issue-86781-bad-inner-doc.stderr @@ -9,8 +9,9 @@ LL | pub struct Foo; | help: to annotate the struct, change the doc comment from inner to outer style | -LL | /// Inner doc comment - | ~ +LL - //! Inner doc comment +LL + /// Inner doc comment + | error: aborting due to 1 previous error diff --git a/tests/ui/pub/pub-ident-fn-or-struct.stderr b/tests/ui/pub/pub-ident-fn-or-struct.stderr index ceadc510c63e..1bdb547be1e5 100644 --- a/tests/ui/pub/pub-ident-fn-or-struct.stderr +++ b/tests/ui/pub/pub-ident-fn-or-struct.stderr @@ -6,8 +6,9 @@ LL | pub S (foo) bar | help: if you meant to call a macro, try | -LL | pub S! (foo) bar - | ~~ +LL - pub S (foo) bar +LL + pub S! (foo) bar + | error: aborting due to 1 previous error diff --git a/tests/ui/pub/pub-restricted.stderr b/tests/ui/pub/pub-restricted.stderr index fc177aa2033e..35c48c6d7692 100644 --- a/tests/ui/pub/pub-restricted.stderr +++ b/tests/ui/pub/pub-restricted.stderr @@ -10,8 +10,9 @@ LL | pub (a) fn afn() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `a` with `in` | -LL | pub (in a) fn afn() {} - | ~~~~ +LL - pub (a) fn afn() {} +LL + pub (in a) fn afn() {} + | error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:4:6 @@ -25,8 +26,9 @@ LL | pub (b) fn bfn() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `b` with `in` | -LL | pub (in b) fn bfn() {} - | ~~~~ +LL - pub (b) fn bfn() {} +LL + pub (in b) fn bfn() {} + | error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:5:6 @@ -40,8 +42,9 @@ LL | pub (crate::a) fn cfn() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `crate::a` with `in` | -LL | pub (in crate::a) fn cfn() {} - | ~~~~~~~~~~~ +LL - pub (crate::a) fn cfn() {} +LL + pub (in crate::a) fn cfn() {} + | error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:22:14 @@ -55,8 +58,9 @@ LL | pub (a) invalid: usize, `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `a` with `in` | -LL | pub (in a) invalid: usize, - | ~~~~ +LL - pub (a) invalid: usize, +LL + pub (in a) invalid: usize, + | error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:31:6 @@ -70,8 +74,9 @@ LL | pub (xyz) fn xyz() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `xyz` with `in` | -LL | pub (in xyz) fn xyz() {} - | ~~~~~~ +LL - pub (xyz) fn xyz() {} +LL + pub (in xyz) fn xyz() {} + | error[E0742]: visibilities can only be restricted to ancestor modules --> $DIR/pub-restricted.rs:23:17 diff --git a/tests/ui/qualified/qualified-path-params-2.stderr b/tests/ui/qualified/qualified-path-params-2.stderr index 56644bdd46a8..6641e81013f0 100644 --- a/tests/ui/qualified/qualified-path-params-2.stderr +++ b/tests/ui/qualified/qualified-path-params-2.stderr @@ -6,8 +6,9 @@ LL | type A = ::A::f; | help: if there were a trait named `Example` with associated type `f` implemented for `::A`, you could use the fully-qualified path | -LL | type A = <::A as Example>::f; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - type A = ::A::f; +LL + type A = <::A as Example>::f; + | error: aborting due to 1 previous error diff --git a/tests/ui/regions/region-object-lifetime-in-coercion.stderr b/tests/ui/regions/region-object-lifetime-in-coercion.stderr index b5bb08c73c89..3880ae822837 100644 --- a/tests/ui/regions/region-object-lifetime-in-coercion.stderr +++ b/tests/ui/regions/region-object-lifetime-in-coercion.stderr @@ -8,12 +8,14 @@ LL | let x: Box = Box::new(v); | help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v` | -LL | fn a(v: &[u8]) -> Box { - | ~~ +LL - fn a(v: &[u8]) -> Box { +LL + fn a(v: &[u8]) -> Box { + | help: alternatively, add an explicit `'static` bound to this reference | -LL | fn a(v: &'static [u8]) -> Box { - | ~~~~~~~~~~~~~ +LL - fn a(v: &[u8]) -> Box { +LL + fn a(v: &'static [u8]) -> Box { + | error: lifetime may not live long enough --> $DIR/region-object-lifetime-in-coercion.rs:14:5 @@ -25,12 +27,14 @@ LL | Box::new(v) | help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v` | -LL | fn b(v: &[u8]) -> Box { - | ~~ +LL - fn b(v: &[u8]) -> Box { +LL + fn b(v: &[u8]) -> Box { + | help: alternatively, add an explicit `'static` bound to this reference | -LL | fn b(v: &'static [u8]) -> Box { - | ~~~~~~~~~~~~~ +LL - fn b(v: &[u8]) -> Box { +LL + fn b(v: &'static [u8]) -> Box { + | error: lifetime may not live long enough --> $DIR/region-object-lifetime-in-coercion.rs:21:5 diff --git a/tests/ui/regions/regions-close-object-into-object-2.stderr b/tests/ui/regions/regions-close-object-into-object-2.stderr index aacb5ea4e87b..54364ef0821a 100644 --- a/tests/ui/regions/regions-close-object-into-object-2.stderr +++ b/tests/ui/regions/regions-close-object-into-object-2.stderr @@ -8,12 +8,14 @@ LL | Box::new(B(&*v)) as Box | help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v` | -LL | fn g<'a, T: 'static>(v: Box + 'a>) -> Box { - | ~~ +LL - fn g<'a, T: 'static>(v: Box + 'a>) -> Box { +LL + fn g<'a, T: 'static>(v: Box + 'a>) -> Box { + | help: alternatively, add an explicit `'static` bound to this reference | -LL | fn g<'a, T: 'static>(v: Box<(dyn A + 'static)>) -> Box { - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn g<'a, T: 'static>(v: Box + 'a>) -> Box { +LL + fn g<'a, T: 'static>(v: Box<(dyn A + 'static)>) -> Box { + | error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-2.rs:9:5 diff --git a/tests/ui/regions/regions-close-object-into-object-4.stderr b/tests/ui/regions/regions-close-object-into-object-4.stderr index f6a79be09477..d119ec57e988 100644 --- a/tests/ui/regions/regions-close-object-into-object-4.stderr +++ b/tests/ui/regions/regions-close-object-into-object-4.stderr @@ -50,12 +50,14 @@ LL | Box::new(B(&*v)) as Box | help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v` | -LL | fn i<'a, T, U>(v: Box+'a>) -> Box { - | ~~ +LL - fn i<'a, T, U>(v: Box+'a>) -> Box { +LL + fn i<'a, T, U>(v: Box+'a>) -> Box { + | help: alternatively, add an explicit `'static` bound to this reference | -LL | fn i<'a, T, U>(v: Box<(dyn A + 'static)>) -> Box { - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn i<'a, T, U>(v: Box+'a>) -> Box { +LL + fn i<'a, T, U>(v: Box<(dyn A + 'static)>) -> Box { + | error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-4.rs:9:5 diff --git a/tests/ui/regions/regions-proc-bound-capture.stderr b/tests/ui/regions/regions-proc-bound-capture.stderr index 3fe497bf2e99..3149cd8c9a1b 100644 --- a/tests/ui/regions/regions-proc-bound-capture.stderr +++ b/tests/ui/regions/regions-proc-bound-capture.stderr @@ -9,12 +9,14 @@ LL | Box::new(move || { *x }) | help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `x` | -LL | fn static_proc(x: &isize) -> Box (isize) + '_> { - | ~~ +LL - fn static_proc(x: &isize) -> Box (isize) + 'static> { +LL + fn static_proc(x: &isize) -> Box (isize) + '_> { + | help: alternatively, add an explicit `'static` bound to this reference | -LL | fn static_proc(x: &'static isize) -> Box (isize) + 'static> { - | ~~~~~~~~~~~~~~ +LL - fn static_proc(x: &isize) -> Box (isize) + 'static> { +LL + fn static_proc(x: &'static isize) -> Box (isize) + 'static> { + | error: aborting due to 1 previous error diff --git a/tests/ui/repeat-expr/repeat_count.stderr b/tests/ui/repeat-expr/repeat_count.stderr index c4aebfb0e20d..34e29e836667 100644 --- a/tests/ui/repeat-expr/repeat_count.stderr +++ b/tests/ui/repeat-expr/repeat_count.stderr @@ -6,8 +6,9 @@ LL | let a = [0; n]; | help: consider using `const` instead of `let` | -LL | const n: /* Type */ = 1; - | ~~~~~ ++++++++++++ +LL - let n = 1; +LL + const n: /* Type */ = 1; + | error[E0308]: mismatched types --> $DIR/repeat_count.rs:7:17 @@ -63,8 +64,9 @@ LL | let f = [0; 4u8]; | help: change the type of the numeric literal from `u8` to `usize` | -LL | let f = [0; 4usize]; - | ~~~~~ +LL - let f = [0; 4u8]; +LL + let f = [0; 4usize]; + | error: aborting due to 9 previous errors diff --git a/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.stderr b/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.stderr index 95eddbde9e67..ce2022374f7f 100644 --- a/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.stderr +++ b/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.stderr @@ -6,8 +6,9 @@ LL | let a = ["a", 10]; | help: replace the comma with a semicolon to create an array | -LL | let a = ["a"; 10]; - | ~ +LL - let a = ["a", 10]; +LL + let a = ["a"; 10]; + | error[E0308]: mismatched types --> $DIR/typo-in-repeat-expr-issue-80173.rs:20:20 @@ -17,8 +18,9 @@ LL | let b = [Type, size_b]; | help: replace the comma with a semicolon to create an array | -LL | let b = [Type; size_b]; - | ~ +LL - let b = [Type, size_b]; +LL + let b = [Type; size_b]; + | error[E0308]: mismatched types --> $DIR/typo-in-repeat-expr-issue-80173.rs:25:20 @@ -48,8 +50,9 @@ LL | let f = ["f", get_size()]; | help: replace the comma with a semicolon to create an array | -LL | let f = ["f"; get_size()]; - | ~ +LL - let f = ["f", get_size()]; +LL + let f = ["f"; get_size()]; + | error[E0308]: mismatched types --> $DIR/typo-in-repeat-expr-issue-80173.rs:40:19 @@ -65,8 +68,9 @@ LL | let g = vec![String::new(), 10]; | help: replace the comma with a semicolon to create a vector | -LL | let g = vec![String::new(); 10]; - | ~ +LL - let g = vec![String::new(), 10]; +LL + let g = vec![String::new(); 10]; + | error[E0308]: mismatched types --> $DIR/typo-in-repeat-expr-issue-80173.rs:49:24 @@ -76,8 +80,9 @@ LL | let h = vec![Type, dyn_size]; | help: replace the comma with a semicolon to create a vector | -LL | let h = vec![Type; dyn_size]; - | ~ +LL - let h = vec![Type, dyn_size]; +LL + let h = vec![Type; dyn_size]; + | error[E0308]: mismatched types --> $DIR/typo-in-repeat-expr-issue-80173.rs:53:24 @@ -87,8 +92,9 @@ LL | let i = vec![Type, get_dyn_size()]; | help: replace the comma with a semicolon to create a vector | -LL | let i = vec![Type; get_dyn_size()]; - | ~ +LL - let i = vec![Type, get_dyn_size()]; +LL + let i = vec![Type; get_dyn_size()]; + | error[E0308]: mismatched types --> $DIR/typo-in-repeat-expr-issue-80173.rs:57:23 @@ -98,8 +104,9 @@ LL | let k = vec!['c', 10]; | help: replace the comma with a semicolon to create a vector | -LL | let k = vec!['c'; 10]; - | ~ +LL - let k = vec!['c', 10]; +LL + let k = vec!['c'; 10]; + | error[E0308]: mismatched types --> $DIR/typo-in-repeat-expr-issue-80173.rs:61:24 diff --git a/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr b/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr index a0cdac3fa253..f142f91064fa 100644 --- a/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr +++ b/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr @@ -28,8 +28,9 @@ LL | _ => {} | help: you might have meant to pattern match against the value of similarly named constant `god` instead of introducing a new catch-all binding | -LL | god => {} - | ~~~ +LL - GOD => {} +LL + god => {} + | error: unreachable pattern --> $DIR/const-with-typo-in-pattern-binding.rs:30:9 @@ -42,8 +43,9 @@ LL | _ => {} | help: you might have meant to pattern match against the value of similarly named constant `GOOD` instead of introducing a new catch-all binding | -LL | GOOD => {} - | ~~~~ +LL - GOOOD => {} +LL + GOOD => {} + | error: unreachable pattern --> $DIR/const-with-typo-in-pattern-binding.rs:36:9 @@ -71,8 +73,9 @@ LL | _ => {} | help: you might have meant to pattern match against the value of constant `ARCH` instead of introducing a new catch-all binding | -LL | std::env::consts::ARCH => {} - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - ARCH => {} +LL + std::env::consts::ARCH => {} + | error: aborting due to 5 previous errors diff --git a/tests/ui/resolve/issue-100365.stderr b/tests/ui/resolve/issue-100365.stderr index 2d9bab4304d4..7a880c6f31ac 100644 --- a/tests/ui/resolve/issue-100365.stderr +++ b/tests/ui/resolve/issue-100365.stderr @@ -6,8 +6,9 @@ LL | let addr = Into::.into([127, 0, 0, 1]); | help: use the path separator to refer to an item | -LL | let addr = Into::::into([127, 0, 0, 1]); - | ~~ +LL - let addr = Into::.into([127, 0, 0, 1]); +LL + let addr = Into::::into([127, 0, 0, 1]); + | error[E0423]: expected value, found trait `Into` --> $DIR/issue-100365.rs:6:13 @@ -17,8 +18,9 @@ LL | let _ = Into.into(()); | help: use the path separator to refer to an item | -LL | let _ = Into::into(()); - | ~~ +LL - let _ = Into.into(()); +LL + let _ = Into::into(()); + | error[E0423]: expected value, found trait `Into` --> $DIR/issue-100365.rs:10:13 @@ -28,8 +30,9 @@ LL | let _ = Into::<()>.into; | help: use the path separator to refer to an item | -LL | let _ = Into::<()>::into; - | ~~ +LL - let _ = Into::<()>.into; +LL + let _ = Into::<()>::into; + | error[E0423]: expected value, found trait `std::iter::Iterator` --> $DIR/issue-100365.rs:17:9 @@ -65,8 +68,9 @@ LL | let _ = create!(); = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | -LL | Into::::into("") - | ~~ +LL - Into::.into("") +LL + Into::::into("") + | error: aborting due to 6 previous errors diff --git a/tests/ui/resolve/issue-101749.stderr b/tests/ui/resolve/issue-101749.stderr index fedbf182ee8c..09e800ec7c31 100644 --- a/tests/ui/resolve/issue-101749.stderr +++ b/tests/ui/resolve/issue-101749.stderr @@ -7,8 +7,9 @@ LL | let _ = rect::area(); = help: you might be missing a crate named `rect` help: you may have meant to call an instance method | -LL | let _ = rect.area(); - | ~ +LL - let _ = rect::area(); +LL + let _ = rect.area(); + | error: aborting due to 1 previous error diff --git a/tests/ui/resolve/issue-103202.stderr b/tests/ui/resolve/issue-103202.stderr index 87fa940ac3b2..cf32efab981f 100644 --- a/tests/ui/resolve/issue-103202.stderr +++ b/tests/ui/resolve/issue-103202.stderr @@ -6,8 +6,9 @@ LL | fn f(self: &S::x) {} | help: if there were a trait named `Example` with associated type `x` implemented for `S`, you could use the fully-qualified path | -LL | fn f(self: &::x) {} - | ~~~~~~~~~~~~~~~~~ +LL - fn f(self: &S::x) {} +LL + fn f(self: &::x) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/resolve/issue-103474.stderr b/tests/ui/resolve/issue-103474.stderr index e48fb31eccc9..717892921f14 100644 --- a/tests/ui/resolve/issue-103474.stderr +++ b/tests/ui/resolve/issue-103474.stderr @@ -6,8 +6,9 @@ LL | this.i | help: you might have meant to use `self` here instead | -LL | self.i - | ~~~~ +LL - this.i +LL + self.i + | help: if you meant to use `self`, you are also missing a `self` receiver argument | LL | fn needs_self(&self) { diff --git a/tests/ui/resolve/issue-112472-multi-generics-suggestion.stderr b/tests/ui/resolve/issue-112472-multi-generics-suggestion.stderr index f463e2dad2cf..1ed6e68c3335 100644 --- a/tests/ui/resolve/issue-112472-multi-generics-suggestion.stderr +++ b/tests/ui/resolve/issue-112472-multi-generics-suggestion.stderr @@ -6,8 +6,9 @@ LL | >::Error: ParseError, | help: constrain the associated type to `ParseError` | -LL | DecodeLine: convert::TryFrom, - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - >::Error: ParseError, +LL + DecodeLine: convert::TryFrom, + | error[E0404]: expected trait, found enum `ParseError` --> $DIR/issue-112472-multi-generics-suggestion.rs:25:45 @@ -17,8 +18,9 @@ LL | >::Error: ParseError, | help: constrain the associated type to `ParseError` | -LL | DecodeLine: TryFrom, - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - >::Error: ParseError, +LL + DecodeLine: TryFrom, + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/issue-18252.stderr b/tests/ui/resolve/issue-18252.stderr index 6cb9c1f1dd21..b22ad3f5225b 100644 --- a/tests/ui/resolve/issue-18252.stderr +++ b/tests/ui/resolve/issue-18252.stderr @@ -6,8 +6,9 @@ LL | let f = Foo::Variant(42); | help: you might have meant to create a new value of the struct | -LL | let f = Foo::Variant { x: /* value */ }; - | ~~~~~~~~~~~~~~~~~~ +LL - let f = Foo::Variant(42); +LL + let f = Foo::Variant { x: /* value */ }; + | error: aborting due to 1 previous error diff --git a/tests/ui/resolve/issue-22692.stderr b/tests/ui/resolve/issue-22692.stderr index be0634ebffc9..546f12b35c15 100644 --- a/tests/ui/resolve/issue-22692.stderr +++ b/tests/ui/resolve/issue-22692.stderr @@ -6,8 +6,9 @@ LL | let _ = String.new(); | help: use the path separator to refer to an item | -LL | let _ = String::new(); - | ~~ +LL - let _ = String.new(); +LL + let _ = String::new(); + | error[E0423]: expected value, found struct `String` --> $DIR/issue-22692.rs:6:13 @@ -17,8 +18,9 @@ LL | let _ = String.default; | help: use the path separator to refer to an item | -LL | let _ = String::default; - | ~~ +LL - let _ = String.default; +LL + let _ = String::default; + | error[E0423]: expected value, found struct `Vec` --> $DIR/issue-22692.rs:10:13 @@ -28,8 +30,9 @@ LL | let _ = Vec::<()>.with_capacity(1); | help: use the path separator to refer to an item | -LL | let _ = Vec::<()>::with_capacity(1); - | ~~ +LL - let _ = Vec::<()>.with_capacity(1); +LL + let _ = Vec::<()>::with_capacity(1); + | error[E0423]: expected value, found struct `std::cell::Cell` --> $DIR/issue-22692.rs:17:9 @@ -43,8 +46,9 @@ LL | Type!().get(); = note: this error originates in the macro `Type` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | -LL | ::get(); - | ~~~~~~~~~~~ +LL - Type!().get(); +LL + ::get(); + | error[E0423]: expected value, found struct `std::cell::Cell` --> $DIR/issue-22692.rs:17:9 @@ -58,8 +62,9 @@ LL | Type! {}.get; = note: this error originates in the macro `Type` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | -LL | ::get; - | ~~~~~~~~~~~~ +LL - Type! {}.get; +LL + ::get; + | error[E0423]: expected value, found struct `Vec` --> $DIR/issue-22692.rs:26:9 @@ -73,8 +78,9 @@ LL | let _ = create!(type method); = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | -LL | Vec::new() - | ~~ +LL - Vec.new() +LL + Vec::new() + | error[E0423]: expected value, found struct `Vec` --> $DIR/issue-22692.rs:31:9 @@ -88,8 +94,9 @@ LL | let _ = create!(type field); = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | -LL | Vec::new - | ~~ +LL - Vec.new +LL + Vec::new + | error[E0423]: expected value, found struct `std::cell::Cell` --> $DIR/issue-22692.rs:17:9 @@ -103,8 +110,9 @@ LL | let _ = create!(macro method); = note: this error originates in the macro `Type` which comes from the expansion of the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | -LL | ::new(0) - | ~~~~~~~~~~~ +LL - Type!().new(0) +LL + ::new(0) + | error: aborting due to 8 previous errors diff --git a/tests/ui/resolve/issue-35675.stderr b/tests/ui/resolve/issue-35675.stderr index 44af65b0768a..83d92ea7bf1a 100644 --- a/tests/ui/resolve/issue-35675.stderr +++ b/tests/ui/resolve/issue-35675.stderr @@ -6,8 +6,9 @@ LL | fn should_return_fruit() -> Apple { | help: there is an enum variant `Fruit::Apple`; try using the variant's enum | -LL | fn should_return_fruit() -> Fruit { - | ~~~~~ +LL - fn should_return_fruit() -> Apple { +LL + fn should_return_fruit() -> Fruit { + | error[E0425]: cannot find function, tuple struct or tuple variant `Apple` in this scope --> $DIR/issue-35675.rs:9:5 @@ -57,8 +58,9 @@ LL | fn bar() -> Variant3 { | help: there is an enum variant `x::Enum::Variant3`; try using the variant's enum | -LL | fn bar() -> x::Enum { - | ~~~~~~~ +LL - fn bar() -> Variant3 { +LL + fn bar() -> x::Enum { + | error[E0573]: expected type, found variant `Some` --> $DIR/issue-35675.rs:28:13 diff --git a/tests/ui/resolve/issue-3907.stderr b/tests/ui/resolve/issue-3907.stderr index e9dc344496e5..0dc85829160b 100644 --- a/tests/ui/resolve/issue-3907.stderr +++ b/tests/ui/resolve/issue-3907.stderr @@ -6,7 +6,8 @@ LL | impl Foo for S { | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | -LL | trait Foo = dyn issue_3907::Foo; +LL - type Foo = dyn issue_3907::Foo; +LL + trait Foo = dyn issue_3907::Foo; | help: consider importing this trait instead | diff --git a/tests/ui/resolve/issue-39226.stderr b/tests/ui/resolve/issue-39226.stderr index 857f6a735178..3d771b4fc42a 100644 --- a/tests/ui/resolve/issue-39226.stderr +++ b/tests/ui/resolve/issue-39226.stderr @@ -9,12 +9,14 @@ LL | handle: Handle | help: use struct literal syntax instead | -LL | handle: Handle {} - | ~~~~~~~~~ +LL - handle: Handle +LL + handle: Handle {} + | help: a local variable with a similar name exists | -LL | handle: handle - | ~~~~~~ +LL - handle: Handle +LL + handle: handle + | error: aborting due to 1 previous error diff --git a/tests/ui/resolve/issue-42944.stderr b/tests/ui/resolve/issue-42944.stderr index 4ffa9402c667..53c155d8f130 100644 --- a/tests/ui/resolve/issue-42944.stderr +++ b/tests/ui/resolve/issue-42944.stderr @@ -23,8 +23,9 @@ LL | pub struct Bx(pub(in crate::foo) ()); | ^^^^^^^^^^^^^^^^^^^^^ private field help: consider making the field publicly accessible | -LL | pub struct Bx(pub ()); - | ~~~ +LL - pub struct Bx(pub(in crate::foo) ()); +LL + pub struct Bx(pub ()); + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/issue-5035.stderr b/tests/ui/resolve/issue-5035.stderr index 32b972b21ffa..b249aaa4b280 100644 --- a/tests/ui/resolve/issue-5035.stderr +++ b/tests/ui/resolve/issue-5035.stderr @@ -15,12 +15,14 @@ LL | impl K for isize {} | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | -LL | trait K = dyn I; +LL - type K = dyn I; +LL + trait K = dyn I; | help: a trait with a similar name exists | -LL | impl I for isize {} - | ~ +LL - impl K for isize {} +LL + impl I for isize {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/issue-5099.stderr b/tests/ui/resolve/issue-5099.stderr index e9b2a9c4d484..991c39db3351 100644 --- a/tests/ui/resolve/issue-5099.stderr +++ b/tests/ui/resolve/issue-5099.stderr @@ -6,8 +6,9 @@ LL | this.a | help: you might have meant to use `self` here instead | -LL | self.a - | ~~~~ +LL - this.a +LL + self.a + | help: if you meant to use `self`, you are also missing a `self` receiver argument | LL | fn a(&self) -> A { @@ -21,8 +22,9 @@ LL | this.b(x); | help: you might have meant to use `self` here instead | -LL | self.b(x); - | ~~~~ +LL - this.b(x); +LL + self.b(x); + | help: if you meant to use `self`, you are also missing a `self` receiver argument | LL | fn b(&self, x: i32) { @@ -36,8 +38,9 @@ LL | let _ = || this.a; | help: you might have meant to use `self` here instead | -LL | let _ = || self.a; - | ~~~~ +LL - let _ = || this.a; +LL + let _ = || self.a; + | help: if you meant to use `self`, you are also missing a `self` receiver argument | LL | fn c(&self) { diff --git a/tests/ui/resolve/issue-55673.stderr b/tests/ui/resolve/issue-55673.stderr index 7d420126199b..30b1cd09085b 100644 --- a/tests/ui/resolve/issue-55673.stderr +++ b/tests/ui/resolve/issue-55673.stderr @@ -6,8 +6,9 @@ LL | T::Baa: std::fmt::Debug, | help: change the associated type name to use `Bar` from `Foo` | -LL | T::Bar: std::fmt::Debug, - | ~~~ +LL - T::Baa: std::fmt::Debug, +LL + T::Bar: std::fmt::Debug, + | error[E0220]: associated type `Baa` not found for `T` --> $DIR/issue-55673.rs:16:8 @@ -17,12 +18,14 @@ LL | T::Baa: std::fmt::Debug, | help: consider further restricting type parameter `T` with trait `Foo` | -LL | T::Baa: std::fmt::Debug, T: Foo - | ~~~~~~~~ +LL - T::Baa: std::fmt::Debug, +LL + T::Baa: std::fmt::Debug, T: Foo + | help: ...and changing the associated type name | -LL | T::Bar: std::fmt::Debug, - | ~~~ +LL - T::Baa: std::fmt::Debug, +LL + T::Bar: std::fmt::Debug, + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/issue-73427.stderr b/tests/ui/resolve/issue-73427.stderr index 0a9a504f79ca..890bb04f24da 100644 --- a/tests/ui/resolve/issue-73427.stderr +++ b/tests/ui/resolve/issue-73427.stderr @@ -17,14 +17,17 @@ LL | | } | |_^ help: you might have meant to use one of the following enum variants | -LL | (A::Tuple()).foo(); - | ~~~~~~~~~~~~ -LL | A::Unit.foo(); - | ~~~~~~~ +LL - A.foo(); +LL + (A::Tuple()).foo(); + | +LL - A.foo(); +LL + A::Unit.foo(); + | help: alternatively, the following enum variant is available | -LL | (A::TupleWithFields(/* fields */)).foo(); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - A.foo(); +LL + (A::TupleWithFields(/* fields */)).foo(); + | error[E0423]: expected value, found enum `B` --> $DIR/issue-73427.rs:35:5 @@ -58,12 +61,14 @@ LL | | } | |_^ help: you might have meant to use the following enum variant | -LL | C::Unit.foo(); - | ~~~~~~~ +LL - C.foo(); +LL + C::Unit.foo(); + | help: alternatively, the following enum variant is available | -LL | (C::TupleWithFields(/* fields */)).foo(); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - C.foo(); +LL + (C::TupleWithFields(/* fields */)).foo(); + | error[E0423]: expected value, found enum `D` --> $DIR/issue-73427.rs:39:5 @@ -81,12 +86,14 @@ LL | | } | |_^ help: you might have meant to use the following enum variant | -LL | D::Unit.foo(); - | ~~~~~~~ +LL - D.foo(); +LL + D::Unit.foo(); + | help: alternatively, the following enum variant is available | -LL | (D::TupleWithFields(/* fields */)).foo(); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - D.foo(); +LL + (D::TupleWithFields(/* fields */)).foo(); + | error[E0423]: expected value, found enum `E` --> $DIR/issue-73427.rs:41:5 @@ -103,8 +110,9 @@ LL | | } | |_^ help: the following enum variant is available | -LL | (E::TupleWithFields(/* fields */)).foo(); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - E.foo(); +LL + (E::TupleWithFields(/* fields */)).foo(); + | help: consider importing one of these constants instead | LL + use std::f128::consts::E; @@ -136,10 +144,12 @@ LL | | } | |_^ help: try to match against one of the enum's variants | -LL | if let A::Tuple(3) = x { } - | ~~~~~~~~ -LL | if let A::TupleWithFields(3) = x { } - | ~~~~~~~~~~~~~~~~~~ +LL - if let A(3) = x { } +LL + if let A::Tuple(3) = x { } + | +LL - if let A(3) = x { } +LL + if let A::TupleWithFields(3) = x { } + | error[E0423]: expected function, tuple struct or tuple variant, found enum `A` --> $DIR/issue-73427.rs:46:13 @@ -161,10 +171,12 @@ LL | | } | |_^ help: try to construct one of the enum's variants | -LL | let x = A::Tuple(3); - | ~~~~~~~~ -LL | let x = A::TupleWithFields(3); - | ~~~~~~~~~~~~~~~~~~ +LL - let x = A(3); +LL + let x = A::Tuple(3); + | +LL - let x = A(3); +LL + let x = A::TupleWithFields(3); + | error: aborting due to 7 previous errors diff --git a/tests/ui/resolve/privacy-enum-ctor.stderr b/tests/ui/resolve/privacy-enum-ctor.stderr index 12a6580048e1..3bbab3716afe 100644 --- a/tests/ui/resolve/privacy-enum-ctor.stderr +++ b/tests/ui/resolve/privacy-enum-ctor.stderr @@ -17,12 +17,14 @@ LL | | } | |_________^ help: you might have meant to use the following enum variant | -LL | m::Z::Unit; - | ~~~~~~~~~~ +LL - n::Z; +LL + m::Z::Unit; + | help: alternatively, the following enum variant is available | -LL | (m::Z::Fn(/* fields */)); - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - n::Z; +LL + (m::Z::Fn(/* fields */)); + | error[E0423]: expected value, found enum `Z` --> $DIR/privacy-enum-ctor.rs:25:9 @@ -43,12 +45,14 @@ LL | | } | |_________^ help: you might have meant to use the following enum variant | -LL | m::Z::Unit; - | ~~~~~~~~~~ +LL - Z; +LL + m::Z::Unit; + | help: alternatively, the following enum variant is available | -LL | (m::Z::Fn(/* fields */)); - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - Z; +LL + (m::Z::Fn(/* fields */)); + | error[E0423]: expected value, found enum `m::E` --> $DIR/privacy-enum-ctor.rs:41:16 @@ -72,16 +76,19 @@ LL | | } | |_____^ help: you might have meant to use the following enum variant | -LL | let _: E = E::Unit; - | ~~~~~~~ +LL - let _: E = m::E; +LL + let _: E = E::Unit; + | help: alternatively, the following enum variant is available | -LL | let _: E = (E::Fn(/* fields */)); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - let _: E = m::E; +LL + let _: E = (E::Fn(/* fields */)); + | help: a function with a similar name exists | -LL | let _: E = m::f; - | ~ +LL - let _: E = m::E; +LL + let _: E = m::f; + | help: consider importing one of these constants instead | LL + use std::f128::consts::E; @@ -117,12 +124,14 @@ LL | | } | |_____^ help: you might have meant to use the following enum variant | -LL | let _: E = E::Unit; - | ~~~~~~~ +LL - let _: E = E; +LL + let _: E = E::Unit; + | help: alternatively, the following enum variant is available | -LL | let _: E = (E::Fn(/* fields */)); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - let _: E = E; +LL + let _: E = (E::Fn(/* fields */)); + | help: consider importing one of these constants instead | LL + use std::f128::consts::E; @@ -168,12 +177,14 @@ LL | | } | |_________^ help: you might have meant to use the following enum variant | -LL | let _: Z = m::Z::Unit; - | ~~~~~~~~~~ +LL - let _: Z = m::n::Z; +LL + let _: Z = m::Z::Unit; + | help: alternatively, the following enum variant is available | -LL | let _: Z = (m::Z::Fn(/* fields */)); - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _: Z = m::n::Z; +LL + let _: Z = (m::Z::Fn(/* fields */)); + | error[E0412]: cannot find type `Z` in this scope --> $DIR/privacy-enum-ctor.rs:61:12 diff --git a/tests/ui/resolve/privacy-struct-ctor.stderr b/tests/ui/resolve/privacy-struct-ctor.stderr index c1fcaaf05738..1d8c741c964e 100644 --- a/tests/ui/resolve/privacy-struct-ctor.stderr +++ b/tests/ui/resolve/privacy-struct-ctor.stderr @@ -55,8 +55,9 @@ LL | pub(in m) struct Z(pub(in m::n) u8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the field publicly accessible | -LL | pub(in m) struct Z(pub u8); - | ~~~ +LL - pub(in m) struct Z(pub(in m::n) u8); +LL + pub(in m) struct Z(pub u8); + | error[E0603]: tuple struct constructor `S` is private --> $DIR/privacy-struct-ctor.rs:29:8 @@ -112,8 +113,9 @@ LL | pub(in m) struct Z(pub(in m::n) u8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the field publicly accessible | -LL | pub(in m) struct Z(pub u8); - | ~~~ +LL - pub(in m) struct Z(pub(in m::n) u8); +LL + pub(in m) struct Z(pub u8); + | error[E0603]: tuple struct constructor `S` is private --> $DIR/privacy-struct-ctor.rs:41:16 diff --git a/tests/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr b/tests/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr index 999e9a47d6c5..f1db2d71b6a6 100644 --- a/tests/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr +++ b/tests/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr @@ -3,7 +3,8 @@ error[E0259]: the name `std` is defined multiple times = note: `std` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | extern crate std as other_std; +LL - extern crate std; +LL + extern crate std as other_std; | error: aborting due to 1 previous error diff --git a/tests/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr b/tests/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr index a8d0efedb6c4..40c76821bb83 100644 --- a/tests/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr +++ b/tests/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr @@ -7,8 +7,9 @@ LL | use std::slice as std; = note: `std` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use std::slice as other_std; - | ~~~~~~~~~~~~ +LL - use std::slice as std; +LL + use std::slice as other_std; + | error: aborting due to 1 previous error diff --git a/tests/ui/resolve/resolve-inconsistent-names.stderr b/tests/ui/resolve/resolve-inconsistent-names.stderr index d6240fb8f872..3197e0b08949 100644 --- a/tests/ui/resolve/resolve-inconsistent-names.stderr +++ b/tests/ui/resolve/resolve-inconsistent-names.stderr @@ -34,8 +34,9 @@ LL | (A, B) | (ref B, c) | (c, A) => () | help: if you meant to match on unit variant `E::A`, use the full path in the pattern | -LL | (E::A, B) | (ref B, c) | (c, A) => () - | ~~~~ +LL - (A, B) | (ref B, c) | (c, A) => () +LL + (E::A, B) | (ref B, c) | (c, A) => () + | error[E0408]: variable `B` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:19:31 @@ -64,8 +65,9 @@ LL | (CONST1, _) | (_, Const2) => () | help: if you meant to match on constant `m::Const2`, use the full path in the pattern | -LL | (CONST1, _) | (_, m::Const2) => () - | ~~~~~~~~~ +LL - (CONST1, _) | (_, Const2) => () +LL + (CONST1, _) | (_, m::Const2) => () + | error[E0408]: variable `CONST1` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:31:23 diff --git a/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr b/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr index b41fa1818e25..3d6d47578c37 100644 --- a/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr +++ b/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr @@ -11,8 +11,9 @@ LL | const DEFAULT: u32 = 0; = note: the matched value is of type `u32` help: introduce a variable instead | -LL | let DEFAULT_var: u32 = 0; - | ~~~~~~~~~~~ +LL - let DEFAULT: u32 = 0; +LL + let DEFAULT_var: u32 = 0; + | error: aborting due to 1 previous error diff --git a/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr b/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr index 908f5bdd8974..f041487da41d 100644 --- a/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr +++ b/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr @@ -21,8 +21,9 @@ LL | const DEFAULT: u32 = 0; = note: the matched value is of type `u32` help: introduce a variable instead | -LL | let DEFAULT_var: u32 = 0; - | ~~~~~~~~~~~ +LL - let DEFAULT: u32 = 0; +LL + let DEFAULT_var: u32 = 0; + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/resolve-variant-assoc-item.stderr b/tests/ui/resolve/resolve-variant-assoc-item.stderr index 9a5a605ac05b..4b15114f022a 100644 --- a/tests/ui/resolve/resolve-variant-assoc-item.stderr +++ b/tests/ui/resolve/resolve-variant-assoc-item.stderr @@ -6,8 +6,9 @@ LL | E::V::associated_item; | help: there is an enum variant `E::V`; try using the variant's enum | -LL | E::associated_item; - | ~ +LL - E::V::associated_item; +LL + E::associated_item; + | error[E0433]: failed to resolve: `V` is a variant, not a module --> $DIR/resolve-variant-assoc-item.rs:6:5 @@ -17,8 +18,9 @@ LL | V::associated_item; | help: there is an enum variant `E::V`; try using the variant's enum | -LL | E::associated_item; - | ~ +LL - V::associated_item; +LL + E::associated_item; + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/suggest-path-for-tuple-struct.stderr b/tests/ui/resolve/suggest-path-for-tuple-struct.stderr index 12c631f5a830..68a5b5509782 100644 --- a/tests/ui/resolve/suggest-path-for-tuple-struct.stderr +++ b/tests/ui/resolve/suggest-path-for-tuple-struct.stderr @@ -6,8 +6,9 @@ LL | let _ = SomeTupleStruct.new(); | help: use the path separator to refer to an item | -LL | let _ = SomeTupleStruct::new(); - | ~~ +LL - let _ = SomeTupleStruct.new(); +LL + let _ = SomeTupleStruct::new(); + | error[E0423]: expected value, found struct `SomeRegularStruct` --> $DIR/suggest-path-for-tuple-struct.rs:24:13 @@ -17,8 +18,9 @@ LL | let _ = SomeRegularStruct.new(); | help: use the path separator to refer to an item | -LL | let _ = SomeRegularStruct::new(); - | ~~ +LL - let _ = SomeRegularStruct.new(); +LL + let _ = SomeRegularStruct::new(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr b/tests/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr index 9c12fd2644c5..5db943cd10d0 100644 --- a/tests/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr +++ b/tests/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr @@ -6,8 +6,9 @@ LL | a.I | help: use the path separator to refer to an item | -LL | a::I - | ~~ +LL - a.I +LL + a::I + | error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:23:5 @@ -17,8 +18,9 @@ LL | a.g() | help: use the path separator to refer to an item | -LL | a::g() - | ~~ +LL - a.g() +LL + a::g() + | error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:29:5 @@ -28,8 +30,9 @@ LL | a.b.J | help: use the path separator to refer to an item | -LL | a::b.J - | ~~ +LL - a.b.J +LL + a::b.J + | error[E0423]: expected value, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:35:5 @@ -42,12 +45,14 @@ LL | a::b.J | help: use the path separator to refer to an item | -LL | a::b::J - | ~~ +LL - a::b.J +LL + a::b::J + | help: a constant with a similar name exists | -LL | a::I.J - | ~ +LL - a::b.J +LL + a::I.J + | error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:42:5 @@ -57,8 +62,9 @@ LL | a.b.f(); | help: use the path separator to refer to an item | -LL | a::b.f(); - | ~~ +LL - a.b.f(); +LL + a::b.f(); + | error[E0423]: expected value, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:46:12 @@ -82,12 +88,14 @@ LL | a::b.f() | help: use the path separator to refer to an item | -LL | a::b::f() - | ~~ +LL - a::b.f() +LL + a::b::f() + | help: a constant with a similar name exists | -LL | a::I.f() - | ~ +LL - a::b.f() +LL + a::I.f() + | error[E0423]: expected value, found module `a::b` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:59:5 @@ -145,8 +153,9 @@ LL | let _ = create!(method); = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | -LL | a::f() - | ~~ +LL - a.f() +LL + a::f() + | error[E0423]: expected value, found module `a` --> $DIR/suggest-path-instead-of-mod-dot-item.rs:85:9 @@ -160,8 +169,9 @@ LL | let _ = create!(field); = note: this error originates in the macro `create` (in Nightly builds, run with -Z macro-backtrace for more info) help: use the path separator to refer to an item | -LL | a::f - | ~~ +LL - a.f +LL + a::f + | error: aborting due to 13 previous errors diff --git a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr index 5662021a2d52..15fdb975a1b2 100644 --- a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr +++ b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr @@ -28,8 +28,9 @@ LL | println!("{self.config}"); | +++++ help: a local variable with a similar name exists | -LL | println!("{cofig}"); - | ~~~~~ +LL - println!("{config}"); +LL + println!("{cofig}"); + | error[E0425]: cannot find value `bah` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:33:9 @@ -46,8 +47,9 @@ LL | Self::bah; | ++++++ help: a function with a similar name exists | -LL | ba; - | ~~ +LL - bah; +LL + ba; + | error[E0425]: cannot find value `BAR` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:35:9 @@ -64,8 +66,9 @@ LL | Self::BAR; | ++++++ help: a constant with a similar name exists | -LL | BARR; - | ~~~~ +LL - BAR; +LL + BARR; + | error[E0412]: cannot find type `Baz` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:37:18 @@ -82,8 +85,9 @@ LL | let foo: Self::Baz = "".to_string(); | ++++++ help: a type alias with a similar name exists | -LL | let foo: Bar = "".to_string(); - | ~~~ +LL - let foo: Baz = "".to_string(); +LL + let foo: Bar = "".to_string(); + | error[E0425]: cannot find function `baz` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:31:9 @@ -100,8 +104,9 @@ LL | self.baz(); | +++++ help: a function with a similar name exists | -LL | ba(); - | ~~ +LL - baz(); +LL + ba(); + | error: aborting due to 7 previous errors diff --git a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr index 3ae134e43bc1..1ea7f1d39cb9 100644 --- a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr +++ b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr @@ -18,8 +18,9 @@ LL | Struct::fob(); | help: there is an associated function `foo` with a similar name | -LL | Struct::foo(); - | ~~~ +LL - Struct::fob(); +LL + Struct::foo(); + | error[E0433]: failed to resolve: use of undeclared type `Struc` --> $DIR/typo-suggestion-mistyped-in-path.rs:27:5 @@ -38,8 +39,9 @@ LL | modul::foo(); | help: there is a crate or module with a similar name | -LL | module::foo(); - | ~~~~~~ +LL - modul::foo(); +LL + module::foo(); + | error[E0433]: failed to resolve: use of undeclared type `Trai` --> $DIR/typo-suggestion-mistyped-in-path.rs:39:5 diff --git a/tests/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr b/tests/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr index 8addc0303fb9..f885705a17b5 100644 --- a/tests/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr +++ b/tests/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr @@ -12,7 +12,8 @@ LL | fn g isize>(x: F) {} | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | -LL | trait Typedef = isize; +LL - type Typedef = isize; +LL + trait Typedef = isize; | error: aborting due to 2 previous errors diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr index 39b1ef1e078c..d0244f39769a 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr @@ -58,8 +58,9 @@ LL | let NormalStruct { first_field, second_field } = ns; | help: add `..` at the end of the field list to ignore all other fields | -LL | let NormalStruct { first_field, second_field , .. } = ns; - | ~~~~~~ +LL - let NormalStruct { first_field, second_field } = ns; +LL + let NormalStruct { first_field, second_field , .. } = ns; + | error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/struct.rs:20:14 @@ -75,8 +76,9 @@ LL | let TupleStruct { 0: first_field, 1: second_field } = ts; | help: add `..` at the end of the field list to ignore all other fields | -LL | let TupleStruct { 0: first_field, 1: second_field , .. } = ts; - | ~~~~~~ +LL - let TupleStruct { 0: first_field, 1: second_field } = ts; +LL + let TupleStruct { 0: first_field, 1: second_field , .. } = ts; + | error[E0638]: `..` required with struct marked as non-exhaustive --> $DIR/struct.rs:35:9 @@ -86,8 +88,9 @@ LL | let UnitStruct { } = us; | help: add `..` at the end of the field list to ignore all other fields | -LL | let UnitStruct { .. } = us; - | ~~~~ +LL - let UnitStruct { } = us; +LL + let UnitStruct { .. } = us; + | error: aborting due to 9 previous errors diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr index 4083f57a9cdf..4cabd5a81402 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr @@ -82,8 +82,9 @@ LL | NonExhaustiveVariants::Struct { field } => "" | help: add `..` at the end of the field list to ignore all other fields | -LL | NonExhaustiveVariants::Struct { field , .. } => "" - | ~~~~~~ +LL - NonExhaustiveVariants::Struct { field } => "" +LL + NonExhaustiveVariants::Struct { field , .. } => "" + | error[E0638]: `..` required with variant marked as non-exhaustive --> $DIR/variant.rs:30:12 @@ -93,8 +94,9 @@ LL | if let NonExhaustiveVariants::Struct { field } = variant_struct { | help: add `..` at the end of the field list to ignore all other fields | -LL | if let NonExhaustiveVariants::Struct { field , .. } = variant_struct { - | ~~~~~~ +LL - if let NonExhaustiveVariants::Struct { field } = variant_struct { +LL + if let NonExhaustiveVariants::Struct { field , .. } = variant_struct { + | error: aborting due to 8 previous errors diff --git a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr index d0c084f7bd5d..37a0f2bcaa88 100644 --- a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr +++ b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr @@ -6,8 +6,9 @@ LL | use alloc; | help: consider importing this module instead | -LL | use std::alloc; - | ~~~~~~~~~~ +LL - use alloc; +LL + use std::alloc; + | error: aborting due to 1 previous error diff --git a/tests/ui/rmeta/rmeta_meta_main.stderr b/tests/ui/rmeta/rmeta_meta_main.stderr index af11c88d9282..7ee44ce29b29 100644 --- a/tests/ui/rmeta/rmeta_meta_main.stderr +++ b/tests/ui/rmeta/rmeta_meta_main.stderr @@ -6,8 +6,9 @@ LL | let _ = Foo { field2: 42 }; | help: a field with a similar name exists | -LL | let _ = Foo { field: 42 }; - | ~~~~~ +LL - let _ = Foo { field2: 42 }; +LL + let _ = Foo { field: 42 }; + | error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/remove-extern-crate.stderr b/tests/ui/rust-2018/remove-extern-crate.stderr index 020db9975c09..cb090c621e9f 100644 --- a/tests/ui/rust-2018/remove-extern-crate.stderr +++ b/tests/ui/rust-2018/remove-extern-crate.stderr @@ -19,8 +19,9 @@ LL | extern crate core; | help: convert it to a `use` | -LL | use core; - | ~~~ +LL - extern crate core; +LL + use core; + | warning: `extern crate` is not idiomatic in the new edition --> $DIR/remove-extern-crate.rs:45:5 @@ -30,8 +31,9 @@ LL | pub extern crate core; | help: convert it to a `use` | -LL | pub use core; - | ~~~ +LL - pub extern crate core; +LL + pub use core; + | warning: 3 warnings emitted diff --git a/tests/ui/rust-2018/trait-import-suggestions.stderr b/tests/ui/rust-2018/trait-import-suggestions.stderr index 852628885794..077b4a6cf2f7 100644 --- a/tests/ui/rust-2018/trait-import-suggestions.stderr +++ b/tests/ui/rust-2018/trait-import-suggestions.stderr @@ -14,8 +14,9 @@ LL + use crate::foo::foobar::Foobar; | help: there is a method `bar` with a similar name | -LL | x.bar(); - | ~~~ +LL - x.foobar(); +LL + x.bar(); + | error[E0599]: no method named `bar` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:28:7 @@ -33,8 +34,9 @@ LL + use crate::foo::Bar; | help: there is a method `foobar` with a similar name | -LL | x.foobar(); - | ~~~~~~ +LL - x.bar(); +LL + x.foobar(); + | error[E0599]: no method named `baz` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:29:7 @@ -44,8 +46,9 @@ LL | x.baz(); | help: there is a method `bar` with a similar name | -LL | x.bar(); - | ~~~ +LL - x.baz(); +LL + x.bar(); + | error[E0599]: no function or associated item named `from_str` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:30:18 @@ -60,8 +63,9 @@ LL + use std::str::FromStr; | help: there is an associated function `from` with a similar name | -LL | let y = u32::from("33"); - | ~~~~ +LL - let y = u32::from_str("33"); +LL + let y = u32::from("33"); + | error: aborting due to 4 previous errors diff --git a/tests/ui/rust-2021/future-prelude-collision-shadow.stderr b/tests/ui/rust-2021/future-prelude-collision-shadow.stderr index d9c0fa47eca0..966613e12b50 100644 --- a/tests/ui/rust-2021/future-prelude-collision-shadow.stderr +++ b/tests/ui/rust-2021/future-prelude-collision-shadow.stderr @@ -14,8 +14,9 @@ LL + use std::convert::TryInto; | help: there is a method `into` with a similar name | -LL | let _: u32 = 3u8.into().unwrap(); - | ~~~~ +LL - let _: u32 = 3u8.try_into().unwrap(); +LL + let _: u32 = 3u8.into().unwrap(); + | error: aborting due to 1 previous error diff --git a/tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr b/tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr index b8a9a5c81297..ac19f91881df 100644 --- a/tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr +++ b/tests/ui/rust-2021/ice-return-unsized-can-impl-2.stderr @@ -7,8 +7,9 @@ LL | fn concrete(b: B) -> B; = note: `B` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `B` | -LL | fn concrete(b: T) -> B; - | ++++++ ~ +LL - fn concrete(b: B) -> B; +LL + fn concrete(b: T) -> B; + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn concrete(b: impl B) -> B; @@ -34,8 +35,9 @@ LL | fn f(a: A) -> A; = note: `A` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `A` | -LL | fn f(a: T) -> A; - | ++++++ ~ +LL - fn f(a: A) -> A; +LL + fn f(a: T) -> A; + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn f(a: impl A) -> A; diff --git a/tests/ui/rust-2021/ice-return-unsized-can-impl.stderr b/tests/ui/rust-2021/ice-return-unsized-can-impl.stderr index c0969570e920..463c6892ca26 100644 --- a/tests/ui/rust-2021/ice-return-unsized-can-impl.stderr +++ b/tests/ui/rust-2021/ice-return-unsized-can-impl.stderr @@ -7,8 +7,9 @@ LL | fn g(new: B) -> B; = note: `B` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `B` | -LL | fn g(new: T) -> B; - | ++++++ ~ +LL - fn g(new: B) -> B; +LL + fn g(new: T) -> B; + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn g(new: impl B) -> B; diff --git a/tests/ui/rust-2021/ice-unsized-fn-params-2.stderr b/tests/ui/rust-2021/ice-unsized-fn-params-2.stderr index d35c8ab3e425..7f837bbe50f0 100644 --- a/tests/ui/rust-2021/ice-unsized-fn-params-2.stderr +++ b/tests/ui/rust-2021/ice-unsized-fn-params-2.stderr @@ -7,8 +7,9 @@ LL | fn guard(_s: Copy) -> bool { = note: `Copy` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `Copy` | -LL | fn guard(_s: T) -> bool { - | +++++++++ ~ +LL - fn guard(_s: Copy) -> bool { +LL + fn guard(_s: T) -> bool { + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn guard(_s: impl Copy) -> bool { diff --git a/tests/ui/rust-2021/ice-unsized-fn-params.stderr b/tests/ui/rust-2021/ice-unsized-fn-params.stderr index d56e9981a288..c31500ba8004 100644 --- a/tests/ui/rust-2021/ice-unsized-fn-params.stderr +++ b/tests/ui/rust-2021/ice-unsized-fn-params.stderr @@ -7,8 +7,9 @@ LL | fn g(b: B) -> B; = note: `B` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `B` | -LL | fn g(b: T) -> B; - | ++++++ ~ +LL - fn g(b: B) -> B; +LL + fn g(b: T) -> B; + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn g(b: impl B) -> B; @@ -34,8 +35,9 @@ LL | fn f(a: A) -> A; = note: `A` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `A` | -LL | fn f(a: T) -> A; - | ++++++ ~ +LL - fn f(a: A) -> A; +LL + fn f(a: T) -> A; + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn f(a: impl A) -> A; diff --git a/tests/ui/self/arbitrary_self_type_mut_difference.stderr b/tests/ui/self/arbitrary_self_type_mut_difference.stderr index ffc61ee0d783..31c1c9b73820 100644 --- a/tests/ui/self/arbitrary_self_type_mut_difference.stderr +++ b/tests/ui/self/arbitrary_self_type_mut_difference.stderr @@ -11,8 +11,9 @@ LL | fn x(self: Pin<&mut Self>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: there is a method `y` with a similar name | -LL | Pin::new(&S).y(); - | ~ +LL - Pin::new(&S).x(); +LL + Pin::new(&S).y(); + | error[E0599]: no method named `y` found for struct `Pin<&mut S>` in the current scope --> $DIR/arbitrary_self_type_mut_difference.rs:12:22 @@ -27,8 +28,9 @@ LL | fn y(self: Pin<&Self>) {} | ^^^^^^^^^^^^^^^^^^^^^^ help: there is a method `x` with a similar name | -LL | Pin::new(&mut S).x(); - | ~ +LL - Pin::new(&mut S).y(); +LL + Pin::new(&mut S).x(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.stderr b/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.stderr index 4c0ab88493e9..8843efc6ff8c 100644 --- a/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.stderr +++ b/tests/ui/self/arbitrary_self_types_not_allow_call_with_no_deref.stderr @@ -13,8 +13,9 @@ LL | foo_cpp_ref.0.frobnicate_ref(); | ++ help: there is a method `frobnicate_cpp_ref` with a similar name | -LL | foo_cpp_ref.frobnicate_cpp_ref(); - | ~~~~~~~~~~~~~~~~~~ +LL - foo_cpp_ref.frobnicate_ref(); +LL + foo_cpp_ref.frobnicate_cpp_ref(); + | error[E0599]: no method named `frobnicate_self` found for struct `CppRef` in the current scope --> $DIR/arbitrary_self_types_not_allow_call_with_no_deref.rs:32:17 @@ -31,8 +32,9 @@ LL | foo_cpp_ref.0.frobnicate_self(); // would desugar to `Foo::frobnicate_s | ++ help: there is a method `frobnicate_cpp_ref` with a similar name | -LL | foo_cpp_ref.frobnicate_cpp_ref(); // would desugar to `Foo::frobnicate_self(*foo_cpp_ref)` - | ~~~~~~~~~~~~~~~~~~ +LL - foo_cpp_ref.frobnicate_self(); // would desugar to `Foo::frobnicate_self(*foo_cpp_ref)` +LL + foo_cpp_ref.frobnicate_cpp_ref(); // would desugar to `Foo::frobnicate_self(*foo_cpp_ref)` + | error: aborting due to 2 previous errors diff --git a/tests/ui/self/self-infer.stderr b/tests/ui/self/self-infer.stderr index 4f9e3f21dca5..c6bdff22b697 100644 --- a/tests/ui/self/self-infer.stderr +++ b/tests/ui/self/self-infer.stderr @@ -6,8 +6,9 @@ LL | fn f(self: _) {} | help: use type parameters instead | -LL | fn f(self: T) {} - | +++ ~ +LL - fn f(self: _) {} +LL + fn f(self: T) {} + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/self-infer.rs:5:17 @@ -17,8 +18,9 @@ LL | fn g(self: &_) {} | help: use type parameters instead | -LL | fn g(self: &T) {} - | +++ ~ +LL - fn g(self: &_) {} +LL + fn g(self: &T) {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/simd/portable-intrinsics-arent-exposed.stderr b/tests/ui/simd/portable-intrinsics-arent-exposed.stderr index d38667f750d9..71b4273fa063 100644 --- a/tests/ui/simd/portable-intrinsics-arent-exposed.stderr +++ b/tests/ui/simd/portable-intrinsics-arent-exposed.stderr @@ -15,8 +15,9 @@ LL | use std::simd::intrinsics; | help: consider importing this module instead | -LL | use std::intrinsics; - | ~~~~~~~~~~~~~~~ +LL - use std::simd::intrinsics; +LL + use std::intrinsics; + | error: aborting due to 2 previous errors diff --git a/tests/ui/span/issue-35987.stderr b/tests/ui/span/issue-35987.stderr index 36c59137b312..634bb5ed68f5 100644 --- a/tests/ui/span/issue-35987.stderr +++ b/tests/ui/span/issue-35987.stderr @@ -17,10 +17,12 @@ LL | fn add(self, rhs: Self) -> Self::Output { | help: use fully-qualified syntax | -LL | fn add(self, rhs: Self) -> as BitOr>::Output { - | ~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | fn add(self, rhs: Self) -> as IntoFuture>::Output { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn add(self, rhs: Self) -> Self::Output { +LL + fn add(self, rhs: Self) -> as BitOr>::Output { + | +LL - fn add(self, rhs: Self) -> Self::Output { +LL + fn add(self, rhs: Self) -> as IntoFuture>::Output { + | error: aborting due to 2 previous errors diff --git a/tests/ui/span/issue-37767.stderr b/tests/ui/span/issue-37767.stderr index 457870821a19..2bb64e3da861 100644 --- a/tests/ui/span/issue-37767.stderr +++ b/tests/ui/span/issue-37767.stderr @@ -16,12 +16,14 @@ LL | fn foo(&mut self) {} | ^^^^^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | A::foo(&mut a) - | ~~~~~~~~~~~~~~ +LL - a.foo() +LL + A::foo(&mut a) + | help: disambiguate the method for candidate #2 | -LL | B::foo(&mut a) - | ~~~~~~~~~~~~~~ +LL - a.foo() +LL + B::foo(&mut a) + | error[E0034]: multiple applicable items in scope --> $DIR/issue-37767.rs:22:7 @@ -41,12 +43,14 @@ LL | fn foo(&self) {} | ^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | C::foo(&a) - | ~~~~~~~~~~ +LL - a.foo() +LL + C::foo(&a) + | help: disambiguate the method for candidate #2 | -LL | D::foo(&a) - | ~~~~~~~~~~ +LL - a.foo() +LL + D::foo(&a) + | error[E0034]: multiple applicable items in scope --> $DIR/issue-37767.rs:34:7 @@ -66,12 +70,14 @@ LL | fn foo(self) {} | ^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | E::foo(a) - | ~~~~~~~~~ +LL - a.foo() +LL + E::foo(a) + | help: disambiguate the method for candidate #2 | -LL | F::foo(a) - | ~~~~~~~~~ +LL - a.foo() +LL + F::foo(a) + | error: aborting due to 3 previous errors diff --git a/tests/ui/span/issue-81800.stderr b/tests/ui/span/issue-81800.stderr index 86c64573b140..c1583c3ef8f8 100644 --- a/tests/ui/span/issue-81800.stderr +++ b/tests/ui/span/issue-81800.stderr @@ -6,8 +6,9 @@ LL | fn x˂- | help: Unicode character '˂' (Modifier Letter Left Arrowhead) looks like '<' (Less-Than Sign), but it is not | -LL | fn x<- - | ~ +LL - fn x˂- +LL + fn x<- + | error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `-` --> $DIR/issue-81800.rs:1:6 diff --git a/tests/ui/span/missing-unit-argument.stderr b/tests/ui/span/missing-unit-argument.stderr index 6261831b7523..e77ec3c8447a 100644 --- a/tests/ui/span/missing-unit-argument.stderr +++ b/tests/ui/span/missing-unit-argument.stderr @@ -8,8 +8,9 @@ note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL help: provide the argument | -LL | let _: Result<(), String> = Ok(()); - | ~~~~ +LL - let _: Result<(), String> = Ok(); +LL + let _: Result<(), String> = Ok(()); + | error[E0061]: this function takes 2 arguments but 0 arguments were supplied --> $DIR/missing-unit-argument.rs:12:5 @@ -24,8 +25,9 @@ LL | fn foo(():(), ():()) {} | ^^^ ----- ----- help: provide the arguments | -LL | foo((), ()); - | ~~~~~~~~ +LL - foo(); +LL + foo((), ()); + | error[E0061]: this function takes 2 arguments but 1 argument was supplied --> $DIR/missing-unit-argument.rs:13:5 @@ -40,8 +42,9 @@ LL | fn foo(():(), ():()) {} | ^^^ ----- help: provide the argument | -LL | foo((), ()); - | ~~~~~~~~ +LL - foo(()); +LL + foo((), ()); + | error[E0061]: this function takes 1 argument but 0 arguments were supplied --> $DIR/missing-unit-argument.rs:14:5 @@ -56,8 +59,9 @@ LL | fn bar(():()) {} | ^^^ ----- help: provide the argument | -LL | bar(()); - | ~~~~ +LL - bar(); +LL + bar(()); + | error[E0061]: this method takes 1 argument but 0 arguments were supplied --> $DIR/missing-unit-argument.rs:15:7 @@ -72,8 +76,9 @@ LL | fn baz(self, (): ()) { } | ^^^ ------ help: provide the argument | -LL | S.baz(()); - | ~~~~ +LL - S.baz(); +LL + S.baz(()); + | error[E0061]: this method takes 1 argument but 0 arguments were supplied --> $DIR/missing-unit-argument.rs:16:7 @@ -88,8 +93,9 @@ LL | fn generic(self, _: T) { } | ^^^^^^^ ---- help: provide the argument | -LL | S.generic::<()>(()); - | ~~~~ +LL - S.generic::<()>(); +LL + S.generic::<()>(()); + | error: aborting due to 6 previous errors diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr index 050834ab6760..4cbd93d17cfe 100644 --- a/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr @@ -11,8 +11,9 @@ LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ help: if you are using features which are still unstable, change to using `const_foobar` | -LL | #![feature(const_foobar)] - | ~~~~~~~~~~~~ +LL - #![feature(const_foo)] +LL + #![feature(const_foobar)] + | help: if you are using features which are now stable, remove this line | LL - #![feature(const_foo)] diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr index 50cc14c3b4f6..38331919ee8f 100644 --- a/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr @@ -11,8 +11,9 @@ LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ help: if you are using features which are still unstable, change to using `const_foobar` | -LL | #![feature(const_foobar)] - | ~~~~~~~~~~~~ +LL - #![feature(const_foo)] +LL + #![feature(const_foobar)] + | help: if you are using features which are now stable, remove this line | LL - #![feature(const_foo)] diff --git a/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr b/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr index d783f1e8e404..1080b977410d 100644 --- a/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr +++ b/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr @@ -11,8 +11,9 @@ LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ help: if you are using features which are still unstable, change to using `foobar` | -LL | #![feature(foobar)] - | ~~~~~~ +LL - #![feature(foo)] +LL + #![feature(foobar)] + | help: if you are using features which are now stable, remove this line | LL - #![feature(foo)] diff --git a/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr b/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr index 4940650fd426..02cb25633ab0 100644 --- a/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr +++ b/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr @@ -11,8 +11,9 @@ LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ help: if you are using features which are still unstable, change to using `foobar` | -LL | #![feature(foobar)] - | ~~~~~~ +LL - #![feature(foo)] +LL + #![feature(foobar)] + | help: if you are using features which are now stable, remove this line | LL - #![feature(foo)] diff --git a/tests/ui/static/static-reference-to-fn-1.stderr b/tests/ui/static/static-reference-to-fn-1.stderr index 6bf64974ef59..72036269b296 100644 --- a/tests/ui/static/static-reference-to-fn-1.stderr +++ b/tests/ui/static/static-reference-to-fn-1.stderr @@ -9,8 +9,9 @@ LL | func: &foo, = note: fn items are distinct from fn pointers help: consider casting to a fn pointer | -LL | func: &(foo as fn() -> Option), - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - func: &foo, +LL + func: &(foo as fn() -> Option), + | error: aborting due to 1 previous error diff --git a/tests/ui/statics/issue-15261.stderr b/tests/ui/statics/issue-15261.stderr index 4067d151de3d..7edd79e08b1e 100644 --- a/tests/ui/statics/issue-15261.stderr +++ b/tests/ui/statics/issue-15261.stderr @@ -9,8 +9,9 @@ LL | static n: &'static usize = unsafe { &n_mut }; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL | static n: &'static usize = unsafe { &raw const n_mut }; - | ~~~~~~~~~~ +LL - static n: &'static usize = unsafe { &n_mut }; +LL + static n: &'static usize = unsafe { &raw const n_mut }; + | warning: 1 warning emitted diff --git a/tests/ui/statics/static-mut-shared-parens.stderr b/tests/ui/statics/static-mut-shared-parens.stderr index aa7a760ded87..f428f9a18d4e 100644 --- a/tests/ui/statics/static-mut-shared-parens.stderr +++ b/tests/ui/statics/static-mut-shared-parens.stderr @@ -9,8 +9,9 @@ LL | let _ = unsafe { (&TEST) as *const usize }; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL | let _ = unsafe { (&raw const TEST) as *const usize }; - | ~~~~~~~~~~ +LL - let _ = unsafe { (&TEST) as *const usize }; +LL + let _ = unsafe { (&raw const TEST) as *const usize }; + | warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-shared-parens.rs:11:22 @@ -22,8 +23,9 @@ LL | let _ = unsafe { ((&mut TEST)) as *const usize }; = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives help: use `&raw mut` instead to create a raw pointer | -LL | let _ = unsafe { ((&raw mut TEST)) as *const usize }; - | ~~~~~~~~ +LL - let _ = unsafe { ((&mut TEST)) as *const usize }; +LL + let _ = unsafe { ((&raw mut TEST)) as *const usize }; + | warning: 2 warnings emitted diff --git a/tests/ui/statics/static-mut-xc.stderr b/tests/ui/statics/static-mut-xc.stderr index 176deb518fce..d03835c30d8b 100644 --- a/tests/ui/statics/static-mut-xc.stderr +++ b/tests/ui/statics/static-mut-xc.stderr @@ -54,8 +54,9 @@ LL | static_bound(&static_mut_xc::a); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL | static_bound(&raw const static_mut_xc::a); - | ~~~~~~~~~~ +LL - static_bound(&static_mut_xc::a); +LL + static_bound(&raw const static_mut_xc::a); + | warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-xc.rs:35:22 @@ -67,8 +68,9 @@ LL | static_bound_set(&mut static_mut_xc::a); = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives help: use `&raw mut` instead to create a raw pointer | -LL | static_bound_set(&raw mut static_mut_xc::a); - | ~~~~~~~~ +LL - static_bound_set(&mut static_mut_xc::a); +LL + static_bound_set(&raw mut static_mut_xc::a); + | warning: 7 warnings emitted diff --git a/tests/ui/statics/static-recursive.stderr b/tests/ui/statics/static-recursive.stderr index f2dd5b8a6cfe..8ea997fa2140 100644 --- a/tests/ui/statics/static-recursive.stderr +++ b/tests/ui/statics/static-recursive.stderr @@ -9,8 +9,9 @@ LL | static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 }; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL | static mut S: *const u8 = unsafe { &raw const S as *const *const u8 as *const u8 }; - | ~~~~~~~~~~ +LL - static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 }; +LL + static mut S: *const u8 = unsafe { &raw const S as *const *const u8 as *const u8 }; + | warning: creating a shared reference to mutable static is discouraged --> $DIR/static-recursive.rs:19:20 diff --git a/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr b/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr index 47b17f9fcd7a..6a8a7b152c54 100644 --- a/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr +++ b/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr @@ -9,8 +9,9 @@ note: if you're trying to build a new `AtomicU64`, consider using `AtomicU64::ne = note: this error originates in the macro `atomic_int` (in Nightly builds, run with -Z macro-backtrace for more info) help: there is an associated function `from` with a similar name | -LL | core::sync::atomic::AtomicU64::from(&mut 0u64); - | ~~~~ +LL - core::sync::atomic::AtomicU64::from_mut(&mut 0u64); +LL + core::sync::atomic::AtomicU64::from(&mut 0u64); + | error: aborting due to 1 previous error diff --git a/tests/ui/str/str-as-char.stderr b/tests/ui/str/str-as-char.stderr index 0638d371c173..b2c716fa4f56 100644 --- a/tests/ui/str/str-as-char.stderr +++ b/tests/ui/str/str-as-char.stderr @@ -6,8 +6,9 @@ LL | println!('●●'); | help: if you meant to write a string literal, use double quotes | -LL | println!("●●"); - | ~ ~ +LL - println!('●●'); +LL + println!("●●"); + | error: aborting due to 1 previous error diff --git a/tests/ui/structs-enums/issue-103869.stderr b/tests/ui/structs-enums/issue-103869.stderr index 2334e5e9712c..10e0f29f8762 100644 --- a/tests/ui/structs-enums/issue-103869.stderr +++ b/tests/ui/structs-enums/issue-103869.stderr @@ -10,8 +10,9 @@ LL | vec: Vec, = help: enum variants can be `Variant`, `Variant = `, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` help: perhaps you meant to use `struct` here | -LL | struct VecOrMap { - | ~~~~~~ +LL - enum VecOrMap { +LL + struct VecOrMap { + | error: aborting due to 1 previous error diff --git a/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.stderr b/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.stderr index 664a00e3303e..231bada006cd 100644 --- a/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.stderr +++ b/tests/ui/structs-enums/struct-enum-ignoring-field-with-underscore.stderr @@ -6,8 +6,9 @@ LL | if let Some(Foo::Bar {_}) = foo {} | help: to omit remaining fields, use `..` | -LL | if let Some(Foo::Bar {..}) = foo {} - | ~~ +LL - if let Some(Foo::Bar {_}) = foo {} +LL + if let Some(Foo::Bar {..}) = foo {} + | error: aborting due to 1 previous error diff --git a/tests/ui/structs/default-field-values/non-exhaustive-ctor.disabled.stderr b/tests/ui/structs/default-field-values/non-exhaustive-ctor.disabled.stderr index 637934256570..c7689cfd323a 100644 --- a/tests/ui/structs/default-field-values/non-exhaustive-ctor.disabled.stderr +++ b/tests/ui/structs/default-field-values/non-exhaustive-ctor.disabled.stderr @@ -66,8 +66,9 @@ LL | let _ = S { }; | help: all remaining fields have default values, if you added `#![feature(default_field_values)]` to your crate you could use those values with `..` | -LL | let _ = S { .. }; - | ~~~~~~ +LL - let _ = S { }; +LL + let _ = S { .. }; + | error[E0063]: missing fields `field1` and `field2` in initializer of `S` --> $DIR/non-exhaustive-ctor.rs:26:13 diff --git a/tests/ui/structs/default-field-values/non-exhaustive-ctor.enabled.stderr b/tests/ui/structs/default-field-values/non-exhaustive-ctor.enabled.stderr index 6d035ebdc475..d9b8e76aa0de 100644 --- a/tests/ui/structs/default-field-values/non-exhaustive-ctor.enabled.stderr +++ b/tests/ui/structs/default-field-values/non-exhaustive-ctor.enabled.stderr @@ -6,8 +6,9 @@ LL | let _ = S { }; | help: all remaining fields have default values, you can use those values with `..` | -LL | let _ = S { .. }; - | ~~~~~~ +LL - let _ = S { }; +LL + let _ = S { .. }; + | error[E0063]: missing fields `field1` and `field2` in initializer of `S` --> $DIR/non-exhaustive-ctor.rs:26:13 diff --git a/tests/ui/structs/struct-field-cfg.stderr b/tests/ui/structs/struct-field-cfg.stderr index f30d343d5828..2bca6f302db7 100644 --- a/tests/ui/structs/struct-field-cfg.stderr +++ b/tests/ui/structs/struct-field-cfg.stderr @@ -20,16 +20,19 @@ LL | let Foo { #[cfg(any())] present: () } = foo; | help: include the missing field in the pattern | -LL | let Foo { present } = foo; - | ~~~~~~~~~~~ +LL - let Foo { #[cfg(any())] present: () } = foo; +LL + let Foo { present } = foo; + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | let Foo { present: _ } = foo; - | ~~~~~~~~~~~~~~ +LL - let Foo { #[cfg(any())] present: () } = foo; +LL + let Foo { present: _ } = foo; + | help: or always ignore missing fields here | -LL | let Foo { .. } = foo; - | ~~~~~~ +LL - let Foo { #[cfg(any())] present: () } = foo; +LL + let Foo { .. } = foo; + | error[E0026]: struct `Foo` does not have a field named `absent` --> $DIR/struct-field-cfg.rs:16:42 diff --git a/tests/ui/structs/struct-fields-hints-no-dupe.stderr b/tests/ui/structs/struct-fields-hints-no-dupe.stderr index 2b88d802833c..650f6ddfa88b 100644 --- a/tests/ui/structs/struct-fields-hints-no-dupe.stderr +++ b/tests/ui/structs/struct-fields-hints-no-dupe.stderr @@ -6,8 +6,9 @@ LL | bar : 42, | help: a field with a similar name exists | -LL | barr : 42, - | ~~~~ +LL - bar : 42, +LL + barr : 42, + | error: aborting due to 1 previous error diff --git a/tests/ui/structs/struct-fields-hints.stderr b/tests/ui/structs/struct-fields-hints.stderr index 8217d7a6e811..6526e49600ec 100644 --- a/tests/ui/structs/struct-fields-hints.stderr +++ b/tests/ui/structs/struct-fields-hints.stderr @@ -6,8 +6,9 @@ LL | bar : 42, | help: a field with a similar name exists | -LL | car : 42, - | ~~~ +LL - bar : 42, +LL + car : 42, + | error: aborting due to 1 previous error diff --git a/tests/ui/structs/struct-fields-typo.stderr b/tests/ui/structs/struct-fields-typo.stderr index d87bace72773..dacf2ecea17c 100644 --- a/tests/ui/structs/struct-fields-typo.stderr +++ b/tests/ui/structs/struct-fields-typo.stderr @@ -6,8 +6,9 @@ LL | let x = foo.baa; | help: a field with a similar name exists | -LL | let x = foo.bar; - | ~~~ +LL - let x = foo.baa; +LL + let x = foo.bar; + | error: aborting due to 1 previous error diff --git a/tests/ui/structs/struct-pat-derived-error.stderr b/tests/ui/structs/struct-pat-derived-error.stderr index d1d68121cf16..a086de089830 100644 --- a/tests/ui/structs/struct-pat-derived-error.stderr +++ b/tests/ui/structs/struct-pat-derived-error.stderr @@ -6,8 +6,9 @@ LL | let A { x, y } = self.d; | help: a field with a similar name exists | -LL | let A { x, y } = self.b; - | ~ +LL - let A { x, y } = self.d; +LL + let A { x, y } = self.b; + | error[E0026]: struct `A` does not have fields named `x`, `y` --> $DIR/struct-pat-derived-error.rs:8:17 @@ -23,16 +24,19 @@ LL | let A { x, y } = self.d; | help: include the missing fields in the pattern | -LL | let A { x, y, b, c } = self.d; - | ~~~~~~~~ +LL - let A { x, y } = self.d; +LL + let A { x, y, b, c } = self.d; + | help: if you don't care about these missing fields, you can explicitly ignore them | -LL | let A { x, y, b: _, c: _ } = self.d; - | ~~~~~~~~~~~~~~ +LL - let A { x, y } = self.d; +LL + let A { x, y, b: _, c: _ } = self.d; + | help: or always ignore missing fields here | -LL | let A { x, y, .. } = self.d; - | ~~~~~~ +LL - let A { x, y } = self.d; +LL + let A { x, y, .. } = self.d; + | error: aborting due to 3 previous errors diff --git a/tests/ui/structs/struct-path-self-type-mismatch.stderr b/tests/ui/structs/struct-path-self-type-mismatch.stderr index bbe5bae29bbe..6517d7f00ddb 100644 --- a/tests/ui/structs/struct-path-self-type-mismatch.stderr +++ b/tests/ui/structs/struct-path-self-type-mismatch.stderr @@ -44,8 +44,9 @@ LL | | } = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters help: use the type name directly | -LL | Foo:: { - | ~~~~~~~~ +LL - Self { +LL + Foo:: { + | error: aborting due to 3 previous errors diff --git a/tests/ui/structs/struct-tuple-field-names.stderr b/tests/ui/structs/struct-tuple-field-names.stderr index 5f1ab2f9d682..7692010aa543 100644 --- a/tests/ui/structs/struct-tuple-field-names.stderr +++ b/tests/ui/structs/struct-tuple-field-names.stderr @@ -6,8 +6,9 @@ LL | E::S { 0, 1 } => {} | help: use the tuple variant pattern syntax instead | -LL | E::S(_, _) => {} - | ~~~~~~ +LL - E::S { 0, 1 } => {} +LL + E::S(_, _) => {} + | error[E0769]: tuple variant `S` written as struct variant --> $DIR/struct-tuple-field-names.rs:13:9 @@ -17,8 +18,9 @@ LL | S { } => {} | help: use the tuple variant pattern syntax instead | -LL | S(_, _) => {} - | ~~~~~~ +LL - S { } => {} +LL + S(_, _) => {} + | error[E0027]: pattern does not mention field `1` --> $DIR/struct-tuple-field-names.rs:16:12 @@ -28,16 +30,19 @@ LL | if let E::S { 0: a } = x { | help: include the missing field in the pattern | -LL | if let E::S { 0: a, 1: _ } = x { - | ~~~~~~~~ +LL - if let E::S { 0: a } = x { +LL + if let E::S { 0: a, 1: _ } = x { + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | if let E::S { 0: a, 1: _ } = x { - | ~~~~~~~~ +LL - if let E::S { 0: a } = x { +LL + if let E::S { 0: a, 1: _ } = x { + | help: or always ignore missing fields here | -LL | if let E::S { 0: a, .. } = x { - | ~~~~~~ +LL - if let E::S { 0: a } = x { +LL + if let E::S { 0: a, .. } = x { + | error: aborting due to 3 previous errors diff --git a/tests/ui/structs/suggest-private-fields.stderr b/tests/ui/structs/suggest-private-fields.stderr index f67a4ed78e29..adf90f0e1fd6 100644 --- a/tests/ui/structs/suggest-private-fields.stderr +++ b/tests/ui/structs/suggest-private-fields.stderr @@ -6,8 +6,9 @@ LL | aa: 20, | help: a field with a similar name exists | -LL | a: 20, - | ~ +LL - aa: 20, +LL + a: 20, + | error[E0560]: struct `B` has no field named `bb` --> $DIR/suggest-private-fields.rs:17:9 @@ -25,8 +26,9 @@ LL | aa: 20, | help: a field with a similar name exists | -LL | a: 20, - | ~ +LL - aa: 20, +LL + a: 20, + | error[E0560]: struct `A` has no field named `bb` --> $DIR/suggest-private-fields.rs:24:9 @@ -36,8 +38,9 @@ LL | bb: 20, | help: a field with a similar name exists | -LL | b: 20, - | ~ +LL - bb: 20, +LL + b: 20, + | error: aborting due to 4 previous errors diff --git a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr index af530e2b7593..befc6a1b538a 100644 --- a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr +++ b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr @@ -15,16 +15,19 @@ LL | Foo::Bar { a, aa: 1, c } => (), | help: include the missing field in the pattern | -LL | Foo::Bar { a, aa: 1, c, b } => (), - | ~~~~~ +LL - Foo::Bar { a, aa: 1, c } => (), +LL + Foo::Bar { a, aa: 1, c, b } => (), + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | Foo::Bar { a, aa: 1, c, b: _ } => (), - | ~~~~~~~~ +LL - Foo::Bar { a, aa: 1, c } => (), +LL + Foo::Bar { a, aa: 1, c, b: _ } => (), + | help: or always ignore missing fields here | -LL | Foo::Bar { a, aa: 1, c, .. } => (), - | ~~~~~~ +LL - Foo::Bar { a, aa: 1, c } => (), +LL + Foo::Bar { a, aa: 1, c, .. } => (), + | error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:13:20 @@ -43,16 +46,19 @@ LL | Foo::Baz { bb: 1.0 } => (), | help: include the missing field in the pattern | -LL | Foo::Baz { bb: 1.0, a } => (), - | ~~~~~ +LL - Foo::Baz { bb: 1.0 } => (), +LL + Foo::Baz { bb: 1.0, a } => (), + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | Foo::Baz { bb: 1.0, a: _ } => (), - | ~~~~~~~~ +LL - Foo::Baz { bb: 1.0 } => (), +LL + Foo::Baz { bb: 1.0, a: _ } => (), + | help: or always ignore missing fields here | -LL | Foo::Baz { bb: 1.0, .. } => (), - | ~~~~~~ +LL - Foo::Baz { bb: 1.0 } => (), +LL + Foo::Baz { bb: 1.0, .. } => (), + | error[E0026]: variant `Foo::Bar` does not have a field named `aa` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:20:23 @@ -68,16 +74,19 @@ LL | Foo::Bar { a, aa: "", c } => (), | help: include the missing field in the pattern | -LL | Foo::Bar { a, aa: "", c, b } => (), - | ~~~~~ +LL - Foo::Bar { a, aa: "", c } => (), +LL + Foo::Bar { a, aa: "", c, b } => (), + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | Foo::Bar { a, aa: "", c, b: _ } => (), - | ~~~~~~~~ +LL - Foo::Bar { a, aa: "", c } => (), +LL + Foo::Bar { a, aa: "", c, b: _ } => (), + | help: or always ignore missing fields here | -LL | Foo::Bar { a, aa: "", c, .. } => (), - | ~~~~~~ +LL - Foo::Bar { a, aa: "", c } => (), +LL + Foo::Bar { a, aa: "", c, .. } => (), + | error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:23:20 @@ -93,16 +102,19 @@ LL | Foo::Baz { bb: "" } => (), | help: include the missing field in the pattern | -LL | Foo::Baz { bb: "", a } => (), - | ~~~~~ +LL - Foo::Baz { bb: "" } => (), +LL + Foo::Baz { bb: "", a } => (), + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | Foo::Baz { bb: "", a: _ } => (), - | ~~~~~~~~ +LL - Foo::Baz { bb: "" } => (), +LL + Foo::Baz { bb: "", a: _ } => (), + | help: or always ignore missing fields here | -LL | Foo::Baz { bb: "", .. } => (), - | ~~~~~~ +LL - Foo::Baz { bb: "" } => (), +LL + Foo::Baz { bb: "", .. } => (), + | error: aborting due to 8 previous errors diff --git a/tests/ui/suggestions/ambiguous-assoc-type-path-suggest-similar-item.stderr b/tests/ui/suggestions/ambiguous-assoc-type-path-suggest-similar-item.stderr index 5863aa28f41f..76e3c21473d6 100644 --- a/tests/ui/suggestions/ambiguous-assoc-type-path-suggest-similar-item.stderr +++ b/tests/ui/suggestions/ambiguous-assoc-type-path-suggest-similar-item.stderr @@ -6,8 +6,9 @@ LL | String::from::utf8; | help: there is an associated function with a similar name: `from_utf8` | -LL | String::from_utf8; - | ~~~~~~~~~ +LL - String::from::utf8; +LL + String::from_utf8; + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:16:5 @@ -17,8 +18,9 @@ LL | String::from::utf8(); | help: there is an associated function with a similar name: `from_utf8` | -LL | String::from_utf8(); - | ~~~~~~~~~ +LL - String::from::utf8(); +LL + String::from_utf8(); + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:19:5 @@ -28,8 +30,9 @@ LL | String::from::utf16(); | help: there is an associated function with a similar name: `from_utf16` | -LL | String::from_utf16(); - | ~~~~~~~~~~ +LL - String::from::utf16(); +LL + String::from_utf16(); + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:22:5 @@ -39,8 +42,9 @@ LL | String::from::method_that_doesnt_exist(); | help: if there were a trait named `Example` with associated type `from` implemented for `String`, you could use the fully-qualified path | -LL | ::from::method_that_doesnt_exist(); - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - String::from::method_that_doesnt_exist(); +LL + ::from::method_that_doesnt_exist(); + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:25:5 @@ -50,8 +54,9 @@ LL | str::into::string(); | help: there is an associated function with a similar name: `into_string` | -LL | str::into_string(); - | ~~~~~~~~~~~ +LL - str::into::string(); +LL + str::into_string(); + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:28:5 @@ -61,8 +66,9 @@ LL | str::char::indices(); | help: there is an associated function with a similar name: `char_indices` | -LL | str::char_indices(); - | ~~~~~~~~~~~~ +LL - str::char::indices(); +LL + str::char_indices(); + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:31:5 @@ -72,8 +78,9 @@ LL | Foo::bar::baz; | help: there is an associated function with a similar name: `bar_baz` | -LL | Foo::bar_baz; - | ~~~~~~~ +LL - Foo::bar::baz; +LL + Foo::bar_baz; + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:34:5 @@ -83,8 +90,9 @@ LL | Foo::bar::quux; | help: there is an associated function with a similar name: `bar_quux` | -LL | Foo::bar_quux; - | ~~~~~~~~ +LL - Foo::bar::quux; +LL + Foo::bar_quux; + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:37:5 @@ -94,8 +102,9 @@ LL | Foo::bar::fizz; | help: if there were a trait named `Example` with associated type `bar` implemented for `Foo`, you could use the fully-qualified path | -LL | ::bar::fizz; - | ~~~~~~~~~~~~~~~~~~~~~ +LL - Foo::bar::fizz; +LL + ::bar::fizz; + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:40:5 @@ -105,8 +114,9 @@ LL | i32::wrapping::add; | help: there is an associated function with a similar name: `wrapping_add` | -LL | i32::wrapping_add; - | ~~~~~~~~~~~~ +LL - i32::wrapping::add; +LL + i32::wrapping_add; + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:43:5 @@ -116,8 +126,9 @@ LL | i32::wrapping::method_that_doesnt_exist; | help: if there were a trait named `Example` with associated type `wrapping` implemented for `i32`, you could use the fully-qualified path | -LL | ::wrapping::method_that_doesnt_exist; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - i32::wrapping::method_that_doesnt_exist; +LL + ::wrapping::method_that_doesnt_exist; + | error[E0223]: ambiguous associated type --> $DIR/ambiguous-assoc-type-path-suggest-similar-item.rs:48:5 @@ -127,8 +138,9 @@ LL | ::downcast::mut_unchecked; | help: if there were a trait named `Example` with associated type `downcast` implemented for `(dyn Any + 'static)`, you could use the fully-qualified path | -LL | <(dyn Any + 'static) as Example>::downcast::mut_unchecked; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - ::downcast::mut_unchecked; +LL + <(dyn Any + 'static) as Example>::downcast::mut_unchecked; + | error: aborting due to 12 previous errors diff --git a/tests/ui/suggestions/args-instead-of-tuple-errors.stderr b/tests/ui/suggestions/args-instead-of-tuple-errors.stderr index 1051a16b40d7..8644f4a1dd45 100644 --- a/tests/ui/suggestions/args-instead-of-tuple-errors.stderr +++ b/tests/ui/suggestions/args-instead-of-tuple-errors.stderr @@ -60,8 +60,9 @@ note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL help: provide the argument | -LL | let _: Option<(i8,)> = Some(/* (i8,) */); - | ~~~~~~~~~~~~~ +LL - let _: Option<(i8,)> = Some(); +LL + let _: Option<(i8,)> = Some(/* (i8,) */); + | error[E0308]: mismatched types --> $DIR/args-instead-of-tuple-errors.rs:14:34 diff --git a/tests/ui/suggestions/args-instead-of-tuple.stderr b/tests/ui/suggestions/args-instead-of-tuple.stderr index 3ca560f93eb7..4b0bab971ee7 100644 --- a/tests/ui/suggestions/args-instead-of-tuple.stderr +++ b/tests/ui/suggestions/args-instead-of-tuple.stderr @@ -34,8 +34,9 @@ note: tuple variant defined here --> $SRC_DIR/core/src/option.rs:LL:COL help: provide the argument | -LL | let _: Option<()> = Some(()); - | ~~~~ +LL - let _: Option<()> = Some(); +LL + let _: Option<()> = Some(()); + | error[E0308]: mismatched types --> $DIR/args-instead-of-tuple.rs:14:34 diff --git a/tests/ui/suggestions/assoc-const-as-field.stderr b/tests/ui/suggestions/assoc-const-as-field.stderr index 6c095e52ac9e..54b7ff39926f 100644 --- a/tests/ui/suggestions/assoc-const-as-field.stderr +++ b/tests/ui/suggestions/assoc-const-as-field.stderr @@ -6,8 +6,9 @@ LL | foo(Mod::Foo.Bar); | help: use the path separator to refer to an item | -LL | foo(Mod::Foo::Bar); - | ~~ +LL - foo(Mod::Foo.Bar); +LL + foo(Mod::Foo::Bar); + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr b/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr index 8f00a72f1e81..6d6fd9830384 100644 --- a/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr +++ b/tests/ui/suggestions/assoc-ct-for-assoc-method.stderr @@ -10,8 +10,9 @@ LL | let x: i32 = MyS::foo; found fn item `fn() -> MyS {MyS::foo}` help: try referring to the associated const `FOO` instead (notice the capitalization difference) | -LL | let x: i32 = MyS::FOO; - | ~~~ +LL - let x: i32 = MyS::foo; +LL + let x: i32 = MyS::FOO; + | error[E0308]: mismatched types --> $DIR/assoc-ct-for-assoc-method.rs:15:18 @@ -25,8 +26,9 @@ LL | let z: i32 = i32::max; found fn item `fn(i32, i32) -> i32 {::max}` help: try referring to the associated const `MAX` instead | -LL | let z: i32 = i32::MAX; - | ~~~ +LL - let z: i32 = i32::max; +LL + let z: i32 = i32::MAX; + | error[E0369]: cannot subtract `{integer}` from `fn(i32, i32) -> i32 {::max}` --> $DIR/assoc-ct-for-assoc-method.rs:22:27 diff --git a/tests/ui/suggestions/bad-hex-float-lit.stderr b/tests/ui/suggestions/bad-hex-float-lit.stderr index bc09abb1a567..94c0715a4e68 100644 --- a/tests/ui/suggestions/bad-hex-float-lit.stderr +++ b/tests/ui/suggestions/bad-hex-float-lit.stderr @@ -8,10 +8,12 @@ LL | let _f: f32 = 0xAAf32; | help: rewrite this as a decimal floating point literal, or use `as` to turn a hex literal into a float | -LL | let _f: f32 = 0xAA as f32; - | ~~~~~~~~~~~ -LL | let _f: f32 = 170_f32; - | ~~~~~~~ +LL - let _f: f32 = 0xAAf32; +LL + let _f: f32 = 0xAA as f32; + | +LL - let _f: f32 = 0xAAf32; +LL + let _f: f32 = 170_f32; + | error[E0308]: mismatched types --> $DIR/bad-hex-float-lit.rs:6:19 @@ -23,10 +25,12 @@ LL | let _f: f32 = 0xAB_f32; | help: rewrite this as a decimal floating point literal, or use `as` to turn a hex literal into a float | -LL | let _f: f32 = 0xAB as f32; - | ~~~~~~~~~~~ -LL | let _f: f32 = 171_f32; - | ~~~~~~~ +LL - let _f: f32 = 0xAB_f32; +LL + let _f: f32 = 0xAB as f32; + | +LL - let _f: f32 = 0xAB_f32; +LL + let _f: f32 = 171_f32; + | error[E0308]: mismatched types --> $DIR/bad-hex-float-lit.rs:10:19 @@ -38,10 +42,12 @@ LL | let _f: f64 = 0xFF_f64; | help: rewrite this as a decimal floating point literal, or use `as` to turn a hex literal into a float | -LL | let _f: f64 = 0xFF as f64; - | ~~~~~~~~~~~ -LL | let _f: f64 = 255_f64; - | ~~~~~~~ +LL - let _f: f64 = 0xFF_f64; +LL + let _f: f64 = 0xFF as f64; + | +LL - let _f: f64 = 0xFF_f64; +LL + let _f: f64 = 255_f64; + | error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/bad-infer-in-trait-impl.stderr b/tests/ui/suggestions/bad-infer-in-trait-impl.stderr index 50c398de2b08..68d8f5402e44 100644 --- a/tests/ui/suggestions/bad-infer-in-trait-impl.stderr +++ b/tests/ui/suggestions/bad-infer-in-trait-impl.stderr @@ -6,8 +6,9 @@ LL | fn bar(s: _) {} | help: use type parameters instead | -LL | fn bar(s: T) {} - | +++ ~ +LL - fn bar(s: _) {} +LL + fn bar(s: T) {} + | error[E0050]: method `bar` has 1 parameter but the declaration in trait `Foo::bar` has 0 --> $DIR/bad-infer-in-trait-impl.rs:6:15 diff --git a/tests/ui/suggestions/bool_typo_err_suggest.stderr b/tests/ui/suggestions/bool_typo_err_suggest.stderr index 8d59ed63e543..faf799d0fda2 100644 --- a/tests/ui/suggestions/bool_typo_err_suggest.stderr +++ b/tests/ui/suggestions/bool_typo_err_suggest.stderr @@ -6,8 +6,9 @@ LL | let x = True; | help: you may want to use a bool value instead | -LL | let x = true; - | ~~~~ +LL - let x = True; +LL + let x = true; + | error[E0425]: cannot find value `False` in this scope --> $DIR/bool_typo_err_suggest.rs:9:13 @@ -17,8 +18,9 @@ LL | let y = False; | help: you may want to use a bool value instead (notice the capitalization difference) | -LL | let y = false; - | ~~~~~ +LL - let y = False; +LL + let y = false; + | error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/bound-suggestions.stderr b/tests/ui/suggestions/bound-suggestions.stderr index e30deb11398e..51a6a51e7da9 100644 --- a/tests/ui/suggestions/bound-suggestions.stderr +++ b/tests/ui/suggestions/bound-suggestions.stderr @@ -43,8 +43,9 @@ LL | println!("{:?} {:?}", x, y); = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting type parameter `Y` with trait `Debug` | -LL | fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { - | ~~~~~~~~~~~~~~~~~~~~ +LL - fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, { +LL + fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { + | error[E0277]: `X` doesn't implement `Debug` --> $DIR/bound-suggestions.rs:33:22 diff --git a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr index 4f92d3aceefe..55a353c40ca3 100644 --- a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr +++ b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr @@ -12,8 +12,9 @@ LL | const A: i32 = 2; = note: the matched value is of type `i32` help: introduce a variable instead | -LL | let A_var = 3; - | ~~~~~ +LL - let A = 3; +LL + let A_var = 3; + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/crate-or-module-typo.stderr b/tests/ui/suggestions/crate-or-module-typo.stderr index 75aa6e614b64..0ca0582105be 100644 --- a/tests/ui/suggestions/crate-or-module-typo.stderr +++ b/tests/ui/suggestions/crate-or-module-typo.stderr @@ -6,8 +6,9 @@ LL | use st::cell::Cell; | help: there is a crate or module with a similar name | -LL | use std::cell::Cell; - | ~~~ +LL - use st::cell::Cell; +LL + use std::cell::Cell; + | error[E0432]: unresolved import `bas` --> $DIR/crate-or-module-typo.rs:11:5 @@ -17,8 +18,9 @@ LL | use bas::bar; | help: there is a crate or module with a similar name | -LL | use bar::bar; - | ~~~ +LL - use bas::bar; +LL + use bar::bar; + | error[E0433]: failed to resolve: use of unresolved module or unlinked crate `st` --> $DIR/crate-or-module-typo.rs:14:10 @@ -28,8 +30,9 @@ LL | bar: st::cell::Cell | help: there is a crate or module with a similar name | -LL | bar: std::cell::Cell - | ~~~ +LL - bar: st::cell::Cell +LL + bar: std::cell::Cell + | help: consider importing this module | LL + use std::cell; diff --git a/tests/ui/suggestions/deref-path-method.stderr b/tests/ui/suggestions/deref-path-method.stderr index bfcc2307fd7f..dc2f6f66437e 100644 --- a/tests/ui/suggestions/deref-path-method.stderr +++ b/tests/ui/suggestions/deref-path-method.stderr @@ -13,8 +13,9 @@ note: if you're trying to build a new `Vec<_, _>` consider using one of the foll --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL help: the function `contains` is implemented on `[_]` | -LL | <[_]>::contains(&vec, &0); - | ~~~~~ +LL - Vec::contains(&vec, &0); +LL + <[_]>::contains(&vec, &0); + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/dont-suggest-try_into-in-macros.stderr b/tests/ui/suggestions/dont-suggest-try_into-in-macros.stderr index 348f7e00d468..53fdb5880c06 100644 --- a/tests/ui/suggestions/dont-suggest-try_into-in-macros.stderr +++ b/tests/ui/suggestions/dont-suggest-try_into-in-macros.stderr @@ -6,8 +6,9 @@ LL | assert_eq!(10u64, 10usize); | help: change the type of the numeric literal from `usize` to `u64` | -LL | assert_eq!(10u64, 10u64); - | ~~~ +LL - assert_eq!(10u64, 10usize); +LL + assert_eq!(10u64, 10u64); + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr index 404df206e189..20aa227d10f9 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021-without-dyn.stderr @@ -7,8 +7,9 @@ LL | fn f(a: A) -> A; = note: `A` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `A` | -LL | fn f(a: T) -> A; - | ++++++ ~ +LL - fn f(a: A) -> A; +LL + fn f(a: T) -> A; + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn f(a: impl A) -> A; @@ -34,8 +35,9 @@ LL | fn f(b: B) -> B; = note: `B` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `B` | -LL | fn f(b: T) -> B; - | ++++++ ~ +LL - fn f(b: B) -> B; +LL + fn f(b: T) -> B; + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn f(b: impl B) -> B; @@ -61,8 +63,9 @@ LL | fn f(&self, c: C) -> C; = note: `C` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `C` | -LL | fn f(&self, c: T) -> C; - | ++++++ ~ +LL - fn f(&self, c: C) -> C; +LL + fn f(&self, c: T) -> C; + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn f(&self, c: impl C) -> C; @@ -89,8 +92,9 @@ LL | fn f(a: A) -> A; | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn f(a: Self) -> Self; - | ~~~~ ~~~~ +LL - fn f(a: A) -> A; +LL + fn f(a: Self) -> Self; + | error: associated item referring to unboxed trait object for its own trait --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:10:13 @@ -102,8 +106,9 @@ LL | fn f(b: B) -> B; | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn f(b: Self) -> Self; - | ~~~~ ~~~~ +LL - fn f(b: B) -> B; +LL + fn f(b: Self) -> Self; + | error: associated item referring to unboxed trait object for its own trait --> $DIR/dyn-incompatible-trait-should-use-self-2021-without-dyn.rs:16:20 @@ -115,8 +120,9 @@ LL | fn f(&self, c: C) -> C; | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn f(&self, c: Self) -> Self; - | ~~~~ ~~~~ +LL - fn f(&self, c: C) -> C; +LL + fn f(&self, c: Self) -> Self; + | error: aborting due to 9 previous errors diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021.stderr index 742011ad0c0e..2e3919db1b75 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self-2021.stderr @@ -8,8 +8,9 @@ LL | fn f(a: dyn A) -> dyn A; | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn f(a: Self) -> Self; - | ~~~~ ~~~~ +LL - fn f(a: dyn A) -> dyn A; +LL + fn f(a: Self) -> Self; + | error[E0038]: the trait `A` is not dyn compatible --> $DIR/dyn-incompatible-trait-should-use-self-2021.rs:4:13 @@ -36,8 +37,9 @@ LL | fn f(a: dyn B) -> dyn B; | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn f(a: Self) -> Self; - | ~~~~ ~~~~ +LL - fn f(a: dyn B) -> dyn B; +LL + fn f(a: Self) -> Self; + | error[E0038]: the trait `B` is not dyn compatible --> $DIR/dyn-incompatible-trait-should-use-self-2021.rs:9:13 diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self.stderr index 843c139851de..f4b669d7fcd4 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-self.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-self.stderr @@ -8,8 +8,9 @@ LL | fn f(a: A) -> A; | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn f(a: Self) -> Self; - | ~~~~ ~~~~ +LL - fn f(a: A) -> A; +LL + fn f(a: Self) -> Self; + | error[E0038]: the trait `A` is not dyn compatible --> $DIR/dyn-incompatible-trait-should-use-self.rs:3:13 @@ -36,8 +37,9 @@ LL | fn f(a: B) -> B; | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn f(a: Self) -> Self; - | ~~~~ ~~~~ +LL - fn f(a: B) -> B; +LL + fn f(a: Self) -> Self; + | error[E0038]: the trait `B` is not dyn compatible --> $DIR/dyn-incompatible-trait-should-use-self.rs:8:13 diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr index e2250807603b..ac93c5df05e0 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr @@ -20,12 +20,14 @@ LL | fn foo(&self) where Self: Other, { } | +++++ help: alternatively, consider constraining `foo` so it does not apply to trait objects | -LL | fn foo() where Self: Other, Self: Sized { } - | ~~~~~~~~~~~~~ +LL - fn foo() where Self: Other, { } +LL + fn foo() where Self: Other, Self: Sized { } + | help: consider changing method `bar`'s `self` parameter to be `&self` | -LL | fn bar(self: &Self) {} - | ~~~~~ +LL - fn bar(self: ()) {} +LL + fn bar(self: &Self) {} + | error[E0307]: invalid `self` parameter type: `()` --> $DIR/dyn-incompatible-trait-should-use-where-sized.rs:6:18 diff --git a/tests/ui/suggestions/field-access.stderr b/tests/ui/suggestions/field-access.stderr index 007bc6ecf937..4696950930f3 100644 --- a/tests/ui/suggestions/field-access.stderr +++ b/tests/ui/suggestions/field-access.stderr @@ -11,8 +11,9 @@ LL | if let B::Fst = a {}; | help: you might have meant to use field `b` whose type is `B` | -LL | if let B::Fst = a.b {}; - | ~~~ +LL - if let B::Fst = a {}; +LL + if let B::Fst = a.b {}; + | error[E0308]: mismatched types --> $DIR/field-access.rs:25:9 @@ -28,8 +29,9 @@ LL | B::Fst => (), | help: you might have meant to use field `b` whose type is `B` | -LL | match a.b { - | ~~~ +LL - match a { +LL + match a.b { + | error[E0308]: mismatched types --> $DIR/field-access.rs:26:9 @@ -45,8 +47,9 @@ LL | B::Snd => (), | help: you might have meant to use field `b` whose type is `B` | -LL | match a.b { - | ~~~ +LL - match a { +LL + match a.b { + | error[E0308]: mismatched types --> $DIR/field-access.rs:32:9 @@ -59,8 +62,9 @@ LL | 1u32 => (), | help: you might have meant to use field `bar` whose type is `u32` | -LL | match unsafe { foo.bar } { - | ~~~~~~~~~~~~~~~~~~ +LL - match foo { +LL + match unsafe { foo.bar } { + | error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/fn-to-method.normal.stderr b/tests/ui/suggestions/fn-to-method.normal.stderr index 502be79481ac..9bd9497ab4da 100644 --- a/tests/ui/suggestions/fn-to-method.normal.stderr +++ b/tests/ui/suggestions/fn-to-method.normal.stderr @@ -6,8 +6,9 @@ LL | let x = cmp(&1, &2); | help: use the `.` operator to call the method `Ord::cmp` on `&{integer}` | -LL | let x = (&1).cmp(&2); - | ~ ~~~~~~~~~ +LL - let x = cmp(&1, &2); +LL + let x = (&1).cmp(&2); + | error[E0425]: cannot find function `len` in this scope --> $DIR/fn-to-method.rs:16:13 diff --git a/tests/ui/suggestions/for-loop-missing-in.stderr b/tests/ui/suggestions/for-loop-missing-in.stderr index 61830b800a61..4e0cb229d50a 100644 --- a/tests/ui/suggestions/for-loop-missing-in.stderr +++ b/tests/ui/suggestions/for-loop-missing-in.stderr @@ -17,8 +17,9 @@ LL | for _i of 0..2 { | help: try using `in` here instead | -LL | for _i in 0..2 { - | ~~ +LL - for _i of 0..2 { +LL + for _i in 0..2 { + | error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/ice-unwrap-probe-many-result-125876.stderr b/tests/ui/suggestions/ice-unwrap-probe-many-result-125876.stderr index d610a3b7cadd..f943688e6578 100644 --- a/tests/ui/suggestions/ice-unwrap-probe-many-result-125876.stderr +++ b/tests/ui/suggestions/ice-unwrap-probe-many-result-125876.stderr @@ -31,8 +31,9 @@ LL | std::ptr::from_ref(num).cast_mut().as_deref(); | help: there is a method `as_ref` with a similar name | -LL | std::ptr::from_ref(num).cast_mut().as_ref(); - | ~~~~~~ +LL - std::ptr::from_ref(num).cast_mut().as_deref(); +LL + std::ptr::from_ref(num).cast_mut().as_ref(); + | error: aborting due to 2 previous errors; 2 warnings emitted diff --git a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr index 79fa468dc494..90dee9005aba 100644 --- a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr +++ b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr @@ -14,8 +14,9 @@ LL | fn foo(_: X) {} | ^^^^^ required by this bound in `foo` help: consider changing this borrow's mutability | -LL | foo(&mut s); - | ~~~~ +LL - foo(&s); +LL + foo(&mut s); + | error[E0277]: the trait bound `S: Trait` is not satisfied --> $DIR/imm-ref-trait-object-literal.rs:13:7 diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr index 30f4509d49de..299cf1d74d51 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr +++ b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr @@ -11,8 +11,9 @@ LL | fn g(mut x: impl Iterator) -> Option<&'static ()> { x.next( | +++++++ help: consider introducing a named lifetime parameter | -LL | fn g<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } - | ++++ ~~~ ~~~ +LL - fn g(mut x: impl Iterator) -> Option<&()> { x.next() } +LL + fn g<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } + | help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Iterator) -> Option<&()> { x.next() } @@ -32,8 +33,9 @@ LL | async fn i(mut x: impl Iterator) -> Option<&'static ()> { x | +++++++ help: consider introducing a named lifetime parameter | -LL | async fn i<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } - | ++++ ~~~ ~~~ +LL - async fn i(mut x: impl Iterator) -> Option<&()> { x.next() } +LL + async fn i<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } + | help: alternatively, you might want to return an owned value | LL - async fn i(mut x: impl Iterator) -> Option<&()> { x.next() } @@ -49,12 +51,14 @@ LL | fn g(mut x: impl Iterator) -> Option<&'_ ()> { x.next() = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values | -LL | fn g(mut x: impl Iterator) -> Option<&'static ()> { x.next() } - | ~~~~~~~ +LL - fn g(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } +LL + fn g(mut x: impl Iterator) -> Option<&'static ()> { x.next() } + | help: consider introducing a named lifetime parameter | -LL | fn g<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } - | ++++ ~~~ ~~~ +LL - fn g(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } +LL + fn g<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } + | help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } @@ -70,12 +74,14 @@ LL | async fn i(mut x: impl Iterator) -> Option<&'_ ()> { x.n = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values | -LL | async fn i(mut x: impl Iterator) -> Option<&'static ()> { x.next() } - | ~~~~~~~ +LL - async fn i(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } +LL + async fn i(mut x: impl Iterator) -> Option<&'static ()> { x.next() } + | help: consider introducing a named lifetime parameter | -LL | async fn i<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } - | ++++ ~~~ ~~~ +LL - async fn i(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } +LL + async fn i<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } + | help: alternatively, you might want to return an owned value | LL - async fn i(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } @@ -95,8 +101,9 @@ LL | fn g(mut x: impl Foo) -> Option<&'static ()> { x.next() } | +++++++ help: consider introducing a named lifetime parameter | -LL | fn g<'a>(mut x: impl Foo) -> Option<&'a ()> { x.next() } - | ++++ ~~~ +LL - fn g(mut x: impl Foo) -> Option<&()> { x.next() } +LL + fn g<'a>(mut x: impl Foo) -> Option<&'a ()> { x.next() } + | help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Foo) -> Option<&()> { x.next() } @@ -116,8 +123,9 @@ LL | fn g(mut x: impl Foo<()>) -> Option<&'static ()> { x.next() } | +++++++ help: consider introducing a named lifetime parameter | -LL | fn g<'a>(mut x: impl Foo<()>) -> Option<&'a ()> { x.next() } - | ++++ ~~~ +LL - fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() } +LL + fn g<'a>(mut x: impl Foo<()>) -> Option<&'a ()> { x.next() } + | help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() } @@ -176,8 +184,9 @@ LL | fn f(_: impl Iterator) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date help: consider introducing a named lifetime parameter | -LL | fn f<'a>(_: impl Iterator) {} - | ++++ ~~ +LL - fn f(_: impl Iterator) {} +LL + fn f<'a>(_: impl Iterator) {} + | error[E0658]: anonymous lifetimes in `impl Trait` are unstable --> $DIR/impl-trait-missing-lifetime-gated.rs:28:39 @@ -189,8 +198,9 @@ LL | fn g(mut x: impl Iterator) -> Option<&'_ ()> { x.next() = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date help: consider introducing a named lifetime parameter | -LL | fn g<'a>(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } - | ++++ ~~ +LL - fn g(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } +LL + fn g<'a>(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } + | error: lifetime may not live long enough --> $DIR/impl-trait-missing-lifetime-gated.rs:38:73 diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime.stderr b/tests/ui/suggestions/impl-trait-missing-lifetime.stderr index 70998b67c04b..dfbc883680b2 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime.stderr +++ b/tests/ui/suggestions/impl-trait-missing-lifetime.stderr @@ -7,12 +7,14 @@ LL | fn g(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values | -LL | fn g(mut x: impl Iterator) -> Option<&'static ()> { x.next() } - | ~~~~~~~ +LL - fn g(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } +LL + fn g(mut x: impl Iterator) -> Option<&'static ()> { x.next() } + | help: consider introducing a named lifetime parameter | -LL | fn g<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } - | ++++ ~~~ ~~~ +LL - fn g(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } +LL + fn g<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } + | help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } @@ -28,12 +30,14 @@ LL | async fn i(mut x: impl Iterator) -> Option<&'_ ()> { x.next( = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values | -LL | async fn i(mut x: impl Iterator) -> Option<&'static ()> { x.next() } - | ~~~~~~~ +LL - async fn i(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } +LL + async fn i(mut x: impl Iterator) -> Option<&'static ()> { x.next() } + | help: consider introducing a named lifetime parameter | -LL | async fn i<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } - | ++++ ~~~ ~~~ +LL - async fn i(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } +LL + async fn i<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } + | help: alternatively, you might want to return an owned value | LL - async fn i(mut x: impl Iterator) -> Option<&'_ ()> { x.next() } diff --git a/tests/ui/suggestions/impl-trait-with-missing-bounds.stderr b/tests/ui/suggestions/impl-trait-with-missing-bounds.stderr index a763eb6f2f85..d0ce7c9ed4e8 100644 --- a/tests/ui/suggestions/impl-trait-with-missing-bounds.stderr +++ b/tests/ui/suggestions/impl-trait-with-missing-bounds.stderr @@ -14,8 +14,9 @@ LL | fn qux(_: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | -LL | fn foo(constraints: I) where ::Item: Debug { - | +++++++++++++ ~ ++++++++++++++++++++++++++++++++++ +LL - fn foo(constraints: impl Iterator) { +LL + fn foo(constraints: I) where ::Item: Debug { + | error[E0277]: `::Item` doesn't implement `Debug` --> $DIR/impl-trait-with-missing-bounds.rs:14:13 @@ -33,8 +34,9 @@ LL | fn qux(_: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | -LL | fn bar(t: T, constraints: I) where T: std::fmt::Debug, ::Item: Debug { - | +++++++++++++ ~ ++++++++++++++++++++++++++++++ +LL - fn bar(t: T, constraints: impl Iterator) where T: std::fmt::Debug { +LL + fn bar(t: T, constraints: I) where T: std::fmt::Debug, ::Item: Debug { + | error[E0277]: `::Item` doesn't implement `Debug` --> $DIR/impl-trait-with-missing-bounds.rs:22:13 @@ -52,8 +54,9 @@ LL | fn qux(_: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | -LL | fn baz(t: impl std::fmt::Debug, constraints: I) where ::Item: Debug { - | +++++++++++++ ~ ++++++++++++++++++++++++++++++++++ +LL - fn baz(t: impl std::fmt::Debug, constraints: impl Iterator) { +LL + fn baz(t: impl std::fmt::Debug, constraints: I) where ::Item: Debug { + | error[E0277]: `::Item` doesn't implement `Debug` --> $DIR/impl-trait-with-missing-bounds.rs:30:13 @@ -71,8 +74,9 @@ LL | fn qux(_: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | -LL | fn bat(t: T, constraints: U, _: I) where ::Item: Debug { - | +++++++++++++ ~ ++++++++++++++++++++++++++++++++++ +LL - fn bat(t: T, constraints: impl Iterator, _: I) { +LL + fn bat(t: T, constraints: U, _: I) where ::Item: Debug { + | error[E0277]: `::Item` doesn't implement `Debug` --> $DIR/impl-trait-with-missing-bounds.rs:37:13 @@ -90,8 +94,9 @@ LL | fn qux(_: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | -LL | fn bak(constraints: I) where ::Item: Debug { - | +++++++++++++++++++++++++++++++ ~ ++++++++++++++++++++++++++++++++++ +LL - fn bak(constraints: impl Iterator + std::fmt::Debug) { +LL + fn bak(constraints: I) where ::Item: Debug { + | error[E0277]: `::Item` doesn't implement `Debug` --> $DIR/impl-trait-with-missing-bounds.rs:45:13 @@ -109,8 +114,9 @@ LL | fn qux(_: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^ required by this bound in `qux` help: introduce a type parameter with a trait bound instead of using `impl Trait` | -LL | fn baw(constraints: I) where ::Item: Debug { - | ~~~~~~~~~~~~~ ~ ++++++++++++++++++++++++++++++++++ +LL - fn baw<>(constraints: impl Iterator) { +LL + fn baw(constraints: I) where ::Item: Debug { + | error: aborting due to 6 previous errors diff --git a/tests/ui/suggestions/incorrect-variant-literal.svg b/tests/ui/suggestions/incorrect-variant-literal.svg index 980a7b29a008..0f2ade633c5a 100644 --- a/tests/ui/suggestions/incorrect-variant-literal.svg +++ b/tests/ui/suggestions/incorrect-variant-literal.svg @@ -1,4 +1,4 @@ - + ` --> $DIR/suggest-field-through-deref.rs:16:15 @@ -50,8 +53,9 @@ LL | let _ = c.longname; | help: a field with a similar name exists | -LL | let _ = c.unwrap().long_name; - | ~~~~~~~~~~~~~~~~~~ +LL - let _ = c.longname; +LL + let _ = c.unwrap().long_name; + | error[E0609]: no field `long_name` on type `Result` --> $DIR/suggest-field-through-deref.rs:20:15 diff --git a/tests/ui/suggestions/suggest-let-and-typo-issue-132483.stderr b/tests/ui/suggestions/suggest-let-and-typo-issue-132483.stderr index c84f9363f033..57983a07bf55 100644 --- a/tests/ui/suggestions/suggest-let-and-typo-issue-132483.stderr +++ b/tests/ui/suggestions/suggest-let-and-typo-issue-132483.stderr @@ -6,8 +6,9 @@ LL | x2 = 1; | help: a local variable with a similar name exists | -LL | x1 = 1; - | ~~ +LL - x2 = 1; +LL + x1 = 1; + | help: you might have meant to introduce a new binding | LL | let x2 = 1; diff --git a/tests/ui/suggestions/suggest-let-for-assignment.stderr b/tests/ui/suggestions/suggest-let-for-assignment.stderr index 8d97dbeb14a7..9dc859dbe0e0 100644 --- a/tests/ui/suggestions/suggest-let-for-assignment.stderr +++ b/tests/ui/suggestions/suggest-let-for-assignment.stderr @@ -40,8 +40,9 @@ LL | let_some_variable = 6; | help: you might have meant to introduce a new binding | -LL | let some_variable = 6; - | ~~~~~~~~~~~~~~~~~ +LL - let_some_variable = 6; +LL + let some_variable = 6; + | error[E0425]: cannot find value `some_variable` in this scope --> $DIR/suggest-let-for-assignment.rs:11:35 @@ -57,8 +58,9 @@ LL | letother_variable = 6; | help: you might have meant to introduce a new binding | -LL | let other_variable = 6; - | ~~~~~~~~~~~~~~~~~~ +LL - letother_variable = 6; +LL + let other_variable = 6; + | error[E0425]: cannot find value `other_variable` in this scope --> $DIR/suggest-let-for-assignment.rs:14:36 diff --git a/tests/ui/suggestions/suggest-methods.stderr b/tests/ui/suggestions/suggest-methods.stderr index 5bacad8c6e89..6f1c2cc4cab0 100644 --- a/tests/ui/suggestions/suggest-methods.stderr +++ b/tests/ui/suggestions/suggest-methods.stderr @@ -21,8 +21,9 @@ LL | let _ = s.is_emtpy(); | help: there is a method `is_empty` with a similar name | -LL | let _ = s.is_empty(); - | ~~~~~~~~ +LL - let _ = s.is_emtpy(); +LL + let _ = s.is_empty(); + | error[E0599]: no method named `count_eos` found for type `u32` in the current scope --> $DIR/suggest-methods.rs:27:19 @@ -32,8 +33,9 @@ LL | let _ = 63u32.count_eos(); | help: there is a method `count_zeros` with a similar name | -LL | let _ = 63u32.count_zeros(); - | ~~~~~~~~~~~ +LL - let _ = 63u32.count_eos(); +LL + let _ = 63u32.count_zeros(); + | error[E0599]: no method named `count_o` found for type `u32` in the current scope --> $DIR/suggest-methods.rs:30:19 @@ -43,8 +45,9 @@ LL | let _ = 63u32.count_o(); | help: there is a method `count_ones` with a similar name | -LL | let _ = 63u32.count_ones(); - | ~~~~~~~~~~ +LL - let _ = 63u32.count_o(); +LL + let _ = 63u32.count_ones(); + | error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/suggest-move-types.stderr b/tests/ui/suggestions/suggest-move-types.stderr index b222e8142bab..397e8ad29c6e 100644 --- a/tests/ui/suggestions/suggest-move-types.stderr +++ b/tests/ui/suggestions/suggest-move-types.stderr @@ -8,8 +8,9 @@ LL | struct A> { | help: move the constraint after the generic argument | -LL | struct A> { - | ~~~~~~~~~~~ +LL - struct A> { +LL + struct A> { + | error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:33:43 @@ -21,8 +22,9 @@ LL | struct Al<'a, T, M: OneWithLifetime> { | help: move the constraint after the generic arguments | -LL | struct Al<'a, T, M: OneWithLifetime<'a, T, A = ()>> { - | ~~~~~~~~~~~~~~~ +LL - struct Al<'a, T, M: OneWithLifetime> { +LL + struct Al<'a, T, M: OneWithLifetime<'a, T, A = ()>> { + | error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:40:46 @@ -34,8 +36,9 @@ LL | struct B> { | help: move the constraints after the generic arguments | -LL | struct B> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - struct B> { +LL + struct B> { + | error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:48:71 @@ -47,8 +50,9 @@ LL | struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime> { +LL + struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<'a, 'b, 'c, T, U, V, A = (), B = (), C = ()>> { + | error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:57:28 @@ -60,8 +64,9 @@ LL | struct C> { | help: move the constraints after the generic arguments | -LL | struct C> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - struct C> { +LL + struct C> { + | error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:65:53 @@ -73,8 +78,9 @@ LL | struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime> { +LL + struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<'a, 'b, 'c, T, U, V, A = (), B = (), C = ()>> { + | error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:74:28 @@ -86,8 +92,9 @@ LL | struct D> { | help: move the constraints after the generic arguments | -LL | struct D> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - struct D> { +LL + struct D> { + | error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:82:53 @@ -99,8 +106,9 @@ LL | struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime> { +LL + struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<'a, 'b, 'c, T, U, V, A = (), B = (), C = ()>> { + | error[E0747]: type provided when a lifetime was expected --> $DIR/suggest-move-types.rs:33:43 diff --git a/tests/ui/suggestions/suggest-null-ptr.stderr b/tests/ui/suggestions/suggest-null-ptr.stderr index a811d6d19c72..5be33d47237d 100644 --- a/tests/ui/suggestions/suggest-null-ptr.stderr +++ b/tests/ui/suggestions/suggest-null-ptr.stderr @@ -15,8 +15,9 @@ LL | fn foo(ptr: *const u8); | ^^^ --- help: if you meant to create a null pointer, use `std::ptr::null()` | -LL | foo(std::ptr::null()); - | ~~~~~~~~~~~~~~~~ +LL - foo(0); +LL + foo(std::ptr::null()); + | error[E0308]: mismatched types --> $DIR/suggest-null-ptr.rs:21:17 @@ -35,8 +36,9 @@ LL | fn foo_mut(ptr: *mut u8); | ^^^^^^^ --- help: if you meant to create a null pointer, use `std::ptr::null_mut()` | -LL | foo_mut(std::ptr::null_mut()); - | ~~~~~~~~~~~~~~~~~~~~ +LL - foo_mut(0); +LL + foo_mut(std::ptr::null_mut()); + | error[E0308]: mismatched types --> $DIR/suggest-null-ptr.rs:24:15 @@ -55,8 +57,9 @@ LL | fn usize(ptr: *const usize); | ^^^^^ --- help: if you meant to create a null pointer, use `std::ptr::null()` | -LL | usize(std::ptr::null()); - | ~~~~~~~~~~~~~~~~ +LL - usize(0); +LL + usize(std::ptr::null()); + | error[E0308]: mismatched types --> $DIR/suggest-null-ptr.rs:27:19 @@ -75,8 +78,9 @@ LL | fn usize_mut(ptr: *mut usize); | ^^^^^^^^^ --- help: if you meant to create a null pointer, use `std::ptr::null_mut()` | -LL | usize_mut(std::ptr::null_mut()); - | ~~~~~~~~~~~~~~~~~~~~ +LL - usize_mut(0); +LL + usize_mut(std::ptr::null_mut()); + | error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/suggest-slice-swap.stderr b/tests/ui/suggestions/suggest-slice-swap.stderr index 2840fc0a7611..95b547aad5de 100644 --- a/tests/ui/suggestions/suggest-slice-swap.stderr +++ b/tests/ui/suggestions/suggest-slice-swap.stderr @@ -9,8 +9,9 @@ LL | std::mem::swap(&mut arr[0], &mut arr[1]); | help: use `.swap()` to swap elements at the specified indices instead | -LL | arr.swap(1, 0); - | ~~~~~~~~~~~~~~ +LL - std::mem::swap(&mut arr[0], &mut arr[1]); +LL + arr.swap(1, 0); + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr index 0bd601e21703..e73aba51847e 100644 --- a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr +++ b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait-edition-2021.stderr @@ -6,8 +6,9 @@ LL | impl<'a, T> Struct for Trait<'a, T> {} | help: `impl` items mention the trait being implemented first and the type it is being implemented for second | -LL | impl<'a, T> Trait<'a, T> for Struct {} - | ~~~~~~~~~~~~ ~~~~~~~~~ +LL - impl<'a, T> Struct for Trait<'a, T> {} +LL + impl<'a, T> Trait<'a, T> for Struct {} + | error[E0404]: expected trait, found enum `Enum` --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:19:13 @@ -17,8 +18,9 @@ LL | impl<'a, T> Enum for Trait<'a, T> {} | help: `impl` items mention the trait being implemented first and the type it is being implemented for second | -LL | impl<'a, T> Trait<'a, T> for Enum {} - | ~~~~~~~~~~~~ ~~~~~~~ +LL - impl<'a, T> Enum for Trait<'a, T> {} +LL + impl<'a, T> Trait<'a, T> for Enum {} + | error[E0404]: expected trait, found union `Union` --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:23:13 @@ -28,8 +30,9 @@ LL | impl<'a, T> Union for Trait<'a, T> {} | help: `impl` items mention the trait being implemented first and the type it is being implemented for second | -LL | impl<'a, T> Trait<'a, T> for Union {} - | ~~~~~~~~~~~~ ~~~~~~~~ +LL - impl<'a, T> Union for Trait<'a, T> {} +LL + impl<'a, T> Trait<'a, T> for Union {} + | error[E0392]: type parameter `T` is never used --> $DIR/suggest-swapping-self-ty-and-trait-edition-2021.rs:5:19 diff --git a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr index d1da9a89c191..929f893e34f5 100644 --- a/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr +++ b/tests/ui/suggestions/suggest-swapping-self-ty-and-trait.stderr @@ -6,8 +6,9 @@ LL | impl<'a, T> Struct for Trait<'a, T> {} | help: `impl` items mention the trait being implemented first and the type it is being implemented for second | -LL | impl<'a, T> Trait<'a, T> for Struct {} - | ~~~~~~~~~~~~ ~~~~~~~~~ +LL - impl<'a, T> Struct for Trait<'a, T> {} +LL + impl<'a, T> Trait<'a, T> for Struct {} + | error[E0404]: expected trait, found enum `Enum` --> $DIR/suggest-swapping-self-ty-and-trait.rs:18:13 @@ -17,8 +18,9 @@ LL | impl<'a, T> Enum for Trait<'a, T> {} | help: `impl` items mention the trait being implemented first and the type it is being implemented for second | -LL | impl<'a, T> Trait<'a, T> for Enum {} - | ~~~~~~~~~~~~ ~~~~~~~ +LL - impl<'a, T> Enum for Trait<'a, T> {} +LL + impl<'a, T> Trait<'a, T> for Enum {} + | error[E0404]: expected trait, found union `Union` --> $DIR/suggest-swapping-self-ty-and-trait.rs:23:13 @@ -28,8 +30,9 @@ LL | impl<'a, T> Union for Trait<'a, T> {} | help: `impl` items mention the trait being implemented first and the type it is being implemented for second | -LL | impl<'a, T> Trait<'a, T> for Union {} - | ~~~~~~~~~~~~ ~~~~~~~~ +LL - impl<'a, T> Union for Trait<'a, T> {} +LL + impl<'a, T> Trait<'a, T> for Union {} + | error[E0392]: type parameter `T` is never used --> $DIR/suggest-swapping-self-ty-and-trait.rs:3:19 diff --git a/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr b/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr index cabaa76a8867..fac93da98293 100644 --- a/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr +++ b/tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr @@ -6,10 +6,12 @@ LL | impl Foo for Bar where for<'a> <&'a S>::Item: Foo {} | help: use fully-qualified syntax | -LL | impl Foo for Bar where for<'a> <&'a S as IntoAsyncIterator>::Item: Foo {} - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | impl Foo for Bar where for<'a> <&'a S as IntoIterator>::Item: Foo {} - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - impl Foo for Bar where for<'a> <&'a S>::Item: Foo {} +LL + impl Foo for Bar where for<'a> <&'a S as IntoAsyncIterator>::Item: Foo {} + | +LL - impl Foo for Bar where for<'a> <&'a S>::Item: Foo {} +LL + impl Foo for Bar where for<'a> <&'a S as IntoIterator>::Item: Foo {} + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr index 5be55f75cd15..0008b4fb5ed2 100644 --- a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr +++ b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr @@ -31,8 +31,9 @@ LL | let _v: Vec<_> = FromIterator::from_iter(&[1]); = note: 'std::iter::FromIterator' is included in the prelude starting in Edition 2021 help: a trait with a similar name exists | -LL | let _v: Vec<_> = IntoIterator::from_iter(&[1]); - | ~~~~~~~~~~~~ +LL - let _v: Vec<_> = FromIterator::from_iter(&[1]); +LL + let _v: Vec<_> = IntoIterator::from_iter(&[1]); + | help: consider importing this trait | LL + use std::iter::FromIterator; @@ -55,8 +56,9 @@ LL + use std::convert::TryInto; | help: there is a method `into` with a similar name | -LL | let _i: i16 = 0_i32.into().unwrap(); - | ~~~~ +LL - let _i: i16 = 0_i32.try_into().unwrap(); +LL + let _i: i16 = 0_i32.into().unwrap(); + | error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/suggest-using-chars.stderr b/tests/ui/suggestions/suggest-using-chars.stderr index ba80ec6a2019..a197223beb05 100644 --- a/tests/ui/suggestions/suggest-using-chars.stderr +++ b/tests/ui/suggestions/suggest-using-chars.stderr @@ -6,8 +6,9 @@ LL | let _ = "foo".iter(); | help: because of the in-memory representation of `&str`, to obtain an `Iterator` over each of its codepoint use method `chars` | -LL | let _ = "foo".chars(); - | ~~~~~ +LL - let _ = "foo".iter(); +LL + let _ = "foo".chars(); + | error[E0599]: no method named `foo` found for reference `&'static str` in the current scope --> $DIR/suggest-using-chars.rs:3:19 @@ -23,8 +24,9 @@ LL | let _ = String::from("bar").iter(); | help: because of the in-memory representation of `&str`, to obtain an `Iterator` over each of its codepoint use method `chars` | -LL | let _ = String::from("bar").chars(); - | ~~~~~ +LL - let _ = String::from("bar").iter(); +LL + let _ = String::from("bar").chars(); + | error[E0599]: no method named `iter` found for reference `&String` in the current scope --> $DIR/suggest-using-chars.rs:5:36 @@ -34,8 +36,9 @@ LL | let _ = (&String::from("bar")).iter(); | help: because of the in-memory representation of `&str`, to obtain an `Iterator` over each of its codepoint use method `chars` | -LL | let _ = (&String::from("bar")).chars(); - | ~~~~~ +LL - let _ = (&String::from("bar")).iter(); +LL + let _ = (&String::from("bar")).chars(); + | error[E0599]: no method named `iter` found for type `{integer}` in the current scope --> $DIR/suggest-using-chars.rs:6:15 diff --git a/tests/ui/suggestions/suggest-variants.stderr b/tests/ui/suggestions/suggest-variants.stderr index d93bf2d8cd72..b422da8fbfac 100644 --- a/tests/ui/suggestions/suggest-variants.stderr +++ b/tests/ui/suggestions/suggest-variants.stderr @@ -9,8 +9,9 @@ LL | println!("My shape is {:?}", Shape::Squareee { size: 5}); | help: there is a variant with a similar name | -LL | println!("My shape is {:?}", Shape::Square { size: 5}); - | ~~~~~~ +LL - println!("My shape is {:?}", Shape::Squareee { size: 5}); +LL + println!("My shape is {:?}", Shape::Square { size: 5}); + | error[E0599]: no variant named `Circl` found for enum `Shape` --> $DIR/suggest-variants.rs:13:41 @@ -23,8 +24,9 @@ LL | println!("My shape is {:?}", Shape::Circl { size: 5}); | help: there is a variant with a similar name | -LL | println!("My shape is {:?}", Shape::Circle { size: 5}); - | ~~~~~~ +LL - println!("My shape is {:?}", Shape::Circl { size: 5}); +LL + println!("My shape is {:?}", Shape::Circle { size: 5}); + | error[E0599]: no variant named `Rombus` found for enum `Shape` --> $DIR/suggest-variants.rs:14:41 @@ -46,8 +48,9 @@ LL | Shape::Squareee; | help: there is a variant with a similar name | -LL | Shape::Square { size: /* value */ }; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - Shape::Squareee; +LL + Shape::Square { size: /* value */ }; + | error[E0599]: no variant or associated item named `Circl` found for enum `Shape` in the current scope --> $DIR/suggest-variants.rs:16:12 @@ -60,8 +63,9 @@ LL | Shape::Circl; | help: there is a variant with a similar name | -LL | Shape::Circle { radius: /* value */ }; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - Shape::Circl; +LL + Shape::Circle { radius: /* value */ }; + | error[E0599]: no variant or associated item named `Rombus` found for enum `Shape` in the current scope --> $DIR/suggest-variants.rs:17:12 diff --git a/tests/ui/suggestions/suggest_print_over_printf.stderr b/tests/ui/suggestions/suggest_print_over_printf.stderr index 8a79745133c9..48a50de0f7ab 100644 --- a/tests/ui/suggestions/suggest_print_over_printf.stderr +++ b/tests/ui/suggestions/suggest_print_over_printf.stderr @@ -6,8 +6,9 @@ LL | printf("%d", x); | help: you may have meant to use the `print` macro | -LL | print!("%d", x); - | ~~~~~~ +LL - printf("%d", x); +LL + print!("%d", x); + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr index ba0682cda321..70e8f5b58acb 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr @@ -7,8 +7,9 @@ LL | let _ = vec![Ok(2)].into_iter().collect:,_>>()?; = note: type ascription syntax has been removed, see issue #101728 help: maybe write a path separator here | -LL | let _ = vec![Ok(2)].into_iter().collect::,_>>()?; - | ~~ +LL - let _ = vec![Ok(2)].into_iter().collect:,_>>()?; +LL + let _ = vec![Ok(2)].into_iter().collect::,_>>()?; + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr index 56b6a69a283f..5ba56d095f73 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr @@ -6,8 +6,9 @@ LL | let _: Vec = A::B; | help: you might have meant to write a path instead of an associated type bound | -LL | let _: Vec = A::B; - | ~~ +LL - let _: Vec = A::B; +LL + let _: Vec = A::B; + | error[E0107]: struct takes at least 1 generic argument but 0 generic arguments were supplied --> $DIR/type-ascription-instead-of-path-in-type.rs:6:12 diff --git a/tests/ui/suggestions/type-mismatch-byte-literal.stderr b/tests/ui/suggestions/type-mismatch-byte-literal.stderr index 3d27149f0dcf..e96ead569d98 100644 --- a/tests/ui/suggestions/type-mismatch-byte-literal.stderr +++ b/tests/ui/suggestions/type-mismatch-byte-literal.stderr @@ -8,8 +8,9 @@ LL | let _x: u8 = 'X'; | help: if you meant to write a byte literal, prefix with `b` | -LL | let _x: u8 = b'X'; - | ~~~~ +LL - let _x: u8 = 'X'; +LL + let _x: u8 = b'X'; + | error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:11:9 @@ -26,8 +27,9 @@ LL | fn foo(_t: u8) {} | ^^^ ------ help: if you meant to write a byte literal, prefix with `b` | -LL | foo(b'#'); - | ~~~~ +LL - foo('#'); +LL + foo(b'#'); + | error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:15:18 @@ -39,8 +41,9 @@ LL | let _a: u8 = '\x20'; | help: if you meant to write a byte literal, prefix with `b` | -LL | let _a: u8 = b'\x20'; - | ~~~~~~~ +LL - let _a: u8 = '\x20'; +LL + let _a: u8 = b'\x20'; + | error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:20:9 diff --git a/tests/ui/suggestions/type-mismatch-struct-field-shorthand-2.stderr b/tests/ui/suggestions/type-mismatch-struct-field-shorthand-2.stderr index fb3573ee2a4e..e60de526945a 100644 --- a/tests/ui/suggestions/type-mismatch-struct-field-shorthand-2.stderr +++ b/tests/ui/suggestions/type-mismatch-struct-field-shorthand-2.stderr @@ -28,8 +28,9 @@ LL | let _ = RGB { r, g, c }; | help: a field with a similar name exists | -LL | let _ = RGB { r, g, b }; - | ~ +LL - let _ = RGB { r, g, c }; +LL + let _ = RGB { r, g, b }; + | error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/unnamable-types.stderr b/tests/ui/suggestions/unnamable-types.stderr index dc236af91f82..bcd1a905194e 100644 --- a/tests/ui/suggestions/unnamable-types.stderr +++ b/tests/ui/suggestions/unnamable-types.stderr @@ -12,8 +12,9 @@ LL | static B: _ = "abc"; | help: replace this with a fully-specified type | -LL | static B: &str = "abc"; - | ~~~~ +LL - static B: _ = "abc"; +LL + static B: &str = "abc"; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/unnamable-types.rs:17:10 diff --git a/tests/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr b/tests/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr index c0162ec2cab8..ade3f3099a35 100644 --- a/tests/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr +++ b/tests/ui/suggestions/unnecessary_dot_for_floating_point_literal.stderr @@ -10,8 +10,9 @@ LL | let _: f64 = 0..10; found struct `std::ops::Range<{integer}>` help: remove the unnecessary `.` operator for a floating point literal | -LL | let _: f64 = 0.10; - | ~ +LL - let _: f64 = 0..10; +LL + let _: f64 = 0.10; + | error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:3:18 @@ -25,8 +26,9 @@ LL | let _: f64 = 1..; found struct `std::ops::RangeFrom<{integer}>` help: remove the unnecessary `.` operator for a floating point literal | -LL | let _: f64 = 1.; - | ~ +LL - let _: f64 = 1..; +LL + let _: f64 = 1.; + | error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:4:18 @@ -40,8 +42,9 @@ LL | let _: f64 = ..10; found struct `RangeTo<{integer}>` help: remove the unnecessary `.` operator and add an integer part for a floating point literal | -LL | let _: f64 = 0.10; - | ~~ +LL - let _: f64 = ..10; +LL + let _: f64 = 0.10; + | error[E0308]: mismatched types --> $DIR/unnecessary_dot_for_floating_point_literal.rs:5:18 diff --git a/tests/ui/test-attrs/inaccessible-test-modules.stderr b/tests/ui/test-attrs/inaccessible-test-modules.stderr index 7635f579d66b..39f69b164fb0 100644 --- a/tests/ui/test-attrs/inaccessible-test-modules.stderr +++ b/tests/ui/test-attrs/inaccessible-test-modules.stderr @@ -12,8 +12,9 @@ LL | use test as y; | help: consider importing this module instead | -LL | use test::test as y; - | ~~~~~~~~~~~~~~~ +LL - use test as y; +LL + use test::test as y; + | error: aborting due to 2 previous errors diff --git a/tests/ui/test-attrs/issue-109816.stderr b/tests/ui/test-attrs/issue-109816.stderr index 6f5e3ae6b63f..433421fff1b5 100644 --- a/tests/ui/test-attrs/issue-109816.stderr +++ b/tests/ui/test-attrs/issue-109816.stderr @@ -9,7 +9,8 @@ LL | struct A5(u32, u8); | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] +LL - #[test] +LL + #[cfg(test)] | error: aborting due to 1 previous error diff --git a/tests/ui/test-attrs/test-attr-non-associated-functions.stderr b/tests/ui/test-attrs/test-attr-non-associated-functions.stderr index 3e3a951aff3e..0ede0cbb97f3 100644 --- a/tests/ui/test-attrs/test-attr-non-associated-functions.stderr +++ b/tests/ui/test-attrs/test-attr-non-associated-functions.stderr @@ -6,7 +6,8 @@ LL | #[test] | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] +LL - #[test] +LL + #[cfg(test)] | error: the `#[test]` attribute may only be used on a non-associated function @@ -17,7 +18,8 @@ LL | #[test] | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] +LL - #[test] +LL + #[cfg(test)] | error: aborting due to 2 previous errors diff --git a/tests/ui/test-attrs/test-on-not-fn.stderr b/tests/ui/test-attrs/test-on-not-fn.stderr index 7a9913fbcfa1..a282db012540 100644 --- a/tests/ui/test-attrs/test-on-not-fn.stderr +++ b/tests/ui/test-attrs/test-on-not-fn.stderr @@ -8,8 +8,9 @@ LL | mod test {} | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:6:1 @@ -27,8 +28,9 @@ LL | | } | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:20:1 @@ -40,8 +42,9 @@ LL | extern "C" {} | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:23:1 @@ -53,8 +56,9 @@ LL | trait Foo {} | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:26:1 @@ -66,8 +70,9 @@ LL | impl Foo for i32 {} | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:29:1 @@ -79,8 +84,9 @@ LL | const FOO: i32 = -1_i32; | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:32:1 @@ -92,8 +98,9 @@ LL | static BAR: u64 = 10_000_u64; | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:35:1 @@ -107,8 +114,9 @@ LL | | } | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:40:1 @@ -120,8 +128,9 @@ LL | struct NewI32(i32); | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:43:1 @@ -136,8 +145,9 @@ LL | | } | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:50:1 @@ -153,8 +163,9 @@ LL | | } | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | warning: the `#[test]` attribute may only be used on a non-associated function --> $DIR/test-on-not-fn.rs:61:1 @@ -166,8 +177,9 @@ LL | foo!(); | help: replace with conditional compilation to make the item only exist when tests are being run | -LL | #[cfg(test)] - | ~~~~~~~~~~~~ +LL - #[test] +LL + #[cfg(test)] + | error: aborting due to 11 previous errors; 1 warning emitted diff --git a/tests/ui/trait-bounds/argument-with-unnecessary-method-call.stderr b/tests/ui/trait-bounds/argument-with-unnecessary-method-call.stderr index 49230c98a12c..7d795581ea9d 100644 --- a/tests/ui/trait-bounds/argument-with-unnecessary-method-call.stderr +++ b/tests/ui/trait-bounds/argument-with-unnecessary-method-call.stderr @@ -14,8 +14,9 @@ LL | fn qux(_: impl From) {} | ^^^^^^^^^ required by this bound in `qux` help: try using a fully qualified path to specify the expected types | -LL | qux(>::into(Bar)); - | +++++++++++++++++++++++ ~ +LL - qux(Bar.into()); +LL + qux(>::into(Bar)); + | help: consider removing this method call, as the receiver has type `Bar` and `Bar: From` trivially holds | LL - qux(Bar.into()); diff --git a/tests/ui/traits/alias/ambiguous.stderr b/tests/ui/traits/alias/ambiguous.stderr index 034e8a3fb7b9..542ee1901296 100644 --- a/tests/ui/traits/alias/ambiguous.stderr +++ b/tests/ui/traits/alias/ambiguous.stderr @@ -16,12 +16,14 @@ LL | fn foo(&self) {} | ^^^^^^^^^^^^^ help: disambiguate the method for candidate #1 | -LL | A::foo(&t); - | ~~~~~~~~~~ +LL - t.foo(); +LL + A::foo(&t); + | help: disambiguate the method for candidate #2 | -LL | B::foo(&t); - | ~~~~~~~~~~ +LL - t.foo(); +LL + B::foo(&t); + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/alias/dont-elaborate-non-self.stderr b/tests/ui/traits/alias/dont-elaborate-non-self.stderr index 952f78dd3da1..1d96a6a69940 100644 --- a/tests/ui/traits/alias/dont-elaborate-non-self.stderr +++ b/tests/ui/traits/alias/dont-elaborate-non-self.stderr @@ -8,8 +8,9 @@ LL | fn f(a: dyn F) {} = help: unsized fn params are gated as an unstable feature help: you can use `impl Trait` as the argument type | -LL | fn f(a: impl F) {} - | ~~~~ +LL - fn f(a: dyn F) {} +LL + fn f(a: impl F) {} + | help: function arguments must have a statically known size, borrowed types always have a known size | LL | fn f(a: &dyn F) {} diff --git a/tests/ui/traits/alias/self-in-const-generics.stderr b/tests/ui/traits/alias/self-in-const-generics.stderr index b5538cb6e2f3..ea201a2dd977 100644 --- a/tests/ui/traits/alias/self-in-const-generics.stderr +++ b/tests/ui/traits/alias/self-in-const-generics.stderr @@ -14,8 +14,9 @@ LL | trait BB = Bar<{ 2 + 1 }>; | this trait is not dyn compatible... help: consider using an opaque type instead | -LL | fn foo(x: &impl BB) {} - | ~~~~ +LL - fn foo(x: &dyn BB) {} +LL + fn foo(x: &impl BB) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/alias/self-in-generics.stderr b/tests/ui/traits/alias/self-in-generics.stderr index afe4dff45ed6..abeb11907adc 100644 --- a/tests/ui/traits/alias/self-in-generics.stderr +++ b/tests/ui/traits/alias/self-in-generics.stderr @@ -16,8 +16,9 @@ LL | pub trait SelfInput = Fn(&mut Self); | this trait is not dyn compatible... help: consider using an opaque type instead | -LL | pub fn f(_f: &impl SelfInput) {} - | ~~~~ +LL - pub fn f(_f: &dyn SelfInput) {} +LL + pub fn f(_f: &impl SelfInput) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/alias/suggest-trait-alias-instead-of-type.stderr b/tests/ui/traits/alias/suggest-trait-alias-instead-of-type.stderr index afe34a125b20..af4e4214be2d 100644 --- a/tests/ui/traits/alias/suggest-trait-alias-instead-of-type.stderr +++ b/tests/ui/traits/alias/suggest-trait-alias-instead-of-type.stderr @@ -6,7 +6,8 @@ LL | struct Struct(S); | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | -LL | trait Strings = Iterator; +LL - type Strings = Iterator; +LL + trait Strings = Iterator; | error: aborting due to 1 previous error diff --git a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr index 0020f9e416df..23974c5b4aaa 100644 --- a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr +++ b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr @@ -9,12 +9,14 @@ LL | struct Foo where T: Bar, ::Baz: String { | help: constrain the associated type to `String` | -LL | struct Foo where T: Bar, T: Bar { - | ~~~~~~~~~~~~~~~~~~~~ +LL - struct Foo where T: Bar, ::Baz: String { +LL + struct Foo where T: Bar, T: Bar { + | help: a trait with a similar name exists | -LL | struct Foo where T: Bar, ::Baz: ToString { - | ~~~~~~~~ +LL - struct Foo where T: Bar, ::Baz: String { +LL + struct Foo where T: Bar, ::Baz: ToString { + | error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:9:54 @@ -27,12 +29,14 @@ LL | struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: String { | help: constrain the associated type to `String` | -LL | struct Qux<'a, T> where T: Bar, &'a T: Bar { - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: String { +LL + struct Qux<'a, T> where T: Bar, &'a T: Bar { + | help: a trait with a similar name exists | -LL | struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: ToString { - | ~~~~~~~~ +LL - struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: String { +LL + struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: ToString { + | error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:13:45 @@ -45,12 +49,14 @@ LL | fn foo(_: T) where ::Baz: String { | help: constrain the associated type to `String` | -LL | fn foo(_: T) where T: Bar { - | ~~~~~~~~~~~~~~~~~~~~ +LL - fn foo(_: T) where ::Baz: String { +LL + fn foo(_: T) where T: Bar { + | help: a trait with a similar name exists | -LL | fn foo(_: T) where ::Baz: ToString { - | ~~~~~~~~ +LL - fn foo(_: T) where ::Baz: String { +LL + fn foo(_: T) where ::Baz: ToString { + | error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:16:57 @@ -63,12 +69,14 @@ LL | fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: String { | help: constrain the associated type to `String` | -LL | fn qux<'a, T: Bar>(_: &'a T) where &'a T: Bar { - | ~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: String { +LL + fn qux<'a, T: Bar>(_: &'a T) where &'a T: Bar { + | help: a trait with a similar name exists | -LL | fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: ToString { - | ~~~~~~~~ +LL - fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: String { +LL + fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: ToString { + | error[E0405]: cannot find trait `Unresolved` in this scope --> $DIR/assoc_type_bound_with_struct.rs:19:31 diff --git a/tests/ui/traits/bound/not-on-bare-trait-2021.stderr b/tests/ui/traits/bound/not-on-bare-trait-2021.stderr index e50186aff7e6..b81aa54b88db 100644 --- a/tests/ui/traits/bound/not-on-bare-trait-2021.stderr +++ b/tests/ui/traits/bound/not-on-bare-trait-2021.stderr @@ -6,8 +6,9 @@ LL | fn foo(_x: Foo + Send) { | help: use a new generic type parameter, constrained by `Foo + Send` | -LL | fn foo(_x: T) { - | +++++++++++++++ ~ +LL - fn foo(_x: Foo + Send) { +LL + fn foo(_x: T) { + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn foo(_x: impl Foo + Send) { @@ -25,8 +26,9 @@ LL | fn bar(x: Foo) -> Foo { | help: use a new generic type parameter, constrained by `Foo` | -LL | fn bar(x: T) -> Foo { - | ++++++++ ~ +LL - fn bar(x: Foo) -> Foo { +LL + fn bar(x: T) -> Foo { + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn bar(x: impl Foo) -> Foo { diff --git a/tests/ui/traits/bound/not-on-bare-trait.stderr b/tests/ui/traits/bound/not-on-bare-trait.stderr index c2cb303b0187..9028e66fa020 100644 --- a/tests/ui/traits/bound/not-on-bare-trait.stderr +++ b/tests/ui/traits/bound/not-on-bare-trait.stderr @@ -39,8 +39,9 @@ LL | fn bar(_x: (dyn Foo + Send)) { = help: unsized fn params are gated as an unstable feature help: you can use `impl Trait` as the argument type | -LL | fn bar(_x: (impl Foo + Send)) { - | ~~~~ +LL - fn bar(_x: (dyn Foo + Send)) { +LL + fn bar(_x: (impl Foo + Send)) { + | help: function arguments must have a statically known size, borrowed types always have a known size | LL | fn bar(_x: (&(dyn Foo + Send))) { diff --git a/tests/ui/traits/bound/not-on-struct.stderr b/tests/ui/traits/bound/not-on-struct.stderr index 2de35dc7fc37..1fb5b1c20670 100644 --- a/tests/ui/traits/bound/not-on-struct.stderr +++ b/tests/ui/traits/bound/not-on-struct.stderr @@ -166,8 +166,9 @@ LL + fn g() -> Traitor { | help: a trait with a similar name exists | -LL | fn g() -> Trait + 'static { - | ~~~~~ +LL - fn g() -> Traitor + 'static { +LL + fn g() -> Trait + 'static { + | error: aborting due to 11 previous errors diff --git a/tests/ui/traits/const-traits/eval-bad-signature.stderr b/tests/ui/traits/const-traits/eval-bad-signature.stderr index a64cf631743d..52de5283f7fd 100644 --- a/tests/ui/traits/const-traits/eval-bad-signature.stderr +++ b/tests/ui/traits/const-traits/eval-bad-signature.stderr @@ -13,8 +13,9 @@ LL | fn value() -> u32; found signature `fn() -> i64` help: change the output type to match the trait | -LL | fn value() -> u32 { - | ~~~ +LL - fn value() -> i64 { +LL + fn value() -> u32 { + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr index 5af263de28c4..c6e0c699520b 100644 --- a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr +++ b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr @@ -24,8 +24,9 @@ LL | fn from_residual(t: T) -> _ { | help: try replacing `_` with the type in the corresponding trait method signature | -LL | fn from_residual(t: T) -> T { - | ~ +LL - fn from_residual(t: T) -> _ { +LL + fn from_residual(t: T) -> T { + | error: aborting due to 3 previous errors diff --git a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr index 460595dd961e..139488d79f13 100644 --- a/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr +++ b/tests/ui/traits/do-not-mention-type-params-by-name-in-suggestion-issue-96292.stderr @@ -14,8 +14,9 @@ LL | impl Method for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | as Method>::method(thing, 42); - | +++++++++++++++++++++++++++++++++++ ~ +LL - thing.method(42); +LL + as Method>::method(thing, 42); + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/issue-28576.stderr b/tests/ui/traits/issue-28576.stderr index ba61ce985544..50d7f8c56b25 100644 --- a/tests/ui/traits/issue-28576.stderr +++ b/tests/ui/traits/issue-28576.stderr @@ -38,8 +38,9 @@ LL | pub trait Bar: Foo { | this trait is not dyn compatible... help: consider using an opaque type instead | -LL | impl Bar - | ~~~~ +LL - dyn Bar +LL + impl Bar + | error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/issue-28576.rs:5:16 diff --git a/tests/ui/traits/issue-35869.stderr b/tests/ui/traits/issue-35869.stderr index 503f9cee246e..73cf96178543 100644 --- a/tests/ui/traits/issue-35869.stderr +++ b/tests/ui/traits/issue-35869.stderr @@ -13,8 +13,9 @@ LL | fn foo(_: fn(u8) -> ()); found signature `fn(fn(u16))` help: change the parameter type to match the trait | -LL | fn foo(_: fn(u8)) {} - | ~~~~~~ +LL - fn foo(_: fn(u16) -> ()) {} +LL + fn foo(_: fn(u8)) {} + | error[E0053]: method `bar` has an incompatible type for trait --> $DIR/issue-35869.rs:13:15 @@ -31,8 +32,9 @@ LL | fn bar(_: Option); found signature `fn(Option)` help: change the parameter type to match the trait | -LL | fn bar(_: Option) {} - | ~~~~~~~~~~ +LL - fn bar(_: Option) {} +LL + fn bar(_: Option) {} + | error[E0053]: method `baz` has an incompatible type for trait --> $DIR/issue-35869.rs:15:15 @@ -49,8 +51,9 @@ LL | fn baz(_: (u8, u16)); found signature `fn((u16, _))` help: change the parameter type to match the trait | -LL | fn baz(_: (u8, u16)) {} - | ~~~~~~~~~ +LL - fn baz(_: (u16, u16)) {} +LL + fn baz(_: (u8, u16)) {} + | error[E0053]: method `qux` has an incompatible type for trait --> $DIR/issue-35869.rs:17:17 @@ -67,8 +70,9 @@ LL | fn qux() -> u8; found signature `fn() -> u16` help: change the output type to match the trait | -LL | fn qux() -> u8 { 5u16 } - | ~~ +LL - fn qux() -> u16 { 5u16 } +LL + fn qux() -> u8 { 5u16 } + | error: aborting due to 4 previous errors diff --git a/tests/ui/traits/issue-50480.stderr b/tests/ui/traits/issue-50480.stderr index 330b23b5755d..d3c11238ede1 100644 --- a/tests/ui/traits/issue-50480.stderr +++ b/tests/ui/traits/issue-50480.stderr @@ -47,8 +47,9 @@ LL | struct Bar(T, N, NotDefined, ::Item, Vec, String); | help: a type parameter with a similar name exists | -LL | struct Bar(T, T, NotDefined, ::Item, Vec, String); - | ~ +LL - struct Bar(T, N, NotDefined, ::Item, Vec, String); +LL + struct Bar(T, T, NotDefined, ::Item, Vec, String); + | help: you might be missing a type parameter | LL | struct Bar(T, N, NotDefined, ::Item, Vec, String); diff --git a/tests/ui/traits/issue-77982.stderr b/tests/ui/traits/issue-77982.stderr index 4907a6dd17af..edc7f56ea467 100644 --- a/tests/ui/traits/issue-77982.stderr +++ b/tests/ui/traits/issue-77982.stderr @@ -52,8 +52,9 @@ LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect( - impl From for u32; help: try using a fully qualified path to specify the expected types | -LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(>::into(0u32))).collect(); - | +++++++++++++++++++++++ ~ +LL - let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(); +LL + let ips: Vec<_> = (0..100_000).map(|_| u32::from(>::into(0u32))).collect(); + | error[E0283]: type annotations needed for `Box<_>` --> $DIR/issue-77982.rs:39:9 diff --git a/tests/ui/traits/issue-78372.stderr b/tests/ui/traits/issue-78372.stderr index 86234d15a5d4..d4dfba4f039f 100644 --- a/tests/ui/traits/issue-78372.stderr +++ b/tests/ui/traits/issue-78372.stderr @@ -19,8 +19,9 @@ LL | impl DispatchFromDyn> for T {} | help: a type parameter with a similar name exists | -LL | impl DispatchFromDyn> for T {} - | ~ +LL - impl DispatchFromDyn> for T {} +LL + impl DispatchFromDyn> for T {} + | help: you might be missing a type parameter | LL | impl DispatchFromDyn> for T {} diff --git a/tests/ui/traits/item-privacy.stderr b/tests/ui/traits/item-privacy.stderr index 58c558d66852..ddead3fdfd36 100644 --- a/tests/ui/traits/item-privacy.stderr +++ b/tests/ui/traits/item-privacy.stderr @@ -11,8 +11,9 @@ LL | S.a(); = help: trait `method::A` which provides `a` is implemented but not reachable help: there is a method `b` with a similar name | -LL | S.b(); - | ~ +LL - S.a(); +LL + S.b(); + | error[E0599]: no method named `b` found for struct `S` in the current scope --> $DIR/item-privacy.rs:68:7 @@ -33,8 +34,9 @@ LL + use method::B; | help: there is a method `c` with a similar name | -LL | S.c(); - | ~ +LL - S.b(); +LL + S.c(); + | error[E0624]: method `a` is private --> $DIR/item-privacy.rs:72:7 @@ -104,8 +106,9 @@ LL | S::A; = help: trait `assoc_const::A` which provides `A` is implemented but not reachable help: there is an associated constant `B` with a similar name | -LL | S::B; - | ~ +LL - S::A; +LL + S::B; + | error[E0599]: no associated item named `B` found for struct `S` in the current scope --> $DIR/item-privacy.rs:98:8 @@ -169,8 +172,9 @@ LL | let _: S::A; | help: if there were a trait named `Example` with associated type `A` implemented for `S`, you could use the fully-qualified path | -LL | let _: ::A; - | ~~~~~~~~~~~~~~~~~ +LL - let _: S::A; +LL + let _: ::A; + | error[E0223]: ambiguous associated type --> $DIR/item-privacy.rs:116:12 diff --git a/tests/ui/traits/method-argument-mismatch-variance-ice-119867.stderr b/tests/ui/traits/method-argument-mismatch-variance-ice-119867.stderr index e63cc522dd13..d535c39639f2 100644 --- a/tests/ui/traits/method-argument-mismatch-variance-ice-119867.stderr +++ b/tests/ui/traits/method-argument-mismatch-variance-ice-119867.stderr @@ -6,8 +6,9 @@ LL | fn deserialize(s: _) {} | help: try replacing `_` with the type in the corresponding trait method signature | -LL | fn deserialize(s: &ArchivedVec) {} - | ~~~~~~~~~~~~~~~ +LL - fn deserialize(s: _) {} +LL + fn deserialize(s: &ArchivedVec) {} + | error[E0186]: method `deserialize` has a `&self` declaration in the trait, but not in the impl --> $DIR/method-argument-mismatch-variance-ice-119867.rs:8:5 diff --git a/tests/ui/traits/multidispatch-bad.stderr b/tests/ui/traits/multidispatch-bad.stderr index 0bb095fb0e13..f605459ca8c6 100644 --- a/tests/ui/traits/multidispatch-bad.stderr +++ b/tests/ui/traits/multidispatch-bad.stderr @@ -13,8 +13,9 @@ LL | fn test(_: T, _: U) | ^^^^ ---- help: change the type of the numeric literal from `i32` to `u32` | -LL | test(22i32, 44u32); - | ~~~ +LL - test(22i32, 44i32); +LL + test(22i32, 44u32); + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/next-solver/diagnostics/coerce-in-may-coerce.stderr b/tests/ui/traits/next-solver/diagnostics/coerce-in-may-coerce.stderr index 9c28f7b0792a..e4775e41ba1a 100644 --- a/tests/ui/traits/next-solver/diagnostics/coerce-in-may-coerce.stderr +++ b/tests/ui/traits/next-solver/diagnostics/coerce-in-may-coerce.stderr @@ -13,8 +13,9 @@ LL | fn arg_error(x: ::Assoc, y: ()) { todo!() } | ^^^^^^^^^ help: swap these arguments | -LL | arg_error(|| (), ()); - | ~~~~~~~~~~~ +LL - arg_error((), || ()); +LL + arg_error(|| (), ()); + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr b/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr index eecf8e88fb64..02295307cb22 100644 --- a/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr +++ b/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr @@ -15,8 +15,9 @@ LL | for B::Item: Send, | help: if there were a trait named `Example` with associated type `Item` implemented for `B`, you could use the fully-qualified path | -LL | for ::Item: Send, - | ~~~~~~~~~~~~~~~~~~~~ +LL - for B::Item: Send, +LL + for ::Item: Send, + | error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr index 40e16dde6e4a..1117ee7efb30 100644 --- a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr +++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr @@ -25,8 +25,9 @@ LL | for F: 'a, | ^^ help: consider adding an explicit lifetime bound | -LL | for F: 'a, !1_"F": 'a - | ~~~~~~~~~~~~ +LL - for F: 'a, +LL + for F: 'a, !1_"F": 'a + | error[E0309]: the placeholder type `!1_"F"` may not live long enough --> $DIR/type-match-with-late-bound.rs:11:1 @@ -39,8 +40,9 @@ LL | {} | help: consider adding an explicit lifetime bound | -LL | for F: 'a, !1_"F": 'a - | ~~~~~~~~~~~~ +LL - for F: 'a, +LL + for F: 'a, !1_"F": 'a + | error[E0309]: the placeholder type `!2_"F"` may not live long enough --> $DIR/type-match-with-late-bound.rs:11:1 @@ -53,8 +55,9 @@ LL | {} | help: consider adding an explicit lifetime bound | -LL | for F: 'a, !2_"F": 'a - | ~~~~~~~~~~~~ +LL - for F: 'a, +LL + for F: 'a, !2_"F": 'a + | error: aborting due to 3 previous errors; 1 warning emitted diff --git a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr index 1d5489845efe..7a2db203ac3f 100644 --- a/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr +++ b/tests/ui/traits/not-suggest-non-existing-fully-qualified-path.stderr @@ -21,8 +21,9 @@ LL | T: I, | ---- unsatisfied trait bound introduced here help: try using a fully qualified path to specify the expected types | -LL | as V>::method(a); - | +++++++++++++++++++++++ ~ +LL - a.method(); +LL + as V>::method(a); + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/suggest-fully-qualified-closure.stderr b/tests/ui/traits/suggest-fully-qualified-closure.stderr index a2c1115e673a..8975d04d5b3e 100644 --- a/tests/ui/traits/suggest-fully-qualified-closure.stderr +++ b/tests/ui/traits/suggest-fully-qualified-closure.stderr @@ -14,8 +14,9 @@ LL | impl MyTrait for Qqq{ | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | >::lol::<_>(&q, ||()); - | +++++++++++++++++++++++++++++++ ~ +LL - q.lol(||()); +LL + >::lol::<_>(&q, ||()); + | error: aborting due to 1 previous error diff --git a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr index 841acb5ffd3c..0996227e6970 100644 --- a/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr +++ b/tests/ui/traits/suggest-fully-qualified-path-with-adjustment.stderr @@ -14,8 +14,9 @@ LL | impl Method for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | >::method(&thing); - | ++++++++++++++++++++++++++++++ ~ +LL - thing.method(); +LL + >::method(&thing); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:46:11 @@ -33,8 +34,9 @@ LL | impl Method for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | >::mut_method(&mut thing); - | +++++++++++++++++++++++++++++++++++++ ~ +LL - thing.mut_method(); +LL + >::mut_method(&mut thing); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:47:11 @@ -52,8 +54,9 @@ LL | impl MethodRef for &Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <&Thing as MethodRef>::by_self(&thing); - | +++++++++++++++++++++++++++++++++++ ~ +LL - thing.by_self(); +LL + <&Thing as MethodRef>::by_self(&thing); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:50:14 @@ -71,8 +74,9 @@ LL | impl Method for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | >::method(&deref_to); - | ++++++++++++++++++++++++++++++ ~ +LL - deref_to.method(); +LL + >::method(&deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:51:14 @@ -90,8 +94,9 @@ LL | impl Method for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | >::mut_method(&mut deref_to); - | +++++++++++++++++++++++++++++++++++++ ~ +LL - deref_to.mut_method(); +LL + >::mut_method(&mut deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:52:14 @@ -109,8 +114,9 @@ LL | impl MethodRef for &Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <&Thing as MethodRef>::by_self(&deref_to); - | +++++++++++++++++++++++++++++++++++ ~ +LL - deref_to.by_self(); +LL + <&Thing as MethodRef>::by_self(&deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:55:20 @@ -128,8 +134,9 @@ LL | impl Method for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | >::method(&deref_deref_to); - | ++++++++++++++++++++++++++++++ ~ +LL - deref_deref_to.method(); +LL + >::method(&deref_deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:56:20 @@ -147,8 +154,9 @@ LL | impl Method for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | >::mut_method(&mut deref_deref_to); - | +++++++++++++++++++++++++++++++++++++ ~ +LL - deref_deref_to.mut_method(); +LL + >::mut_method(&mut deref_deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-with-adjustment.rs:57:20 @@ -166,8 +174,9 @@ LL | impl MethodRef for &Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <&Thing as MethodRef>::by_self(&deref_deref_to); - | +++++++++++++++++++++++++++++++++++ ~ +LL - deref_deref_to.by_self(); +LL + <&Thing as MethodRef>::by_self(&deref_deref_to); + | error: aborting due to 9 previous errors diff --git a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr index 1865d81bad19..629904815f31 100644 --- a/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr +++ b/tests/ui/traits/suggest-fully-qualified-path-without-adjustment.stderr @@ -14,8 +14,9 @@ LL | impl Method for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | >::method(ref_thing); - | +++++++++++++++++++++++++++++ ~ +LL - ref_thing.method(); +LL + >::method(ref_thing); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:46:15 @@ -33,8 +34,9 @@ LL | impl MethodRef for &Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <&Thing as MethodRef>::by_self(ref_thing); - | ++++++++++++++++++++++++++++++++++ ~ +LL - ref_thing.by_self(); +LL + <&Thing as MethodRef>::by_self(ref_thing); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:49:15 @@ -52,8 +54,9 @@ LL | impl Method for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | >::method(mut_thing); - | +++++++++++++++++++++++++++++ ~ +LL - mut_thing.method(); +LL + >::method(mut_thing); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:50:15 @@ -71,8 +74,9 @@ LL | impl Method for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | >::mut_method(mut_thing); - | +++++++++++++++++++++++++++++++++ ~ +LL - mut_thing.mut_method(); +LL + >::mut_method(mut_thing); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:51:15 @@ -90,8 +94,9 @@ LL | impl MethodRef for &Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <&Thing as MethodRef>::by_self(mut_thing); - | ++++++++++++++++++++++++++++++++++ ~ +LL - mut_thing.by_self(); +LL + <&Thing as MethodRef>::by_self(mut_thing); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:54:14 @@ -109,8 +114,9 @@ LL | impl Method for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | >::method(deref_to); - | +++++++++++++++++++++++++++++ ~ +LL - deref_to.method(); +LL + >::method(deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:55:14 @@ -128,8 +134,9 @@ LL | impl Method for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | >::mut_method(deref_to); - | +++++++++++++++++++++++++++++++++ ~ +LL - deref_to.mut_method(); +LL + >::mut_method(deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:56:14 @@ -147,8 +154,9 @@ LL | impl MethodRef for &Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <&Thing as MethodRef>::by_self(deref_to); - | ++++++++++++++++++++++++++++++++++ ~ +LL - deref_to.by_self(); +LL + <&Thing as MethodRef>::by_self(deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:59:20 @@ -166,8 +174,9 @@ LL | impl Method for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | >::method(deref_deref_to); - | +++++++++++++++++++++++++++++ ~ +LL - deref_deref_to.method(); +LL + >::method(deref_deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:60:20 @@ -185,8 +194,9 @@ LL | impl Method for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | >::mut_method(deref_deref_to); - | +++++++++++++++++++++++++++++++++ ~ +LL - deref_deref_to.mut_method(); +LL + >::mut_method(deref_deref_to); + | error[E0283]: type annotations needed --> $DIR/suggest-fully-qualified-path-without-adjustment.rs:61:20 @@ -204,8 +214,9 @@ LL | impl MethodRef for &Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | <&Thing as MethodRef>::by_self(deref_deref_to); - | ++++++++++++++++++++++++++++++++++ ~ +LL - deref_deref_to.by_self(); +LL + <&Thing as MethodRef>::by_self(deref_deref_to); + | error: aborting due to 11 previous errors diff --git a/tests/ui/traits/trait-upcasting/subtrait-method.stderr b/tests/ui/traits/trait-upcasting/subtrait-method.stderr index a7658a7bcd3e..a16daa11d6f7 100644 --- a/tests/ui/traits/trait-upcasting/subtrait-method.stderr +++ b/tests/ui/traits/trait-upcasting/subtrait-method.stderr @@ -12,8 +12,9 @@ LL | trait Baz: Bar { | ^^^^^^^^^^^^^^ help: there is a method `a` with a similar name | -LL | bar.a(); - | ~ +LL - bar.c(); +LL + bar.a(); + | error[E0599]: no method named `b` found for reference `&dyn Foo` in the current scope --> $DIR/subtrait-method.rs:57:9 @@ -29,8 +30,9 @@ LL | trait Bar: Foo { | ^^^^^^^^^^^^^^ help: there is a method `a` with a similar name | -LL | foo.a(); - | ~ +LL - foo.b(); +LL + foo.a(); + | error[E0599]: no method named `c` found for reference `&dyn Foo` in the current scope --> $DIR/subtrait-method.rs:59:9 @@ -46,8 +48,9 @@ LL | trait Baz: Bar { | ^^^^^^^^^^^^^^ help: there is a method `a` with a similar name | -LL | foo.a(); - | ~ +LL - foo.c(); +LL + foo.a(); + | error[E0599]: no method named `b` found for reference `&dyn Foo` in the current scope --> $DIR/subtrait-method.rs:63:9 @@ -63,8 +66,9 @@ LL | trait Bar: Foo { | ^^^^^^^^^^^^^^ help: there is a method `a` with a similar name | -LL | foo.a(); - | ~ +LL - foo.b(); +LL + foo.a(); + | error[E0599]: no method named `c` found for reference `&dyn Foo` in the current scope --> $DIR/subtrait-method.rs:65:9 @@ -80,8 +84,9 @@ LL | trait Baz: Bar { | ^^^^^^^^^^^^^^ help: there is a method `a` with a similar name | -LL | foo.a(); - | ~ +LL - foo.c(); +LL + foo.a(); + | error: aborting due to 5 previous errors diff --git a/tests/ui/traits/wrong-mul-method-signature.stderr b/tests/ui/traits/wrong-mul-method-signature.stderr index e30b61622ae0..c85775f48871 100644 --- a/tests/ui/traits/wrong-mul-method-signature.stderr +++ b/tests/ui/traits/wrong-mul-method-signature.stderr @@ -8,8 +8,9 @@ LL | fn mul(self, s: &f64) -> Vec1 { found signature `fn(Vec1, &_) -> Vec1` help: change the parameter type to match the trait | -LL | fn mul(self, s: f64) -> Vec1 { - | ~~~ +LL - fn mul(self, s: &f64) -> Vec1 { +LL + fn mul(self, s: f64) -> Vec1 { + | error[E0053]: method `mul` has an incompatible type for trait --> $DIR/wrong-mul-method-signature.rs:33:21 @@ -21,8 +22,9 @@ LL | fn mul(self, s: f64) -> Vec2 { found signature `fn(Vec2, f64) -> Vec2` help: change the parameter type to match the trait | -LL | fn mul(self, s: Vec2) -> Vec2 { - | ~~~~ +LL - fn mul(self, s: f64) -> Vec2 { +LL + fn mul(self, s: Vec2) -> Vec2 { + | error[E0053]: method `mul` has an incompatible type for trait --> $DIR/wrong-mul-method-signature.rs:52:29 @@ -34,8 +36,9 @@ LL | fn mul(self, s: f64) -> f64 { found signature `fn(Vec3, _) -> f64` help: change the output type to match the trait | -LL | fn mul(self, s: f64) -> i32 { - | ~~~ +LL - fn mul(self, s: f64) -> f64 { +LL + fn mul(self, s: f64) -> i32 { + | error[E0308]: mismatched types --> $DIR/wrong-mul-method-signature.rs:63:45 diff --git a/tests/ui/transmutability/assoc-bound.stderr b/tests/ui/transmutability/assoc-bound.stderr index b3c7680bf294..4ff67bd636ad 100644 --- a/tests/ui/transmutability/assoc-bound.stderr +++ b/tests/ui/transmutability/assoc-bound.stderr @@ -12,8 +12,9 @@ LL | type AssocB: std::mem::TransmuteFrom<()>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `B::AssocB` help: consider further restricting the associated type | -LL | T: A, ::AssocA: TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }> - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - T: A, +LL + T: A, ::AssocA: TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }> + | error[E0277]: `()` cannot be safely transmuted into `<&i32 as A>::AssocA` --> $DIR/assoc-bound.rs:24:19 diff --git a/tests/ui/tuple/tuple-index-not-tuple.stderr b/tests/ui/tuple/tuple-index-not-tuple.stderr index a267e41b1bc3..faf9a313478d 100644 --- a/tests/ui/tuple/tuple-index-not-tuple.stderr +++ b/tests/ui/tuple/tuple-index-not-tuple.stderr @@ -6,8 +6,9 @@ LL | origin.0; | help: a field with a similar name exists | -LL | origin.x; - | ~ +LL - origin.0; +LL + origin.x; + | error[E0609]: no field `0` on type `Empty` --> $DIR/tuple-index-not-tuple.rs:8:11 diff --git a/tests/ui/tuple/tuple-index-out-of-bounds.stderr b/tests/ui/tuple/tuple-index-out-of-bounds.stderr index 96090435d06b..8b3c835c3e3c 100644 --- a/tests/ui/tuple/tuple-index-out-of-bounds.stderr +++ b/tests/ui/tuple/tuple-index-out-of-bounds.stderr @@ -6,8 +6,9 @@ LL | origin.2; | help: a field with a similar name exists | -LL | origin.0; - | ~ +LL - origin.2; +LL + origin.0; + | error[E0609]: no field `2` on type `({integer}, {integer})` --> $DIR/tuple-index-out-of-bounds.rs:12:11 diff --git a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr index 482a314db602..8caf17ae2da5 100644 --- a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr +++ b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr @@ -43,8 +43,9 @@ LL | impl Enum { | --------------- `Self` is on type `Enum` in this `impl` help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters | -LL | Enum::<()>::TSVariant(()); - | ~~~~ +LL - Self::<()>::TSVariant(()); +LL + Enum::<()>::TSVariant(()); + | error[E0308]: mismatched types --> $DIR/enum-variant-generic-args.rs:17:31 @@ -83,8 +84,9 @@ LL | impl Enum { | --------------- `Self` is on type `Enum` in this `impl` help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters | -LL | Enum::<()>::TSVariant::<()>(()); - | ~~~~ +LL - Self::<()>::TSVariant::<()>(()); +LL + Enum::<()>::TSVariant::<()>(()); + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:20:33 @@ -151,8 +153,9 @@ LL | impl Enum { | --------------- `Self` is on type `Enum` in this `impl` help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters | -LL | Enum::<()>::SVariant { v: () }; - | ~~~~ +LL - Self::<()>::SVariant { v: () }; +LL + Enum::<()>::SVariant { v: () }; + | error[E0308]: mismatched types --> $DIR/enum-variant-generic-args.rs:31:35 @@ -184,8 +187,9 @@ LL | impl Enum { | --------------- `Self` is on type `Enum` in this `impl` help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters | -LL | Enum::<()>::SVariant::<()> { v: () }; - | ~~~~ +LL - Self::<()>::SVariant::<()> { v: () }; +LL + Enum::<()>::SVariant::<()> { v: () }; + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:34:32 @@ -240,8 +244,9 @@ LL | impl Enum { | --------------- `Self` is on type `Enum` in this `impl` help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters | -LL | Enum::<()>::UVariant; - | ~~~~ +LL - Self::<()>::UVariant; +LL + Enum::<()>::UVariant; + | error[E0109]: type arguments are not allowed on self type --> $DIR/enum-variant-generic-args.rs:45:16 @@ -261,8 +266,9 @@ LL | impl Enum { | --------------- `Self` is on type `Enum` in this `impl` help: the `Self` type doesn't accept type parameters, use the concrete type's name `Enum` instead if you want to specify its type parameters | -LL | Enum::<()>::UVariant::<()>; - | ~~~~ +LL - Self::<()>::UVariant::<()>; +LL + Enum::<()>::UVariant::<()>; + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:45:32 diff --git a/tests/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr b/tests/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr index 371f5b10988a..c4deafd4f6b7 100644 --- a/tests/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr +++ b/tests/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr @@ -11,8 +11,9 @@ LL | V(u8) | ^ help: provide the argument | -LL | ::V(/* u8 */); - | ~~~~~~~~~~ +LL - ::V(); +LL + ::V(/* u8 */); + | error[E0308]: mismatched types --> $DIR/enum-variant-priority-higher-than-other-inherent.rs:22:17 diff --git a/tests/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr b/tests/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr index 714b4fd7d25f..1ed78cbc0da2 100644 --- a/tests/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr +++ b/tests/ui/type-alias-enum-variants/incorrect-variant-form-through-alias-caught.stderr @@ -28,8 +28,9 @@ LL | let Alias::Braced(..) = panic!(); | help: use the struct variant pattern syntax | -LL | let Alias::Braced {} = panic!(); - | ~~ +LL - let Alias::Braced(..) = panic!(); +LL + let Alias::Braced {} = panic!(); + | error[E0618]: expected function, found enum variant `Alias::Unit` --> $DIR/incorrect-variant-form-through-alias-caught.rs:15:5 diff --git a/tests/ui/type-alias-impl-trait/unnameable_type.stderr b/tests/ui/type-alias-impl-trait/unnameable_type.stderr index 5b331c5660d9..25dc41df4193 100644 --- a/tests/ui/type-alias-impl-trait/unnameable_type.stderr +++ b/tests/ui/type-alias-impl-trait/unnameable_type.stderr @@ -16,8 +16,9 @@ LL | fn dont_define_this(_private: Private) {} found signature `fn(MyPrivate)` help: change the parameter type to match the trait | -LL | fn dont_define_this(private: Private) { - | ~~~~~~~ +LL - fn dont_define_this(private: MyPrivate) { +LL + fn dont_define_this(private: Private) { + | error: aborting due to 1 previous error diff --git a/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.eager.stderr b/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.eager.stderr index e891ff10fdaa..b0b183d652b0 100644 --- a/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.eager.stderr +++ b/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.eager.stderr @@ -17,8 +17,9 @@ LL | type AssokOf = T::Assok; | help: consider fully qualifying and renaming the associated type | -LL | type AssokOf = ::Assoc; - | + +++++++++ ~~~~~ +LL - type AssokOf = T::Assok; +LL + type AssokOf = ::Assoc; + | error[E0220]: associated type `Proj` not found for `T` --> $DIR/unresolved-assoc-ty-suggest-trait.rs:22:21 diff --git a/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.lazy.stderr b/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.lazy.stderr index 885c6ec9d8e8..79b9db1edf77 100644 --- a/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.lazy.stderr +++ b/tests/ui/type-alias/unresolved-assoc-ty-suggest-trait.lazy.stderr @@ -21,8 +21,9 @@ LL | type AssokOf = T::Assok; | +++++++ help: ...and changing the associated type name | -LL | type AssokOf = T::Assoc; - | ~~~~~ +LL - type AssokOf = T::Assok; +LL + type AssokOf = T::Assoc; + | error[E0220]: associated type `Proj` not found for `T` --> $DIR/unresolved-assoc-ty-suggest-trait.rs:22:21 diff --git a/tests/ui/type/issue-100584.stderr b/tests/ui/type/issue-100584.stderr index e1db14d1f001..7cbab1540660 100644 --- a/tests/ui/type/issue-100584.stderr +++ b/tests/ui/type/issue-100584.stderr @@ -19,8 +19,9 @@ LL | let _ = format!("{xyza}"); | ++++++++ + help: if this is intentional, prefix it with an underscore | -LL | fn foo(_xyza: &str) { - | ~~~~~ +LL - fn foo(xyza: &str) { +LL + fn foo(_xyza: &str) { + | error: unused variable: `xyza` --> $DIR/issue-100584.rs:7:9 @@ -37,8 +38,9 @@ LL | let _ = format!("aaa{xyza}bbb"); | ++++++++ + help: if this is intentional, prefix it with an underscore | -LL | fn foo3(_xyza: &str) { - | ~~~~~ +LL - fn foo3(xyza: &str) { +LL + fn foo3(_xyza: &str) { + | error: aborting due to 2 previous errors diff --git a/tests/ui/type/issue-103271.stderr b/tests/ui/type/issue-103271.stderr index f4dac51b2b47..1b84033291a5 100644 --- a/tests/ui/type/issue-103271.stderr +++ b/tests/ui/type/issue-103271.stderr @@ -6,8 +6,9 @@ LL | let iter_fun = <&[u32]>::iter; | help: the function `iter` is implemented on `[u32]` | -LL | let iter_fun = <[u32]>::iter; - | ~~~~~ +LL - let iter_fun = <&[u32]>::iter; +LL + let iter_fun = <[u32]>::iter; + | error[E0599]: no function or associated item named `iter` found for reference `&[u32]` in the current scope --> $DIR/issue-103271.rs:10:33 @@ -17,8 +18,9 @@ LL | let iter_fun2 = <(&[u32])>::iter; | help: the function `iter` is implemented on `[u32]` | -LL | let iter_fun2 = <([u32])>::iter; - | ~~~~~ +LL - let iter_fun2 = <(&[u32])>::iter; +LL + let iter_fun2 = <([u32])>::iter; + | error: aborting due to 2 previous errors diff --git a/tests/ui/type/pattern_types/pattern_type_mismatch.stderr b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr index 19b0c1059c86..aaf41ed6eba2 100644 --- a/tests/ui/type/pattern_types/pattern_type_mismatch.stderr +++ b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr @@ -6,8 +6,9 @@ LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); | help: if you meant to write a byte literal, prefix with `b` | -LL | const BAD_NESTING4: pattern_type!(u8 is b'a'..='a') = todo!(); - | ~~~~ +LL - const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); +LL + const BAD_NESTING4: pattern_type!(u8 is b'a'..='a') = todo!(); + | error[E0308]: mismatched types --> $DIR/pattern_type_mismatch.rs:8:47 @@ -17,8 +18,9 @@ LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); | help: if you meant to write a byte literal, prefix with `b` | -LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..=b'a') = todo!(); - | ~~~~ +LL - const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); +LL + const BAD_NESTING4: pattern_type!(u8 is 'a'..=b'a') = todo!(); + | error[E0308]: mismatched types --> $DIR/pattern_type_mismatch.rs:12:43 diff --git a/tests/ui/type/type-ascription-instead-of-statement-end.stderr b/tests/ui/type/type-ascription-instead-of-statement-end.stderr index 34c886423239..34759b413d89 100644 --- a/tests/ui/type/type-ascription-instead-of-statement-end.stderr +++ b/tests/ui/type/type-ascription-instead-of-statement-end.stderr @@ -7,8 +7,9 @@ LL | println!("test"): = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 help: use a semicolon instead | -LL | println!("test"); - | ~ +LL - println!("test"): +LL + println!("test"); + | error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` --> $DIR/type-ascription-instead-of-statement-end.rs:7:21 diff --git a/tests/ui/type/type-ascription-with-fn-call.stderr b/tests/ui/type/type-ascription-with-fn-call.stderr index 2691f10cf3ed..4222762373dc 100644 --- a/tests/ui/type/type-ascription-with-fn-call.stderr +++ b/tests/ui/type/type-ascription-with-fn-call.stderr @@ -7,8 +7,9 @@ LL | f() : = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 help: use a semicolon instead | -LL | f() ; - | ~ +LL - f() : +LL + f() ; + | error: aborting due to 1 previous error diff --git a/tests/ui/type/type-check/issue-41314.stderr b/tests/ui/type/type-check/issue-41314.stderr index 2a089029b0a5..6a1b22c542cd 100644 --- a/tests/ui/type/type-check/issue-41314.stderr +++ b/tests/ui/type/type-check/issue-41314.stderr @@ -6,8 +6,9 @@ LL | X::Y { number } => {} | help: use the tuple variant pattern syntax instead | -LL | X::Y(number) => {} - | ~~~~~~~~ +LL - X::Y { number } => {} +LL + X::Y(number) => {} + | error: aborting due to 1 previous error diff --git a/tests/ui/type/type-check/point-at-inference-3.stderr b/tests/ui/type/type-check/point-at-inference-3.stderr index 663799e9f86b..58460aefdf86 100644 --- a/tests/ui/type/type-check/point-at-inference-3.stderr +++ b/tests/ui/type/type-check/point-at-inference-3.stderr @@ -15,8 +15,9 @@ note: method defined here --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL help: change the type of the numeric literal from `u32` to `i32` | -LL | v.push(1i32); - | ~~~ +LL - v.push(1u32); +LL + v.push(1i32); + | error: aborting due to 1 previous error diff --git a/tests/ui/type/type-check/point-at-inference-4.stderr b/tests/ui/type/type-check/point-at-inference-4.stderr index 544c25934ec2..52d603c59808 100644 --- a/tests/ui/type/type-check/point-at-inference-4.stderr +++ b/tests/ui/type/type-check/point-at-inference-4.stderr @@ -11,8 +11,9 @@ LL | fn infer(&self, a: A, b: B) {} | ^^^^^ ---- help: provide the argument | -LL | s.infer(0i32, /* b */); - | ~~~~~~~~~~~~~~~ +LL - s.infer(0i32); +LL + s.infer(0i32, /* b */); + | error[E0308]: mismatched types --> $DIR/point-at-inference-4.rs:18:24 @@ -31,8 +32,9 @@ LL | let t: S = s; found struct `S` help: change the type of the numeric literal from `i32` to `u32` | -LL | s.infer(0u32); - | ~~~ +LL - s.infer(0i32); +LL + s.infer(0u32); + | error: aborting due to 2 previous errors diff --git a/tests/ui/type/type-dependent-def-issue-49241.stderr b/tests/ui/type/type-dependent-def-issue-49241.stderr index cf372dc59681..9b395af8c139 100644 --- a/tests/ui/type/type-dependent-def-issue-49241.stderr +++ b/tests/ui/type/type-dependent-def-issue-49241.stderr @@ -6,8 +6,9 @@ LL | const l: usize = v.count(); | help: consider using `let` instead of `const` | -LL | let l: usize = v.count(); - | ~~~ +LL - const l: usize = v.count(); +LL + let l: usize = v.count(); + | error: aborting due to 1 previous error diff --git a/tests/ui/type/wrong-call-return-type-due-to-generic-arg.stderr b/tests/ui/type/wrong-call-return-type-due-to-generic-arg.stderr index fbe6bfeebb14..53920bc9e02e 100644 --- a/tests/ui/type/wrong-call-return-type-due-to-generic-arg.stderr +++ b/tests/ui/type/wrong-call-return-type-due-to-generic-arg.stderr @@ -13,8 +13,9 @@ LL | fn wrong_arg_type(x: u32) -> u32 { | ^^^^^^^^^^^^^^ ------ help: change the type of the numeric literal from `u16` to `u32` | -LL | let x = wrong_arg_type(0u32); - | ~~~ +LL - let x = wrong_arg_type(0u16); +LL + let x = wrong_arg_type(0u32); + | error[E0308]: mismatched types --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:19:30 @@ -52,8 +53,9 @@ LL | fn function(x: T, y: bool) -> T { | ^^^^^^^^ ---- ------- help: change the type of the numeric literal from `u32` to `u16` | -LL | let x: u16 = function(0u16, 0u8); - | ~~~ +LL - let x: u16 = function(0u32, 0u8); +LL + let x: u16 = function(0u16, 0u8); + | error[E0308]: mismatched types --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:25:27 @@ -77,8 +79,9 @@ LL | fn function(x: T, y: bool) -> T { | ^^^^^^^^ ---- help: change the type of the numeric literal from `u32` to `u16` | -LL | let x: u16 = function(0u16, true); - | ~~~ +LL - let x: u16 = function(0u32, true); +LL + let x: u16 = function(0u16, true); + | error[E0308]: mismatched types --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:26:32 @@ -102,8 +105,9 @@ LL | fn method(&self, x: T) -> T { | ^^^^^^ ---- help: change the type of the numeric literal from `u32` to `u16` | -LL | let x: u16 = (S {}).method(0u16); - | ~~~ +LL - let x: u16 = (S {}).method(0u32); +LL + let x: u16 = (S {}).method(0u16); + | error[E0308]: arguments to this function are incorrect --> $DIR/wrong-call-return-type-due-to-generic-arg.rs:27:5 diff --git a/tests/ui/typeck/attempted-access-non-fatal.stderr b/tests/ui/typeck/attempted-access-non-fatal.stderr index bff669727a1b..03334759baf5 100644 --- a/tests/ui/typeck/attempted-access-non-fatal.stderr +++ b/tests/ui/typeck/attempted-access-non-fatal.stderr @@ -18,8 +18,9 @@ LL | let _ = 0.f; | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f32` suffix | -LL | let _ = 0.0f32; - | ~~~~ +LL - let _ = 0.f; +LL + let _ = 0.0f32; + | error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:7:15 @@ -29,8 +30,9 @@ LL | let _ = 2.l; | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | -LL | let _ = 2.0f64; - | ~~~~ +LL - let _ = 2.l; +LL + let _ = 2.0f64; + | error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:8:16 @@ -40,8 +42,9 @@ LL | let _ = 12.F; | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f32` suffix | -LL | let _ = 12.0f32; - | ~~~~ +LL - let _ = 12.F; +LL + let _ = 12.0f32; + | error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:9:16 @@ -51,8 +54,9 @@ LL | let _ = 34.L; | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | -LL | let _ = 34.0f64; - | ~~~~ +LL - let _ = 34.L; +LL + let _ = 34.0f64; + | error: aborting due to 6 previous errors diff --git a/tests/ui/typeck/check-args-on-fn-err-2.stderr b/tests/ui/typeck/check-args-on-fn-err-2.stderr index 301bb88dbacf..ccc006a902de 100644 --- a/tests/ui/typeck/check-args-on-fn-err-2.stderr +++ b/tests/ui/typeck/check-args-on-fn-err-2.stderr @@ -8,8 +8,9 @@ LL | a((), 1i32 == 2u32); | help: change the type of the numeric literal from `u32` to `i32` | -LL | a((), 1i32 == 2i32); - | ~~~ +LL - a((), 1i32 == 2u32); +LL + a((), 1i32 == 2i32); + | error[E0425]: cannot find function `a` in this scope --> $DIR/check-args-on-fn-err-2.rs:2:5 diff --git a/tests/ui/typeck/cyclic_type_ice.stderr b/tests/ui/typeck/cyclic_type_ice.stderr index 36715b4ee5d1..4dc02a53c021 100644 --- a/tests/ui/typeck/cyclic_type_ice.stderr +++ b/tests/ui/typeck/cyclic_type_ice.stderr @@ -22,8 +22,9 @@ LL | let f = |_, _| (); | ^^^^^^ help: provide the argument | -LL | f(/* */, /* */); - | ~~~~~~~~~~~~~~~~ +LL - f(f); +LL + f(/* */, /* */); + | error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/deref-multi.stderr b/tests/ui/typeck/deref-multi.stderr index 4346e273d0d6..02513853c486 100644 --- a/tests/ui/typeck/deref-multi.stderr +++ b/tests/ui/typeck/deref-multi.stderr @@ -34,8 +34,9 @@ LL | &x | help: consider removing the `&` and dereferencing the borrow instead | -LL | *x - | ~ +LL - &x +LL + *x + | error[E0308]: mismatched types --> $DIR/deref-multi.rs:17:5 @@ -49,8 +50,9 @@ LL | &x found reference `&Box` help: consider removing the `&` and dereferencing the borrow instead | -LL | *x - | ~ +LL - &x +LL + *x + | error[E0308]: mismatched types --> $DIR/deref-multi.rs:22:5 diff --git a/tests/ui/typeck/ice-self-mismatch-const-generics.stderr b/tests/ui/typeck/ice-self-mismatch-const-generics.stderr index 068cf3ee9036..8b820668129f 100644 --- a/tests/ui/typeck/ice-self-mismatch-const-generics.stderr +++ b/tests/ui/typeck/ice-self-mismatch-const-generics.stderr @@ -12,8 +12,9 @@ LL | Self { thing } found struct `GenericStruct<0, _>` help: use the type name directly | -LL | GenericStruct::<1, T> { thing } - | ~~~~~~~~~~~~~~~~~~~~~ +LL - Self { thing } +LL + GenericStruct::<1, T> { thing } + | error[E0308]: mismatched types --> $DIR/ice-self-mismatch-const-generics.rs:20:9 @@ -29,8 +30,9 @@ LL | Self { 0: thing } found struct `GenericStruct2<0, _>` help: use the type name directly | -LL | GenericStruct2::<1, T> { 0: thing } - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - Self { 0: thing } +LL + GenericStruct2::<1, T> { 0: thing } + | error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/ice-unexpected-region-123863.stderr b/tests/ui/typeck/ice-unexpected-region-123863.stderr index 742096f3861f..8a4d767c1435 100644 --- a/tests/ui/typeck/ice-unexpected-region-123863.stderr +++ b/tests/ui/typeck/ice-unexpected-region-123863.stderr @@ -38,8 +38,9 @@ LL | Inner::concat_strs::<"a">::A | help: if there were a trait named `Example` with associated type `concat_strs` implemented for `Inner<_>`, you could use the fully-qualified path | -LL | as Example>::concat_strs::A - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - Inner::concat_strs::<"a">::A +LL + as Example>::concat_strs::A + | error: aborting due to 3 previous errors diff --git a/tests/ui/typeck/issue-104582.stderr b/tests/ui/typeck/issue-104582.stderr index 61b6b23642cc..704579698b90 100644 --- a/tests/ui/typeck/issue-104582.stderr +++ b/tests/ui/typeck/issue-104582.stderr @@ -6,8 +6,9 @@ LL | let my_var: String(String?); | help: if you meant to express that the type might not contain a value, use the `Option` wrapper type | -LL | let my_var: String(Option); - | +++++++ ~ +LL - let my_var: String(String?); +LL + let my_var: String(Option); + | error[E0214]: parenthesized type parameters may only be used with a `Fn` trait --> $DIR/issue-104582.rs:2:17 @@ -17,8 +18,9 @@ LL | let my_var: String(String?); | help: use angle brackets instead | -LL | let my_var: String; - | ~ ~ +LL - let my_var: String(String?); +LL + let my_var: String; + | error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/issue-110052.stderr b/tests/ui/typeck/issue-110052.stderr index 5eb10d9a30e8..649fc8429b9c 100644 --- a/tests/ui/typeck/issue-110052.stderr +++ b/tests/ui/typeck/issue-110052.stderr @@ -6,10 +6,12 @@ LL | for<'iter> dyn Validator<<&'iter I>::Item>:, | help: use fully-qualified syntax | -LL | for<'iter> dyn Validator<<&'iter I as IntoAsyncIterator>::Item>:, - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -LL | for<'iter> dyn Validator<<&'iter I as IntoIterator>::Item>:, - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - for<'iter> dyn Validator<<&'iter I>::Item>:, +LL + for<'iter> dyn Validator<<&'iter I as IntoAsyncIterator>::Item>:, + | +LL - for<'iter> dyn Validator<<&'iter I>::Item>:, +LL + for<'iter> dyn Validator<<&'iter I as IntoIterator>::Item>:, + | error: aborting due to 1 previous error diff --git a/tests/ui/typeck/issue-112252-ptr-arithmetics-help.stderr b/tests/ui/typeck/issue-112252-ptr-arithmetics-help.stderr index f81736245f3c..18a992b2f341 100644 --- a/tests/ui/typeck/issue-112252-ptr-arithmetics-help.stderr +++ b/tests/ui/typeck/issue-112252-ptr-arithmetics-help.stderr @@ -8,8 +8,9 @@ LL | let _a = _ptr1 + 5; | help: consider using `wrapping_add` or `add` for pointer + {integer} | -LL | let _a = _ptr1.wrapping_add(5); - | ~~~~~~~~~~~~~~ + +LL - let _a = _ptr1 + 5; +LL + let _a = _ptr1.wrapping_add(5); + | error[E0369]: cannot subtract `{integer}` from `*const u32` --> $DIR/issue-112252-ptr-arithmetics-help.rs:7:20 @@ -21,8 +22,9 @@ LL | let _b = _ptr1 - 5; | help: consider using `wrapping_sub` or `sub` for pointer - {integer} | -LL | let _b = _ptr1.wrapping_sub(5); - | ~~~~~~~~~~~~~~ + +LL - let _b = _ptr1 - 5; +LL + let _b = _ptr1.wrapping_sub(5); + | error[E0369]: cannot subtract `*const u32` from `*const u32` --> $DIR/issue-112252-ptr-arithmetics-help.rs:8:20 @@ -34,8 +36,9 @@ LL | let _c = _ptr2 - _ptr1; | help: consider using `offset_from` for pointer - pointer if the pointers point to the same allocation | -LL | let _c = unsafe { _ptr2.offset_from(_ptr1) }; - | ++++++++ ~~~~~~~~~~~~~ +++ +LL - let _c = _ptr2 - _ptr1; +LL + let _c = unsafe { _ptr2.offset_from(_ptr1) }; + | error[E0608]: cannot index into a value of type `*const u32` --> $DIR/issue-112252-ptr-arithmetics-help.rs:9:19 @@ -45,8 +48,9 @@ LL | let _d = _ptr1[5]; | help: consider using `wrapping_add` or `add` for indexing into raw pointer | -LL | let _d = _ptr1.wrapping_add(5); - | ~~~~~~~~~~~~~~ ~ +LL - let _d = _ptr1[5]; +LL + let _d = _ptr1.wrapping_add(5); + | error: aborting due to 4 previous errors diff --git a/tests/ui/typeck/issue-114529-illegal-break-with-value.stderr b/tests/ui/typeck/issue-114529-illegal-break-with-value.stderr index 731f234c162a..de993df722ce 100644 --- a/tests/ui/typeck/issue-114529-illegal-break-with-value.stderr +++ b/tests/ui/typeck/issue-114529-illegal-break-with-value.stderr @@ -8,8 +8,9 @@ LL | break 9; | help: use `break` on its own without a value inside this `while` loop | -LL | break; - | ~~~~~ +LL - break 9; +LL + break; + | error[E0571]: `break` with value from a `while` loop --> $DIR/issue-114529-illegal-break-with-value.rs:16:13 @@ -21,8 +22,9 @@ LL | break v; | help: use `break` on its own without a value inside this `while` loop | -LL | break; - | ~~~~~ +LL - break v; +LL + break; + | error[E0571]: `break` with value from a `while` loop --> $DIR/issue-114529-illegal-break-with-value.rs:22:9 @@ -36,8 +38,11 @@ LL | | }); | help: use `break` on its own without a value inside this `while` loop | -LL | break; - | ~~~~~ +LL - break (|| { +LL - let local = 9; +LL - }); +LL + break; + | error: aborting due to 3 previous errors diff --git a/tests/ui/typeck/issue-29181.stderr b/tests/ui/typeck/issue-29181.stderr index 53addf2fe4d0..e73c3e518818 100644 --- a/tests/ui/typeck/issue-29181.stderr +++ b/tests/ui/typeck/issue-29181.stderr @@ -12,8 +12,9 @@ LL | let _ = |x: f64| x * 2.0.exp(); | help: you must specify a concrete type for this numeric value, like `f32` | -LL | let _ = |x: f64| x * 2.0_f32.exp(); - | ~~~~~~~ +LL - let _ = |x: f64| x * 2.0.exp(); +LL + let _ = |x: f64| x * 2.0_f32.exp(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/issue-53712.stderr b/tests/ui/typeck/issue-53712.stderr index ffaf5cde1d71..16a7ce0ea62f 100644 --- a/tests/ui/typeck/issue-53712.stderr +++ b/tests/ui/typeck/issue-53712.stderr @@ -6,8 +6,9 @@ LL | arr.0; | help: instead of using tuple indexing, use array indexing | -LL | arr[0]; - | ~ + +LL - arr.0; +LL + arr[0]; + | error: aborting due to 1 previous error diff --git a/tests/ui/typeck/issue-87872-missing-inaccessible-field-pattern.stderr b/tests/ui/typeck/issue-87872-missing-inaccessible-field-pattern.stderr index b9bdf6f9a399..ed0e4eb9ece8 100644 --- a/tests/ui/typeck/issue-87872-missing-inaccessible-field-pattern.stderr +++ b/tests/ui/typeck/issue-87872-missing-inaccessible-field-pattern.stderr @@ -6,16 +6,19 @@ LL | let foo::Foo {} = foo::Foo::default(); | help: include the missing field in the pattern and ignore the inaccessible fields | -LL | let foo::Foo { visible, .. } = foo::Foo::default(); - | ~~~~~~~~~~~~~~~ +LL - let foo::Foo {} = foo::Foo::default(); +LL + let foo::Foo { visible, .. } = foo::Foo::default(); + | help: if you don't care about this missing field, you can explicitly ignore it | -LL | let foo::Foo { visible: _, .. } = foo::Foo::default(); - | ~~~~~~~~~~~~~~~~~~ +LL - let foo::Foo {} = foo::Foo::default(); +LL + let foo::Foo { visible: _, .. } = foo::Foo::default(); + | help: or always ignore missing fields here | -LL | let foo::Foo { .. } = foo::Foo::default(); - | ~~~~~~ +LL - let foo::Foo {} = foo::Foo::default(); +LL + let foo::Foo { .. } = foo::Foo::default(); + | error: aborting due to 1 previous error diff --git a/tests/ui/typeck/method-chain-gats.stderr b/tests/ui/typeck/method-chain-gats.stderr index 633837922147..902255a28a62 100644 --- a/tests/ui/typeck/method-chain-gats.stderr +++ b/tests/ui/typeck/method-chain-gats.stderr @@ -19,8 +19,9 @@ LL | Self::Base: Functor; | ^^^^^^^^^^ required by this bound in `Functor::fmap` help: consider further restricting the associated type | -LL | T::Base: Functor = T::Base>, ::Base: Functor - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - T::Base: Functor = T::Base>, +LL + T::Base: Functor = T::Base>, ::Base: Functor + | error: aborting due to 1 previous error diff --git a/tests/ui/typeck/mismatched-map-under-self.stderr b/tests/ui/typeck/mismatched-map-under-self.stderr index 59de00a58bbe..fd6b3093ec97 100644 --- a/tests/ui/typeck/mismatched-map-under-self.stderr +++ b/tests/ui/typeck/mismatched-map-under-self.stderr @@ -13,8 +13,9 @@ LL | fn values(&self) -> Self::Values; found signature `fn(Option<_>)` help: change the self-receiver type to match the trait | -LL | fn values(&self) -> Self::Values { - | ~~~~~ +LL - fn values(self) -> Self::Values { +LL + fn values(&self) -> Self::Values { + | error[E0631]: type mismatch in function arguments --> $DIR/mismatched-map-under-self.rs:12:18 diff --git a/tests/ui/typeck/ptr-null-mutability-suggestions.stderr b/tests/ui/typeck/ptr-null-mutability-suggestions.stderr index 2912977a461a..aa1e79ac0d4a 100644 --- a/tests/ui/typeck/ptr-null-mutability-suggestions.stderr +++ b/tests/ui/typeck/ptr-null-mutability-suggestions.stderr @@ -15,8 +15,9 @@ LL | fn expecting_null_mut(_: *mut u8) {} | ^^^^^^^^^^^^^^^^^^ ---------- help: consider using `core::ptr::null_mut` instead | -LL | expecting_null_mut(core::ptr::null_mut()); - | ~~~~~~~~~~~~~~~~~~~~~ +LL - expecting_null_mut(ptr::null()); +LL + expecting_null_mut(core::ptr::null_mut()); + | error: aborting due to 1 previous error diff --git a/tests/ui/typeck/remove-semi-but-confused-char.stderr b/tests/ui/typeck/remove-semi-but-confused-char.stderr index 2d0b53a60ce4..7f5c0758dd14 100644 --- a/tests/ui/typeck/remove-semi-but-confused-char.stderr +++ b/tests/ui/typeck/remove-semi-but-confused-char.stderr @@ -6,8 +6,9 @@ LL | num * num; | help: Unicode character ';' (Greek Question Mark) looks like ';' (Semicolon), but it is not | -LL | num * num; - | ~ +LL - num * num; +LL + num * num; + | error[E0308]: mismatched types --> $DIR/remove-semi-but-confused-char.rs:5:28 diff --git a/tests/ui/typeck/struct-enum-wrong-args.stderr b/tests/ui/typeck/struct-enum-wrong-args.stderr index e58d162901e1..d1003fbb6b31 100644 --- a/tests/ui/typeck/struct-enum-wrong-args.stderr +++ b/tests/ui/typeck/struct-enum-wrong-args.stderr @@ -38,8 +38,9 @@ note: tuple variant defined here --> $SRC_DIR/core/src/result.rs:LL:COL help: provide the argument | -LL | let _ = Ok(/* value */); - | ~~~~~~~~~~~~~ +LL - let _ = Ok(); +LL + let _ = Ok(/* value */); + | error[E0061]: this struct takes 1 argument but 0 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:9:13 @@ -54,8 +55,9 @@ LL | struct Wrapper(i32); | ^^^^^^^ help: provide the argument | -LL | let _ = Wrapper(/* i32 */); - | ~~~~~~~~~~~ +LL - let _ = Wrapper(); +LL + let _ = Wrapper(/* i32 */); + | error[E0061]: this struct takes 1 argument but 2 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:10:13 @@ -87,8 +89,9 @@ LL | struct DoubleWrapper(i32, i32); | ^^^^^^^^^^^^^ help: provide the arguments | -LL | let _ = DoubleWrapper(/* i32 */, /* i32 */); - | ~~~~~~~~~~~~~~~~~~~~~~ +LL - let _ = DoubleWrapper(); +LL + let _ = DoubleWrapper(/* i32 */, /* i32 */); + | error[E0061]: this struct takes 2 arguments but 1 argument was supplied --> $DIR/struct-enum-wrong-args.rs:12:13 @@ -103,8 +106,9 @@ LL | struct DoubleWrapper(i32, i32); | ^^^^^^^^^^^^^ help: provide the argument | -LL | let _ = DoubleWrapper(5, /* i32 */); - | ~~~~~~~~~~~~~~ +LL - let _ = DoubleWrapper(5); +LL + let _ = DoubleWrapper(5, /* i32 */); + | error[E0061]: this struct takes 2 arguments but 3 arguments were supplied --> $DIR/struct-enum-wrong-args.rs:13:13 diff --git a/tests/ui/typeck/suggest-arg-comma-delete-ice.stderr b/tests/ui/typeck/suggest-arg-comma-delete-ice.stderr index 53608391f3c8..0b899ad27123 100644 --- a/tests/ui/typeck/suggest-arg-comma-delete-ice.stderr +++ b/tests/ui/typeck/suggest-arg-comma-delete-ice.stderr @@ -6,8 +6,9 @@ LL | main(rahh); | help: Unicode character ')' (Fullwidth Right Parenthesis) looks like ')' (Right Parenthesis), but it is not | -LL | main(rahh); - | ~ +LL - main(rahh); +LL + main(rahh); + | error[E0425]: cannot find value `rahh` in this scope --> $DIR/suggest-arg-comma-delete-ice.rs:15:10 diff --git a/tests/ui/typeck/typeck_type_placeholder_item.stderr b/tests/ui/typeck/typeck_type_placeholder_item.stderr index d2a850d7dbfb..c5bf9a47e913 100644 --- a/tests/ui/typeck/typeck_type_placeholder_item.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_item.stderr @@ -71,8 +71,9 @@ LL | static TEST3: _ = "test"; | help: replace this with a fully-specified type | -LL | static TEST3: &str = "test"; - | ~~~~ +LL - static TEST3: _ = "test"; +LL + static TEST3: &str = "test"; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:16:15 @@ -82,8 +83,9 @@ LL | static TEST4: _ = 145; | help: replace this with a fully-specified type | -LL | static TEST4: i32 = 145; - | ~~~ +LL - static TEST4: _ = 145; +LL + static TEST4: i32 = 145; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:19:16 @@ -95,8 +97,9 @@ LL | static TEST5: (_, _) = (1, 2); | help: replace this with a fully-specified type | -LL | static TEST5: (i32, i32) = (1, 2); - | ~~~~~~~~~~ +LL - static TEST5: (_, _) = (1, 2); +LL + static TEST5: (i32, i32) = (1, 2); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:22:13 @@ -106,8 +109,9 @@ LL | fn test6(_: _) { } | help: use type parameters instead | -LL | fn test6(_: T) { } - | +++ ~ +LL - fn test6(_: _) { } +LL + fn test6(_: T) { } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:25:18 @@ -117,8 +121,9 @@ LL | fn test6_b(_: _, _: T) { } | help: use type parameters instead | -LL | fn test6_b(_: U, _: T) { } - | +++ ~ +LL - fn test6_b(_: _, _: T) { } +LL + fn test6_b(_: U, _: T) { } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:28:30 @@ -128,8 +133,9 @@ LL | fn test6_c(_: _, _: (T, K, L, A, B)) { } | help: use type parameters instead | -LL | fn test6_c(_: U, _: (T, K, L, A, B)) { } - | +++ ~ +LL - fn test6_c(_: _, _: (T, K, L, A, B)) { } +LL + fn test6_c(_: U, _: (T, K, L, A, B)) { } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:31:13 @@ -139,8 +145,9 @@ LL | fn test7(x: _) { let _x: usize = x; } | help: use type parameters instead | -LL | fn test7(x: T) { let _x: usize = x; } - | +++ ~ +LL - fn test7(x: _) { let _x: usize = x; } +LL + fn test7(x: T) { let _x: usize = x; } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:34:22 @@ -159,8 +166,9 @@ LL | fn test8(_f: fn() -> _) { } | help: use type parameters instead | -LL | fn test8(_f: fn() -> T) { } - | +++ ~ +LL - fn test8(_f: fn() -> _) { } +LL + fn test8(_f: fn() -> T) { } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:48:26 @@ -188,8 +196,9 @@ LL | fn clone(&self) -> _ { Test9 } | help: try replacing `_` with the type in the corresponding trait method signature | -LL | fn clone(&self) -> Test9 { Test9 } - | ~~~~~ +LL - fn clone(&self) -> _ { Test9 } +LL + fn clone(&self) -> Test9 { Test9 } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:62:37 @@ -199,8 +208,9 @@ LL | fn clone_from(&mut self, other: _) { *self = Test9; } | help: try replacing `_` with the type in the corresponding trait method signature | -LL | fn clone_from(&mut self, other: &Test9) { *self = Test9; } - | ~~~~~~ +LL - fn clone_from(&mut self, other: _) { *self = Test9; } +LL + fn clone_from(&mut self, other: &Test9) { *self = Test9; } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs --> $DIR/typeck_type_placeholder_item.rs:67:8 @@ -235,8 +245,9 @@ LL | static B: _ = 42; | help: replace this with a fully-specified type | -LL | static B: i32 = 42; - | ~~~ +LL - static B: _ = 42; +LL + static B: i32 = 42; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:77:22 @@ -246,8 +257,9 @@ LL | static C: Option<_> = Some(42); | help: replace this with a fully-specified type | -LL | static C: Option = Some(42); - | ~~~~~~~~~~~ +LL - static C: Option<_> = Some(42); +LL + static C: Option = Some(42); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:79:21 @@ -276,8 +288,9 @@ LL | static FN_TEST3: _ = "test"; | help: replace this with a fully-specified type | -LL | static FN_TEST3: &str = "test"; - | ~~~~ +LL - static FN_TEST3: _ = "test"; +LL + static FN_TEST3: &str = "test"; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:88:22 @@ -287,8 +300,9 @@ LL | static FN_TEST4: _ = 145; | help: replace this with a fully-specified type | -LL | static FN_TEST4: i32 = 145; - | ~~~ +LL - static FN_TEST4: _ = 145; +LL + static FN_TEST4: i32 = 145; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/typeck_type_placeholder_item.rs:91:23 @@ -300,8 +314,9 @@ LL | static FN_TEST5: (_, _) = (1, 2); | help: replace this with a fully-specified type | -LL | static FN_TEST5: (i32, i32) = (1, 2); - | ~~~~~~~~~~ +LL - static FN_TEST5: (_, _) = (1, 2); +LL + static FN_TEST5: (i32, i32) = (1, 2); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:94:20 @@ -311,8 +326,9 @@ LL | fn fn_test6(_: _) { } | help: use type parameters instead | -LL | fn fn_test6(_: T) { } - | +++ ~ +LL - fn fn_test6(_: _) { } +LL + fn fn_test6(_: T) { } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:97:20 @@ -322,8 +338,9 @@ LL | fn fn_test7(x: _) { let _x: usize = x; } | help: use type parameters instead | -LL | fn fn_test7(x: T) { let _x: usize = x; } - | +++ ~ +LL - fn fn_test7(x: _) { let _x: usize = x; } +LL + fn fn_test7(x: T) { let _x: usize = x; } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:100:29 @@ -342,8 +359,9 @@ LL | fn fn_test8(_f: fn() -> _) { } | help: use type parameters instead | -LL | fn fn_test8(_f: fn() -> T) { } - | +++ ~ +LL - fn fn_test8(_f: fn() -> _) { } +LL + fn fn_test8(_f: fn() -> T) { } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:115:28 @@ -353,8 +371,9 @@ LL | fn clone(&self) -> _ { FnTest9 } | help: try replacing `_` with the type in the corresponding trait method signature | -LL | fn clone(&self) -> FnTest9 { FnTest9 } - | ~~~~~~~ +LL - fn clone(&self) -> _ { FnTest9 } +LL + fn clone(&self) -> FnTest9 { FnTest9 } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:118:41 @@ -364,8 +383,9 @@ LL | fn clone_from(&mut self, other: _) { *self = FnTest9; } | help: try replacing `_` with the type in the corresponding trait method signature | -LL | fn clone_from(&mut self, other: &FnTest9) { *self = FnTest9; } - | ~~~~~~~~ +LL - fn clone_from(&mut self, other: _) { *self = FnTest9; } +LL + fn clone_from(&mut self, other: &FnTest9) { *self = FnTest9; } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs --> $DIR/typeck_type_placeholder_item.rs:123:12 @@ -427,8 +447,9 @@ LL | fn method_test1(&self, x: _); | help: use type parameters instead | -LL | fn method_test1(&self, x: T); - | +++ ~ +LL - fn method_test1(&self, x: _); +LL + fn method_test1(&self, x: T); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:142:31 @@ -440,8 +461,9 @@ LL | fn method_test2(&self, x: _) -> _; | help: use type parameters instead | -LL | fn method_test2(&self, x: T) -> T; - | +++ ~ ~ +LL - fn method_test2(&self, x: _) -> _; +LL + fn method_test2(&self, x: T) -> T; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:144:31 @@ -451,8 +473,9 @@ LL | fn method_test3(&self) -> _; | help: use type parameters instead | -LL | fn method_test3(&self) -> T; - | +++ ~ +LL - fn method_test3(&self) -> _; +LL + fn method_test3(&self) -> T; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:146:26 @@ -462,8 +485,9 @@ LL | fn assoc_fn_test1(x: _); | help: use type parameters instead | -LL | fn assoc_fn_test1(x: T); - | +++ ~ +LL - fn assoc_fn_test1(x: _); +LL + fn assoc_fn_test1(x: T); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:148:26 @@ -475,8 +499,9 @@ LL | fn assoc_fn_test2(x: _) -> _; | help: use type parameters instead | -LL | fn assoc_fn_test2(x: T) -> T; - | +++ ~ ~ +LL - fn assoc_fn_test2(x: _) -> _; +LL + fn assoc_fn_test2(x: T) -> T; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item.rs:150:28 @@ -486,8 +511,9 @@ LL | fn assoc_fn_test3() -> _; | help: use type parameters instead | -LL | fn assoc_fn_test3() -> T; - | +++ ~ +LL - fn assoc_fn_test3() -> _; +LL + fn assoc_fn_test3() -> T; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs --> $DIR/typeck_type_placeholder_item.rs:154:21 @@ -497,8 +523,9 @@ LL | struct BadStruct<_>(_); | help: use type parameters instead | -LL | struct BadStruct(T); - | ~ ~ +LL - struct BadStruct<_>(_); +LL + struct BadStruct(T); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for implementations --> $DIR/typeck_type_placeholder_item.rs:159:15 @@ -522,8 +549,9 @@ LL | struct BadStruct1<_, _>(_); | help: use type parameters instead | -LL | struct BadStruct1(T); - | ~ ~ +LL - struct BadStruct1<_, _>(_); +LL + struct BadStruct1(T); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs --> $DIR/typeck_type_placeholder_item.rs:172:25 @@ -533,8 +561,9 @@ LL | struct BadStruct2<_, T>(_, T); | help: use type parameters instead | -LL | struct BadStruct2(U, T); - | ~ ~ +LL - struct BadStruct2<_, T>(_, T); +LL + struct BadStruct2(U, T); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for type aliases --> $DIR/typeck_type_placeholder_item.rs:176:14 @@ -562,8 +591,9 @@ LL | const D: _ = 42; | help: replace this with a fully-specified type | -LL | const D: i32 = 42; - | ~~~ +LL - const D: _ = 42; +LL + const D: i32 = 42; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants --> $DIR/typeck_type_placeholder_item.rs:209:14 @@ -597,8 +627,9 @@ LL | const _: Option<_> = map(value); | help: replace this with a fully-specified type | -LL | const _: Option = map(value); - | ~~~~~~~~~~ +LL - const _: Option<_> = map(value); +LL + const _: Option = map(value); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:226:31 @@ -638,8 +669,9 @@ LL | fn test10(&self, _x : _) { } | help: use type parameters instead | -LL | fn test10(&self, _x : T) { } - | +++ ~ +LL - fn test10(&self, _x : _) { } +LL + fn test10(&self, _x : T) { } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types --> $DIR/typeck_type_placeholder_item.rs:107:31 @@ -658,8 +690,9 @@ LL | fn fn_test10(&self, _x : _) { } | help: use type parameters instead | -LL | fn fn_test10(&self, _x : T) { } - | +++ ~ +LL - fn fn_test10(&self, _x : _) { } +LL + fn fn_test10(&self, _x : T) { } + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types --> $DIR/typeck_type_placeholder_item.rs:202:14 diff --git a/tests/ui/typeck/typeck_type_placeholder_item_help.stderr b/tests/ui/typeck/typeck_type_placeholder_item_help.stderr index a05e27cebfcd..afdd58e0a038 100644 --- a/tests/ui/typeck/typeck_type_placeholder_item_help.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_item_help.stderr @@ -15,8 +15,9 @@ LL | const TEST2: _ = 42u32; | help: replace this with a fully-specified type | -LL | const TEST2: u32 = 42u32; - | ~~~ +LL - const TEST2: _ = 42u32; +LL + const TEST2: u32 = 42u32; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/typeck_type_placeholder_item_help.rs:10:14 @@ -26,8 +27,9 @@ LL | const TEST3: _ = Some(42); | help: replace this with a fully-specified type | -LL | const TEST3: Option = Some(42); - | ~~~~~~~~~~~ +LL - const TEST3: _ = Some(42); +LL + const TEST3: Option = Some(42); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions --> $DIR/typeck_type_placeholder_item_help.rs:13:22 @@ -49,8 +51,9 @@ LL | const TEST6: _ = 13; | help: replace this with a fully-specified type | -LL | const TEST6: i32 = 13; - | ~~~ +LL - const TEST6: _ = 13; +LL + const TEST6: i32 = 13; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated constants --> $DIR/typeck_type_placeholder_item_help.rs:18:18 @@ -60,8 +63,9 @@ LL | const TEST5: _ = 42; | help: replace this with a fully-specified type | -LL | const TEST5: i32 = 42; - | ~~~ +LL - const TEST5: _ = 42; +LL + const TEST5: i32 = 42; + | error[E0308]: mismatched types --> $DIR/typeck_type_placeholder_item_help.rs:30:28 diff --git a/tests/ui/typeof/issue-100183.stderr b/tests/ui/typeof/issue-100183.stderr index 57317d449cf3..765a5c54428f 100644 --- a/tests/ui/typeof/issue-100183.stderr +++ b/tests/ui/typeof/issue-100183.stderr @@ -6,8 +6,9 @@ LL | y: (typeof("hey"),), | help: consider replacing `typeof(...)` with an actual type | -LL | y: (&str,), - | ~~~~ +LL - y: (typeof("hey"),), +LL + y: (&str,), + | error: aborting due to 1 previous error diff --git a/tests/ui/typeof/issue-29184.stderr b/tests/ui/typeof/issue-29184.stderr index f07c850e5566..d8d43504d722 100644 --- a/tests/ui/typeof/issue-29184.stderr +++ b/tests/ui/typeof/issue-29184.stderr @@ -6,8 +6,9 @@ LL | let x: typeof(92) = 92; | help: consider replacing `typeof(...)` with an actual type | -LL | let x: i32 = 92; - | ~~~ +LL - let x: typeof(92) = 92; +LL + let x: i32 = 92; + | error: aborting due to 1 previous error diff --git a/tests/ui/typeof/issue-42060.stderr b/tests/ui/typeof/issue-42060.stderr index 86ba9432384b..733ad37693be 100644 --- a/tests/ui/typeof/issue-42060.stderr +++ b/tests/ui/typeof/issue-42060.stderr @@ -6,8 +6,9 @@ LL | let other: typeof(thing) = thing; | help: consider using `const` instead of `let` | -LL | const thing: /* Type */ = (); - | ~~~~~ ++++++++++++ +LL - let thing = (); +LL + const thing: /* Type */ = (); + | error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-42060.rs:9:13 @@ -17,8 +18,9 @@ LL | ::N | help: consider using `const` instead of `let` | -LL | const q: /* Type */ = 1; - | ~~~~~ ++++++++++++ +LL - let q = 1; +LL + const q: /* Type */ = 1; + | error[E0516]: `typeof` is a reserved keyword but unimplemented --> $DIR/issue-42060.rs:3:16 diff --git a/tests/ui/typeof/type_mismatch.stderr b/tests/ui/typeof/type_mismatch.stderr index e75214cd31a6..d5494922b166 100644 --- a/tests/ui/typeof/type_mismatch.stderr +++ b/tests/ui/typeof/type_mismatch.stderr @@ -6,8 +6,9 @@ LL | let b: typeof(a) = 1i8; | help: consider replacing `typeof(...)` with an actual type | -LL | let b: u8 = 1i8; - | ~~ +LL - let b: typeof(a) = 1i8; +LL + let b: u8 = 1i8; + | error[E0308]: mismatched types --> $DIR/type_mismatch.rs:5:24 @@ -19,8 +20,9 @@ LL | let b: typeof(a) = 1i8; | help: change the type of the numeric literal from `i8` to `u8` | -LL | let b: typeof(a) = 1u8; - | ~~ +LL - let b: typeof(a) = 1i8; +LL + let b: typeof(a) = 1u8; + | error: aborting due to 2 previous errors diff --git a/tests/ui/ufcs/bad-builder.stderr b/tests/ui/ufcs/bad-builder.stderr index e466f94d0d84..a3528cb1e7d8 100644 --- a/tests/ui/ufcs/bad-builder.stderr +++ b/tests/ui/ufcs/bad-builder.stderr @@ -13,8 +13,9 @@ note: if you're trying to build a new `Vec` consider using one of the followi --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL help: there is an associated function `new` with a similar name | -LL | Vec::::new() - | ~~~ +LL - Vec::::mew() +LL + Vec::::new() + | error: aborting due to 1 previous error diff --git a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr index 2a8c4edbdb5f..7b5f7cd9f703 100644 --- a/tests/ui/ufcs/ufcs-explicit-self-bad.stderr +++ b/tests/ui/ufcs/ufcs-explicit-self-bad.stderr @@ -13,8 +13,9 @@ LL | fn dummy2(&self); found signature `fn(&Bar<_>)` help: change the self-receiver type to match the trait | -LL | fn dummy2(&self) {} - | ~~~~~ +LL - fn dummy2(self: &Bar) {} +LL + fn dummy2(&self) {} + | error[E0307]: invalid `self` parameter type: `isize` --> $DIR/ufcs-explicit-self-bad.rs:8:18 diff --git a/tests/ui/ufcs/ufcs-partially-resolved.stderr b/tests/ui/ufcs/ufcs-partially-resolved.stderr index eef55c8dc686..0a9c190cb356 100644 --- a/tests/ui/ufcs/ufcs-partially-resolved.stderr +++ b/tests/ui/ufcs/ufcs-partially-resolved.stderr @@ -24,7 +24,8 @@ LL | let _: ::N; | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | -LL | trait A = u32; +LL - type A = u32; +LL + trait A = u32; | error[E0576]: cannot find method or associated constant `N` in trait `Tr` @@ -53,7 +54,8 @@ LL | ::N; | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | -LL | trait A = u32; +LL - type A = u32; +LL + trait A = u32; | error[E0404]: expected trait, found enum `E` @@ -100,7 +102,8 @@ LL | let _: ::N::NN; | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | -LL | trait A = u32; +LL - type A = u32; +LL + trait A = u32; | error[E0576]: cannot find associated type `N` in trait `Tr` @@ -129,7 +132,8 @@ LL | ::N::NN; | help: you might have meant to use `#![feature(trait_alias)]` instead of a `type` alias | -LL | trait A = u32; +LL - type A = u32; +LL + trait A = u32; | error[E0404]: expected trait, found enum `E` @@ -253,8 +257,9 @@ LL | let _: ::Y::NN; | help: if there were a trait named `Example` with associated type `NN` implemented for `::Y`, you could use the fully-qualified path | -LL | let _: <::Y as Example>::NN; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _: ::Y::NN; +LL + let _: <::Y as Example>::NN; + | error[E0599]: no associated item named `NN` found for type `u16` in the current scope --> $DIR/ufcs-partially-resolved.rs:38:20 diff --git a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr index f8be11a24e3d..050718348839 100644 --- a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -30,8 +30,9 @@ note: method defined here --> $SRC_DIR/core/src/ops/arith.rs:LL:COL help: change the type of the numeric literal from `u32` to `i32` | -LL | >::add(1i32, 2); - | ~~~ +LL - >::add(1u32, 2); +LL + >::add(1i32, 2); + | error[E0308]: mismatched types --> $DIR/ufcs-qpath-self-mismatch.rs:9:31 @@ -52,8 +53,9 @@ note: method defined here --> $SRC_DIR/core/src/ops/arith.rs:LL:COL help: change the type of the numeric literal from `u32` to `i32` | -LL | >::add(1, 2i32); - | ~~~ +LL - >::add(1, 2u32); +LL + >::add(1, 2i32); + | error[E0277]: cannot add `u32` to `i32` --> $DIR/ufcs-qpath-self-mismatch.rs:4:5 diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr index ce2c90f97da6..1c6470eef8f7 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr @@ -6,8 +6,9 @@ LL | let b = Bar::(isize, usize)::new(); // OK too (for the parser) | help: use angle brackets instead | -LL | let b = Bar::::new(); // OK too (for the parser) - | ~ ~ +LL - let b = Bar::(isize, usize)::new(); // OK too (for the parser) +LL + let b = Bar::::new(); // OK too (for the parser) + | error: aborting due to 1 previous error diff --git a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr index 327df50e645d..d87588d18225 100644 --- a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr +++ b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr @@ -13,8 +13,9 @@ LL | let mut f = |x: isize, y: isize| -> isize { x + y }; | ^^^^^^^^ help: change the type of the numeric literal from `usize` to `isize` | -LL | let z = f(1_isize, 2); - | ~~~~~ +LL - let z = f(1_usize, 2); +LL + let z = f(1_isize, 2); + | error[E0308]: mismatched types --> $DIR/unboxed-closures-type-mismatch.rs:9:15 @@ -38,8 +39,9 @@ LL | let mut g = |x, y| { x + y }; | ^ help: change the type of the numeric literal from `usize` to `i32` | -LL | let z = g(1_i32, 2); - | ~~~ +LL - let z = g(1_usize, 2); +LL + let z = g(1_i32, 2); + | error[E0308]: mismatched types --> $DIR/unboxed-closures-type-mismatch.rs:17:18 @@ -63,8 +65,9 @@ LL | let identity = |x| x; | ^ help: change the type of the numeric literal from `u16` to `u8` | -LL | identity(1u8); - | ~~ +LL - identity(1u16); +LL + identity(1u8); + | error[E0308]: mismatched types --> $DIR/unboxed-closures-type-mismatch.rs:20:18 @@ -111,8 +114,9 @@ LL | let identity = |x| x; | ^ help: change the type of the numeric literal from `u16` to `u8` | -LL | identity(1u8); - | ~~ +LL - identity(1u16); +LL + identity(1u8); + | error[E0308]: mismatched types --> $DIR/unboxed-closures-type-mismatch.rs:33:18 diff --git a/tests/ui/underscore-lifetime/in-fn-return-illegal.stderr b/tests/ui/underscore-lifetime/in-fn-return-illegal.stderr index fb036c695b41..a53e8adbecf9 100644 --- a/tests/ui/underscore-lifetime/in-fn-return-illegal.stderr +++ b/tests/ui/underscore-lifetime/in-fn-return-illegal.stderr @@ -7,8 +7,9 @@ LL | fn foo(x: &u32, y: &u32) -> &'_ u32 { loop { } } = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `x` or `y` help: consider introducing a named lifetime parameter | -LL | fn foo<'a>(x: &'a u32, y: &'a u32) -> &'a u32 { loop { } } - | ++++ ++ ++ ~~ +LL - fn foo(x: &u32, y: &u32) -> &'_ u32 { loop { } } +LL + fn foo<'a>(x: &'a u32, y: &'a u32) -> &'a u32 { loop { } } + | error: aborting due to 1 previous error diff --git a/tests/ui/underscore-lifetime/underscore-lifetime-binders.stderr b/tests/ui/underscore-lifetime/underscore-lifetime-binders.stderr index cd74d27dcb55..d940166e9e28 100644 --- a/tests/ui/underscore-lifetime/underscore-lifetime-binders.stderr +++ b/tests/ui/underscore-lifetime/underscore-lifetime-binders.stderr @@ -6,8 +6,9 @@ LL | struct Baz<'a>(&'_ &'a u8); | help: consider using the `'a` lifetime | -LL | struct Baz<'a>(&'a &'a u8); - | ~~ +LL - struct Baz<'a>(&'_ &'a u8); +LL + struct Baz<'a>(&'a &'a u8); + | error[E0637]: `'_` cannot be used here --> $DIR/underscore-lifetime-binders.rs:4:8 @@ -30,8 +31,9 @@ LL | fn meh() -> Box Meh<'_>> = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values | -LL | fn meh() -> Box Meh<'static>> - | ~~~~~~~ +LL - fn meh() -> Box Meh<'_>> +LL + fn meh() -> Box Meh<'static>> + | error[E0106]: missing lifetime specifier --> $DIR/underscore-lifetime-binders.rs:16:35 @@ -42,8 +44,9 @@ LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y } = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or `y` help: consider introducing a named lifetime parameter | -LL | fn foo2<'a>(_: &'a u8, y: &'a u8) -> &'a u8 { y } - | ++++ ~~ ~~ ~~ +LL - fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y } +LL + fn foo2<'a>(_: &'a u8, y: &'a u8) -> &'a u8 { y } + | error: aborting due to 5 previous errors diff --git a/tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr b/tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr index 8bd9b1112c56..4b530ca4ba65 100644 --- a/tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr +++ b/tests/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr @@ -12,8 +12,9 @@ LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } = help: see for more information about variance help: consider introducing a named lifetime parameter | -LL | fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } - | ++++ ~~ ~~ +LL - fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } +LL + fn foo<'a>(x: &mut Vec<&'a u8>, y: &'a u8) { x.push(y); } + | error: aborting due to 1 previous error diff --git a/tests/ui/union/union-suggest-field.stderr b/tests/ui/union/union-suggest-field.stderr index 5c428cf6c899..fc6daca2a479 100644 --- a/tests/ui/union/union-suggest-field.stderr +++ b/tests/ui/union/union-suggest-field.stderr @@ -6,8 +6,9 @@ LL | let u = U { principle: 0 }; | help: a field with a similar name exists | -LL | let u = U { principal: 0 }; - | ~~~~~~~~~ +LL - let u = U { principle: 0 }; +LL + let u = U { principal: 0 }; + | error[E0609]: no field `principial` on type `U` --> $DIR/union-suggest-field.rs:14:15 @@ -17,8 +18,9 @@ LL | let w = u.principial; | help: a field with a similar name exists | -LL | let w = u.principal; - | ~~~~~~~~~ +LL - let w = u.principial; +LL + let w = u.principal; + | error[E0615]: attempted to take value of method `calculate` on type `U` --> $DIR/union-suggest-field.rs:18:15 diff --git a/tests/ui/unresolved/unresolved-candidates.stderr b/tests/ui/unresolved/unresolved-candidates.stderr index 7ef2f6b1a292..0810f90306e8 100644 --- a/tests/ui/unresolved/unresolved-candidates.stderr +++ b/tests/ui/unresolved/unresolved-candidates.stderr @@ -6,8 +6,9 @@ LL | use Trait; | help: consider importing this trait instead | -LL | use a::Trait; - | ~~~~~~~~ +LL - use Trait; +LL + use a::Trait; + | error[E0405]: cannot find trait `Trait` in this scope --> $DIR/unresolved-candidates.rs:10:10 diff --git a/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr b/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr index b0352ab67543..f96cf69a2afc 100644 --- a/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr +++ b/tests/ui/unresolved/unresolved-import-avoid-suggesting-global-path.stderr @@ -6,8 +6,9 @@ LL | use module::SomeUsefulType; | help: consider importing this struct instead | -LL | use library::SomeUsefulType; - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - use module::SomeUsefulType; +LL + use library::SomeUsefulType; + | error[E0432]: unresolved import `module::SomeUsefulType` --> $DIR/unresolved-import-avoid-suggesting-global-path.rs:28:9 @@ -17,8 +18,9 @@ LL | use module::SomeUsefulType; | help: consider importing this struct instead | -LL | use library::SomeUsefulType; - | ~~~~~~~~~~~~~~~~~~~~~~~ +LL - use module::SomeUsefulType; +LL + use library::SomeUsefulType; + | error: aborting due to 2 previous errors diff --git a/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr index c6812dbb1963..31b943defbaa 100644 --- a/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr +++ b/tests/ui/unresolved/unresolved-import-suggest-disambiguated-crate-name.stderr @@ -6,8 +6,9 @@ LL | pub use module::SomeUsefulType; | help: consider importing this struct instead | -LL | pub use ::library::SomeUsefulType; - | ~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - pub use module::SomeUsefulType; +LL + pub use ::library::SomeUsefulType; + | error: aborting due to 1 previous error diff --git a/tests/ui/unsigned-literal-negation.stderr b/tests/ui/unsigned-literal-negation.stderr index b0a730477a1b..0bedbc1accd3 100644 --- a/tests/ui/unsigned-literal-negation.stderr +++ b/tests/ui/unsigned-literal-negation.stderr @@ -7,8 +7,9 @@ LL | let x = -1 as usize; = note: unsigned values cannot be negated help: you may have meant the maximum value of `usize` | -LL | let x = usize::MAX; - | ~~~~~~~~~~ +LL - let x = -1 as usize; +LL + let x = usize::MAX; + | error[E0600]: cannot apply unary operator `-` to type `usize` --> $DIR/unsigned-literal-negation.rs:3:13 @@ -19,8 +20,9 @@ LL | let x = (-1) as usize; = note: unsigned values cannot be negated help: you may have meant the maximum value of `usize` | -LL | let x = usize::MAX; - | ~~~~~~~~~~ +LL - let x = (-1) as usize; +LL + let x = usize::MAX; + | error[E0600]: cannot apply unary operator `-` to type `u32` --> $DIR/unsigned-literal-negation.rs:4:18 @@ -31,8 +33,9 @@ LL | let x: u32 = -1; = note: unsigned values cannot be negated help: you may have meant the maximum value of `u32` | -LL | let x: u32 = u32::MAX; - | ~~~~~~~~ +LL - let x: u32 = -1; +LL + let x: u32 = u32::MAX; + | error: aborting due to 3 previous errors diff --git a/tests/ui/unsized/box-instead-of-dyn-fn.stderr b/tests/ui/unsized/box-instead-of-dyn-fn.stderr index 1836d5dfffe2..b666718262da 100644 --- a/tests/ui/unsized/box-instead-of-dyn-fn.stderr +++ b/tests/ui/unsized/box-instead-of-dyn-fn.stderr @@ -6,8 +6,9 @@ LL | fn print_on_or_the_other<'a>(a: i32, b: &'a String) -> dyn Fn() + 'a { | help: consider returning an `impl Trait` instead of a `dyn Trait` | -LL | fn print_on_or_the_other<'a>(a: i32, b: &'a String) -> impl Fn() + 'a { - | ~~~~ +LL - fn print_on_or_the_other<'a>(a: i32, b: &'a String) -> dyn Fn() + 'a { +LL + fn print_on_or_the_other<'a>(a: i32, b: &'a String) -> impl Fn() + 'a { + | help: alternatively, box the return type, and wrap all of the returned values in `Box::new` | LL ~ fn print_on_or_the_other<'a>(a: i32, b: &'a String) -> Box { diff --git a/tests/ui/unsized/issue-91803.stderr b/tests/ui/unsized/issue-91803.stderr index e0fde4b1c1bc..037ec2ceaa54 100644 --- a/tests/ui/unsized/issue-91803.stderr +++ b/tests/ui/unsized/issue-91803.stderr @@ -6,8 +6,9 @@ LL | fn or<'a>(first: &'static dyn Foo<'a>) -> dyn Foo<'a> { | help: consider returning an `impl Trait` instead of a `dyn Trait` | -LL | fn or<'a>(first: &'static dyn Foo<'a>) -> impl Foo<'a> { - | ~~~~ +LL - fn or<'a>(first: &'static dyn Foo<'a>) -> dyn Foo<'a> { +LL + fn or<'a>(first: &'static dyn Foo<'a>) -> impl Foo<'a> { + | help: alternatively, box the return type, and wrap all of the returned values in `Box::new` | LL | fn or<'a>(first: &'static dyn Foo<'a>) -> Box> { diff --git a/tests/ui/variants/variant-used-as-type.stderr b/tests/ui/variants/variant-used-as-type.stderr index 64424abbcecc..1857c10a8e9b 100644 --- a/tests/ui/variants/variant-used-as-type.stderr +++ b/tests/ui/variants/variant-used-as-type.stderr @@ -6,10 +6,12 @@ LL | B(Ty::A), | help: try using the variant's enum | -LL | B(E), - | ~ -LL | B(Ty), - | ~~ +LL - B(Ty::A), +LL + B(E), + | +LL - B(Ty::A), +LL + B(Ty), + | error[E0573]: expected type, found variant `E::A` --> $DIR/variant-used-as-type.rs:17:6 @@ -19,10 +21,12 @@ LL | impl E::A {} | help: try using the variant's enum | -LL | impl E {} - | ~ -LL | impl Ty {} - | ~~ +LL - impl E::A {} +LL + impl E {} + | +LL - impl E::A {} +LL + impl Ty {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr index 339f7b2cc820..3b4de0753af0 100644 --- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr +++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr @@ -96,8 +96,9 @@ LL | fn fnc(&self) -> Trait { | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn fnc(&self) -> Self { - | ~~~~ +LL - fn fnc(&self) -> Trait { +LL + fn fnc(&self) -> Self { + | error: aborting due to 7 previous errors; 3 warnings emitted From 4f18560d0600ae235289a6c4c745c9c4c300a602 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 10 Feb 2025 21:38:05 +0000 Subject: [PATCH 070/128] Don't ICE when failing to lower contracts for associated impl items --- compiler/rustc_ast_lowering/src/expr.rs | 21 +-- compiler/rustc_ast_lowering/src/item.rs | 166 +++++++++++----------- compiler/rustc_ast_lowering/src/lib.rs | 21 +-- tests/ui/contracts/associated-item.rs | 18 +++ tests/ui/contracts/associated-item.stderr | 11 ++ 5 files changed, 124 insertions(+), 113 deletions(-) create mode 100644 tests/ui/contracts/associated-item.rs create mode 100644 tests/ui/contracts/associated-item.stderr diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index 923fd65dccaf..af53c7ec2157 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -379,16 +379,16 @@ impl<'hir> LoweringContext<'_, 'hir> { }) } - /// Create an `ExprKind::Ret` that is preceded by a call to check contract ensures clause. + /// Create an `ExprKind::Ret` that is optionally wrapped by a call to check + /// a contract ensures clause, if it exists. fn checked_return(&mut self, opt_expr: Option<&'hir hir::Expr<'hir>>) -> hir::ExprKind<'hir> { - let checked_ret = if let Some(Some((span, fresh_ident))) = - self.contract.as_ref().map(|c| c.ensures.as_ref().map(|e| (e.expr.span, e.fresh_ident))) - { - let expr = opt_expr.unwrap_or_else(|| self.expr_unit(span)); - Some(self.inject_ensures_check(expr, span, fresh_ident.0, fresh_ident.2)) - } else { - opt_expr - }; + let checked_ret = + if let Some((check_span, check_ident, check_hir_id)) = self.contract_ensures { + let expr = opt_expr.unwrap_or_else(|| self.expr_unit(check_span)); + Some(self.inject_ensures_check(expr, check_span, check_ident, check_hir_id)) + } else { + opt_expr + }; hir::ExprKind::Ret(checked_ret) } @@ -1090,7 +1090,8 @@ impl<'hir> LoweringContext<'_, 'hir> { } else { None }; - let body_id = this.lower_fn_body(decl, |this| { + // FIXME(contracts): Support contracts on closures? + let body_id = this.lower_fn_body(decl, None, |this| { this.coroutine_kind = coroutine_kind; let e = this.lower_expr_mut(body); coroutine_kind = this.coroutine_kind; diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 7379a3d2cde6..f72274694827 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -211,36 +211,6 @@ impl<'hir> LoweringContext<'_, 'hir> { .. }) => { self.with_new_scopes(*fn_sig_span, |this| { - assert!(this.contract.is_none()); - if let Some(contract) = contract { - let requires = contract.requires.clone(); - let ensures = contract.ensures.clone(); - let ensures = ensures.map(|ens| { - // FIXME: this needs to be a fresh (or illegal) identifier to prevent - // accidental capture of a parameter or global variable. - let checker_ident: Ident = - Ident::from_str_and_span("__ensures_checker", ens.span); - let (checker_pat, checker_hir_id) = this.pat_ident_binding_mode_mut( - ens.span, - checker_ident, - hir::BindingMode::NONE, - ); - - crate::FnContractLoweringEnsures { - expr: ens, - fresh_ident: (checker_ident, checker_pat, checker_hir_id), - } - }); - - // Note: `with_new_scopes` will reinstall the outer - // item's contract (if any) after its callback finishes. - this.contract.replace(crate::FnContractLoweringInfo { - span, - requires, - ensures, - }); - } - // Note: we don't need to change the return type from `T` to // `impl Future` here because lower_body // only cares about the input argument patterns in the function @@ -254,6 +224,7 @@ impl<'hir> LoweringContext<'_, 'hir> { coroutine_kind, body.as_deref(), attrs, + contract.as_deref(), ); let itctx = ImplTraitContext::Universal; @@ -803,6 +774,8 @@ impl<'hir> LoweringContext<'_, 'hir> { (generics, kind, expr.is_some()) } AssocItemKind::Fn(box Fn { sig, generics, body: None, .. }) => { + // FIXME(contracts): Deny contract here since it won't apply to + // any impl method or callees. let names = self.lower_fn_params_to_names(&sig.decl); let (generics, sig) = self.lower_method_sig( generics, @@ -814,7 +787,7 @@ impl<'hir> LoweringContext<'_, 'hir> { ); (generics, hir::TraitItemKind::Fn(sig, hir::TraitFn::Required(names)), false) } - AssocItemKind::Fn(box Fn { sig, generics, body: Some(body), .. }) => { + AssocItemKind::Fn(box Fn { sig, generics, body: Some(body), contract, .. }) => { let body_id = self.lower_maybe_coroutine_body( sig.span, i.span, @@ -823,6 +796,7 @@ impl<'hir> LoweringContext<'_, 'hir> { sig.header.coroutine_kind, Some(body), attrs, + contract.as_deref(), ); let (generics, sig) = self.lower_method_sig( generics, @@ -931,7 +905,7 @@ impl<'hir> LoweringContext<'_, 'hir> { hir::ImplItemKind::Const(ty, body) }, ), - AssocItemKind::Fn(box Fn { sig, generics, body, .. }) => { + AssocItemKind::Fn(box Fn { sig, generics, body, contract, .. }) => { let body_id = self.lower_maybe_coroutine_body( sig.span, i.span, @@ -940,6 +914,7 @@ impl<'hir> LoweringContext<'_, 'hir> { sig.header.coroutine_kind, body.as_deref(), attrs, + contract.as_deref(), ); let (generics, sig) = self.lower_method_sig( generics, @@ -1088,72 +1063,89 @@ impl<'hir> LoweringContext<'_, 'hir> { pub(super) fn lower_fn_body( &mut self, decl: &FnDecl, + contract: Option<&FnContract>, body: impl FnOnce(&mut Self) -> hir::Expr<'hir>, ) -> hir::BodyId { self.lower_body(|this| { let params = this.arena.alloc_from_iter(decl.inputs.iter().map(|x| this.lower_param(x))); - let result = body(this); - - let opt_contract = this.contract.take(); + // Optionally lower the fn contract, which turns: + // // { body } - // ==> - // { contract_requires(PRECOND); { body } } - let Some(contract) = opt_contract else { return (params, result) }; - let result_ref = this.arena.alloc(result); - let lit_unit = |this: &mut LoweringContext<'_, 'hir>| { - this.expr(contract.span, hir::ExprKind::Tup(&[])) - }; - - let precond: hir::Stmt<'hir> = if let Some(req) = contract.requires { - let lowered_req = this.lower_expr_mut(&req); - let precond = this.expr_call_lang_item_fn_mut( - req.span, - hir::LangItem::ContractCheckRequires, - &*arena_vec![this; lowered_req], - ); - this.stmt_expr(req.span, precond) - } else { - let u = lit_unit(this); - this.stmt_expr(contract.span, u) - }; - - let (postcond_checker, result) = if let Some(ens) = contract.ensures { - let crate::FnContractLoweringEnsures { expr: ens, fresh_ident } = ens; - let lowered_ens: hir::Expr<'hir> = this.lower_expr_mut(&ens); - let postcond_checker = this.expr_call_lang_item_fn( - ens.span, - hir::LangItem::ContractBuildCheckEnsures, - &*arena_vec![this; lowered_ens], - ); - let checker_binding_pat = fresh_ident.1; - ( - this.stmt_let_pat( + // + // into: + // + // { contract_requires(PRECOND); let __postcond = |ret_val| POSTCOND; postcond({ body }) } + if let Some(contract) = contract { + let precond = if let Some(req) = &contract.requires { + // Lower the precondition check intrinsic. + let lowered_req = this.lower_expr_mut(&req); + let precond = this.expr_call_lang_item_fn_mut( + req.span, + hir::LangItem::ContractCheckRequires, + &*arena_vec![this; lowered_req], + ); + Some(this.stmt_expr(req.span, precond)) + } else { + None + }; + let (postcond, body) = if let Some(ens) = &contract.ensures { + let ens_span = this.lower_span(ens.span); + // Set up the postcondition `let` statement. + let check_ident: Ident = + Ident::from_str_and_span("__ensures_checker", ens_span); + let (checker_pat, check_hir_id) = this.pat_ident_binding_mode_mut( + ens_span, + check_ident, + hir::BindingMode::NONE, + ); + let lowered_ens = this.lower_expr_mut(&ens); + let postcond_checker = this.expr_call_lang_item_fn( + ens_span, + hir::LangItem::ContractBuildCheckEnsures, + &*arena_vec![this; lowered_ens], + ); + let postcond = this.stmt_let_pat( None, - ens.span, + ens_span, Some(postcond_checker), - this.arena.alloc(checker_binding_pat), + this.arena.alloc(checker_pat), hir::LocalSource::Contract, - ), - this.inject_ensures_check(result_ref, ens.span, fresh_ident.0, fresh_ident.2), - ) - } else { - let u = lit_unit(this); - (this.stmt_expr(contract.span, u), &*result_ref) - }; + ); - let block = this.block_all( - contract.span, - arena_vec![this; precond, postcond_checker], - Some(result), - ); - (params, this.expr_block(block)) + // Install contract_ensures so we will intercept `return` statements, + // then lower the body. + this.contract_ensures = Some((ens_span, check_ident, check_hir_id)); + let body = this.arena.alloc(body(this)); + + // Finally, inject an ensures check on the implicit return of the body. + let body = this.inject_ensures_check(body, ens_span, check_ident, check_hir_id); + (Some(postcond), body) + } else { + let body = &*this.arena.alloc(body(this)); + (None, body) + }; + // Flatten the body into precond, then postcond, then wrapped body. + let wrapped_body = this.block_all( + body.span, + this.arena.alloc_from_iter([precond, postcond].into_iter().flatten()), + Some(body), + ); + (params, this.expr_block(wrapped_body)) + } else { + (params, body(this)) + } }) } - fn lower_fn_body_block(&mut self, decl: &FnDecl, body: &Block) -> hir::BodyId { - self.lower_fn_body(decl, |this| this.lower_block_expr(body)) + fn lower_fn_body_block( + &mut self, + decl: &FnDecl, + body: &Block, + contract: Option<&FnContract>, + ) -> hir::BodyId { + self.lower_fn_body(decl, contract, |this| this.lower_block_expr(body)) } pub(super) fn lower_const_body(&mut self, span: Span, expr: Option<&Expr>) -> hir::BodyId { @@ -1179,12 +1171,13 @@ impl<'hir> LoweringContext<'_, 'hir> { coroutine_kind: Option, body: Option<&Block>, attrs: &'hir [hir::Attribute], + contract: Option<&FnContract>, ) -> hir::BodyId { let Some(body) = body else { // Functions without a body are an error, except if this is an intrinsic. For those we // create a fake body so that the entire rest of the compiler doesn't have to deal with // this as a special case. - return self.lower_fn_body(decl, |this| { + return self.lower_fn_body(decl, contract, |this| { if attrs.iter().any(|a| a.name_or_empty() == sym::rustc_intrinsic) { let span = this.lower_span(span); let empty_block = hir::Block { @@ -1209,8 +1202,9 @@ impl<'hir> LoweringContext<'_, 'hir> { }; let Some(coroutine_kind) = coroutine_kind else { // Typical case: not a coroutine. - return self.lower_fn_body_block(decl, body); + return self.lower_fn_body_block(decl, body, contract); }; + // FIXME(contracts): Support contracts on async fn. self.lower_body(|this| { let (parameters, expr) = this.lower_coroutine_body_with_moved_arguments( decl, diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 127b7e3684e9..215cb66d80cf 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -87,19 +87,6 @@ mod path; rustc_fluent_macro::fluent_messages! { "../messages.ftl" } -#[derive(Debug, Clone)] -struct FnContractLoweringInfo<'hir> { - pub span: Span, - pub requires: Option>, - pub ensures: Option>, -} - -#[derive(Debug, Clone)] -struct FnContractLoweringEnsures<'hir> { - expr: ast::ptr::P, - fresh_ident: (Ident, hir::Pat<'hir>, HirId), -} - struct LoweringContext<'a, 'hir> { tcx: TyCtxt<'hir>, resolver: &'a mut ResolverAstLowering, @@ -114,7 +101,7 @@ struct LoweringContext<'a, 'hir> { /// Collect items that were created by lowering the current owner. children: Vec<(LocalDefId, hir::MaybeOwner<'hir>)>, - contract: Option>, + contract_ensures: Option<(Span, Ident, HirId)>, coroutine_kind: Option, @@ -164,7 +151,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { bodies: Vec::new(), attrs: SortedMap::default(), children: Vec::default(), - contract: None, + contract_ensures: None, current_hir_id_owner: hir::CRATE_OWNER_ID, item_local_id_counter: hir::ItemLocalId::ZERO, ident_and_label_to_local_id: Default::default(), @@ -851,7 +838,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { let was_in_loop_condition = self.is_in_loop_condition; self.is_in_loop_condition = false; - let old_contract = self.contract.take(); + let old_contract = self.contract_ensures.take(); let catch_scope = self.catch_scope.take(); let loop_scope = self.loop_scope.take(); @@ -859,7 +846,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { self.catch_scope = catch_scope; self.loop_scope = loop_scope; - self.contract = old_contract; + self.contract_ensures = old_contract; self.is_in_loop_condition = was_in_loop_condition; diff --git a/tests/ui/contracts/associated-item.rs b/tests/ui/contracts/associated-item.rs new file mode 100644 index 000000000000..4a2d05abbc53 --- /dev/null +++ b/tests/ui/contracts/associated-item.rs @@ -0,0 +1,18 @@ +// Ensure we don't ICE when lowering contracts on an associated item. + +//@ compile-flags: --crate-type=lib +//@ check-pass + +#![feature(contracts)] +//~^ WARN the feature `contracts` is incomplete and may not be safe to use + +extern crate core; + +use core::contracts::requires; + +struct Foo; + +impl Foo { + #[requires(align > 0 && (align & (align - 1)) == 0)] + pub fn foo(align: i32) {} +} diff --git a/tests/ui/contracts/associated-item.stderr b/tests/ui/contracts/associated-item.stderr new file mode 100644 index 000000000000..20651026b87a --- /dev/null +++ b/tests/ui/contracts/associated-item.stderr @@ -0,0 +1,11 @@ +warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/associated-item.rs:6:12 + | +LL | #![feature(contracts)] + | ^^^^^^^^^ + | + = note: see issue #128044 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + From 95357c772c60b713f7af10d813ce4df94953431c Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 10 Feb 2025 21:53:05 +0000 Subject: [PATCH 071/128] Check whole Unsize predicate for escaping bound vars --- .../src/traits/select/candidate_assembly.rs | 5 +++-- ...unsize-goal-escaping-bounds.current.stderr | 19 ++++++++++++++++ .../ui/traits/unsize-goal-escaping-bounds.rs | 22 +++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 tests/ui/traits/unsize-goal-escaping-bounds.current.stderr create mode 100644 tests/ui/traits/unsize-goal-escaping-bounds.rs diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index e495bdbf7825..bfab009a7e35 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -920,11 +920,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { // T: Trait // so it seems ok if we (conservatively) fail to accept that `Unsize` // obligation above. Should be possible to extend this in the future. - let Some(source) = obligation.self_ty().no_bound_vars() else { + let Some(trait_pred) = obligation.predicate.no_bound_vars() else { // Don't add any candidates if there are bound regions. return; }; - let target = obligation.predicate.skip_binder().trait_ref.args.type_at(1); + let source = trait_pred.self_ty(); + let target = trait_pred.trait_ref.args.type_at(1); debug!(?source, ?target, "assemble_candidates_for_unsizing"); diff --git a/tests/ui/traits/unsize-goal-escaping-bounds.current.stderr b/tests/ui/traits/unsize-goal-escaping-bounds.current.stderr new file mode 100644 index 000000000000..e63a0bf50b7a --- /dev/null +++ b/tests/ui/traits/unsize-goal-escaping-bounds.current.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `for<'a> (): Unsize<(dyn Trait + 'a)>` is not satisfied + --> $DIR/unsize-goal-escaping-bounds.rs:20:5 + | +LL | foo(); + | ^^^^^ the trait `for<'a> Unsize<(dyn Trait + 'a)>` is not implemented for `()` + | + = note: all implementations of `Unsize` are provided automatically by the compiler, see for more information +note: required by a bound in `foo` + --> $DIR/unsize-goal-escaping-bounds.rs:15:17 + | +LL | fn foo() + | --- required by a bound in this function +LL | where +LL | for<'a> (): Unsize, + | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `foo` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/unsize-goal-escaping-bounds.rs b/tests/ui/traits/unsize-goal-escaping-bounds.rs new file mode 100644 index 000000000000..fb25f7a42390 --- /dev/null +++ b/tests/ui/traits/unsize-goal-escaping-bounds.rs @@ -0,0 +1,22 @@ +//@ revisions: current next +//@[next] compile-flags: -Znext-solver +//@[next] check-pass +//@ ignore-compare-mode-next-solver (explicit revisions) + +#![feature(unsize)] + +use std::marker::Unsize; + +trait Trait {} +impl Trait for () {} + +fn foo() +where + for<'a> (): Unsize, +{ +} + +fn main() { + foo(); + //[current]~^ ERROR the trait bound `for<'a> (): Unsize<(dyn Trait + 'a)>` is not satisfied +} From 4898753d5d20a1a871053eece96ec8d5a4f690f8 Mon Sep 17 00:00:00 2001 From: Lukas Markeffsky <@> Date: Tue, 11 Feb 2025 01:10:05 +0100 Subject: [PATCH 072/128] add test for const type_id misoptimization --- ...type_id_polymorphic.cursed_is_i32.GVN.diff | 13 +++++++++++ tests/mir-opt/gvn_type_id_polymorphic.rs | 22 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 tests/mir-opt/gvn_type_id_polymorphic.cursed_is_i32.GVN.diff create mode 100644 tests/mir-opt/gvn_type_id_polymorphic.rs diff --git a/tests/mir-opt/gvn_type_id_polymorphic.cursed_is_i32.GVN.diff b/tests/mir-opt/gvn_type_id_polymorphic.cursed_is_i32.GVN.diff new file mode 100644 index 000000000000..c9d641472d03 --- /dev/null +++ b/tests/mir-opt/gvn_type_id_polymorphic.cursed_is_i32.GVN.diff @@ -0,0 +1,13 @@ +- // MIR for `cursed_is_i32` before GVN ++ // MIR for `cursed_is_i32` after GVN + + fn cursed_is_i32() -> bool { + let mut _0: bool; + + bb0: { +- _0 = Eq(const cursed_is_i32::::{constant#0}, const cursed_is_i32::::{constant#1}); ++ _0 = const false; + return; + } + } + diff --git a/tests/mir-opt/gvn_type_id_polymorphic.rs b/tests/mir-opt/gvn_type_id_polymorphic.rs new file mode 100644 index 000000000000..a5b936e52daf --- /dev/null +++ b/tests/mir-opt/gvn_type_id_polymorphic.rs @@ -0,0 +1,22 @@ +//@ test-mir-pass: GVN +//@ compile-flags: -C opt-level=2 + +#![feature(core_intrinsics)] + +fn generic() {} + +const fn type_id_of_val(_: &T) -> u128 { + std::intrinsics::type_id::() +} + +// EMIT_MIR gvn_type_id_polymorphic.cursed_is_i32.GVN.diff +fn cursed_is_i32() -> bool { + // CHECK-LABEL: fn cursed_is_i32( + // CHECK: _0 = const false; + // CHECK-NEXT: return; + (const { type_id_of_val(&generic::) } == const { type_id_of_val(&generic::) }) +} + +fn main() { + dbg!(cursed_is_i32::()); +} From c1da4f1d3c4fc4beb5edcfa8a303a1dcbe27b65e Mon Sep 17 00:00:00 2001 From: Lukas Markeffsky <@> Date: Mon, 10 Feb 2025 22:06:19 +0000 Subject: [PATCH 073/128] fix ensure_monomorphic_enough --- .../rustc_const_eval/src/interpret/util.rs | 44 ++----------------- ...type_id_polymorphic.cursed_is_i32.GVN.diff | 3 +- tests/mir-opt/gvn_type_id_polymorphic.rs | 2 +- 3 files changed, 5 insertions(+), 44 deletions(-) diff --git a/compiler/rustc_const_eval/src/interpret/util.rs b/compiler/rustc_const_eval/src/interpret/util.rs index eb98e3b53805..ba579e25f036 100644 --- a/compiler/rustc_const_eval/src/interpret/util.rs +++ b/compiler/rustc_const_eval/src/interpret/util.rs @@ -1,12 +1,8 @@ -use std::ops::ControlFlow; - use rustc_hir::def_id::LocalDefId; use rustc_middle::mir; use rustc_middle::mir::interpret::{AllocInit, Allocation, InterpResult, Pointer}; use rustc_middle::ty::layout::TyAndLayout; -use rustc_middle::ty::{ - self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor, -}; +use rustc_middle::ty::{TyCtxt, TypeVisitable, TypeVisitableExt}; use tracing::debug; use super::{InterpCx, MPlaceTy, MemoryKind, interp_ok, throw_inval}; @@ -20,44 +16,10 @@ where T: TypeVisitable>, { debug!("ensure_monomorphic_enough: ty={:?}", ty); - if !ty.has_param() { - return interp_ok(()); - } - - struct FoundParam; - struct UsedParamsNeedInstantiationVisitor {} - - impl<'tcx> TypeVisitor> for UsedParamsNeedInstantiationVisitor { - type Result = ControlFlow; - - fn visit_ty(&mut self, ty: Ty<'tcx>) -> Self::Result { - if !ty.has_param() { - return ControlFlow::Continue(()); - } - - match *ty.kind() { - ty::Param(_) => ControlFlow::Break(FoundParam), - ty::Closure(..) | ty::CoroutineClosure(..) | ty::Coroutine(..) | ty::FnDef(..) => { - ControlFlow::Continue(()) - } - _ => ty.super_visit_with(self), - } - } - - fn visit_const(&mut self, c: ty::Const<'tcx>) -> Self::Result { - match c.kind() { - ty::ConstKind::Param(..) => ControlFlow::Break(FoundParam), - _ => c.super_visit_with(self), - } - } - } - - let mut vis = UsedParamsNeedInstantiationVisitor {}; - if matches!(ty.visit_with(&mut vis), ControlFlow::Break(FoundParam)) { + if ty.has_param() { throw_inval!(TooGeneric); - } else { - interp_ok(()) } + interp_ok(()) } impl<'tcx> InterpretationResult<'tcx> for mir::interpret::ConstAllocation<'tcx> { diff --git a/tests/mir-opt/gvn_type_id_polymorphic.cursed_is_i32.GVN.diff b/tests/mir-opt/gvn_type_id_polymorphic.cursed_is_i32.GVN.diff index c9d641472d03..2f83f54d2afd 100644 --- a/tests/mir-opt/gvn_type_id_polymorphic.cursed_is_i32.GVN.diff +++ b/tests/mir-opt/gvn_type_id_polymorphic.cursed_is_i32.GVN.diff @@ -5,8 +5,7 @@ let mut _0: bool; bb0: { -- _0 = Eq(const cursed_is_i32::::{constant#0}, const cursed_is_i32::::{constant#1}); -+ _0 = const false; + _0 = Eq(const cursed_is_i32::::{constant#0}, const cursed_is_i32::::{constant#1}); return; } } diff --git a/tests/mir-opt/gvn_type_id_polymorphic.rs b/tests/mir-opt/gvn_type_id_polymorphic.rs index a5b936e52daf..39bc5c24ecc6 100644 --- a/tests/mir-opt/gvn_type_id_polymorphic.rs +++ b/tests/mir-opt/gvn_type_id_polymorphic.rs @@ -12,7 +12,7 @@ const fn type_id_of_val(_: &T) -> u128 { // EMIT_MIR gvn_type_id_polymorphic.cursed_is_i32.GVN.diff fn cursed_is_i32() -> bool { // CHECK-LABEL: fn cursed_is_i32( - // CHECK: _0 = const false; + // CHECK: _0 = Eq(const cursed_is_i32::::{constant#0}, const cursed_is_i32::::{constant#1}); // CHECK-NEXT: return; (const { type_id_of_val(&generic::) } == const { type_id_of_val(&generic::) }) } From 593c88fc49d2fa3ceabaa12923d8540551617041 Mon Sep 17 00:00:00 2001 From: Thalia Archibald Date: Wed, 5 Feb 2025 12:28:53 -0800 Subject: [PATCH 074/128] Fix long lines which rustfmt fails to format rustfmt fails to format this match expression, because it has several long string literals over the maximum line width. This seems to exhibit rustfmt issues #3863 (Gives up on chains if any line is too long) and #3156 (Fail to format match arm when other arm has long line). --- config.example.toml | 2 +- library/std/src/sys/pal/uefi/os.rs | 151 +++++++++-------------------- 2 files changed, 46 insertions(+), 107 deletions(-) diff --git a/config.example.toml b/config.example.toml index 7f6bbf279928..1a8f42428ab8 100644 --- a/config.example.toml +++ b/config.example.toml @@ -323,7 +323,7 @@ #full-bootstrap = false # Set the bootstrap/download cache path. It is useful when building rust -# repeatedly in a CI invironment. +# repeatedly in a CI environment. #bootstrap-cache-path = /path/to/shared/cache # Enable a build of the extended Rust tool set which is not only the compiler diff --git a/library/std/src/sys/pal/uefi/os.rs b/library/std/src/sys/pal/uefi/os.rs index 6d23c72ef220..e305b8610c9f 100644 --- a/library/std/src/sys/pal/uefi/os.rs +++ b/library/std/src/sys/pal/uefi/os.rs @@ -17,111 +17,50 @@ pub fn errno() -> RawOsError { pub fn error_string(errno: RawOsError) -> String { // Keep the List in Alphabetical Order // The Messages are taken from UEFI Specification Appendix D - Status Codes - match r_efi::efi::Status::from_usize(errno) { - Status::ABORTED => "The operation was aborted.".to_owned(), - Status::ACCESS_DENIED => "Access was denied.".to_owned(), - Status::ALREADY_STARTED => "The protocol has already been started.".to_owned(), - Status::BAD_BUFFER_SIZE => "The buffer was not the proper size for the request.".to_owned(), - Status::BUFFER_TOO_SMALL => { - "The buffer is not large enough to hold the requested data. The required buffer size is returned in the appropriate parameter when this error occurs.".to_owned() - } - Status::COMPROMISED_DATA => { - "The security status of the data is unknown or compromised and the data must be updated or replaced to restore a valid security status.".to_owned() - } - Status::CONNECTION_FIN => { - "The receiving operation fails because the communication peer has closed the connection and there is no more data in the receive buffer of the instance.".to_owned() - } - Status::CONNECTION_REFUSED => { - "The receiving or transmission operation fails because this connection is refused.".to_owned() - } - Status::CONNECTION_RESET => { - "The connect fails because the connection is reset either by instance itself or the communication peer.".to_owned() - } - Status::CRC_ERROR => "A CRC error was detected.".to_owned(), - Status::DEVICE_ERROR => "The physical device reported an error while attempting the operation.".to_owned() - , - Status::END_OF_FILE => { - "The end of the file was reached.".to_owned() - } - Status::END_OF_MEDIA => { - "Beginning or end of media was reached".to_owned() - } - Status::HOST_UNREACHABLE => { - "The remote host is not reachable.".to_owned() - } - Status::HTTP_ERROR => { - "A HTTP error occurred during the network operation.".to_owned() - } - Status::ICMP_ERROR => { - "An ICMP error occurred during the network operation.".to_owned() - } - Status::INCOMPATIBLE_VERSION => { - "The function encountered an internal version that was incompatible with a version requested by the caller.".to_owned() - } - Status::INVALID_LANGUAGE => { - "The language specified was invalid.".to_owned() - } - Status::INVALID_PARAMETER => { - "A parameter was incorrect.".to_owned() - } - Status::IP_ADDRESS_CONFLICT => { - "There is an address conflict address allocation".to_owned() - } - Status::LOAD_ERROR => { - "The image failed to load.".to_owned() - } - Status::MEDIA_CHANGED => { - "The medium in the device has changed since the last access.".to_owned() - } - Status::NETWORK_UNREACHABLE => { - "The network containing the remote host is not reachable.".to_owned() - } - Status::NO_MAPPING => { - "A mapping to a device does not exist.".to_owned() - } - Status::NO_MEDIA => { - "The device does not contain any medium to perform the operation.".to_owned() - } - Status::NO_RESPONSE => { - "The server was not found or did not respond to the request.".to_owned() - } - Status::NOT_FOUND => "The item was not found.".to_owned(), - Status::NOT_READY => { - "There is no data pending upon return.".to_owned() - } - Status::NOT_STARTED => { - "The protocol has not been started.".to_owned() - } - Status::OUT_OF_RESOURCES => { - "A resource has run out.".to_owned() - } - Status::PROTOCOL_ERROR => { - "A protocol error occurred during the network operation.".to_owned() - } - Status::PROTOCOL_UNREACHABLE => { - "An ICMP protocol unreachable error is received.".to_owned() - } - Status::SECURITY_VIOLATION => { - "The function was not performed due to a security violation.".to_owned() - } - Status::TFTP_ERROR => { - "A TFTP error occurred during the network operation.".to_owned() - } - Status::TIMEOUT => "The timeout time expired.".to_owned(), - Status::UNSUPPORTED => { - "The operation is not supported.".to_owned() - } - Status::VOLUME_FULL => { - "There is no more space on the file system.".to_owned() - } - Status::VOLUME_CORRUPTED => { - "An inconstancy was detected on the file system causing the operating to fail.".to_owned() - } - Status::WRITE_PROTECTED => { - "The device cannot be written to.".to_owned() - } - _ => format!("Status: {}", errno), - } + #[rustfmt::skip] + let msg = match r_efi::efi::Status::from_usize(errno) { + Status::ABORTED => "The operation was aborted.", + Status::ACCESS_DENIED => "Access was denied.", + Status::ALREADY_STARTED => "The protocol has already been started.", + Status::BAD_BUFFER_SIZE => "The buffer was not the proper size for the request.", + Status::BUFFER_TOO_SMALL => "The buffer is not large enough to hold the requested data. The required buffer size is returned in the appropriate parameter when this error occurs.", + Status::COMPROMISED_DATA => "The security status of the data is unknown or compromised and the data must be updated or replaced to restore a valid security status.", + Status::CONNECTION_FIN => "The receiving operation fails because the communication peer has closed the connection and there is no more data in the receive buffer of the instance.", + Status::CONNECTION_REFUSED => "The receiving or transmission operation fails because this connection is refused.", + Status::CONNECTION_RESET => "The connect fails because the connection is reset either by instance itself or the communication peer.", + Status::CRC_ERROR => "A CRC error was detected.", + Status::DEVICE_ERROR => "The physical device reported an error while attempting the operation.", + Status::END_OF_FILE => "The end of the file was reached.", + Status::END_OF_MEDIA => "Beginning or end of media was reached", + Status::HOST_UNREACHABLE => "The remote host is not reachable.", + Status::HTTP_ERROR => "A HTTP error occurred during the network operation.", + Status::ICMP_ERROR => "An ICMP error occurred during the network operation.", + Status::INCOMPATIBLE_VERSION => "The function encountered an internal version that was incompatible with a version requested by the caller.", + Status::INVALID_LANGUAGE => "The language specified was invalid.", + Status::INVALID_PARAMETER => "A parameter was incorrect.", + Status::IP_ADDRESS_CONFLICT => "There is an address conflict address allocation", + Status::LOAD_ERROR => "The image failed to load.", + Status::MEDIA_CHANGED => "The medium in the device has changed since the last access.", + Status::NETWORK_UNREACHABLE => "The network containing the remote host is not reachable.", + Status::NO_MAPPING => "A mapping to a device does not exist.", + Status::NO_MEDIA => "The device does not contain any medium to perform the operation.", + Status::NO_RESPONSE => "The server was not found or did not respond to the request.", + Status::NOT_FOUND => "The item was not found.", + Status::NOT_READY => "There is no data pending upon return.", + Status::NOT_STARTED => "The protocol has not been started.", + Status::OUT_OF_RESOURCES => "A resource has run out.", + Status::PROTOCOL_ERROR => "A protocol error occurred during the network operation.", + Status::PROTOCOL_UNREACHABLE => "An ICMP protocol unreachable error is received.", + Status::SECURITY_VIOLATION => "The function was not performed due to a security violation.", + Status::TFTP_ERROR => "A TFTP error occurred during the network operation.", + Status::TIMEOUT => "The timeout time expired.", + Status::UNSUPPORTED => "The operation is not supported.", + Status::VOLUME_FULL => "There is no more space on the file system.", + Status::VOLUME_CORRUPTED => "An inconstancy was detected on the file system causing the operating to fail.", + Status::WRITE_PROTECTED => "The device cannot be written to.", + _ => return format!("Status: {errno}"), + }; + msg.to_owned() } pub fn getcwd() -> io::Result { @@ -314,7 +253,7 @@ mod uefi_env { let mut start = 0; - // UEFI Shell returns all keys seperated by NULL. + // UEFI Shell returns all keys separated by NULL. // End of string is denoted by two NULLs for i in 0.. { if unsafe { *val.add(i) } == 0 { From af6020320d32fb3491b8d30b580f675a2e1d16a6 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 11 Feb 2025 13:58:38 +1100 Subject: [PATCH 075/128] Simplify intra-crate qualifiers. The following is a weird pattern for a file within `rustc_middle`: ``` use rustc_middle::aaa; use crate::bbb; ``` More sensible and standard would be this: ``` use crate::{aaa, bbb}; ``` I.e. we generally prefer using `crate::` to using a crate's own name. (Exceptions are things like in macros where `crate::` doesn't work because the macro is used in multiple crates.) This commit fixes a bunch of these weird qualifiers. --- compiler/rustc_errors/src/diagnostic_impls.rs | 4 ++-- compiler/rustc_middle/src/hir/map/mod.rs | 3 +-- compiler/rustc_middle/src/middle/stability.rs | 2 +- .../rustc_middle/src/mir/generic_graph.rs | 3 ++- .../rustc_middle/src/mir/generic_graphviz.rs | 3 ++- compiler/rustc_middle/src/mir/graphviz.rs | 2 +- .../rustc_middle/src/mir/interpret/mod.rs | 2 +- compiler/rustc_middle/src/mir/patch.rs | 3 ++- compiler/rustc_middle/src/mir/pretty.rs | 13 ++++++------- compiler/rustc_middle/src/query/erase.rs | 4 ++-- .../rustc_middle/src/query/on_disk_cache.rs | 15 ++++++++------- compiler/rustc_middle/src/thir.rs | 19 ++++++++++--------- compiler/rustc_middle/src/ty/cast.rs | 2 +- compiler/rustc_middle/src/ty/codec.rs | 5 ++--- compiler/rustc_middle/src/ty/instance.rs | 2 +- compiler/rustc_middle/src/ty/print/pretty.rs | 4 ++-- .../rustc_middle/src/ty/typeck_results.rs | 2 +- compiler/rustc_middle/src/util/mod.rs | 8 ++++---- compiler/rustc_middle/src/values.rs | 2 +- .../src/relate/solver_relating.rs | 6 +++--- 20 files changed, 53 insertions(+), 51 deletions(-) diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs index d179396398f0..14baf7554bcf 100644 --- a/compiler/rustc_errors/src/diagnostic_impls.rs +++ b/compiler/rustc_errors/src/diagnostic_impls.rs @@ -108,13 +108,13 @@ impl IntoDiagArg for rustc_type_ir::ExistentialTrait } impl IntoDiagArg for rustc_type_ir::UnevaluatedConst { - fn into_diag_arg(self) -> rustc_errors::DiagArgValue { + fn into_diag_arg(self) -> DiagArgValue { format!("{self:?}").into_diag_arg() } } impl IntoDiagArg for rustc_type_ir::FnSig { - fn into_diag_arg(self) -> rustc_errors::DiagArgValue { + fn into_diag_arg(self) -> DiagArgValue { format!("{self:?}").into_diag_arg() } } diff --git a/compiler/rustc_middle/src/hir/map/mod.rs b/compiler/rustc_middle/src/hir/map/mod.rs index 4df4624971df..83c7bb0f52f4 100644 --- a/compiler/rustc_middle/src/hir/map/mod.rs +++ b/compiler/rustc_middle/src/hir/map/mod.rs @@ -10,11 +10,10 @@ use rustc_hir::definitions::{DefKey, DefPath, DefPathHash}; use rustc_hir::intravisit::Visitor; use rustc_hir::*; use rustc_hir_pretty as pprust_hir; -use rustc_middle::hir::nested_filter; use rustc_span::def_id::StableCrateId; use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol, kw, sym, with_metavar_spans}; -use crate::hir::ModuleItems; +use crate::hir::{ModuleItems, nested_filter}; use crate::middle::debugger_visualizer::DebuggerVisualizerFile; use crate::query::LocalCrate; use crate::ty::TyCtxt; diff --git a/compiler/rustc_middle/src/middle/stability.rs b/compiler/rustc_middle/src/middle/stability.rs index 77a7da2c74bc..93bbf6d7fa4f 100644 --- a/compiler/rustc_middle/src/middle/stability.rs +++ b/compiler/rustc_middle/src/middle/stability.rs @@ -13,7 +13,6 @@ use rustc_feature::GateIssue; use rustc_hir::def_id::{DefId, LocalDefId, LocalDefIdMap}; use rustc_hir::{self as hir, HirId}; use rustc_macros::{Decodable, Encodable, HashStable, Subdiagnostic}; -use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_session::Session; use rustc_session::lint::builtin::{DEPRECATED, DEPRECATED_IN_FUTURE, SOFT_UNSTABLE}; use rustc_session::lint::{BuiltinLintDiag, DeprecatedSinceKind, Level, Lint, LintBuffer}; @@ -23,6 +22,7 @@ use tracing::debug; pub use self::StabilityLevel::*; use crate::ty::TyCtxt; +use crate::ty::print::with_no_trimmed_paths; #[derive(PartialEq, Clone, Copy, Debug)] pub enum StabilityLevel { diff --git a/compiler/rustc_middle/src/mir/generic_graph.rs b/compiler/rustc_middle/src/mir/generic_graph.rs index a52ec58a1ee6..3fd73712b096 100644 --- a/compiler/rustc_middle/src/mir/generic_graph.rs +++ b/compiler/rustc_middle/src/mir/generic_graph.rs @@ -1,5 +1,6 @@ use gsgdt::{Edge, Graph, Node, NodeStyle}; -use rustc_middle::mir::*; + +use crate::mir::*; /// Convert an MIR function into a gsgdt Graph pub(crate) fn mir_fn_to_generic_graph<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'_>) -> Graph { diff --git a/compiler/rustc_middle/src/mir/generic_graphviz.rs b/compiler/rustc_middle/src/mir/generic_graphviz.rs index e1c3d8156d83..bce7beb521da 100644 --- a/compiler/rustc_middle/src/mir/generic_graphviz.rs +++ b/compiler/rustc_middle/src/mir/generic_graphviz.rs @@ -2,7 +2,8 @@ use std::io::{self, Write}; use rustc_data_structures::graph::{self, iterate}; use rustc_graphviz as dot; -use rustc_middle::ty::TyCtxt; + +use crate::ty::TyCtxt; pub struct GraphvizWriter< 'a, diff --git a/compiler/rustc_middle/src/mir/graphviz.rs b/compiler/rustc_middle/src/mir/graphviz.rs index 7bb41193d5c9..a64b122fbc9e 100644 --- a/compiler/rustc_middle/src/mir/graphviz.rs +++ b/compiler/rustc_middle/src/mir/graphviz.rs @@ -2,10 +2,10 @@ use std::io::{self, Write}; use gsgdt::GraphvizSettings; use rustc_graphviz as dot; -use rustc_middle::mir::*; use super::generic_graph::mir_fn_to_generic_graph; use super::pretty::dump_mir_def_ids; +use crate::mir::*; /// Write a graphviz DOT graph of a list of MIRs. pub fn write_mir_graphviz(tcx: TyCtxt<'_>, single: Option, w: &mut W) -> io::Result<()> diff --git a/compiler/rustc_middle/src/mir/interpret/mod.rs b/compiler/rustc_middle/src/mir/interpret/mod.rs index 45c862e0d34b..c48cfffa05cc 100644 --- a/compiler/rustc_middle/src/mir/interpret/mod.rs +++ b/compiler/rustc_middle/src/mir/interpret/mod.rs @@ -20,7 +20,6 @@ use rustc_data_structures::sync::{AtomicU64, Lock}; use rustc_hir::def::DefKind; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable}; -use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_serialize::{Decodable, Encodable}; use tracing::{debug, trace}; // Also make the error macros available from this module. @@ -46,6 +45,7 @@ pub use self::pointer::{CtfeProvenance, Pointer, PointerArithmetic, Provenance}; pub use self::value::Scalar; use crate::mir; use crate::ty::codec::{TyDecoder, TyEncoder}; +use crate::ty::print::with_no_trimmed_paths; use crate::ty::{self, Instance, Ty, TyCtxt}; /// Uniquely identifies one of the following: diff --git a/compiler/rustc_middle/src/mir/patch.rs b/compiler/rustc_middle/src/mir/patch.rs index 18c48d99b81c..748797fbb8d5 100644 --- a/compiler/rustc_middle/src/mir/patch.rs +++ b/compiler/rustc_middle/src/mir/patch.rs @@ -1,6 +1,7 @@ -use rustc_middle::mir::*; use tracing::debug; +use crate::mir::*; + /// This struct represents a patch to MIR, which can add /// new statements and basic blocks and patch over block /// terminators. diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_middle/src/mir/pretty.rs index 11ebbbe807db..b0df6c71014a 100644 --- a/compiler/rustc_middle/src/mir/pretty.rs +++ b/compiler/rustc_middle/src/mir/pretty.rs @@ -5,17 +5,16 @@ use std::{fs, io}; use rustc_abi::Size; use rustc_ast::InlineAsmTemplatePiece; -use rustc_middle::mir::interpret::{ - AllocBytes, AllocId, Allocation, GlobalAlloc, Pointer, Provenance, alloc_range, - read_target_uint, -}; -use rustc_middle::mir::visit::Visitor; -use rustc_middle::mir::*; use tracing::trace; use ty::print::PrettyPrinter; use super::graphviz::write_mir_fn_graphviz; -use crate::mir::interpret::ConstAllocation; +use crate::mir::interpret::{ + AllocBytes, AllocId, Allocation, ConstAllocation, GlobalAlloc, Pointer, Provenance, + alloc_range, read_target_uint, +}; +use crate::mir::visit::Visitor; +use crate::mir::*; const INDENT: &str = " "; /// Alignment for lining up comments following MIR statements diff --git a/compiler/rustc_middle/src/query/erase.rs b/compiler/rustc_middle/src/query/erase.rs index 14f871cbbdcb..cbd60920bc57 100644 --- a/compiler/rustc_middle/src/query/erase.rs +++ b/compiler/rustc_middle/src/query/erase.rs @@ -101,9 +101,9 @@ impl EraseType for Result<&'_ T, &'_ ty::layout::FnAbiError<'_>> { type Result = [u8; size_of::>>()]; } -impl EraseType for Result<(&'_ T, rustc_middle::thir::ExprId), rustc_errors::ErrorGuaranteed> { +impl EraseType for Result<(&'_ T, crate::thir::ExprId), rustc_errors::ErrorGuaranteed> { type Result = [u8; size_of::< - Result<(&'static (), rustc_middle::thir::ExprId), rustc_errors::ErrorGuaranteed>, + Result<(&'static (), crate::thir::ExprId), rustc_errors::ErrorGuaranteed>, >()]; } diff --git a/compiler/rustc_middle/src/query/on_disk_cache.rs b/compiler/rustc_middle/src/query/on_disk_cache.rs index 3247bdbf1050..d9035efaf56d 100644 --- a/compiler/rustc_middle/src/query/on_disk_cache.rs +++ b/compiler/rustc_middle/src/query/on_disk_cache.rs @@ -11,12 +11,6 @@ use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LOCAL_CRATE, LocalDefId, Stab use rustc_hir::definitions::DefPathHash; use rustc_index::{Idx, IndexVec}; use rustc_macros::{Decodable, Encodable}; -use rustc_middle::dep_graph::{DepNodeIndex, SerializedDepNodeIndex}; -use rustc_middle::mir::interpret::{AllocDecodingSession, AllocDecodingState}; -use rustc_middle::mir::mono::MonoItem; -use rustc_middle::mir::{self, interpret}; -use rustc_middle::ty::codec::{RefDecodable, TyDecoder, TyEncoder}; -use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_query_system::query::QuerySideEffects; use rustc_serialize::opaque::{FileEncodeResult, FileEncoder, IntEncodedWithFixedSize, MemDecoder}; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; @@ -30,6 +24,13 @@ use rustc_span::{ SpanDecoder, SpanEncoder, StableSourceFileId, Symbol, }; +use crate::dep_graph::{DepNodeIndex, SerializedDepNodeIndex}; +use crate::mir::interpret::{AllocDecodingSession, AllocDecodingState}; +use crate::mir::mono::MonoItem; +use crate::mir::{self, interpret}; +use crate::ty::codec::{RefDecodable, TyDecoder, TyEncoder}; +use crate::ty::{self, Ty, TyCtxt}; + const TAG_FILE_FOOTER: u128 = 0xC0FFEE_C0FFEE_C0FFEE_C0FFEE_C0FFEE; // A normal span encoded with both location information and a `SyntaxContext` @@ -563,7 +564,7 @@ impl<'a, 'tcx> TyDecoder for CacheDecoder<'a, 'tcx> { } } -rustc_middle::implement_ty_decoder!(CacheDecoder<'a, 'tcx>); +crate::implement_ty_decoder!(CacheDecoder<'a, 'tcx>); // This ensures that the `Decodable::decode` specialization for `Vec` is used // when a `CacheDecoder` is passed to `Decodable::decode`. Unfortunately, we have to manually opt diff --git a/compiler/rustc_middle/src/thir.rs b/compiler/rustc_middle/src/thir.rs index 4dc8f2795535..2ab8750f727c 100644 --- a/compiler/rustc_middle/src/thir.rs +++ b/compiler/rustc_middle/src/thir.rs @@ -20,20 +20,21 @@ use rustc_hir::def_id::DefId; use rustc_hir::{BindingMode, ByRef, HirId, MatchSource, RangeEnd}; use rustc_index::{IndexVec, newtype_index}; use rustc_macros::{HashStable, TypeVisitable}; -use rustc_middle::middle::region; -use rustc_middle::mir::interpret::AllocId; -use rustc_middle::mir::{self, BinOp, BorrowKind, FakeReadCause, UnOp}; -use rustc_middle::ty::adjustment::PointerCoercion; -use rustc_middle::ty::layout::IntegerExt; -use rustc_middle::ty::{ - self, AdtDef, CanonicalUserType, CanonicalUserTypeAnnotation, FnSig, GenericArgsRef, List, Ty, - TyCtxt, UpvarArgs, -}; use rustc_span::def_id::LocalDefId; use rustc_span::{ErrorGuaranteed, Span, Symbol}; use rustc_target::asm::InlineAsmRegOrRegClass; use tracing::instrument; +use crate::middle::region; +use crate::mir::interpret::AllocId; +use crate::mir::{self, BinOp, BorrowKind, FakeReadCause, UnOp}; +use crate::ty::adjustment::PointerCoercion; +use crate::ty::layout::IntegerExt; +use crate::ty::{ + self, AdtDef, CanonicalUserType, CanonicalUserTypeAnnotation, FnSig, GenericArgsRef, List, Ty, + TyCtxt, UpvarArgs, +}; + pub mod visit; macro_rules! thir_with_elements { diff --git a/compiler/rustc_middle/src/ty/cast.rs b/compiler/rustc_middle/src/ty/cast.rs index b1316ceef5ac..10f7d5896362 100644 --- a/compiler/rustc_middle/src/ty/cast.rs +++ b/compiler/rustc_middle/src/ty/cast.rs @@ -2,8 +2,8 @@ // typeck and codegen. use rustc_macros::{HashStable, TyDecodable, TyEncodable}; -use rustc_middle::mir; +use crate::mir; use crate::ty::{self, Ty}; /// Types that are represented as ints. diff --git a/compiler/rustc_middle/src/ty/codec.rs b/compiler/rustc_middle/src/ty/codec.rs index 94bf1aa4f035..6b6e0ffc6564 100644 --- a/compiler/rustc_middle/src/ty/codec.rs +++ b/compiler/rustc_middle/src/ty/codec.rs @@ -13,8 +13,6 @@ use std::marker::DiscriminantKind; use rustc_abi::{FieldIdx, VariantIdx}; use rustc_data_structures::fx::FxHashMap; use rustc_hir::def_id::LocalDefId; -use rustc_middle::mir::mono::MonoItem; -use rustc_middle::ty::TyCtxt; use rustc_serialize::{Decodable, Encodable}; use rustc_span::Span; use rustc_span::source_map::Spanned; @@ -23,9 +21,10 @@ pub use rustc_type_ir::{TyDecoder, TyEncoder}; use crate::arena::ArenaAllocatable; use crate::infer::canonical::{CanonicalVarInfo, CanonicalVarInfos}; use crate::mir::interpret::{AllocId, ConstAllocation, CtfeProvenance}; +use crate::mir::mono::MonoItem; use crate::mir::{self}; use crate::traits; -use crate::ty::{self, AdtDef, GenericArgsRef, Ty}; +use crate::ty::{self, AdtDef, GenericArgsRef, Ty, TyCtxt}; /// The shorthand encoding uses an enum's variant index `usize` /// and is offset by this value so it never matches a real variant. diff --git a/compiler/rustc_middle/src/ty/instance.rs b/compiler/rustc_middle/src/ty/instance.rs index b7a648aae3f1..e9c19331e4a0 100644 --- a/compiler/rustc_middle/src/ty/instance.rs +++ b/compiler/rustc_middle/src/ty/instance.rs @@ -10,13 +10,13 @@ use rustc_hir::def_id::{CrateNum, DefId}; use rustc_hir::lang_items::LangItem; use rustc_index::bit_set::FiniteBitSet; use rustc_macros::{Decodable, Encodable, HashStable, Lift, TyDecodable, TyEncodable}; -use rustc_middle::ty::normalize_erasing_regions::NormalizationError; use rustc_span::def_id::LOCAL_CRATE; use rustc_span::{DUMMY_SP, Span, Symbol}; use tracing::{debug, instrument}; use crate::error; use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags; +use crate::ty::normalize_erasing_regions::NormalizationError; use crate::ty::print::{FmtPrinter, Printer, shrunk_instance_name}; use crate::ty::{ self, EarlyBinder, GenericArgs, GenericArgsRef, Ty, TyCtxt, TypeFoldable, TypeSuperVisitable, diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index feae8ea312ea..343aabd7bbb3 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -1512,7 +1512,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { ty::ExprKind::Binop(op) => { let (_, _, c1, c2) = expr.binop_args(); - let precedence = |binop: rustc_middle::mir::BinOp| { + let precedence = |binop: crate::mir::BinOp| { use rustc_ast::util::parser::AssocOp; AssocOp::from_ast_binop(binop.to_hir_binop()).precedence() }; @@ -1558,7 +1558,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { ty::ExprKind::UnOp(op) => { let (_, ct) = expr.unop_args(); - use rustc_middle::mir::UnOp; + use crate::mir::UnOp; let formatted_op = match op { UnOp::Not => "!", UnOp::Neg => "-", diff --git a/compiler/rustc_middle/src/ty/typeck_results.rs b/compiler/rustc_middle/src/ty/typeck_results.rs index 49bdb5e9dc31..1b5b791bb24a 100644 --- a/compiler/rustc_middle/src/ty/typeck_results.rs +++ b/compiler/rustc_middle/src/ty/typeck_results.rs @@ -14,13 +14,13 @@ use rustc_hir::{ }; use rustc_index::IndexVec; use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable}; -use rustc_middle::mir::FakeReadCause; use rustc_session::Session; use rustc_span::Span; use super::RvalueScopes; use crate::hir::place::Place as HirPlace; use crate::infer::canonical::Canonical; +use crate::mir::FakeReadCause; use crate::traits::ObligationCause; use crate::ty::{ self, BoundVar, CanonicalPolyFnSig, ClosureSizeProfileData, GenericArgKind, GenericArgs, diff --git a/compiler/rustc_middle/src/util/mod.rs b/compiler/rustc_middle/src/util/mod.rs index 8c875007b7fb..85519fb0a7d2 100644 --- a/compiler/rustc_middle/src/util/mod.rs +++ b/compiler/rustc_middle/src/util/mod.rs @@ -2,9 +2,9 @@ pub mod bug; #[derive(Default, Copy, Clone)] pub struct Providers { - pub queries: rustc_middle::query::Providers, - pub extern_queries: rustc_middle::query::ExternProviders, - pub hooks: rustc_middle::hooks::Providers, + pub queries: crate::query::Providers, + pub extern_queries: crate::query::ExternProviders, + pub hooks: crate::hooks::Providers, } /// Backwards compatibility hack to keep the diff small. This @@ -17,7 +17,7 @@ impl std::ops::DerefMut for Providers { } impl std::ops::Deref for Providers { - type Target = rustc_middle::query::Providers; + type Target = crate::query::Providers; fn deref(&self) -> &Self::Target { &self.queries diff --git a/compiler/rustc_middle/src/values.rs b/compiler/rustc_middle/src/values.rs index 867f8f639698..433f7542bd70 100644 --- a/compiler/rustc_middle/src/values.rs +++ b/compiler/rustc_middle/src/values.rs @@ -7,7 +7,6 @@ use rustc_errors::codes::*; use rustc_errors::{Applicability, MultiSpan, pluralize, struct_span_code_err}; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; -use rustc_middle::ty::{self, Representability, Ty, TyCtxt}; use rustc_query_system::Value; use rustc_query_system::query::{CycleError, report_cycle}; use rustc_span::def_id::LocalDefId; @@ -15,6 +14,7 @@ use rustc_span::{ErrorGuaranteed, Span}; use crate::dep_graph::dep_kinds; use crate::query::plumbing::CyclePlaceholder; +use crate::ty::{self, Representability, Ty, TyCtxt}; impl<'tcx> Value> for Ty<'_> { fn from_cycle_error(tcx: TyCtxt<'tcx>, _: &CycleError, guar: ErrorGuaranteed) -> Self { diff --git a/compiler/rustc_type_ir/src/relate/solver_relating.rs b/compiler/rustc_type_ir/src/relate/solver_relating.rs index dc2312b2da3a..e42639c68075 100644 --- a/compiler/rustc_type_ir/src/relate/solver_relating.rs +++ b/compiler/rustc_type_ir/src/relate/solver_relating.rs @@ -1,10 +1,10 @@ -pub use rustc_type_ir::relate::*; -use rustc_type_ir::solve::Goal; -use rustc_type_ir::{self as ty, InferCtxtLike, Interner}; use tracing::{debug, instrument}; use self::combine::{PredicateEmittingRelation, super_combine_consts, super_combine_tys}; use crate::data_structures::DelayedSet; +pub use crate::relate::*; +use crate::solve::Goal; +use crate::{self as ty, InferCtxtLike, Interner}; pub trait RelateExt: InferCtxtLike { fn relate>( From 8a0a4df0c6725be431157ce84ffd7595c4bd7780 Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Tue, 11 Feb 2025 09:37:59 +0530 Subject: [PATCH 076/128] Add docs to bootstrap:src:utils:cache --- src/bootstrap/src/utils/cache.rs | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/bootstrap/src/utils/cache.rs b/src/bootstrap/src/utils/cache.rs index 29342cc5a2c5..650316eebd59 100644 --- a/src/bootstrap/src/utils/cache.rs +++ b/src/bootstrap/src/utils/cache.rs @@ -1,3 +1,17 @@ +//! This module helps you efficiently store and retrieve values using interning. +//! +//! Interning is a neat trick that keeps only one copy of identical values, saving memory +//! and making comparisons super fast. Here, we provide the `Interned` struct and the `Internable` trait +//! to make interning easy for different data types. +//! +//! The `Interner` struct handles caching for common types like `String`, `PathBuf`, and `Vec`, +//! while the `Cache` struct acts as a write-once storage for linking computation steps with their results. +//! +//! # Thread Safety +//! +//! We use `Mutex` to make sure interning and retrieval are thread-safe. But keep in mind—once a value is +//! interned, it sticks around for the entire lifetime of the program. + use std::any::{Any, TypeId}; use std::borrow::Borrow; use std::cell::RefCell; @@ -12,6 +26,9 @@ use std::{fmt, mem}; use crate::core::builder::Step; +/// Represents an interned value of type `T`, allowing for efficient comparisons and retrieval. +/// +/// This struct stores a unique index referencing the interned value within an internal cache. pub struct Interned(usize, PhantomData<*const T>); impl Default for Interned { @@ -111,6 +128,10 @@ impl Ord for Interned { } } +/// A structure for managing the interning of values of type `T`. +/// +/// `TyIntern` maintains a mapping between values and their interned representations, +/// ensuring that duplicate values are not stored multiple times. struct TyIntern { items: Vec, set: HashMap>, @@ -123,6 +144,9 @@ impl Default for TyIntern { } impl TyIntern { + /// Interns a borrowed value, ensuring it is stored uniquely. + /// + /// If the value has been previously interned, the same `Interned` instance is returned. fn intern_borrow(&mut self, item: &B) -> Interned where B: Eq + Hash + ToOwned + ?Sized, @@ -138,6 +162,9 @@ impl TyIntern { interned } + /// Interns an owned value, storing it uniquely. + /// + /// If the value has been previously interned, the existing `Interned` is returned. fn intern(&mut self, item: T) -> Interned { if let Some(i) = self.set.get(&item) { return *i; @@ -148,11 +175,16 @@ impl TyIntern { interned } + /// Retrieves a reference to the interned value associated with the given `Interned` instance. fn get(&self, i: Interned) -> &T { &self.items[i.0] } } +/// A global interner for managing interned values of common types. +/// +/// This structure maintains caches for `String`, `PathBuf`, and `Vec`, ensuring efficient storage +/// and retrieval of frequently used values. #[derive(Default)] pub struct Interner { strs: Mutex>, @@ -160,6 +192,10 @@ pub struct Interner { lists: Mutex>>, } +/// Defines the behavior required for a type to be internable. +/// +/// Types implementing this trait must provide access to a static cache and define an `intern` method +/// that ensures values are stored uniquely. trait Internable: Clone + Eq + Hash + 'static { fn intern_cache() -> &'static Mutex>; @@ -187,11 +223,15 @@ impl Internable for Vec { } impl Interner { + /// Interns a string reference, ensuring it is stored uniquely. + /// + /// If the string has been previously interned, the same `Interned` instance is returned. pub fn intern_str(&self, s: &str) -> Interned { self.strs.lock().unwrap().intern_borrow(s) } } +/// A global instance of `Interner` that caches common interned values. pub static INTERNER: LazyLock = LazyLock::new(Interner::default); /// This is essentially a `HashMap` which allows storing any type in its input and @@ -209,10 +249,12 @@ pub struct Cache( ); impl Cache { + /// Creates a new empty cache. pub fn new() -> Cache { Cache(RefCell::new(HashMap::new())) } + /// Stores the result of a computation step in the cache. pub fn put(&self, step: S, value: S::Output) { let mut cache = self.0.borrow_mut(); let type_id = TypeId::of::(); @@ -225,6 +267,7 @@ impl Cache { stepcache.insert(step, value); } + /// Retrieves a cached result for the given step, if available. pub fn get(&self, step: &S) -> Option { let mut cache = self.0.borrow_mut(); let type_id = TypeId::of::(); From 24150eb3c073e8f00ebd6b7d02ffac7ddd0f398e Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Tue, 11 Feb 2025 10:33:05 +0530 Subject: [PATCH 077/128] add unit test to bootstrap:util:cache:tests --- src/bootstrap/src/utils/cache.rs | 3 ++ src/bootstrap/src/utils/cache/tests.rs | 52 ++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 src/bootstrap/src/utils/cache/tests.rs diff --git a/src/bootstrap/src/utils/cache.rs b/src/bootstrap/src/utils/cache.rs index 650316eebd59..1c8cc4025df1 100644 --- a/src/bootstrap/src/utils/cache.rs +++ b/src/bootstrap/src/utils/cache.rs @@ -298,3 +298,6 @@ impl Cache { self.0.borrow().contains_key(&TypeId::of::()) } } + +#[cfg(test)] +mod tests; diff --git a/src/bootstrap/src/utils/cache/tests.rs b/src/bootstrap/src/utils/cache/tests.rs new file mode 100644 index 000000000000..28f5563a589b --- /dev/null +++ b/src/bootstrap/src/utils/cache/tests.rs @@ -0,0 +1,52 @@ +use std::path::PathBuf; + +use crate::utils::cache::{INTERNER, Internable, TyIntern}; + +#[test] +fn test_string_interning() { + let s1 = INTERNER.intern_str("Hello"); + let s2 = INTERNER.intern_str("Hello"); + let s3 = INTERNER.intern_str("world"); + + assert_eq!(s1, s2, "Same strings should be interned to the same instance"); + assert_ne!(s1, s3, "Different strings should have different interned values"); +} + +#[test] +fn test_path_interning() { + let p1 = PathBuf::from("/tmp/file").intern(); + let p2 = PathBuf::from("/tmp/file").intern(); + let p3 = PathBuf::from("/tmp/other").intern(); + + assert_eq!(p1, p2); + assert_ne!(p1, p3); +} + +#[test] +fn test_vec_interning() { + let v1 = vec!["a".to_string(), "b".to_string()].intern(); + let v2 = vec!["a".to_string(), "b".to_string()].intern(); + let v3 = vec!["c".to_string()].intern(); + + assert_eq!(v1, v2); + assert_ne!(v1, v3); +} + +#[test] +fn test_interned_equality() { + let s1 = INTERNER.intern_str("test"); + let s2 = INTERNER.intern_str("test"); + + assert_eq!(s1, s2); + assert_eq!(s1, "test"); +} + +#[test] +fn test_ty_intern_intern_borrow() { + let mut interner = TyIntern::default(); + let s1 = interner.intern_borrow("borrowed"); + let s2 = interner.intern("borrowed".to_string()); + + assert_eq!(s1, s2); + assert_eq!(interner.get(s1), "borrowed"); +} From 166680c480182253affb34c8aa5d0572a43f8b01 Mon Sep 17 00:00:00 2001 From: Marijn Schouten Date: Fri, 31 Jan 2025 14:31:34 +0100 Subject: [PATCH 078/128] Update docs for impl keyword --- library/std/src/keyword_docs.rs | 41 +++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs index 1d26bf37f4d2..825a89fc7f2c 100644 --- a/library/std/src/keyword_docs.rs +++ b/library/std/src/keyword_docs.rs @@ -651,16 +651,24 @@ mod if_keyword {} #[doc(keyword = "impl")] // -/// Implement some functionality for a type. +/// Implementations of functionality for a type, or a type implementing some functionality. +/// +/// There are two uses of the keyword `impl`: +/// * An `impl` block is an item that is used to implement some functionality for a type. +/// * An `impl Trait` in a type-position can be used to designate a type that implements a trait called `Trait`. +/// +/// # Implementing Functionality for a Type /// /// The `impl` keyword is primarily used to define implementations on types. Inherent /// implementations are standalone, while trait implementations are used to implement traits for /// types, or other traits. /// -/// Functions and consts can both be defined in an implementation. A function defined in an -/// `impl` block can be standalone, meaning it would be called like `Foo::bar()`. If the function +/// An implementation consists of definitions of functions and consts. A function defined in an +/// `impl` block can be standalone, meaning it would be called like `Vec::new()`. If the function /// takes `self`, `&self`, or `&mut self` as its first argument, it can also be called using -/// method-call syntax, a familiar feature to any object oriented programmer, like `foo.bar()`. +/// method-call syntax, a familiar feature to any object-oriented programmer, like `vec.len()`. +/// +/// ## Inherent Implementations /// /// ```rust /// struct Example { @@ -680,6 +688,17 @@ mod if_keyword {} /// self.number /// } /// } +/// ``` +/// +/// It matters little where an inherent implementation is defined; +/// its functionality is in scope wherever its implementing type is. +/// +/// ## Trait Implementations +/// +/// ```rust +/// struct Example { +/// number: i32, +/// } /// /// trait Thingy { /// fn do_thingy(&self); @@ -692,11 +711,19 @@ mod if_keyword {} /// } /// ``` /// +/// It matters little where a trait implementation is defined; +/// its functionality can be brought into scope by importing the trait it implements. +/// /// For more information on implementations, see the [Rust book][book1] or the [Reference]. /// -/// The other use of the `impl` keyword is in `impl Trait` syntax, which can be seen as a shorthand -/// for "a concrete type that implements this trait". Its primary use is working with closures, -/// which have type definitions generated at compile time that can't be simply typed out. +/// # Designating a Type that Implements Some Functionality +/// +/// The other use of the `impl` keyword is in `impl Trait` syntax, which can be understood to mean +/// "any (or some) concrete type that implements Trait". +/// It can be used as the type of a variable declaration, +/// in [argument position](https://rust-lang.github.io/rfcs/1951-expand-impl-trait.html) +/// or in [return position](https://rust-lang.github.io/rfcs/3425-return-position-impl-trait-in-traits.html). +/// One pertinent use case is in working with closures, which have unnameable types. /// /// ```rust /// fn thing_returning_closure() -> impl Fn(i32) -> bool { From e279c4eadba97aaf6f64830b4a4a83be8f5879c4 Mon Sep 17 00:00:00 2001 From: Marijn Schouten Date: Wed, 29 Jan 2025 15:18:10 +0100 Subject: [PATCH 079/128] include note on variance and example Fixes #89150 Co-authored-by: Daniel Henry-Mantilla --- library/core/src/any.rs | 98 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 96 insertions(+), 2 deletions(-) diff --git a/library/core/src/any.rs b/library/core/src/any.rs index 17d945559278..f90de1f5ced4 100644 --- a/library/core/src/any.rs +++ b/library/core/src/any.rs @@ -610,6 +610,101 @@ impl dyn Any + Send + Sync { /// While `TypeId` implements `Hash`, `PartialOrd`, and `Ord`, it is worth /// noting that the hashes and ordering will vary between Rust releases. Beware /// of relying on them inside of your code! +/// +/// # Danger of Improper Variance +/// +/// You might think that subtyping is impossible between two static types, +/// but this is false; there exists a static type with a static subtype. +/// To wit, `fn(&str)`, which is short for `for<'any> fn(&'any str)`, and +/// `fn(&'static str)`, are two distinct, static types, and yet, +/// `fn(&str)` is a subtype of `fn(&'static str)`, since any value of type +/// `fn(&str)` can be used where a value of type `fn(&'static str)` is needed. +/// +/// This means that abstractions around `TypeId`, despite its +/// `'static` bound on arguments, still need to worry about unnecessary +/// and improper variance: it is advisable to strive for invariance +/// first. The usability impact will be negligible, while the reduction +/// in the risk of unsoundness will be most welcome. +/// +/// ## Examples +/// +/// Suppose `SubType` is a subtype of `SuperType`, that is, +/// a value of type `SubType` can be used wherever +/// a value of type `SuperType` is expected. +/// Suppose also that `CoVar` is a generic type, which is covariant over `T` +/// (like many other types, including `PhantomData` and `Vec`). +/// +/// Then, by covariance, `CoVar` is a subtype of `CoVar`, +/// that is, a value of type `CoVar` can be used wherever +/// a value of type `CoVar` is expected. +/// +/// Then if `CoVar` relies on `TypeId::of::()` to uphold any invariants, +/// those invariants may be broken because a value of type `CoVar` can be created +/// without going through any of its methods, like so: +/// ``` +/// type SubType = fn(&()); +/// type SuperType = fn(&'static ()); +/// type CoVar = Vec; // imagine something more complicated +/// +/// let sub: CoVar = CoVar::new(); +/// // we have a `CoVar` instance without +/// // *ever* having called `CoVar::::new()`! +/// let fake_super: CoVar = sub; +/// ``` +/// +/// The following is an example program that tries to use `TypeId::of` to +/// implement a generic type `Unique` that guarantees unique instances for each `Unique`, +/// that is, and for each type `T` there can be at most one value of type `Unique` at any time. +/// +/// ``` +/// mod unique { +/// use std::any::TypeId; +/// use std::collections::BTreeSet; +/// use std::marker::PhantomData; +/// use std::sync::Mutex; +/// +/// static ID_SET: Mutex> = Mutex::new(BTreeSet::new()); +/// +/// // TypeId has only covariant uses, which makes Unique covariant over TypeAsId 🚨 +/// #[derive(Debug, PartialEq)] +/// pub struct Unique( +/// // private field prevents creation without `new` outside this module +/// PhantomData, +/// ); +/// +/// impl Unique { +/// pub fn new() -> Option { +/// let mut set = ID_SET.lock().unwrap(); +/// (set.insert(TypeId::of::())).then(|| Self(PhantomData)) +/// } +/// } +/// +/// impl Drop for Unique { +/// fn drop(&mut self) { +/// let mut set = ID_SET.lock().unwrap(); +/// (!set.remove(&TypeId::of::())).then(|| panic!("duplicity detected")); +/// } +/// } +/// } +/// +/// use unique::Unique; +/// +/// // `OtherRing` is a subtype of `TheOneRing`. Both are 'static, and thus have a TypeId. +/// type TheOneRing = fn(&'static ()); +/// type OtherRing = fn(&()); +/// +/// fn main() { +/// let the_one_ring: Unique = Unique::new().unwrap(); +/// assert_eq!(Unique::::new(), None); +/// +/// let other_ring: Unique = Unique::new().unwrap(); +/// // Use that `Unique` is a subtype of `Unique` 🚨 +/// let fake_one_ring: Unique = other_ring; +/// assert_eq!(fake_one_ring, the_one_ring); +/// +/// std::mem::forget(fake_one_ring); +/// } +/// ``` #[derive(Clone, Copy, Eq, PartialOrd, Ord)] #[stable(feature = "rust1", since = "1.0.0")] pub struct TypeId { @@ -627,8 +722,7 @@ impl PartialEq for TypeId { } impl TypeId { - /// Returns the `TypeId` of the type this generic function has been - /// instantiated with. + /// Returns the `TypeId` of the generic type parameter. /// /// # Examples /// From 644c6948d01c66b744d8d7b8d06ea131a75e8311 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Fri, 24 Jan 2025 15:57:13 +0000 Subject: [PATCH 080/128] Add ffi tests for pattern types --- tests/ui/lint/clashing-extern-fn.rs | 41 ++++++++- tests/ui/lint/clashing-extern-fn.stderr | 116 +++++++++++++++++++++++- tests/ui/lint/lint-ctypes-enum.rs | 1 + tests/ui/lint/lint-ctypes-enum.stderr | 49 ++++++---- 4 files changed, 185 insertions(+), 22 deletions(-) diff --git a/tests/ui/lint/clashing-extern-fn.rs b/tests/ui/lint/clashing-extern-fn.rs index 9bbb20246df9..0464299348bd 100644 --- a/tests/ui/lint/clashing-extern-fn.rs +++ b/tests/ui/lint/clashing-extern-fn.rs @@ -1,7 +1,7 @@ //@ check-pass //@ aux-build:external_extern_fn.rs #![crate_type = "lib"] - +#![feature(pattern_type_macro, pattern_types)] mod redeclared_different_signature { mod a { extern "C" { @@ -490,3 +490,42 @@ mod hidden_niche { } } } + +mod pattern_types { + mod a { + use std::pat::pattern_type; + #[repr(transparent)] + struct NonZeroUsize(pattern_type!(usize is 1..)); + extern "C" { + fn pt_non_zero_usize() -> pattern_type!(usize is 1..); + //~^ WARN not FFI-safe + fn pt_non_zero_usize_opt() -> Option; + //~^ WARN not FFI-safe + fn pt_non_zero_usize_opt_full_range() -> Option; + //~^ WARN not FFI-safe + fn pt_non_null_ptr() -> pattern_type!(usize is 1..); + //~^ WARN not FFI-safe + fn pt_non_zero_usize_wrapper() -> NonZeroUsize; + //~^ WARN not FFI-safe + fn pt_non_zero_usize_wrapper_opt() -> Option; + //~^ WARN not FFI-safe + } + } + mod b { + extern "C" { + // If there's a clash in either of these cases you're either gaining an incorrect + // invariant that the value is non-zero, or you're missing out on that invariant. Both + // cases are warning for, from both a caller-convenience and optimisation perspective. + fn pt_non_zero_usize() -> usize; + //~^ WARN `pt_non_zero_usize` redeclared with a different signature + fn pt_non_zero_usize_opt() -> usize; + //~^ WARN `pt_non_zero_usize_opt` redeclared with a different signature + fn pt_non_null_ptr() -> *const (); + //~^ WARN `pt_non_null_ptr` redeclared with a different signature + fn pt_non_zero_usize_wrapper() -> usize; + //~^ WARN `pt_non_zero_usize_wrapper` redeclared with a different signature + fn pt_non_zero_usize_wrapper_opt() -> usize; + //~^ WARN `pt_non_zero_usize_wrapper_opt` redeclared with a different signature + } + } +} diff --git a/tests/ui/lint/clashing-extern-fn.stderr b/tests/ui/lint/clashing-extern-fn.stderr index 48dd1adbc1fa..acf31a1f5dd4 100644 --- a/tests/ui/lint/clashing-extern-fn.stderr +++ b/tests/ui/lint/clashing-extern-fn.stderr @@ -17,6 +17,60 @@ LL | fn hidden_niche_unsafe_cell() -> Option $DIR/clashing-extern-fn.rs:500:39 + | +LL | fn pt_non_zero_usize() -> pattern_type!(usize is 1..); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider using the base type instead + = note: pattern types have no C equivalent + +warning: `extern` block uses type `Option<(usize) is 1..=>`, which is not FFI-safe + --> $DIR/clashing-extern-fn.rs:502:43 + | +LL | fn pt_non_zero_usize_opt() -> Option; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +warning: `extern` block uses type `Option<(usize) is 0..=>`, which is not FFI-safe + --> $DIR/clashing-extern-fn.rs:504:54 + | +LL | fn pt_non_zero_usize_opt_full_range() -> Option; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + +warning: `extern` block uses type `(usize) is 1..=`, which is not FFI-safe + --> $DIR/clashing-extern-fn.rs:506:37 + | +LL | fn pt_non_null_ptr() -> pattern_type!(usize is 1..); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider using the base type instead + = note: pattern types have no C equivalent + +warning: `extern` block uses type `(usize) is 1..=`, which is not FFI-safe + --> $DIR/clashing-extern-fn.rs:508:47 + | +LL | fn pt_non_zero_usize_wrapper() -> NonZeroUsize; + | ^^^^^^^^^^^^ not FFI-safe + | + = help: consider using the base type instead + = note: pattern types have no C equivalent + +warning: `extern` block uses type `Option`, which is not FFI-safe + --> $DIR/clashing-extern-fn.rs:510:51 + | +LL | fn pt_non_zero_usize_wrapper_opt() -> Option; + | ^^^^^^^^^^^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + warning: `clash` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:13:13 | @@ -258,5 +312,65 @@ LL | fn hidden_niche_unsafe_cell() -> Option usize` found `unsafe extern "C" fn() -> Option>>` -warning: 22 warnings emitted +warning: `pt_non_zero_usize` redeclared with a different signature + --> $DIR/clashing-extern-fn.rs:519:13 + | +LL | fn pt_non_zero_usize() -> pattern_type!(usize is 1..); + | ------------------------------------------------------ `pt_non_zero_usize` previously declared here +... +LL | fn pt_non_zero_usize() -> usize; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | + = note: expected `unsafe extern "C" fn() -> (usize) is 1..=` + found `unsafe extern "C" fn() -> usize` + +warning: `pt_non_zero_usize_opt` redeclared with a different signature + --> $DIR/clashing-extern-fn.rs:521:13 + | +LL | fn pt_non_zero_usize_opt() -> Option; + | ------------------------------------------------------------------ `pt_non_zero_usize_opt` previously declared here +... +LL | fn pt_non_zero_usize_opt() -> usize; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | + = note: expected `unsafe extern "C" fn() -> Option<(usize) is 1..=>` + found `unsafe extern "C" fn() -> usize` + +warning: `pt_non_null_ptr` redeclared with a different signature + --> $DIR/clashing-extern-fn.rs:523:13 + | +LL | fn pt_non_null_ptr() -> pattern_type!(usize is 1..); + | ---------------------------------------------------- `pt_non_null_ptr` previously declared here +... +LL | fn pt_non_null_ptr() -> *const (); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | + = note: expected `unsafe extern "C" fn() -> (usize) is 1..=` + found `unsafe extern "C" fn() -> *const ()` + +warning: `pt_non_zero_usize_wrapper` redeclared with a different signature + --> $DIR/clashing-extern-fn.rs:525:13 + | +LL | fn pt_non_zero_usize_wrapper() -> NonZeroUsize; + | ----------------------------------------------- `pt_non_zero_usize_wrapper` previously declared here +... +LL | fn pt_non_zero_usize_wrapper() -> usize; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | + = note: expected `unsafe extern "C" fn() -> NonZeroUsize` + found `unsafe extern "C" fn() -> usize` + +warning: `pt_non_zero_usize_wrapper_opt` redeclared with a different signature + --> $DIR/clashing-extern-fn.rs:527:13 + | +LL | fn pt_non_zero_usize_wrapper_opt() -> Option; + | ----------------------------------------------------------- `pt_non_zero_usize_wrapper_opt` previously declared here +... +LL | fn pt_non_zero_usize_wrapper_opt() -> usize; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration + | + = note: expected `unsafe extern "C" fn() -> Option` + found `unsafe extern "C" fn() -> usize` + +warning: 33 warnings emitted diff --git a/tests/ui/lint/lint-ctypes-enum.rs b/tests/ui/lint/lint-ctypes-enum.rs index 19af1de95760..0d19d5b53471 100644 --- a/tests/ui/lint/lint-ctypes-enum.rs +++ b/tests/ui/lint/lint-ctypes-enum.rs @@ -94,6 +94,7 @@ extern "C" { fn option_transparent_union(x: Option>>); //~^ ERROR `extern` block uses type fn option_repr_rust(x: Option>>); //~ ERROR `extern` block uses type + fn option_u8(x: Option); //~ ERROR `extern` block uses type fn result_ref_t(x: Result<&'static u8, ()>); fn result_fn_t(x: Result); diff --git a/tests/ui/lint/lint-ctypes-enum.stderr b/tests/ui/lint/lint-ctypes-enum.stderr index 8e92e7e69462..a491bd196056 100644 --- a/tests/ui/lint/lint-ctypes-enum.stderr +++ b/tests/ui/lint/lint-ctypes-enum.stderr @@ -79,8 +79,17 @@ LL | fn option_repr_rust(x: Option>>); = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint +error: `extern` block uses type `Option`, which is not FFI-safe + --> $DIR/lint-ctypes-enum.rs:97:21 + | +LL | fn option_u8(x: Option); + | ^^^^^^^^^^ not FFI-safe + | + = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum + = note: enum has no representation hint + error: `extern` block uses type `u128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:106:33 + --> $DIR/lint-ctypes-enum.rs:107:33 | LL | fn result_nonzero_u128_t(x: Result, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -88,7 +97,7 @@ LL | fn result_nonzero_u128_t(x: Result, ()>); = note: 128-bit integers don't currently have a known stable ABI error: `extern` block uses type `i128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:113:33 + --> $DIR/lint-ctypes-enum.rs:114:33 | LL | fn result_nonzero_i128_t(x: Result, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -96,7 +105,7 @@ LL | fn result_nonzero_i128_t(x: Result, ()>); = note: 128-bit integers don't currently have a known stable ABI error: `extern` block uses type `Result>, ()>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:118:38 + --> $DIR/lint-ctypes-enum.rs:119:38 | LL | fn result_transparent_union_t(x: Result>, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -105,7 +114,7 @@ LL | fn result_transparent_union_t(x: Result>, ()>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:120:30 + --> $DIR/lint-ctypes-enum.rs:121:30 | LL | fn result_repr_rust_t(x: Result>, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -114,7 +123,7 @@ LL | fn result_repr_rust_t(x: Result>, ()>); = note: enum has no representation hint error: `extern` block uses type `Result, U>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:124:51 + --> $DIR/lint-ctypes-enum.rs:125:51 | LL | fn result_1zst_exhaustive_single_variant_t(x: Result, U>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -123,7 +132,7 @@ LL | fn result_1zst_exhaustive_single_variant_t(x: Result, = note: enum has no representation hint error: `extern` block uses type `Result, B>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:126:53 + --> $DIR/lint-ctypes-enum.rs:127:53 | LL | fn result_1zst_exhaustive_multiple_variant_t(x: Result, B>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -132,7 +141,7 @@ LL | fn result_1zst_exhaustive_multiple_variant_t(x: Result = note: enum has no representation hint error: `extern` block uses type `Result, NonExhaustive>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:128:51 + --> $DIR/lint-ctypes-enum.rs:129:51 | LL | fn result_1zst_non_exhaustive_no_variant_t(x: Result, NonExhaustive>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -141,7 +150,7 @@ LL | fn result_1zst_non_exhaustive_no_variant_t(x: Result, = note: enum has no representation hint error: `extern` block uses type `Result, Field>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:131:49 + --> $DIR/lint-ctypes-enum.rs:132:49 | LL | fn result_1zst_exhaustive_single_field_t(x: Result, Field>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -150,7 +159,7 @@ LL | fn result_1zst_exhaustive_single_field_t(x: Result, Fi = note: enum has no representation hint error: `extern` block uses type `Result>, ()>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:133:30 + --> $DIR/lint-ctypes-enum.rs:134:30 | LL | fn result_cascading_t(x: Result>, ()>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -159,7 +168,7 @@ LL | fn result_cascading_t(x: Result>, ()>); = note: enum has no representation hint error: `extern` block uses type `u128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:144:33 + --> $DIR/lint-ctypes-enum.rs:145:33 | LL | fn result_nonzero_u128_e(x: Result<(), num::NonZero>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -167,7 +176,7 @@ LL | fn result_nonzero_u128_e(x: Result<(), num::NonZero>); = note: 128-bit integers don't currently have a known stable ABI error: `extern` block uses type `i128`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:151:33 + --> $DIR/lint-ctypes-enum.rs:152:33 | LL | fn result_nonzero_i128_e(x: Result<(), num::NonZero>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -175,7 +184,7 @@ LL | fn result_nonzero_i128_e(x: Result<(), num::NonZero>); = note: 128-bit integers don't currently have a known stable ABI error: `extern` block uses type `Result<(), TransparentUnion>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:156:38 + --> $DIR/lint-ctypes-enum.rs:157:38 | LL | fn result_transparent_union_e(x: Result<(), TransparentUnion>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -184,7 +193,7 @@ LL | fn result_transparent_union_e(x: Result<(), TransparentUnion>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:158:30 + --> $DIR/lint-ctypes-enum.rs:159:30 | LL | fn result_repr_rust_e(x: Result<(), Rust>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -193,7 +202,7 @@ LL | fn result_repr_rust_e(x: Result<(), Rust>>); = note: enum has no representation hint error: `extern` block uses type `Result>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:162:51 + --> $DIR/lint-ctypes-enum.rs:163:51 | LL | fn result_1zst_exhaustive_single_variant_e(x: Result>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -202,7 +211,7 @@ LL | fn result_1zst_exhaustive_single_variant_e(x: Result>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:164:53 + --> $DIR/lint-ctypes-enum.rs:165:53 | LL | fn result_1zst_exhaustive_multiple_variant_e(x: Result>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -211,7 +220,7 @@ LL | fn result_1zst_exhaustive_multiple_variant_e(x: Result>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:166:51 + --> $DIR/lint-ctypes-enum.rs:167:51 | LL | fn result_1zst_non_exhaustive_no_variant_e(x: Result>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -220,7 +229,7 @@ LL | fn result_1zst_non_exhaustive_no_variant_e(x: Result>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:169:49 + --> $DIR/lint-ctypes-enum.rs:170:49 | LL | fn result_1zst_exhaustive_single_field_e(x: Result>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -229,7 +238,7 @@ LL | fn result_1zst_exhaustive_single_field_e(x: Result>>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:171:30 + --> $DIR/lint-ctypes-enum.rs:172:30 | LL | fn result_cascading_e(x: Result<(), Result<(), num::NonZero>>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -238,7 +247,7 @@ LL | fn result_cascading_e(x: Result<(), Result<(), num::NonZero>>); = note: enum has no representation hint error: `extern` block uses type `Result<(), ()>`, which is not FFI-safe - --> $DIR/lint-ctypes-enum.rs:173:27 + --> $DIR/lint-ctypes-enum.rs:174:27 | LL | fn result_unit_t_e(x: Result<(), ()>); | ^^^^^^^^^^^^^^ not FFI-safe @@ -246,5 +255,5 @@ LL | fn result_unit_t_e(x: Result<(), ()>); = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint -error: aborting due to 26 previous errors +error: aborting due to 27 previous errors From 473352da311f79bfaadb90c02c6458d02b1fb119 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Fri, 24 Jan 2025 15:57:13 +0000 Subject: [PATCH 081/128] Correctly handle pattern types in FFI safety --- compiler/rustc_lint/messages.ftl | 3 -- compiler/rustc_lint/src/types.rs | 8 ++--- tests/ui/lint/clashing-extern-fn.rs | 3 -- tests/ui/lint/clashing-extern-fn.stderr | 45 +++++-------------------- 4 files changed, 12 insertions(+), 47 deletions(-) diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index 55c6a122d35d..480d97e377a4 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -390,9 +390,6 @@ lint_improper_ctypes_only_phantomdata = composed only of `PhantomData` lint_improper_ctypes_opaque = opaque types have no C equivalent -lint_improper_ctypes_pat_help = consider using the base type instead - -lint_improper_ctypes_pat_reason = pattern types have no C equivalent lint_improper_ctypes_slice_help = consider using a raw pointer instead lint_improper_ctypes_slice_reason = slices have no C equivalent diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index 601d2fbfb67f..0dccb8d336d3 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -1256,11 +1256,9 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { help: Some(fluent::lint_improper_ctypes_char_help), }, - ty::Pat(..) => FfiUnsafe { - ty, - reason: fluent::lint_improper_ctypes_pat_reason, - help: Some(fluent::lint_improper_ctypes_pat_help), - }, + // It's just extra invariants on the type that you need to uphold, + // but only the base type is relevant for being representable in FFI. + ty::Pat(base, ..) => self.check_type_for_ffi(acc, base), ty::Int(ty::IntTy::I128) | ty::Uint(ty::UintTy::U128) => { FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_128bit, help: None } diff --git a/tests/ui/lint/clashing-extern-fn.rs b/tests/ui/lint/clashing-extern-fn.rs index 0464299348bd..012eda761f42 100644 --- a/tests/ui/lint/clashing-extern-fn.rs +++ b/tests/ui/lint/clashing-extern-fn.rs @@ -498,15 +498,12 @@ mod pattern_types { struct NonZeroUsize(pattern_type!(usize is 1..)); extern "C" { fn pt_non_zero_usize() -> pattern_type!(usize is 1..); - //~^ WARN not FFI-safe fn pt_non_zero_usize_opt() -> Option; //~^ WARN not FFI-safe fn pt_non_zero_usize_opt_full_range() -> Option; //~^ WARN not FFI-safe fn pt_non_null_ptr() -> pattern_type!(usize is 1..); - //~^ WARN not FFI-safe fn pt_non_zero_usize_wrapper() -> NonZeroUsize; - //~^ WARN not FFI-safe fn pt_non_zero_usize_wrapper_opt() -> Option; //~^ WARN not FFI-safe } diff --git a/tests/ui/lint/clashing-extern-fn.stderr b/tests/ui/lint/clashing-extern-fn.stderr index acf31a1f5dd4..16d251c1d7a7 100644 --- a/tests/ui/lint/clashing-extern-fn.stderr +++ b/tests/ui/lint/clashing-extern-fn.stderr @@ -17,17 +17,8 @@ LL | fn hidden_niche_unsafe_cell() -> Option $DIR/clashing-extern-fn.rs:500:39 - | -LL | fn pt_non_zero_usize() -> pattern_type!(usize is 1..); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider using the base type instead - = note: pattern types have no C equivalent - warning: `extern` block uses type `Option<(usize) is 1..=>`, which is not FFI-safe - --> $DIR/clashing-extern-fn.rs:502:43 + --> $DIR/clashing-extern-fn.rs:501:43 | LL | fn pt_non_zero_usize_opt() -> Option; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -36,7 +27,7 @@ LL | fn pt_non_zero_usize_opt() -> Option`, which is not FFI-safe - --> $DIR/clashing-extern-fn.rs:504:54 + --> $DIR/clashing-extern-fn.rs:503:54 | LL | fn pt_non_zero_usize_opt_full_range() -> Option; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -44,26 +35,8 @@ LL | fn pt_non_zero_usize_opt_full_range() -> Option $DIR/clashing-extern-fn.rs:506:37 - | -LL | fn pt_non_null_ptr() -> pattern_type!(usize is 1..); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider using the base type instead - = note: pattern types have no C equivalent - -warning: `extern` block uses type `(usize) is 1..=`, which is not FFI-safe - --> $DIR/clashing-extern-fn.rs:508:47 - | -LL | fn pt_non_zero_usize_wrapper() -> NonZeroUsize; - | ^^^^^^^^^^^^ not FFI-safe - | - = help: consider using the base type instead - = note: pattern types have no C equivalent - warning: `extern` block uses type `Option`, which is not FFI-safe - --> $DIR/clashing-extern-fn.rs:510:51 + --> $DIR/clashing-extern-fn.rs:507:51 | LL | fn pt_non_zero_usize_wrapper_opt() -> Option; | ^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -313,7 +286,7 @@ LL | fn hidden_niche_unsafe_cell() -> Option Option>>` warning: `pt_non_zero_usize` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:519:13 + --> $DIR/clashing-extern-fn.rs:516:13 | LL | fn pt_non_zero_usize() -> pattern_type!(usize is 1..); | ------------------------------------------------------ `pt_non_zero_usize` previously declared here @@ -325,7 +298,7 @@ LL | fn pt_non_zero_usize() -> usize; found `unsafe extern "C" fn() -> usize` warning: `pt_non_zero_usize_opt` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:521:13 + --> $DIR/clashing-extern-fn.rs:518:13 | LL | fn pt_non_zero_usize_opt() -> Option; | ------------------------------------------------------------------ `pt_non_zero_usize_opt` previously declared here @@ -337,7 +310,7 @@ LL | fn pt_non_zero_usize_opt() -> usize; found `unsafe extern "C" fn() -> usize` warning: `pt_non_null_ptr` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:523:13 + --> $DIR/clashing-extern-fn.rs:520:13 | LL | fn pt_non_null_ptr() -> pattern_type!(usize is 1..); | ---------------------------------------------------- `pt_non_null_ptr` previously declared here @@ -349,7 +322,7 @@ LL | fn pt_non_null_ptr() -> *const (); found `unsafe extern "C" fn() -> *const ()` warning: `pt_non_zero_usize_wrapper` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:525:13 + --> $DIR/clashing-extern-fn.rs:522:13 | LL | fn pt_non_zero_usize_wrapper() -> NonZeroUsize; | ----------------------------------------------- `pt_non_zero_usize_wrapper` previously declared here @@ -361,7 +334,7 @@ LL | fn pt_non_zero_usize_wrapper() -> usize; found `unsafe extern "C" fn() -> usize` warning: `pt_non_zero_usize_wrapper_opt` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:527:13 + --> $DIR/clashing-extern-fn.rs:524:13 | LL | fn pt_non_zero_usize_wrapper_opt() -> Option; | ----------------------------------------------------------- `pt_non_zero_usize_wrapper_opt` previously declared here @@ -372,5 +345,5 @@ LL | fn pt_non_zero_usize_wrapper_opt() -> usize; = note: expected `unsafe extern "C" fn() -> Option` found `unsafe extern "C" fn() -> usize` -warning: 33 warnings emitted +warning: 30 warnings emitted From 5bae8ca77c3f6a0050a58b1bc96ee3d51d3feb32 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Fri, 24 Jan 2025 15:57:13 +0000 Subject: [PATCH 082/128] Correctly handle pattern types in FFI redeclaration lints --- compiler/rustc_lint/src/foreign_modules.rs | 9 +- compiler/rustc_lint/src/types.rs | 113 +++++++++++---------- tests/ui/lint/clashing-extern-fn.rs | 2 - tests/ui/lint/clashing-extern-fn.stderr | 32 +----- 4 files changed, 66 insertions(+), 90 deletions(-) diff --git a/compiler/rustc_lint/src/foreign_modules.rs b/compiler/rustc_lint/src/foreign_modules.rs index 45b188205d22..636779fe9b4c 100644 --- a/compiler/rustc_lint/src/foreign_modules.rs +++ b/compiler/rustc_lint/src/foreign_modules.rs @@ -241,10 +241,7 @@ fn structurally_same_type_impl<'tcx>( if let ty::Adt(def, args) = *ty.kind() { let is_transparent = def.repr().transparent(); let is_non_null = types::nonnull_optimization_guaranteed(tcx, def); - debug!( - "non_transparent_ty({:?}) -- type is transparent? {}, type is non-null? {}", - ty, is_transparent, is_non_null - ); + debug!(?ty, is_transparent, is_non_null); if is_transparent && !is_non_null { debug_assert_eq!(def.variants().len(), 1); let v = &def.variant(FIRST_VARIANT); @@ -378,14 +375,14 @@ fn structurally_same_type_impl<'tcx>( // An Adt and a primitive or pointer type. This can be FFI-safe if non-null // enum layout optimisation is being applied. - (Adt(..), _) if is_primitive_or_pointer(b) => { + (Adt(..) | Pat(..), _) if is_primitive_or_pointer(b) => { if let Some(a_inner) = types::repr_nullable_ptr(tcx, typing_env, a, ckind) { a_inner == b } else { false } } - (_, Adt(..)) if is_primitive_or_pointer(a) => { + (_, Adt(..) | Pat(..)) if is_primitive_or_pointer(a) => { if let Some(b_inner) = types::repr_nullable_ptr(tcx, typing_env, b, ckind) { b_inner == a } else { diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index 0dccb8d336d3..47ceb4b7d282 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -907,9 +907,8 @@ fn get_nullable_type<'tcx>( }; return get_nullable_type(tcx, typing_env, inner_field_ty); } - ty::Int(ty) => Ty::new_int(tcx, ty), - ty::Uint(ty) => Ty::new_uint(tcx, ty), - ty::RawPtr(ty, mutbl) => Ty::new_ptr(tcx, ty, mutbl), + ty::Pat(base, ..) => return get_nullable_type(tcx, typing_env, base), + ty::Int(_) | ty::Uint(_) | ty::RawPtr(..) => ty, // As these types are always non-null, the nullable equivalent of // `Option` of these types are their raw pointer counterparts. ty::Ref(_region, ty, mutbl) => Ty::new_ptr(tcx, ty, mutbl), @@ -965,63 +964,69 @@ pub(crate) fn repr_nullable_ptr<'tcx>( ckind: CItemKind, ) -> Option> { debug!("is_repr_nullable_ptr(tcx, ty = {:?})", ty); - if let ty::Adt(ty_def, args) = ty.kind() { - let field_ty = match &ty_def.variants().raw[..] { - [var_one, var_two] => match (&var_one.fields.raw[..], &var_two.fields.raw[..]) { - ([], [field]) | ([field], []) => field.ty(tcx, args), - ([field1], [field2]) => { - let ty1 = field1.ty(tcx, args); - let ty2 = field2.ty(tcx, args); + match ty.kind() { + ty::Adt(ty_def, args) => { + let field_ty = match &ty_def.variants().raw[..] { + [var_one, var_two] => match (&var_one.fields.raw[..], &var_two.fields.raw[..]) { + ([], [field]) | ([field], []) => field.ty(tcx, args), + ([field1], [field2]) => { + let ty1 = field1.ty(tcx, args); + let ty2 = field2.ty(tcx, args); - if is_niche_optimization_candidate(tcx, typing_env, ty1) { - ty2 - } else if is_niche_optimization_candidate(tcx, typing_env, ty2) { - ty1 - } else { - return None; + if is_niche_optimization_candidate(tcx, typing_env, ty1) { + ty2 + } else if is_niche_optimization_candidate(tcx, typing_env, ty2) { + ty1 + } else { + return None; + } } - } + _ => return None, + }, _ => return None, - }, - _ => return None, - }; - - if !ty_is_known_nonnull(tcx, typing_env, field_ty, ckind) { - return None; - } - - // At this point, the field's type is known to be nonnull and the parent enum is Option-like. - // If the computed size for the field and the enum are different, the nonnull optimization isn't - // being applied (and we've got a problem somewhere). - let compute_size_skeleton = |t| SizeSkeleton::compute(t, tcx, typing_env).ok(); - if !compute_size_skeleton(ty)?.same_size(compute_size_skeleton(field_ty)?) { - bug!("improper_ctypes: Option nonnull optimization not applied?"); - } - - // Return the nullable type this Option-like enum can be safely represented with. - let field_ty_layout = tcx.layout_of(typing_env.as_query_input(field_ty)); - if field_ty_layout.is_err() && !field_ty.has_non_region_param() { - bug!("should be able to compute the layout of non-polymorphic type"); - } - - let field_ty_abi = &field_ty_layout.ok()?.backend_repr; - if let BackendRepr::Scalar(field_ty_scalar) = field_ty_abi { - match field_ty_scalar.valid_range(&tcx) { - WrappingRange { start: 0, end } - if end == field_ty_scalar.size(&tcx).unsigned_int_max() - 1 => - { - return Some(get_nullable_type(tcx, typing_env, field_ty).unwrap()); - } - WrappingRange { start: 1, .. } => { - return Some(get_nullable_type(tcx, typing_env, field_ty).unwrap()); - } - WrappingRange { start, end } => { - unreachable!("Unhandled start and end range: ({}, {})", start, end) - } }; + + if !ty_is_known_nonnull(tcx, typing_env, field_ty, ckind) { + return None; + } + + // At this point, the field's type is known to be nonnull and the parent enum is Option-like. + // If the computed size for the field and the enum are different, the nonnull optimization isn't + // being applied (and we've got a problem somewhere). + let compute_size_skeleton = |t| SizeSkeleton::compute(t, tcx, typing_env).ok(); + if !compute_size_skeleton(ty)?.same_size(compute_size_skeleton(field_ty)?) { + bug!("improper_ctypes: Option nonnull optimization not applied?"); + } + + // Return the nullable type this Option-like enum can be safely represented with. + let field_ty_layout = tcx.layout_of(typing_env.as_query_input(field_ty)); + if field_ty_layout.is_err() && !field_ty.has_non_region_param() { + bug!("should be able to compute the layout of non-polymorphic type"); + } + + let field_ty_abi = &field_ty_layout.ok()?.backend_repr; + if let BackendRepr::Scalar(field_ty_scalar) = field_ty_abi { + match field_ty_scalar.valid_range(&tcx) { + WrappingRange { start: 0, end } + if end == field_ty_scalar.size(&tcx).unsigned_int_max() - 1 => + { + return Some(get_nullable_type(tcx, typing_env, field_ty).unwrap()); + } + WrappingRange { start: 1, .. } => { + return Some(get_nullable_type(tcx, typing_env, field_ty).unwrap()); + } + WrappingRange { start, end } => { + unreachable!("Unhandled start and end range: ({}, {})", start, end) + } + }; + } + None } + ty::Pat(base, pat) => match **pat { + ty::PatternKind::Range { .. } => get_nullable_type(tcx, typing_env, *base), + }, + _ => None, } - None } impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { diff --git a/tests/ui/lint/clashing-extern-fn.rs b/tests/ui/lint/clashing-extern-fn.rs index 012eda761f42..1d1c07b66b2f 100644 --- a/tests/ui/lint/clashing-extern-fn.rs +++ b/tests/ui/lint/clashing-extern-fn.rs @@ -514,13 +514,11 @@ mod pattern_types { // invariant that the value is non-zero, or you're missing out on that invariant. Both // cases are warning for, from both a caller-convenience and optimisation perspective. fn pt_non_zero_usize() -> usize; - //~^ WARN `pt_non_zero_usize` redeclared with a different signature fn pt_non_zero_usize_opt() -> usize; //~^ WARN `pt_non_zero_usize_opt` redeclared with a different signature fn pt_non_null_ptr() -> *const (); //~^ WARN `pt_non_null_ptr` redeclared with a different signature fn pt_non_zero_usize_wrapper() -> usize; - //~^ WARN `pt_non_zero_usize_wrapper` redeclared with a different signature fn pt_non_zero_usize_wrapper_opt() -> usize; //~^ WARN `pt_non_zero_usize_wrapper_opt` redeclared with a different signature } diff --git a/tests/ui/lint/clashing-extern-fn.stderr b/tests/ui/lint/clashing-extern-fn.stderr index 16d251c1d7a7..a2fc9e774923 100644 --- a/tests/ui/lint/clashing-extern-fn.stderr +++ b/tests/ui/lint/clashing-extern-fn.stderr @@ -285,20 +285,8 @@ LL | fn hidden_niche_unsafe_cell() -> Option usize` found `unsafe extern "C" fn() -> Option>>` -warning: `pt_non_zero_usize` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:516:13 - | -LL | fn pt_non_zero_usize() -> pattern_type!(usize is 1..); - | ------------------------------------------------------ `pt_non_zero_usize` previously declared here -... -LL | fn pt_non_zero_usize() -> usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration - | - = note: expected `unsafe extern "C" fn() -> (usize) is 1..=` - found `unsafe extern "C" fn() -> usize` - warning: `pt_non_zero_usize_opt` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:518:13 + --> $DIR/clashing-extern-fn.rs:517:13 | LL | fn pt_non_zero_usize_opt() -> Option; | ------------------------------------------------------------------ `pt_non_zero_usize_opt` previously declared here @@ -310,7 +298,7 @@ LL | fn pt_non_zero_usize_opt() -> usize; found `unsafe extern "C" fn() -> usize` warning: `pt_non_null_ptr` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:520:13 + --> $DIR/clashing-extern-fn.rs:519:13 | LL | fn pt_non_null_ptr() -> pattern_type!(usize is 1..); | ---------------------------------------------------- `pt_non_null_ptr` previously declared here @@ -321,20 +309,8 @@ LL | fn pt_non_null_ptr() -> *const (); = note: expected `unsafe extern "C" fn() -> (usize) is 1..=` found `unsafe extern "C" fn() -> *const ()` -warning: `pt_non_zero_usize_wrapper` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:522:13 - | -LL | fn pt_non_zero_usize_wrapper() -> NonZeroUsize; - | ----------------------------------------------- `pt_non_zero_usize_wrapper` previously declared here -... -LL | fn pt_non_zero_usize_wrapper() -> usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration - | - = note: expected `unsafe extern "C" fn() -> NonZeroUsize` - found `unsafe extern "C" fn() -> usize` - warning: `pt_non_zero_usize_wrapper_opt` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:524:13 + --> $DIR/clashing-extern-fn.rs:522:13 | LL | fn pt_non_zero_usize_wrapper_opt() -> Option; | ----------------------------------------------------------- `pt_non_zero_usize_wrapper_opt` previously declared here @@ -345,5 +321,5 @@ LL | fn pt_non_zero_usize_wrapper_opt() -> usize; = note: expected `unsafe extern "C" fn() -> Option` found `unsafe extern "C" fn() -> usize` -warning: 30 warnings emitted +warning: 28 warnings emitted From 6d7ce4e893003cc652428ec02eb752bba63645e2 Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Thu, 6 Feb 2025 13:48:12 +0000 Subject: [PATCH 083/128] Add a TyPat in the AST to reuse the generic arg lowering logic --- compiler/rustc_ast/src/ast.rs | 23 ++++- compiler/rustc_ast/src/mut_visit.rs | 20 ++++- compiler/rustc_ast/src/visit.rs | 17 +++- compiler/rustc_ast_lowering/src/pat.rs | 80 +++-------------- compiler/rustc_ast_pretty/src/pprust/state.rs | 24 ++++- .../rustc_builtin_macros/src/pattern_type.rs | 18 +++- compiler/rustc_resolve/src/late.rs | 15 ++++ src/tools/rustfmt/src/patterns.rs | 87 +++++++++++-------- src/tools/rustfmt/src/spanned.rs | 2 +- src/tools/rustfmt/src/types.rs | 16 ++++ .../pattern_types/assoc_const.default.stderr | 83 +++++------------- tests/ui/type/pattern_types/assoc_const.rs | 12 +-- .../bad_const_generics_args_on_const_param.rs | 2 +- ..._const_generics_args_on_const_param.stderr | 11 ++- tests/ui/type/pattern_types/const_block.rs | 2 +- .../ui/type/pattern_types/const_block.stderr | 72 --------------- .../feature-gate-pattern_types.rs | 1 + .../feature-gate-pattern_types.stderr | 8 +- .../feature-gate-pattern_types2.rs | 2 +- .../feature-gate-pattern_types2.stderr | 8 ++ tests/ui/unpretty/expanded-exhaustive.stdout | 2 +- 21 files changed, 241 insertions(+), 264 deletions(-) delete mode 100644 tests/ui/type/pattern_types/const_block.stderr create mode 100644 tests/ui/type/pattern_types/feature-gate-pattern_types2.stderr diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index deee3a597aed..29c1d34a125a 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -2249,7 +2249,7 @@ pub enum TyKind { CVarArgs, /// Pattern types like `pattern_type!(u32 is 1..=)`, which is the same as `NonZero`, /// just as part of the type system. - Pat(P, P), + Pat(P, P), /// Sometimes we need a dummy value when no error has occurred. Dummy, /// Placeholder for a kind that has failed to be defined. @@ -2277,6 +2277,27 @@ impl TyKind { } } +/// A pattern type pattern. +#[derive(Clone, Encodable, Decodable, Debug)] +pub struct TyPat { + pub id: NodeId, + pub kind: TyPatKind, + pub span: Span, + pub tokens: Option, +} + +/// All the different flavors of pattern that Rust recognizes. +// +// Adding a new variant? Please update `test_pat` in `tests/ui/macros/stringify.rs`. +#[derive(Clone, Encodable, Decodable, Debug)] +pub enum TyPatKind { + /// A range pattern (e.g., `1...2`, `1..2`, `1..`, `..2`, `1..=2`, `..=2`). + Range(Option>, Option>, Spanned), + + /// Placeholder for a pattern that wasn't syntactically well formed in some way. + Err(ErrorGuaranteed), +} + /// Syntax used to declare a trait object. #[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)] #[repr(u8)] diff --git a/compiler/rustc_ast/src/mut_visit.rs b/compiler/rustc_ast/src/mut_visit.rs index a9961cca5833..de9f049704a4 100644 --- a/compiler/rustc_ast/src/mut_visit.rs +++ b/compiler/rustc_ast/src/mut_visit.rs @@ -210,6 +210,10 @@ pub trait MutVisitor: Sized { walk_ty(self, t); } + fn visit_ty_pat(&mut self, t: &mut P) { + walk_ty_pat(self, t); + } + fn visit_lifetime(&mut self, l: &mut Lifetime) { walk_lifetime(self, l); } @@ -570,7 +574,7 @@ pub fn walk_ty(vis: &mut T, ty: &mut P) { TyKind::Paren(ty) => vis.visit_ty(ty), TyKind::Pat(ty, pat) => { vis.visit_ty(ty); - vis.visit_pat(pat); + vis.visit_ty_pat(pat); } TyKind::Path(qself, path) => { vis.visit_qself(qself); @@ -594,6 +598,20 @@ pub fn walk_ty(vis: &mut T, ty: &mut P) { vis.visit_span(span); } +pub fn walk_ty_pat(vis: &mut T, ty: &mut P) { + let TyPat { id, kind, span, tokens } = ty.deref_mut(); + vis.visit_id(id); + match kind { + TyPatKind::Range(start, end, _include_end) => { + visit_opt(start, |c| vis.visit_anon_const(c)); + visit_opt(end, |c| vis.visit_anon_const(c)); + } + TyPatKind::Err(_) => {} + } + visit_lazy_tts(vis, tokens); + vis.visit_span(span); +} + fn walk_foreign_mod(vis: &mut T, foreign_mod: &mut ForeignMod) { let ForeignMod { extern_span: _, safety, abi: _, items } = foreign_mod; visit_safety(vis, safety); diff --git a/compiler/rustc_ast/src/visit.rs b/compiler/rustc_ast/src/visit.rs index 714b074f930c..3242d4145959 100644 --- a/compiler/rustc_ast/src/visit.rs +++ b/compiler/rustc_ast/src/visit.rs @@ -179,6 +179,9 @@ pub trait Visitor<'ast>: Sized { fn visit_ty(&mut self, t: &'ast Ty) -> Self::Result { walk_ty(self, t) } + fn visit_ty_pat(&mut self, t: &'ast TyPat) -> Self::Result { + walk_ty_pat(self, t) + } fn visit_generic_param(&mut self, param: &'ast GenericParam) -> Self::Result { walk_generic_param(self, param) } @@ -534,7 +537,7 @@ pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) -> V::Result { } TyKind::Pat(ty, pat) => { try_visit!(visitor.visit_ty(ty)); - try_visit!(visitor.visit_pat(pat)); + try_visit!(visitor.visit_ty_pat(pat)); } TyKind::Array(ty, length) => { try_visit!(visitor.visit_ty(ty)); @@ -555,6 +558,18 @@ pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) -> V::Result { V::Result::output() } +pub fn walk_ty_pat<'a, V: Visitor<'a>>(visitor: &mut V, tp: &'a TyPat) -> V::Result { + let TyPat { id: _, kind, span: _, tokens: _ } = tp; + match kind { + TyPatKind::Range(start, end, _include_end) => { + visit_opt!(visitor, visit_anon_const, start); + visit_opt!(visitor, visit_anon_const, end); + } + TyPatKind::Err(_) => {} + } + V::Result::output() +} + fn walk_qself<'a, V: Visitor<'a>>(visitor: &mut V, qself: &'a Option>) -> V::Result { if let Some(qself) = qself { let QSelf { ty, path_span: _, position: _ } = &**qself; diff --git a/compiler/rustc_ast_lowering/src/pat.rs b/compiler/rustc_ast_lowering/src/pat.rs index bb9b2a13185b..e1f3afbcf590 100644 --- a/compiler/rustc_ast_lowering/src/pat.rs +++ b/compiler/rustc_ast_lowering/src/pat.rs @@ -4,10 +4,10 @@ use rustc_ast::ptr::P; use rustc_ast::*; use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_hir as hir; -use rustc_hir::def::{DefKind, Res}; +use rustc_hir::def::Res; use rustc_middle::span_bug; use rustc_span::source_map::{Spanned, respan}; -use rustc_span::{Ident, Span, kw}; +use rustc_span::{Ident, Span}; use super::errors::{ ArbitraryExpressionInPattern, ExtraDoubleDot, MisplacedDoubleDot, SubTupleBinding, @@ -430,78 +430,20 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { self.arena.alloc(hir::PatExpr { hir_id: self.lower_node_id(expr.id), span, kind }) } - pub(crate) fn lower_ty_pat(&mut self, pattern: &Pat) -> &'hir hir::TyPat<'hir> { + pub(crate) fn lower_ty_pat(&mut self, pattern: &TyPat) -> &'hir hir::TyPat<'hir> { self.arena.alloc(self.lower_ty_pat_mut(pattern)) } - fn lower_ty_pat_mut(&mut self, mut pattern: &Pat) -> hir::TyPat<'hir> { + fn lower_ty_pat_mut(&mut self, pattern: &TyPat) -> hir::TyPat<'hir> { // loop here to avoid recursion let pat_hir_id = self.lower_node_id(pattern.id); - let node = loop { - match &pattern.kind { - PatKind::Range(e1, e2, Spanned { node: end, .. }) => { - // FIXME(pattern_types): remove this closure and call `lower_const_arg` instead. - // That requires first modifying the AST to have const args here. - let mut lower_expr = |e: &Expr| -> &_ { - if let ExprKind::Path(None, path) = &e.kind - && let Some(res) = self - .resolver - .get_partial_res(e.id) - .and_then(|partial_res| partial_res.full_res()) - { - self.lower_const_path_to_const_arg(path, res, e.id, e.span) - } else { - let node_id = self.next_node_id(); - let def_id = self.create_def( - self.current_hir_id_owner.def_id, - node_id, - kw::Empty, - DefKind::AnonConst, - e.span, - ); - let hir_id = self.lower_node_id(node_id); - let ac = self.arena.alloc(hir::AnonConst { - def_id, - hir_id, - body: self.lower_const_body(pattern.span, Some(e)), - span: self.lower_span(pattern.span), - }); - self.arena.alloc(hir::ConstArg { - hir_id: self.next_id(), - kind: hir::ConstArgKind::Anon(ac), - }) - } - }; - break hir::TyPatKind::Range( - e1.as_deref().map(|e| lower_expr(e)), - e2.as_deref().map(|e| lower_expr(e)), - self.lower_range_end(end, e2.is_some()), - ); - } - // return inner to be processed in next loop - PatKind::Paren(inner) => pattern = inner, - PatKind::MacCall(_) => panic!("{:?} shouldn't exist here", pattern.span), - PatKind::Err(guar) => break hir::TyPatKind::Err(*guar), - PatKind::Deref(..) - | PatKind::Box(..) - | PatKind::Or(..) - | PatKind::Struct(..) - | PatKind::TupleStruct(..) - | PatKind::Tuple(..) - | PatKind::Ref(..) - | PatKind::Expr(..) - | PatKind::Guard(..) - | PatKind::Slice(_) - | PatKind::Ident(..) - | PatKind::Path(..) - | PatKind::Wild - | PatKind::Never - | PatKind::Rest => { - break hir::TyPatKind::Err( - self.dcx().span_err(pattern.span, "pattern not supported in pattern types"), - ); - } - } + let node = match &pattern.kind { + TyPatKind::Range(e1, e2, Spanned { node: end, .. }) => hir::TyPatKind::Range( + e1.as_deref().map(|e| self.lower_anon_const_to_const_arg(e)), + e2.as_deref().map(|e| self.lower_anon_const_to_const_arg(e)), + self.lower_range_end(end, e2.is_some()), + ), + TyPatKind::Err(guar) => hir::TyPatKind::Err(*guar), }; hir::TyPat { hir_id: pat_hir_id, kind: node, span: self.lower_span(pattern.span) } diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index eeec24e5ea4e..0bf5de3ef898 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -1148,6 +1148,28 @@ impl<'a> State<'a> { } } + pub fn print_ty_pat(&mut self, pat: &ast::TyPat) { + match &pat.kind { + rustc_ast::TyPatKind::Range(start, end, include_end) => { + if let Some(start) = start { + self.print_expr_anon_const(start, &[]); + } + self.word(".."); + if let Some(end) = end { + if let RangeEnd::Included(_) = include_end.node { + self.word("="); + } + self.print_expr_anon_const(end, &[]); + } + } + rustc_ast::TyPatKind::Err(_) => { + self.popen(); + self.word("/*ERROR*/"); + self.pclose(); + } + } + } + pub fn print_type(&mut self, ty: &ast::Ty) { self.maybe_print_comment(ty.span.lo()); self.ibox(0); @@ -1252,7 +1274,7 @@ impl<'a> State<'a> { ast::TyKind::Pat(ty, pat) => { self.print_type(ty); self.word(" is "); - self.print_pat(pat); + self.print_ty_pat(pat); } } self.end(); diff --git a/compiler/rustc_builtin_macros/src/pattern_type.rs b/compiler/rustc_builtin_macros/src/pattern_type.rs index a600a9f316a7..a55c7e962d09 100644 --- a/compiler/rustc_builtin_macros/src/pattern_type.rs +++ b/compiler/rustc_builtin_macros/src/pattern_type.rs @@ -1,6 +1,6 @@ use rustc_ast::ptr::P; use rustc_ast::tokenstream::TokenStream; -use rustc_ast::{Pat, Ty, ast}; +use rustc_ast::{AnonConst, DUMMY_NODE_ID, Ty, TyPat, TyPatKind, ast}; use rustc_errors::PResult; use rustc_expand::base::{self, DummyResult, ExpandResult, ExtCtxt, MacroExpanderResult}; use rustc_parse::exp; @@ -21,12 +21,24 @@ pub(crate) fn expand<'cx>( ExpandResult::Ready(base::MacEager::ty(cx.ty(sp, ast::TyKind::Pat(ty, pat)))) } -fn parse_pat_ty<'a>(cx: &mut ExtCtxt<'a>, stream: TokenStream) -> PResult<'a, (P, P)> { +fn parse_pat_ty<'a>(cx: &mut ExtCtxt<'a>, stream: TokenStream) -> PResult<'a, (P, P)> { let mut parser = cx.new_parser_from_tts(stream); let ty = parser.parse_ty()?; parser.expect_keyword(exp!(Is))?; - let pat = parser.parse_pat_no_top_alt(None, None)?; + let pat = parser.parse_pat_no_top_alt(None, None)?.into_inner(); + + let kind = match pat.kind { + ast::PatKind::Range(start, end, include_end) => TyPatKind::Range( + start.map(|value| P(AnonConst { id: DUMMY_NODE_ID, value })), + end.map(|value| P(AnonConst { id: DUMMY_NODE_ID, value })), + include_end, + ), + ast::PatKind::Err(guar) => TyPatKind::Err(guar), + _ => TyPatKind::Err(cx.dcx().span_err(pat.span, "pattern not supported in pattern types")), + }; + + let pat = P(TyPat { id: pat.id, kind, span: pat.span, tokens: pat.tokens }); Ok((ty, pat)) } diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 508bd831ccbe..03aeb8720ca6 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -923,6 +923,21 @@ impl<'ra: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'r self.diag_metadata.current_trait_object = prev; self.diag_metadata.current_type_path = prev_ty; } + + fn visit_ty_pat(&mut self, t: &'ast TyPat) -> Self::Result { + match &t.kind { + TyPatKind::Range(start, end, _) => { + if let Some(start) = start { + self.resolve_anon_const(start, AnonConstKind::ConstArg(IsRepeatExpr::No)); + } + if let Some(end) = end { + self.resolve_anon_const(end, AnonConstKind::ConstArg(IsRepeatExpr::No)); + } + } + TyPatKind::Err(_) => {} + } + } + fn visit_poly_trait_ref(&mut self, tref: &'ast PolyTraitRef) { let span = tref.span.shrink_to_lo().to(tref.trait_ref.path.span.shrink_to_lo()); self.with_generic_param_rib( diff --git a/src/tools/rustfmt/src/patterns.rs b/src/tools/rustfmt/src/patterns.rs index 1d88726d9458..bafed41e39f4 100644 --- a/src/tools/rustfmt/src/patterns.rs +++ b/src/tools/rustfmt/src/patterns.rs @@ -75,12 +75,12 @@ fn is_short_pattern_inner(context: &RewriteContext<'_>, pat: &ast::Pat) -> bool } } -pub(crate) struct RangeOperand<'a> { - operand: &'a Option>, - pub(crate) span: Span, +pub(crate) struct RangeOperand<'a, T> { + pub operand: &'a Option>, + pub span: Span, } -impl<'a> Rewrite for RangeOperand<'a> { +impl<'a, T: Rewrite> Rewrite for RangeOperand<'a, T> { fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option { self.rewrite_result(context, shape).ok() } @@ -259,40 +259,7 @@ impl Rewrite for Pat { } PatKind::Never => Err(RewriteError::Unknown), PatKind::Range(ref lhs, ref rhs, ref end_kind) => { - let infix = match end_kind.node { - RangeEnd::Included(RangeSyntax::DotDotDot) => "...", - RangeEnd::Included(RangeSyntax::DotDotEq) => "..=", - RangeEnd::Excluded => "..", - }; - let infix = if context.config.spaces_around_ranges() { - let lhs_spacing = match lhs { - None => "", - Some(_) => " ", - }; - let rhs_spacing = match rhs { - None => "", - Some(_) => " ", - }; - format!("{lhs_spacing}{infix}{rhs_spacing}") - } else { - infix.to_owned() - }; - let lspan = self.span.with_hi(end_kind.span.lo()); - let rspan = self.span.with_lo(end_kind.span.hi()); - rewrite_pair( - &RangeOperand { - operand: lhs, - span: lspan, - }, - &RangeOperand { - operand: rhs, - span: rspan, - }, - PairParts::infix(&infix), - context, - shape, - SeparatorPlace::Front, - ) + rewrite_range_pat(context, shape, lhs, rhs, end_kind, self.span) } PatKind::Ref(ref pat, mutability) => { let prefix = format!("&{}", format_mutability(mutability)); @@ -359,6 +326,50 @@ impl Rewrite for Pat { } } +pub fn rewrite_range_pat( + context: &RewriteContext<'_>, + shape: Shape, + lhs: &Option>, + rhs: &Option>, + end_kind: &rustc_span::source_map::Spanned, + span: Span, +) -> RewriteResult { + let infix = match end_kind.node { + RangeEnd::Included(RangeSyntax::DotDotDot) => "...", + RangeEnd::Included(RangeSyntax::DotDotEq) => "..=", + RangeEnd::Excluded => "..", + }; + let infix = if context.config.spaces_around_ranges() { + let lhs_spacing = match lhs { + None => "", + Some(_) => " ", + }; + let rhs_spacing = match rhs { + None => "", + Some(_) => " ", + }; + format!("{lhs_spacing}{infix}{rhs_spacing}") + } else { + infix.to_owned() + }; + let lspan = span.with_hi(end_kind.span.lo()); + let rspan = span.with_lo(end_kind.span.hi()); + rewrite_pair( + &RangeOperand { + operand: lhs, + span: lspan, + }, + &RangeOperand { + operand: rhs, + span: rspan, + }, + PairParts::infix(&infix), + context, + shape, + SeparatorPlace::Front, + ) +} + fn rewrite_struct_pat( qself: &Option>, path: &ast::Path, diff --git a/src/tools/rustfmt/src/spanned.rs b/src/tools/rustfmt/src/spanned.rs index 6b3e40b91150..e93eb53cd87f 100644 --- a/src/tools/rustfmt/src/spanned.rs +++ b/src/tools/rustfmt/src/spanned.rs @@ -211,7 +211,7 @@ impl Spanned for ast::PreciseCapturingArg { } } -impl<'a> Spanned for RangeOperand<'a> { +impl<'a, T> Spanned for RangeOperand<'a, T> { fn span(&self) -> Span { self.span } diff --git a/src/tools/rustfmt/src/types.rs b/src/tools/rustfmt/src/types.rs index f8b713117f4c..0009490e86fe 100644 --- a/src/tools/rustfmt/src/types.rs +++ b/src/tools/rustfmt/src/types.rs @@ -18,6 +18,7 @@ use crate::lists::{ use crate::macros::{MacroPosition, rewrite_macro}; use crate::overflow; use crate::pairs::{PairParts, rewrite_pair}; +use crate::patterns::rewrite_range_pat; use crate::rewrite::{Rewrite, RewriteContext, RewriteError, RewriteErrorExt, RewriteResult}; use crate::shape::Shape; use crate::source_map::SpanUtils; @@ -1045,6 +1046,21 @@ impl Rewrite for ast::Ty { } } +impl Rewrite for ast::TyPat { + fn rewrite(&self, context: &RewriteContext<'_>, shape: Shape) -> Option { + self.rewrite_result(context, shape).ok() + } + + fn rewrite_result(&self, context: &RewriteContext<'_>, shape: Shape) -> RewriteResult { + match self.kind { + ast::TyPatKind::Range(ref lhs, ref rhs, ref end_kind) => { + rewrite_range_pat(context, shape, lhs, rhs, end_kind, self.span) + } + ast::TyPatKind::Err(_) => Err(RewriteError::Unknown), + } + } +} + fn rewrite_bare_fn( bare_fn: &ast::BareFnTy, span: Span, diff --git a/tests/ui/type/pattern_types/assoc_const.default.stderr b/tests/ui/type/pattern_types/assoc_const.default.stderr index c5d9691a0291..8cff0cee7b97 100644 --- a/tests/ui/type/pattern_types/assoc_const.default.stderr +++ b/tests/ui/type/pattern_types/assoc_const.default.stderr @@ -1,79 +1,38 @@ -error[E0658]: wraparound pattern type ranges cause monomorphization time errors - --> $DIR/assoc_const.rs:17:19 +error: generic parameters may not be used in const operations + --> $DIR/assoc_const.rs:17:41 | LL | fn foo(_: pattern_type!(u32 is ::START..=::END)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ cannot perform const operation using `T` | - = note: see issue #136574 for more information - = help: add `#![feature(generic_pattern_types)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = note: type parameters may not be used in const expressions + = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions -error[E0658]: wraparound pattern type ranges cause monomorphization time errors - --> $DIR/assoc_const.rs:17:19 +error: generic parameters may not be used in const operations + --> $DIR/assoc_const.rs:17:61 | LL | fn foo(_: pattern_type!(u32 is ::START..=::END)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ cannot perform const operation using `T` | - = note: see issue #136574 for more information - = help: add `#![feature(generic_pattern_types)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + = note: type parameters may not be used in const expressions + = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions -error: constant expression depends on a generic parameter - --> $DIR/assoc_const.rs:17:19 - | -LL | fn foo(_: pattern_type!(u32 is ::START..=::END)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this may fail depending on what value the parameter takes - -error: constant expression depends on a generic parameter - --> $DIR/assoc_const.rs:17:19 - | -LL | fn foo(_: pattern_type!(u32 is ::START..=::END)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this may fail depending on what value the parameter takes - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0658]: wraparound pattern type ranges cause monomorphization time errors - --> $DIR/assoc_const.rs:22:19 +error: generic parameters may not be used in const operations + --> $DIR/assoc_const.rs:20:40 | LL | fn bar(_: pattern_type!(u32 is T::START..=T::END)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^ cannot perform const operation using `T` | - = note: see issue #136574 for more information - = help: add `#![feature(generic_pattern_types)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = note: type parameters may not be used in const expressions + = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions -error[E0658]: wraparound pattern type ranges cause monomorphization time errors - --> $DIR/assoc_const.rs:22:19 +error: generic parameters may not be used in const operations + --> $DIR/assoc_const.rs:20:51 | LL | fn bar(_: pattern_type!(u32 is T::START..=T::END)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^ cannot perform const operation using `T` | - = note: see issue #136574 for more information - = help: add `#![feature(generic_pattern_types)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + = note: type parameters may not be used in const expressions + = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions -error: constant expression depends on a generic parameter - --> $DIR/assoc_const.rs:22:19 - | -LL | fn bar(_: pattern_type!(u32 is T::START..=T::END)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this may fail depending on what value the parameter takes +error: aborting due to 4 previous errors -error: constant expression depends on a generic parameter - --> $DIR/assoc_const.rs:22:19 - | -LL | fn bar(_: pattern_type!(u32 is T::START..=T::END)) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this may fail depending on what value the parameter takes - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error: aborting due to 8 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/type/pattern_types/assoc_const.rs b/tests/ui/type/pattern_types/assoc_const.rs index 87886587d515..90508801990e 100644 --- a/tests/ui/type/pattern_types/assoc_const.rs +++ b/tests/ui/type/pattern_types/assoc_const.rs @@ -15,14 +15,10 @@ trait Foo { } fn foo(_: pattern_type!(u32 is ::START..=::END)) {} -//[default]~^ ERROR: constant expression depends on a generic parameter -//[default]~| ERROR: constant expression depends on a generic parameter -//[default]~| ERROR: wraparound pattern type ranges cause monomorphization time errors -//[default]~| ERROR: wraparound pattern type ranges cause monomorphization time errors +//[default]~^ ERROR: generic parameters may not be used in const operations +//[default]~| ERROR: generic parameters may not be used in const operations fn bar(_: pattern_type!(u32 is T::START..=T::END)) {} -//[default]~^ ERROR: constant expression depends on a generic parameter -//[default]~| ERROR: constant expression depends on a generic parameter -//[default]~| ERROR: wraparound pattern type ranges cause monomorphization time errors -//[default]~| ERROR: wraparound pattern type ranges cause monomorphization time errors +//[default]~^ ERROR: generic parameters may not be used in const operations +//[default]~| ERROR: generic parameters may not be used in const operations fn main() {} diff --git a/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.rs b/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.rs index 0f10bf8ce627..c28fda6f91ae 100644 --- a/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.rs +++ b/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.rs @@ -5,7 +5,7 @@ //@ normalize-stderr: "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: " //@ rustc-env:RUST_BACKTRACE=0 -#![feature(pattern_types, pattern_type_macro)] +#![feature(pattern_types, pattern_type_macro, generic_const_exprs)] #![allow(internal_features)] type Pat = diff --git a/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.stderr b/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.stderr index fbe80a19863d..ffc6068eb17e 100644 --- a/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.stderr +++ b/tests/ui/type/pattern_types/bad_const_generics_args_on_const_param.stderr @@ -1,4 +1,11 @@ -error: internal compiler error: compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs:LL:CC: try_lower_anon_const_lit: received const param which shouldn't be possible +warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/bad_const_generics_args_on_const_param.rs:8:47 + | +LL | #![feature(pattern_types, pattern_type_macro, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #76560 for more information + = error: internal compiler error: compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs:LL:CC: try_lower_anon_const_lit: received const param which shouldn't be possible --> $DIR/bad_const_generics_args_on_const_param.rs:12:36 | LL | std::pat::pattern_type!(u32 is START::<(), i32, 2>..=END::<_, Assoc = ()>); @@ -10,5 +17,5 @@ query stack during panic: #0 [type_of] expanding type alias `Pat` #1 [check_well_formed] checking that `Pat` is well-formed ... and 2 other queries... use `env RUST_BACKTRACE=1` to see the full query stack -error: aborting due to 1 previous error +error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/type/pattern_types/const_block.rs b/tests/ui/type/pattern_types/const_block.rs index 49c87f4fa0d6..ed19b10671af 100644 --- a/tests/ui/type/pattern_types/const_block.rs +++ b/tests/ui/type/pattern_types/const_block.rs @@ -1,10 +1,10 @@ #![feature(pattern_types)] #![feature(pattern_type_macro)] #![feature(inline_const_pat)] +//@ check-pass use std::pat::pattern_type; fn bar(x: pattern_type!(u32 is 0..=const{ 5 + 5 })) {} -//~^ ERROR: cycle fn main() {} diff --git a/tests/ui/type/pattern_types/const_block.stderr b/tests/ui/type/pattern_types/const_block.stderr deleted file mode 100644 index 82b616105afa..000000000000 --- a/tests/ui/type/pattern_types/const_block.stderr +++ /dev/null @@ -1,72 +0,0 @@ -error[E0391]: cycle detected when evaluating type-level constant - --> $DIR/const_block.rs:7:36 - | -LL | fn bar(x: pattern_type!(u32 is 0..=const{ 5 + 5 })) {} - | ^^^^^^^^^^^^^^ - | -note: ...which requires const-evaluating + checking `bar::{constant#2}`... - --> $DIR/const_block.rs:7:36 - | -LL | fn bar(x: pattern_type!(u32 is 0..=const{ 5 + 5 })) {} - | ^^^^^^^^^^^^^^ -note: ...which requires caching mir of `bar::{constant#2}` for CTFE... - --> $DIR/const_block.rs:7:36 - | -LL | fn bar(x: pattern_type!(u32 is 0..=const{ 5 + 5 })) {} - | ^^^^^^^^^^^^^^ -note: ...which requires elaborating drops for `bar::{constant#2}`... - --> $DIR/const_block.rs:7:36 - | -LL | fn bar(x: pattern_type!(u32 is 0..=const{ 5 + 5 })) {} - | ^^^^^^^^^^^^^^ -note: ...which requires borrow-checking `bar::{constant#2}`... - --> $DIR/const_block.rs:7:36 - | -LL | fn bar(x: pattern_type!(u32 is 0..=const{ 5 + 5 })) {} - | ^^^^^^^^^^^^^^ -note: ...which requires borrow-checking `bar::{constant#0}`... - --> $DIR/const_block.rs:7:41 - | -LL | fn bar(x: pattern_type!(u32 is 0..=const{ 5 + 5 })) {} - | ^^^^^^^^^ -note: ...which requires promoting constants in MIR for `bar::{constant#0}`... - --> $DIR/const_block.rs:7:41 - | -LL | fn bar(x: pattern_type!(u32 is 0..=const{ 5 + 5 })) {} - | ^^^^^^^^^ -note: ...which requires const checking `bar::{constant#0}`... - --> $DIR/const_block.rs:7:41 - | -LL | fn bar(x: pattern_type!(u32 is 0..=const{ 5 + 5 })) {} - | ^^^^^^^^^ -note: ...which requires building MIR for `bar::{constant#0}`... - --> $DIR/const_block.rs:7:41 - | -LL | fn bar(x: pattern_type!(u32 is 0..=const{ 5 + 5 })) {} - | ^^^^^^^^^ -note: ...which requires match-checking `bar::{constant#0}`... - --> $DIR/const_block.rs:7:41 - | -LL | fn bar(x: pattern_type!(u32 is 0..=const{ 5 + 5 })) {} - | ^^^^^^^^^ -note: ...which requires type-checking `bar::{constant#0}`... - --> $DIR/const_block.rs:7:41 - | -LL | fn bar(x: pattern_type!(u32 is 0..=const{ 5 + 5 })) {} - | ^^^^^^^^^ -note: ...which requires type-checking `bar`... - --> $DIR/const_block.rs:7:1 - | -LL | fn bar(x: pattern_type!(u32 is 0..=const{ 5 + 5 })) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: ...which again requires evaluating type-level constant, completing the cycle -note: cycle used when checking that `bar` is well-formed - --> $DIR/const_block.rs:7:1 - | -LL | fn bar(x: pattern_type!(u32 is 0..=const{ 5 + 5 })) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/type/pattern_types/feature-gate-pattern_types.rs b/tests/ui/type/pattern_types/feature-gate-pattern_types.rs index b90ba4784023..b4f4bd656f5f 100644 --- a/tests/ui/type/pattern_types/feature-gate-pattern_types.rs +++ b/tests/ui/type/pattern_types/feature-gate-pattern_types.rs @@ -12,3 +12,4 @@ type Positive = pattern_type!(i32 is 0..); //~^ use of unstable library feature `pattern_type_macro` type Always = pattern_type!(Option is Some(_)); //~^ use of unstable library feature `pattern_type_macro` +//~| ERROR pattern not supported in pattern types diff --git a/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr b/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr index 69239d68bdc7..12508bcb54a3 100644 --- a/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr +++ b/tests/ui/type/pattern_types/feature-gate-pattern_types.stderr @@ -48,6 +48,12 @@ LL | type Always = pattern_type!(Option is Some(_)); = help: add `#![feature(pattern_type_macro)]` 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: aborting due to 5 previous errors +error: pattern not supported in pattern types + --> $DIR/feature-gate-pattern_types.rs:13:44 + | +LL | type Always = pattern_type!(Option is Some(_)); + | ^^^^^^^ + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/type/pattern_types/feature-gate-pattern_types2.rs b/tests/ui/type/pattern_types/feature-gate-pattern_types2.rs index 50c355c8de61..c6b4b325fa35 100644 --- a/tests/ui/type/pattern_types/feature-gate-pattern_types2.rs +++ b/tests/ui/type/pattern_types/feature-gate-pattern_types2.rs @@ -1,5 +1,4 @@ //@ compile-flags: -Zno-analysis -//@ check-pass #![feature(pattern_type_macro)] @@ -10,3 +9,4 @@ type Percent = pattern_type!(u32 is 0..=100); type Negative = pattern_type!(i32 is ..=0); type Positive = pattern_type!(i32 is 0..); type Always = pattern_type!(Option is Some(_)); +//~^ ERROR: pattern not supported in pattern types diff --git a/tests/ui/type/pattern_types/feature-gate-pattern_types2.stderr b/tests/ui/type/pattern_types/feature-gate-pattern_types2.stderr new file mode 100644 index 000000000000..81bf9dea0e2f --- /dev/null +++ b/tests/ui/type/pattern_types/feature-gate-pattern_types2.stderr @@ -0,0 +1,8 @@ +error: pattern not supported in pattern types + --> $DIR/feature-gate-pattern_types2.rs:11:44 + | +LL | type Always = pattern_type!(Option is Some(_)); + | ^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/unpretty/expanded-exhaustive.stdout b/tests/ui/unpretty/expanded-exhaustive.stdout index 11066c90edb7..19ae66f7a07a 100644 --- a/tests/ui/unpretty/expanded-exhaustive.stdout +++ b/tests/ui/unpretty/expanded-exhaustive.stdout @@ -678,7 +678,7 @@ mod types { /*! FIXME: todo */ } /// TyKind::Pat - fn ty_pat() { let _: u32 is 1..; } + fn ty_pat() { let _: u32 is const 1..; } } mod visibilities { /// VisibilityKind::Public From f1f996a4d590e3d75eb5c5dab5098b7ae2ebf7eb Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Tue, 28 Jan 2025 11:08:22 +0000 Subject: [PATCH 084/128] Handle pattern types wrapped in `Option` in FFI checks --- compiler/rustc_lint/src/lib.rs | 1 + compiler/rustc_lint/src/types.rs | 31 ++++++++++++++++ tests/ui/lint/clashing-extern-fn.rs | 4 --- tests/ui/lint/clashing-extern-fn.stderr | 48 ++----------------------- 4 files changed, 35 insertions(+), 49 deletions(-) diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index d89e615e14ad..c8de5e877531 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -33,6 +33,7 @@ #![feature(let_chains)] #![feature(rustc_attrs)] #![feature(rustdoc_internals)] +#![feature(try_blocks)] #![warn(unreachable_pub)] // tidy-alphabetical-end diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index 47ceb4b7d282..68b1f435a4cf 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -877,6 +877,37 @@ fn ty_is_known_nonnull<'tcx>( .filter_map(|variant| transparent_newtype_field(tcx, variant)) .any(|field| ty_is_known_nonnull(tcx, typing_env, field.ty(tcx, args), mode)) } + ty::Pat(base, pat) => { + ty_is_known_nonnull(tcx, typing_env, *base, mode) + || Option::unwrap_or_default( + try { + match **pat { + ty::PatternKind::Range { start, end, include_end } => { + match (start, end) { + (Some(start), None) => { + start.try_to_value()?.try_to_bits(tcx, typing_env)? > 0 + } + (Some(start), Some(end)) => { + let start = + start.try_to_value()?.try_to_bits(tcx, typing_env)?; + let end = + end.try_to_value()?.try_to_bits(tcx, typing_env)?; + + if include_end { + // This also works for negative numbers, as we just need + // to ensure we aren't wrapping over zero. + start > 0 && end >= start + } else { + start > 0 && end > start + } + } + _ => false, + } + } + } + }, + ) + } _ => false, } } diff --git a/tests/ui/lint/clashing-extern-fn.rs b/tests/ui/lint/clashing-extern-fn.rs index 1d1c07b66b2f..e4477c962022 100644 --- a/tests/ui/lint/clashing-extern-fn.rs +++ b/tests/ui/lint/clashing-extern-fn.rs @@ -499,13 +499,11 @@ mod pattern_types { extern "C" { fn pt_non_zero_usize() -> pattern_type!(usize is 1..); fn pt_non_zero_usize_opt() -> Option; - //~^ WARN not FFI-safe fn pt_non_zero_usize_opt_full_range() -> Option; //~^ WARN not FFI-safe fn pt_non_null_ptr() -> pattern_type!(usize is 1..); fn pt_non_zero_usize_wrapper() -> NonZeroUsize; fn pt_non_zero_usize_wrapper_opt() -> Option; - //~^ WARN not FFI-safe } } mod b { @@ -515,12 +513,10 @@ mod pattern_types { // cases are warning for, from both a caller-convenience and optimisation perspective. fn pt_non_zero_usize() -> usize; fn pt_non_zero_usize_opt() -> usize; - //~^ WARN `pt_non_zero_usize_opt` redeclared with a different signature fn pt_non_null_ptr() -> *const (); //~^ WARN `pt_non_null_ptr` redeclared with a different signature fn pt_non_zero_usize_wrapper() -> usize; fn pt_non_zero_usize_wrapper_opt() -> usize; - //~^ WARN `pt_non_zero_usize_wrapper_opt` redeclared with a different signature } } } diff --git a/tests/ui/lint/clashing-extern-fn.stderr b/tests/ui/lint/clashing-extern-fn.stderr index a2fc9e774923..118b18b224c0 100644 --- a/tests/ui/lint/clashing-extern-fn.stderr +++ b/tests/ui/lint/clashing-extern-fn.stderr @@ -17,17 +17,8 @@ LL | fn hidden_niche_unsafe_cell() -> Option`, which is not FFI-safe - --> $DIR/clashing-extern-fn.rs:501:43 - | -LL | fn pt_non_zero_usize_opt() -> Option; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - warning: `extern` block uses type `Option<(usize) is 0..=>`, which is not FFI-safe - --> $DIR/clashing-extern-fn.rs:503:54 + --> $DIR/clashing-extern-fn.rs:502:54 | LL | fn pt_non_zero_usize_opt_full_range() -> Option; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe @@ -35,15 +26,6 @@ LL | fn pt_non_zero_usize_opt_full_range() -> Option`, which is not FFI-safe - --> $DIR/clashing-extern-fn.rs:507:51 - | -LL | fn pt_non_zero_usize_wrapper_opt() -> Option; - | ^^^^^^^^^^^^^^^^^^^^ not FFI-safe - | - = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum - = note: enum has no representation hint - warning: `clash` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:13:13 | @@ -285,20 +267,8 @@ LL | fn hidden_niche_unsafe_cell() -> Option usize` found `unsafe extern "C" fn() -> Option>>` -warning: `pt_non_zero_usize_opt` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:517:13 - | -LL | fn pt_non_zero_usize_opt() -> Option; - | ------------------------------------------------------------------ `pt_non_zero_usize_opt` previously declared here -... -LL | fn pt_non_zero_usize_opt() -> usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration - | - = note: expected `unsafe extern "C" fn() -> Option<(usize) is 1..=>` - found `unsafe extern "C" fn() -> usize` - warning: `pt_non_null_ptr` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:519:13 + --> $DIR/clashing-extern-fn.rs:516:13 | LL | fn pt_non_null_ptr() -> pattern_type!(usize is 1..); | ---------------------------------------------------- `pt_non_null_ptr` previously declared here @@ -309,17 +279,5 @@ LL | fn pt_non_null_ptr() -> *const (); = note: expected `unsafe extern "C" fn() -> (usize) is 1..=` found `unsafe extern "C" fn() -> *const ()` -warning: `pt_non_zero_usize_wrapper_opt` redeclared with a different signature - --> $DIR/clashing-extern-fn.rs:522:13 - | -LL | fn pt_non_zero_usize_wrapper_opt() -> Option; - | ----------------------------------------------------------- `pt_non_zero_usize_wrapper_opt` previously declared here -... -LL | fn pt_non_zero_usize_wrapper_opt() -> usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration - | - = note: expected `unsafe extern "C" fn() -> Option` - found `unsafe extern "C" fn() -> usize` - -warning: 28 warnings emitted +warning: 24 warnings emitted From b2cd1b8ead95530e61ad108a3113c588e590187a Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Tue, 14 Jan 2025 12:25:16 +0000 Subject: [PATCH 085/128] Remove an unsafe closure invariant by inlining the closure wrapper into the called function --- compiler/rustc_codegen_llvm/src/back/write.rs | 130 +++++++----------- 1 file changed, 50 insertions(+), 80 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index ae4c4d5876e2..6a7b69963475 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -40,7 +40,7 @@ use crate::errors::{ WithLlvmError, WriteBytecode, }; use crate::llvm::diagnostic::OptimizationDiagnosticKind::*; -use crate::llvm::{self, DiagnosticInfo, PassManager}; +use crate::llvm::{self, DiagnosticInfo}; use crate::type_::Type; use crate::{LlvmCodegenBackend, ModuleLlvm, base, common, llvm_util}; @@ -54,7 +54,7 @@ pub(crate) fn llvm_err<'a>(dcx: DiagCtxtHandle<'_>, err: LlvmError<'a>) -> Fatal fn write_output_file<'ll>( dcx: DiagCtxtHandle<'_>, target: &'ll llvm::TargetMachine, - pm: &llvm::PassManager<'ll>, + no_builtins: bool, m: &'ll llvm::Module, output: &Path, dwo_output: Option<&Path>, @@ -63,16 +63,19 @@ fn write_output_file<'ll>( verify_llvm_ir: bool, ) -> Result<(), FatalError> { debug!("write_output_file output={:?} dwo_output={:?}", output, dwo_output); - unsafe { - let output_c = path_to_c_string(output); - let dwo_output_c; - let dwo_output_ptr = if let Some(dwo_output) = dwo_output { - dwo_output_c = path_to_c_string(dwo_output); - dwo_output_c.as_ptr() - } else { - std::ptr::null() - }; - let result = llvm::LLVMRustWriteOutputFile( + let output_c = path_to_c_string(output); + let dwo_output_c; + let dwo_output_ptr = if let Some(dwo_output) = dwo_output { + dwo_output_c = path_to_c_string(dwo_output); + dwo_output_c.as_ptr() + } else { + std::ptr::null() + }; + let result = unsafe { + let pm = llvm::LLVMCreatePassManager(); + llvm::LLVMAddAnalysisPasses(target, pm); + llvm::LLVMRustAddLibraryInfo(pm, m, no_builtins); + llvm::LLVMRustWriteOutputFile( target, pm, m, @@ -80,22 +83,22 @@ fn write_output_file<'ll>( dwo_output_ptr, file_type, verify_llvm_ir, - ); + ) + }; - // Record artifact sizes for self-profiling - if result == llvm::LLVMRustResult::Success { - let artifact_kind = match file_type { - llvm::FileType::ObjectFile => "object_file", - llvm::FileType::AssemblyFile => "assembly_file", - }; - record_artifact_size(self_profiler_ref, artifact_kind, output); - if let Some(dwo_file) = dwo_output { - record_artifact_size(self_profiler_ref, "dwo_file", dwo_file); - } + // Record artifact sizes for self-profiling + if result == llvm::LLVMRustResult::Success { + let artifact_kind = match file_type { + llvm::FileType::ObjectFile => "object_file", + llvm::FileType::AssemblyFile => "assembly_file", + }; + record_artifact_size(self_profiler_ref, artifact_kind, output); + if let Some(dwo_file) = dwo_output { + record_artifact_size(self_profiler_ref, "dwo_file", dwo_file); } - - result.into_result().map_err(|()| llvm_err(dcx, LlvmError::WriteOutput { path: output })) } + + result.into_result().map_err(|()| llvm_err(dcx, LlvmError::WriteOutput { path: output })) } pub(crate) fn create_informational_target_machine( @@ -755,31 +758,6 @@ pub(crate) unsafe fn codegen( create_msvc_imps(cgcx, llcx, llmod); } - // A codegen-specific pass manager is used to generate object - // files for an LLVM module. - // - // Apparently each of these pass managers is a one-shot kind of - // thing, so we create a new one for each type of output. The - // pass manager passed to the closure should be ensured to not - // escape the closure itself, and the manager should only be - // used once. - unsafe fn with_codegen<'ll, F, R>( - tm: &'ll llvm::TargetMachine, - llmod: &'ll llvm::Module, - no_builtins: bool, - f: F, - ) -> R - where - F: FnOnce(&'ll mut PassManager<'ll>) -> R, - { - unsafe { - let cpm = llvm::LLVMCreatePassManager(); - llvm::LLVMAddAnalysisPasses(tm, cpm); - llvm::LLVMRustAddLibraryInfo(cpm, llmod, no_builtins); - f(cpm) - } - } - // Note that if object files are just LLVM bitcode we write bitcode, // copy it to the .o file, and delete the bitcode if it wasn't // otherwise requested. @@ -898,21 +876,17 @@ pub(crate) unsafe fn codegen( } else { llmod }; - unsafe { - with_codegen(tm, llmod, config.no_builtins, |cpm| { - write_output_file( - dcx, - tm, - cpm, - llmod, - &path, - None, - llvm::FileType::AssemblyFile, - &cgcx.prof, - config.verify_llvm_ir, - ) - })?; - } + write_output_file( + dcx, + tm, + config.no_builtins, + llmod, + &path, + None, + llvm::FileType::AssemblyFile, + &cgcx.prof, + config.verify_llvm_ir, + )?; } match config.emit_obj { @@ -936,21 +910,17 @@ pub(crate) unsafe fn codegen( (_, SplitDwarfKind::Split) => Some(dwo_out.as_path()), }; - unsafe { - with_codegen(tm, llmod, config.no_builtins, |cpm| { - write_output_file( - dcx, - tm, - cpm, - llmod, - &obj_out, - dwo_out, - llvm::FileType::ObjectFile, - &cgcx.prof, - config.verify_llvm_ir, - ) - })?; - } + write_output_file( + dcx, + tm, + config.no_builtins, + llmod, + &obj_out, + dwo_out, + llvm::FileType::ObjectFile, + &cgcx.prof, + config.verify_llvm_ir, + )?; } EmitObj::Bitcode => { From 4b83038d637c1664df94895c82cb8b26716bad1d Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Tue, 14 Jan 2025 12:25:16 +0000 Subject: [PATCH 086/128] Add a safe wrapper for `WriteBitcodeToFile` --- compiler/rustc_codegen_llvm/src/back/write.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index 6a7b69963475..39aa3a033dcc 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -328,13 +328,17 @@ pub(crate) fn save_temp_bitcode( if !cgcx.save_temps { return; } + let ext = format!("{name}.bc"); + let cgu = Some(&module.name[..]); + let path = cgcx.output_filenames.temp_path_ext(&ext, cgu); + write_bitcode_to_file(module, &path) +} + +fn write_bitcode_to_file(module: &ModuleCodegen, path: &Path) { unsafe { - let ext = format!("{name}.bc"); - let cgu = Some(&module.name[..]); - let path = cgcx.output_filenames.temp_path_ext(&ext, cgu); - let cstr = path_to_c_string(&path); + let path = path_to_c_string(&path); let llmod = module.module_llvm.llmod(); - llvm::LLVMWriteBitcodeToFile(llmod, cstr.as_ptr()); + llvm::LLVMWriteBitcodeToFile(llmod, path.as_ptr()); } } @@ -679,7 +683,6 @@ pub(crate) unsafe fn optimize( ) -> Result<(), FatalError> { let _timer = cgcx.prof.generic_activity_with_arg("LLVM_module_optimize", &*module.name); - let llmod = module.module_llvm.llmod(); let llcx = &*module.module_llvm.llcx; let _handlers = DiagnosticHandlers::new(cgcx, dcx, llcx, module, CodegenDiagnosticsStage::Opt); @@ -688,8 +691,7 @@ pub(crate) unsafe fn optimize( if config.emit_no_opt_bc { let out = cgcx.output_filenames.temp_path_ext("no-opt.bc", module_name); - let out = path_to_c_string(&out); - unsafe { llvm::LLVMWriteBitcodeToFile(llmod, out.as_ptr()) }; + write_bitcode_to_file(module, &out) } // FIXME(ZuseZ4): support SanitizeHWAddress and prevent illegal/unsupported opts From dcf1e4d72b4dbda592050dcde7d7972414b05d3c Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Tue, 14 Jan 2025 12:25:16 +0000 Subject: [PATCH 087/128] Document some safety constraints and use more safe wrappers --- compiler/rustc_codegen_llvm/src/allocator.rs | 4 +- .../rustc_codegen_llvm/src/back/archive.rs | 11 ++-- compiler/rustc_codegen_llvm/src/back/write.rs | 64 ++++++++----------- compiler/rustc_codegen_llvm/src/common.rs | 2 +- compiler/rustc_codegen_llvm/src/consts.rs | 6 +- compiler/rustc_codegen_llvm/src/context.rs | 10 ++- .../rustc_codegen_llvm/src/debuginfo/gdb.rs | 2 +- compiler/rustc_codegen_llvm/src/declare.rs | 2 +- compiler/rustc_codegen_llvm/src/intrinsic.rs | 2 +- compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 2 +- compiler/rustc_codegen_llvm/src/llvm/mod.rs | 4 ++ 11 files changed, 50 insertions(+), 59 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/allocator.rs b/compiler/rustc_codegen_llvm/src/allocator.rs index 149ded28356b..66723cbf8820 100644 --- a/compiler/rustc_codegen_llvm/src/allocator.rs +++ b/compiler/rustc_codegen_llvm/src/allocator.rs @@ -81,13 +81,13 @@ pub(crate) unsafe fn codegen( llvm::set_visibility(ll_g, llvm::Visibility::from_generic(tcx.sess.default_visibility())); let val = tcx.sess.opts.unstable_opts.oom.should_panic(); let llval = llvm::LLVMConstInt(i8, val as u64, False); - llvm::LLVMSetInitializer(ll_g, llval); + llvm::set_initializer(ll_g, llval); let name = NO_ALLOC_SHIM_IS_UNSTABLE; let ll_g = llvm::LLVMRustGetOrInsertGlobal(llmod, name.as_c_char_ptr(), name.len(), i8); llvm::set_visibility(ll_g, llvm::Visibility::from_generic(tcx.sess.default_visibility())); let llval = llvm::LLVMConstInt(i8, 0, False); - llvm::LLVMSetInitializer(ll_g, llval); + llvm::set_initializer(ll_g, llval); } if tcx.sess.opts.debuginfo != DebugInfo::None { diff --git a/compiler/rustc_codegen_llvm/src/back/archive.rs b/compiler/rustc_codegen_llvm/src/back/archive.rs index 33a956e552fb..93553f3f3648 100644 --- a/compiler/rustc_codegen_llvm/src/back/archive.rs +++ b/compiler/rustc_codegen_llvm/src/back/archive.rs @@ -11,7 +11,7 @@ use rustc_codegen_ssa::back::archive::{ use rustc_session::Session; use crate::llvm::archive_ro::{ArchiveRO, Child}; -use crate::llvm::{self, ArchiveKind}; +use crate::llvm::{self, ArchiveKind, last_error}; /// Helper for adding many files to an archive. #[must_use = "must call build() to finish building the archive"] @@ -169,6 +169,8 @@ impl<'a> LlvmArchiveBuilder<'a> { .unwrap_or_else(|kind| self.sess.dcx().emit_fatal(UnknownArchiveKind { kind })); let mut additions = mem::take(&mut self.additions); + // Values in the `members` list below will contain pointers to the strings allocated here. + // So they need to get dropped after all elements of `members` get freed. let mut strings = Vec::new(); let mut members = Vec::new(); @@ -229,12 +231,7 @@ impl<'a> LlvmArchiveBuilder<'a> { self.sess.target.arch == "arm64ec", ); let ret = if r.into_result().is_err() { - let err = llvm::LLVMRustGetLastError(); - let msg = if err.is_null() { - "failed to write archive".into() - } else { - String::from_utf8_lossy(CStr::from_ptr(err).to_bytes()) - }; + let msg = last_error().unwrap_or_else(|| "failed to write archive".into()); Err(io::Error::new(io::ErrorKind::Other, msg)) } else { Ok(!members.is_empty()) diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index 39aa3a033dcc..58933a77e53d 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -1049,24 +1049,18 @@ unsafe fn embed_bitcode( { // We don't need custom section flags, create LLVM globals. let llconst = common::bytes_in_context(llcx, bitcode); - let llglobal = llvm::LLVMAddGlobal( - llmod, - common::val_ty(llconst), - c"rustc.embedded.module".as_ptr(), - ); - llvm::LLVMSetInitializer(llglobal, llconst); + let llglobal = + llvm::add_global(llmod, common::val_ty(llconst), c"rustc.embedded.module"); + llvm::set_initializer(llglobal, llconst); llvm::set_section(llglobal, bitcode_section_name(cgcx)); llvm::set_linkage(llglobal, llvm::Linkage::PrivateLinkage); llvm::LLVMSetGlobalConstant(llglobal, llvm::True); let llconst = common::bytes_in_context(llcx, cmdline.as_bytes()); - let llglobal = llvm::LLVMAddGlobal( - llmod, - common::val_ty(llconst), - c"rustc.embedded.cmdline".as_ptr(), - ); - llvm::LLVMSetInitializer(llglobal, llconst); + let llglobal = + llvm::add_global(llmod, common::val_ty(llconst), c"rustc.embedded.cmdline"); + llvm::set_initializer(llglobal, llconst); let section = if cgcx.target_is_like_osx { c"__LLVM,__cmdline" } else if cgcx.target_is_like_aix { @@ -1106,31 +1100,29 @@ fn create_msvc_imps( // underscores added in front). let prefix = if cgcx.target_arch == "x86" { "\x01__imp__" } else { "\x01__imp_" }; - unsafe { - let ptr_ty = Type::ptr_llcx(llcx); - let globals = base::iter_globals(llmod) - .filter(|&val| { - llvm::get_linkage(val) == llvm::Linkage::ExternalLinkage - && llvm::LLVMIsDeclaration(val) == 0 - }) - .filter_map(|val| { - // Exclude some symbols that we know are not Rust symbols. - let name = llvm::get_value_name(val); - if ignored(name) { None } else { Some((val, name)) } - }) - .map(move |(val, name)| { - let mut imp_name = prefix.as_bytes().to_vec(); - imp_name.extend(name); - let imp_name = CString::new(imp_name).unwrap(); - (imp_name, val) - }) - .collect::>(); + let ptr_ty = Type::ptr_llcx(llcx); + let globals = base::iter_globals(llmod) + .filter(|&val| { + llvm::get_linkage(val) == llvm::Linkage::ExternalLinkage && !llvm::is_declaration(val) + }) + .filter_map(|val| { + // Exclude some symbols that we know are not Rust symbols. + let name = llvm::get_value_name(val); + if ignored(name) { None } else { Some((val, name)) } + }) + .map(move |(val, name)| { + let mut imp_name = prefix.as_bytes().to_vec(); + imp_name.extend(name); + let imp_name = CString::new(imp_name).unwrap(); + (imp_name, val) + }) + .collect::>(); - for (imp_name, val) in globals { - let imp = llvm::LLVMAddGlobal(llmod, ptr_ty, imp_name.as_ptr()); - llvm::LLVMSetInitializer(imp, val); - llvm::set_linkage(imp, llvm::Linkage::ExternalLinkage); - } + for (imp_name, val) in globals { + let imp = llvm::add_global(llmod, ptr_ty, &imp_name); + + llvm::set_initializer(imp, val); + llvm::set_linkage(imp, llvm::Linkage::ExternalLinkage); } // Use this function to exclude certain symbols from `__imp` generation. diff --git a/compiler/rustc_codegen_llvm/src/common.rs b/compiler/rustc_codegen_llvm/src/common.rs index 8c94a46ebf30..78b3a7f85417 100644 --- a/compiler/rustc_codegen_llvm/src/common.rs +++ b/compiler/rustc_codegen_llvm/src/common.rs @@ -219,8 +219,8 @@ impl<'ll, 'tcx> ConstCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> { let g = self.define_global(&sym, self.val_ty(sc)).unwrap_or_else(|| { bug!("symbol `{}` is already defined", sym); }); + llvm::set_initializer(g, sc); unsafe { - llvm::LLVMSetInitializer(g, sc); llvm::LLVMSetGlobalConstant(g, True); llvm::LLVMSetUnnamedAddress(g, llvm::UnnamedAddr::Global); } diff --git a/compiler/rustc_codegen_llvm/src/consts.rs b/compiler/rustc_codegen_llvm/src/consts.rs index c6855dd42e53..4a5491ec7a18 100644 --- a/compiler/rustc_codegen_llvm/src/consts.rs +++ b/compiler/rustc_codegen_llvm/src/consts.rs @@ -191,7 +191,7 @@ fn check_and_apply_linkage<'ll, 'tcx>( }) }); llvm::set_linkage(g2, llvm::Linkage::InternalLinkage); - unsafe { llvm::LLVMSetInitializer(g2, g1) }; + llvm::set_initializer(g2, g1); g2 } else if cx.tcx.sess.target.arch == "x86" && common::is_mingw_gnu_toolchain(&cx.tcx.sess.target) @@ -235,7 +235,7 @@ impl<'ll> CodegenCx<'ll, '_> { } _ => self.define_private_global(self.val_ty(cv)), }; - unsafe { llvm::LLVMSetInitializer(gv, cv) }; + llvm::set_initializer(gv, cv); set_global_alignment(self, gv, align); llvm::SetUnnamedAddress(gv, llvm::UnnamedAddr::Global); gv @@ -458,7 +458,7 @@ impl<'ll> CodegenCx<'ll, '_> { new_g }; set_global_alignment(self, g, alloc.align); - llvm::LLVMSetInitializer(g, v); + llvm::set_initializer(g, v); if self.should_assume_dso_local(g, true) { llvm::LLVMRustSetDSOLocal(g, true); diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index ba4fd75fb941..7fe527a4c07d 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -616,12 +616,10 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { pub(crate) fn create_used_variable_impl(&self, name: &'static CStr, values: &[&'ll Value]) { let array = self.const_array(self.type_ptr(), values); - unsafe { - let g = llvm::LLVMAddGlobal(self.llmod, self.val_ty(array), name.as_ptr()); - llvm::LLVMSetInitializer(g, array); - llvm::set_linkage(g, llvm::Linkage::AppendingLinkage); - llvm::set_section(g, c"llvm.metadata"); - } + let g = llvm::add_global(self.llmod, self.val_ty(array), name); + llvm::set_initializer(g, array); + llvm::set_linkage(g, llvm::Linkage::AppendingLinkage); + llvm::set_section(g, c"llvm.metadata"); } } impl<'ll> SimpleCx<'ll> { diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs b/compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs index 2c9f1cda13a8..54c5d445f66b 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs @@ -73,7 +73,7 @@ pub(crate) fn get_or_insert_gdb_debug_scripts_section_global<'ll>( .define_global(section_var_name, llvm_type) .unwrap_or_else(|| bug!("symbol `{}` is already defined", section_var_name)); llvm::set_section(section_var, c".debug_gdb_scripts"); - llvm::LLVMSetInitializer(section_var, cx.const_bytes(section_contents)); + llvm::set_initializer(section_var, cx.const_bytes(section_contents)); llvm::LLVMSetGlobalConstant(section_var, llvm::True); llvm::LLVMSetUnnamedAddress(section_var, llvm::UnnamedAddr::Global); llvm::set_linkage(section_var, llvm::Linkage::LinkOnceODRLinkage); diff --git a/compiler/rustc_codegen_llvm/src/declare.rs b/compiler/rustc_codegen_llvm/src/declare.rs index bdc83267cca9..cebceef1b93f 100644 --- a/compiler/rustc_codegen_llvm/src/declare.rs +++ b/compiler/rustc_codegen_llvm/src/declare.rs @@ -235,7 +235,7 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { /// name. pub(crate) fn get_defined_value(&self, name: &str) -> Option<&'ll Value> { self.get_declared_value(name).and_then(|val| { - let declaration = unsafe { llvm::LLVMIsDeclaration(val) != 0 }; + let declaration = llvm::is_declaration(val); if !declaration { Some(val) } else { None } }) } diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 3200c94d9770..8b9768859045 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -824,7 +824,7 @@ fn codegen_msvc_try<'ll>( if bx.cx.tcx.sess.target.supports_comdat() { llvm::SetUniqueComdat(bx.llmod, tydesc); } - unsafe { llvm::LLVMSetInitializer(tydesc, type_info) }; + llvm::set_initializer(tydesc, type_info); // The flag value of 8 indicates that we are catching the exception by // reference instead of by value. We can't use catch by value because diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 4d6a76b23ea1..441d144ce50d 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -2359,7 +2359,7 @@ unsafe extern "C" { ); pub fn LLVMRustWriteOutputFile<'a>( T: &'a TargetMachine, - PM: &PassManager<'a>, + PM: *mut PassManager<'a>, M: &'a Module, Output: *const c_char, DwoOutput: *const c_char, diff --git a/compiler/rustc_codegen_llvm/src/llvm/mod.rs b/compiler/rustc_codegen_llvm/src/llvm/mod.rs index 707aeba22ccf..7becba4ccd4c 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/mod.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/mod.rs @@ -241,6 +241,10 @@ pub fn set_linkage(llglobal: &Value, linkage: Linkage) { } } +pub fn is_declaration(llglobal: &Value) -> bool { + unsafe { LLVMIsDeclaration(llglobal) == ffi::True } +} + pub fn get_visibility(llglobal: &Value) -> Visibility { unsafe { LLVMGetVisibility(llglobal) }.to_rust() } From 673fd23dff47bf72953d1408b1cfbd45f6ef859b Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 7 Feb 2025 17:50:14 +0100 Subject: [PATCH 088/128] Update rustdoc tests --- src/librustdoc/html/highlight/tests.rs | 10 +-- tests/rustdoc-gui/basic-code.goml | 6 -- .../docblock-code-block-line-number.goml | 66 +++++-------------- tests/rustdoc-gui/jump-to-def-background.goml | 2 +- .../scrape-examples-button-focus.goml | 40 +---------- tests/rustdoc-gui/scrape-examples-layout.goml | 47 +++++-------- tests/rustdoc-gui/source-anchor-scroll.goml | 6 +- .../source-code-page-code-scroll.goml | 4 +- tests/rustdoc-gui/source-code-page.goml | 38 +++++------ .../rustdoc/check-source-code-urls-to-def.rs | 9 +-- 10 files changed, 72 insertions(+), 156 deletions(-) delete mode 100644 tests/rustdoc-gui/basic-code.goml diff --git a/src/librustdoc/html/highlight/tests.rs b/src/librustdoc/html/highlight/tests.rs index fccbb98f80ff..8f39130bb836 100644 --- a/src/librustdoc/html/highlight/tests.rs +++ b/src/librustdoc/html/highlight/tests.rs @@ -23,7 +23,7 @@ fn test_html_highlighting() { let src = include_str!("fixtures/sample.rs"); let html = { let mut out = Buffer::new(); - write_code(&mut out, src, None, None); + write_code(&mut out, src, None, None, None); format!("{STYLE}

", playground_button.unwrap_or_default())); } /// How a span of text is classified. Mostly corresponds to token kinds. diff --git a/src/librustdoc/html/highlight/tests.rs b/src/librustdoc/html/highlight/tests.rs index 8f39130bb836..2603e887bead 100644 --- a/src/librustdoc/html/highlight/tests.rs +++ b/src/librustdoc/html/highlight/tests.rs @@ -3,7 +3,6 @@ use rustc_data_structures::fx::FxIndexMap; use rustc_span::create_default_session_globals_then; use super::{DecorationInfo, write_code}; -use crate::html::format::Buffer; const STYLE: &str = r#"