Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,7 @@ pub fn install_ice_hook(bug_report_url: &'static str, extra_info: fn(DiagCtxtHan
// (e.g. `RUST_BACKTRACE=1`)
if env::var_os("RUST_BACKTRACE").is_none() {
// HACK: this check is extremely dumb, but we don't really need it to be smarter since this should only happen in the test suite anyway.
let ui_testing = std::env::args().any(|arg| arg == "-Zui-testing");
let ui_testing = env::args_os().any(|arg| arg == "-Zui-testing");
if env!("CFG_RELEASE_CHANNEL") == "dev" && !ui_testing {
panic::set_backtrace_style(panic::BacktraceStyle::Short);
} else {
Expand Down
25 changes: 25 additions & 0 deletions tests/run-make/non-unicode-argument/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Regression test for https://github.com/rust-lang/rust/issues/164585

use run_make_support::rustc;

fn main() {
#[cfg(unix)]
let non_unicode: &std::ffi::OsStr = std::os::unix::ffi::OsStrExt::from_bytes(&[0xFF]);
#[cfg(windows)]
let non_unicode: std::ffi::OsString = std::os::windows::ffi::OsStringExt::from_wide(&[0xD800]);

rustc()
.env_remove("RUST_BACKTRACE")
.arg(&non_unicode)
.run_fail()
.assert_exit_code(1)
.assert_stderr_contains("is not valid Unicode")
.assert_stderr_not_contains("panicked at");

rustc()
.env("RUST_BACKTRACE", "0")
.arg(&non_unicode)
.run_fail()
.assert_exit_code(1)
.assert_stderr_contains("is not valid Unicode");
}
Loading