Skip to content

Commit

Permalink
Rollup merge of rust-lang#62817 - estebank:variant-sp, r=matthewjasper
Browse files Browse the repository at this point in the history
Tweak span for variant not found error
  • Loading branch information
Mark-Simulacrum authored Jul 23, 2019
2 parents 66c2965 + 2641bed commit 24a8065
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/suggestions/suggest-variants.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 24a8065

Please sign in to comment.