Skip to content

Commit eb5cee6

Browse files
committed
Add unsized_locals to INCOMPLETE_FEATURES list
1 parent 3bb9ec7 commit eb5cee6

28 files changed

+153
-55
lines changed

src/librustc_feature/active.rs

+1
Original file line numberDiff line numberDiff line change
@@ -590,4 +590,5 @@ pub const INCOMPLETE_FEATURES: &[Symbol] = &[
590590
sym::raw_dylib,
591591
sym::const_trait_impl,
592592
sym::const_trait_bound_opt_out,
593+
sym::unsized_locals,
593594
];

src/test/ui/error-codes/E0161.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
//[zflagsul]compile-flags: -Z borrowck=migrate
1010
//[editionul]edition:2018
1111

12+
#![allow(incomplete_features)]
1213
#![cfg_attr(nll, feature(nll))]
1314
#![cfg_attr(nllul, feature(nll))]
1415
#![cfg_attr(migrateul, feature(unsized_locals))]
1516
#![cfg_attr(zflagsul, feature(unsized_locals))]
1617
#![cfg_attr(nllul, feature(unsized_locals))]
1718
#![cfg_attr(editionul, feature(unsized_locals))]
18-
1919
#![feature(box_syntax)]
2020

2121
fn foo(x: Box<[i32]>) {

src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(arbitrary_self_types, coerce_unsized, dispatch_from_dyn, unsize, unsized_locals, unsized_fn_params)]
2+
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
23

34
// This tests a few edge-cases around `arbitrary_self_types`. Most specifically,
45
// it checks that the `ObjectCandidate` you get from method matching can't
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,46 @@
1+
warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:1:77
3+
|
4+
LL | #![feature(arbitrary_self_types, coerce_unsized, dispatch_from_dyn, unsize, unsized_locals, unsized_fn_params)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
9+
110
error[E0308]: mismatched types
2-
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:85:24
11+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:86:24
312
|
413
LL | let _seetype: () = z;
514
| -- ^ expected `()`, found `u32`
615
| |
716
| expected due to this
817

918
error[E0308]: mismatched types
10-
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:102:24
19+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:103:24
1120
|
1221
LL | let _seetype: () = z;
1322
| -- ^ expected `()`, found `u64`
1423
| |
1524
| expected due to this
1625

1726
error[E0034]: multiple applicable items in scope
18-
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:120:15
27+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:121:15
1928
|
2029
LL | let z = x.foo();
2130
| ^^^ multiple `foo` found
2231
|
2332
note: candidate #1 is defined in an impl of the trait `internal::X` for the type `T`
24-
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:43:9
33+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:44:9
2534
|
2635
LL | fn foo(self: Smaht<Self, u64>) -> u64 {
2736
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2837
note: candidate #2 is defined in an impl of the trait `nuisance_foo::NuisanceFoo` for the type `T`
29-
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:70:9
38+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:71:9
3039
|
3140
LL | fn foo(self) {}
3241
| ^^^^^^^^^^^^
3342
note: candidate #3 is defined in the trait `FinalFoo`
34-
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:57:5
43+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:58:5
3544
|
3645
LL | fn foo(&self) -> u8;
3746
| ^^^^^^^^^^^^^^^^^^^^
@@ -49,30 +58,30 @@ LL | let z = FinalFoo::foo(x);
4958
| ^^^^^^^^^^^^^^^^
5059

5160
error[E0308]: mismatched types
52-
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:137:24
61+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:138:24
5362
|
5463
LL | let _seetype: () = z;
5564
| -- ^ expected `()`, found `u8`
5665
| |
5766
| expected due to this
5867

5968
error[E0308]: mismatched types
60-
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:155:24
69+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:156:24
6170
|
6271
LL | let _seetype: () = z;
6372
| -- ^ expected `()`, found `u32`
6473
| |
6574
| expected due to this
6675

6776
error[E0308]: mismatched types
68-
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:172:24
77+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:173:24
6978
|
7079
LL | let _seetype: () = z;
7180
| -- ^ expected `()`, found `u32`
7281
| |
7382
| expected due to this
7483

75-
error: aborting due to 6 previous errors
84+
error: aborting due to 6 previous errors; 1 warning emitted
7685

7786
Some errors have detailed explanations: E0034, E0308.
7887
For more information about an error, try `rustc --explain E0034`.
+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(unsized_locals)]
2+
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
23

