Skip to content

Commit cc9ab1c

Browse files
committed
Merge unsized locals pat tests
1 parent 00fd703 commit cc9ab1c

4 files changed

+29
-39
lines changed

src/test/ui/unsized-locals/unsized-local-pat.rs

-13
This file was deleted.

src/test/ui/unsized-locals/unsized-local-pat.stderr

-23
This file was deleted.

src/test/ui/unsized-locals/unsized-locals-using-unsized-fn-params.rs

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

3-
// Ensure that even with unsized_fn_params, unsized locals are not accepted.
4+
#[allow(dead_code)]
5+
fn f1(box box _b: Box<Box<[u8]>>) {}
6+
//~^ ERROR: the size for values of type `[u8]` cannot be known at compilation time [E0277]
7+
8+
fn f2((_x, _y): (i32, [i32])) {}
9+
//~^ ERROR: the size for values of type `[i32]` cannot be known at compilation time [E0277]
410

511
fn main() {
612
let foo: Box<[u8]> = Box::new(*b"foo");
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
2-
--> $DIR/unsized-locals-using-unsized-fn-params.rs:7:9
2+
--> $DIR/unsized-locals-using-unsized-fn-params.rs:5:15
3+
|
4+
LL | fn f1(box box _b: Box<Box<[u8]>>) {}
5+
| ^^ doesn't have a size known at compile-time
6+
|
7+
= help: the trait `Sized` is not implemented for `[u8]`
8+
= note: all local variables must have a statically known size
9+
= help: unsized locals are gated as an unstable feature
10+
11+
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
12+
--> $DIR/unsized-locals-using-unsized-fn-params.rs:8:12
13+
|
14+
LL | fn f2((_x, _y): (i32, [i32])) {}
15+
| ^^ doesn't have a size known at compile-time
16+
|
17+
= help: the trait `Sized` is not implemented for `[i32]`
18+
= note: all local variables must have a statically known size
19+
= help: unsized locals are gated as an unstable feature
20+
21+
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
22+
--> $DIR/unsized-locals-using-unsized-fn-params.rs:13:9
323
|
424
LL | let _foo: [u8] = *foo;
525
| ^^^^ doesn't have a size known at compile-time
@@ -8,6 +28,6 @@ LL | let _foo: [u8] = *foo;
828
= note: all local variables must have a statically known size
929
= help: unsized locals are gated as an unstable feature
1030

11-
error: aborting due to previous error
31+
error: aborting due to 3 previous errors
1232

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

0 commit comments

Comments
 (0)