Merged
Conversation
Skipping FileCheck in codegen/assembly tests is normally not very useful, but a small number of existing tests were using `//@ build-pass` to do so anyway, so it's clearer for them to explicitly use `//@ skip-filecheck` instead.
codegen: Copy to an alloca when the argument is neither by-val nor by-move for indirect pointer. Fixes rust-lang/rust#155241. When a value is passed via an indirect pointer, the value needs to be copied to a new alloca. For x86_64-unknown-linux-gnu, `Thing` is the case: ```rust #[derive(Clone, Copy)] struct Thing(usize, usize, usize); pub fn foo() { let thing = Thing(0, 0, 0); bar(thing); assert_eq!(thing.0, 0); } #[inline(never)] #[unsafe(no_mangle)] pub fn bar(mut thing: Thing) { thing.0 = 1; } ``` Before passing the thing to the bar function, the thing needs to be copied to an alloca that is passed to bar. ```llvm %0 = alloca [24 x i8], align 8 call void @llvm.memcpy.p0.p0.i64(ptr align 8 %0, ptr align 8 %thing, i64 24, i1 false) call void @bar(ptr %0) ``` This patch applies the rule to the untupled arguments as well. ```rust #![feature(fn_traits)] #[derive(Clone, Copy)] struct Thing(usize, usize, usize); #[inline(never)] #[unsafe(no_mangle)] pub fn foo() { let thing = (Thing(0, 0, 0),); (|mut thing: Thing| { thing.0 = 1; }).call(thing); assert_eq!(thing.0.0, 0); } ``` For this case, this patch changes from ```llvm ; call example::foo::{closure#0} call void @_RNCNvCs15qdZVLwHPA_7example3foo0B3_(ptr ..., ptr %thing) ``` to ```llvm %0 = alloca [24 x i8], align 8 call void @llvm.memcpy.p0.p0.i64(ptr align 8 %0, ptr align 8 %thing, i64 24, i1 false) ; call example::foo::{closure#0} call void @_RNCNvCs15qdZVLwHPA_7example3foo0B3_(ptr ..., ptr %0) ``` However, the same rule cannot be applied to tail calls that would be unsound, because the caller's stack frame is overwritten by the callee's stack frame. Fortunately, rust-lang/rust#151143 has already handled the special case. We must not copy again. No copy is needed for by-move arguments, because the argument is passed to the called "in-place". No copy is also needed for by-val arguments, because the attribute implies that a hidden copy of the pointee is made between the caller and the callee. NOTE: The patch has a trick for tail calls that we pass by-move. We can choose to copy an alloca even for by-move arguments, but tail calls require MUST-by-move.
Document precision considerations of `Duration`-float methods A `Duration` is essentially a 94-bit value (64-bit sec and ~30-bit ns), so there's some inherent loss when converting to floating-point for `mul_f64` and `div_f64`. We could go to greater lengths to compute these with more accuracy, like rust-lang/rust#150933 or rust-lang/rust#154107, but it's not clear that it's worth the effort. The least we can do is document that some rounding is to be expected, which this commit does with simple examples that only multiply or divide by `1.0`. This also changes the `f32` methods to just forward to `f64`, so we keep more of that duration precision, as the range is otherwise much more limited there.
…rcote Remove `nodes_in_current_session` field and related assertions This removes the `nodes_in_current_session` field and related assertions. These are enabled if `-Z incremental-verify-ich` is passed or `debug_assertions` is on. Historically these have been useful to catch query keys with improper `HashStable` impls which lead to collisions. We currently also check for duplicate nodes when loading the dep graph. This check is more complete as it covers the entire dep graph and is enabled by default. It doesn't provide a query key for a collision however. This check is also delayed to the next incremental session. We also have the `verify_query_key_hashes` which is also enabled if `-Z incremental-verify-ich` is passed or `debug_assertions` is on. This checks for dep node conflicts in each query cache and provides 2 conflicting keys if present. I think these remaining checks are sufficient and so we can remove `nodes_in_current_session`.
rustdoc: fix a few spots where emit isn't respected Addresses the third list item of rust-lang/rust#155298
…nkov Immediately feed visibility on DefId creation This system was originally introduced in rust-lang/rust#121089 This PR was enabled by refactorings in rust-lang/rust#154945, because after that, the visibility feeding happens directly after the `DefId` creation, so we don't need to go through the intermediate hash table anymore Should unblock rust-lang/rust#138995
c-variadic: `va_arg` fixes tracking issue: rust-lang/rust#44930 extracts some generic LLVM `va_arg` fixes from rust-lang/rust#152576 and rust-lang/rust#155429. r? tgross35
rustc_public: Add `constness` & `asyncness` in `FnDef` Resolves [https://github.com/rust-lang/project-stable-mir/issues/111](https://github.com/rust-lang/project-stable-mir/issues/111).
Some metadata cleanups Details in individual commits. r? @mejrs
BinOpAssign always returns unit I don't know why we treated assign ops as returning their binop type sometimes, but it's usually ignored later anyway and mostly affects infer vars. Also updated a comment from 11 years ago when SIMD types apparently had builtin `==` logic.
rustc-dev-guide subtree update Subtree update of `rustc-dev-guide` to bed088a. Created using https://github.com/rust-lang/josh-sync. r? @ghost
…uwer Rollup of 10 pull requests Successful merges: - rust-lang/rust#154794 (Add on_unmatch_args) - rust-lang/rust#155133 (Document precision considerations of `Duration`-float methods) - rust-lang/rust#154283 (Remove `nodes_in_current_session` field and related assertions) - rust-lang/rust#155374 (rustdoc: fix a few spots where emit isn't respected) - rust-lang/rust#155587 (Immediately feed visibility on DefId creation) - rust-lang/rust#155622 (c-variadic: `va_arg` fixes ) - rust-lang/rust#155629 (rustc_public: Add `constness` & `asyncness` in `FnDef`) - rust-lang/rust#155632 (Some metadata cleanups) - rust-lang/rust#155639 (BinOpAssign always returns unit) - rust-lang/rust#155647 (rustc-dev-guide subtree update)
Replace `ShardedHashMap` method `insert` with debug-checked `insert_unique` Currently every use of `ShardedHashMap::insert` checks that it won't evict an old value due to unique key. I haven't found any issue related to that faulty condition, so I thought of replacing it with `ShardedHashMap::insert_unique` which doesn't check for this condition unless `debug_assertions` are enabled. This might improve the performance. r? @petrochenkov
Update to wasi-sdk-32 in CI/releases Similar to prior updates such as rust-lang/rust#149037. This notably pulls in some bug fixes for wasi-libc around nonblocking I/O and networking.
This is a callback used to track otherwise untracked state. It was added in #116731 for Clippy. (It was originally named `hash_untracked_state`, and examples in the rustc-dev-guide still use that name.) The `StableHasher` argument is unused, and probably has never been used. There is a FIXME comment pointing this out, which was added more than a year ago. This commit removes the `StableHasher` callback argument. This also removes the need for `Options::untracked_state_hash`.
rustc_thread_pool: Make `CoreLatch::set` use `SeqCst` instead of `AcqRel` Every other modification of this variable uses `SeqCst`, which is justified in the sleep README. This particular choice of `AcqRel` was not discussed during its addition in rayon-rs/rayon#746, nor rayon-rs/rfcs#5, so I suspect was simply an oversight from earlier development. We probably do want this to participate in the same sequential consistency. The only other ordering difference is `CoreLatch::probe`'s load with `Acquire`, which should be fine because this doesn't need consistency with the sleep counters. See also rayon-rs/rayon#1297. As I commented there, I think in practice this would be quite rare to cause any problems, but it *could* be a source of non-deterministic bugs on targets with weak memory ordering.
mir-opt: Remove the workaround in UnreachableEnumBranching rust-lang/rust#120268 added a workaround due to the compile time of TailDuplicator. LLVM 20 has resolved this in llvm/llvm-project#114990 and llvm/llvm-project#132536.
…, r=jackh726 Fix ICE for inherent associated type mismatches Avoid projection-only suggestions for inherent associated types. Closes rust-lang/rust#154333 Closes rust-lang/rust#155204
Improved assumptions relating to isqrt Improved various assumptions relating to values yielded by `isqrt`. Does not solve but does improve rust-lang/rust#132763. Re-openeing of rust-lang/rust#154115 Added assumptions are: * if `x` is nonzero then `x.isqrt()` is nonzero * `x.isqrt() <= x` * `x.isqrt() * x.isqrt() <= x`
…=wesleywiser
Mark a function only used in nightly as nightly only
If you run `./x.py test rustc_next_trait_solver` you'll currently see a failure:
```
warning: method `merge` is never used
--> compiler/rustc_abi/src/callconv.rs:38:8
|
25 | impl HomogeneousAggregate {
| ------------------------- method in this implementation
...
38 | fn merge(self, other: HomogeneousAggregate) -> Result<HomogeneousAggregate, Heterogeneous> {
| ^^^^^
|
= note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default
warning: `rustc_abi` (lib) generated 1 warning
```
This is because the usages are behind a nightly feature flag:
https://github.com/rust-lang/rust/blob/fda6d37bb88ee12fd50fa54d15859f1f91b74f55/compiler/rustc_abi/src/callconv.rs#L52
https://github.com/rust-lang/rust/blob/fda6d37bb88ee12fd50fa54d15859f1f91b74f55/compiler/rustc_abi/src/callconv.rs#L131
https://github.com/rust-lang/rust/blob/fda6d37bb88ee12fd50fa54d15859f1f91b74f55/compiler/rustc_abi/src/callconv.rs#L167
This does the flag off.
Test on `main` and this branch:
```
./x.py test rustc_next_trait_solver
```
c-variadic: rename `VaList::arg` to `VaList::next_arg` tracking issue: rust-lang/rust#44930 per [the T-libs-api meeting](https://hackmd.io/d9D6vUnuTnCWygkc3hffEw#nominated-rusttf44930-Tracking-issue-for-RFC-2137-Support-defining-C-compatible-variadic-functions-in-Rust-c_variadic), rename `VaList::arg` to `VaList::next_arg`.
Make `//@ skip-filecheck` a normal compiletest directive The `skip-filecheck` directive is currently used by mir-opt tests, to suppress the default behaviour of running LLVM's `FileCheck` tool to check MIR output against FileCheck rules in the test file. The `skip-filecheck` directive was not included in the big migration to `//@` directive syntax (rust-lang/rust#121370), perhaps because it was parsed and processed in the *miropt-test-tools* helper crate, not in compiletest itself. Recently I noticed that a small number of *codegen-llvm* tests were using the `//@ build-pass` directive, which has the non-obvious effect of skipping FileCheck in codegen tests. That's quite confusing, so I decided to have the mir-opt tests migrate over to a proper `//@ skip-filecheck` directive, which could then be used by codegen tests as well. (I also added skip-filecheck support to assembly tests, which are very similar to codegen tests, though there are currently no assembly tests that actually use `//@ skip-filecheck`.) --- Support for using `//@ build-pass` in codegen tests to skip FileCheck was introduced in rust-lang/rust#113603. With hindsight, I think doing things that way was pretty clearly a mistake, and we'll be better off with `//@ skip-filecheck`. r? jieyouxu
Remove non-working code for "running" mir-opt tests Tests in `tests/mir-opt` always use `--emit=mir`, so the compiler doesn't even produce an executable. Attempting to "run" these tests (e.g. with `./x test mir-opt --pass=run`) therefore fails when the OS notices that a MIR text file is not executable. --- The second commit performs some semi-related cleanup. r? jieyouxu
Expand `Path::is_empty` docs Give some reasons why you might want to check if a path is empty. The `Path::join` behaviour can be surprising if you're not aware it might happen.
rustc_llvm: update opt-level handling for LLVM 23 LLVM 23 removed Os and Oz optimization pipelines and the PR says to use O2 with optsize or minsize instead as appropriate. See llvm/llvm-project#191363 for more details.
…uwer Rollup of 10 pull requests Successful merges: - rust-lang/rust#146544 (mir-opt: Remove the workaround in UnreachableEnumBranching) - rust-lang/rust#154819 (Fix ICE for inherent associated type mismatches) - rust-lang/rust#155265 (Improved assumptions relating to isqrt) - rust-lang/rust#152576 (c-variadic: use `emit_ptr_va_arg` for mips) - rust-lang/rust#154481 (Mark a function only used in nightly as nightly only) - rust-lang/rust#155614 (c-variadic: rename `VaList::arg` to `VaList::next_arg`) - rust-lang/rust#155630 (Make `//@ skip-filecheck` a normal compiletest directive) - rust-lang/rust#155641 (Remove non-working code for "running" mir-opt tests) - rust-lang/rust#155652 (Expand `Path::is_empty` docs) - rust-lang/rust#155656 (rustc_llvm: update opt-level handling for LLVM 23)
Streamline `CrateMetadataRef` construction in `provide_one!`. `cstore.get_crate_data()` creates a `CrateMetadataRef`, which is exactly what we need. The current code is very confused and does several unnecessary things: mapping the `FreezeReadGuard` and calling `CStore::from_tcx` a second time to construct a second `CrateMetadataRef`. This is a small perf win. r? @mu001999
…orn3 Simplify `Config::track_state`. This is a callback used to track otherwise untracked state. It was added in rust-lang/rust#116731 for Clippy. (It was originally named `hash_untracked_state`, and examples in the rustc-dev-guide still use that name.) The `StableHasher` argument is unused, and probably has never been used. There is a FIXME comment pointing this out, which was added more than a year ago. This commit removes the `StableHasher` callback argument. This also removes the need for `Options::untracked_state_hash`. r? @bjorn3
…huss tests/ui/macros: add annotations for reference rules
Add docs about SDKs and C compilation on armv7a-vex-v5 This PR expands the documentation for armv7a-vex-v5 to fix broken links, add more information about SDKs, and create a new section about C compilation. I'm not super familiar with how Rust chooses what linker configuration to use / how the `cc` crate chooses what compiler to use - is this configuration to make C compilation work usually something that would be included in the compiler itself? Either way, it requires a lot of extra work which is kind of unfortunate (downloading a separate compiler, adding it to path, setting up a bunch of environment variables, and making a cargo config for linking).
Fix `get_child_at_index` return type hints returning `None` is valid when the index is invalid, so the type hints should reflect that
Fix array template arg lookup behavior Minor logic error. `get_template_args` expects a matching `<`/`>` pair. We were passing in an array type with the beginning `<` removed, so the template arg behavior would fail.
…uVanilla Const initialize `LOCK_LATCH` thread local A simple refactor to avoid runtime thread-local initialization.
Fix classify_union to return Union for regular unions Commit 623c7d7c4bc accidentally changed the return value from REGULAR_UNION to RegularEnum when converting string literals to enum values. Commit b17670d3de2 then renamed RegularUnion to Union, but the buggy return statement remained unchanged. This caused unions to be misclassified as enums, preventing LLDB from displaying union field contents.
Rollup of 7 pull requests Successful merges: - rust-lang/rust#155660 (c-variadic: fix for sparc64) - rust-lang/rust#153482 (tests/ui/macros: add annotations for reference rules) - rust-lang/rust#155075 (Add docs about SDKs and C compilation on armv7a-vex-v5) - rust-lang/rust#155685 (Fix `get_child_at_index` return type hints) - rust-lang/rust#155686 (Fix array template arg lookup behavior) - rust-lang/rust#155689 (Const initialize `LOCK_LATCH` thread local) - rust-lang/rust#155690 (Fix classify_union to return Union for regular unions)
This updates the rust-version file to d493b7c5ac637ed7edf626128b9f14796a2dad20.
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: rust-lang/rust@d493b7c Filtered ref: 8e19834 Upstream diff: rust-lang/rust@cf1817b...d493b7c This merge was created using https://github.com/rust-lang/josh-sync.
Collaborator
|
Thanks for the PR. If you have write access, feel free to merge this PR if it does not need reviews. You can request a review using |
Collaborator
|
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.
Latest update from rustc.