forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test from rust-lang#61041.
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
pub struct Foo<A, B>(A, B); | ||
|
||
impl<A, B> Foo<A, B> { | ||
const HOST_SIZE: usize = std::mem::size_of::<B>(); | ||
|
||
pub fn crash() -> bool { | ||
[5; Self::HOST_SIZE] == [6; 0] //~ ERROR no associated item named `HOST_SIZE` | ||
//~^ the size for values of type `A` cannot be known | ||
//~| the size for values of type `B` cannot be known | ||
} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
error[E0599]: no associated item named `HOST_SIZE` found for type `Foo<A, B>` in the current scope | ||
--> $DIR/too_generic_eval_ice.rs:7:19 | ||
| | ||
LL | pub struct Foo<A, B>(A, B); | ||
| --------------------------- associated item `HOST_SIZE` not found for this | ||
... | ||
LL | [5; Self::HOST_SIZE] == [6; 0] | ||
| ^^^^^^^^^ associated item not found in `Foo<A, B>` | ||
| | ||
= note: the method `HOST_SIZE` exists but the following trait bounds were not satisfied: | ||
`A : std::marker::Sized` | ||
`B : std::marker::Sized` | ||
|
||
error[E0277]: the size for values of type `A` cannot be known at compilation time | ||
--> $DIR/too_generic_eval_ice.rs:7:13 | ||
| | ||
LL | [5; Self::HOST_SIZE] == [6; 0] | ||
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `std::marker::Sized` is not implemented for `A` | ||
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait> | ||
= help: consider adding a `where A: std::marker::Sized` bound | ||
note: required by `Foo` | ||
--> $DIR/too_generic_eval_ice.rs:1:1 | ||
| | ||
LL | pub struct Foo<A, B>(A, B); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0277]: the size for values of type `B` cannot be known at compilation time | ||
--> $DIR/too_generic_eval_ice.rs:7:13 | ||
| | ||
LL | [5; Self::HOST_SIZE] == [6; 0] | ||
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `std::marker::Sized` is not implemented for `B` | ||
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait> | ||
= help: consider adding a `where B: std::marker::Sized` bound | ||
note: required by `Foo` | ||
--> $DIR/too_generic_eval_ice.rs:1:1 | ||
| | ||
LL | pub struct Foo<A, B>(A, B); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0277, E0599. | ||
For more information about an error, try `rustc --explain E0277`. |