Rollup of 4 pull requests - #161799
Closed
jhpratt wants to merge 17 commits into
Closed
Conversation
Due to some bad ordering of session/config initialization code -- more about that in subsequent commits -- `cfg(target_has_threads)` fails to be set for the `wasm32-unknown-unknown` platform when `-Ctarget-feature=+atomics` is specified. This commit modifies a test to demonstrate the bug; as written the test passes.
- `parse_check_cfg` has a single call site and is followed by a call to `fill_well_known`. - `parse_cfg` has two call sites and in both cases is followed by a call to `build_configuration`. This commit moves the follow-up calls into the functions, simplifying `run_compiler`.
Currently it modifies the `Session` and the `Cfg` (and the `Cfg` afterwards is put into the `Session`). It also takes a `CodegenBackend`. Those are some heavyweight arguments. This commit moves the `Session` modifications to the caller so the `&mut Session` isn't necessary, and passes in the `TargetConfig` instead of the whole `CodegenBackend`, plus some other small arguments. `add_configuration` ends up more clearly about modifying the `Cfg`. This is a step towards untangling session/backend initialization.
Currently, `parse_cfg` calls `build_configuration`, which calls `default_configuration`, which calls `sess.target.singlethread(&sess.internal_target_features)`. But `sess.internal_target_features` hasn't been set at this point and is empty! This commit moves the setting of `sess.internal_target_features` before the `parse_cfg` call to fix this ordering bug. This results in the `cfg(target_has_threads)` being correctly set on `wasm32-unknown-unknown` when `-Ctarget-feature=+atomics` is specified. Note: I have plans to make this kind of ordering bug difficult/impossible in a follow-up (e.g. rust-lang#161432).
`RawSpan`, `RawDefId`, and `RawDefPathHash` were all introduced to work around the fact that `StableHashCtxt` in `rustc_data_structure` is upstream of `rustc_span`. However, `DefPathHash` is just a newtype around `Fingerprint`, which is defined in `rustc_data_structure`. So by working directly with `Fingerprint` we can remove `RawDefPathHash`, which is a nice simplification.
had to update several tests which used repeated aligns and packeds. they now produce both a warning and an error where appropriate (e.g. when using conflicting packeds) which i think is correct.
… r=jdonszelmann lint against repeated repr attributes fixes rust-lang#156029 by adding a lint against repeated repr attributes. r? scottmcm
Fix the wasm32-unknown-unknown target feature/cfg bug Due to some bad ordering of session/config initialization code, `cfg(target_has_threads)` fails to be set for the `wasm32-unknown-unknown` platform when `-Ctarget-feature=+atomics` is specified. This PR fixes the problem. Details in individual commits. r? @Mark-Simulacrum
…ee1-dead Remove `RawDefPathHash` `RawSpan`, `RawDefId`, and `RawDefPathHash` were all introduced to work around the fact that `StableHashCtxt` in `rustc_data_structure` is upstream of `rustc_span`. However, `DefPathHash` is just a newtype around `Fingerprint`, which is defined in `rustc_data_structure`. So by working directly with `Fingerprint` we can remove `RawDefPathHash`, which is a nice simplification. r? @fee1-dead
explicitly state that allocations cannot grow to the left This was already implied, but it seems better to make this explicit. Cc @rust-lang/opsem
Member
Author
|
@bors r+ p=5 |
Contributor
Contributor
|
This pull request was unapproved due to being closed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successful merges:
RawDefPathHash#161744 (RemoveRawDefPathHash)r? @ghost
Create a similar rollup