Ok(t) => {
// Parsed successfully, therefore most probably the code only
// misses a separator.
+ let mut exp_span = self.sess.source_map().next_point(sp);
+ if self.sess.source_map().is_multiline(exp_span) {
+ exp_span = sp;
+ }
expect_err
.span_suggestion_short(
- self.sess.source_map().next_point(sp),
+ exp_span,
&format!("missing `{}`", token_str),
token_str,
Applicability::MaybeIncorrect,
--- /dev/null
+// run-rustfix
+
+#![allow(dead_code)]
+#![allow(unused_variables)]
+fn f(
+ x: u8,
+ y: u8,
+) {}
+//~^^ ERROR: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `y`
+
+fn main() {}
+// run-rustfix
+
+#![allow(dead_code)]
+#![allow(unused_variables)]
fn f(
x: u8
y: u8,
error: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `y`
- --> $DIR/issue-76597.rs:3:38
+ --> $DIR/issue-76597.rs:7:38
|
-LL | ... x: u8
- | - expected one of 7 possible tokens
- | ____________________________|
- | |
-LL | | ... y: u8,
-| | | ^ unexpected token
-| | |
- | help: missing `,`
+LL | ... x: u8
+ | -
+ | |
+ | expected one of 7 possible tokens
+ | help: missing `,`
+LL | ... y: u8,
+ | ^ unexpected token
error: aborting due to previous error