Skip to content
Open
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
7 changes: 6 additions & 1 deletion crates/rustc_plugin/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,13 @@ pub fn cli_main<T: RustcPlugin>(plugin: T) -> ExitCode {
path.set_extension("exe");
}

let wrapper = match args.filter {
CrateFilter::AllCrates => "RUSTC_WRAPPER",
_ => "RUSTC_WORKSPACE_WRAPPER",
};

cmd
.env("RUSTC_WORKSPACE_WRAPPER", path)
.env(wrapper, path)
.args(["check", "--target-dir"])
.arg(&target_dir);

Expand Down
10 changes: 10 additions & 0 deletions crates/rustc_plugin/tests/test_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,13 @@ fn multi() -> Result<()> {
run("workspaces/multi", |_cmd| {})?;
Ok(())
}

#[test]
fn dependency() -> Result<()> {
let output = run("workspaces/deps", |_cmd| {})?;
assert!(
output.contains(r#"There is an item "mul" of type "function""#),
"output:\n{output}"
);
Ok(())
}
7 changes: 7 additions & 0 deletions crates/rustc_plugin/tests/workspaces/deps/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "deps"
version = "0.1.0"
edition = "2024"

[dependencies]
dep = { path = "dep" }
6 changes: 6 additions & 0 deletions crates/rustc_plugin/tests/workspaces/deps/dep/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "dep"
version = "0.1.0"
edition = "2024"

[dependencies]
3 changes: 3 additions & 0 deletions crates/rustc_plugin/tests/workspaces/deps/dep/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn mul(left: usize, right: usize) -> usize {
left * right
}
3 changes: 3 additions & 0 deletions crates/rustc_plugin/tests/workspaces/deps/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn square(x: usize) -> usize {
dep::mul(x, x)
}
Loading