UI tests: migrate remaining compile time error-patterns to line annotations

when possible.
This commit is contained in:
Vadim Petrochenkov 2025-04-12 22:40:34 +03:00
parent 092a284ba0
commit 93bee0789a
66 changed files with 546 additions and 518 deletions

View file

@ -3,7 +3,6 @@
// //
//@ compile-flags: -Zincremental-ignore-spans //@ compile-flags: -Zincremental-ignore-spans
//@ revisions: cpass cfail //@ revisions: cpass cfail
//@ error-pattern: cycle detected when computing type of `Bar::N`
#![feature(trait_alias)] #![feature(trait_alias)]
#![crate_type="lib"] #![crate_type="lib"]
@ -13,5 +12,9 @@ trait Bar<const N: usize> {}
#[cfg(cfail)] #[cfg(cfail)]
trait Bar<const N: dyn BB> {} trait Bar<const N: dyn BB> {}
//[cfail]~^ ERROR cycle detected when computing type of `Bar::N`
//[cfail]~| ERROR cycle detected when computing type of `Bar::N`
//[cfail]~| ERROR cycle detected when computing type of `Bar::N`
//[cfail]~| ERROR `(dyn Bar<{ 2 + 1 }> + 'static)` is forbidden as the type of a const generic parameter
trait BB = Bar<{ 2 + 1 }>; trait BB = Bar<{ 2 + 1 }>;

View file

@ -1,8 +1,7 @@
//@ revisions: cfail1 cfail2 //@ revisions: cfail1 cfail2
//@ should-ice //@ should-ice
//@ error-pattern: delayed bug triggered by #[rustc_delayed_bug_from_inside_query]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#[rustc_delayed_bug_from_inside_query] #[rustc_delayed_bug_from_inside_query]
fn main() {} fn main() {} //~ ERROR delayed bug triggered by #[rustc_delayed_bug_from_inside_query]

View file

@ -1,5 +1,4 @@
//@ aux-build:my_lib.rs //@ aux-build:my_lib.rs
//@ error-pattern: error: linking with
//@ revisions:cfail1 cfail2 //@ revisions:cfail1 cfail2
//@ compile-flags:-Z query-dep-graph //@ compile-flags:-Z query-dep-graph
@ -10,3 +9,5 @@
extern crate my_lib; extern crate my_lib;
fn main() {} fn main() {}
//~? ERROR linking with

View file

@ -1,5 +1,4 @@
//@ compile-flags: --passes unknown-pass //@ compile-flags: --passes unknown-pass
//@ error-pattern: the `passes` flag no longer functions
#![doc(no_default_passes)] #![doc(no_default_passes)]
//~^ ERROR unknown `doc` attribute `no_default_passes` //~^ ERROR unknown `doc` attribute `no_default_passes`

View file

@ -4,7 +4,7 @@ warning: the `passes` flag no longer functions
= help: you may want to use --document-private-items = help: you may want to use --document-private-items
error: unknown `doc` attribute `no_default_passes` error: unknown `doc` attribute `no_default_passes`
--> $DIR/deprecated-attrs.rs:4:8 --> $DIR/deprecated-attrs.rs:3:8
| |
LL | #![doc(no_default_passes)] LL | #![doc(no_default_passes)]
| ^^^^^^^^^^^^^^^^^ no longer functions | ^^^^^^^^^^^^^^^^^ no longer functions
@ -15,7 +15,7 @@ LL | #![doc(no_default_passes)]
= note: `#[deny(invalid_doc_attributes)]` on by default = note: `#[deny(invalid_doc_attributes)]` on by default
error: unknown `doc` attribute `passes` error: unknown `doc` attribute `passes`
--> $DIR/deprecated-attrs.rs:11:8 --> $DIR/deprecated-attrs.rs:10:8
| |
LL | #![doc(passes = "collapse-docs unindent-comments")] LL | #![doc(passes = "collapse-docs unindent-comments")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no longer functions | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no longer functions
@ -25,7 +25,7 @@ LL | #![doc(passes = "collapse-docs unindent-comments")]
= note: `doc(passes)` is now a no-op = note: `doc(passes)` is now a no-op
error: unknown `doc` attribute `plugins` error: unknown `doc` attribute `plugins`
--> $DIR/deprecated-attrs.rs:17:8 --> $DIR/deprecated-attrs.rs:16:8
| |
LL | #![doc(plugins = "xxx")] LL | #![doc(plugins = "xxx")]
| ^^^^^^^^^^^^^^^ no longer functions | ^^^^^^^^^^^^^^^ no longer functions

View file

@ -1,4 +1,4 @@
//@ compile-flags:--theme {{src-base}}/invalid-theme-name.rs //@ compile-flags:--theme {{src-base}}/invalid-theme-name.rs
//@ error-pattern: must have a .css extension
//~? ERROR invalid argument: "$DIR/invalid-theme-name.rs" //~? ERROR invalid argument: "$DIR/invalid-theme-name.rs"
//~? HELP must have a .css extension

View file

@ -1,11 +1,15 @@
// Test that we get the following hint when trying to use a compiler crate without rustc_driver. // Test that we get the following hint when trying to use a compiler crate without rustc_driver.
//@ error-pattern: try adding `extern crate rustc_driver;` at the top level of this crate //@ compile-flags: --emit link
//@ compile-flags: --emit link --error-format=human
//@ normalize-stderr: ".*crate .* required.*\n\n" -> "" //@ normalize-stderr: ".*crate .* required.*\n\n" -> ""
//@ normalize-stderr: "aborting due to [0-9]+" -> "aborting due to NUMBER" //@ normalize-stderr: "aborting due to [0-9]+" -> "aborting due to NUMBER"
//@ dont-require-annotations: ERROR
#![feature(rustc_private)] #![feature(rustc_private)]
extern crate rustc_serialize; extern crate rustc_serialize;
fn main() {} fn main() {}
//~? HELP try adding `extern crate rustc_driver;` at the top level of this crate
//~? HELP try adding `extern crate rustc_driver;` at the top level of this crate
//~? HELP try adding `extern crate rustc_driver;` at the top level of this crate

