about summary refs log tree commit diff
path: root/tests/ui/lang-items
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2023-10-02 12:32:31 +0000
committerNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2024-01-10 21:18:54 +0100
commitda26317a8a69fed3f7b96457c643121e75954933 (patch)
tree22c13161c8a62b9557bdd713d0e4911b7522d612 /tests/ui/lang-items
parenta2d9d73e608f1b24eba840c4fd2d68dbe3b65e01 (diff)
downloadrust-da26317a8a69fed3f7b96457c643121e75954933.tar.gz
rust-da26317a8a69fed3f7b96457c643121e75954933.zip
Stop mentioning internal lang items in no_std binary errors
When writing a no_std binary, you'll be greeted with nonsensical errors
mentioning lang items like eh_personality and start. That's pretty bad
because it makes you think that you need to define them somewhere! But
oh no, now you're getting the `internal_features` lint telling you that
you shouldn't use them! But you need a no_std binary! What now?

No problem! Writing a no_std binary is super easy. Just use panic=abort
and supply your own platform specific entrypoint symbol (like `main`)
and you're good to go. Would be nice if the compiler told you that,
right?

This makes it so that it does do that.
Diffstat (limited to 'tests/ui/lang-items')
-rw-r--r--tests/ui/lang-items/required-lang-item.rs7
-rw-r--r--tests/ui/lang-items/required-lang-item.stderr6
2 files changed, 8 insertions, 5 deletions
diff --git a/tests/ui/lang-items/required-lang-item.rs b/tests/ui/lang-items/required-lang-item.rs
index 3b17c5b7255..7f8933ac2ad 100644
--- a/tests/ui/lang-items/required-lang-item.rs
+++ b/tests/ui/lang-items/required-lang-item.rs
@@ -1,11 +1,10 @@
-// build-fail
+// edition: 2018
 
 #![feature(lang_items, no_core)]
 #![no_core]
+#![no_main]
 
 #[lang="copy"] pub trait Copy { }
 #[lang="sized"] pub trait Sized { }
 
-// error-pattern:requires `start` lang_item
-
-fn main() {}
+async fn x() {} //~ ERROR requires `ResumeTy` lang_item
diff --git a/tests/ui/lang-items/required-lang-item.stderr b/tests/ui/lang-items/required-lang-item.stderr
index bb53d336bb2..13c07ee6529 100644
--- a/tests/ui/lang-items/required-lang-item.stderr
+++ b/tests/ui/lang-items/required-lang-item.stderr
@@ -1,4 +1,8 @@
-error: requires `start` lang_item
+error: requires `ResumeTy` lang_item
+  --> $DIR/required-lang-item.rs:10:14
+   |
+LL | async fn x() {}
+   |              ^^
 
 error: aborting due to 1 previous error