diff --git a/src/librustc_feature/active.rs b/src/librustc_feature/active.rs index 7b3c599e8c7ca..7e4cda5556779 100644 --- a/src/librustc_feature/active.rs +++ b/src/librustc_feature/active.rs @@ -575,4 +575,5 @@ pub const INCOMPLETE_FEATURES: &[Symbol] = &[ sym::raw_dylib, sym::const_trait_impl, sym::const_trait_bound_opt_out, + sym::unsized_locals, ]; diff --git a/src/test/ui/error-codes/E0161.rs b/src/test/ui/error-codes/E0161.rs index 58217ff74b8d6..e0f5776424e09 100644 --- a/src/test/ui/error-codes/E0161.rs +++ b/src/test/ui/error-codes/E0161.rs @@ -9,13 +9,13 @@ //[zflagsul]compile-flags: -Z borrowck=migrate //[editionul]edition:2018 +#![allow(incomplete_features)] #![cfg_attr(nll, feature(nll))] #![cfg_attr(nllul, feature(nll))] #![cfg_attr(migrateul, feature(unsized_locals))] #![cfg_attr(zflagsul, feature(unsized_locals))] #![cfg_attr(nllul, feature(unsized_locals))] #![cfg_attr(editionul, feature(unsized_locals))] - #![feature(box_syntax)] fn foo(x: Box<[i32]>) { diff --git a/src/test/ui/fn/dyn-fn-alignment.rs b/src/test/ui/fn/dyn-fn-alignment.rs index 125f44bbf0093..9455b7431cc1d 100644 --- a/src/test/ui/fn/dyn-fn-alignment.rs +++ b/src/test/ui/fn/dyn-fn-alignment.rs @@ -1,5 +1,6 @@ // run-pass +#![allow(incomplete_features)] #![feature(unsized_locals)] #![allow(dead_code)] #[repr(align(256))] diff --git a/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.rs b/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.rs index 5ceba64678410..bc854d5f33017 100644 --- a/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.rs +++ b/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.rs @@ -1,4 +1,5 @@ #![feature(arbitrary_self_types, coerce_unsized, dispatch_from_dyn, unsize, unsized_locals)] +//~^ WARN the feature `unsized_locals` is incomplete and may cause the compiler to crash // This tests a few edge-cases around `arbitrary_self_types`. Most specifically, // it checks that the `ObjectCandidate` you get from method matching can't diff --git a/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr b/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr index 1bc7f30d04d0d..7bd1db39a7679 100644 --- a/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr +++ b/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr @@ -1,5 +1,13 @@ +warning: the feature `unsized_locals` is incomplete and may cause the compiler to crash + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:1:77 + | +LL | #![feature(arbitrary_self_types, coerce_unsized, dispatch_from_dyn, unsize, unsized_locals)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + error[E0308]: mismatched types - --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:85:24 + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:86:24 | LL | let _seetype: () = z; | -- ^ expected `()`, found `u32` @@ -7,7 +15,7 @@ LL | let _seetype: () = z; | expected due to this error[E0308]: mismatched types - --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:102:24 + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:103:24 | LL | let _seetype: () = z; | -- ^ expected `()`, found `u64` @@ -15,23 +23,23 @@ LL | let _seetype: () = z; | expected due to this error[E0034]: multiple applicable items in scope - --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:120:15 + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:121:15 | LL | let z = x.foo(); | ^^^ multiple `foo` found | note: candidate #1 is defined in an impl of the trait `internal::X` for the type `T` - --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:43:9 + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:44:9 | LL | fn foo(self: Smaht) -> u64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl of the trait `nuisance_foo::NuisanceFoo` for the type `T` - --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:70:9 + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:71:9 | LL | fn foo(self) {} | ^^^^^^^^^^^^ note: candidate #3 is defined in the trait `FinalFoo` - --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:57:5 + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:58:5 | LL | fn foo(&self) -> u8; | ^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +57,7 @@ LL | let z = FinalFoo::foo(x); | ^^^^^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:137:24 + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:138:24 | LL | let _seetype: () = z; | -- ^ expected `()`, found `u8` @@ -57,7 +65,7 @@ LL | let _seetype: () = z; | expected due to this error[E0308]: mismatched types - --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:155:24 + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:156:24 | LL | let _seetype: () = z; | -- ^ expected `()`, found `u32` @@ -65,14 +73,14 @@ LL | let _seetype: () = z; | expected due to this error[E0308]: mismatched types - --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:172:24 + --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:173:24 | LL | let _seetype: () = z; | -- ^ expected `()`, found `u32` | | | expected due to this -error: aborting due to 6 previous errors +error: aborting due to 6 previous errors; 1 warning emitted Some errors have detailed explanations: E0034, E0308. For more information about an error, try `rustc --explain E0034`. diff --git a/src/test/ui/moves/move-out-of-slice-2.rs b/src/test/ui/moves/move-out-of-slice-2.rs index 5c1a61eb375a4..105f98eb34900 100644 --- a/src/test/ui/moves/move-out-of-slice-2.rs +++ b/src/test/ui/moves/move-out-of-slice-2.rs @@ -1,4 +1,5 @@ #![feature(unsized_locals)] +//~^ WARN the feature `unsized_locals` is incomplete and may cause the compiler to crash struct A; #[derive(Clone, Copy)] @@ -8,13 +9,13 @@ fn main() { let a: Box<[A]> = Box::new([A]); match *a { //~^ ERROR cannot move out of type `[A]`, a non-copy slice - [a @ ..] => {}, + [a @ ..] => {} _ => {} } let b: Box<[A]> = Box::new([A, A, A]); match *b { //~^ ERROR cannot move out of type `[A]`, a non-copy slice - [_, _, b @ .., _] => {}, + [_, _, b @ .., _] => {} _ => {} } @@ -22,13 +23,13 @@ fn main() { let c: Box<[C]> = Box::new([C]); match *c { //~^ ERROR cannot move out of type `[C]`, a non-copy slice - [c @ ..] => {}, + [c @ ..] => {} _ => {} } let d: Box<[C]> = Box::new([C, C, C]); match *d { //~^ ERROR cannot move out of type `[C]`, a non-copy slice - [_, _, d @ .., _] => {}, + [_, _, d @ .., _] => {} _ => {} } } diff --git a/src/test/ui/moves/move-out-of-slice-2.stderr b/src/test/ui/moves/move-out-of-slice-2.stderr index 058f34b24a3b6..d0f4b3a1315d9 100644 --- a/src/test/ui/moves/move-out-of-slice-2.stderr +++ b/src/test/ui/moves/move-out-of-slice-2.stderr @@ -1,51 +1,59 @@ +warning: the feature `unsized_locals` is incomplete and may cause the compiler to crash + --> $DIR/move-out-of-slice-2.rs:1:12 + | +LL | #![feature(unsized_locals)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + error[E0508]: cannot move out of type `[A]`, a non-copy slice - --> $DIR/move-out-of-slice-2.rs:9:11 + --> $DIR/move-out-of-slice-2.rs:10:11 | LL | match *a { | ^^ cannot move out of here LL | -LL | [a @ ..] => {}, +LL | [a @ ..] => {} | ------ | | | data moved here | move occurs because `a` has type `[A]`, which does not implement the `Copy` trait error[E0508]: cannot move out of type `[A]`, a non-copy slice - --> $DIR/move-out-of-slice-2.rs:15:11 + --> $DIR/move-out-of-slice-2.rs:16:11 | LL | match *b { | ^^ cannot move out of here LL | -LL | [_, _, b @ .., _] => {}, +LL | [_, _, b @ .., _] => {} | ------ | | | data moved here | move occurs because `b` has type `[A]`, which does not implement the `Copy` trait error[E0508]: cannot move out of type `[C]`, a non-copy slice - --> $DIR/move-out-of-slice-2.rs:23:11 + --> $DIR/move-out-of-slice-2.rs:24:11 | LL | match *c { | ^^ cannot move out of here LL | -LL | [c @ ..] => {}, +LL | [c @ ..] => {} | ------ | | | data moved here | move occurs because `c` has type `[C]`, which does not implement the `Copy` trait error[E0508]: cannot move out of type `[C]`, a non-copy slice - --> $DIR/move-out-of-slice-2.rs:29:11 + --> $DIR/move-out-of-slice-2.rs:30:11 | LL | match *d { | ^^ cannot move out of here LL | -LL | [_, _, d @ .., _] => {}, +LL | [_, _, d @ .., _] => {} | ------ | | | data moved here | move occurs because `d` has type `[C]`, which does not implement the `Copy` trait -error: aborting due to 4 previous errors +error: aborting due to 4 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0508`. diff --git a/src/test/ui/unsized-locals/autoderef.rs b/src/test/ui/unsized-locals/autoderef.rs index 7f2d2f9c7ef3b..503cc49e31124 100644 --- a/src/test/ui/unsized-locals/autoderef.rs +++ b/src/test/ui/unsized-locals/autoderef.rs @@ -1,5 +1,6 @@ // run-pass +#![allow(incomplete_features)] #![feature(unsized_locals)] pub trait Foo { @@ -24,7 +25,6 @@ impl Foo for dyn FnMut() -> String { } } - fn main() { let x = *(Box::new(['h', 'e', 'l', 'l', 'o']) as Box<[char]>); assert_eq!(&x.foo() as &str, "hello"); diff --git a/src/test/ui/unsized-locals/borrow-after-move.rs b/src/test/ui/unsized-locals/borrow-after-move.rs index 3299fdf3a9ce8..764a8ec41adab 100644 --- a/src/test/ui/unsized-locals/borrow-after-move.rs +++ b/src/test/ui/unsized-locals/borrow-after-move.rs @@ -1,4 +1,5 @@ #![feature(unsized_locals)] +//~^ WARN the feature `unsized_locals` is incomplete and may cause the compiler to crash pub trait Foo { fn foo(self) -> String; diff --git a/src/test/ui/unsized-locals/borrow-after-move.stderr b/src/test/ui/unsized-locals/borrow-after-move.stderr index 110edab69be87..c3061a94d9c7e 100644 --- a/src/test/ui/unsized-locals/borrow-after-move.stderr +++ b/src/test/ui/unsized-locals/borrow-after-move.stderr @@ -1,5 +1,13 @@ +warning: the feature `unsized_locals` is incomplete and may cause the compiler to crash + --> $DIR/borrow-after-move.rs:1:12 + | +LL | #![feature(unsized_locals)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + error[E0382]: borrow of moved value: `x` - --> $DIR/borrow-after-move.rs:20:24 + --> $DIR/borrow-after-move.rs:21:24 | LL | let y = *x; | -- value moved here @@ -10,7 +18,7 @@ LL | println!("{}", &x); = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `y` - --> $DIR/borrow-after-move.rs:22:24 + --> $DIR/borrow-after-move.rs:23:24 | LL | let y = *x; | - move occurs because `y` has type `str`, which does not implement the `Copy` trait @@ -21,7 +29,7 @@ LL | println!("{}", &y); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` - --> $DIR/borrow-after-move.rs:30:24 + --> $DIR/borrow-after-move.rs:31:24 | LL | let y = *x; | -- value moved here @@ -32,7 +40,7 @@ LL | println!("{}", &x); = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `y` - --> $DIR/borrow-after-move.rs:32:24 + --> $DIR/borrow-after-move.rs:33:24 | LL | let y = *x; | - move occurs because `y` has type `str`, which does not implement the `Copy` trait @@ -43,7 +51,7 @@ LL | println!("{}", &y); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` - --> $DIR/borrow-after-move.rs:39:24 + --> $DIR/borrow-after-move.rs:40:24 | LL | let x = "hello".to_owned().into_boxed_str(); | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -52,6 +60,6 @@ LL | x.foo(); LL | println!("{}", &x); | ^^ value borrowed here after move -error: aborting due to 5 previous errors +error: aborting due to 5 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/unsized-locals/by-value-trait-object-safety-rpass.rs b/src/test/ui/unsized-locals/by-value-trait-object-safety-rpass.rs index b07d1a571b212..b9881defac39a 100644 --- a/src/test/ui/unsized-locals/by-value-trait-object-safety-rpass.rs +++ b/src/test/ui/unsized-locals/by-value-trait-object-safety-rpass.rs @@ -1,5 +1,6 @@ // run-pass +#![allow(incomplete_features)] #![feature(unsized_locals)] pub trait Foo { @@ -14,7 +15,6 @@ impl Foo for A { } } - fn main() { let x = *(Box::new(A) as Box); assert_eq!(x.foo(), format!("hello")); diff --git a/src/test/ui/unsized-locals/by-value-trait-object-safety-withdefault.rs b/src/test/ui/unsized-locals/by-value-trait-object-safety-withdefault.rs index 8b39a99da582e..487061b7455c5 100644 --- a/src/test/ui/unsized-locals/by-value-trait-object-safety-withdefault.rs +++ b/src/test/ui/unsized-locals/by-value-trait-object-safety-withdefault.rs @@ -1,5 +1,6 @@ // run-pass +#![allow(incomplete_features)] #![feature(unsized_locals)] pub trait Foo { @@ -12,7 +13,6 @@ struct A; impl Foo for A {} - fn main() { let x = *(Box::new(A) as Box); assert_eq!(x.foo(), format!("hello")); diff --git a/src/test/ui/unsized-locals/by-value-trait-object-safety.rs b/src/test/ui/unsized-locals/by-value-trait-object-safety.rs index 8b24328bd3854..93b22d990ca00 100644 --- a/src/test/ui/unsized-locals/by-value-trait-object-safety.rs +++ b/src/test/ui/unsized-locals/by-value-trait-object-safety.rs @@ -1,7 +1,10 @@ #![feature(unsized_locals)] +//~^ WARN the feature `unsized_locals` is incomplete and may cause the compiler to crash pub trait Foo { - fn foo(self) -> String where Self: Sized; + fn foo(self) -> String + where + Self: Sized; } struct A; @@ -12,7 +15,6 @@ impl Foo for A { } } - fn main() { let x = *(Box::new(A) as Box); x.foo(); diff --git a/src/test/ui/unsized-locals/by-value-trait-object-safety.stderr b/src/test/ui/unsized-locals/by-value-trait-object-safety.stderr index 4cd2098eef256..fe20190e2f5bf 100644 --- a/src/test/ui/unsized-locals/by-value-trait-object-safety.stderr +++ b/src/test/ui/unsized-locals/by-value-trait-object-safety.stderr @@ -1,11 +1,19 @@ +warning: the feature `unsized_locals` is incomplete and may cause the compiler to crash + --> $DIR/by-value-trait-object-safety.rs:1:12 + | +LL | #![feature(unsized_locals)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + error: the `foo` method cannot be invoked on a trait object - --> $DIR/by-value-trait-object-safety.rs:18:7 + --> $DIR/by-value-trait-object-safety.rs:20:7 | -LL | fn foo(self) -> String where Self: Sized; - | ----- this has a `Sized` requirement +LL | Self: Sized; + | ----- this has a `Sized` requirement ... LL | x.foo(); | ^^^ -error: aborting due to previous error +error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/unsized-locals/double-move.rs b/src/test/ui/unsized-locals/double-move.rs index c3a50341bc962..a44628c1cb9dc 100644 --- a/src/test/ui/unsized-locals/double-move.rs +++ b/src/test/ui/unsized-locals/double-move.rs @@ -1,4 +1,5 @@ #![feature(unsized_locals)] +//~^ WARN the feature `unsized_locals` is incomplete and may cause the compiler to crash pub trait Foo { fn foo(self) -> String; diff --git a/src/test/ui/unsized-locals/double-move.stderr b/src/test/ui/unsized-locals/double-move.stderr index 5b936fb64474f..76b8267640065 100644 --- a/src/test/ui/unsized-locals/double-move.stderr +++ b/src/test/ui/unsized-locals/double-move.stderr @@ -1,5 +1,13 @@ +warning: the feature `unsized_locals` is incomplete and may cause the compiler to crash + --> $DIR/double-move.rs:1:12 + | +LL | #![feature(unsized_locals)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + error[E0382]: use of moved value: `y` - --> $DIR/double-move.rs:20:22 + --> $DIR/double-move.rs:21:22 | LL | let y = *x; | - move occurs because `y` has type `str`, which does not implement the `Copy` trait @@ -9,7 +17,7 @@ LL | drop_unsized(y); | ^ value used here after move error[E0382]: use of moved value: `x` - --> $DIR/double-move.rs:26:22 + --> $DIR/double-move.rs:27:22 | LL | let _y = *x; | -- value moved here @@ -19,7 +27,7 @@ LL | drop_unsized(x); = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait error[E0382]: use of moved value: `*x` - --> $DIR/double-move.rs:32:18 + --> $DIR/double-move.rs:33:18 | LL | let x = "hello".to_owned().into_boxed_str(); | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -29,7 +37,7 @@ LL | let _y = *x; | ^^ value used here after move error[E0382]: use of moved value: `y` - --> $DIR/double-move.rs:39:9 + --> $DIR/double-move.rs:40:9 | LL | let y = *x; | - move occurs because `y` has type `str`, which does not implement the `Copy` trait @@ -39,7 +47,7 @@ LL | y.foo(); | ^ value used here after move error[E0382]: use of moved value: `x` - --> $DIR/double-move.rs:45:9 + --> $DIR/double-move.rs:46:9 | LL | let _y = *x; | -- value moved here @@ -49,7 +57,7 @@ LL | x.foo(); = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait error[E0382]: use of moved value: `*x` - --> $DIR/double-move.rs:51:18 + --> $DIR/double-move.rs:52:18 | LL | let x = "hello".to_owned().into_boxed_str(); | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -58,6 +66,6 @@ LL | x.foo(); LL | let _y = *x; | ^^ value used here after move -error: aborting due to 6 previous errors +error: aborting due to 6 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/unsized-locals/issue-50940-with-feature.rs b/src/test/ui/unsized-locals/issue-50940-with-feature.rs index 3e5d39ab31150..d7d7720d00235 100644 --- a/src/test/ui/unsized-locals/issue-50940-with-feature.rs +++ b/src/test/ui/unsized-locals/issue-50940-with-feature.rs @@ -1,4 +1,5 @@ #![feature(unsized_locals)] +//~^ WARN the feature `unsized_locals` is incomplete and may cause the compiler to crash fn main() { struct A(X); diff --git a/src/test/ui/unsized-locals/issue-50940-with-feature.stderr b/src/test/ui/unsized-locals/issue-50940-with-feature.stderr index 7b6c2d11ea169..9310b672beb64 100644 --- a/src/test/ui/unsized-locals/issue-50940-with-feature.stderr +++ b/src/test/ui/unsized-locals/issue-50940-with-feature.stderr @@ -1,5 +1,13 @@ +warning: the feature `unsized_locals` is incomplete and may cause the compiler to crash + --> $DIR/issue-50940-with-feature.rs:1:12 + | +LL | #![feature(unsized_locals)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/issue-50940-with-feature.rs:5:5 + --> $DIR/issue-50940-with-feature.rs:6:5 | LL | A as fn(str) -> A; | ^ doesn't have a size known at compile-time @@ -9,6 +17,6 @@ LL | A as fn(str) -> A; = note: required because it appears within the type `main::A` = note: the return type of a function must have a statically known size -error: aborting due to previous error +error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/unsized-locals/reference-unsized-locals.rs b/src/test/ui/unsized-locals/reference-unsized-locals.rs index 1560d25d4b0de..4e887f32753f1 100644 --- a/src/test/ui/unsized-locals/reference-unsized-locals.rs +++ b/src/test/ui/unsized-locals/reference-unsized-locals.rs @@ -1,5 +1,6 @@ // run-pass +#![allow(incomplete_features)] #![feature(unsized_locals)] fn main() { diff --git a/src/test/ui/unsized-locals/simple-unsized-locals.rs b/src/test/ui/unsized-locals/simple-unsized-locals.rs index 059559192456d..02b7c299aa40a 100644 --- a/src/test/ui/unsized-locals/simple-unsized-locals.rs +++ b/src/test/ui/unsized-locals/simple-unsized-locals.rs @@ -1,5 +1,6 @@ // run-pass +#![allow(incomplete_features)] #![feature(unsized_locals)] fn main() { diff --git a/src/test/ui/unsized-locals/unsized-exprs-rpass.rs b/src/test/ui/unsized-locals/unsized-exprs-rpass.rs index 24c2758a0a255..40e52ce45ae75 100644 --- a/src/test/ui/unsized-locals/unsized-exprs-rpass.rs +++ b/src/test/ui/unsized-locals/unsized-exprs-rpass.rs @@ -1,5 +1,6 @@ // run-pass -#![allow(unused_braces, unused_parens)] + +#![allow(incomplete_features, unused_braces, unused_parens)] #![feature(unsized_tuple_coercion, unsized_locals)] struct A(X); @@ -24,12 +25,8 @@ fn main() { udrop::<[u8]>(loop { break *foo(); }); - udrop::<[u8]>(if true { - *foo() - } else { - *foo() - }); - udrop::<[u8]>({*foo()}); + udrop::<[u8]>(if true { *foo() } else { *foo() }); + udrop::<[u8]>({ *foo() }); udrop::<[u8]>((*foo())); udrop::<[u8]>((*tfoo()).1); *afoo() + 42; diff --git a/src/test/ui/unsized-locals/unsized-exprs.rs b/src/test/ui/unsized-locals/unsized-exprs.rs index 8ca88edcb6add..b0896955d1b09 100644 --- a/src/test/ui/unsized-locals/unsized-exprs.rs +++ b/src/test/ui/unsized-locals/unsized-exprs.rs @@ -1,4 +1,5 @@ #![feature(unsized_tuple_coercion, unsized_locals)] +//~^ WARN the feature `unsized_locals` is incomplete and may cause the compiler to crash struct A(X); diff --git a/src/test/ui/unsized-locals/unsized-exprs.stderr b/src/test/ui/unsized-locals/unsized-exprs.stderr index 43c35cdd7b5b0..0b2297d6c871b 100644 --- a/src/test/ui/unsized-locals/unsized-exprs.stderr +++ b/src/test/ui/unsized-locals/unsized-exprs.stderr @@ -1,5 +1,13 @@ +warning: the feature `unsized_locals` is incomplete and may cause the compiler to crash + --> $DIR/unsized-exprs.rs:1:36 + | +LL | #![feature(unsized_tuple_coercion, unsized_locals)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/unsized-exprs.rs:22:26 + --> $DIR/unsized-exprs.rs:23:26 | LL | udrop::<(i32, [u8])>((42, *foo())); | ^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -10,7 +18,7 @@ LL | udrop::<(i32, [u8])>((42, *foo())); = note: tuples must have a statically known size to be initialized error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/unsized-exprs.rs:24:22 + --> $DIR/unsized-exprs.rs:25:22 | LL | udrop::>(A { 0: *foo() }); | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -21,7 +29,7 @@ LL | udrop::>(A { 0: *foo() }); = note: structs must have a statically known size to be initialized error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/unsized-exprs.rs:26:22 + --> $DIR/unsized-exprs.rs:27:22 | LL | udrop::>(A(*foo())); | ^ doesn't have a size known at compile-time @@ -31,6 +39,6 @@ LL | udrop::>(A(*foo())); = note: required because it appears within the type `A<[u8]>` = note: the return type of a function must have a statically known size -error: aborting due to 3 previous errors +error: aborting due to 3 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/unsized-locals/unsized-exprs2.rs b/src/test/ui/unsized-locals/unsized-exprs2.rs index 534439aa6c41c..6ab73ad513546 100644 --- a/src/test/ui/unsized-locals/unsized-exprs2.rs +++ b/src/test/ui/unsized-locals/unsized-exprs2.rs @@ -1,4 +1,5 @@ #![feature(unsized_tuple_coercion, unsized_locals)] +//~^ WARN the feature `unsized_locals` is incomplete and may cause the compiler to crash struct A(X); diff --git a/src/test/ui/unsized-locals/unsized-exprs2.stderr b/src/test/ui/unsized-locals/unsized-exprs2.stderr index 88269f237afb7..09c9e50541d1d 100644 --- a/src/test/ui/unsized-locals/unsized-exprs2.stderr +++ b/src/test/ui/unsized-locals/unsized-exprs2.stderr @@ -1,5 +1,13 @@ +warning: the feature `unsized_locals` is incomplete and may cause the compiler to crash + --> $DIR/unsized-exprs2.rs:1:36 + | +LL | #![feature(unsized_tuple_coercion, unsized_locals)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + error[E0508]: cannot move out of type `[u8]`, a non-copy slice - --> $DIR/unsized-exprs2.rs:22:5 + --> $DIR/unsized-exprs2.rs:23:5 | LL | udrop::<[u8]>(foo()[..]); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,6 +15,6 @@ LL | udrop::<[u8]>(foo()[..]); | cannot move out of here | move occurs because value has type `[u8]`, which does not implement the `Copy` trait -error: aborting due to previous error +error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0508`. diff --git a/src/test/ui/unsized-locals/unsized-index.rs b/src/test/ui/unsized-locals/unsized-index.rs index 19ad97a853e83..88d05fb936acb 100644 --- a/src/test/ui/unsized-locals/unsized-index.rs +++ b/src/test/ui/unsized-locals/unsized-index.rs @@ -5,6 +5,7 @@ // Tightening the bound now could be a breaking change. Although no crater // regression were observed (https://github.com/rust-lang/rust/pull/59527), // let's be conservative and just add a test for this. +#![allow(incomplete_features)] #![feature(unsized_locals)] use std::ops; @@ -13,11 +14,15 @@ pub struct A; impl ops::Index for A { type Output = (); - fn index(&self, _: str) -> &Self::Output { panic!() } + fn index(&self, _: str) -> &Self::Output { + panic!() + } } impl ops::IndexMut for A { - fn index_mut(&mut self, _: str) -> &mut Self::Output { panic!() } + fn index_mut(&mut self, _: str) -> &mut Self::Output { + panic!() + } } fn main() {} diff --git a/src/test/ui/unsized-locals/unsized-parameters.rs b/src/test/ui/unsized-locals/unsized-parameters.rs index 3624154d5c44c..cdc53195e27a7 100644 --- a/src/test/ui/unsized-locals/unsized-parameters.rs +++ b/src/test/ui/unsized-locals/unsized-parameters.rs @@ -1,5 +1,6 @@ // run-pass +#![allow(incomplete_features)] #![feature(unsized_locals)] pub fn f0(_f: dyn FnOnce()) {}