From 2641beddc4a08351dc101365b3f80f92092866f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 19 Jul 2019 19:25:03 -0700 Subject: [PATCH] Tweak span for variant not found error --- src/librustc_typeck/astconv.rs | 5 ++++- src/test/ui/suggestions/suggest-variants.stderr | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index d314228a232..5799e58a727 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1650,7 +1650,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { Applicability::MaybeIncorrect, ); } else { - err.span_label(span, format!("variant not found in `{}`", qself_ty)); + err.span_label( + assoc_ident.span, + format!("variant not found in `{}`", qself_ty), + ); } if let Some(sp) = tcx.hir().span_if_local(adt_def.did) { diff --git a/src/test/ui/suggestions/suggest-variants.stderr b/src/test/ui/suggestions/suggest-variants.stderr index ef0ba70c340..b4338e20554 100644 --- a/src/test/ui/suggestions/suggest-variants.stderr +++ b/src/test/ui/suggestions/suggest-variants.stderr @@ -23,9 +23,7 @@ LL | enum Shape { | ---------- variant `Rombus` not found here ... LL | println!("My shape is {:?}", Shape::Rombus{ size: 5}); - | -------^^^^^^ - | | - | variant not found in `Shape` + | ^^^^^^ variant not found in `Shape` error[E0599]: no variant or associated item named `Squareee` found for type `Shape` in the current scope --> $DIR/suggest-variants.rs:15:12