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.
- Loading branch information
Showing
2 changed files
with
37 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,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() {} |
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,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`. |