Skip to content

Commit 1c7a472

Browse files
committed
Bless and add closure lifetime binder tests
1 parent 27e1e8f commit 1c7a472

21 files changed

+86
-73
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![feature(generic_arg_infer, closure_lifetime_binder)]
2+
3+
struct Foo<const N: usize>([u32; N]);
4+
5+
fn main() {
6+
let c = for<'a> |b: &'a Foo<_>| -> u32 { b.0[0] };
7+
//~^ ERROR: implicit types in closure signatures are forbidden when `for<...>` is present
8+
c(&Foo([1_u32; 1]));
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: implicit types in closure signatures are forbidden when `for<...>` is present
2+
--> $DIR/forbid_ambig_const_infers.rs:6:33
3+
|
4+
LL | let c = for<'a> |b: &'a Foo<_>| -> u32 { b.0[0] };
5+
| ------- ^
6+
| |
7+
| `for<...>` is here
8+
9+
error: aborting due to 1 previous error
10+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![feature(generic_arg_infer, closure_lifetime_binder)]
2+
3+
struct Foo<T>(T);
4+
5+
fn main() {
6+
let c = for<'a> |b: &'a Foo<_>| -> u32 { b.0 };
7+
//~^ ERROR: implicit types in closure signatures are forbidden when `for<...>` is present
8+
c(&Foo(1_u32));
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: implicit types in closure signatures are forbidden when `for<...>` is present
2+
--> $DIR/forbid_ambig_type_infers.rs:6:33
3+
|
4+
LL | let c = for<'a> |b: &'a Foo<_>| -> u32 { b.0 };
5+
| ------- ^
6+
| |
7+
| `for<...>` is here
8+
9+
error: aborting due to 1 previous error
10+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![feature(generic_arg_infer, closure_lifetime_binder)]
2+
3+
fn main() {
4+
let c = for<'a> |b: &'a [u32; _]| -> u32 { b[0] };
5+
//~^ ERROR: implicit types in closure signatures are forbidden when `for<...>` is present
6+
c(&[1_u32; 2]);
7+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: implicit types in closure signatures are forbidden when `for<...>` is present
2+
--> $DIR/forbid_const_infer.rs:4:35
3+
|
4+
LL | let c = for<'a> |b: &'a [u32; _]| -> u32 { b[0] };
5+
| ------- ^
6+
| |
7+
| `for<...>` is here
8+
9+
error: aborting due to 1 previous error
10+

tests/ui/const-generics/issues/issue-62878.min.stderr

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,17 @@ help: add `#![feature(adt_const_params)]` to the crate attributes to enable more
1818
LL + #![feature(adt_const_params)]
1919
|
2020

21-
error[E0747]: type provided when a constant was expected
21+
error[E0658]: const arguments cannot yet be inferred with `_`
2222
--> $DIR/issue-62878.rs:10:11
2323
|
2424
LL | foo::<_, { [1] }>();
2525
| ^
2626
|
27-
= help: const arguments cannot yet be inferred with `_`
28-
help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
29-
|
30-
LL + #![feature(generic_arg_infer)]
31-
|
27+
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
28+
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
29+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3230

3331
error: aborting due to 3 previous errors
3432

35-
Some errors have detailed explanations: E0747, E0770.
36-
For more information about an error, try `rustc --explain E0747`.
33+
Some errors have detailed explanations: E0658, E0770.
34+
For more information about an error, try `rustc --explain E0658`.

tests/ui/const-generics/issues/issue-62878.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ fn foo<const N: usize, const A: [u8; N]>() {}
88

99
fn main() {
1010
foo::<_, { [1] }>();
11-
//[min]~^ ERROR: type provided when a constant was expected
11+
//[min]~^ ERROR: const arguments cannot yet be inferred with `_`
1212
}

tests/ui/did_you_mean/bad-assoc-ty.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,6 @@ LL | fn foo<X: K<_, _>>(x: X) {}
233233
| ^ ^ not allowed in type signatures
234234
| |
235235
| not allowed in type signatures
236-
|
237-
help: use type parameters instead
238-
|
239-
LL | fn foo<X: K<T, T>, T>(x: X) {}
240-
| ~ ~ +++
241236

242237
error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
243238
--> $DIR/bad-assoc-ty.rs:54:34

tests/ui/feature-gates/feature-gate-generic_arg_infer.normal.stderr

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@ LL | let _y: [u8; _] = [0; 3];
88
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010

11-
error[E0747]: type provided when a constant was expected
11+
error[E0658]: const arguments cannot yet be inferred with `_`
1212
--> $DIR/feature-gate-generic_arg_infer.rs:18:20
1313
|
14-
LL | let _x = foo::<_>([1,2]);
14+
LL | let _x = foo::<_>([1, 2]);
1515
| ^
1616
|
17-
= help: const arguments cannot yet be inferred with `_`
18-
help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
19-
|
20-
LL + #![feature(generic_arg_infer)]
21-
|
17+
= note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information
18+
= help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
19+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2220

2321
error[E0658]: using `_` for array lengths is unstable
2422
--> $DIR/feature-gate-generic_arg_infer.rs:11:27
@@ -32,5 +30,4 @@ LL | let _x: [u8; 3] = [0; _];
3230

3331
error: aborting due to 3 previous errors
3432

35-
Some errors have detailed explanations: E0658, E0747.
36-
For more information about an error, try `rustc --explain E0658`.
33+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)