View file

@ -2,7 +2,6 @@
// Behavior on aarch64 is tested by tests/codegen/fixed-x18.rs. // Behavior on aarch64 is tested by tests/codegen/fixed-x18.rs.
// //
//@ revisions: x64 i686 arm riscv32 riscv64 //@ revisions: x64 i686 arm riscv32 riscv64
//@ error-pattern: the `-Zfixed-x18` flag is not supported
//@ dont-check-compiler-stderr //@ dont-check-compiler-stderr
// //
//@ compile-flags: -Zfixed-x18 //@ compile-flags: -Zfixed-x18

View file

@ -1,5 +1,3 @@
//@ error-pattern: aborting due to 1 previous error
fn main() { fn main() {
2 + +2; //~ ERROR leading `+` is not supported 2 + +2; //~ ERROR leading `+` is not supported
} }

View file

@ -1,5 +1,5 @@
error: leading `+` is not supported error: leading `+` is not supported
--> $DIR/issue-36499.rs:4:9 --> $DIR/issue-36499.rs:2:9
| |
LL | 2 + +2; LL | 2 + +2;
| ^ unexpected `+` | ^ unexpected `+`

View file

@ -10,7 +10,7 @@
//@ [none]compile-flags: --check-cfg=cfg(feature,values()) //@ [none]compile-flags: --check-cfg=cfg(feature,values())
//@ [some]compile-flags: --check-cfg=cfg(feature,values("bitcode")) //@ [some]compile-flags: --check-cfg=cfg(feature,values("bitcode"))
//@ [some]compile-flags: --check-cfg=cfg(CONFIG_NVME,values("y")) //@ [some]compile-flags: --check-cfg=cfg(CONFIG_NVME,values("y"))
//@ [none]error-pattern:Cargo.toml //@ dont-require-annotations: HELP
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
//~^ WARNING unexpected `cfg` condition value //~^ WARNING unexpected `cfg` condition value
@ -27,6 +27,7 @@ fn tokio() {}
#[cfg(CONFIG_NVME = "m")] #[cfg(CONFIG_NVME = "m")]
//[none]~^ WARNING unexpected `cfg` condition name //[none]~^ WARNING unexpected `cfg` condition name
//[some]~^^ WARNING unexpected `cfg` condition value //[some]~^^ WARNING unexpected `cfg` condition value
//[none]~| HELP Cargo.toml
fn tokio() {} fn tokio() {}
fn main() {} fn main() {}

View file

@ -3,7 +3,6 @@
//@ compile-flags: -Cpanic=abort --print=native-static-libs //@ compile-flags: -Cpanic=abort --print=native-static-libs
//@ build-pass //@ build-pass
//@ error-pattern: note: native-static-libs:
//@ dont-check-compiler-stderr (libcore links `/defaultlib:msvcrt` or `/defaultlib:libcmt` on MSVC) //@ dont-check-compiler-stderr (libcore links `/defaultlib:msvcrt` or `/defaultlib:libcmt` on MSVC)
//@ ignore-pass (the note is emitted later in the compilation pipeline, needs build) //@ ignore-pass (the note is emitted later in the compilation pipeline, needs build)
@ -14,3 +13,6 @@
fn panic(_info: &core::panic::PanicInfo) -> ! { fn panic(_info: &core::panic::PanicInfo) -> ! {
loop {} loop {}
} }
//~? NOTE native-static-libs:
//~? NOTE Link against the following native artifacts when linking against this static library

View file

@ -1,3 +1,5 @@
//@ compile-flags: --error-format=human --cfg a(b=c) //@ compile-flags: --cfg a(b=c)
//@ error-pattern: invalid `--cfg` argument: `a(b=c)` (expected `key` or `key="value"`, ensure escaping is appropriate for your shell, try 'key="value"' or key=\"value\")
fn main() {} fn main() {}
//~? ERROR invalid `--cfg` argument: `a(b=c)` (expected `key` or `key="value"`, ensure escaping is appropriate for your shell, try 'key="value"' or key=\"value\")

View file

@ -1,3 +1,5 @@
//@ compile-flags: --error-format=human --cfg a{b} //@ compile-flags: --cfg a{b}
//@ error-pattern: invalid `--cfg` argument: `a{b}` (expected `key` or `key="value"`)
fn main() {} fn main() {}
//~? ERROR invalid `--cfg` argument: `a{b}` (expected `key` or `key="value"`)

View file

@ -1,3 +1,5 @@
//@ compile-flags: --error-format=human --cfg a(b) //@ compile-flags: --cfg a(b)
//@ error-pattern: invalid `--cfg` argument: `a(b)` (expected `key` or `key="value"`)
fn main() {} fn main() {}
//~? ERROR invalid `--cfg` argument: `a(b)` (expected `key` or `key="value"`)

View file

@ -1,3 +1,5 @@
//@ compile-flags: --error-format=human --cfg a{ //@ compile-flags: --cfg a{
//@ error-pattern: invalid `--cfg` argument: `a{` (expected `key` or `key="value"`)
fn main() {} fn main() {}
//~? ERROR invalid `--cfg` argument: `a{` (expected `key` or `key="value"`)

