Skip to content

Commit 234d043

Browse files
committed
Move lifetimes before the *first* type argument
1 parent 79ee8f3 commit 234d043

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5229,7 +5229,9 @@ impl<'a> Parser<'a> {
52295229
} else if self.check_ident() {
52305230
// Parse type parameter.
52315231
params.push(self.parse_ty_param(attrs)?);
5232-
seen_ty_param = Some(self.prev_span);
5232+
if seen_ty_param.is_none() {
5233+
seen_ty_param = Some(self.prev_span);
5234+
}
52335235
} else {
52345236
// Check for trailing attributes and stop parsing.
52355237
if !attrs.is_empty() {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ LL | struct C<T, U, 'a> {
2525
| ^^
2626
help: move the lifetime parameter prior to the first type parameter
2727
|
28-
LL | struct C<T, 'a, U> {
29-
| ^^^ --
28+
LL | struct C<'a, T, U> {
29+
| ^^^ --
3030

3131
error: aborting due to 3 previous errors
3232

0 commit comments

Comments
 (0)