34
struct A;
45
#[derive(Clone, Copy)]
@@ -8,27 +9,27 @@ fn main() {
89
let a: Box<[A]> = Box::new([A]);
910
match *a {
1011
//~^ ERROR cannot move out of type `[A]`, a non-copy slice
11-
[a @ ..] => {},
12+
[a @ ..] => {}
1213
_ => {}
1314
}
1415
let b: Box<[A]> = Box::new([A, A, A]);
1516
match *b {
1617
//~^ ERROR cannot move out of type `[A]`, a non-copy slice
17-
[_, _, b @ .., _] => {},
18+
[_, _, b @ .., _] => {}
1819
_ => {}
1920
}
2021

2122
// `[C]` isn't `Copy`, even if `C` is.
2223
let c: Box<[C]> = Box::new([C]);
2324
match *c {
2425
//~^ ERROR cannot move out of type `[C]`, a non-copy slice
25-
[c @ ..] => {},
26+
[c @ ..] => {}
2627
_ => {}
2728
}
2829
let d: Box<[C]> = Box::new([C, C, C]);
2930
match *d {
3031
//~^ ERROR cannot move out of type `[C]`, a non-copy slice
31-
[_, _, d @ .., _] => {},
32+
[_, _, d @ .., _] => {}
3233
_ => {}
3334
}
3435
}
+18-9
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,60 @@
1+
warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/move-out-of-slice-2.rs:1:12
3+
|
4+
LL | #![feature(unsized_locals)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
9+
110
error[E0508]: cannot move out of type `[A]`, a non-copy slice
2-
--> $DIR/move-out-of-slice-2.rs:9:11
11+
--> $DIR/move-out-of-slice-2.rs:10:11
312
|
413
LL | match *a {
514
| ^^ cannot move out of here
615
LL |
7-
LL | [a @ ..] => {},
16+
LL | [a @ ..] => {}
817
| ------
918
| |
1019
| data moved here
1120
| move occurs because `a` has type `[A]`, which does not implement the `Copy` trait
1221

1322
error[E0508]: cannot move out of type `[A]`, a non-copy slice
14-
--> $DIR/move-out-of-slice-2.rs:15:11
23+
--> $DIR/move-out-of-slice-2.rs:16:11
1524
|
1625
LL | match *b {
1726
| ^^ cannot move out of here
1827
LL |
19-
LL | [_, _, b @ .., _] => {},
28+
LL | [_, _, b @ .., _] => {}
2029
| ------
2130
| |
2231
| data moved here
2332
| move occurs because `b` has type `[A]`, which does not implement the `Copy` trait
2433

2534
error[E0508]: cannot move out of type `[C]`, a non-copy slice
26-
--> $DIR/move-out-of-slice-2.rs:23:11
35+
--> $DIR/move-out-of-slice-2.rs:24:11
2736
|
2837
LL | match *c {
2938
| ^^ cannot move out of here
3039
LL |
31-
LL | [c @ ..] => {},
40+
LL | [c @ ..] => {}
3241
| ------
3342
| |
3443
| data moved here
3544
| move occurs because `c` has type `[C]`, which does not implement the `Copy` trait
3645

3746
error[E0508]: cannot move out of type `[C]`, a non-copy slice
38-
--> $DIR/move-out-of-slice-2.rs:29:11
47+
--> $DIR/move-out-of-slice-2.rs:30:11
3948
|
4049
LL | match *d {
4150
| ^^ cannot move out of here
4251
LL |
43-
LL | [_, _, d @ .., _] => {},
52+
LL | [_, _, d @ .., _] => {}
4453
| ------
4554
| |
4655
| data moved here
4756
| move occurs because `d` has type `[C]`, which does not implement the `Copy` trait
4857

49-
error: aborting due to 4 previous errors
58+
error: aborting due to 4 previous errors; 1 warning emitted
5059

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

src/test/ui/unsized-locals/autoderef.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-pass
22

3+
#![allow(incomplete_features)]
34
#![feature(unsized_locals, unsized_fn_params)]
45

56
pub trait Foo {

src/test/ui/unsized-locals/borrow-after-move.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(unsized_locals, unsized_fn_params)]
2+
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
23

34
pub trait Foo {
45
fn foo(self) -> String;

src/test/ui/unsized-locals/borrow-after-move.stderr

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/borrow-after-move.rs:1:12
3+
|
4+
LL | #![feature(unsized_locals, unsized_fn_params)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
9+
110
error[E0382]: borrow of moved value: `x`
2-
--> $DIR/borrow-after-move.rs:20:24
11+
--> $DIR/borrow-after-move.rs:21:24
312
|
413
LL | let y = *x;
514
| -- value moved here
@@ -10,7 +19,7 @@ LL | println!("{}", &x);
1019
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
1120

1221
error[E0382]: borrow of moved value: `y`
13-
--> $DIR/borrow-after-move.rs:22:24
22+
--> $DIR/borrow-after-move.rs:23:24
1423
|
1524
LL | let y = *x;
1625
| - move occurs because `y` has type `str`, which does not implement the `Copy` trait
@@ -21,7 +30,7 @@ LL | println!("{}", &y);
2130
| ^^ value borrowed here after move
2231

2332
error[E0382]: borrow of moved value: `x`
24-
--> $DIR/borrow-after-move.rs:30:24
33+
--> $DIR/borrow-after-move.rs:31:24
2534
|
2635
LL | let y = *x;
2736
| -- value moved here
@@ -32,7 +41,7 @@ LL | println!("{}", &x);
3241
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
3342

3443
error[E0382]: borrow of moved value: `y`
35-
--> $DIR/borrow-after-move.rs:32:24
44+
--> $DIR/borrow-after-move.rs:33:24
3645
|
3746
LL | let y = *x;
3847
| - move occurs because `y` has type `str`, which does not implement the `Copy` trait
@@ -43,7 +52,7 @@ LL | println!("{}", &y);
4352
| ^^ value borrowed here after move
4453

4554
error[E0382]: borrow of moved value: `x`
46-
--> $DIR/borrow-after-move.rs:39:24
55+
--> $DIR/borrow-after-move.rs:40:24
4756
|
4857
LL | let x = "hello".to_owned().into_boxed_str();
4958
| - move occurs because `x` has type `std::boxed::Box<str>`, which does not implement the `Copy` trait
@@ -52,6 +61,6 @@ LL | x.foo();
5261
LL | println!("{}", &x);
5362
| ^^ value borrowed here after move
5463

55-
error: aborting due to 5 previous errors
64+
error: aborting due to 5 previous errors; 1 warning emitted
5665

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

src/test/ui/unsized-locals/by-value-trait-object-safety-rpass.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-pass
22

3+
#![allow(incomplete_features)]
34
#![feature(unsized_locals)]
45

56
pub trait Foo {
@@ -14,7 +15,6 @@ impl Foo for A {
1415
}
1516
}
1617

17-
1818
fn main() {
1919
let x = *(Box::new(A) as Box<dyn Foo>);
2020
assert_eq!(x.foo(), format!("hello"));

src/test/ui/unsized-locals/by-value-trait-object-safety-withdefault.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-pass
22

3+
#![allow(incomplete_features)]
34
#![feature(unsized_locals, unsized_fn_params)]
45

56
pub trait Foo {

src/test/ui/unsized-locals/by-value-trait-object-safety.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#![feature(unsized_locals)]
2+
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
23

34
pub trait Foo {
4-
fn foo(self) -> String where Self: Sized;
5+
fn foo(self) -> String
6+
where
7+
Self: Sized;
58
}
69

710
struct A;
@@ -12,7 +15,6 @@ impl Foo for A {
1215
}
1316
}
1417

15-
1618
fn main() {
1719
let x = *(Box::new(A) as Box<dyn Foo>);
1820
x.foo();
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1+
warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/by-value-trait-object-safety.rs:1:12
3+
|
4+
LL | #![feature(unsized_locals)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
9+
110
error: the `foo` method cannot be invoked on a trait object
2-
--> $DIR/by-value-trait-object-safety.rs:18:7
11+
--> $DIR/by-value-trait-object-safety.rs:20:7
312
|
4-
LL | fn foo(self) -> String where Self: Sized;
5-
| ----- this has a `Sized` requirement
13+
LL | Self: Sized;
14+
| ----- this has a `Sized` requirement
615
...
716
LL | x.foo();
817
| ^^^
918

10-
error: aborting due to previous error
19+
error: aborting due to previous error; 1 warning emitted
1120

src/test/ui/unsized-locals/double-move.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(unsized_locals, unsized_fn_params)]
2+
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
23

34
pub trait Foo {
45
fn foo(self) -> String;

0 commit comments

Comments
 (0)