View file

@ -1,3 +1,5 @@
//@ compile-flags: --error-format=human --cfg ) //@ compile-flags: --cfg )
//@ error-pattern: invalid `--cfg` argument: `)` (expected `key` or `key="value"`)
fn main() {} fn main() {}
//~? ERROR invalid `--cfg` argument: `)` (expected `key` or `key="value"`)

View file

@ -1,4 +1,6 @@
// Test for missing quotes around value, issue #66450. // Test for missing quotes around value, issue #66450.
//@ compile-flags: --error-format=human --cfg key=value //@ compile-flags: --cfg key=value
//@ error-pattern: invalid `--cfg` argument: `key=value` (expected `key` or `key="value"`, ensure escaping is appropriate for your shell, try 'key="value"' or key=\"value\")
fn main() {} fn main() {}
//~? ERROR invalid `--cfg` argument: `key=value` (expected `key` or `key="value"`, ensure escaping is appropriate for your shell, try 'key="value"' or key=\"value\")

View file

@ -1,8 +1,8 @@
// Tests that empty source_maps don't ICE (#23301) // Tests that empty source_maps don't ICE (#23301)
//@ compile-flags: --error-format=human --cfg "" //@ compile-flags: --cfg ""
//@ error-pattern: invalid `--cfg` argument: `""` (expected `key` or `key="value"`)
pub fn main() { pub fn main() {
} }
//~? ERROR invalid `--cfg` argument: `""` (expected `key` or `key="value"`)

View file

@ -1,5 +1,4 @@
//@ compile-flags: -Zunleash-the-miri-inside-of-you //@ compile-flags: -Zunleash-the-miri-inside-of-you
//@ error-pattern: calling non-const function `<Vec<i32> as Drop>::drop`
use std::mem::ManuallyDrop; use std::mem::ManuallyDrop;
@ -15,5 +14,7 @@ static TEST_OK: () = {
static TEST_BAD: () = { static TEST_BAD: () = {
let _v: Vec<i32> = Vec::new(); let _v: Vec<i32> = Vec::new();
}; //~ ERROR could not evaluate static initializer }; //~ ERROR could not evaluate static initializer
//~| NOTE calling non-const function `<Vec<i32> as Drop>::drop`
//~| NOTE inside `std::ptr::drop_in_place::<Vec<i32>> - shim(Some(Vec<i32>))`
//~? WARN skipping const checks //~? WARN skipping const checks

View file

@ -1,5 +1,5 @@
error[E0080]: could not evaluate static initializer error[E0080]: could not evaluate static initializer
--> $DIR/drop.rs:17:1 --> $DIR/drop.rs:16:1
| |
LL | }; LL | };
| ^ calling non-const function `<Vec<i32> as Drop>::drop` | ^ calling non-const function `<Vec<i32> as Drop>::drop`
@ -10,7 +10,7 @@ note: inside `std::ptr::drop_in_place::<Vec<i32>> - shim(Some(Vec<i32>))`
warning: skipping const checks warning: skipping const checks
| |
help: skipping check that does not even have a feature gate help: skipping check that does not even have a feature gate
--> $DIR/drop.rs:16:9 --> $DIR/drop.rs:15:9
| |
LL | let _v: Vec<i32> = Vec::new(); LL | let _v: Vec<i32> = Vec::new();
| ^^ | ^^

View file

@ -6,7 +6,6 @@
//@[zero] compile-flags: -Zdwarf-version=0 //@[zero] compile-flags: -Zdwarf-version=0
//@[one] compile-flags: -Zdwarf-version=1 //@[one] compile-flags: -Zdwarf-version=1
//@[one] error-pattern: requested DWARF version 1 is not supported
//@[two] compile-flags: -Zdwarf-version=2 //@[two] compile-flags: -Zdwarf-version=2
//@[two] check-pass //@[two] check-pass

View file

@ -3,8 +3,9 @@
//! //!
//! Issue: <https://github.com/rust-lang/rust/issues/31788> //! Issue: <https://github.com/rust-lang/rust/issues/31788>
//@ error-pattern: first defined in crate `std`
//@ normalize-stderr: "loaded from .*libstd-.*.rlib" -> "loaded from SYSROOT/libstd-*.rlib" //@ normalize-stderr: "loaded from .*libstd-.*.rlib" -> "loaded from SYSROOT/libstd-*.rlib"
//@ dont-require-annotations: NOTE
#![feature(lang_items)] #![feature(lang_items)]
extern crate core; extern crate core;
@ -14,6 +15,7 @@ use core::panic::PanicInfo;
#[lang = "panic_impl"] #[lang = "panic_impl"]
fn panic_impl(info: &PanicInfo) -> ! { fn panic_impl(info: &PanicInfo) -> ! {
//~^ ERROR: found duplicate lang item `panic_impl` //~^ ERROR: found duplicate lang item `panic_impl`
//~| NOTE first defined in crate `std`
loop {} loop {}
} }

View file

@ -1,8 +1,9 @@
error[E0152]: found duplicate lang item `panic_impl` error[E0152]: found duplicate lang item `panic_impl`
--> $DIR/E0152-duplicate-lang-items.rs:15:1 --> $DIR/E0152-duplicate-lang-items.rs:16:1
| |
LL | / fn panic_impl(info: &PanicInfo) -> ! { LL | / fn panic_impl(info: &PanicInfo) -> ! {
LL | | LL | |
LL | |
LL | | loop {} LL | | loop {}
LL | | } LL | | }
| |_^ | |_^

