Commit Graph

327219 Commits

Author SHA1 Message Date
Jonathan Brouwer 18bedf4bc6 Rollup merge of #152367 - Conaclos:conaclos/FromBytesUntilNulError-impl-Copy, r=clarfonthey
Derives `Copy` for `ffi::FromBytesUntilNulError`

[`ffi::FromBytesWithNulError` derives `Copy` since Rust 1.93](https://github.com/rust-lang/rust/commit/2f5a3d4b06a0a9e8749c2e361758ec517df0c96a) while `ffi::FromBytesUntilNulError` doesn't.
This Pr fixes that by deriving `Copy` for `ffi::FromBytesUntilNulError`.

I encountered this issue while I was working in a const context.

Note: I couldn't find any documentation about what kind of PR is allowed. As this one is very small, I guess it is ok to submit it directly without opening an issue first?
2026-05-18 17:07:08 +02:00
Jonathan Brouwer 43de103116 Rollup merge of #156661 - theemathas:del-unchecked-iter, r=SimonSapin
Remove `UncheckedIterator`

The only remaining usage of `UncheckedIterator` was in `array::{try_,}from_trusted_iterator`. So, replace `array::repeat` and array's `Clone` impl with a manual `from_fn` call rather than going through unnecessary abstractions, and remove the `UncheckedIterator` trait.
2026-05-18 17:07:07 +02:00
Jonathan Brouwer 59eda84e03 Rollup merge of #156582 - daxpedda:global-asm-statement, r=petrochenkov
Allow `global_asm!` in statement positions

This PR makes it possible to put `global_asm!` in statement positions. This is particularly useful for proc-macros, where you otherwise have to wrap them in `mod foo { global_asm!(...); }`.

I'm happy to open an ACP first (or a design meeting?).
I would also assume this needs sign-off from the lang-team?

Previously discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/216763-project-inline-asm/topic/Item.20position.20global_asm/with/581784943).

r? @Amanieu
2026-05-18 17:07:06 +02:00
Jonathan Brouwer a6138ec142 Rollup merge of #156444 - ChrisDenton:os_str_split_at, r=nia-e
Implement `OsStr::split_at`

See rust-lang/rust#156199

This allows splitting only on valid UTF-8 boundaries, regardless of the platform, which avoids cross-platform landmines.
2026-05-18 17:07:05 +02:00
Jonathan Brouwer 33d6fe7a9a Rollup merge of #155006 - WaffleLapkin:stabilize_cfg_target_has_atomic_equal_alignment, r=Urgau
stabilize `feature(cfg_target_has_atomic_equal_alignment)`

See stabilization report: https://github.com/rust-lang/rust/issues/93822#issuecomment-4192399374
cc @joshtriplett
2026-05-18 17:07:04 +02:00
Jonathan Brouwer 0deac0fc6c Rollup merge of #156709 - sayantn:stdarch-sync-2026-05-18, r=sayantn
stdarch subtree update

Subtree update of `stdarch` to https://github.com/rust-lang/stdarch/commit/bb24cbdaa541dd1ca7723d2e172a6c43582055f3.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-05-18 17:07:04 +02:00
daxpedda 450cdb5501 Allow global_asm! in statement positions 2026-05-18 16:02:56 +02:00
bors 5ea817c65e Auto merge of #149696 - jnodorp:clarify-utf16-errors, r=SimonSapin
Clarify UTF-16 decoding errors

Fix UTF-16 error messages as suggested in rust-lang/rust#116258.
2026-05-18 04:49:52 +00:00
bors a31c27a887 Auto merge of #156681 - JonathanBrouwer:rollup-wC7f2r6, r=JonathanBrouwer
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#156196 (Include vendored sources in the rust-src component)
 - rust-lang/rust#155870 (Fix cross-compiling `macos-deployment-target-warning` test)
 - rust-lang/rust#156492 (remove/update various cfg(miri))
 - rust-lang/rust#156676 (Preserve spans when hiding do_not_recommend impls)
 - rust-lang/rust#155313 (doc(core::cmp::Eq): fix definition of symmetry)
 - rust-lang/rust#156234 (implement `into_array` for `Vec<T>`)
 - rust-lang/rust#156488 (Fix missing period in Iterator product doc comment)
 - rust-lang/rust#156572 (std: replace "safe" with "sound" in safety documentation)
 - rust-lang/rust#156624 (c ffi document fixes for c_short.md)
 - rust-lang/rust#156638 (library: Fix std compilation for espidf target in unix::process)
 - rust-lang/rust#156647 (Change division to multiplication in floating-point midpoint)
 - rust-lang/rust#156668 (Fix typo in `format_into` docs: signed -> unsigned)
 - rust-lang/rust#156677 (change `other uses of const` to `raw pointers` in const keyword docs)
