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

Make the default sysroot configurable by rustc_private tools #98832

Closed
jyn514 opened this issue Jul 3, 2022 · 2 comments · Fixed by #103660
Closed

Make the default sysroot configurable by rustc_private tools #98832

jyn514 opened this issue Jul 3, 2022 · 2 comments · Fixed by #103660
Assignees
Labels
A-clippy Area: Clippy A-miri Area: The miri tool A-rustfmt Area: Rustfmt E-help-wanted Call for participation: Help is requested to fix this issue. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Jul 3, 2022

This code hard-codes the default sysroot to be "one path above the binary":

let mut p = canonicalize(exe);
p.pop();
p.pop();
p

That doesn't work for Miri, which is why it needs various hacks around sysroot (also copied in clippy and rustfmt). We should make the default sysroot configurable in rustc_driver so tools can stop using this hack.

cc #97443, @flip1995, @calebcartwright

Originally posted by @RalfJung in #78926 (comment)

@jyn514 jyn514 added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. A-miri Area: The miri tool A-clippy Area: Clippy A-rustfmt Area: Rustfmt E-help-wanted Call for participation: Help is requested to fix this issue. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. labels Jul 3, 2022
@RalfJung
Copy link
Member

RalfJung commented Jul 3, 2022

That doesn't work for Miri, which is why it needs various hacks around sysroot (also copied in clippy and rustfmt)

(Just for the historical record, Miri copied these hacks from Clippy.)

@onur-ozkan
Copy link
Member

I would like to work on this.

@rustbot claim

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Oct 28, 2022
improve `filesearch::get_or_default_sysroot`

`fn get_or_default_sysroot` is now improved and used in `miri` and `clippy`, and tests are still passing as they should. So we no longer need to implement custom workarounds/hacks to find sysroot in tools like miri/clippy.

Resolves rust-lang#98832

re-opened from rust-lang#103581
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Nov 3, 2022
improve `filesearch::get_or_default_sysroot`

`fn get_or_default_sysroot` is now improved and used in `miri` and `clippy`, and tests are still passing as they should. So we no longer need to implement custom workarounds/hacks to find sysroot in tools like miri/clippy.

Resolves rust-lang#98832

re-opened from rust-lang#103581
@bors bors closed this as completed in bd9e6e0 Nov 5, 2022
RalfJung pushed a commit to RalfJung/miri that referenced this issue Nov 5, 2022
improve `filesearch::get_or_default_sysroot`

`fn get_or_default_sysroot` is now improved and used in `miri` and `clippy`, and tests are still passing as they should. So we no longer need to implement custom workarounds/hacks to find sysroot in tools like miri/clippy.

Resolves rust-lang/rust#98832

re-opened from #103581
flip1995 pushed a commit to flip1995/rust-clippy that referenced this issue Nov 19, 2022
improve `filesearch::get_or_default_sysroot`

`fn get_or_default_sysroot` is now improved and used in `miri` and `clippy`, and tests are still passing as they should. So we no longer need to implement custom workarounds/hacks to find sysroot in tools like miri/clippy.

Resolves rust-lang/rust#98832

re-opened from #103581
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-clippy Area: Clippy A-miri Area: The miri tool A-rustfmt Area: Rustfmt E-help-wanted Call for participation: Help is requested to fix this issue. E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue.
Projects
None yet
3 participants