Add comment explaining why in these tests unsized locals are not accepted

This commit is contained in:
Santiago Pastorino 2020-10-20 21:52:49 -03:00
parent 497ee0e1ff
commit 8b8b6392ba
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
2 changed files with 4 additions and 0 deletions

View file

@ -1,6 +1,8 @@
#![feature(box_patterns)]
#![feature(unsized_fn_params)]
// Ensure that even with unsized_fn_params, unsized types in parameter patterns are not accepted.
#[allow(dead_code)]
fn f1(box box _b: Box<Box<[u8]>>) {}
//~^ ERROR: the size for values of type `[u8]` cannot be known at compilation time [E0277]

View file

@ -1,5 +1,7 @@
#![feature(unsized_fn_params)]
// Ensure that even with unsized_fn_params, unsized locals are not accepted.
fn main() {
let foo: Box<[u8]> = Box::new(*b"foo");
let _foo: [u8] = *foo;