Rollup merge of #139760 - petrochenkov:noerrpat2, r=jieyouxu

UI tests: migrate remaining compile time `error-pattern`s to line annotations when possible

There's a number of cases in which `error-pattern` is still necessary even for compile time checking.
- It checks something that compiler writes directly into stderr as text, and not to the structured json output. This includes some stuff reported during compiler panics, and also diagnostics that happen very early, for example when parsing the command line.
- It checks something that exists only in the full rendered diagnostic test, but not in its structured components, for example code fragments or output of `-Ztrack-diagnostics`. (The latter can probably be converted to structured form though.)

This is continuation of https://github.com/rust-lang/rust/pull/139137.
r? `@jieyouxu`
This commit is contained in:
Jacob Pratt 2025-04-13 23:57:41 -04:00 committed by GitHub
commit 883c8dd52e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 546 additions and 518 deletions

View file

@ -3,7 +3,6 @@
//
//@ compile-flags: -Zincremental-ignore-spans
//@ revisions: cpass cfail
//@ error-pattern: cycle detected when computing type of `Bar::N`
#![feature(trait_alias)]
#![crate_type="lib"]
@ -13,5 +12,9 @@ trait Bar<const N: usize> {}
#[cfg(cfail)]
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 }>;

View file

@ -1,8 +1,7 @@
//@ revisions: cfail1 cfail2
//@ should-ice
//@ error-pattern: delayed bug triggered by #[rustc_delayed_bug_from_inside_query]
#![feature(rustc_attrs)]
#[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
//@ error-pattern: error: linking with
//@ revisions:cfail1 cfail2
//@ compile-flags:-Z query-dep-graph
@ -10,3 +9,5 @@
extern crate my_lib;
fn main() {}
//~? ERROR linking with

View file

@ -1,5 +1,4 @@
//@ compile-flags: --passes unknown-pass
//@ error-pattern: the `passes` flag no longer functions
#![doc(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
error: unknown `doc` attribute `no_default_passes`
--> $DIR/deprecated-attrs.rs:4:8
--> $DIR/deprecated-attrs.rs:3:8
|
LL | #![doc(no_default_passes)]
| ^^^^^^^^^^^^^^^^^ no longer functions
@ -15,7 +15,7 @@ LL | #![doc(no_default_passes)]
= note: `#[deny(invalid_doc_attributes)]` on by default
error: unknown `doc` attribute `passes`
--> $DIR/deprecated-attrs.rs:11:8
--> $DIR/deprecated-attrs.rs:10:8
|
LL | #![doc(passes = "collapse-docs unindent-comments")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no longer functions
@ -25,7 +25,7 @@ LL | #![doc(passes = "collapse-docs unindent-comments")]
= note: `doc(passes)` is now a no-op
error: unknown `doc` attribute `plugins`
--> $DIR/deprecated-attrs.rs:17:8
--> $DIR/deprecated-attrs.rs:16:8
|
LL | #![doc(plugins = "xxx")]
| ^^^^^^^^^^^^^^^ no longer functions

View file

@ -1,4 +1,4 @@
//@ compile-flags:--theme {{src-base}}/invalid-theme-name.rs
//@ error-pattern: must have a .css extension
//~? 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.
//@ error-pattern: try adding `extern crate rustc_driver;` at the top level of this crate
//@ compile-flags: --emit link --error-format=human
//@ compile-flags: --emit link
//@ normalize-stderr: ".*crate .* required.*\n\n" -> ""
//@ normalize-stderr: "aborting due to [0-9]+" -> "aborting due to NUMBER"
//@ dont-require-annotations: ERROR
#![feature(rustc_private)]
extern crate rustc_serialize;
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.
//
//@ revisions: x64 i686 arm riscv32 riscv64
//@ error-pattern: the `-Zfixed-x18` flag is not supported
//@ dont-check-compiler-stderr
//
//@ compile-flags: -Zfixed-x18

View file

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

View file

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

