Skip to content

Commit 1474fac

Browse files
committed
Add regression test for #26376
1 parent 3360cc3 commit 1474fac

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// ignore-tidy-linelength
2+
3+
// regression test for #26376
4+
5+
trait Foo {
6+
fn foo(&self) -> [u8];
7+
}
8+
9+
fn foo(f: Option<&dyn Foo>) {
10+
if let Some(f) = f {
11+
let _ = f.foo();
12+
//~^ ERROR cannot move a value of type [u8]: the size of [u8] cannot be statically determined
13+
}
14+
}
15+
16+
fn main() { foo(None) }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0161]: cannot move a value of type [u8]: the size of [u8] cannot be statically determined
2+
--> $DIR/return-unsized-from-trait-method.rs:11:17
3+
|
4+
LL | let _ = f.foo();
5+
| ^^^^^^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0161`.

0 commit comments

Comments
 (0)