View file

@ -1,11 +1,11 @@
//@ compile-flags:-D bogus //@ compile-flags:-D bogus
//@ check-pass //@ check-pass
//@ dont-require-annotations: NOTE
//@ error-pattern:requested on the command line with `-D bogus`
//@ error-pattern:`#[warn(unknown_lints)]` on by default
fn main() {} fn main() {}
//~? WARN unknown lint: `bogus` //~? WARN unknown lint: `bogus`
//~? WARN unknown lint: `bogus` //~? WARN unknown lint: `bogus`
//~? WARN unknown lint: `bogus` //~? WARN unknown lint: `bogus`
//~? NOTE requested on the command line with `-D bogus`
//~? NOTE `#[warn(unknown_lints)]` on by default

View file

@ -1,5 +1,4 @@
//@ compile-flags: --extern=my-awesome-library=libawesome.rlib //@ compile-flags: --extern=my-awesome-library=libawesome.rlib
//@ error-pattern: consider replacing the dashes with underscores: `my_awesome_library`
// In a sense, this is a regression test for issue #113035. We no longer suggest // In a sense, this is a regression test for issue #113035. We no longer suggest
// `pub use my-awesome-library::*;` (sic!) as we outright ban this crate name. // `pub use my-awesome-library::*;` (sic!) as we outright ban this crate name.
@ -9,3 +8,4 @@ pub use my_awesome_library::*;
fn main() {} fn main() {}
//~? ERROR crate name `my-awesome-library` passed to `--extern` is not a valid ASCII identifier //~? ERROR crate name `my-awesome-library` passed to `--extern` is not a valid ASCII identifier
//~? HELP consider replacing the dashes with underscores: `my_awesome_library`

View file

@ -1,4 +1,6 @@
//~ ERROR can't find crate for `std` //~ ERROR can't find crate for `std`
//~| NOTE target may not be installed
//~| NOTE can't find crate
// Tests that compiling for a target which is not installed will result in a helpful // Tests that compiling for a target which is not installed will result in a helpful
// error message. // error message.
@ -6,5 +8,4 @@
//@ ignore-arm //@ ignore-arm
//@ needs-llvm-components: arm //@ needs-llvm-components: arm
//@ error-pattern:target may not be installed
fn main() { } fn main() { }

View file

@ -1,13 +1,13 @@
#![feature(trivial_bounds)] #![feature(trivial_bounds)]
//@ error-pattern: the type `<() as Project>::Assoc` has an unknown layout
trait Project { trait Project {
type Assoc; type Assoc;
} }
fn foo() where (): Project { fn foo() where (): Project {
[(); size_of::<<() as Project>::Assoc>()]; //~ ERROR evaluation of constant value failed [(); size_of::<<() as Project>::Assoc>()]; //~ ERROR evaluation of constant value failed
//~| NOTE the type `<() as Project>::Assoc` has an unknown layout
//~| NOTE inside `std::mem::size_of::<<() as Project>::Assoc>`
} }
fn main() {} fn main() {}

View file

@ -1,5 +1,5 @@
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> $DIR/unknown-when-no-type-parameter.rs:10:10 --> $DIR/unknown-when-no-type-parameter.rs:8:10
| |
LL | [(); size_of::<<() as Project>::Assoc>()]; LL | [(); size_of::<<() as Project>::Assoc>()];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the type `<() as Project>::Assoc` has an unknown layout | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the type `<() as Project>::Assoc` has an unknown layout

View file

@ -1,10 +1,11 @@
//@ build-fail //@ build-fail
//@ compile-flags: --crate-type rlib //@ compile-flags: --crate-type rlib
//@ error-pattern: only provide the library name `foo`, not the full filename
#[link(name = "libfoo.a", kind = "static")] #[link(name = "libfoo.a", kind = "static")]
extern { } //~ WARN extern declarations without an explicit ABI are deprecated extern { } //~ WARN extern declarations without an explicit ABI are deprecated
//~| HELP explicitly specify the "C" ABI
pub fn main() { } pub fn main() { }
//~? ERROR could not find native static library `libfoo.a` //~? ERROR could not find native static library `libfoo.a`
//~? HELP only provide the library name `foo`, not the full filename

View file

@ -1,5 +1,5 @@
warning: extern declarations without an explicit ABI are deprecated warning: extern declarations without an explicit ABI are deprecated
--> $DIR/suggest-libname-only-1.rs:6:1 --> $DIR/suggest-libname-only-1.rs:5:1
| |
LL | extern { } LL | extern { }
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`

View file

@ -1,10 +1,11 @@
//@ build-fail //@ build-fail
//@ compile-flags: --crate-type rlib //@ compile-flags: --crate-type rlib
//@ error-pattern: only provide the library name `bar`, not the full filename
#[link(name = "bar.lib", kind = "static")] #[link(name = "bar.lib", kind = "static")]
extern { } //~ WARN extern declarations without an explicit ABI are deprecated extern { } //~ WARN extern declarations without an explicit ABI are deprecated
//~| HELP explicitly specify the "C" ABI
pub fn main() { } pub fn main() { }
//~? ERROR could not find native static library `bar.lib` //~? ERROR could not find native static library `bar.lib`
//~? HELP only provide the library name `bar`, not the full filename

View file

@ -1,5 +1,5 @@
warning: extern declarations without an explicit ABI are deprecated warning: extern declarations without an explicit ABI are deprecated
--> $DIR/suggest-libname-only-2.rs:6:1 --> $DIR/suggest-libname-only-2.rs:5:1
| |
LL | extern { } LL | extern { }
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`

