Remove obsolete no-op #[main] attribute from compiler.
This commit is contained in:
parent
f52c31840d
commit
475e4eeb65
@ -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),
|
||||
|
2
src/test/ui/attributes/main-removed-1.rs
Normal file
2
src/test/ui/attributes/main-removed-1.rs
Normal file
@ -0,0 +1,2 @@
|
||||
#[main] //~ ERROR cannot find attribute `main` in this scope
|
||||
fn main() {}
|
10
src/test/ui/attributes/main-removed-1.stderr
Normal file
10
src/test/ui/attributes/main-removed-1.stderr
Normal file
@ -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
|
||||
|
12
src/test/ui/attributes/main-removed-2/auxiliary/tokyo.rs
Normal file
12
src/test/ui/attributes/main-removed-2/auxiliary/tokyo.rs
Normal file
@ -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()
|
||||
}
|
11
src/test/ui/attributes/main-removed-2/main.rs
Normal file
11
src/test/ui/attributes/main-removed-2/main.rs
Normal file
@ -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")
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user