diff options
| author | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2017-03-28 14:10:16 +0200 |
|---|---|---|
| committer | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2017-04-25 11:07:42 +0200 |
| commit | f4b1e2af6836bcf30a8be05ff6a44df6f61b19f2 (patch) | |
| tree | 0fc07cb3b3d9a62212d8580a96f543d0f67852f4 /src/libsyntax/parse | |
| parent | 3a5567bad45fbde0962263f484ebc76f750920e4 (diff) | |
| download | rust-f4b1e2af6836bcf30a8be05ff6a44df6f61b19f2.tar.gz rust-f4b1e2af6836bcf30a8be05ff6a44df6f61b19f2.zip | |
Improve E0178 suggestion placement
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index e1fe8f1b2eb..55098d77472 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1490,9 +1490,8 @@ impl<'a> Parser<'a> { let bounds = self.parse_ty_param_bounds()?; let sum_span = ty.span.to(self.prev_span); - let mut err = struct_span_err!(self.sess.span_diagnostic, ty.span, E0178, + let mut err = struct_span_err!(self.sess.span_diagnostic, sum_span, E0178, "expected a path on the left-hand side of `+`, not `{}`", pprust::ty_to_string(&ty)); - err.span_label(ty.span, &format!("expected a path")); match ty.node { TyKind::Rptr(ref lifetime, ref mut_ty) => { @@ -1511,9 +1510,11 @@ impl<'a> Parser<'a> { err.span_suggestion(sum_span, "try adding parentheses:", sum_with_parens); } TyKind::Ptr(..) | TyKind::BareFn(..) => { - help!(&mut err, "perhaps you forgot parentheses?"); + err.span_label(sum_span, &"perhaps you forgot parentheses?"); } - _ => {} + _ => { + err.span_label(sum_span, &"expected a path"); + }, } err.emit(); Ok(()) |
