about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/attr-main-2.rs11
-rw-r--r--src/test/ui/attr-main.rs8
-rw-r--r--src/test/ui/attr.rs8
-rw-r--r--src/test/ui/error-codes/E0137.rs8
-rw-r--r--src/test/ui/error-codes/E0137.stderr12
-rw-r--r--src/test/ui/feature-gates/feature-gate-main.rs2
-rw-r--r--src/test/ui/feature-gates/feature-gate-main.stderr12
-rw-r--r--src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs22
-rw-r--r--src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr59
-rw-r--r--src/test/ui/intrinsics/intrinsic-alignment.rs10
-rw-r--r--src/test/ui/lint/dead-code/lint-dead-code-2.rs4
-rw-r--r--src/test/ui/main-wrong-location.rs2
-rw-r--r--src/test/ui/main-wrong-location.stderr4
-rw-r--r--src/test/ui/multiple-main-2.rs9
-rw-r--r--src/test/ui/multiple-main-2.stderr14
-rw-r--r--src/test/ui/multiple-main-3.rs11
-rw-r--r--src/test/ui/multiple-main-3.stderr14
-rw-r--r--src/test/ui/test-attrs/test-main-not-dead-attr.rs4
-rw-r--r--src/test/ui/test-attrs/test-runner-hides-buried-main.rs4
19 files changed, 35 insertions, 183 deletions
diff --git a/src/test/ui/attr-main-2.rs b/src/test/ui/attr-main-2.rs
deleted file mode 100644
index 3a51f83ba3b..00000000000
--- a/src/test/ui/attr-main-2.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// run-pass
-
-#![feature(main)]
-
-pub fn main() {
-    panic!()
-}
-
-#[main]
-fn foo() {
-}
diff --git a/src/test/ui/attr-main.rs b/src/test/ui/attr-main.rs
deleted file mode 100644
index 9c4caaa4a42..00000000000
--- a/src/test/ui/attr-main.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-pass
-// pretty-expanded FIXME #23616
-
-#![feature(main)]
-
-#[main]
-fn foo() {
-}
diff --git a/src/test/ui/attr.rs b/src/test/ui/attr.rs
deleted file mode 100644
index 9c4caaa4a42..00000000000
--- a/src/test/ui/attr.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-pass
-// pretty-expanded FIXME #23616
-
-#![feature(main)]
-
-#[main]
-fn foo() {
-}
diff --git a/src/test/ui/error-codes/E0137.rs b/src/test/ui/error-codes/E0137.rs
deleted file mode 100644
index b8299c71bdf..00000000000
--- a/src/test/ui/error-codes/E0137.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-#![feature(main)]
-
-#[main]
-fn foo() {}
-
-#[main]
-fn f() {}
-//~^ ERROR E0137
diff --git a/src/test/ui/error-codes/E0137.stderr b/src/test/ui/error-codes/E0137.stderr
deleted file mode 100644
index f4d5e10369a..00000000000
--- a/src/test/ui/error-codes/E0137.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0137]: multiple functions with a `#[main]` attribute
-  --> $DIR/E0137.rs:7:1
-   |
-LL | fn foo() {}
-   | ----------- first `#[main]` function
-...
-LL | fn f() {}
-   | ^^^^^^^^^ additional `#[main]` function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0137`.
diff --git a/src/test/ui/feature-gates/feature-gate-main.rs b/src/test/ui/feature-gates/feature-gate-main.rs
deleted file mode 100644
index 9c304a1792f..00000000000
--- a/src/test/ui/feature-gates/feature-gate-main.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#[main]
-fn foo() {} //~ ERROR: declaration of a non-standard `#[main]` function may change over time
diff --git a/src/test/ui/feature-gates/feature-gate-main.stderr b/src/test/ui/feature-gates/feature-gate-main.stderr
deleted file mode 100644
index f0ef3b38c62..00000000000
--- a/src/test/ui/feature-gates/feature-gate-main.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0658]: declaration of a non-standard `#[main]` function may change over time, for now a top-level `fn main()` is required
-  --> $DIR/feature-gate-main.rs:2:1
-   |
-LL | fn foo() {}
-   | ^^^^^^^^^^^
-   |
-   = note: see issue #29634 <https://github.com/rust-lang/rust/issues/29634> for more information
-   = help: add `#![feature(main)]` to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs
index 07167fa695e..d1fbd38ce07 100644
--- a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs
+++ b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs
@@ -11,8 +11,8 @@
 
 #![macro_export]
 //~^ ERROR: `macro_export` attribute cannot be used at crate level
