Skip to content

Commit

Permalink
Fix ICE due to carriage return w/ multibyte char
Browse files Browse the repository at this point in the history
Based off of
kfitch@972560b
  • Loading branch information
JulianKnodt committed Aug 27, 2020
1 parent 45a83e9 commit ed9df28
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc_parse_format/lib.rs
Expand Up @@ -760,7 +760,7 @@ fn find_skips_from_snippet(
(' ' | '\n' | '\t', _) if eat_ws => {
skips.push(pos);
}
('\\', Some((next_pos, 'n' | 't' | '0' | '\\' | '\'' | '\"'))) => {
('\\', Some((next_pos, 'n' | 't' | 'r' | '0' | '\\' | '\'' | '\"'))) => {
skips.push(*next_pos);
let _ = s.next();
}
Expand Down
6 changes: 6 additions & 0 deletions src/test/ui/issues/issue-70381.rs
@@ -0,0 +1,6 @@
// Test that multi-byte unicode characters with missing parameters do not ICE.

fn main() {
println!("\r¡{}")
//~^ ERROR 1 positional argument in format string
}
8 changes: 8 additions & 0 deletions src/test/ui/issues/issue-70381.stderr
@@ -0,0 +1,8 @@
error: 1 positional argument in format string, but no arguments were given
--> $DIR/issue-70381.rs:4:16
|
LL | println!("\r¡{}")
| ^^

error: aborting due to previous error

0 comments on commit ed9df28

Please sign in to comment.