Skip to content

Commit 42c5cfd

Browse files
committed
add the label back but make it shorter
1 parent 2ddc359 commit 42c5cfd

File tree

3 files changed

+34
-17
lines changed

3 files changed

+34
-17
lines changed

src/librustc_ast_passes/ast_validation.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -660,10 +660,11 @@ impl<'a> AstValidator<'a> {
660660
// ...and then error:
661661
self.err_handler()
662662
.struct_span_err(
663-
misplaced_args,
663+
misplaced_args.clone(),
664664
"generic arguments must come before the first constraint",
665665
)
666666
.span_label(first.unwrap(), "the first constraint is provided here")
667+
.span_labels(misplaced_args, "generic argument")
667668
.emit();
668669
}
669670
}

src/test/ui/parser/issue-32214.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: generic arguments must come before the first constraint
22
--> $DIR/issue-32214.rs:3:34
33
|
44
LL | pub fn test<W, I: Trait<Item=(), W> >() {}
5-
| ------- ^
5+
| ------- ^ generic argument
66
| |
77
| the first constraint is provided here
88

src/test/ui/suggestions/suggest-move-types.stderr

+31-15
Original file line numberDiff line numberDiff line change
@@ -2,64 +2,80 @@ error: generic arguments must come before the first constraint
22
--> $DIR/suggest-move-types.rs:26:26
33
|
44
LL | struct A<T, M: One<A=(), T>> {
5-
| ---- ^
5+
| ---- ^ generic argument
66
| |
77
| the first constraint is provided here
88

99
error: generic arguments must come before the first constraint
1010
--> $DIR/suggest-move-types.rs:33:43
1111
|
1212
LL | struct Al<'a, T, M: OneWithLifetime<A=(), T, 'a>> {
13-
| ---- ^ ^^
14-
| |
13+
| ---- ^ ^^ generic argument
14+
| | |
15+
| | generic argument
1516
| the first constraint is provided here
1617

1718
error: generic arguments must come before the first constraint
1819
--> $DIR/suggest-move-types.rs:40:46
1920
|
2021
LL | struct B<T, U, V, M: Three<A=(), B=(), C=(), T, U, V>> {
21-
| ---- ^ ^ ^
22-
| |
22+
| ---- ^ ^ ^ generic argument
23+
| | | |
24+
| | | generic argument
25+
| | generic argument
2326
| the first constraint is provided here
2427

2528
error: generic arguments must come before the first constraint
2629
--> $DIR/suggest-move-types.rs:48:71
2730
|
2831
LL | struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<A=(), B=(), C=(), T, U, V, 'a, 'b, 'c>> {
29-
| ---- ^ ^ ^ ^^ ^^ ^^
30-
| |
32+
| ---- ^ ^ ^ ^^ ^^ ^^ generic argument
33+
| | | | | | |
34+
| | | | | | generic argument
35+
| | | | | generic argument
36+
| | | | generic argument
37+
| | | generic argument
38+
| | generic argument
3139
| the first constraint is provided here
3240

3341
error: generic arguments must come before the first constraint
3442
--> $DIR/suggest-move-types.rs:57:49
3543
|
3644
LL | struct C<T, U, V, M: Three<T, A=(), B=(), C=(), U, V>> {
37-
| ---- ^ ^
38-
| |
45+
| ---- ^ ^ generic argument
46+
| | |
47+
| | generic argument
3948
| the first constraint is provided here
4049

4150
error: generic arguments must come before the first constraint
4251
--> $DIR/suggest-move-types.rs:65:78
4352
|
4453
LL | struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), C=(), U, 'b, V, 'c>> {
45-
| ---- ^ ^^ ^ ^^
46-
| |
54+
| ---- ^ ^^ ^ ^^ generic argument
55+
| | | | |
56+
| | | | generic argument
57+
| | | generic argument
58+
| | generic argument
4759
| the first constraint is provided here
4860

4961
error: generic arguments must come before the first constraint
5062
--> $DIR/suggest-move-types.rs:74:43
5163
|
5264
LL | struct D<T, U, V, M: Three<T, A=(), B=(), U, C=(), V>> {
53-
| ---- ^ ^
54-
| |
65+
| ---- ^ ^ generic argument
66+
| | |
67+
| | generic argument
5568
| the first constraint is provided here
5669

5770
error: generic arguments must come before the first constraint
5871
--> $DIR/suggest-move-types.rs:82:72
5972
|
6073
LL | struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<T, 'a, A=(), B=(), U, 'b, C=(), V, 'c>> {
61-
| ---- ^ ^^ ^ ^^
62-
| |
74+
| ---- ^ ^^ ^ ^^ generic argument
75+
| | | | |
76+
| | | | generic argument
77+
| | | generic argument
78+
| | generic argument
6379
| the first constraint is provided here
6480

6581
error[E0747]: type provided when a lifetime was expected

0 commit comments

Comments
 (0)