diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/closures/issue-112547.rs | 15 | ||||
| -rw-r--r-- | tests/ui/parser/generic-param-default-in-binder.rs | 10 | ||||
| -rw-r--r-- | tests/ui/parser/issue-119042.rs | 7 | ||||
| -rw-r--r-- | tests/ui/traits/non_lifetime_binders/binder-defaults-112547.rs | 16 | ||||
| -rw-r--r-- | tests/ui/traits/non_lifetime_binders/binder-defaults-112547.stderr (renamed from tests/ui/closures/issue-112547.stderr) | 15 | ||||
| -rw-r--r-- | tests/ui/traits/non_lifetime_binders/binder-defaults-118697.rs (renamed from tests/ui/traits/non_lifetime_binders/issue-118697.rs) | 2 | ||||
| -rw-r--r-- | tests/ui/traits/non_lifetime_binders/binder-defaults-118697.stderr (renamed from tests/ui/traits/non_lifetime_binders/issue-118697.stderr) | 12 | ||||
| -rw-r--r-- | tests/ui/traits/non_lifetime_binders/binder-defaults-119489.rs | 12 | ||||
| -rw-r--r-- | tests/ui/traits/non_lifetime_binders/binder-defaults-119489.stderr | 31 | 
9 files changed, 88 insertions, 32 deletions
| diff --git a/tests/ui/closures/issue-112547.rs b/tests/ui/closures/issue-112547.rs deleted file mode 100644 index 8ecb2abccd4..00000000000 --- a/tests/ui/closures/issue-112547.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![feature(non_lifetime_binders)] - //~^ WARNING the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - -pub fn bar() -where - for<const N: usize = { - (||1usize)() -}> V: IntoIterator -//~^ ERROR cannot find type `V` in this scope [E0412] -{ -} - -fn main() { - bar(); -} diff --git a/tests/ui/parser/generic-param-default-in-binder.rs b/tests/ui/parser/generic-param-default-in-binder.rs new file mode 100644 index 00000000000..78dc4186b3a --- /dev/null +++ b/tests/ui/parser/generic-param-default-in-binder.rs @@ -0,0 +1,10 @@ +// Check that defaults for generic parameters in `for<...>` binders are +// syntactically valid. See also PR #119042. + +// check-pass + +macro_rules! a { ($ty:ty) => {} } + +a! { for<T = &i32> fn() } + +fn main() {} diff --git a/tests/ui/parser/issue-119042.rs b/tests/ui/parser/issue-119042.rs deleted file mode 100644 index a4fee169d1c..00000000000 --- a/tests/ui/parser/issue-119042.rs +++ /dev/null @@ -1,7 +0,0 @@ -// check-pass - -macro_rules! a { ($ty:ty) => {} } - -a! { for<T = &i32> fn() } - -fn main() {} diff --git a/tests/ui/traits/non_lifetime_binders/binder-defaults-112547.rs b/tests/ui/traits/non_lifetime_binders/binder-defaults-112547.rs new file mode 100644 index 00000000000..c6bf0dc1f72 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/binder-defaults-112547.rs @@ -0,0 +1,16 @@ +#![feature(non_lifetime_binders)] +//~^ WARN the feature `non_lifetime_binders` is incomplete + +pub fn bar() +where + for<const N: usize = { + (||1usize)() +}> V: IntoIterator +//~^^^ ERROR defaults for generic parameters are not allowed in `for<...>` binders +//~^^ ERROR cannot find type `V` in this scope +{ +} + +fn main() { + bar(); +} diff --git a/tests/ui/closures/issue-112547.stderr b/tests/ui/traits/non_lifetime_binders/binder-defaults-112547.stderr index f47ea607297..edc55a3c8e6 100644 --- a/tests/ui/closures/issue-112547.stderr +++ b/tests/ui/traits/non_lifetime_binders/binder-defaults-112547.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `V` in this scope - --> $DIR/issue-112547.rs:8:4 + --> $DIR/binder-defaults-112547.rs:8:4 | LL | }> V: IntoIterator | ^ not found in this scope @@ -10,7 +10,7 @@ LL | pub fn bar<V>() | +++ warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-112547.rs:1:12 + --> $DIR/binder-defaults-112547.rs:1:12 | LL | #![feature(non_lifetime_binders)] | ^^^^^^^^^^^^^^^^^^^^ @@ -18,6 +18,15 @@ LL | #![feature(non_lifetime_binders)] = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information = note: `#[warn(incomplete_features)]` on by default -error: aborting due to 1 previous error; 1 warning emitted +error: defaults for generic parameters are not allowed in `for<...>` binders + --> $DIR/binder-defaults-112547.rs:6:9 + | +LL | for<const N: usize = { + | _________^ +LL | | (||1usize)() +LL | | }> V: IntoIterator + | |_^ + +error: aborting due to 2 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/traits/non_lifetime_binders/issue-118697.rs b/tests/ui/traits/non_lifetime_binders/binder-defaults-118697.rs index a282d0c5a40..2dc9fb98b15 100644 --- a/tests/ui/traits/non_lifetime_binders/issue-118697.rs +++ b/tests/ui/traits/non_lifetime_binders/binder-defaults-118697.rs @@ -2,7 +2,7 @@ #![feature(non_lifetime_binders)] type T = dyn for<V = A(&())> Fn(()); -//~^ ERROR default parameter is not allowed in this binder +//~^ ERROR defaults for generic parameters are not allowed in `for<...>` binders //~| ERROR cannot find type `A` in this scope //~| ERROR late-bound type parameter not allowed on trait object types diff --git a/tests/ui/traits/non_lifetime_binders/issue-118697.stderr b/tests/ui/traits/non_lifetime_binders/binder-defaults-118697.stderr index 52ce568d69d..6b93f52dbfc 100644 --- a/tests/ui/traits/non_lifetime_binders/issue-118697.stderr +++ b/tests/ui/traits/non_lifetime_binders/binder-defaults-118697.stderr @@ -1,20 +1,20 @@ error[E0412]: cannot find type `A` in this scope - --> $DIR/issue-118697.rs:4:22 + --> $DIR/binder-defaults-118697.rs:4:22 | LL | type T = dyn for<V = A(&())> Fn(()); | ^ not found in this scope -error: default parameter is not allowed in this binder - --> $DIR/issue-118697.rs:4:22 +error: defaults for generic parameters are not allowed in `for<...>` binders + --> $DIR/binder-defaults-118697.rs:4:18 | LL | type T = dyn for<V = A(&())> Fn(()); - | ^^^^^^ + | ^^^^^^^^^^ error: late-bound type parameter not allowed on trait object types - --> $DIR/issue-118697.rs:4:18 + --> $DIR/binder-defaults-118697.rs:4:18 | LL | type T = dyn for<V = A(&())> Fn(()); - | ^ + | ^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/tests/ui/traits/non_lifetime_binders/binder-defaults-119489.rs b/tests/ui/traits/non_lifetime_binders/binder-defaults-119489.rs new file mode 100644 index 00000000000..f33da416ad8 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/binder-defaults-119489.rs @@ -0,0 +1,12 @@ +#![feature(non_lifetime_binders, generic_const_exprs)] +//~^ WARN the feature `non_lifetime_binders` is incomplete +//~| WARN the feature `generic_const_exprs` is incomplete + +fn fun() +where + for<T = (), const N: usize = 1> ():, +//~^ ERROR defaults for generic parameters are not allowed in `for<...>` binders +//~| ERROR defaults for generic parameters are not allowed in `for<...>` binders +{} + +fn main() {} diff --git a/tests/ui/traits/non_lifetime_binders/binder-defaults-119489.stderr b/tests/ui/traits/non_lifetime_binders/binder-defaults-119489.stderr new file mode 100644 index 00000000000..7fe82f1f097 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/binder-defaults-119489.stderr @@ -0,0 +1,31 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/binder-defaults-119489.rs:1:12 + | +LL | #![feature(non_lifetime_binders, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/binder-defaults-119489.rs:1:34 + | +LL | #![feature(non_lifetime_binders, generic_const_exprs)] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information + +error: defaults for generic parameters are not allowed in `for<...>` binders + --> $DIR/binder-defaults-119489.rs:7:9 + | +LL | for<T = (), const N: usize = 1> ():, + | ^^^^^^ + +error: defaults for generic parameters are not allowed in `for<...>` binders + --> $DIR/binder-defaults-119489.rs:7:17 + | +LL | for<T = (), const N: usize = 1> ():, + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors; 2 warnings emitted + | 
