about summary refs log tree commit diff
path: root/tests/run-make/invalid-tmpdir-env-var/rmake.rs
blob: c5b9dca33a940987f9e351de8a32835e256a3584 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//@ needs-target-std
//
// When the TMP (on Windows) or TMPDIR (on Unix) variable is set to an invalid
// or non-existing directory, this used to cause an internal compiler error (ICE). After the
// addition of proper error handling in #28430, this test checks that the expected message is
// printed.
// See https://github.com/rust-lang/rust/issues/14698

use run_make_support::{is_windows, rustc};

// NOTE: This is not a UI test despite its simplicity, as the error message contains a path
// with some variability that is difficult to normalize

fn main() {
    let mut rustc = rustc();
    if is_windows() {
        rustc.env("TMP", "fake");
    } else {
        rustc.env("TMPDIR", "fake");
    }
    rustc.input("foo.rs").run_fail().assert_stderr_contains("couldn't create a temp dir");
}