-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Overhaul the -l
option parser (for linking to native libs)
#132934
Conversation
r? @Nadrieril rustbot has assigned @Nadrieril. Use |
@petrochenkov did you try to take the assignment for yourself or was this you changing your mind? |
@Nadrieril |
r? compiler |
r? jieyouxu |
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.
Thanks, AFAICT this looks good.
@Zalathar one question: do we want any dedicated UI tests for the failure cases (if not already)? But otherwise r=me. |
8dd2af2
to
5e8fed2
Compare
(Rebased; no changes.) Still looking into the test situation; it does seem a bit worrying. |
Yeah. AFAICT this has very sparse coverage (esp. for the more complex cases). It would be very cool if we can figure out some way to test this (like making the intermediate parsing outcome unit testable before it gets fed to library searching). |
5e8fed2
to
78edefe
Compare
Decided that I don't want to fall too far down the rabbit-hole of adding tests, so I added just a few that I noticed were conspicuously missing (diff). (Also note that one of these tests found a bug in one of the error messages, which had accidentally swapped the nightly and stable messages. The new implementation gets this correct.) @rustbot ready |
I do have some unit tests for one of the important intermediate steps ( |
@bors r=jieyouxu rollup |
Overhaul the `-l` option parser (for linking to native libs) The current parser for `-l` options has accumulated over time, making it hard to follow. This PR tries to clean it up in several ways. Key changes: - This code now gets its own submodule, to slightly reduce clutter in `rustc_session::config`. - Cleaner division between iterating over multiple `-l` options, and processing each individual one. - Separate “split” step that breaks up the value string into `[KIND[:MODIFIERS]=]NAME[:NEW_NAME]`, but leaves parsing/validating those parts to later steps. - This step also gets its own (disposable) unit test, to make sure it works as expected. - A context struct reduces the burden of parameter passing, and makes it easier to write error messages that adapt to nightly/stable compilers. - Fewer calls to `nightly_options` helper functions, because at this point we can get the same information from `UnstableOptions` and `UnstableFeatures` (which are downstream of earlier calls to those helper functions). There should be no overall change in compiler behaviour.
Rollup of 4 pull requests Successful merges: - rust-lang#132934 (Overhaul the `-l` option parser (for linking to native libs)) - rust-lang#133142 (rename rustc_const_stable_intrinsic -> rustc_intrinsic_const_stable_indirect) - rust-lang#133145 (Document alternatives to `static mut`) - rust-lang#133158 (Subtree update of `rust-analyzer`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 4 pull requests Successful merges: - rust-lang#132934 (Overhaul the `-l` option parser (for linking to native libs)) - rust-lang#133142 (rename rustc_const_stable_intrinsic -> rustc_intrinsic_const_stable_indirect) - rust-lang#133145 (Document alternatives to `static mut`) - rust-lang#133158 (Subtree update of `rust-analyzer`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#132934 - Zalathar:native-libs, r=jieyouxu Overhaul the `-l` option parser (for linking to native libs) The current parser for `-l` options has accumulated over time, making it hard to follow. This PR tries to clean it up in several ways. Key changes: - This code now gets its own submodule, to slightly reduce clutter in `rustc_session::config`. - Cleaner division between iterating over multiple `-l` options, and processing each individual one. - Separate “split” step that breaks up the value string into `[KIND[:MODIFIERS]=]NAME[:NEW_NAME]`, but leaves parsing/validating those parts to later steps. - This step also gets its own (disposable) unit test, to make sure it works as expected. - A context struct reduces the burden of parameter passing, and makes it easier to write error messages that adapt to nightly/stable compilers. - Fewer calls to `nightly_options` helper functions, because at this point we can get the same information from `UnstableOptions` and `UnstableFeatures` (which are downstream of earlier calls to those helper functions). There should be no overall change in compiler behaviour.
The current parser for
-l
options has accumulated over time, making it hard to follow. This PR tries to clean it up in several ways.Key changes:
rustc_session::config
.-l
options, and processing each individual one.[KIND[:MODIFIERS]=]NAME[:NEW_NAME]
, but leaves parsing/validating those parts to later steps.nightly_options
helper functions, because at this point we can get the same information fromUnstableOptions
andUnstableFeatures
(which are downstream of earlier calls to those helper functions).There should be no overall change in compiler behaviour.