Skip to content

Commit 2ff6ffc

Browse files
committed
Add tests for unsized-locals functions stability.
1 parent 8ab5be1 commit 2ff6ffc

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

src/test/run-pass/unsized-locals/unsized-exprs.rs

+1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ fn main() {
3434
udrop::<[u8]>((*foo()));
3535
udrop::<[u8]>((*tfoo()).1);
3636
*afoo() + 42;
37+
udrop as fn([u8]);
3738
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#![feature(unsized_locals)]
2+
3+
pub fn udrop<T: ?Sized>(_x: T) {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// aux-build:ufuncs.rs
2+
3+
extern crate ufuncs;
4+
5+
use ufuncs::udrop;
6+
7+
fn main() {
8+
udrop as fn([u8]);
9+
//~^ERROR E0277
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
2+
--> $DIR/unsized-exprs3.rs:8:5
3+
|
4+
LL | udrop as fn([u8]);
5+
| ^^^^^ doesn't have a size known at compile-time
6+
|
7+
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
8+
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
9+
= note: all function arguments must have a statically known size
10+
= help: unsized locals are gated as an unstable feature
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)