-#![main]
-//~^ ERROR: `main` attribute cannot be used at crate level
+#![rustc_main] //~ ERROR: the `#[rustc_main]` attribute is used internally to specify
+//~^ ERROR: `rustc_main` attribute cannot be used at crate level
 #![start]
 //~^ ERROR: `start` attribute cannot be used at crate level
 #![repr()]
@@ -106,24 +106,6 @@ mod export_name {
     //~| NOTE not a function or static
 }
 
-#[main]
-//~^ ERROR: `main` attribute can only be used on functions
-mod main {
-    mod inner { #![main] }
-    //~^ ERROR: `main` attribute can only be used on functions
-
-    // for `fn f()` case, see feature-gate-main.rs
-
-    #[main] struct S;
-    //~^ ERROR: `main` attribute can only be used on functions
-
-    #[main] type T = S;
-    //~^ ERROR: `main` attribute can only be used on functions
-
-    #[main] impl S { }
-    //~^ ERROR: `main` attribute can only be used on functions
-}
-
 #[start]
 //~^ ERROR: `start` attribute can only be used on functions
 mod start {
diff --git a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr
index 33a5021cde4..ae2c428cc75 100644
--- a/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr
+++ b/src/test/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr
@@ -1,3 +1,11 @@
+error[E0658]: the `#[rustc_main]` attribute is used internally to specify test entry point function
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:14:1
+   |
+LL | #![rustc_main]
+   | ^^^^^^^^^^^^^^
+   |
+   = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
+
 error: attribute must be of the form `#[inline]` or `#[inline(always|never)]`
   --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:40:5
    |
@@ -8,62 +16,32 @@ LL |     #[inline = "2100"] fn f() { }
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
 
-error: `main` attribute can only be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:109:1
-   |
-LL | #[main]
-   | ^^^^^^^
-
-error: `main` attribute can only be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:112:17
-   |
-LL |     mod inner { #![main] }
-   |                 ^^^^^^^^
-
-error: `main` attribute can only be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:117:5
-   |
-LL |     #[main] struct S;
-   |     ^^^^^^^
-
-error: `main` attribute can only be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:120:5
-   |
-LL |     #[main] type T = S;
-   |     ^^^^^^^
-
-error: `main` attribute can only be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:123:5
-   |
-LL |     #[main] impl S { }
-   |     ^^^^^^^
-
 error: `start` attribute can only be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:127:1
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:109:1
    |
 LL | #[start]
    | ^^^^^^^^
 
 error: `start` attribute can only be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:130:17
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:112:17
    |
 LL |     mod inner { #![start] }
    |                 ^^^^^^^^^
 
 error: `start` attribute can only be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:135:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:117:5
    |
 LL |     #[start] struct S;
    |     ^^^^^^^^
 
 error: `start` attribute can only be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:138:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:120:5
    |
 LL |     #[start] type T = S;
    |     ^^^^^^^^
 
 error: `start` attribute can only be used on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:141:5
+  --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:123:5
    |
 LL |     #[start] impl S { }
    |     ^^^^^^^^
@@ -137,11 +115,11 @@ error: `macro_export` attribute cannot be used at crate level
 LL | #![macro_export]
    | ^^^^^^^^^^^^^^^^
 
-error: `main` attribute cannot be used at crate level
+error: `rustc_main` attribute cannot be used at crate level
   --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:14:1
    |
-LL | #![main]
-   | ^^^^^^^^
+LL | #![rustc_main]
+   | ^^^^^^^^^^^^^^
 
 error: `start` attribute cannot be used at crate level
   --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:16:1
@@ -245,6 +223,7 @@ error: attribute should be applied to a function or static
 LL |     #[export_name = "2200"] impl S { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^ ---------- not a function or static
 
-error: aborting due to 36 previous errors
+error: aborting due to 32 previous errors
 
-For more information about this error, try `rustc --explain E0518`.
+Some errors have detailed explanations: E0518, E0658.
+For more information about an error, try `rustc --explain E0518`.
diff --git a/src/test/ui/intrinsics/intrinsic-alignment.rs b/src/test/ui/intrinsics/intrinsic-alignment.rs
index 2bf40db5ad2..592409ba89f 100644
--- a/src/test/ui/intrinsics/intrinsic-alignment.rs
+++ b/src/test/ui/intrinsics/intrinsic-alignment.rs
@@ -1,7 +1,7 @@
 // run-pass
 // ignore-wasm32-bare seems not important to test here
 
-#![feature(intrinsics, main)]
+#![feature(intrinsics)]
 
 mod rusti {
     extern "rust-intrinsic" {
@@ -21,7 +21,6 @@ mod rusti {
           target_os = "solaris",
           target_os = "vxworks"))]
 mod m {
-    #[main]
     #[cfg(target_arch = "x86")]
     pub fn main() {
         unsafe {
@@ -30,7 +29,6 @@ mod m {
         }
     }
 
-    #[main]
     #[cfg(not(target_arch = "x86"))]
     pub fn main() {
         unsafe {
@@ -42,7 +40,6 @@ mod m {
 
 #[cfg(target_env = "sgx")]
 mod m {
-    #[main]
     #[cfg(target_arch = "x86_64")]
     pub fn main() {
         unsafe {
@@ -54,7 +51,6 @@ mod m {
 
 #[cfg(target_os = "windows")]
 mod m {
-    #[main]
     pub fn main() {
         unsafe {
             assert_eq!(::rusti::pref_align_of::<u64>(), 8);
@@ -62,3 +58,7 @@ mod m {
         }
     }
 }
+
+fn main() {
+    m::main();
+}
diff --git a/src/test/ui/lint/dead-code/lint-dead-code-2.rs b/src/test/ui/lint/dead-code/lint-dead-code-2.rs
index 88db4f88c3f..2cfe6e539db 100644
--- a/src/test/ui/lint/dead-code/lint-dead-code-2.rs
+++ b/src/test/ui/lint/dead-code/lint-dead-code-2.rs
@@ -1,6 +1,6 @@
 #![allow(unused_variables)]
 #![deny(dead_code)]
-#![feature(main, start)]
+#![feature(rustc_attrs, start)]
 
 struct Foo;
 
@@ -21,7 +21,7 @@ fn live_fn() {}
 
 fn dead_fn() {} //~ ERROR: function is never used
 
-#[main]
+#[rustc_main]
 fn dead_fn2() {} //~ ERROR: function is never used
 
 fn used_fn() {}
diff --git a/src/test/ui/main-wrong-location.rs b/src/test/ui/main-wrong-location.rs
index f75d08813cd..f3acd80a7a4 100644
--- a/src/test/ui/main-wrong-location.rs
+++ b/src/test/ui/main-wrong-location.rs
@@ -1,6 +1,6 @@
 mod m {
 //~^ ERROR `main` function not found
-    // An inferred main entry point (that doesn't use #[main])
+    // An inferred main entry point
     // must appear at the top of the crate
     fn main() { }
 }
diff --git a/src/test/ui/main-wrong-location.stderr b/src/test/ui/main-wrong-location.stderr
index e301c2ff09a..754ff0f80eb 100644
--- a/src/test/ui/main-wrong-location.stderr
+++ b/src/test/ui/main-wrong-location.stderr
@@ -3,7 +3,7 @@ error[E0601]: `main` function not found in crate `main_wrong_location`
    |
 LL | / mod m {
 LL | |
-LL | |     // An inferred main entry point (that doesn't use #[main])
+LL | |     // An inferred main entry point
 LL | |     // must appear at the top of the crate
 LL | |     fn main() { }
 LL | | }
@@ -15,7 +15,7 @@ note: here is a function named `main`
 LL |     fn main() { }
    |     ^^^^^^^^^^^^^
    = note: you have one or more functions named `main` not defined at the crate level
-   = help: either move the `main` function definitions or attach the `#[main]` attribute to one of them
+   = help: consider moving the `main` function definitions
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/multiple-main-2.rs b/src/test/ui/multiple-main-2.rs
deleted file mode 100644
index e4685b1e004..00000000000
--- a/src/test/ui/multiple-main-2.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-#![feature(main)]
-
-#[main]
-fn bar() {
-}
-
-#[main]
-fn foo() { //~ ERROR multiple functions with a `#[main]` attribute
-}
diff --git a/src/test/ui/multiple-main-2.stderr b/src/test/ui/multiple-main-2.stderr
deleted file mode 100644
index 24bc9a8878b..00000000000
--- a/src/test/ui/multiple-main-2.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0137]: multiple functions with a `#[main]` attribute
-  --> $DIR/multiple-main-2.rs:8:1
-   |
-LL | / fn bar() {
-LL | | }
-   | |_- first `#[main]` function
-...
-LL | / fn foo() {
-LL | | }
-   | |_^ additional `#[main]` function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0137`.
diff --git a/src/test/ui/multiple-main-3.rs b/src/test/ui/multiple-main-3.rs
deleted file mode 100644
index d1b5ae9a833..00000000000
--- a/src/test/ui/multiple-main-3.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-#![feature(main)]
-
-#[main]
-fn main1() {
-}
-
-mod foo {
-    #[main]
-    fn main2() { //~ ERROR multiple functions with a `#[main]` attribute
-    }
-}
diff --git a/src/test/ui/multiple-main-3.stderr b/src/test/ui/multiple-main-3.stderr
deleted file mode 100644
index ec171b76a28..00000000000
--- a/src/test/ui/multiple-main-3.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0137]: multiple functions with a `#[main]` attribute
-  --> $DIR/multiple-main-3.rs:9:5
-   |
-LL | / fn main1() {
-LL | | }
-   | |_- first `#[main]` function
-...
-LL | /     fn main2() {
-LL | |     }
-   | |_____^ additional `#[main]` function
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0137`.
diff --git a/src/test/ui/test-attrs/test-main-not-dead-attr.rs b/src/test/ui/test-attrs/test-main-not-dead-attr.rs
index 628b1896ace..0b2a9a3541b 100644
--- a/src/test/ui/test-attrs/test-main-not-dead-attr.rs
+++ b/src/test/ui/test-attrs/test-main-not-dead-attr.rs
@@ -1,9 +1,9 @@
 // run-pass
 // compile-flags: --test
 
-#![feature(main)]
+#![feature(rustc_attrs)]
 
 #![deny(dead_code)]
 
-#[main]
+#[rustc_main]
 fn foo() { panic!(); }
diff --git a/src/test/ui/test-attrs/test-runner-hides-buried-main.rs b/src/test/ui/test-attrs/test-runner-hides-buried-main.rs
index bf5482056d4..346aa868eb4 100644
--- a/src/test/ui/test-attrs/test-runner-hides-buried-main.rs
+++ b/src/test/ui/test-attrs/test-runner-hides-buried-main.rs
@@ -1,14 +1,14 @@
 // run-pass
 // compile-flags: --test
 
-#![feature(main)]
+#![feature(rustc_attrs)]
 
 #![allow(dead_code)]
 
 mod a {
     fn b() {
         (|| {
-            #[main]
+            #[rustc_main]
             fn c() { panic!(); }
         })();
     }