22 lines
876 B
Rust
22 lines
876 B
Rust
// If rustc is invoked on a file that would be overwritten by the
|
|
// compilation, the compilation should fail, to avoid accidental loss.
|
|
// See https://github.com/rust-lang/rust/pull/46814
|
|
|
|
//@ ignore-cross-compile
|
|
|
|
use run_make_support::{fs_wrapper, rustc};
|
|
|
|
fn main() {
|
|
fs_wrapper::copy("foo.rs", "foo");
|
|
rustc().input("foo").output("foo").run_fail().assert_stderr_contains(
|
|
r#"the input file "foo" would be overwritten by the generated executable"#,
|
|
);
|
|
fs_wrapper::copy("bar.rs", "bar.rlib");
|
|
rustc().input("bar.rlib").output("bar.rlib").run_fail().assert_stderr_contains(
|
|
r#"the input file "bar.rlib" would be overwritten by the generated executable"#,
|
|
);
|
|
rustc().input("foo.rs").output("foo.rs").run_fail().assert_stderr_contains(
|
|
r#"the input file "foo.rs" would be overwritten by the generated executable"#,
|
|
);
|
|
}
|