about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorAurélien Deharbe <aurelien.deharbe@ssi.gouv.fr>2020-09-11 17:31:52 +0200
committerAurélien Deharbe <aurelien.deharbe@ssi.gouv.fr>2020-09-11 17:31:52 +0200
commit62068a59eea44ff78c4293d5fcc676279b1deab0 (patch)
tree5b192a89bc2696d3136750e4ee6b35cb9de74ce0 /compiler/rustc_parse/src/parser
parentf9059a41b48813845e1ffa2d1bdcbc455ffcd10c (diff)
downloadrust-62068a59eea44ff78c4293d5fcc676279b1deab0.tar.gz
rust-62068a59eea44ff78c4293d5fcc676279b1deab0.zip
repairing broken error message and rustfix application for the new test
case
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/mod.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs
index 5eefae3af60..7340c574480 100644
--- a/compiler/rustc_parse/src/parser/mod.rs
+++ b/compiler/rustc_parse/src/parser/mod.rs
@@ -694,9 +694,13 @@ impl<'a> Parser<'a> {
                                 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,