File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ pub trait Foo : Sized {
2+ const SIZE : usize ;
3+
4+ fn new ( slice : & [ u8 ; Foo :: SIZE ] ) -> Self ;
5+ //~^ ERROR: type annotations needed: cannot resolve `_: Foo`
6+ }
7+
8+ pub struct Bar < T : ?Sized > ( T ) ;
9+
10+ impl Bar < [ u8 ] > {
11+ const SIZE : usize = 32 ;
12+
13+ fn new ( slice : & [ u8 ; Self :: SIZE ] ) -> Self {
14+ Foo ( Box :: new ( * slice) ) //~ ERROR: expected function, found trait `Foo`
15+ }
16+ }
17+
18+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0423]: expected function, found trait `Foo`
2+ --> $DIR/issue-58022.rs:14:9
3+ |
4+ LL | Foo(Box::new(*slice))
5+ | ^^^ not a function
6+
7+ error[E0283]: type annotations needed: cannot resolve `_: Foo`
8+ --> $DIR/issue-58022.rs:4:25
9+ |
10+ LL | const SIZE: usize;
11+ | ------------------ required by `Foo::SIZE`
12+ LL |
13+ LL | fn new(slice: &[u8; Foo::SIZE]) -> Self;
14+ | ^^^^^^^^^
15+
16+ error: aborting due to 2 previous errors
17+
18+ Some errors have detailed explanations: E0283, E0423.
19+ For more information about an error, try `rustc --explain E0283`.
You can’t perform that action at this time.
0 commit comments