From 42c5cfdfda24529f424a6175fa1a48e5542cb824 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Fri, 27 Mar 2020 21:52:09 +0100 Subject: [PATCH] add the label back but make it shorter --- src/librustc_ast_passes/ast_validation.rs | 3 +- src/test/ui/parser/issue-32214.stderr | 2 +- .../ui/suggestions/suggest-move-types.stderr | 46 +++++++++++++------ 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/librustc_ast_passes/ast_validation.rs b/src/librustc_ast_passes/ast_validation.rs index 592d3bf2e052f..de7ae10723f4d 100644 --- a/src/librustc_ast_passes/ast_validation.rs +++ b/src/librustc_ast_passes/ast_validation.rs @@ -660,10 +660,11 @@ impl<'a> AstValidator<'a> { // ...and then error: self.err_handler() .struct_span_err( - misplaced_args, + misplaced_args.clone(), "generic arguments must come before the first constraint", ) .span_label(first.unwrap(), "the first constraint is provided here") + .span_labels(misplaced_args, "generic argument") .emit(); } } diff --git a/src/test/ui/parser/issue-32214.stderr b/src/test/ui/parser/issue-32214.stderr index d25d3a0963304..742f4fdc38bbd 100644 --- a/src/test/ui/parser/issue-32214.stderr +++ b/src/test/ui/parser/issue-32214.stderr @@ -2,7 +2,7 @@ error: generic arguments must come before the first constraint --> $DIR/issue-32214.rs:3:34 | LL | pub fn test >() {} - | ------- ^ + | ------- ^ generic argument | | | the first constraint is provided here diff --git a/src/test/ui/suggestions/suggest-move-types.stderr b/src/test/ui/suggestions/suggest-move-types.stderr index a0a8c3fc3ba58..4dd0613757a95 100644 --- a/src/test/ui/suggestions/suggest-move-types.stderr +++ b/src/test/ui/suggestions/suggest-move-types.stderr @@ -2,7 +2,7 @@ error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:26:26 | LL | struct A> { - | ---- ^ + | ---- ^ generic argument | | | the first constraint is provided here @@ -10,56 +10,72 @@ error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:33:43 | LL | struct Al<'a, T, M: OneWithLifetime> { - | ---- ^ ^^ - | | + | ---- ^ ^^ generic argument + | | | + | | generic argument | the first constraint is provided here error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:40:46 | LL | struct B> { - | ---- ^ ^ ^ - | | + | ---- ^ ^ ^ generic argument + | | | | + | | | generic argument + | | generic argument | the first constraint is provided here error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:48:71 | LL | struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime> { - | ---- ^ ^ ^ ^^ ^^ ^^ - | | + | ---- ^ ^ ^ ^^ ^^ ^^ generic argument + | | | | | | | + | | | | | | generic argument + | | | | | generic argument + | | | | generic argument + | | | generic argument + | | generic argument | the first constraint is provided here error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:57:49 | LL | struct C> { - | ---- ^ ^ - | | + | ---- ^ ^ generic argument + | | | + | | generic argument | the first constraint is provided here error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:65:78 | LL | struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime> { - | ---- ^ ^^ ^ ^^ - | | + | ---- ^ ^^ ^ ^^ generic argument + | | | | | + | | | | generic argument + | | | generic argument + | | generic argument | the first constraint is provided here error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:74:43 | LL | struct D> { - | ---- ^ ^ - | | + | ---- ^ ^ generic argument + | | | + | | generic argument | the first constraint is provided here error: generic arguments must come before the first constraint --> $DIR/suggest-move-types.rs:82:72 | LL | struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime> { - | ---- ^ ^^ ^ ^^ - | | + | ---- ^ ^^ ^ ^^ generic argument + | | | | | + | | | | generic argument + | | | generic argument + | | generic argument | the first constraint is provided here error[E0747]: type provided when a lifetime was expected