1
Fork 0

Add tests for unsized-locals functions stability.

This commit is contained in:
Masaki Hara 2018-11-19 00:26:05 +09:00
parent 8ab5be13a3
commit 2ff6ffc872
4 changed files with 28 additions and 0 deletions

View file

@ -34,4 +34,5 @@ fn main() {
udrop::<[u8]>((*foo())); udrop::<[u8]>((*foo()));
udrop::<[u8]>((*tfoo()).1); udrop::<[u8]>((*tfoo()).1);
*afoo() + 42; *afoo() + 42;
udrop as fn([u8]);
} }

View file

@ -0,0 +1,3 @@
#![feature(unsized_locals)]
pub fn udrop<T: ?Sized>(_x: T) {}

View file

@ -0,0 +1,10 @@
// aux-build:ufuncs.rs
extern crate ufuncs;
use ufuncs::udrop;
fn main() {
udrop as fn([u8]);
//~^ERROR E0277
}

View file

@ -0,0 +1,14 @@
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> $DIR/unsized-exprs3.rs:8:5
|
LL | udrop as fn([u8]);
| ^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
= 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>
= note: all function arguments must have a statically known size
= help: unsized locals are gated as an unstable feature
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.