Skip to content

Commit 1e3486f

Browse files
committed
Add regression test for #127424
1 parent 8fb32ab commit 1e3486f

File tree

2 files changed

+199
-0
lines changed

2 files changed

+199
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// compile-fail
2+
// Regression test for issue #127424
3+
4+
fn bar() -> impl Into<
5+
[u8; {
6+
//~^ ERROR mismatched types [E0308]
7+
f_t(&*s);
8+
//~^ ERROR cannot find function `f_t` in this scope [E0425]
9+
//~| ERROR cannot find value `s` in this scope [E0425]
10+
11+
c(&*s);
12+
//~^ ERROR cannot find function `c` in this scope [E0425]
13+
//~| ERROR cannot find value `s` in this scope [E0425]
14+
15+
c(&*s);
16+
//~^ ERROR cannot find function `c` in this scope [E0425]
17+
//~| ERROR cannot find value `s` in this scope [E0425]
18+
19+
struct X;
20+
21+
c1(*x);
22+
//~^ ERROR cannot find function `c1` in this scope [E0425]
23+
//~| ERROR cannot find value `x` in this scope [E0425]
24+
25+
let _ = for<'a, 'b> |x: &'a &'a Vec<&'b u32>, b: bool| -> &'a Vec<&'b u32> { *x };
26+
//~^ ERROR `for<...>` binders for closures are experimental [E0658]
27+
}],
28+
> {
29+
[99]
30+
}
31+
//~^ ERROR `main` function not found in crate `const_generics_closure` [E0601]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
error[E0425]: cannot find function `f_t` in this scope
2+
--> $DIR/const-generics-closure.rs:7:9
3+
|
4+
LL | f_t(&*s);
5+
| ^^^ not found in this scope
6+
|
7+
help: you might be missing a const parameter
8+
|
9+
LL | fn bar<const f_t: /* Type */>() -> impl Into<
10+
| +++++++++++++++++++++++
11+
12+
error[E0425]: cannot find value `s` in this scope
13+
--> $DIR/const-generics-closure.rs:7:15
14+
|
15+
LL | f_t(&*s);
16+
| ^
17+
...
18+
LL | struct X;
19+
| --------- similarly named unit struct `X` defined here
20+
|
21+
help: a unit struct with a similar name exists
22+
|
23+
LL - f_t(&*s);
24+
LL + f_t(&*X);
25+
|
26+
help: you might be missing a const parameter
27+
|
28+
LL | fn bar<const s: /* Type */>() -> impl Into<
29+
| +++++++++++++++++++++
30+
31+
error[E0425]: cannot find function `c` in this scope
32+
--> $DIR/const-generics-closure.rs:11:9
33+
|
34+
LL | c(&*s);
35+
| ^
36+
...
37+
LL | struct X;
38+
| --------- similarly named unit struct `X` defined here
39+
|
40+
help: a unit struct with a similar name exists
41+
|
42+
LL - c(&*s);
43+
LL + X(&*s);
44+
|
45+
help: you might be missing a const parameter
46+
|
47+
LL | fn bar<const c: /* Type */>() -> impl Into<
48+
| +++++++++++++++++++++
49+
50+
error[E0425]: cannot find value `s` in this scope
51+
--> $DIR/const-generics-closure.rs:11:13
52+
|
53+
LL | c(&*s);
54+
| ^
55+
...
56+
LL | struct X;
57+
| --------- similarly named unit struct `X` defined here
58+
|
59+
help: a unit struct with a similar name exists
60+
|
61+
LL - c(&*s);
62+
LL + c(&*X);
63+
|
64+
help: you might be missing a const parameter
65+
|
66+
LL | fn bar<const s: /* Type */>() -> impl Into<
67+
| +++++++++++++++++++++
68+
69+
error[E0425]: cannot find function `c` in this scope
70+
--> $DIR/const-generics-closure.rs:15:9
71+
|
72+
LL | c(&*s);
73+
| ^
74+
...
75+
LL | struct X;
76+
| --------- similarly named unit struct `X` defined here
77+
|
78+
help: a unit struct with a similar name exists
79+
|
80+
LL - c(&*s);
81+
LL + X(&*s);
82+
|
83+
help: you might be missing a const parameter
84+
|
85+
LL | fn bar<const c: /* Type */>() -> impl Into<
86+
| +++++++++++++++++++++
87+
88+
error[E0425]: cannot find value `s` in this scope
89+
--> $DIR/const-generics-closure.rs:15:13
90+
|
91+
LL | c(&*s);
92+
| ^
93+
...
94+
LL | struct X;
95+
| --------- similarly named unit struct `X` defined here
96+
|
97+
help: a unit struct with a similar name exists
98+
|
99+
LL - c(&*s);
100+
LL + c(&*X);
101+
|
102+
help: you might be missing a const parameter
103+
|
104+
LL | fn bar<const s: /* Type */>() -> impl Into<
105+
| +++++++++++++++++++++
106+
107+
error[E0425]: cannot find function `c1` in this scope
108+
--> $DIR/const-generics-closure.rs:21:9
109+
|
110+
LL | c1(*x);
111+
| ^^ not found in this scope
112+
|
113+
help: you might be missing a const parameter
114+
|
115+
LL | fn bar<const c1: /* Type */>() -> impl Into<
116+
| ++++++++++++++++++++++
117+
118+
error[E0425]: cannot find value `x` in this scope
119+
--> $DIR/const-generics-closure.rs:21:13
120+
|
121+
LL | struct X;
122+
| --------- similarly named unit struct `X` defined here
123+
LL |
124+
LL | c1(*x);
125+
| ^
126+
|
127+
help: a unit struct with a similar name exists (notice the capitalization difference)
128+
|
129+
LL - c1(*x);
130+
LL + c1(*X);
131+
|
132+
help: you might be missing a const parameter
133+
|
134+
LL | fn bar<const x: /* Type */>() -> impl Into<
135+
| +++++++++++++++++++++
136+
137+
error[E0658]: `for<...>` binders for closures are experimental
138+
--> $DIR/const-generics-closure.rs:25:17
139+
|
140+
LL | let _ = for<'a, 'b> |x: &'a &'a Vec<&'b u32>, b: bool| -> &'a Vec<&'b u32> { *x };
141+
| ^^^^^^^^^^^
142+
|
143+
= note: see issue #97362 <https://github.com/rust-lang/rust/issues/97362> for more information
144+
= help: add `#![feature(closure_lifetime_binder)]` to the crate attributes to enable
145+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
146+
= help: consider removing `for<...>`
147+
148+
error[E0601]: `main` function not found in crate `const_generics_closure`
149+
--> $DIR/const-generics-closure.rs:30:2
150+
|
151+
LL | }
152+
| ^ consider adding a `main` function to `$DIR/const-generics-closure.rs`
153+
154+
error[E0308]: mismatched types
155+
--> $DIR/const-generics-closure.rs:5:10
156+
|
157+
LL | [u8; {
158+
| __________^
159+
LL | |
160+
LL | | f_t(&*s);
161+
... |
162+
LL | | }],
163+
| |_____^ expected `usize`, found `()`
164+
165+
error: aborting due to 11 previous errors
166+
167+
Some errors have detailed explanations: E0308, E0425, E0601, E0658.
168+
For more information about an error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)