Add regression test for -Zcrate-attr in rustdoc --test

This commit is contained in:
Urgau 2025-10-03 12:02:35 +02:00
parent e914a1a6e0
commit c1443e2591
5 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,14 @@
// This test verifies that unstable options like `-Zcrate-attr` are respected when `--test` is
// passed.
//
// <https://github.com/rust-lang/rust/issues/143930>
//
// NOTE: If any of these command line arguments or features get stabilized, please replace with
// another unstable one.
//@ check-pass
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ compile-flags: --test -Zcrate-attr=feature(register_tool) -Zcrate-attr=register_tool(rapx)
#[rapx::tag]
fn f() {}

View file

@ -0,0 +1,5 @@
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

View file

@ -0,0 +1,5 @@
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

View file

@ -0,0 +1,13 @@
error[E0658]: `#[used(linker)]` is currently unstable
--> $DIR/unstable-opts-147276.rs:15:1
|
LL | #[used(linker)]
| ^^^^^^^^^^^^^^^
|
= note: see issue #93798 <https://github.com/rust-lang/rust/issues/93798> for more information
= help: add `#![feature(used_with_arg)]` 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 1 previous error
For more information about this error, try `rustc --explain E0658`.

View file

@ -0,0 +1,17 @@
// This test verifies that unstable options like `-Zcrate-attr` are respected when `--test` is
// passed.
//
// <https://github.com/rust-lang/rust/issues/147276>
//
// NOTE: If any of these command line arguments or features get stabilized, please replace with
// another unstable one.
//@ revisions: normal crate_attr
//@ compile-flags: --test
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@[crate_attr] check-pass
//@[crate_attr] compile-flags: -Zcrate-attr=feature(used_with_arg)
#[used(linker)]
//[normal]~^ ERROR `#[used(linker)]` is currently unstable
static REPRO: isize = 1;