-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Rollup of 6 pull requests #71037
Closed
Closed
Rollup of 6 pull requests #71037
Conversation
This file contains 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
The condition checks if `sess.opts.output_types` doesn't contain `OutputType::Assembly` within a match arm that is only reached if `sess.opts.output_types` contains `OutputType::Assembly`.
There are three `ModuleConfigs`, one for each `ModuleKind`. The code to initialized them is spaghetti imperative code that sets each field to a default value and then modifies many fields in complicated ways. This makes it very hard to tell what value ends up in each field in each config. For example, the `modules_config.emit_pre_lto_bc` field is set twice, which means it can be set to true and then incorrectly set back to false. (This probably hasn't been noticed because it happens in a very obscure case.) This commit changes the code to a declarative style in which `ModuleConfig::new` initializes all fields and then they are never changed again. This is slightly more concise and much easier to read. (And it fixes the abovementioned `emit_pre_lto_bc` error as well.)
That way it matches `ModuleKind::Regular`.
I personally find this clearer.
Going along with or_insert_with, or_insert_with_key provides the Entry's key to the lambda, avoiding the need to either clone the key or the need to reimplement this body of this method from scratch each time. This is useful when the initial value for a map entry is derived from the key. For example, the introductory Rust book has an example Cacher struct that takes an expensive-to-compute lambda and then can, given an argument to the lambda, produce either the cached result or execute the lambda.
Remove the UnicodeVersion struct containing major, minor and update fields and replace it with a 3-tuple containing the version number. As the value of each field is limited to 255 use u8 to store them.
…nit, r=Mark-Simulacrum Clean up `ModuleConfig` initialization Because it's currently a mess. r? @Mark-Simulacrum
Improve async-await/generator obligation errors in some cases Fixes rust-lang#68112. This change is best read one commit at a time (I add a test at the beginning and update it in each change after). The `test2` function is a case I found while writing the test that we don't handle with this code yet. I don't attempt to fix it in this PR, but it's a good candidate for future work. r? @davidtwco, @nikomatsakis
Add or_insert_with_key to Entry of HashMap/BTreeMap Going along with `or_insert_with`, `or_insert_with_key` provides the `Entry`'s key to the lambda, avoiding the need to either clone the key or the need to reimplement this body of this method from scratch each time. This is useful when the initial value for a map entry is derived from the key. For example, the introductory Rust book has an example Cacher struct that takes an expensive-to-compute lambda and then can, given an argument to the lambda, produce either the cached result or execute the lambda. --- I'm fairly new to Rust, so any optimizations, corrections to types, better names, better documentation, or whatever else would be appreciated. I'd like to thank Arnavion on freenode for helping me to implement a very similar method when I found that `or_insert_with_key` was unavailable. As a somewhat-related note, this implements rust-lang/rfcs#1202 from 2015, so if this pull request is accepted, that should be closed.
…acrum Deprecate the asm! macro in favor of llvm_asm! Since we will be changing the syntax of `asm!` soon, deprecate it and encourage people to use `llvm_asm!` instead (which preserves the old syntax). This will avoid breakage when `asm!` is changed. RFC: rust-lang/rfcs#2843
Store UNICODE_VERSION as a tuple Remove the UnicodeVersion struct containing major, minor and update fields and replace it with a 3-tuple containing the version number. As the value of each field is limited to 255 use u8 to store them.
… r=jonas-schievink Use write!-style syntax for MIR assert terminator Fixes rust-lang#71000. r? @jonas-schievink
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:
ModuleConfig
initialization #70644 (Clean upModuleConfig
initialization)Failed merges:
r? @ghost