Skip to content

Commit

Permalink
Merge unsized locals pat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Oct 27, 2020
1 parent 00fd703 commit cc9ab1c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 39 deletions.
13 changes: 0 additions & 13 deletions src/test/ui/unsized-locals/unsized-local-pat.rs

This file was deleted.

23 changes: 0 additions & 23 deletions src/test/ui/unsized-locals/unsized-local-pat.stderr

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#![feature(box_patterns)]
#![feature(unsized_fn_params)]

// Ensure that even with unsized_fn_params, unsized locals 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]

fn f2((_x, _y): (i32, [i32])) {}
//~^ ERROR: the size for values of type `[i32]` cannot be known at compilation time [E0277]

fn main() {
let foo: Box<[u8]> = Box::new(*b"foo");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> $DIR/unsized-locals-using-unsized-fn-params.rs:7:9
--> $DIR/unsized-locals-using-unsized-fn-params.rs:5:15
|
LL | fn f1(box box _b: Box<Box<[u8]>>) {}
| ^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[u8]`
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature

error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
--> $DIR/unsized-locals-using-unsized-fn-params.rs:8:12
|
LL | fn f2((_x, _y): (i32, [i32])) {}
| ^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `[i32]`
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> $DIR/unsized-locals-using-unsized-fn-params.rs:13:9
|
LL | let _foo: [u8] = *foo;
| ^^^^ doesn't have a size known at compile-time
Expand All @@ -8,6 +28,6 @@ LL | let _foo: [u8] = *foo;
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature

error: aborting due to previous error
error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0277`.

0 comments on commit cc9ab1c

Please sign in to comment.