View file

@ -3,12 +3,12 @@
//@ check-pass //@ check-pass
//@ compile-flags: --force-warn foo-qux //@ compile-flags: --force-warn foo-qux
//@ dont-require-annotations: NOTE
//@ error-pattern: requested on the command line with `--force-warn foo_qux`
//@ error-pattern: `#[warn(unknown_lints)]` on by default
fn main() {} fn main() {}
//~? WARN unknown lint: `foo_qux` //~? WARN unknown lint: `foo_qux`
//~? WARN unknown lint: `foo_qux` //~? WARN unknown lint: `foo_qux`
//~? WARN unknown lint: `foo_qux` //~? WARN unknown lint: `foo_qux`
//~? NOTE requested on the command line with `--force-warn foo_qux`
//~? NOTE `#[warn(unknown_lints)]` on by default

View file

@ -2,9 +2,7 @@
// cc #30346 // cc #30346
//@ compile-flags:-D renamed-and-removed-lints -D raw_pointer_derive //@ compile-flags:-D renamed-and-removed-lints -D raw_pointer_derive
//@ dont-require-annotations: NOTE
//@ error-pattern:requested on the command line with `-D raw_pointer_derive`
//@ error-pattern:requested on the command line with `-D renamed-and-removed-lints`
#![warn(unused)] #![warn(unused)]
@ -14,3 +12,5 @@ fn main() { let unused = (); } //~ ERROR unused variable: `unused`
//~? ERROR lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok //~? ERROR lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
//~? ERROR lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok //~? ERROR lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
//~? ERROR lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok //~? ERROR lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
//~? NOTE requested on the command line with `-D raw_pointer_derive`
//~? NOTE requested on the command line with `-D renamed-and-removed-lints`

View file

@ -14,13 +14,13 @@ error: lint `raw_pointer_derive` has been removed: using derive with raw pointer
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unused variable: `unused` error: unused variable: `unused`
--> $DIR/lint-removed-cmdline-deny.rs:12:17 --> $DIR/lint-removed-cmdline-deny.rs:10:17
| |
LL | fn main() { let unused = (); } LL | fn main() { let unused = (); }
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused` | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/lint-removed-cmdline-deny.rs:11:8 --> $DIR/lint-removed-cmdline-deny.rs:9:8
| |
LL | #[deny(warnings)] LL | #[deny(warnings)]
| ^^^^^^^^ | ^^^^^^^^

View file

@ -2,9 +2,7 @@
// cc #30346 // cc #30346
//@ compile-flags:-D raw_pointer_derive //@ compile-flags:-D raw_pointer_derive
//@ dont-require-annotations: NOTE
//@ error-pattern:`#[warn(renamed_and_removed_lints)]` on by default
//@ error-pattern:requested on the command line with `-D raw_pointer_derive`
#![warn(unused)] #![warn(unused)]
@ -14,3 +12,5 @@ fn main() { let unused = (); } //~ ERROR unused variable: `unused`
//~? WARN lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok //~? WARN lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
//~? WARN lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok //~? WARN lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
//~? WARN lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok //~? WARN lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
//~? NOTE `#[warn(renamed_and_removed_lints)]` on by default
//~? NOTE requested on the command line with `-D raw_pointer_derive`

View file

@ -14,13 +14,13 @@ warning: lint `raw_pointer_derive` has been removed: using derive with raw point
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unused variable: `unused` error: unused variable: `unused`
--> $DIR/lint-removed-cmdline.rs:12:17 --> $DIR/lint-removed-cmdline.rs:10:17
| |
LL | fn main() { let unused = (); } LL | fn main() { let unused = (); }
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused` | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/lint-removed-cmdline.rs:11:8 --> $DIR/lint-removed-cmdline.rs:9:8
| |
LL | #[deny(warnings)] LL | #[deny(warnings)]
| ^^^^^^^^ | ^^^^^^^^

View file

@ -1,8 +1,6 @@
//@ compile-flags:-D renamed-and-removed-lints -D bare_trait_object //@ compile-flags:-D renamed-and-removed-lints -D bare_trait_object
//@ dont-require-annotations: HELP
//@ error-pattern:use the new name `bare_trait_objects` //@ dont-require-annotations: NOTE
//@ error-pattern:requested on the command line with `-D bare_trait_object`
//@ error-pattern:requested on the command line with `-D renamed-and-removed-lints`
#[deny(unused)] #[deny(unused)]
fn main() { let unused = (); } //~ ERROR unused variable: `unused` fn main() { let unused = (); } //~ ERROR unused variable: `unused`
@ -10,3 +8,6 @@ fn main() { let unused = (); } //~ ERROR unused variable: `unused`
//~? ERROR lint `bare_trait_object` has been renamed to `bare_trait_objects` //~? ERROR lint `bare_trait_object` has been renamed to `bare_trait_objects`
//~? ERROR lint `bare_trait_object` has been renamed to `bare_trait_objects` //~? ERROR lint `bare_trait_object` has been renamed to `bare_trait_objects`
//~? ERROR lint `bare_trait_object` has been renamed to `bare_trait_objects` //~? ERROR lint `bare_trait_object` has been renamed to `bare_trait_objects`
//~? HELP use the new name `bare_trait_objects`
//~? NOTE requested on the command line with `-D bare_trait_object`
//~? NOTE requested on the command line with `-D renamed-and-removed-lints`

View file

@ -17,13 +17,13 @@ error: lint `bare_trait_object` has been renamed to `bare_trait_objects`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unused variable: `unused` error: unused variable: `unused`
--> $DIR/lint-renamed-cmdline-deny.rs:8:17 --> $DIR/lint-renamed-cmdline-deny.rs:6:17
| |
LL | fn main() { let unused = (); } LL | fn main() { let unused = (); }
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused` | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/lint-renamed-cmdline-deny.rs:7:8 --> $DIR/lint-renamed-cmdline-deny.rs:5:8
| |
LL | #[deny(unused)] LL | #[deny(unused)]
| ^^^^^^ | ^^^^^^