View file

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

View file

@ -3,7 +3,6 @@
//@ compile-flags: -Cpanic=abort --print=native-static-libs
//@ build-pass
//@ error-pattern: note: native-static-libs:
//@ 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)
@ -14,3 +13,6 @@
fn panic(_info: &core::panic::PanicInfo) -> ! {
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)
//@ 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\")
//@ compile-flags: --cfg a(b=c)
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}
//@ error-pattern: invalid `--cfg` argument: `a{b}` (expected `key` or `key="value"`)
//@ compile-flags: --cfg a{b}
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)
//@ error-pattern: invalid `--cfg` argument: `a(b)` (expected `key` or `key="value"`)
//@ compile-flags: --cfg a(b)
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{
//@ error-pattern: invalid `--cfg` argument: `a{` (expected `key` or `key="value"`)
//@ compile-flags: --cfg a{
fn main() {}
//~? ERROR invalid `--cfg` argument: `a{` (expected `key` or `key="value"`)

View file

@ -1,3 +1,5 @@
//@ compile-flags: --error-format=human --cfg )
//@ error-pattern: invalid `--cfg` argument: `)` (expected `key` or `key="value"`)
//@ compile-flags: --cfg )
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.
//@ compile-flags: --error-format=human --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\")
//@ compile-flags: --cfg key=value
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)
//@ compile-flags: --error-format=human --cfg ""
//@ error-pattern: invalid `--cfg` argument: `""` (expected `key` or `key="value"`)
//@ compile-flags: --cfg ""
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
//@ error-pattern: calling non-const function `<Vec<i32> as Drop>::drop`
use std::mem::ManuallyDrop;
@ -15,5 +14,7 @@ static TEST_OK: () = {
static TEST_BAD: () = {
let _v: Vec<i32> = Vec::new();
}; //~ 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

View file

@ -1,5 +1,5 @@
error[E0080]: could not evaluate static initializer
--> $DIR/drop.rs:17:1
--> $DIR/drop.rs:16:1
|
LL | };
| ^ 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
|
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();
| ^^

View file

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

View file

@ -3,8 +3,9 @@
//!
//! 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"
//@ dont-require-annotations: NOTE
#![feature(lang_items)]
extern crate core;
@ -14,6 +15,7 @@ use core::panic::PanicInfo;
#[lang = "panic_impl"]
fn panic_impl(info: &PanicInfo) -> ! {
//~^ ERROR: found duplicate lang item `panic_impl`
//~| NOTE first defined in crate `std`
loop {}
}

View file

@ -1,8 +1,9 @@
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 | |
LL | |
LL | | loop {}
LL | | }
| |_^

View file

@ -1,11 +1,11 @@
//@ compile-flags:-D bogus
//@ check-pass
//@ error-pattern:requested on the command line with `-D bogus`
//@ error-pattern:`#[warn(unknown_lints)]` on by default
//@ dont-require-annotations: NOTE
fn main() {}
//~? 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
//@ 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
// `pub use my-awesome-library::*;` (sic!) as we outright ban this crate name.
@ -9,3 +8,4 @@ pub use my_awesome_library::*;
fn main() {}
//~? 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`
//~| 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
// error message.
@ -6,5 +8,4 @@
//@ ignore-arm
//@ needs-llvm-components: arm
//@ error-pattern:target may not be installed
fn main() { }

View file

