about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-04-30Rollup merge of #140437 - husqvarnagroup:af/codegen-test-mips-msa, r=jieyouxuMatthias Krüger-2/+13
enable msa feature for mips in codegen tests Fix codegen unit tests for mips by enabling the msa target feature.
2025-04-30Rollup merge of #140404 - lcnr:canonical-no-type-foldable, r=compiler-errorsMatthias Krüger-26/+4
rm `TypeVistable` impls for `Canonical` similar to `EarlyBinder`, you generally do not want to fold a canonical value directly without first instantiating it. In places where you do want to look into the `Canonical`, it's likely better to do so manually. r? ```@compiler-errors```
2025-04-30Rollup merge of #140312 - nnethercote:DelimArgs-spacing, r=petrochenkovMatthias Krüger-30/+63
Improve pretty-printing of braces r? ````@petrochenkov````
2025-04-30Rollup merge of #139192 - ↵Matthias Krüger-4/+6
lolbinarycat:docs-wrapping_offset-provenance-139008, r=RalfJung mention provenance in the pointer::wrapping_offset docs fixes https://github.com/rust-lang/rust/issues/139008
2025-04-30Rollup merge of #139059 - RalfJung:uses_power_alignment, r=nagisaMatthias Krüger-21/+14
uses_power_alignment: wording tweaks Slightly improves the wording introduced with https://github.com/rust-lang/rust/pull/135552.
2025-04-30Rollup merge of #136160 - ShE3py:should-panic-backticks, r=thomccMatthias Krüger-11/+10
Remove backticks from `ShouldPanic::YesWithMessage`'s `TrFailedMsg` More legible imo ```rs #[test] #[should_panic = "love"] fn foo() { assert!(1 == 2); } ``` Before: ``` note: panic did not contain expected string panic message: `"assertion failed: 1 == 2"`, expected substring: `"love"` ``` After: ``` note: panic did not contain expected string panic message: "assertion failed: 1 == 2" expected substring: "love" ``` Also removed the comma as `assert_eq!` / `assert_ne!` don't use one. ``@rustbot`` label +A-libtest
2025-04-30Auto merge of #140188 - nnethercote:streamline-format-macro, r=cuviperbors-10/+7
Streamline the `format` macro. Removing the unnecessary local variable speeds up compilation a little. r? `@cuviper`
2025-04-30Auto merge of #127516 - nnethercote:simplify-LazyAttrTokenStream, r=petrochenkovbors-378/+399
Simplify `LazyAttrTokenStream` `LazyAttrTokenStream` is an unpleasant type: `Lrc<Box<dyn ToAttrTokenStream>>`. Why does it look like that? - There are two `ToAttrTokenStream` impls, one for the lazy case, and one for the case where we already have an `AttrTokenStream`. - The lazy case (`LazyAttrTokenStreamImpl`) is implemented in `rustc_parse`, but `LazyAttrTokenStream` is defined in `rustc_ast`, which does not depend on `rustc_parse`. The use of the trait lets `rustc_ast` implicitly depend on `rustc_parse`. This explains the `dyn`. - `LazyAttrTokenStream` must have a `size_of` as small as possible, because it's used in many AST nodes. This explains the `Lrc<Box<_>>`, which keeps it to one word. (It's required `Lrc<dyn _>` would be a fat pointer.) This PR moves `LazyAttrTokenStreamImpl` (and a few other token stream things) from `rustc_parse` to `rustc_ast`. This lets us replace the `ToAttrTokenStream` trait with a two-variant enum and also remove the `Box`, changing `LazyAttrTokenStream` to `Lrc<LazyAttrTokenStreamInner>`. Plus it does a few cleanups. r? `@petrochenkov`
2025-04-29canonical no type foldable :<lcnr-26/+4
2025-04-30Use `ThinVec` to shrink `LazyAttrTokenStreamInner`.Nicholas Nethercote-5/+7
2025-04-30Simplify `LazyAttrTokenStream`.Nicholas Nethercote-118/+138
This commit does the following. - Changes it from `Lrc<Box<dyn ToAttrTokenStream>>` to `Lrc<LazyAttrTokenStreamInner>`. - Reworks `LazyAttrTokenStreamImpl` as `LazyAttrTokenStreamInner`, which is a two-variant enum. - Removes the `ToAttrTokenStream` trait and the two impls of it. The recursion limit must be increased in some crates otherwise rustdoc aborts.
2025-04-29Auto merge of #140023 - cjgillot:arena-try-alloc, r=BoxyUwUbors-33/+47
Introduce Arena::try_alloc_from_iter. `alloc_from_iter` already collects the iterator for reentrancy. So adding an early exit for a fallible iterator integrates naturally into the code. This avoids the other solution to allocate and dump the allocation.
2025-04-29mention provenance in the pointer::wrapping_offset docsbinarycat-4/+6
fixes https://github.com/rust-lang/rust/issues/139008
2025-04-29Auto merge of #140474 - tgross35:rollup-rdkao89, r=tgross35bors-274/+691
Rollup of 7 pull requests Successful merges: - #138344 (Enable `reliable_f16_math` on x86) - #139909 (implement or-patterns for pattern types) - #140392 (compiletest: Remove the libtest-based executor and its dependency) - #140400 (PassWrapper: adapt for llvm/llvm-project@d3d856ad8469) - #140422 (unwind: bump `unwinding` dependency to 0.2.6) - #140432 (Update documentation for `fn target_config`) - #140433 (Replace the \01__gnu_mcount_nc to LLVM intrinsic for additional ARM targets) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-29Rollup merge of #140433 - BjoernLange:master, r=nnethercoteTrevor Gross-0/+2
Replace the \01__gnu_mcount_nc to LLVM intrinsic for additional ARM targets This is an extension to #113814 which seems to have missed two targets which also need this patch for instrumentation with `-Z instrument-mcount` to work correctly. For anyone who might stumble over this issue again in the future: As a workaround one can dump the current target configuration using ``` rustc +nightly -Z unstable-options --target armv7-unknown-linux-gnueabihf --print target-spec-json ``` (assuming `armv7-unknown-linux-gnueabihf` is the target to build for) add the line ``` "llvm-mcount-intrinsic": "llvm.arm.gnu.eabi.mcount", ``` and compile with ``` RUSTFLAGS="-Z instrument-mcount -C passes=ee-instrument<post-inline>" cargo +nightly build -Z build-std --target <path to directory with modified target config>/armv7-unknown-linux-gnueabihf.json ``` It might be necessary to set the compiler for cross compiling using something like ``` export TARGET_CC=arm-linux-gnueabihf-gcc ```
2025-04-29Rollup merge of #140432 - tgross35:target-config-docs-update, r=jieyouxuTrevor Gross-5/+4
Update documentation for `fn target_config` This was missed as part of [1]. [1]: https://github.com/rust-lang/rust/pull/140323
2025-04-29Rollup merge of #140422 - betrusted-io:bump-unwinding-to-0.2.6, r=workingjubileeTrevor Gross-3/+3
unwind: bump `unwinding` dependency to 0.2.6 Xous now fails to compile under nightly, due to the recent change where `#[naked]` must now be wrapped in `unsafe(...)`. The `unwinding` crate was updated to account for this. With the following `bootstrap.toml`: ``` profile = "library" change-id = 138934 [build] build-stage = 2 target = ["riscv32imac-unknown-xous-elf"] [rust] std-features = ["panic-unwind"] download-rustc = false ``` The build fails when trying unwinding v0.2.5: ``` $ ./x.py build [...] Compiling unwinding v0.2.5 error: unsafe attribute used without unsafe --> /home/user/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/unwinding-0.2.5/src/unwinder/arch/riscv32.rs:176:3 | 176 | #[naked] | ^^^^^ usage of unsafe attribute | help: wrap the attribute in `unsafe(...)` | 176 | #[unsafe(naked)] | +++++++ + error: could not compile `unwinding` (lib) due to 1 previous error warning: build failed, waiting for other jobs to finish... Build completed unsuccessfully in 0:06:26 $ ``` This patch updates `unwinding` to v0.2.6, which now wraps all issues of `naked` in `unsafe()`.
2025-04-29Rollup merge of #140400 - durin42:llvm-21-getguid, r=cuviperTrevor Gross-4/+9
PassWrapper: adapt for llvm/llvm-project@d3d856ad8469 LLVM 21 moves to making it more explicit what this function call is doing, but nothing has changed behaviorally, so for now we just adjust to using the new name of the function. `@rustbot` label llvm-main
2025-04-29Rollup merge of #140392 - Zalathar:goodbye-libtest, r=jieyouxuTrevor Gross-133/+8
compiletest: Remove the libtest-based executor and its dependency Now that #140288 has landed and the new compiletest executor is used by default, we can now move forward with removing the libtest dependency from compiletest. My hope is that after landing this, we can configure bootstrap to build compiletest with the pre-built stage0 library by default, instead of the in-tree stage0 library. That would give the stage0 redesign one less thing to worry about. --- This PR has deliberately been kept small and simple, to make it easier to revert if necessary. Further cleanup can take palce after we're confident that it won't need to be reverted. r? jieyouxu Blocker for https://github.com/rust-lang/rust/pull/119899
2025-04-29Rollup merge of #139909 - oli-obk:or-patterns, r=BoxyUwUTrevor Gross-122/+662
implement or-patterns for pattern types These are necessary to represent `NonZeroI32`, as the range for that is `..0 | 1..`. The `rustc_scalar_layout_range_*` attributes avoided this by just implementing wraparound and having a single `1..=-1` range effectively. See https://rust-lang.zulipchat.com/#narrow/channel/481660-t-lang.2Fpattern-types/topic/.60or.20pattern.60.20representation.20in.20type.20system/with/504217694 for some background discussion cc https://github.com/rust-lang/rust/issues/123646 r? `@BoxyUwU`
2025-04-29Rollup merge of #138344 - tgross35:x86-f16-math, r=AmanieuTrevor Gross-7/+3
Enable `reliable_f16_math` on x86 This has been disabled due to an LLVM misoptimization with `powi.f16` [1]. This was fixed upstream and the fix is included in LLVM20, so tests no longer need to be disabled. `f16` still remains disabled on MinGW due to the ABI issue. [1]: https://github.com/llvm/llvm-project/issues/98665 try-job: x86_64-gnu try-job: x86_64-gnu-llvm-19-1 try-job: x86_64-gnu-llvm-20-1
2025-04-29Auto merge of #140436 - RalfJung:miri-sync, r=RalfJungbors-304/+799
Miri subtree update r? `@ghost`
2025-04-29enable msa feature for mips in codegen testsAdrian Friedli-2/+13
2025-04-29Merge pull request #4301 from rust-lang/rustup-2025-04-29Ralf Jung-3796/+7701
Automatic Rustup
2025-04-29suppress dangerous_implicit_autorefs in TB testRalf Jung-0/+1
2025-04-29fmtThe Miri Cronjob Bot-7/+3
2025-04-29Merge from rustcThe Miri Cronjob Bot-3797/+7705
2025-04-29Preparing for merge from rustcThe Miri Cronjob Bot-1/+1
2025-04-29Replace the \01__gnu_mcount_nc to LLVM intrinsic for additional ARM targetsBjörn Barwinski-0/+2
2025-04-29Update documentation for `fn target_config`Trevor Gross-5/+4
This was missed as part of [1]. [1]: https://github.com/rust-lang/rust/pull/140323
2025-04-29Enable `target_has_reliable_f16_math` on x86Trevor Gross-7/+3
This has been disabled due to an LLVM misoptimization with `powi.f16` [1]. This was fixed upstream and the fix is included in LLVM20, so tests no longer need to be disabled. `f16` still remains disabled on MinGW due to the ABI issue. [1]: https://github.com/llvm/llvm-project/issues/98665
2025-04-29Auto merge of #137940 - 1c3t3a:alignment-borrows-check, r=saethlinbors-32/+88
Extend the alignment check to borrows The current alignment check does not include checks for creating misaligned references from raw pointers, which is now added in this patch. When inserting the check we need to be careful with references to field projections (e.g. `&(*ptr).a`), in which case the resulting reference must be aligned according to the field type and not the type of the pointer. r? `@saethlin` cc `@RalfJung,` after our discussion in #134424
2025-04-29Improve pretty-printing of braces.Nicholas Nethercote-29/+46
Most notably, the `FIXME` for suboptimal printing of `use` groups in `tests/ui/macros/stringify.rs` is fixed. And all other test output changes result in pretty printed output being closer to the original formatting in the source code.
2025-04-29Add a few extra tests to `tests/ui/macros/stringify.rs`.Nicholas Nethercote-2/+18
2025-04-29Auto merge of #140415 - ChrisDenton:rollup-r0631fv, r=ChrisDentonbors-519/+1693
Rollup of 10 pull requests Successful merges: - #139308 (add autodiff inline) - #139656 (Stabilize `slice_as_chunks` library feature) - #140022 (allow deref patterns to move out of boxes) - #140276 (Do not compute type_of for impl item if impl where clauses are unsatisfied) - #140302 (Move inline asm check to typeck, properly handle aliases) - #140323 (Implement the internal feature `cfg_target_has_reliable_f16_f128`) - #140391 (Rename sub_ptr to offset_from_unsigned in docs) - #140394 (Make bootstrap git tests more self-contained) - #140396 (Workaround for windows-gnu rust-lld test failure) - #140402 (only return nested goals for `Certainty::Yes`) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-29Move various token stream things from `rustc_parse` to `rustc_ast`.Nicholas Nethercote-339/+338
Specifically: `TokenCursor`, `TokenTreeCursor`, `LazyAttrTokenStreamImpl`, `FlatToken`, `make_attr_token_stream`, `ParserRange`, `NodeRange`. `ParserReplacement`, and `NodeReplacement`. These are all related to token streams, rather than actual parsing. This will facilitate the simplifications in the next commit.
2025-04-29unwind: bump `unwinding` dependency to 0.2.6Sean Cross-3/+3
With a recent change to the compiler, all instances of `#[naked]` must now be wrapped in `#[unsafe(naked)]`. The `unwinding` crate, which is used on Xous for doing unwinding in constrained environments, needed to be updated to handle this change. Bump the `unwinding` dependency to 0.2.6, which performs this wrapping. Signed-off-by: Sean Cross <sean@xobs.io>
2025-04-28Rollup merge of #140402 - lcnr:normalizes-to-certainty-yes, r=compiler-errorsChris Denton-32/+66
only return nested goals for `Certainty::Yes` Ambiguous `NormalizesTo` goals can otherwise repeatedly add the same nested goals to the parent. r? ```@compiler-errors```
2025-04-28Rollup merge of #140396 - ChrisDenton:gnu-threads, r=jieyouxuChris Denton-0/+6
Workaround for windows-gnu rust-lld test failure The test run-make/amdgpu-kd has an issue on windows-gnu where rust-lld will sometimes fail with error 0xc0000374 (`STATUS_HEAP_CORRUPTION`). This works around the issue by passing `--threads=1` to the linker as suggested [here](https://github.com/rust-lang/rust/issues/115985#issuecomment-1754112623). Note I don't know if this will help and it happens only sometimes in our CI so it's hard to test.
2025-04-28Rollup merge of #140394 - Kobzol:git-test-self-contained, r=jieyouxuChris Denton-0/+3
Make bootstrap git tests more self-contained Based on https://stackoverflow.com/a/67512433/1107768. Fixes: https://github.com/rust-lang/rust/issues/140387 r? ```@jieyouxu```
2025-04-28Rollup merge of #140391 - DaniPopes:sub-ptr-rename, r=RalfJungChris Denton-14/+15
Rename sub_ptr to offset_from_unsigned in docs There are still a few mentions of `sub_ptr` in comments and doc comments, which were missed in https://github.com/rust-lang/rust/pull/137483.
2025-04-28Rollup merge of #140323 - tgross35:cfg-unstable-float, r=UrgauChris Denton-289/+959
Implement the internal feature `cfg_target_has_reliable_f16_f128` Support for `f16` and `f128` is varied across targets, backends, and backend versions. Eventually we would like to reach a point where all backends support these approximately equally, but until then we have to work around some of these nuances of support being observable. Introduce the `cfg_target_has_reliable_f16_f128` internal feature, which provides the following new configuration gates: * `cfg(target_has_reliable_f16)` * `cfg(target_has_reliable_f16_math)` * `cfg(target_has_reliable_f128)` * `cfg(target_has_reliable_f128_math)` `reliable_f16` and `reliable_f128` indicate that basic arithmetic for the type works correctly. The `_math` versions indicate that anything relying on `libm` works correctly, since sometimes this hits a separate class of codegen bugs. These options match configuration set by the build script at [1]. The logic for LLVM support is duplicated as-is from the same script. There are a few possible updates that will come as a follow up. The config introduced here is not planned to ever become stable, it is only intended to replace the build scripts for `std` tests and `compiler-builtins` that don't have any way to configure based on the codegen backend. MCP: https://github.com/rust-lang/compiler-team/issues/866 Closes: https://github.com/rust-lang/compiler-team/issues/866 [1]: https://github.com/rust-lang/rust/blob/555e1d0386f024a8359645c3217f4b3eae9be042/library/std/build.rs#L84-L186 --- The second commit makes use of this config to replace `cfg_{f16,f128}{,_math}` in `library/`. I omitted providing a `cfg(bootstrap)` configuration to keep things simpler since the next beta branch is in two weeks. try-job: aarch64-gnu try-job: i686-msvc-1 try-job: test-various try-job: x86_64-gnu try-job: x86_64-msvc-ext2
2025-04-28Rollup merge of #140302 - compiler-errors:inline_asm-bug, r=lcnrChris Denton-73/+86
Move inline asm check to typeck, properly handle aliases Pull `InlineAsmCtxt` down to `rustc_hir_typeck`, and instead of using things like `Ty::is_copy`, use the `InferCtxt`-aware methods. To fix https://github.com/rust-lang/trait-system-refactor-initiative/issues/189, we also add a `try_structurally_resolve_*` call to `expr_ty`. r? lcnr
2025-04-28Rollup merge of #140276 - compiler-errors:typeof-less-eagerly, r=lcnrChris Denton-0/+77
Do not compute type_of for impl item if impl where clauses are unsatisfied Consider the following code: ```rust trait Foo { fn call(self) -> impl Send; } trait Nested {} impl<T> Foo for T where T: Nested, { fn call(self) -> impl Sized { NotSatisfied.call() } } struct NotSatisfied; impl Foo for NotSatisfied { fn call(self) -> impl Sized { todo!() } } ``` In `impl Foo for NotSatisfied`, we need to prove that the RPITIT is well formed. This requires proving the item bound `<NotSatisfied as Foo>::RPITIT: Send`. Normalizing `<NotSatisfied as Foo>::RPITIT: Send` assembles two impl candidates, via the `NotSatisfied` impl and the blanket `T` impl. We end up computing the `type_of` for the blanket impl even if `NotSatisfied: Nested` where clause does not hold. This type_of query ends up needing to prove that its own `impl Sized` RPIT satisfies `Send`, which ends up needing to compute the hidden type of the RPIT, which is equal to the return type of `NotSatisfied.call()`. That ends up in a query cycle, since we subsequently try normalizing that return type via the blanket impl again! In the old solver, we don't end up computing the `type_of` an impl candidate if its where clauses don't hold, since this select call would fail before confirming the projection candidate: https://github.com/rust-lang/rust/blob/d7ea436a02d5de4033fcf7fd4eb8ed965d0f574c/compiler/rustc_trait_selection/src/traits/project.rs#L882 This PR makes the new solver more consistent with the old solver by adding a call to `try_evaluate_added_goals` after regstering the impl predicates, which causes us to bail before computing the `type_of` for impls if the impl definitely doesn't apply. r? lcnr Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/185
2025-04-28Rollup merge of #140022 - dianne:box-deref-pats, r=NadrierilChris Denton-82/+229
allow deref patterns to move out of boxes This adds a case to lower deref patterns on boxes using a built-in deref instead of a `Deref::deref` or `DerefMut::deref_mut` call: if `deref!(inner): Box<T>` is matching on place `place`, the inner pattern `inner` now matches on `*place` rather than a temporary. No longer needing to call a method also means it won't borrow the scrutinee in match arms. This allows for bindings in `inner` to move out of `*place`. For comparison with box patterns, this uses the same MIR lowering but different THIR. Consequently, deref patterns on boxes are treated the same as any other deref patterns in match exhaustiveness analysis. Box patterns can't quite be implemented in terms of deref patterns until exhaustiveness checking for deref patterns is implemented (I'll open a PR for exhaustiveness soon!). Tracking issue: #87121 r? ``@Nadrieril``
2025-04-28Rollup merge of #139656 - scottmcm:stabilize-slice-as-chunks, r=dtolnayChris Denton-27/+107
Stabilize `slice_as_chunks` library feature ~~Draft as this needs #139163 to land first.~~ FCP: https://github.com/rust-lang/rust/issues/74985#issuecomment-2769963395 Methods being stabilized are: ```rust impl [T] { const fn as_chunks<const N: usize>(&self) -> (&[[T; N]], &[T]); const fn as_rchunks<const N: usize>(&self) -> (&[T], &[[T; N]]); const unsafe fn as_chunks_unchecked<const N: usize>(&self) -> &[[T; N]]; const fn as_chunks_mut<const N: usize>(&mut self) -> (&mut [[T; N]], &mut [T]); const fn as_rchunks_mut<const N: usize>(&mut self) -> (&mut [T], &mut [[T; N]]); const unsafe fn as_chunks_unchecked_mut<const N: usize>(&mut self) -> &mut [[T; N]]; } ``` ~~(FCP's not done quite yet, but will in another day if I'm counting right.)~~ FCP Complete: https://github.com/rust-lang/rust/issues/74985#issuecomment-2797951535
2025-04-28Rollup merge of #139308 - Shourya742:2025-03-29-add-autodiff-inline, r=ZuseZ4Chris Denton-2/+145
add autodiff inline closes: #138920 r? ```@ZuseZ4``` try-job: dist-aarch64-linux
2025-04-28Workaround for windows-gnu rust-lld test failureChris Denton-0/+6
The test run-make/amdgpu-kd has an issue where rust-lld will sometimes fail with error 0xc0000374 (STATUS_HEAP_CORRUPTION).
2025-04-28Remove backticks from `ShouldPanic::YesWithMessage`'s `TrFailedMsg`Lieselotte-11/+10
2025-04-28Auto merge of #140388 - GuillaumeGomez:rollup-aj9o3ch, r=GuillaumeGomezbors-743/+874
Rollup of 7 pull requests Successful merges: - #140056 (Fix a wrong error message in 2024 edition) - #140220 (Fix detection of main function if there are expressions around it) - #140249 (Remove `weak` alias terminology) - #140316 (Introduce `BoxMarker` to improve pretty-printing correctness) - #140347 (ci: clean more disk space in codebuild) - #140349 (ci: use aws codebuild for the `dist-x86_64-linux` job) - #140379 (rustc-dev-guide subtree update) r? `@ghost` `@rustbot` modify labels: rollup