Skip to content

Commit 5c98cf1

Browse files
authoredNov 20, 2021
Rollup merge of #90956 - JohnTitor:issue-87573, r=Mark-Simulacrum
Add a regression test for #87573 Closes #87573
2 parents c0695bb + 8f6fa4f commit 5c98cf1

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
 

‎src/test/ui/lang-items/issue-87573.rs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Regression test for #87573, ensures that duplicate lang items or invalid generics
2+
// for lang items doesn't cause ICE.
3+
4+
#![feature(no_core, lang_items)]
5+
#![no_core]
6+
#![crate_type = "lib"]
7+
8+
pub static STATIC_BOOL: bool = true;
9+
10+
#[lang = "sized"]
11+
trait Sized {}
12+
13+
#[lang = "copy"]
14+
trait Copy {}
15+
16+
#[lang = "sync"]
17+
trait Sync {}
18+
impl Sync for bool {}
19+
20+
#[lang = "drop_in_place"]
21+
//~^ ERROR: `drop_in_place` language item must be applied to a function with at least 1 generic argument
22+
fn drop_fn() {
23+
while false {}
24+
}
25+
26+
#[lang = "start"]
27+
//~^ ERROR: `start` language item must be applied to a function with 1 generic argument
28+
fn start(){}
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0718]: `drop_in_place` language item must be applied to a function with at least 1 generic argument
2+
--> $DIR/issue-87573.rs:20:1
3+
|
4+
LL | #[lang = "drop_in_place"]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
6+
LL |
7+
LL | fn drop_fn() {
8+
| - this function has 0 generic arguments
9+
10+
error[E0718]: `start` language item must be applied to a function with 1 generic argument
11+
--> $DIR/issue-87573.rs:26:1
12+
|
13+
LL | #[lang = "start"]
14+
| ^^^^^^^^^^^^^^^^^
15+
LL |
16+
LL | fn start(){}
17+
| - this function has 0 generic arguments
18+
19+
error: aborting due to 2 previous errors
20+
21+
For more information about this error, try `rustc --explain E0718`.

0 commit comments

Comments
 (0)
Please sign in to comment.