Add unsized_locals to INCOMPLETE_FEATURES list

This commit is contained in:
Santiago Pastorino 2020-10-16 19:37:54 -03:00
parent 708fc3b1a2
commit 953d7a64a5
No known key found for this signature in database
GPG key ID: 8131A24E0C79EFAF
28 changed files with 156 additions and 58 deletions

View file

@ -632,6 +632,7 @@ pub const INCOMPLETE_FEATURES: &[Symbol] = &[
sym::specialization,
sym::inline_const,
sym::repr128,
sym::unsized_locals,
];
/// Some features are not allowed to be used together at the same time, if

View file

@ -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]>) {

View file

@ -1,4 +1,5 @@
#![feature(arbitrary_self_types, coerce_unsized, dispatch_from_dyn, unsize, unsized_locals, unsized_fn_params)]
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
// This tests a few edge-cases around `arbitrary_self_types`. Most specifically,
// it checks that the `ObjectCandidate` you get from method matching can't

View file

@ -1,5 +1,14 @@
warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
--> $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, unsized_fn_params)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
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 +16,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 +24,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 `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<Self, u64>) -> u64 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl of the trait `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 +58,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 +66,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 +74,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`.

View file

@ -1,4 +1,5 @@
#![feature(unsized_locals)]
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
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 @ .., _] => {}
_ => {}
}
}

View file

@ -1,51 +1,60 @@
warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/move-out-of-slice-2.rs:1:12
|
LL | #![feature(unsized_locals)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
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`.

View file

@ -1,5 +1,6 @@
// run-pass
#![allow(incomplete_features)]
#![feature(unsized_locals, unsized_fn_params)]
pub trait Foo {

View file

@ -1,4 +1,5 @@
#![feature(unsized_locals, unsized_fn_params)]
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
pub trait Foo {
fn foo(self) -> String;

View file

@ -1,5 +1,14 @@
warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/borrow-after-move.rs:1:12
|
LL | #![feature(unsized_locals, unsized_fn_params)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
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 +19,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 +30,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 +41,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,13 +52,13 @@ LL | println!("{}", &y);
| ^^ value borrowed here after move
|
note: this function consumes the receiver `self` by taking ownership of it, which moves `y`
--> $DIR/borrow-after-move.rs:4:12
--> $DIR/borrow-after-move.rs:5:12
|
LL | fn foo(self) -> String;
| ^^^^
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 `Box<str>`, which does not implement the `Copy` trait
@ -58,6 +67,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`.

View file

@ -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<dyn Foo>);
assert_eq!(x.foo(), format!("hello"));

View file

@ -1,5 +1,6 @@
// run-pass
#![allow(incomplete_features)]
#![feature(unsized_locals, unsized_fn_params)]
pub trait Foo {

View file

@ -1,7 +1,10 @@
#![feature(unsized_locals)]
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
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<dyn Foo>);
x.foo();

View file

@ -1,11 +1,20 @@
error: the `foo` method cannot be invoked on a trait object
--> $DIR/by-value-trait-object-safety.rs:18:7
warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/by-value-trait-object-safety.rs:1:12
|
LL | fn foo(self) -> String where Self: Sized;
| ----- this has a `Sized` requirement
LL | #![feature(unsized_locals)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
error: the `foo` method cannot be invoked on a trait object
--> $DIR/by-value-trait-object-safety.rs:20:7
|
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

View file

@ -1,4 +1,5 @@
#![feature(unsized_locals, unsized_fn_params)]
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
pub trait Foo {
fn foo(self) -> String;

View file

@ -1,5 +1,14 @@
warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/double-move.rs:1:12
|
LL | #![feature(unsized_locals, unsized_fn_params)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
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 +18,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 +28,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 `Box<str>`, which does not implement the `Copy` trait
@ -29,7 +38,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,13 +48,13 @@ LL | y.foo();
| ^ value used here after move
|
note: this function consumes the receiver `self` by taking ownership of it, which moves `y`
--> $DIR/double-move.rs:4:12
--> $DIR/double-move.rs:5:12
|
LL | fn foo(self) -> String;
| ^^^^
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
@ -55,7 +64,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 `Box<str>`, which does not implement the `Copy` trait
@ -64,6 +73,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`.

View file

@ -1,4 +1,5 @@
#![feature(unsized_locals)]
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
struct Test([i32]);

View file

@ -1,5 +1,14 @@
warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-30276-feature-flagged.rs:1:12
|
LL | #![feature(unsized_locals)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
--> $DIR/issue-30276-feature-flagged.rs:6:29
--> $DIR/issue-30276-feature-flagged.rs:7:29
|
LL | let _x: fn(_) -> Test = Test;
| ^^^^ doesn't have a size known at compile-time
@ -8,6 +17,6 @@ LL | let _x: fn(_) -> Test = Test;
= note: all function arguments must have a statically known size
= help: unsized fn params are gated as an unstable feature
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`.

View file

@ -1,4 +1,5 @@
#![feature(unsized_locals, unsized_fn_params)]
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
fn main() {
struct A<X: ?Sized>(X);

View file

@ -1,5 +1,14 @@
warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-50940-with-feature.rs:1:12
|
LL | #![feature(unsized_locals, unsized_fn_params)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
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<str>;
| ^ doesn't have a size known at compile-time
@ -8,6 +17,6 @@ LL | A as fn(str) -> A<str>;
= note: required because it appears within the type `A<str>`
= 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`.

View file

@ -1,5 +1,6 @@
// run-pass
#![allow(incomplete_features)]
#![feature(unsized_locals)]
fn main() {

View file

@ -1,5 +1,6 @@
// run-pass
#![allow(incomplete_features)]
#![feature(unsized_locals)]
fn main() {

View file

@ -1,5 +1,5 @@
// run-pass
#![allow(unused_braces, unused_parens)]
#![allow(incomplete_features, unused_braces, unused_parens)]
#![feature(unsized_tuple_coercion, unsized_locals, unsized_fn_params)]
struct A<X: ?Sized>(X);

View file

@ -1,4 +1,5 @@
#![feature(unsized_tuple_coercion, unsized_locals, unsized_fn_params)]
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
struct A<X: ?Sized>(X);

View file

@ -1,5 +1,14 @@
warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/unsized-exprs.rs:1:36
|
LL | #![feature(unsized_tuple_coercion, unsized_locals, unsized_fn_params)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
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
@ -9,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<[u8]>>(A { 0: *foo() });
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
@ -19,7 +28,7 @@ LL | udrop::<A<[u8]>>(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<[u8]>>(A(*foo()));
| ^ doesn't have a size known at compile-time
@ -28,6 +37,6 @@ LL | udrop::<A<[u8]>>(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`.

View file

@ -1,4 +1,5 @@
#![feature(unsized_tuple_coercion, unsized_locals, unsized_fn_params)]
//~^ WARN the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features]
struct A<X: ?Sized>(X);

View file

@ -1,5 +1,14 @@
warning: the feature `unsized_locals` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/unsized-exprs2.rs:1:36
|
LL | #![feature(unsized_tuple_coercion, unsized_locals, unsized_fn_params)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #48055 <https://github.com/rust-lang/rust/issues/48055> for more information
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 +16,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`.

View file

@ -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, unsized_fn_params)]
use std::ops;

View file

@ -1,5 +1,6 @@
// run-pass
#![allow(incomplete_features)]
#![feature(unsized_locals, unsized_fn_params)]
pub fn f0(_f: dyn FnOnce()) {}