Skip to content

Commit cd77b62

Browse files
authored
Rollup merge of #75972 - JulianKnodt:i70381, r=rollup
Fix ICE due to carriage return w/ multibyte char Based off of this [commit](kfitch@972560b) Fixes #70381 CC: @Dylan-DPC
2 parents 0f1ffa8 + ed9df28 commit cd77b62

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/librustc_parse_format/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ fn find_skips_from_snippet(
760760
(' ' | '\n' | '\t', _) if eat_ws => {
761761
skips.push(pos);
762762
}
763-
('\\', Some((next_pos, 'n' | 't' | '0' | '\\' | '\'' | '\"'))) => {
763+
('\\', Some((next_pos, 'n' | 't' | 'r' | '0' | '\\' | '\'' | '\"'))) => {
764764
skips.push(*next_pos);
765765
let _ = s.next();
766766
}

src/test/ui/issues/issue-70381.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Test that multi-byte unicode characters with missing parameters do not ICE.
2+
3+
fn main() {
4+
println!("\r¡{}")
5+
//~^ ERROR 1 positional argument in format string
6+
}

src/test/ui/issues/issue-70381.stderr

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: 1 positional argument in format string, but no arguments were given
2+
--> $DIR/issue-70381.rs:4:16
3+
|
4+
LL | println!("\r¡{}")
5+
| ^^
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)