Skip to content

Commit f3ef4e9

Browse files
committed
rewrite and rename issue-83045 to rmake
1 parent 9a21ac8 commit f3ef4e9

File tree

7 files changed

+55
-36
lines changed

7 files changed

+55
-36
lines changed

src/tools/run-make-support/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub use llvm::{
3535
LlvmProfdata, LlvmReadobj,
3636
};
3737
pub use run::{cmd, run, run_fail, run_with_args};
38-
pub use rustc::{aux_build, rustc, Rustc};
38+
pub use rustc::{aux_build, bare_rustc, rustc, Rustc};
3939
pub use rustdoc::{bare_rustdoc, rustdoc, Rustdoc};
4040

4141
#[track_caller]

src/tools/run-make-support/src/rustc.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ pub fn rustc() -> Rustc {
1010
Rustc::new()
1111
}
1212

13-
/// Construct a new `rustc` aux-build invocation.
13+
/// Construct a plain `rustc` invocation with no flags set.
14+
#[track_caller]
15+
pub fn bare_rustc() -> Rustc {
16+
Rustc::bare()
17+
}
18+
19+
// Construct a new `rustc` aux-build invocation.
1420
#[track_caller]
1521
pub fn aux_build() -> Rustc {
1622
Rustc::new_aux_build()
@@ -30,7 +36,6 @@ fn setup_common() -> Command {
3036
let rustc = env_var("RUSTC");
3137
let mut cmd = Command::new(rustc);
3238
set_host_rpath(&mut cmd);
33-
cmd.arg("-L").arg(cwd());
3439
cmd
3540
}
3641

@@ -40,6 +45,14 @@ impl Rustc {
4045
/// Construct a new `rustc` invocation.
4146
#[track_caller]
4247
pub fn new() -> Self {
48+
let mut cmd = setup_common();
49+
cmd.arg("-L").arg(cwd());
50+
Self { cmd }
51+
}
52+
53+
/// Construct a bare `rustc` invocation with no flags set.
54+
#[track_caller]
55+
pub fn bare() -> Self {
4356
let cmd = setup_common();
4457
Self { cmd }
4558
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// This test case creates a situation where the crate loader would run
2+
// into an ICE (internal compiler error) when confronted with an invalid setup where it cannot
3+
// find the dependency of a direct dependency.
4+
//
5+
// The test case makes sure that the compiler produces the expected
6+
// error message but does not ICE immediately after.
7+
//
8+
// See https://github.com/rust-lang/rust/issues/83045
9+
10+
//@ only-x86_64
11+
//@ only-linux
12+
// Reason: This is a platform-independent issue, no need to waste time testing
13+
// everywhere.
14+
15+
// NOTE: We use `bare_rustc` below so that the compiler can't find liba.rlib
16+
// If we used `rustc` the additional '-L rmake_out' option would allow rustc to
17+
// actually find the crate.
18+
19+
use run_make_support::{bare_rustc, fs_wrapper, rust_lib_name, rustc};
20+
21+
fn main() {
22+
rustc().crate_name("a").crate_type("rlib").input("a.rs").arg("--verbose").run();
23+
rustc()
24+
.crate_name("b")
25+
.crate_type("rlib")
26+
.extern_("a", rust_lib_name("a"))
27+
.input("b.rs")
28+
.arg("--verbose")
29+
.run();
30+
fs_wrapper::create_dir("wrong_directory");
31+
bare_rustc()
32+
.extern_("b", rust_lib_name("b"))
33+
.crate_type("rlib")
34+
.edition("2018")
35+
.input("c.rs")
36+
.run_fail()
37+
.assert_stderr_contains("E0463")
38+
.assert_stderr_not_contains("internal compiler error");
39+
}

tests/run-make/issue-83045/Makefile

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)