Skip to content

Commit

Permalink
A much simpler way to set the sysroot. (#34)
Browse files Browse the repository at this point in the history
## What Changed?

Reimplements #32 in a simpler manner. Partially reverts those changes
but with the same overall outcome.

Also added documentation for what is happening.

## Why Does It Need To?

The other version to achieve this needed more changes to `rustc_plugin`
that were haphazard and would have been annoying to try and get merged
eventually. This way is slightly more hacky but with a *significantly*
reduced footprint. Everything is now contained in `dfpp` alone.

## Checklist

- [x] Above description has been filled out so that upon quash merge we
have a
  good record of what changed.
- [x] New functions, methods, types are documented. Old documentation is
updated
  if necessary
- [x] Documentation in Notion has been updated
- [x] Tests for new behaviors are provided
  - [x] New test suites (if any) ave been added to the CI tests (in
`.github/workflows/rust.yml`) either as compiler test or integration
test.
*Or* justification for their omission from CI has been provided in this
PR
    description.
  • Loading branch information
JustusAdam authored Sep 6, 2023
1 parent d6130ae commit 722f543
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ debug = true

[replace]

"rustc_utils:0.6.0-nightly-2023-04-12" = { git = "https://github.com/JustusAdam/rustc_plugin", rev = "a50617487e129623df946c42d554bd8080765096" }
"rustc_plugin:0.6.0-nightly-2023-04-12" = { git = "https://github.com/JustusAdam/rustc_plugin", rev = "a50617487e129623df946c42d554bd8080765096" }
"rustc_utils:0.6.0-nightly-2023-04-12" = { git = "https://github.com/JustusAdam/rustc_plugin", rev = "344ecb3bc056c641eaf9d06792571b3d81c8eb33" }
"rustc_plugin:0.6.0-nightly-2023-04-12" = { git = "https://github.com/JustusAdam/rustc_plugin", rev = "344ecb3bc056c641eaf9d06792571b3d81c8eb33" }
11 changes: 10 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,19 @@ impl rustc_plugin::RustcPlugin for DfppPlugin {
) -> rustc_plugin::RustcPluginArgs<Self::Args> {
use clap::Parser;
let args = ArgWrapper::parse();

// Override the SYSROOT so that it points to the version we were
// compiled against.
//
// This is actually not necessary for *this* binary, but it will bne
// inherited by the calls to `cargo` and `rustc` does by `rustc_plugin`
// and thus those will link against the version of `std` that we
// require.
std::env::set_var("SYSROOT", env!("SYSROOT_PATH"));

rustc_plugin::RustcPluginArgs {
args: Args::from_parseable(args.args).unwrap(),
filter: CrateFilter::OnlyWorkspace,
env: vec![("SYSROOT".into(), env!("SYSROOT_PATH").into())],
}
}

Expand Down

0 comments on commit 722f543

Please sign in to comment.