Skip to content

Commit 5d3b331

Browse files
committed
Add unsized_locals to INCOMPLETE_FEATURES list
1 parent 4bfd62a commit 5d3b331

27 files changed

+143
-63
lines changed

src/librustc_feature/active.rs

+1
Original file line numberDiff line numberDiff line change
@@ -575,4 +575,5 @@ pub const INCOMPLETE_FEATURES: &[Symbol] = &[
575575
sym::raw_dylib,
576576
sym::const_trait_impl,
577577
sym::const_trait_bound_opt_out,
578+
sym::unsized_locals,
578579
];

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/fn/dyn-fn-alignment.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)]
45
#![allow(dead_code)]
56
#[repr(align(256))]

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)]
2+
//~^ WARN the feature `unsized_locals` is incomplete and may cause the compiler to crash
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,45 @@
1+
warning: the feature `unsized_locals` is incomplete and may cause the compiler to crash
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)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
19
error[E0308]: mismatched types
2-
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:85:24
10+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:86:24
311
|
412
LL | let _seetype: () = z;
513
| -- ^ expected `()`, found `u32`
614
| |
715
| expected due to this
816

917
error[E0308]: mismatched types
10-
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:102:24
18+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:103:24
1119
|
1220
LL | let _seetype: () = z;
1321
| -- ^ expected `()`, found `u64`
1422
| |
1523
| expected due to this
1624