View file

@ -1,7 +1,5 @@
//@ compile-flags:-D bare_trait_object //@ compile-flags:-D bare_trait_object
//@ dont-require-annotations: NOTE
//@ error-pattern:requested on the command line with `-D bare_trait_object`
//@ error-pattern:`#[warn(renamed_and_removed_lints)]` on by default
#[deny(unused)] #[deny(unused)]
fn main() { let unused = (); } //~ ERROR unused variable: `unused` fn main() { let unused = (); } //~ ERROR unused variable: `unused`
@ -9,3 +7,5 @@ fn main() { let unused = (); } //~ ERROR unused variable: `unused`
//~? WARN lint `bare_trait_object` has been renamed to `bare_trait_objects` //~? WARN lint `bare_trait_object` has been renamed to `bare_trait_objects`
//~? WARN lint `bare_trait_object` has been renamed to `bare_trait_objects` //~? WARN lint `bare_trait_object` has been renamed to `bare_trait_objects`
//~? WARN lint `bare_trait_object` has been renamed to `bare_trait_objects` //~? WARN lint `bare_trait_object` has been renamed to `bare_trait_objects`
//~? NOTE requested on the command line with `-D bare_trait_object`
//~? NOTE `#[warn(renamed_and_removed_lints)]` on by default

View file

@ -17,13 +17,13 @@ warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: unused variable: `unused` error: unused variable: `unused`
--> $DIR/lint-renamed-cmdline.rs:7:17 --> $DIR/lint-renamed-cmdline.rs:5:17
| |
LL | fn main() { let unused = (); } LL | fn main() { let unused = (); }
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused` | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/lint-renamed-cmdline.rs:6:8 --> $DIR/lint-renamed-cmdline.rs:4:8
| |
LL | #[deny(unused)] LL | #[deny(unused)]
| ^^^^^^ | ^^^^^^

View file

@ -1,9 +1,6 @@
//@ compile-flags:-D unknown-lints -D bogus -D dead_cod //@ compile-flags:-D unknown-lints -D bogus -D dead_cod
//@ dont-require-annotations: HELP
//@ error-pattern:requested on the command line with `-D bogus` //@ dont-require-annotations: NOTE
//@ error-pattern:requested on the command line with `-D dead_cod`
//@ error-pattern:requested on the command line with `-D unknown-lints`
//@ error-pattern:did you mean: `dead_code`
fn main() { } fn main() { }
@ -13,3 +10,7 @@ fn main() { }
//~? ERROR unknown lint: `dead_cod` //~? ERROR unknown lint: `dead_cod`
//~? ERROR unknown lint: `bogus` //~? ERROR unknown lint: `bogus`
//~? ERROR unknown lint: `dead_cod` //~? ERROR unknown lint: `dead_cod`
//~? NOTE requested on the command line with `-D bogus`
//~? NOTE requested on the command line with `-D dead_cod`
//~? NOTE requested on the command line with `-D unknown-lints`
//~? HELP did you mean: `dead_code`

View file

@ -1,10 +1,7 @@
//@ check-pass //@ check-pass
//@ compile-flags:-D bogus -D dead_cod //@ compile-flags:-D bogus -D dead_cod
//@ dont-require-annotations: HELP
//@ error-pattern:requested on the command line with `-D bogus` //@ dont-require-annotations: NOTE
//@ error-pattern:`#[warn(unknown_lints)]` on by default
//@ error-pattern:requested on the command line with `-D dead_cod`
//@ error-pattern:did you mean: `dead_code`
fn main() { } fn main() { }
@ -14,3 +11,7 @@ fn main() { }
//~? WARN unknown lint: `dead_cod` //~? WARN unknown lint: `dead_cod`
//~? WARN unknown lint: `bogus` //~? WARN unknown lint: `bogus`
//~? WARN unknown lint: `dead_cod` //~? WARN unknown lint: `dead_cod`
//~? NOTE requested on the command line with `-D bogus`
//~? NOTE `#[warn(unknown_lints)]` on by default
//~? NOTE requested on the command line with `-D dead_cod`
//~? HELP did you mean: `dead_code`

View file

@ -8,7 +8,7 @@
// //
// and since we specifically want to check the presence // and since we specifically want to check the presence
// of the `cargo update` suggestion we assert it here. // of the `cargo update` suggestion we assert it here.
//@ error-pattern: `cargo update -p non_local_macro` //@ dont-require-annotations: NOTE
extern crate non_local_macro; extern crate non_local_macro;
@ -16,5 +16,6 @@ struct LocalStruct;
non_local_macro::non_local_impl!(LocalStruct); non_local_macro::non_local_impl!(LocalStruct);
//~^ WARN non-local `impl` definition //~^ WARN non-local `impl` definition
//~| NOTE `cargo update -p non_local_macro`
fn main() {} fn main() {}

View file

