diff options
| author | Jeremy Banks <_@jeremy.ca> | 2022-02-07 23:40:17 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-08 00:46:16 +0000 |
| commit | 475e4eeb6557af820ee2b48f213f178eca5e11ce (patch) | |
| tree | 1514a2a1f3a71693170cc0a75bac2356d9e2b30a | |
| parent | f52c31840df7ec9c9350baff51a8964b20b5e1ba (diff) | |
| download | rust-475e4eeb6557af820ee2b48f213f178eca5e11ce.tar.gz rust-475e4eeb6557af820ee2b48f213f178eca5e11ce.zip | |
Remove obsolete no-op #[main] attribute from compiler.
| -rw-r--r-- | compiler/rustc_feature/src/builtin_attrs.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/attributes/main-removed-1.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/attributes/main-removed-1.stderr | 10 | ||||
| -rw-r--r-- | src/test/ui/attributes/main-removed-2/auxiliary/tokyo.rs | 12 | ||||
| -rw-r--r-- | src/test/ui/attributes/main-removed-2/main.rs | 11 |
5 files changed, 35 insertions, 1 deletions
diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index cb2562d09a5..b224c64ece7 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -339,7 +339,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ ), // Entry point: - ungated!(main, Normal, template!(Word), WarnFollowing), ungated!(start, Normal, template!(Word), WarnFollowing), ungated!(no_start, CrateLevel, template!(Word), WarnFollowing), ungated!(no_main, CrateLevel, template!(Word), WarnFollowing), diff --git a/src/test/ui/attributes/main-removed-1.rs b/src/test/ui/attributes/main-removed-1.rs new file mode 100644 index 00000000000..0e887469d44 --- /dev/null +++ b/src/test/ui/attributes/main-removed-1.rs @@ -0,0 +1,2 @@ +#[main] //~ ERROR cannot find attribute `main` in this scope +fn main() {} diff --git a/src/test/ui/attributes/main-removed-1.stderr b/src/test/ui/attributes/main-removed-1.stderr new file mode 100644 index 00000000000..2422c5c3b62 --- /dev/null +++ b/src/test/ui/attributes/main-removed-1.stderr @@ -0,0 +1,10 @@ +error: cannot find attribute `main` in this scope + --> $DIR/main-removed-1.rs:1:3 + | +LL | #[main] + | ^^^^ + | + = note: `main` is in scope, but it is a function, not an attribute + +error: aborting due to previous error + diff --git a/src/test/ui/attributes/main-removed-2/auxiliary/tokyo.rs b/src/test/ui/attributes/main-removed-2/auxiliary/tokyo.rs new file mode 100644 index 00000000000..196b5be2dd0 --- /dev/null +++ b/src/test/ui/attributes/main-removed-2/auxiliary/tokyo.rs @@ -0,0 +1,12 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro_attribute] +pub fn main(_: TokenStream, input: TokenStream) -> TokenStream { + "fn main() { println!(\"Hello Tokyo!\"); }".parse().unwrap() +} diff --git a/src/test/ui/attributes/main-removed-2/main.rs b/src/test/ui/attributes/main-removed-2/main.rs new file mode 100644 index 00000000000..e8fecf825fa --- /dev/null +++ b/src/test/ui/attributes/main-removed-2/main.rs @@ -0,0 +1,11 @@ +// run-pass +// aux-build:tokyo.rs +// compile-flags:--extern tokyo +// edition:2021 + +use tokyo::main; + +#[main] +fn main() { + panic!("the #[main] macro should replace this with non-panicking code") +} |
