diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2020-08-28 10:24:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-28 10:24:06 +0200 |
| commit | cd77b62174432003d7637518de903b27735ec520 (patch) | |
| tree | 2a4f5b47d4a11db5ff5c9e9c7730941dea0cded3 | |
| parent | 0f1ffa85d1d97375eac16c8b25d0c5abf7a3b690 (diff) | |
| parent | ed9df28655607a17f01714b67930bdddba14fb26 (diff) | |
| download | rust-cd77b62174432003d7637518de903b27735ec520.tar.gz rust-cd77b62174432003d7637518de903b27735ec520.zip | |
Rollup merge of #75972 - JulianKnodt:i70381, r=rollup
Fix ICE due to carriage return w/ multibyte char Based off of this [commit](https://github.com/kfitch/rust/commit/972560b83f80e1219b5735ff3d751c034115b08e) Fixes #70381 CC: @Dylan-DPC
| -rw-r--r-- | src/librustc_parse_format/lib.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-70381.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-70381.stderr | 8 |
3 files changed, 15 insertions, 1 deletions
diff --git a/src/librustc_parse_format/lib.rs b/src/librustc_parse_format/lib.rs index ebb3aa3866e..e07b8b86aef 100644 --- a/src/librustc_parse_format/lib.rs +++ b/src/librustc_parse_format/lib.rs @@ -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(); } diff --git a/src/test/ui/issues/issue-70381.rs b/src/test/ui/issues/issue-70381.rs new file mode 100644 index 00000000000..3df8277b873 --- /dev/null +++ b/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 +} diff --git a/src/test/ui/issues/issue-70381.stderr b/src/test/ui/issues/issue-70381.stderr new file mode 100644 index 00000000000..96b8e656991 --- /dev/null +++ b/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 + |
