Skip to content

Commit a8df047

Browse files
committed
Auto merge of #1440 - RalfJung:wtf8, r=RalfJung
test WTF8 encoding corner cases This adds a Miri-side test for rust-lang/rust#72760. Blocked on rust-lang/rust#72683.
2 parents 4fd0aa3 + 7cd68eb commit a8df047

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b6fa392238a459c29a47e2cf824d79a49a8ba039
1+
5fd2f06e99a985dd896684cb2c9f8c7090eca1ab

tests/run-pass/wtf8.rs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// ignore-linux: tests Windows-only APIs
2+
// ignore-macos: tests Windows-only APIs
3+
4+
use std::os::windows::ffi::{OsStrExt, OsStringExt};
5+
use std::ffi::{OsStr, OsString};
6+
7+
fn test1() {
8+
let base = "a\té \u{7f}💩\r";
9+
let mut base: Vec<u16> = OsStr::new(base).encode_wide().collect();
10+
base.push(0xD800);
11+
let _res = OsString::from_wide(&base);
12+
}
13+
14+
fn test2() {
15+
let mut base: Vec<u16> = OsStr::new("aé ").encode_wide().collect();
16+
base.push(0xD83D);
17+
let mut _res: Vec<u16> = OsString::from_wide(&base).encode_wide().collect();
18+
}
19+
20+
fn main() {
21+
test1();
22+
test2();
23+
}

0 commit comments

Comments
 (0)