@ -1,13 +1,13 @@
#![feature(trivial_bounds)]
//@ error-pattern: the type `<() as Project>::Assoc` has an unknown layout
trait Project {
type Assoc;
}
fn foo() where (): Project {
[(); 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() {}

View file

@ -1,5 +1,5 @@
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>()];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the type `<() as Project>::Assoc` has an unknown layout

View file

@ -1,10 +1,11 @@
//@ build-fail
//@ compile-flags: --crate-type rlib
//@ error-pattern: only provide the library name `foo`, not the full filename
#[link(name = "libfoo.a", kind = "static")]
extern { } //~ WARN extern declarations without an explicit ABI are deprecated
//~| HELP explicitly specify the "C" ABI
pub fn main() { }
//~? 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
--> $DIR/suggest-libname-only-1.rs:6:1
--> $DIR/suggest-libname-only-1.rs:5:1
|
LL | extern { }
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`

View file

@ -1,10 +1,11 @@
//@ build-fail
//@ compile-flags: --crate-type rlib
//@ error-pattern: only provide the library name `bar`, not the full filename
#[link(name = "bar.lib", kind = "static")]
extern { } //~ WARN extern declarations without an explicit ABI are deprecated
//~| HELP explicitly specify the "C" ABI
pub fn main() { }
//~? 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
--> $DIR/suggest-libname-only-2.rs:6:1
--> $DIR/suggest-libname-only-2.rs:5:1
|
LL | extern { }
| ^^^^^^ help: explicitly specify the "C" ABI: `extern "C"`

View file

@ -3,12 +3,12 @@
//@ check-pass
//@ compile-flags: --force-warn foo-qux
//@ error-pattern: requested on the command line with `--force-warn foo_qux`
//@ error-pattern: `#[warn(unknown_lints)]` on by default
//@ dont-require-annotations: NOTE
fn main() {}
//~? 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
//@ compile-flags:-D renamed-and-removed-lints -D raw_pointer_derive
//@ 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`
//@ dont-require-annotations: NOTE
#![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
//~? 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`
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 = (); }
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
|
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)]
| ^^^^^^^^

View file

@ -2,9 +2,7 @@
// cc #30346
//@ compile-flags:-D raw_pointer_derive
//@ error-pattern:`#[warn(renamed_and_removed_lints)]` on by default
//@ error-pattern:requested on the command line with `-D raw_pointer_derive`
//@ dont-require-annotations: NOTE
#![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
//~? 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`
error: unused variable: `unused`
--> $DIR/lint-removed-cmdline.rs:12:17
--> $DIR/lint-removed-cmdline.rs:10:17
|
LL | fn main() { let unused = (); }
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
|
note: the lint level is defined here
--> $DIR/lint-removed-cmdline.rs:11:8
--> $DIR/lint-removed-cmdline.rs:9:8
|
LL | #[deny(warnings)]
| ^^^^^^^^

View file

@ -1,8 +1,6 @@
//@ compile-flags:-D renamed-and-removed-lints -D bare_trait_object
//@ error-pattern:use the new name `bare_trait_objects`
//@ 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`
//@ dont-require-annotations: HELP
//@ dont-require-annotations: NOTE
#[deny(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`
//~? 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`
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 = (); }
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
|
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)]
| ^^^^^^

View file

@ -1,7 +1,5 @@
//@ compile-flags:-D bare_trait_object
//@ error-pattern:requested on the command line with `-D bare_trait_object`
//@ error-pattern:`#[warn(renamed_and_removed_lints)]` on by default
//@ dont-require-annotations: NOTE
#[deny(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`
//~? 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`
error: unused variable: `unused`
--> $DIR/lint-renamed-cmdline.rs:7:17
--> $DIR/lint-renamed-cmdline.rs:5:17
|
LL | fn main() { let unused = (); }
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
|
note: the lint level is defined here
--> $DIR/lint-renamed-cmdline.rs:6:8
--> $DIR/lint-renamed-cmdline.rs:4:8
|
LL | #[deny(unused)]
| ^^^^^^

View file

