Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Significantly simplify sysroot configuration #342

Merged
merged 1 commit into from
Jun 21, 2023
Merged

Conversation

thomcc
Copy link
Contributor

@thomcc thomcc commented Jun 21, 2023

We no longer have to manually search for the sysroot, as of rust-lang/rust#103660 it should be auto-detected from first the arguments passed, followed by locating it based on the location of the rustc_driver dynamic library.

This means we don't support configuring it via the environment anymore, but I don't believe anybody was explicitly using this anyway. Regardless, if they were configuring it to a different value than we locate with this function, it was almost certainly wrong. Still, we should make a note in the next release notes about it.

Thanks to @jyn514 for pointing this out to me!

@thomcc thomcc requested a review from workingjubilee June 21, 2023 15:55
Comment on lines -127 to -142
let our_exe_filename = std::env::current_exe()
.ok()
.and_then(|p| p.file_stem().map(ToOwned::to_owned))
.unwrap_or_else(|| "plrustc".into());

let wrapper_mode = orig_args
.get(1)
.map(std::path::Path::new)
.and_then(std::path::Path::file_stem)
.map_or(false, |name| {
name == our_exe_filename || name == "plrustc" || name == "rustc"
});

if wrapper_mode {
args.remove(1);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that removing this means that setting RUSTC_WORKSPACE_WRAPPER=plrustc won't work anymore, but thom tells me you were using RUSTC instead anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I don't think we realistically supported that anyway.

Copy link
Contributor

@workingjubilee workingjubilee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's beautiful.

@@ -52,6 +51,8 @@ impl Callbacks for PlrustcCallbacks {
}
}

// TODO: eventually we can replace this with:
// rustc_driver::install_ice_hook("https://github.com/tcdi/plrust/issues/new", |_| ());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When? 👀

Copy link

@jyn514 jyn514 Jun 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as soon as you update the nightly toolchain :) rust-lang/rust#110989

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually don't use nightly >_>

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah. when 1.71 lands on stable in a few weeks, then.

Comment on lines +112 to +113
let args = rustc_driver::args::arg_expand_all(&std::env::args().collect::<Vec<_>>());
let config = PlrustcConfig::from_env_and_args(&args);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So much less code!

@thomcc thomcc merged commit 30abdea into develop Jun 21, 2023
@thomcc thomcc deleted the thomcc/sysroot-config branch June 21, 2023 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants