-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Expose std support via --print #3693
base: master
Are you sure you want to change the base?
Expose std support via --print #3693
Conversation
abe5a97
to
9ac60b9
Compare
I don't know what process the compiler team wants to use, but typically in the past they have been using the Major Change Proposal process for new flags and such like this (instead of an RFC). |
I think the line is a bit blurry, our documentation says:
Is this a small user-facing change? Probably? Given that an RFC has been written and it'll be subject to an FCP anyway, I think we might as well keep it as an RFC. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a sensible addition to --print
1. I don't think we need to worry about adding options to that flag.
Footnotes
-
for the sake of transparency: @adamgemmell and I work for the same employer and I've reviewed this internally already. ↩
What does "std support" means exactly? You can, for example, make you own crate and make it the std library. Having an std library shipped is not a property of the compiler, it's a property of the distributed toolchain, similarly to having the LLD linker shipped, for example.
The distribution itself can potentially ship a json file describing its components (rustup already does something like that?), then rustc |
From my perspective rustc already treats core/std/others as special when it comes to the sysroot and attributes like The RFC goes into implementation details - it's going to use an existing field in the Target spec. The output can be changed by using a custom JSON target but if a user's custom std doesn't support a target and the user wants to use a built-in target then I think I agree with your concerns. I'm not sure if people do that or what guarantees the compiler makes for people who write their own std crates. |
To add to what @adamgemmell said, this flag isn't that related to whether a std is shipped for a target. With something like |
Looking back at this I'm not sure it's a concern. Whether a target can support std is still a property of the target (i.e. whether it has a suitable OS) and as the RFC says the flag doesn't attempt to differentiate targets with a "broken" std. |
I think this is a reasonable addition to the @rfcbot fcp merge |
Team member @wesleywiser has proposed to merge this. The next step is review by the rest of the tagged team members:
No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
I want to second @petrochenkov's questions. In my mind a lot of the motivation reads as a desire to add a mechanism to "ask" before doing. It then again motivates that this is to avoid confusion by the users of // in std/lib.rs
#[cfg(not(supported_platform))]
compile_error!("libstd is not supported for $platform"); or whatever, with huge benefit of such approach being that the support for libstd remains entirely within confines of |
Sorry for the silence here. First of all, I think there's two concepts I'm trying to express as one here that need to be separate:
For the vast majority of targets these booleans are the same though there's some weird edge cases that I really don't understand. For example, the majority of targets that don't contain "-none" in their name are marked as supporting std in bootstrap, though I'm ok with adding a perma-unstable "std_supported" cfg option which would represent concern 1, though that's effectively a minor improvement of the solution currently in place today. Note that still requires the compiler to have an opinion here, which I think goes against the end of your message but I think this would be ok. I'm interested in what the Cargo team thinks of it - rust-lang/cargo#14183 was merged recently which is a soft check for the |
As discussed on Zulip, this RFC proposes adding a new argument for
rustc --print
that acts as the single source of truth for whether a target supports std.Rendered