]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_parse_format/lib.rs
asm: Allow multiple template strings; interpret them as newline-separated
[rust.git] / src / librustc_parse_format / lib.rs
index 23bf7b35419db9767d20d7340bd20320dc124ca1..a5b5a1090cbfd5052e0d6beb64b0b79581a87698 100644 (file)
@@ -178,7 +178,7 @@ pub struct Parser<'a> {
     /// Error messages accumulated during parsing
     pub errors: Vec<ParseError>,
     /// Current position of implicit positional argument pointer
-    curarg: usize,
+    pub curarg: usize,
     /// `Some(raw count)` when the string is "raw", used to position spans correctly
     style: Option<usize>,
     /// Start and end byte offset of every successfully parsed argument
@@ -243,11 +243,13 @@ fn next(&mut self) -> Option<Piece<'a>> {
                 _ => Some(String(self.string(pos))),
             }
         } else {
-            if self.is_literal && self.cur_line_start != self.input.len() {
+            if self.is_literal {
                 let start = self.to_span_index(self.cur_line_start);
                 let end = self.to_span_index(self.input.len());
-                self.line_spans.push(start.to(end));
-                self.cur_line_start = self.input.len();
+                let span = start.to(end);
+                if self.line_spans.last() != Some(&span) {
+                    self.line_spans.push(span);
+                }
             }
             None
         }