about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/ty.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_parse/src/parser/ty.rs')
-rw-r--r--compiler/rustc_parse/src/parser/ty.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs
index c561ea3823d..505586e74f1 100644
--- a/compiler/rustc_parse/src/parser/ty.rs
+++ b/compiler/rustc_parse/src/parser/ty.rs
@@ -274,7 +274,6 @@ impl<'a> Parser<'a> {
             // Function pointer type
             self.parse_ty_bare_fn(lo, ThinVec::new(), None, recover_return_sign)?
         } else if self.check_keyword(kw::For) {
-            let for_span = self.token.span;
             // Function pointer type or bound list (trait object type) starting with a poly-trait.
             //   `for<'lt> [unsafe] [extern "ABI"] fn (&'lt S) -> T`
             //   `for<'lt> Trait1<'lt> + Trait2 + 'a`
@@ -302,7 +301,7 @@ impl<'a> Parser<'a> {
                         kw: kw.name.as_str(),
                         sugg: errors::TransposeDynOrImplSugg {
                             removal_span,
-                            insertion_span: for_span.shrink_to_lo(),
+                            insertion_span: lo.shrink_to_lo(),
                             kw: kw.name.as_str(),
                         },
                     });
@@ -345,16 +344,14 @@ impl<'a> Parser<'a> {
                     // FIXME(c_variadic): Should we just allow `...` syntactically
                     // anywhere in a type and use semantic restrictions instead?
                     // NOTE: This may regress certain MBE calls if done incorrectly.
-                    let guar = self
-                        .dcx()
-                        .emit_err(NestedCVariadicType { span: lo.to(self.prev_token.span) });
+                    let guar = self.dcx().emit_err(NestedCVariadicType { span: lo });
                     TyKind::Err(guar)
                 }
             }
         } else {
             let msg = format!("expected type, found {}", super::token_descr(&self.token));
-            let mut err = self.dcx().struct_span_err(self.token.span, msg);
-            err.span_label(self.token.span, "expected type");
+            let mut err = self.dcx().struct_span_err(lo, msg);
+            err.span_label(lo, "expected type");
             return Err(err);
         };