Add test for issue rust-lang/rust#83474
This commit is contained in:
parent
634770c0a7
commit
594a2fcc3f
2 changed files with 20 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
|||
// Checks that declaring a lang item with the wrong number
|
||||
// of generic arguments errors rather than crashing (issue #83893, #87573, part of #9307, #79559).
|
||||
// Checks that declaring a lang item with the wrong number of generic arguments errors rather than
|
||||
// crashing (issue #83474, #83893, #87573, part of #9307, #79559).
|
||||
|
||||
#![feature(lang_items, no_core)]
|
||||
#![no_core]
|
||||
|
@ -25,6 +25,10 @@ struct MyPhantomData<T, U>;
|
|||
//~^ ERROR parameter `T` is never used
|
||||
//~| ERROR parameter `U` is never used
|
||||
|
||||
#[lang = "owned_box"]
|
||||
//~^ ERROR `owned_box` language item must be applied to a struct with at least 1 generic argument
|
||||
struct Foo;
|
||||
|
||||
// When the `start` lang item is missing generics very odd things can happen, especially when
|
||||
// it comes to cross-crate monomorphization
|
||||
#[lang = "start"]
|
||||
|
@ -48,6 +52,9 @@ fn ice() {
|
|||
|
||||
// Use phantomdata
|
||||
let _ = MyPhantomData::<(), i32>;
|
||||
|
||||
// Use Foo
|
||||
let _: () = Foo;
|
||||
}
|
||||
|
||||
// use `start`
|
||||
|
|
|
@ -32,8 +32,17 @@ LL |
|
|||
LL | struct MyPhantomData<T, U>;
|
||||
| ------ this struct has 2 generic arguments
|
||||
|
||||
error[E0718]: `owned_box` language item must be applied to a struct with at least 1 generic argument
|
||||
--> $DIR/lang-item-generic-requirements.rs:28:1
|
||||
|
|
||||
LL | #[lang = "owned_box"]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
LL |
|
||||
LL | struct Foo;
|
||||
| - this struct has 0 generic arguments
|
||||
|
||||
error[E0718]: `start` language item must be applied to a function with 1 generic argument
|
||||
--> $DIR/lang-item-generic-requirements.rs:30:1
|
||||
--> $DIR/lang-item-generic-requirements.rs:34:1
|
||||
|
|
||||
LL | #[lang = "start"]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
@ -59,7 +68,7 @@ LL | struct MyPhantomData<T, U>;
|
|||
= help: consider removing `U` or referring to it in a field
|
||||
= help: if you intended `U` to be a const parameter, use `const U: usize` instead
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0392, E0718.
|
||||
For more information about an error, try `rustc --explain E0392`.
|
||||
|
|
Loading…
Reference in a new issue