2026-05-18 01:35:23 +00:00
Jonathan Brouwer 3810819af3 Rollup merge of #156677 - Cheese-Space:main, r=SimonSapin
change `other uses of const` to `raw pointers` in const keyword docs

this section only talks about how `const` is used in raw pointers and doesn't give any other uses, so in my opinion it would be a bit clearer if the section was named `raw pointers` or something similar.
2026-05-18 03:19:51 +02:00
Jonathan Brouwer b295a02a4e Rollup merge of #156668 - joshtriplett:format-into-typo, r=SimonSapin
Fix typo in `format_into` docs: signed -> unsigned

The documentation for the `format_into` methods on unsigned integers
still said "in signed decimal format". Change them to say "unsigned".
2026-05-18 03:19:50 +02:00
Jonathan Brouwer 868afcb29b Rollup merge of #156647 - oscargus:fasterfloatmidpoint, r=SimonSapin
Change division to multiplication in floating-point midpoint

Multiplication is faster than division on most (all?) platforms. While the optimizer will handle this, there is really no point in relying on that. Using multiplication directly will not have any drawbacks and are numerically identical (in this case since 1.0 / 2.0 == 0.5)

Consider the examples at https://godbolt.org/z/oMvb9vobG where it is clear that the non-optimized version uses division, while the optimized version uses multiplication.
2026-05-18 03:19:49 +02:00
Jonathan Brouwer 0104cf008e Rollup merge of #156638 - FelixLttks:fix-espidf-sigkill, r=SimonSapin
library: Fix std compilation for espidf target in unix::process

