Add tests for unsized-locals functions stability.
This commit is contained in:
parent
8ab5be13a3
commit
2ff6ffc872
4 changed files with 28 additions and 0 deletions
|
@ -34,4 +34,5 @@ fn main() {
|
|||
udrop::<[u8]>((*foo()));
|
||||
udrop::<[u8]>((*tfoo()).1);
|
||||
*afoo() + 42;
|
||||
udrop as fn([u8]);
|
||||
}
|
||||
|
|
3
src/test/ui/unsized-locals/auxiliary/ufuncs.rs
Normal file
3
src/test/ui/unsized-locals/auxiliary/ufuncs.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
#![feature(unsized_locals)]
|
||||
|
||||
pub fn udrop<T: ?Sized>(_x: T) {}
|
10
src/test/ui/unsized-locals/unsized-exprs3.rs
Normal file
10
src/test/ui/unsized-locals/unsized-exprs3.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
// aux-build:ufuncs.rs
|
||||
|
||||
extern crate ufuncs;
|
||||
|
||||
use ufuncs::udrop;
|
||||
|
||||
fn main() {
|
||||
udrop as fn([u8]);
|
||||
//~^ERROR E0277
|
||||
}
|
14
src/test/ui/unsized-locals/unsized-exprs3.stderr
Normal file
14
src/test/ui/unsized-locals/unsized-exprs3.stderr
Normal 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`.
|
Loading…
Add table
Add a link
Reference in a new issue