Rollup of 9 pull requests#157610
Closed
JonathanBrouwer wants to merge 26 commits into
Closed
Conversation
…nce Option calling `.cloned()` or `.copied()` on `Option<T>` where `T` is an owned type emitted "`Option<T>` is not an iterator" with a suggestion to prepend `.into_iter()`. the suggested code still did not compile: `Option<T>::into_iter()` yields `T` by value not `&T`, so `.cloned()`/`.copied()` failed again for the same reason. `Option<T>` implements `IntoIterator`, which is why the `impl_into_iterator_should_be_iterator` branch fires. added a guard before it: when the method is `cloned`/`copied`, the receiver is `Option<T>`, and `T` is a concrete non-reference type, emit a targeted label pointing at the correct form (`Option<&T>`) and suggest removing the call instead.
…y 'unused' size_of calls
Inconsistency happens when subdiagnostic pads the main diagnostic with an empty source line (aka "|"). Meanwhile the parallel frontend might bunch subdiagnostics on a single primary diagnostic, removing padding from some other one. Revert "Update reproducibly failing tests when parallel frontend is enabled" This reverts commit f582193. Apply a test directive format suggested by a reviewer Bless thine tests
…d in comptime fn
…rgetted at what it does
Co-authored-by: Taiki Endo <te316e89@gmail.com> Co-authored-by: Kerry Jones <kerry@iodrive.co.za>
asm! support for the Xtensa architecture This implements the asm! support for Xtensa. We've been using this code for a few years in [our fork](https://github.com/esp-rs/rust) and it's been working well. I finally found some time to clean it up a bit and start the upstreaming process. This should be one of the final PRs for Xtensa support on the Rust side (minus bug fixes of course). After this, we're mostly just waiting on the LLVM upstreaming which is going well. This PR doesn't cover all possible asm options for Xtensa, but the base ISA plus a few extras that are used in Espressif chips. r? Amanieu
Add very basic "comptime" fn implementation Implements functions that cannot be called at runtime (and thus also not from normal const functions, as those could be called from runtime). This is done via the internal attribute `rustc_comptime` that can be added to normal functions, turning them into compile-time-only functions. Because @fee1-dead and @compiler-errors did amazing work, we even get trait bounds that work inside comptime fns: via unconditionally-const `const Trait` bounds. Use cases are * rust-lang#146923 * const heap intrinsics * and the other various intrinsics (e.g. size_of 😆) that will just ICE in codegen or panic at runtime if they actually end up in runtime code project goal issue: rust-lang/rust-project-goals#406 no tracking issue until we have a feature gate and some sort of syntax cc @scottmcm as the T-lang goal champion
…cs-in-tests, r=petrochenkov Fix unstable diagnostics in tests The main inconsistency in changed tests happens when subdiagnostic pads the main diagnostic with an empty source line (aka "|"). Meanwhile the parallel frontend might bunch subdiagnostics on a single primary diagnostic, removing padding from some other one. So we can just ignore "|" lines. Updates rust-lang#154314 Reverts rust-lang#157103
…acro_API, r=Mark-Simulacrum Add `_value` API for number literals in proc-macro Part of rust-lang#136652. This PR adds the `*_value` for numbers (integers and floats). However, `f16` and `f128` are voluntarily left out as they're still unstable. Adding support for them is just a matter of uncommenting two lines, so should be fine. Setting same reviewer as last time. r? @Urgau
…diagnostic, r=folkertdev fix: don't suggest .into_iter() for .cloned()/.copied() on non-reference Option calling `.cloned()` or `.copied()` on `Option<T>` where `T` is an owned type emitted "`Option<T>` is not an iterator" with a suggestion to prepend `.into_iter()`. the suggested code still did not compile: `Option<T>::into_iter()` yields `T` by value not `&T` so `.cloned()`/`.copied()` failed again for the same reason. `Option<T>` implements `IntoIterator` which is why the `impl_into_iterator_should_be_iterator` branch fires. added a guard before it: when the method is `cloned`/`copied`, the receiver is `Option<T>` and `T` is a concrete non-reference type. emit a targeted label pointing at the correct form (`Option<&T>`) and suggest removing the call instead. closes rust-lang#151147
…=Nadrieril Fix diagnostics for non-exhaustive destructuring assignments (rust-lang#157553) Assigning to a refutable pattern (e.g. `Foo::One = Foo::One;`) is a destructuring assignment, which is lowered to a `let` binding. When the pattern was refutable, the refutability check reported it as a `let` binding. This detects the `AssignDesugar` origin during match checking and reports it as an assignment instead, dropping the `let`-specific note and suggestion. Fixes rust-lang#157553.
explain that the size_of constant also serves to avoid optimizing away 'unused' size_of calls
During a discussion at the all-hands I got worried that we might do uncanny optimizations on code like this which would lead to that code actually compiling
```rust
#![crate_type = "lib"]
#[unsafe(no_mangle)] // ensure this gets monomorphized
pub fn f() {
assert_valid_type::<[u32; 1 << 62]>();
}
pub fn assert_valid_type<T>() {
std::mem::size_of::<T>();
}
```
We do something like that for [even more cursed similar code](https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=41b84c5e705c9d86a05a919e2135e2d3).
But turns out that for `size_of`, we are good! Ever since that was made a constant, the required_consts system ensures that we do indeed evaluate the constant even if we do not use its results.
r? @oli-obk
…st, r=JonathanBrouwer test: remove ineffective link-extern-crate-with-drop-type test Closes rust-lang#157477 Removed `tests/ui/cross-crate/link-extern-crate-with-drop-type.rs` and its auxiliary file. As discussed in the issue, this test was meant for language-level "resources" which were removed from Rust long ago, making the current test ineffective. Verified locally that the remaining tests in `tests/ui/cross-crate` pass successfully.
…-path, r=mu001999 rustdoc: Remove unnecessary fast path I added this "fast path" prematurely in PR rust-lang#116882. It's not actually necessary as this perf run shows: rust-lang#146483 (comment) (https://perf.rust-lang.org/compare.html?start=40ace17fc3891155bad26a50d60a9ab07b83bf8e&end=a77816d56c8fdadab64ae3f9fe1a653bfdb975a8&stat=instructions:u). Let's remove it since makes it slightly more annoying to add new reprs (one would need to update two places).
Contributor
Author
Contributor
Contributor
|
⌛ Trying commit 5ece1be with merge 050062c… To cancel the try build, run the command Workflow: https://github.com/rust-lang/rust/actions/runs/27141322115 |
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 8, 2026
Rollup of 9 pull requests try-job: dist-various-1 try-job: test-various try-job: x86_64-gnu-aux try-job: x86_64-gnu-llvm-21-3 try-job: x86_64-msvc-1 try-job: aarch64-apple try-job: x86_64-mingw-1 try-job: i686-msvc-2
Contributor
|
This pull request was unapproved due to being closed. |
Contributor
Author
|
@bors try cancel |
Contributor
|
Try build cancelled. Cancelled workflows: |
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:
_valueAPI for number literals in proc-macro #154608 (Add_valueAPI for number literals in proc-macro)r? @ghost
Create a similar rollup