From 0eb2b4b78ff56cd2b1a24d615332afa1202fbae8 Mon Sep 17 00:00:00 2001 From: BD103 <59022059+BD103@users.noreply.github.com> Date: Wed, 11 Dec 2024 12:14:12 -0500 Subject: [PATCH] fix: bless ui test output --- .../tests/example_tests/basic_test.fixed | 24 +++++++++++++++++++ .../tests/example_tests/import.stderr | 6 ++--- 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 tools/compile_fail_utils/tests/example_tests/basic_test.fixed diff --git a/tools/compile_fail_utils/tests/example_tests/basic_test.fixed b/tools/compile_fail_utils/tests/example_tests/basic_test.fixed new file mode 100644 index 0000000000000..74fcd17490f92 --- /dev/null +++ b/tools/compile_fail_utils/tests/example_tests/basic_test.fixed @@ -0,0 +1,24 @@ +// Compiler warnings also need to be annotated. We don't +// want to annotate all the unused variables so let's instruct +// the compiler to ignore them. +#![allow(unused_variables)] + +fn bad_moves() { + let x = String::new(); + // Help diagnostics need to be annotated + let y = x.clone(); + //~^ HELP: consider cloning + + // We expect a failure on this line + println!("{x}"); //~ ERROR: borrow + + + let x = String::new(); + // We expect the help message to mention cloning. + //~v HELP: consider cloning + let y = x.clone(); + + // Check error message using a regex + println!("{x}"); + //~^ ERROR: /(move)|(borrow)/ +} diff --git a/tools/compile_fail_utils/tests/example_tests/import.stderr b/tools/compile_fail_utils/tests/example_tests/import.stderr index c0d36fbe75a07..51fa1f6e00e5a 100644 --- a/tools/compile_fail_utils/tests/example_tests/import.stderr +++ b/tools/compile_fail_utils/tests/example_tests/import.stderr @@ -7,12 +7,12 @@ error[E0599]: no function or associated item named `this_function_does_not_exist note: if you're trying to build a new `Config` consider using one of the following associated functions: Config::rustc Config::cargo - --> $RUSTUP_HOME/.cargo/git/checkouts/ui_test-2b82183a391bb05c/680bb08/src/config.rs:63:5 + --> $RUSTUP_HOME/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ui_test-0.23.0/src/config.rs:70:5 | -63 | pub fn rustc(root_dir: impl Into) -> Self { +70 | pub fn rustc(root_dir: impl Into) -> Self { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... -108 | pub fn cargo(root_dir: impl Into) -> Self { +221 | pub fn cargo(root_dir: impl Into) -> Self { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error