-
Notifications
You must be signed in to change notification settings - Fork 400
Rustup #4640
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
Merged
Merged
Rustup #4640
Conversation
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
Remove boxes from ast list elements Less indirection should be better perf.
Use regular Vec in BitSet. That code is hot enough for the branch in all accesses to `SmallVec` to appear in profiles.
…-obk Guard HIR lowered contracts with `contract_checks` Refactor contract HIR lowering to ensure no contract code is executed when contract-checks are disabled. The call to `contract_checks` is moved to inside the lowered fn body, and contract closures are built conditionally, ensuring no side-effects present in contracts occur when those are disabled. This partially addresses rust-lang/rust#139548, i.e. the bad behavior no longer happens with contract checks disabled (`-Zcontract-checks=no`). The change is made in preparation for adding contract variable declarations - variables declared before the `requires` assertion, and accessible from both `requires` and `ensures`, but not in the function body (PR rust-lang/rust#144444). As those declarations may also have side-effects, it's good to guard them with `contract_checks` - the new lowering approach allows for this to be done easily. Contracts tracking issue: rust-lang/rust#128044 **Known limiatations**: - It is still possible to early return from the *function* from within a contract, e.g. ```rust #[ensures({if x > 0 { return 0 }; |_| true})] fn foo(x: u32) -> i32 { 42 } ``` When `foo` is called with an argument greater than 0, instead of `42`, `0` will be returned. As this is not a regression, it is not addressed in this PR. However, it may be worth revisiting later down the line, as users may expect a form of early return from *contract specifications*, and so returning from the entire *function* could cause confusion. - ~Contracts are still not optimised out when disabled. Currently, even when contracts are disabled, the code generated causes existing optimisations to fail, meaning even disabled contracts could impact runtime performance. This issue is blocking rust-lang/rust#136578, and has not been addressed in this PR, i.e. the `mir-opt` and `codegen` tests that fail in rust-lang/rust#136578 still fail with these new HIR lowering changes.~ Contracts should now be optimised out when disabled, however some regressions tests still need to be added to be sure that is indeed the case.
std: Add Motor OS std library port Motor OS was added as a no-std Tier-3 target in [PR 146848](rust-lang/rust#146848) as x86_64-unknown-motor. This PR adds the std library for Motor OS. While the PR may seem large, all it does is proxy std pal calls to [moto-rt](https://crates.io/crates/moto-rt). Where there is some non-trivial code (e.g. thread::spawn), it is quite similar, often identical, to what other platforms do.
…te,RalfJung Fix ICE on offsetted ZST pointer I'm not sure this is the *right* fix, but it's simple enough and does roughly what I'd expect. Like with the previous optimization to codegen usize rather than a zero-sized static, there's no guarantee that we continue returning a particular value from the offsetting. A grep for `const_usize.*align` found the same code copied to rustc_codegen_gcc and cranelift but a quick skim didn't find other cases of similar 'optimization'. That said, I'm not convinced I caught everything, it's not trivial to search for this. Closes rust-lang/rust#147516
remove duplicate inline macro
Don't highlight `let` expressions as having type `bool` in let-chain error messages Fixes rust-lang/rust#147665.
miri subtree update Subtree update of `miri` to rust-lang@50ba3a7. Created using https://github.com/rust-lang/josh-sync. r? ``````@ghost``````
Use `bit_set::Word` in a couple more places. It's a synonym for `u64` and there are a couple of places where we use `u64` where we should use `Word`, which this commit fixes. I found this when I tried changing `Word` to `u128` (which made performance worse). r? `````@Zalathar`````
style-guide: fix typo for empty struct advice the advice appears to apply to empty structs with braces (parens/blocks), and a unit struct in the comment does not make sense. Fix the typo.
`is_ascii` on an empty string or slice returns true Update the description of the [`is_ascii`](https://doc.rust-lang.org/std/primitive.str.html#method.is_ascii) functions - an empty string or slice also returns `true`. This follows the pattern of [`all()`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.all). Clippy currently suggests to change `string.chars().all(|c| c.is_ascii())` into `string.is_ascii()`. This suggestion therefore seems fitting. I've already questioned the behavior for this multiple times. I've always had to check the internals to conclude how it works. That's why I'm opening this PR to add it directly in the documentation.
Rollup of 9 pull requests Successful merges: - rust-lang/rust#144438 (Guard HIR lowered contracts with `contract_checks`) - rust-lang/rust#147000 (std: Add Motor OS std library port) - rust-lang/rust#147576 (Fix ICE on offsetted ZST pointer) - rust-lang/rust#147732 (remove duplicate inline macro) - rust-lang/rust#147738 (Don't highlight `let` expressions as having type `bool` in let-chain error messages) - rust-lang/rust#147744 (miri subtree update) - rust-lang/rust#147751 (Use `bit_set::Word` in a couple more places.) - rust-lang/rust#147752 (style-guide: fix typo for empty struct advice) - rust-lang/rust#147773 (`is_ascii` on an empty string or slice returns true) r? `@ghost` `@rustbot` modify labels: rollup
`TaskDeps` improvements Some cleanups and minor perf improvements relating to `TaskDeps`. r? `@saethlin`
Clippy subtree update r? `@Manishearth` `Cargo.lock` update, because `clippy_utils` is now also using `itertools`
rustdoc-search: stringdex 0.0.2 Two index format tweaks that reduce the size of the standard library, compiler, and wordnet dictionary when I test it. CC rust-lang/rust#146048 FF Profiler output: https://share.firefox.dev/4onH5xP Preview: https://notriddle.com/rustdoc-html-demo-12/stringdex-002/std/index.html
Pre-compute MIR CFG caches for borrowck and other analyses I was puzzled that rust-lang/rust#142390 introduces additional computations of CFG traversals: borrowck computes them, right? It turns out that borrowck clones the MIR body, so doesn't share its cache with other analyses. This PR: - forces the computation of all caches in `mir_promoted` query; - modifies region renumbering to avoid dropping that cache.
mismatched_lifetime_syntax lint refactors and optimizations I found several opportunities to return early so I'm hoping those will have a perf improvement. Otherwise, it's various refactors for simplicity.
Simplify trivial constants in SimplifyConstCondition After `InstSimplify-after-simplifycfg` with `-Zub_checks=false`, there are many of the following patterns. ``` _13 = const false; assume(copy _13); _12 = unreachable_unchecked::precondition_check() -> [return: bb1, unwind unreachable]; ``` Simplifying them to unreachable early should make CFG simpler.
deduced_param_attrs: check Freeze on monomorphic types. `deduced_param_attrs` currently checks `Freeze` bound on polymorphic MIR. This pessimizes the deduction, as generic types are not `Freeze` by default. This moves the check to the ABI adjustment.
…athanBrouwer Micro-optimization in `FunctionCx::initialize_locals` This showed up in a profile I was looking at, hoping this might improve perf by a little bit.
hide `alloc::alloc::box_new` in docs It's an internal function which isn't supposed to be used outside standard library / `vec!`.
Do not enable LLD if we don't build host code for targets that opt into it Should fix the problem mentioned in rust-lang/rust#147626 (comment). r? `@jieyouxu`
Offload host2 r? `@oli-obk` A follow-up to my previous gpu host PR. With this, I can (in theory) run a sufficiently simple Rust function on GPUs. I tested it on AMD, where the amdgcn tartget of rustc causes issues due to Addressspace castings, which might not be valid. If I (manually) fix them, I can run the generated IR on an AMD GPU. This should conceptually also work on NVIDIA or Intel. I updated the dev-guide acordingly: https://rustc-dev-guide.rust-lang.org/offload/usage.html I am unhappy with the amount of standalone functions in my offload code, so in my second commit I bundled some of the code around two structs which are Rust versions of the LLVM/Offload structs which they represent. The structs themselves only have doc comments. Since I directly lower everything to llvm-ir I didn't saw a big value in modelling the struct member variables.
handle spurious returns of `wait_timeout` in test Fixes rust-lang/rust#147885 Closes rust-lang/rust#147871 `wait_timeout` is allowed to spuriously return, hence the `timeout_nanoseconds` must not assume that the wakeup resulted from a `notify_all()`.
Add a test for the cold attribute This adds a test for the cold attribute to verify that it actually does something, and that it applies correctly in all the positions it is expected to work.
Make `UnevaluatedConst` have a specific ID type in the new solver For the benefit of rust-analyzer. r? types
|
Thank you for contributing to Miri! |
This comment has been minimized.
This comment has been minimized.
This updates the rust-version file to 96fe3c31c2ec385f3d3263346bcdde3d118cdaf6.
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: 96fe3c31c2ec385f3d3263346bcdde3d118cdaf6 Filtered ref: 376a755 Upstream diff: rust-lang/rust@402ce0e...96fe3c3 This merge was created using https://github.com/rust-lang/josh-sync.
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
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.
No description provided.