@ -1,9 +1,6 @@
//@ compile-flags:-D unknown-lints -D bogus -D dead_cod
//@ error-pattern:requested on the command line with `-D bogus`
//@ 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`
//@ dont-require-annotations: HELP
//@ dont-require-annotations: NOTE
fn main() { }
@ -13,3 +10,7 @@ fn main() { }
//~? ERROR unknown lint: `dead_cod`
//~? ERROR unknown lint: `bogus`
//~? 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
//@ compile-flags:-D bogus -D dead_cod
//@ error-pattern:requested on the command line with `-D bogus`
//@ 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`
//@ dont-require-annotations: HELP
//@ dont-require-annotations: NOTE
fn main() { }
@ -14,3 +11,7 @@ fn main() { }
//~? WARN unknown lint: `dead_cod`
//~? WARN unknown lint: `bogus`
//~? 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
// 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;
@ -16,5 +16,6 @@ struct LocalStruct;
non_local_macro::non_local_impl!(LocalStruct);
//~^ WARN non-local `impl` definition
//~| NOTE `cargo update -p non_local_macro`
fn main() {}

View file

@ -1,5 +1,4 @@
//@ error-pattern: return
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(); }

View file

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/missing-return.rs:3:11
--> $DIR/missing-return.rs:1:11
|
LL | fn f() -> isize { }
| - ^^^^^ 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 hd1(w: [U]) -> U { return w[0]; }
//~^ 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
--> $DIR/nested-ty-params.rs:3:16
--> $DIR/nested-ty-params.rs:2:16
|
LL | fn hd<U>(v: Vec<U> ) -> U {
| - 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>`
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 {
| - type parameter from outer item

View file

@ -1,5 +1,4 @@
//@ 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.

View file

@ -12,9 +12,8 @@
//
//@ [merge1] compile-flags: -Cremark=all -Cremark=giraffe
//@ [merge2] compile-flags: -Cremark=inline -Cremark=giraffe
//
//@ error-pattern: inline (missed): 'f' not inlined into 'g'
//@ dont-check-compiler-stderr
//@ dont-require-annotations: NOTE
#[no_mangle]
#[inline(never)]
@ -25,3 +24,5 @@ pub fn f() {
pub fn g() {
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
// transmute
//@ error-pattern: cannot transmute between types of different sizes, or dependently-sized types
use std::mem;
#[repr(packed)]

View file

@ -1,5 +1,5 @@
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);
| ^^^^^^^^^^^^^^

View file

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

View file

@ -1,5 +1,5 @@
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);
| ^^^^^^^^^^^^^^

View file

@ -2,7 +2,8 @@
//! `--print=lints` (which is not a valid print request).
//@ 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`
//~? 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
//@ compile-flags: -Z span-debug --error-format human
//@ error-pattern:expected non-macro inner attribute
//@ compile-flags: -Z span-debug
//@ proc-macro: test-macros.rs
//@ edition:2018
@ -63,23 +62,27 @@ fn bar() {
for _ in &[true] {
#![print_attr]
//~^ ERROR expected non-macro inner attribute, found attribute macro `print_attr`
}
let _ = {
#![print_attr]
//~^ ERROR expected non-macro inner attribute, found attribute macro `print_attr`
};
let _ = async {
#![print_attr]
//~^ ERROR expected non-macro inner attribute, found attribute macro `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() {
#![print_target_and_args_consume(tenth)]
}

View file

@ -1,5 +1,5 @@
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]
| ^^^^^^^^^^ not a non-macro inner attribute
@ -11,19 +11,19 @@ LL | #![print_attr]
| ^^^^^^^^^^ not a non-macro inner attribute
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]
| ^^^^^^^^^^ not a non-macro inner attribute
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]
| ^^^^^^^^^^ not a non-macro inner attribute
warning: extern declarations without an explicit ABI are deprecated
--> $DIR/inner-attrs.rs:82:1
--> $DIR/inner-attrs.rs:85:1
|
LL | extern {
| ^^^^^^ 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
// 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 ()>);
@ -14,6 +14,7 @@ fn unify<'a>(x: Option<Invariant<'a>>, f: fn(Invariant<'a>)) {
x.unwrap()
} else {
mk_static() //~ ERROR lifetime may not live long enough
//~| NOTE assignment requires that `'a` must outlive `'static`
};
f(bad);
}

View file

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

View file

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

View file

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

View file

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