Rollup merge of #75972 - JulianKnodt:i70381, r=rollup

Fix ICE due to carriage return w/ multibyte char

Based off of this [commit](972560b83f)

Fixes #70381

CC: @Dylan-DPC
This commit is contained in:
Pietro Albini 2020-08-28 10:24:06 +02:00 committed by GitHub
commit cd77b62174
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View file

@ -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();
}

View file

@ -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
}

View file

@ -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