@ -1,5 +1,4 @@
//@ error-pattern: return
fn f() -> isize { } //~ ERROR mismatched types fn f() -> isize { } //~ ERROR mismatched types
//~| NOTE implicitly returns `()` as its body has no tail or `return` expression
//~| NOTE expected `isize`, found `()`
fn main() { f(); } fn main() { f(); }

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/missing-return.rs:3:11 --> $DIR/missing-return.rs:1:11
| |
LL | fn f() -> isize { } LL | fn f() -> isize { }
| - ^^^^^ expected `isize`, found `()` | - ^^^^^ expected `isize`, found `()`

View file

@ -1,4 +1,3 @@
//@ error-pattern:can't use generic parameters from outer item
fn hd<U>(v: Vec<U> ) -> U { fn hd<U>(v: Vec<U> ) -> U {
fn hd1(w: [U]) -> U { return w[0]; } fn hd1(w: [U]) -> U { return w[0]; }
//~^ ERROR can't use generic parameters from outer item //~^ ERROR can't use generic parameters from outer item

View file

@ -1,5 +1,5 @@
error[E0401]: can't use generic parameters from outer item error[E0401]: can't use generic parameters from outer item
--> $DIR/nested-ty-params.rs:3:16 --> $DIR/nested-ty-params.rs:2:16
| |
LL | fn hd<U>(v: Vec<U> ) -> U { LL | fn hd<U>(v: Vec<U> ) -> U {
| - type parameter from outer item | - type parameter from outer item
@ -9,7 +9,7 @@ LL | fn hd1(w: [U]) -> U { return w[0]; }
| help: try introducing a local generic parameter here: `<U>` | help: try introducing a local generic parameter here: `<U>`
error[E0401]: can't use generic parameters from outer item error[E0401]: can't use generic parameters from outer item
--> $DIR/nested-ty-params.rs:3:23 --> $DIR/nested-ty-params.rs:2:23
| |
LL | fn hd<U>(v: Vec<U> ) -> U { LL | fn hd<U>(v: Vec<U> ) -> U {
| - type parameter from outer item | - type parameter from outer item

View file

@ -1,5 +1,4 @@
//@ compile-flags: -Cpanic=abort --emit link //@ compile-flags: -Cpanic=abort --emit link
//@ error-pattern:using `fn main` requires the standard library
// Make sure that we don't emit an error message mentioning internal lang items. // Make sure that we don't emit an error message mentioning internal lang items.

View file

@ -12,9 +12,8 @@
// //
//@ [merge1] compile-flags: -Cremark=all -Cremark=giraffe //@ [merge1] compile-flags: -Cremark=all -Cremark=giraffe
//@ [merge2] compile-flags: -Cremark=inline -Cremark=giraffe //@ [merge2] compile-flags: -Cremark=inline -Cremark=giraffe
//
//@ error-pattern: inline (missed): 'f' not inlined into 'g'
//@ dont-check-compiler-stderr //@ dont-check-compiler-stderr
//@ dont-require-annotations: NOTE
#[no_mangle] #[no_mangle]
#[inline(never)] #[inline(never)]
@ -25,3 +24,5 @@ pub fn f() {
pub fn g() { pub fn g() {
f(); f();
} }
//~? NOTE inline (missed): 'f' not inlined into 'g'

View file

@ -3,8 +3,6 @@
// the error points to the start of the file, not the line with the // the error points to the start of the file, not the line with the
// transmute // transmute
//@ error-pattern: cannot transmute between types of different sizes, or dependently-sized types
use std::mem; use std::mem;
#[repr(packed)] #[repr(packed)]

View file

@ -1,5 +1,5 @@
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> $DIR/packed-struct-generic-transmute.rs:24:38 --> $DIR/packed-struct-generic-transmute.rs:22:38
| |
LL | let oof: Oof<[u8; 5], i32> = mem::transmute(foo); LL | let oof: Oof<[u8; 5], i32> = mem::transmute(foo);
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^

View file

@ -4,7 +4,6 @@
// transmute // transmute
//@ normalize-stderr: "\d+ bits" -> "N bits" //@ normalize-stderr: "\d+ bits" -> "N bits"
//@ error-pattern: cannot transmute between types of different sizes, or dependently-sized types
use std::mem; use std::mem;

View file

@ -1,5 +1,5 @@
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> $DIR/packed-struct-transmute.rs:26:24 --> $DIR/packed-struct-transmute.rs:25:24
| |
LL | let oof: Oof = mem::transmute(foo); LL | let oof: Oof = mem::transmute(foo);
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^

View file

@ -2,7 +2,8 @@
//! `--print=lints` (which is not a valid print request). //! `--print=lints` (which is not a valid print request).
//@ compile-flags: --print lints //@ compile-flags: --print lints
//@ error-pattern: help: use `-Whelp` to print a list of lints
//@ error-pattern: help: for more information, see the rustc book
//~? ERROR unknown print request: `lints` //~? ERROR unknown print request: `lints`
//~? HELP use `-Whelp` to print a list of lints
//~? HELP for more information, see the rustc book
//~? HELP valid print requests are

View file

@ -1,6 +1,5 @@
// gate-test-custom_inner_attributes // gate-test-custom_inner_attributes
//@ compile-flags: -Z span-debug --error-format human //@ compile-flags: -Z span-debug
//@ error-pattern:expected non-macro inner attribute
//@ proc-macro: test-macros.rs //@ proc-macro: test-macros.rs
//@ edition:2018 //@ edition:2018
@ -63,23 +62,27 @@ fn bar() {
for _ in &[true] { for _ in &[true] {
#![print_attr] #![print_attr]
//~^ ERROR expected non-macro inner attribute, found attribute macro `print_attr`
} }
let _ = { let _ = {
#![print_attr] #![print_attr]
//~^ ERROR expected non-macro inner attribute, found attribute macro `print_attr`
}; };
let _ = async { let _ = async {
#![print_attr] #![print_attr]
//~^ ERROR expected non-macro inner attribute, found attribute macro `print_attr`
}; };
{ {
#![print_attr] #![print_attr]
//~^ ERROR expected non-macro inner attribute, found attribute macro `print_attr`
}; };
} }
extern { extern { //~ WARN extern declarations without an explicit ABI are deprecated
fn weird_extern() { fn weird_extern() {
#![print_target_and_args_consume(tenth)] #![print_target_and_args_consume(tenth)]
} }

View file

@ -1,5 +1,5 @@
error: expected non-macro inner attribute, found attribute macro `print_attr` error: expected non-macro inner attribute, found attribute macro `print_attr`
--> $DIR/inner-attrs.rs:65:12 --> $DIR/inner-attrs.rs:64:12
| |
LL | #![print_attr] LL | #![print_attr]
| ^^^^^^^^^^ not a non-macro inner attribute | ^^^^^^^^^^ not a non-macro inner attribute
@ -11,19 +11,19 @@ LL | #![print_attr]
| ^^^^^^^^^^ not a non-macro inner attribute | ^^^^^^^^^^ not a non-macro inner attribute
error: expected non-macro inner attribute, found attribute macro `print_attr` error: expected non-macro inner attribute, found attribute macro `print_attr`
--> $DIR/inner-attrs.rs:73:12 --> $DIR/inner-attrs.rs:74:12
| |
LL | #![print_attr] LL | #![print_attr]
| ^^^^^^^^^^ not a non-macro inner attribute | ^^^^^^^^^^ not a non-macro inner attribute
error: expected non-macro inner attribute, found attribute macro `print_attr` error: expected non-macro inner attribute, found attribute macro `print_attr`
--> $DIR/inner-attrs.rs:77:12 --> $DIR/inner-attrs.rs:79:12
| |
LL | #![print_attr] LL | #![print_attr]
| ^^^^^^^^^^ not a non-macro inner attribute | ^^^^^^^^^^ not a non-macro inner attribute
warning: extern declarations without an explicit ABI are deprecated warning: extern declarations without an explicit ABI are deprecated
--> $DIR/inner-attrs.rs:82:1 --> $DIR/inner-attrs.rs:85:1
| |
LL | extern { LL | extern {
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"` | ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,7 @@
// over time, but this test used to exhibit some pretty bogus messages // over time, but this test used to exhibit some pretty bogus messages
// that were not remotely helpful. // that were not remotely helpful.
//@ error-pattern:requires that `'a` must outlive `'static` //@ dont-require-annotations: NOTE
struct Invariant<'a>(Option<&'a mut &'a mut ()>); struct Invariant<'a>(Option<&'a mut &'a mut ()>);
@ -14,6 +14,7 @@ fn unify<'a>(x: Option<Invariant<'a>>, f: fn(Invariant<'a>)) {
x.unwrap() x.unwrap()
} else { } else {
mk_static() //~ ERROR lifetime may not live long enough mk_static() //~ ERROR lifetime may not live long enough
//~| NOTE assignment requires that `'a` must outlive `'static`
}; };
f(bad); f(bad);
} }

View file

@ -4,7 +4,7 @@
//@ compile-flags: -Ctarget-feature=-forced-atomics //@ compile-flags: -Ctarget-feature=-forced-atomics
// For now this is just a warning. // For now this is just a warning.
//@ build-pass //@ build-pass
//@error-pattern: unsound because it changes the ABI
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]

View file

@ -2,9 +2,7 @@
//@ compile-flags: --crate-type=rlib --target=aarch64-unknown-linux-gnu //@ compile-flags: --crate-type=rlib --target=aarch64-unknown-linux-gnu
//@ needs-llvm-components: aarch64 //@ needs-llvm-components: aarch64
//@[paca] compile-flags: -Ctarget-feature=+paca //@[paca] compile-flags: -Ctarget-feature=+paca
//@[paca] error-pattern: the target features paca, pacg must all be either enabled or disabled together
//@[pacg] compile-flags: -Ctarget-feature=+pacg //@[pacg] compile-flags: -Ctarget-feature=+pacg
//@[paca] error-pattern: the target features paca, pacg must all be either enabled or disabled together
#![feature(no_core, lang_items)] #![feature(no_core, lang_items)]
#![no_core] #![no_core]

View file

@ -1,6 +1,7 @@
//~ ERROR unknown lint: `test_unstable_lint` //~ ERROR unknown lint: `test_unstable_lint`
//~^ NOTE the `test_unstable_lint` lint is unstable
//@ check-fail //@ check-fail
//@ compile-flags: -Dunknown_lints -Atest_unstable_lint //@ compile-flags: -Dunknown_lints -Atest_unstable_lint
//@ error-pattern: the `test_unstable_lint` lint is unstable //@ dont-require-annotations: NOTE
fn main() {} fn main() {}

View file

@ -1,6 +1,7 @@
//~ WARN unknown lint: `test_unstable_lint` //~ WARN unknown lint: `test_unstable_lint`
//~^ NOTE the `test_unstable_lint` lint is unstable
//@ check-pass //@ check-pass
//@ compile-flags: -Wunknown_lints -Atest_unstable_lint //@ compile-flags: -Wunknown_lints -Atest_unstable_lint
//@ error-pattern: the `test_unstable_lint` lint is unstable //@ dont-require-annotations: NOTE
fn main() {} fn main() {}