Skip to content

Commit 561c4ec

Browse files
committed
refactor test
1 parent dc58bc6 commit 561c4ec

File tree

2 files changed

+7
-161
lines changed

2 files changed

+7
-161
lines changed

tests/ui/const-generics/generic_const_exprs/const-generics-closure.rs

+1-19
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,10 @@
33
fn bar() -> impl Into<
44
[u8; {
55
//~^ ERROR mismatched types [E0308]
6-
f_t(&*s);
7-
//~^ ERROR cannot find function `f_t` in this scope [E0425]
8-
//~| ERROR cannot find value `s` in this scope [E0425]
9-
10-
c(&*s);
11-
//~^ ERROR cannot find function `c` in this scope [E0425]
12-
//~| ERROR cannot find value `s` in this scope [E0425]
13-
14-
c(&*s);
15-
//~^ ERROR cannot find function `c` in this scope [E0425]
16-
//~| ERROR cannot find value `s` in this scope [E0425]
17-
18-
struct X;
19-
20-
c1(*x);
21-
//~^ ERROR cannot find function `c1` in this scope [E0425]
22-
//~| ERROR cannot find value `x` in this scope [E0425]
23-
246
let _ = for<'a, 'b> |x: &'a &'a Vec<&'b u32>, b: bool| -> &'a Vec<&'b u32> { *x };
257
//~^ ERROR `for<...>` binders for closures are experimental [E0658]
268
}],
279
> {
28-
[99]
10+
[89]
2911
}
3012
//~^ ERROR `main` function not found in crate `const_generics_closure` [E0601]
Original file line numberDiff line numberDiff line change
@@ -1,141 +1,5 @@
1-
error[E0425]: cannot find function `f_t` in this scope
2-
--> $DIR/const-generics-closure.rs:6: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:6: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:10: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:10: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:14: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:14: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:20: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:20: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-
1371
error[E0658]: `for<...>` binders for closures are experimental
138-
--> $DIR/const-generics-closure.rs:24:17
2+
--> $DIR/const-generics-closure.rs:6:17
1393
|
1404
LL | let _ = for<'a, 'b> |x: &'a &'a Vec<&'b u32>, b: bool| -> &'a Vec<&'b u32> { *x };
1415
| ^^^^^^^^^^^
@@ -146,7 +10,7 @@ LL | let _ = for<'a, 'b> |x: &'a &'a Vec<&'b u32>, b: bool| -> &'a Vec<&
14610
= help: consider removing `for<...>`
14711

14812
error[E0601]: `main` function not found in crate `const_generics_closure`
149-
--> $DIR/const-generics-closure.rs:29:2
13+
--> $DIR/const-generics-closure.rs:11:2
15014
|
15115
LL | }
15216
| ^ consider adding a `main` function to `$DIR/const-generics-closure.rs`
@@ -157,12 +21,12 @@ error[E0308]: mismatched types
15721
LL | [u8; {
15822
| __________^
15923
LL | |
160-
LL | | f_t(&*s);
161-
... |
24+
LL | | let _ = for<'a, 'b> |x: &'a &'a Vec<&'b u32>, b: bool| -> &'a Vec<&'b u32> { *x };
25+
LL | |
16226
LL | | }],
16327
| |_____^ expected `usize`, found `()`
16428

165-
error: aborting due to 11 previous errors
29+
error: aborting due to 3 previous errors
16630

167-
Some errors have detailed explanations: E0308, E0425, E0601, E0658.
31+
Some errors have detailed explanations: E0308, E0601, E0658.
16832
For more information about an error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)