1725
error[E0034]: multiple applicable items in scope
18-
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:120:15
26+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:121:15
1927
|
2028
LL | let z = x.foo();
2129
| ^^^ multiple `foo` found
2230
|
2331
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
32+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:44:9
2533
|
2634
LL | fn foo(self: Smaht<Self, u64>) -> u64 {
2735
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2836
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
37+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:71:9
3038
|
3139
LL | fn foo(self) {}
3240
| ^^^^^^^^^^^^
3341
note: candidate #3 is defined in the trait `FinalFoo`
34-
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:57:5
42+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:58:5
3543
|
3644
LL | fn foo(&self) -> u8;
3745
| ^^^^^^^^^^^^^^^^^^^^
@@ -49,30 +57,30 @@ LL | let z = FinalFoo::foo(x);
4957
| ^^^^^^^^^^^^^^^^
5058

5159
error[E0308]: mismatched types
52-
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:137:24
60+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:138:24
5361
|
5462
LL | let _seetype: () = z;
5563
| -- ^ expected `()`, found `u8`
5664
| |
5765
| expected due to this
5866

5967
error[E0308]: mismatched types
60-
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:155:24
68+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:156:24
6169
|
6270
LL | let _seetype: () = z;
6371
| -- ^ expected `()`, found `u32`
6472
| |
6573
| expected due to this
6674

6775
error[E0308]: mismatched types
68-
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:172:24
76+
--> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:173:24
6977
|
7078
LL | let _seetype: () = z;
7179
| -- ^ expected `()`, found `u32`
7280
| |
7381
| expected due to this
7482

75-
error: aborting due to 6 previous errors
83+
error: aborting due to 6 previous errors; 1 warning emitted
7684

7785
Some errors have detailed explanations: E0034, E0308.
7886
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 cause the compiler to crash
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
}
+17-9
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,59 @@
1+
warning: the feature `unsized_locals` is incomplete and may cause the compiler to crash
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+
19
error[E0508]: cannot move out of type `[A]`, a non-copy slice
2-
--> $DIR/move-out-of-slice-2.rs:9:11
10+
--> $DIR/move-out-of-slice-2.rs:10:11
311
|
412
LL | match *a {
513
| ^^ cannot move out of here
614
LL |
7-
LL | [a @ ..] => {},
15+
LL | [a @ ..] => {}
816
| ------
917
| |
1018
| data moved here
1119
| move occurs because `a` has type `[A]`, which does not implement the `Copy` trait
1220

1321
error[E0508]: cannot move out of type `[A]`, a non-copy slice
14-
--> $DIR/move-out-of-slice-2.rs:15:11
22+
--> $DIR/move-out-of-slice-2.rs:16:11
1523
|
1624
LL | match *b {
1725
| ^^ cannot move out of here
1826
LL |
19-
LL | [_, _, b @ .., _] => {},
27+
LL | [_, _, b @ .., _] => {}
2028
| ------
2129
| |
2230
| data moved here
2331
| move occurs because `b` has type `[A]`, which does not implement the `Copy` trait
2432

2533
error[E0508]: cannot move out of type `[C]`, a non-copy slice
26-
--> $DIR/move-out-of-slice-2.rs:23:11
34+
--> $DIR/move-out-of-slice-2.rs:24:11
2735
|
2836
LL | match *c {
2937
| ^^ cannot move out of here
3038
LL |
31-
LL | [c @ ..] => {},
39+
LL | [c @ ..] => {}
3240
| ------
3341
| |
3442
| data moved here
3543
| move occurs because `c` has type `[C]`, which does not implement the `Copy` trait
3644

3745
error[E0508]: cannot move out of type `[C]`, a non-copy slice
38-
--> $DIR/move-out-of-slice-2.rs:29:11
46+
--> $DIR/move-out-of-slice-2.rs:30:11
3947
|
4048
LL | match *d {
4149
| ^^ cannot move out of here
4250
LL |
43-
LL | [_, _, d @ .., _] => {},
51+
LL | [_, _, d @ .., _] => {}
4452
| ------
4553
| |
4654
| data moved here
4755
| move occurs because `d` has type `[C]`, which does not implement the `Copy` trait
4856

49-
error: aborting due to 4 previous errors
57+
error: aborting due to 4 previous errors; 1 warning emitted
5058

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

src/test/ui/unsized-locals/autoderef.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 {
@@ -24,7 +25,6 @@ impl Foo for dyn FnMut() -> String {
2425
}
2526
}
2627

27-
2828
fn main() {
2929
let x = *(Box::new(['h', 'e', 'l', 'l', 'o']) as Box<[char]>);
3030
assert_eq!(&x.foo() as &str, "hello");

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)]
2+
//~^ WARN the feature `unsized_locals` is incomplete and may cause the compiler to crash
23

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

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

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1+
warning: the feature `unsized_locals` is incomplete and may cause the compiler to crash
2+
--> $DIR/borrow-after-move.rs:1:12
3+
|
4+
LL | #![feature(unsized_locals)]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
19
error[E0382]: borrow of moved value: `x`
2-
--> $DIR/borrow-after-move.rs:20:24
10+
--> $DIR/borrow-after-move.rs:21:24
311
|
412
LL | let y = *x;
513
| -- value moved here
@@ -10,7 +18,7 @@ LL | println!("{}", &x);
1018
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
1119

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

2331
error[E0382]: borrow of moved value: `x`
24-
--> $DIR/borrow-after-move.rs:30:24
32+
--> $DIR/borrow-after-move.rs:31:24
2533
|
2634
LL | let y = *x;
2735
| -- value moved here
@@ -32,7 +40,7 @@ LL | println!("{}", &x);
3240
= note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait
3341

3442
error[E0382]: borrow of moved value: `y`
35-
--> $DIR/borrow-after-move.rs:32:24
43+
--> $DIR/borrow-after-move.rs:33:24
3644
|
3745
LL | let y = *x;
3846
| - move occurs because `y` has type `str`, which does not implement the `Copy` trait
@@ -43,7 +51,7 @@ LL | println!("{}", &y);
4351
| ^^ value borrowed here after move
4452

4553
error[E0382]: borrow of moved value: `x`
46-
--> $DIR/borrow-after-move.rs:39:24
54+
--> $DIR/borrow-after-move.rs:40:24
4755
|
4856
LL | let x = "hello".to_owned().into_boxed_str();
4957
| - move occurs because `x` has type `std::boxed::Box<str>`, which does not implement the `Copy` trait
@@ -52,6 +60,6 @@ LL | x.foo();
5260
LL | println!("{}", &x);
5361
| ^^ value borrowed here after move
5462

55-
error: aborting due to 5 previous errors
63+
error: aborting due to 5 previous errors; 1 warning emitted
5664

5765
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-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 {
@@ -12,7 +13,6 @@ struct A;
1213

1314
impl Foo for A {}
1415

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

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 cause the compiler to crash
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,19 @@
1+
warning: the feature `unsized_locals` is incomplete and may cause the compiler to crash
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+
19
error: the `foo` method cannot be invoked on a trait object
2-
--> $DIR/by-value-trait-object-safety.rs:18:7
10+
--> $DIR/by-value-trait-object-safety.rs:20:7
311
|
4-
LL | fn foo(self) -> String where Self: Sized;
5-
| ----- this has a `Sized` requirement
12+
LL | Self: Sized;
13+
| ----- this has a `Sized` requirement
614
...
715
LL | x.foo();
816
| ^^^
917

10-
error: aborting due to previous error
18+
error: aborting due to previous error; 1 warning emitted
1119

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)]
2+
//~^ WARN the feature `unsized_locals` is incomplete and may cause the compiler to crash
23

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

0 commit comments

Comments
 (0)