Fixes a regression on the riscv32imac-esp-espidf target caused by commit 7bf5fe7bf8 (linked issue rust-lang/rust#156537) . The unix_kill_process_group feature attempts to use libc::SIGKILL, which is not supported on the espidf target.

Discussed in `esp-idf-sys` issue: https://github.com/esp-rs/esp-idf-sys/issues/419
2026-05-18 03:19:49 +02:00
Jonathan Brouwer a62fb3bfd7 Rollup merge of #156624 - lygstate:c_ffi_docs_fixes, r=SimonSapin
c ffi document fixes for c_short.md

There is no reference to `char` in c_short.md
2026-05-18 03:19:48 +02:00
Jonathan Brouwer a99602d456 Rollup merge of #156572 - xtqqczze:sound-env, r=SimonSapin
std: replace "safe" with "sound" in safety documentation

- `env::set_var`
- `env::remove_var`

Context: https://github.com/rust-lang/rust/pull/124636
2026-05-18 03:19:47 +02:00
Jonathan Brouwer 8ebe7e84bc Rollup merge of #156488 - justinyaodu:patch-2, r=SimonSapin
Fix missing period in Iterator product doc comment

It looks like the other doc comments all end with a period.
2026-05-18 03:19:47 +02:00
Jonathan Brouwer acd0707333 Rollup merge of #156234 - bend-n:into_array_for_vec_t_via_boxed_array, r=SimonSapin
implement `into_array` for `Vec<T>`

for more into_array coverage and to avoid harmful obtuse opaque try_into calls
2026-05-18 03:19:46 +02:00
Jonathan Brouwer 5908149302 Rollup merge of #155313 - numero-744:patch-1, r=SimonSapin
doc(core::cmp::Eq): fix definition of symmetry

The definition did not match the one from PartialEq
2026-05-18 03:19:45 +02:00
Jonathan Brouwer 04d8b94a09 Rollup merge of #156676 - qaijuang:diagnostics-do-not-recommend-span, r=chenyukang
Preserve spans when hiding do_not_recommend impls

Fixes rust-lang/rust#156475 by restoring the root span only when the current refined span has wandered outside the parent obligation.
2026-05-18 03:19:45 +02:00
Jonathan Brouwer 05e9620f33 Rollup merge of #156492 - RalfJung:cfg-miri, r=SimonSapin
remove/update various cfg(miri)

I went over all `cfg(miri)` in `library/`. Most of the things I noticed have become separate PRs; these here are the few remaining scattered little fixes in various places.
2026-05-18 03:19:44 +02:00
Jonathan Brouwer 1f9aa27a9e Rollup merge of #155870 - madsmtm:fix-test-arm64e, r=chenyukang
Fix cross-compiling `macos-deployment-target-warning` test

`cc()` gets target flags, which won't match with the host triple used by `bare_rustc()`.

Follow-up to https://github.com/rust-lang/rust/pull/155716, with both of these, `./x test --target arm64e-apple-darwin tests` now succeeds.

r? compiler
2026-05-18 03:19:43 +02:00
Jonathan Brouwer c30d903b1c Rollup merge of #156196 - bjorn3:vendor_stdlib, r=Mark-Simulacrum
Include vendored sources in the rust-src component

In the future this can be used by build-std, but until then it is still useful for allowing rust-analyzer to work offline.

This increases the unpacked size by 24MB (from 116MB to 140MB) and the compressed size by only 2MB (from 18MB to 20MB)
2026-05-18 03:19:42 +02:00
bors b40ce8b786 Auto merge of #156670 - JonathanBrouwer:rollup-u90lYRn, r=JonathanBrouwer
Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#151742 (Remove redundant information in `rustc_abi::Variants`)
 - rust-lang/rust#151362 (Add interior-mutability suggestion to `static_mut_refs`)
 - rust-lang/rust#156121 (compiler: suggest `.collect()` when `String` is expected and `Iterator` is found)
 - rust-lang/rust#156208 (Emit retags in codegen to support BorrowSanitizer (part 1))
 - rust-lang/rust#156596 (Split `LintExpectationId`s)
 - rust-lang/rust#156607 (ci: Update FreeBSD version to FreeBSD 14)
 - rust-lang/rust#156376 (suggest hex escapes for C-style escapes)
 - rust-lang/rust#156577 (Test EII UI tests with prefer-dynamic)
 - rust-lang/rust#156585 (explicit tail calls: ignore some tests on unsupported LLVM targets)
 - rust-lang/rust#156598 (Avoid rustfix suggestions for macro-expanded unused imports)
 - rust-lang/rust#156616 (rustdoc: add test case for `-Drustdoc::` and `--cap-lints`)
 - rust-lang/rust#156633 (Add regression test for issue rust-lang/rust#41261)
 - rust-lang/rust#156635 (rename unexpected_try_recover function)
 - rust-lang/rust#156636 (minor `rustc_mir_transform` cleanup)
2026-05-17 22:25:43 +00:00
Amanieu d'Antras d913db70df Merge pull request #2063 from sayantn/intrinsic-test
Redesign `intrinsic-test` to use simple comparison
2026-05-17 22:21:24 +00:00
Cheese_space 76955f4f2d change other uses of const to raw pointers 2026-05-17 22:52:56 +02:00
qaijuang 7aa831f47a preserve spans when hiding do_not_recommend impls 2026-05-17 16:12:40 -04:00
qaijuang 7442ae735d add red test 2026-05-17 16:12:19 -04:00
bors 507271bc11 Auto merge of #156655 - ehuss:disable-rust-analyzer-llvm-21, r=JonathanBrouwer,jieyouxu
Disable rust-analyzer tests on LLVM 21

The rust-analyzer tests have been frequently failing with a SIGSEGV on CI in the LLVM 21 runners. In my investigation, this seems to be fixed with LLVM 22. It was suggested that we should just disable these tests.

There wasn't a particularly convenient way to detect if this is running with LLVM 21, so I decided to just check the CI_JOB_NAME which contains the image name which in our case includes the string "llvm-21".

Fixes https://github.com/rust-lang/rust/issues/156460
2026-05-17 19:08:57 +00:00
Jonathan Brouwer fc7ac3de0c Rollup merge of #156636 - Human9000-bit:mir-transform-ref, r=Kivooeo
minor `rustc_mir_transform` cleanup

Some minor things I noticed here and there while reading though code
2026-05-17 15:52:43 +02:00
Jonathan Brouwer 4cce8bcdc8 Rollup merge of #156635 - bb1yd:rename_unexpected_try_recover, r=JohnTitor
rename unexpected_try_recover function

While reading the code, the doc comment and the name of the function `unexpected_try_recover` confused me. The doc said it tries to recover if it is a closing delimiter but I see no recovering code and the function always return an error.

So I change the name of the function to `unexpected_err` and change the return value to `Diag<'a>`. I also update the doc comment.
2026-05-17 15:52:42 +02:00
Jonathan Brouwer c340b0a28e Rollup merge of #156633 - eval-exec:issue-41261-regression-test, r=mu001999
Add regression test for issue #41261

Adds a regression test for rust-lang/rust#41261.
2026-05-17 15:52:42 +02:00
Jonathan Brouwer 06763ba095 Rollup merge of #156616 - notriddle:rustdoc-ui-test-cli, r=GuillaumeGomez
rustdoc: add test case for `-Drustdoc::` and `--cap-lints`

This works, but I couldn't find any test cases for it.
2026-05-17 15:52:41 +02:00
Jonathan Brouwer 9e8d48c551 Rollup merge of #156598 - cijiugechu:decl-macro-diag, r=mu001999
Avoid rustfix suggestions for macro-expanded unused imports

Avoid emitting rustfix suggestions for unused imports when the removal span is not directly editable.

Closes rust-lang/rust#147855
2026-05-17 15:52:40 +02:00
Jonathan Brouwer ded0aaba6c Rollup merge of #156585 - InvalidPathException:llvm-error, r=folkertdev
explicit tail calls: ignore some tests on unsupported LLVM targets

Fixes https://github.com/rust-lang/rust/issues/148748

Add ignore derivatives to two tests that cause the most platforms to fail, there are two reasons:

All tests involving `musttail` should fail on these platforms due to poor support overall by LLVM, but since they have low usage and supposedly already have many tests failing we limit ignores to the two "worst" tests.

```
//@ ignore-aix
//@ ignore-csky
//@ ignore-mips
//@ ignore-mips64
//@ ignore-powerpc
//@ ignore-powerpc64
//@ ignore-thumb
```

aix/powerpc issue: https://github.com/llvm/llvm-project/issues/187119
thumb issue: https://github.com/llvm/llvm-project/issues/73167
mips has been fixed but it is in a different LLVM version than what is pinned by Rust: https://github.com/llvm/llvm-project/issues/57795

These were caused by argument/returns that do not fit in registers (e.g., indirect), they had a fix but were reverted due to lifetime issues:

```
//@ ignore-riscv64
//@ ignore-loongarch32
//@ ignore-loongarch64
```

RISC-V had a fix which got reverted: https://github.com/llvm/llvm-project/pull/191508
LoongArch fix also got reverted: https://github.com/llvm/llvm-project/pull/191525

Also add missing compiletest directive names for `ignore-csky`, `ignore-mips`, and `ignore-mips64`.

r? folkertdev
2026-05-17 15:52:40 +02:00
Jonathan Brouwer 4babf87ac3 Rollup merge of #156577 - AsakuraMizu:eii-default-dynamic, r=mejrs
Test EII UI tests with prefer-dynamic

Tracking issue: rust-lang/rust#125418

Remove `no-prefer-dynamic` from the EII UI tests now that rust-lang/rust#153648 fixed exporting EII declaration aliases from dylibs.

Fixes rust-lang/rust#151271.

Tested with:

```sh
python3 x.py test tests/ui/eii --force-rerun
```
2026-05-17 15:52:39 +02:00
Jonathan Brouwer 4bb85516e8 Rollup merge of #156376 - euclio:foreign-escapes, r=mu001999
suggest hex escapes for C-style escapes

Fixes rust-lang/rust#148884.
2026-05-17 15:52:38 +02:00
Jonathan Brouwer 7efacb044b Rollup merge of #156607 - mrkajetanp:freebsd-14, r=marcoieni
ci: Update FreeBSD version to FreeBSD 14

FreeBSD 12 & 13 are now EOL. The decision to move to FreeBSD 13 was not implemented due to the issues with the toolchain. Now that FreeBSD 14 is the most recent supported version, we should use it for builds in CI.
2026-05-17 15:52:37 +02:00
Jonathan Brouwer b0c869a35e Rollup merge of #156596 - nnethercote:split-LintExpectation, r=GuillaumeGomez
Split `LintExpectationId`s

This PR makes clearer where stable and unstable `LintExpectationIds` can occur, plus a few other small cleanups. Details in individual commits.

r? @GuillaumeGomez
2026-05-17 15:52:37 +02:00
Jonathan Brouwer ff42fc00d4 Rollup merge of #156208 - BorrowSanitizer:codegen-emit-retag-1, r=saethlin
Emit retags in codegen to support BorrowSanitizer (part 1)

Tracking issue: rust-lang/rust#154760
[Zulip Thread](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Staging.20for.20emitting.20retags.20in.20codegen/with/593004012)

This is the first of several PRs that will add experimental support for emitting retags as function calls in codegen. Each PR will be a minimal, improved slice of the changes in rust-lang/rust#155965.

This PR contains all of the changes that will affect codegen backends. It adds methods to `IntrinsicCallBuilderMethods` for emitting each kind of retag call.

cc: @RalfJung
2026-05-17 15:52:36 +02:00
Jonathan Brouwer fe32c706ed Rollup merge of #156121 - thiago-fealves:suggest-collect-string, r=estebank
compiler: suggest `.collect()` when `String` is expected and `Iterator` is found

This commit adds a diagnostic suggestion to help users who forget to call `.collect()` when they have an iterator and the function or variable expects a `String`.

The logic checks if the expected type is `std::string::String` and if the found type implements the `Iterator` trait, if so the compiler provides a suggestion to add `.collect()`

Includes also a UI test to verify if the suggestion appears correctly
2026-05-17 15:52:35 +02:00
Jonathan Brouwer 9de8fa9347 Rollup merge of #151362 - JohnTitor:interior-mutability-sugg, r=estebank
Add interior-mutability suggestion to `static_mut_refs`

Closes https://github.com/rust-lang/rust/issues/151131
r? @estebank

I've skipped to expand catching below code as a mutable _reference_ shouldn't be involved (maybe a new lint would be needed?):
```rs
static mut COUNTER: u64 = 0;
fn main() {
    unsafe { COUNTER = 1 };
}
```
2026-05-17 15:52:35 +02:00
Jonathan Brouwer 346f43e2aa Rollup merge of #151742 - moulins:variant-layout, r=saethlin
Remove redundant information in `rustc_abi::Variants`

Follow-up to rust-lang/rust#151040; partially addresses rust-lang/rust#113988.

Replaces the nested `LayoutData` in `Variants::Multiple` by a new, smaller `VariantLayout` struct, and adjust `LayoutData::for_variant`and the layout algorithm in consequence.
This PR is best reviewed commit-by-commit.
2026-05-17 15:52:34 +02:00
Josh Triplett 43436c9a77 Fix typo in format_into docs: signed -> unsigned
The documentation for the `format_into` methods on unsigned integers
still said "in signed decimal format". Change them to say "unsigned".
2026-05-17 15:16:01 +02:00
Tim (Theemathas Chirananthavat) ea703e28fc Remove UncheckedIterator
The last usage of this trait was removed in a previous commit.
2026-05-17 15:06:12 +07:00
Tim (Theemathas Chirananthavat) 62e595213d Remove array::{try_,}from_trusted_iterator
This is the only remaining place that uses `UncheckedIterator`. So,
replace `array::repeat` and array's `Clone` impl with a manual `from_fn`
call rather than going through unnecessary abstractions.

Removal of `UncheckedIterator` will be done in a later commit.
2026-05-17 14:33:59 +07:00
Yuki Okushi ee8949e513 Add FIXME for interior_mutability_suggestion 2026-05-17 15:03:24 +09:00
Yuki Okushi 33d92f7b52 Add test for the case span is unavailable 2026-05-17 14:58:25 +09:00
Yuki Okushi cbaee5df1b Tweak note condition 2026-05-17 14:09:51 +09:00
Yuki Okushi 2071c66f19 Add interior-mutability suggestion to static_mut_refs 2026-05-17 14:09:51 +09:00
bors ba0949ab74 Auto merge of #156623 - weihanglo:update-cargo, r=ehuss
Update cargo submodule

7 commits in a343accce8526b128adc517d33348573d22920a3..4d1f984518c77fad6eeef4f40153b002a659e662
2026-05-08 22:41:35 +0000 to 2026-05-15 17:12:01 +0000
- Revert "feat: add frame-pointers profile option (rust-lang/cargo#16742)" (rust-lang/cargo#16999)
- CI: update to macos-15 (rust-lang/cargo#16996)
- fix(clean): respect `build.target` config for `clean -p` (rust-lang/cargo#16988)
- fix(diag): Consolidate verify/run diagnostics passes  (rust-lang/cargo#16989)
- fix(diag): Track Cargo diagnostic warning/error count like is done for rustc (rust-lang/cargo#16981)
- fix: suggest 'fmt' when user types 'cargo rustfmt' (rust-lang/cargo#16985)
- Rebuild when -Zpublic-dependency changes (rust-lang/cargo#16965)

r? ghost
2026-05-17 04:45:56 +00:00