Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,11 +473,6 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
),
FutureWarnFollowing, EncodeCrossCrate::No,
),
// FIXME(Centril): This can be used on stable but shouldn't.
ungated!(
reexport_test_harness_main, CrateLevel, template!(NameValueStr: "name"), ErrorFollowing,
EncodeCrossCrate::No,
),

// Macros:
ungated!(
Expand Down Expand Up @@ -831,6 +826,13 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
EncodeCrossCrate::Yes, custom_test_frameworks,
"custom test frameworks are an unstable feature",
),

gated!(
reexport_test_harness_main, CrateLevel, template!(NameValueStr: "name"), ErrorFollowing,
EncodeCrossCrate::No, custom_test_frameworks,
"custom test frameworks are an unstable feature",
),

// RFC #1268
gated!(
marker, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
should_panic, Normal,
template!(Word, List: r#"expected = "reason""#, NameValueStr: "reason"), FutureWarnFollowing,
),
// FIXME(Centril): This can be used on stable but shouldn't.
ungated!(reexport_test_harness_main, CrateLevel, template!(NameValueStr: "name"), ErrorFollowing),

// Macros:
ungated!(automatically_derived, Normal, template!(Word), WarnFollowing),
Expand Down Expand Up @@ -264,6 +262,13 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
test_runner, CrateLevel, template!(List: "path"), ErrorFollowing, custom_test_frameworks,
"custom test frameworks are an unstable feature",
),

gated!(
reexport_test_harness_main, CrateLevel, template!(NameValueStr: "name"),
ErrorFollowing, custom_test_frameworks,
"custom test frameworks are an unstable feature",
),

// RFC #1268
gated!(
marker, Normal, template!(Word), WarnFollowing, @only_local: true,
Expand Down
1 change: 1 addition & 0 deletions tests/ui/attributes/reexport-test-harness-entry-point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//@ run-pass
//@ compile-flags:--test

#![feature(custom_test_frameworks)]
#![reexport_test_harness_main = "test_main"]

#[cfg(test)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![test_runner(main)] //~ ERROR custom test frameworks are an unstable feature

#![reexport_test_harness_main = "foo"] //~ ERROR custom test frameworks are an unstable feature
#[test_case] //~ ERROR custom test frameworks are an unstable feature
fn f() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ LL | #![test_runner(main)]
= help: add `#![feature(custom_test_frameworks)]` 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 2 previous errors
error[E0658]: custom test frameworks are an unstable feature
--> $DIR/feature-gate-custom_test_frameworks.rs:2:1
|
LL | #![reexport_test_harness_main = "foo"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #50297 <https://github.com/rust-lang/rust/issues/50297> for more information
= help: add `#![feature(custom_test_frameworks)]` 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 3 previous errors

For more information about this error, try `rustc --explain E0658`.
25 changes: 0 additions & 25 deletions tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
//~| HELP can only be applied to
//~| HELP remove the attribute
#![no_implicit_prelude]
#![reexport_test_harness_main = "2900"]
// see gated-link-args.rs
// see issue-43106-gating-of-macro_escape.rs for crate-level; but non crate-level is below at "2700"
// (cannot easily test gating of crate-level #[no_std]; but non crate-level is below at "2600")
Expand Down Expand Up @@ -465,30 +464,6 @@ mod no_implicit_prelude {
//~| HELP remove the attribute
}

#[reexport_test_harness_main = "2900"]
//~^ WARN crate-level attribute should be
mod reexport_test_harness_main {
//~^ NOTE this attribute does not have an `!`, which means it is applied to this module
mod inner { #![reexport_test_harness_main="2900"] }
//~^ WARN the `#![reexport_test_harness_main]` attribute can only be used at the crate root

#[reexport_test_harness_main = "2900"] fn f() { }
//~^ WARN crate-level attribute should be
//~| NOTE this attribute does not have an `!`, which means it is applied to this function

#[reexport_test_harness_main = "2900"] struct S;
//~^ WARN crate-level attribute should be
//~| NOTE this attribute does not have an `!`, which means it is applied to this struct

#[reexport_test_harness_main = "2900"] type T = S;
//~^ WARN crate-level attribute should be
//~| NOTE this attribute does not have an `!`, which means it is applied to this type alias

#[reexport_test_harness_main = "2900"] impl S { }
//~^ WARN crate-level attribute should be
//~| NOTE this attribute does not have an `!`, which means it is applied to this implementation block
}

// Cannot feed "2700" to `#[macro_escape]` without signaling an error.
#[macro_escape]
//~^ WARN `#[macro_escape]` is a deprecated synonym for `#[macro_use]`
Expand Down
Loading
Loading