about summary refs log tree commit diff
path: root/src/test/ui/feature-gates
diff options
context:
space:
mode:
authorCharles Lew <crlf0710@gmail.com>2021-04-26 01:09:35 +0800
committerCharles Lew <crlf0710@gmail.com>2021-04-29 08:35:08 +0800
commitd261df4a72e60e8baa0f21b67eba8f7b91cc2135 (patch)
tree4547e05f08c17033fdc8da3d03415010f213d82c /src/test/ui/feature-gates
parent727d101561f9b1e81c6282943292d990288ca479 (diff)
downloadrust-d261df4a72e60e8baa0f21b67eba8f7b91cc2135.tar.gz
rust-d261df4a72e60e8baa0f21b67eba8f7b91cc2135.zip
Implement RFC 1260 with feature_name `imported_main`.
Diffstat (limited to 'src/test/ui/feature-gates')
-rw-r--r--src/test/ui/feature-gates/feature-gate-imported_main.rs6
-rw-r--r--src/test/ui/feature-gates/feature-gate-imported_main.stderr12
2 files changed, 18 insertions, 0 deletions
diff --git a/src/test/ui/feature-gates/feature-gate-imported_main.rs b/src/test/ui/feature-gates/feature-gate-imported_main.rs
new file mode 100644
index 00000000000..b351d0d0e9a
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-imported_main.rs
@@ -0,0 +1,6 @@
+pub mod foo {
+    pub fn bar() {
+        println!("Hello world!");
+    }
+}
+use foo::bar as main; //~ ERROR using an imported function as entry point
diff --git a/src/test/ui/feature-gates/feature-gate-imported_main.stderr b/src/test/ui/feature-gates/feature-gate-imported_main.stderr
new file mode 100644
index 00000000000..3b879fdfc6b
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-imported_main.stderr
@@ -0,0 +1,12 @@
+error[E0658]: using an imported function as entry point `main` is experimental
+  --> $DIR/feature-gate-imported_main.rs:6:5
+   |
+LL | use foo::bar as main;
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #28937 <https://github.com/rust-lang/rust/issues/28937> for more information
+   = help: add `#![feature(imported_main)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.