mirror of https://github.com/rust-lang/rust.git
Add test for #58022
This commit is contained in:
parent
576c215ab9
commit
bc25746d48
|
@ -0,0 +1,18 @@
|
|||
pub trait Foo: Sized {
|
||||
const SIZE: usize;
|
||||
|
||||
fn new(slice: &[u8; Foo::SIZE]) -> Self;
|
||||
//~^ ERROR: type annotations needed: cannot resolve `_: Foo`
|
||||
}
|
||||
|
||||
pub struct Bar<T: ?Sized>(T);
|
||||
|
||||
impl Bar<[u8]> {
|
||||
const SIZE: usize = 32;
|
||||
|
||||
fn new(slice: &[u8; Self::SIZE]) -> Self {
|
||||
Foo(Box::new(*slice)) //~ ERROR: expected function, found trait `Foo`
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,19 @@
|
|||
error[E0423]: expected function, found trait `Foo`
|
||||
--> $DIR/issue-58022.rs:14:9
|
||||
|
|
||||
LL | Foo(Box::new(*slice))
|
||||
| ^^^ not a function
|
||||
|
||||
error[E0283]: type annotations needed: cannot resolve `_: Foo`
|
||||
--> $DIR/issue-58022.rs:4:25
|
||||
|
|
||||
LL | const SIZE: usize;
|
||||
| ------------------ required by `Foo::SIZE`
|
||||
LL |
|
||||
LL | fn new(slice: &[u8; Foo::SIZE]) -> Self;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0283, E0423.
|
||||
For more information about an error, try `rustc --explain E0283`.
|
Loading…
Reference in New Issue