Commit Graph

314356 Commits

Author SHA1 Message Date
Jakub Beránek 19c8ea4629 Fix new bors config 2025-12-29 09:56:12 +01:00
bors 123588a5bf Auto merge of #108671 - Coca162:option_reference_flattening, r=dtolnay
Implement flatten for `Option<&Option<T>>` and `Option<&mut Option<T>>`

Adds `.flatten_ref()` to get a immutable reference of a nested option and `.flatten_mut()` for mutable references.

ACP: https://github.com/rust-lang/libs-team/issues/186
Tracking Issue: rust-lang/rust#149221
2025-12-29 02:12:47 +00:00
bors 7fefa09b90 Auto merge of #150469 - JonathanBrouwer:rollup-6ujkn6v, r=JonathanBrouwer
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#148321 (parser/lexer: bump to Unicode 17, use faster unicode-ident)
 - rust-lang/rust#149540 (std: sys: fs: uefi: Implement readdir)
 - rust-lang/rust#149582 (Implement `Duration::div_duration_{floor,ceil}`)
 - rust-lang/rust#149663 (Optimized implementation for uN::{gather,scatter}_bits)
 - rust-lang/rust#149667 (Fix ICE by rejecting const blocks in patterns during AST lowering (closes rust-lang/rust#148138))
 - rust-lang/rust#149947 (add several older crashtests)
 - rust-lang/rust#150011 (Add more `unbounded_sh[lr]` examples)
 - rust-lang/rust#150411 (refactor `destructure_const`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-28 22:46:58 +00:00
Jonathan Brouwer 1117bd9e78 Rollup merge of #150411 - Kivooeo:somefunnystuff, r=BoxyUwU
refactor `destructure_const`

r? BoxyUwU

as you suggested yesterday (will add more context like links when it stops being a draft)

tried to split this into some meaningful commits hope it help ^^
2025-12-28 22:52:33 +01:00
Jonathan Brouwer 13633c5bdc Rollup merge of #150011 - scottmcm:more-unbounded-shift-docs, r=Mark-Simulacrum
Add more `unbounded_sh[lr]` examples

Inspired by rust-lang/rust#149837, which added more stuff to `wrapping_sh[lr]`, including a cross-reference to these methods.
2025-12-28 22:52:33 +01:00
Jonathan Brouwer 32e848163c Rollup merge of #149947 - cyrgani:crashtests, r=Mark-Simulacrum
add several older crashtests

Includes rust-lang/rust#114880, rust-lang/rust#119940, rust-lang/rust#138274, rust-lang/rust#138660.
Since their issue numbers are all smaller than 140000, this has no conflicts with rust-lang/rust#147857.
2025-12-28 22:52:32 +01:00
Jonathan Brouwer ef835a83ee Rollup merge of #149667 - Shinonn23:fix-ice-constblock-148138, r=dianne
Fix ICE by rejecting const blocks in patterns during AST lowering (closes #148138)

This PR fixes the ICE reported in rust-lang/rust#148138.

The root cause is that `const` blocks aren’t allowed in pattern position, but the AST lowering logic still attempted to create `PatExprKind::ConstBlock`, allowing invalid HIR to reach type checking and trigger a `span_bug!`.

Following the discussion in the issue, this patch removes the `ConstBlock` lowering path from `lower_expr_within_pat`. Any `ExprKind::ConstBlock` inside a pattern is now handled consistently with other invalid pattern expressions.

A new UI test is included to ensure the compiler reports a proper error and to prevent regressions.

Closes rust-lang/rust#148138.
2025-12-28 22:52:31 +01:00
Jonathan Brouwer 8bd4d04cce Rollup merge of #149663 - quaternic:gather-scatter-bits-opt, r=Mark-Simulacrum
Optimized implementation for uN::{gather,scatter}_bits

Feature gate: #![feature(uint_gather_scatter_bits)]
Tracking issue: https://github.com/rust-lang/rust/issues/149069
Accepted ACP: https://github.com/rust-lang/libs-team/issues/695

Implements the methods using the parallel suffix strategy mentioned in the ACP discussion. The referenced source material provides C implementations, though this PR makes improvements over those, cutting the instruction count by a third:
https://rust.godbolt.org/z/rn5naYnK4 (this PR)
https://c.godbolt.org/z/WzYd5WbsY (Hacker's delight)

This was initially based on the code for `gather_bits` that ``@okaneco`` provided in https://github.com/rust-lang/libs-team/issues/695#issuecomment-3538922128 . I wanted to understand how it worked, and later on noticed some opportunities for improvement, which eventually led to this PR.
2025-12-28 22:52:31 +01:00
Jonathan Brouwer 7b105b21d1 Rollup merge of #149582 - max-heller:duration-integer-division, r=Mark-Simulacrum
Implement `Duration::div_duration_{floor,ceil}`
2025-12-28 22:52:30 +01:00
Jonathan Brouwer b512fa78e9 Rollup merge of #149540 - Ayush1325:uefi-fs-readdir, r=Mark-Simulacrum
std: sys: fs: uefi: Implement readdir

- Tested on OVMF.
- Add path field to uefi file since this will also be required in
  implementing Debug for rust File.

``@rustbot`` label +O-UEFI
2025-12-28 22:52:30 +01:00
Jonathan Brouwer 30618bb89c Rollup merge of #148321 - Marcondiro:master, r=Mark-Simulacrum
parser/lexer: bump to Unicode 17, use faster unicode-ident

Hello,

Bump the unicode version used by lexer/parser to 17.0.0 by updating:
- `unicode-normalization` to 0.1.25
- `unicode-properties` to 0.1.4
- `unicode-width` to 0.2.2

and by replacing `unicode-xid` with `unicode-ident` which is also 6 times faster.
I think it might be worth to run the benchmarks to double check.
(`unicode-ident` is already in `src/tools/tidy/src/deps.rs`)

Thanks!
2025-12-28 22:52:29 +01:00
bors 21cf7fb3ff Auto merge of #150463 - JonathanBrouwer:rollup-ietend4, r=JonathanBrouwer
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#147499 (Implement round-ties-to-even for Duration Debug for consistency with f64)
 - rust-lang/rust#149447 (Rewrite `String::replace_range`)
 - rust-lang/rust#149469 (Leverage &mut in OnceLock when possible)
 - rust-lang/rust#149921 (Add new source component that includes GPL-licensed source)
 - rust-lang/rust#150460 (fix ManuallyDrop::into_inner aliasing (Miri) issues)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-28 18:23:22 +00:00
Jonathan Brouwer 2ecaa1df2d Rollup merge of #150460 - RalfJung:miri-manually-drop, r=dtolnay
fix ManuallyDrop::into_inner aliasing (Miri) issues

Fixes https://github.com/rust-lang/miri/issues/4793

r? `@WaffleLapkin`
2025-12-28 18:16:11 +01:00
Jonathan Brouwer 3bbad7f337 Rollup merge of #149921 - Kobzol:src-gpl, r=Mark-Simulacrum
Add new source component that includes GPL-licensed source

To unblock rustup distribution of `cg_gcc` (https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/Safe.20rustup.20distribution.20of.20rustc_codegen_gcc/with/560644441).

CC ``@joshtriplett``

r? ``@Mark-Simulacrum``
2025-12-28 18:16:10 +01:00
Jonathan Brouwer cc68f30960 Rollup merge of #149469 - tisonkun:mut-once, r=Mark-Simulacrum
Leverage &mut in OnceLock when possible

See comments inline.
2025-12-28 18:16:10 +01:00
Jonathan Brouwer 3c7ffa5dd1 Rollup merge of #149447 - theemathas:string-replace_range, r=Mark-Simulacrum
Rewrite `String::replace_range`

This simplifies the code, provides better panic messages, and avoids an integer overflow.
2025-12-28 18:16:09 +01:00
Jonathan Brouwer 2c0daa2301 Rollup merge of #147499 - josh-kaplan:master, r=Mark-Simulacrum
Implement round-ties-to-even for Duration Debug for consistency with f64

## Summary

This PR proposes a fix for rust-lang/rust#103747 implementing IEEE-754 S4.3 roundTiesToEven for Duration Debug implementation.

## Testing

Added new test in `time.rs` for  validating roundTiesToEven behavior in Duration formatting. Reran all debug formatting tests in `time.rs` with `./x test library/coretests --test-args time::debug_formatting`.
2025-12-28 18:16:09 +01:00
Kivooeo b29cc9860b refactor destructure_const 2025-12-28 16:12:27 +00:00
Ralf Jung d2290c4253 fix ManuallyDrop::into_inner aliasing (Miri) issues 2025-12-28 16:24:55 +01:00
bors 9f54abeeba Auto merge of #150076 - heathdutton:fix-linked-list-cursor-pop-front-index, r=Mark-Simulacrum
Fix `LinkedList::CursorMut::pop_front` to correctly update index

When `pop_front` was called while the cursor pointed to the front element, `move_next` incremented the index but it was never decremented afterwards, causing the index to incorrectly report 1 instead of 0.

Always decrement the index after popping from front using `saturating_sub` to handle edge cases safely.

Fixes rust-lang/rust#147616
2025-12-28 15:10:14 +00:00
bors 7eadf834b5 Auto merge of #150456 - dianqk:codegen-llvm-serde, r=mati865
Removes the serde dependency in rustc_codegen_llvm
2025-12-28 10:24:30 +00:00
dianqk fe075ad212 Removes the serde dependency in rustc_codegen_llvm 2025-12-28 15:52:20 +08:00
bors 23d01cd241 Auto merge of #150448 - matthiaskrgr:rollup-d52y317, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#148533 (Split LLVM intrinsic abi handling from the rest of the abi handling)
 - rust-lang/rust#150358 (fix rustfmt on `const impl Ty {}`)
 - rust-lang/rust#150434 (Add test for never type fallback in try blocks with `Into<!>`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-27 22:44:07 +00:00
Matthias Krüger 05287d1e81 Rollup merge of #150434 - AprilNEA:test-125364-never-type-try-blocks, r=WaffleLapkin
Add test for never type fallback in try blocks with `Into<!>`

### Summary

Adds UI tests for issue rust-lang/rust#125364, which involves the interaction between
never type fallback, try blocks, and `From`/`Into` trait bounds.

### Changes

- Added `tests/ui/never_type/try-block-never-type-fallback.rs`
- Tests both edition 2021 (where the issue manifests) and edition 2024 (where it's fixed)

### Issue

Closes rust-lang/rust#125364

### Testing

```bash
./x test tests/ui/never_type/try-block-never-type-fallback.rs
```

Both test variants pass:

e2021: Correctly fails with expected error
e2024: Compiles successfully (check-pass)

### Notes

This test documents the edition-dependent behavior of never type fallback in try blocks, as requested in the original issue.

cc `@WaffleLapkin`
2025-12-27 22:36:36 +01:00
Matthias Krüger 15b364e2cb Rollup merge of #150358 - fee1-dead-contrib:push-utvysrrzsvvm, r=oli-obk
fix rustfmt on `const impl Ty {}`

r? `@oli-obk` on rust-lang/rust#148434, cc `@ytmimi` for https://github.com/rust-lang/rust/pull/148434/changes#r2637972310

format_constness_right outputs `" const"` whereas format_constness outputs `"const "`

Not making this change to rust-lang/rustfmt since I'm not sure if that repo has these changes yet.
2025-12-27 22:36:35 +01:00
Matthias Krüger 1a6c604a39 Rollup merge of #148533 - bjorn3:split_llvm_intrinsic_abi_handling, r=WaffleLapkin
Split LLVM intrinsic abi handling from the rest of the abi handling

LLVM intrinsics have weird requirements like requiring the fake "unadjusted" abi, not being callable through function pointers and for all codegen backends other than cg_llvm requiring special cases to redirect them to the correct backend specific intrinsic (or directly codegen their implementation inline without any intrinsic call). By splitting the LLVM intrinsic handling it becomes easier for backends to special case them and should in the future allow getting rid of the abi calculation for `extern "unadjusted"` in favor of computing the correct abi directly in the backend without depending on the exact way cg_ssa lowers types.
2025-12-27 22:36:35 +01:00
bors 7b5cde7370 Auto merge of #150421 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

17 commits in e91b2baa632c0c7e84216c91ecfe107c37d887c1..94c368ad2b9db0f0da5bdd8421cea13786ce4412
2025-12-13 16:29:21 +0000 to 2025-12-26 19:39:15 +0000
- fix(vendor): unpack from local-registry cache path (rust-lang/cargo#16435)
- feat(index): Stabilize pubtime (rust-lang/cargo#16372)
- Experiment: Render timing pipeline in SVG (rust-lang/cargo#15091)
- chore(triagebot): auto-label `Command-report` (rust-lang/cargo#16429)
- fix(sbom): Don't set CARGO_SBOM_PATH when empty (like stable)  (rust-lang/cargo#16419)
- chore(ci): report-timings to upload HTML report (rust-lang/cargo#16416)
- fix(report): get the same feature parity of `--timings` (rust-lang/cargo#16414)
- fix(docs): Document the only possible values for DEBUG in build scripts (rust-lang/cargo#16413)
- fix(log): emit fingeprint log also for no-rebuild unit (rust-lang/cargo#16408)
- Fix link to `doc_cfg` docs in cargo book (rust-lang/cargo#16404)
- Add best pratice for how to check in generated files (rust-lang/cargo#16405)
- test: Use a larger default term width (rust-lang/cargo#16403)
- Document more services and permissions of the cargo team (rust-lang/cargo#16402)
- fix(new): Improve quality of package name error messages (rust-lang/cargo#16398)
- feat(log): add more log events (rust-lang/cargo#16390)
- chore: bump to 0.95.0; update changelog (rust-lang/cargo#16395)
- Cache submodule into git db (rust-lang/cargo#16246)

r? ghost
2025-12-27 19:31:43 +00:00
bjorn3 aeac6cb2d6 Fix compilation of cg_gcc with master feature disabled 2025-12-27 18:41:14 +00:00
bjorn3 cb23b54eb1 Add a hack for llvm.wasm.throw
As this is the only unwinding intrinsic we use and
codegen_llvm_intrinsic_call currently doesn't handle unwinding
intrinsics, this uses the conventional call path for llvm.wasm.throw.
2025-12-27 17:46:26 +00:00
bjorn3 9bcd6ed4c9 Partially inline get_fn_addr/get_fn in codegen_llvm_intrinsic_call
This moves all LLVM intrinsic handling out of the regular call path for
cg_gcc and makes it easier to hook into this code for future cg_llvm
changes.
2025-12-27 17:46:26 +00:00
bjorn3 ae8ef1f5eb Inline BuilderMethods::call for intrinsics
Intrinsics only need a fraction of the functionality offered by
BuilderMethods::call and in particular don't need the FnAbi to be
computed other than (currently) as step towards computing the function
value type.
2025-12-27 17:46:26 +00:00
bjorn3 c506e23426 Pass Function to Builder::function_call in cg_gcc 2025-12-27 17:46:26 +00:00
bjorn3 b40eae863a Don't assume get_fn is only called from codegen_mir in cg_gcc 2025-12-27 17:46:26 +00:00
bjorn3 17f6652641 Fix for uninhabited llvm intrinsic return type 2025-12-27 17:46:25 +00:00
bjorn3 62e17e920c Move llvm intrinsic call to backend 2025-12-27 17:46:25 +00:00
bjorn3 4f7086a629 Split out ABI handling for LLVM intrinsics 2025-12-27 17:46:25 +00:00
Deadbeef cf8d0c82dc fix rustfmt on const impl Ty {} 2025-12-27 12:13:52 -05:00
bors 50db29bbd7 Auto merge of #150435 - JonathanBrouwer:rollup-gkvgsfb, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#150362 (rustdoc: fix duplicate Re-exports sections)
 - rust-lang/rust#150397 (Update hir.rs: fix typo ("aligement" -> "alignment"), conform to max_width)
 - rust-lang/rust#150410 (Document default SOCK_CLOEXEC flag on new UnixStream)
 - rust-lang/rust#150429 (Improve missing core error for tier 3 targets)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-27 16:12:14 +00:00
Jonathan Brouwer 4af704522e Rollup merge of #150429 - Noratrieb:tier-3-errors, r=Urgau
Improve missing core error for tier 3 targets

Tier 3 targets can't be installed via rustup, so don't recommend that. Additionally, do recommend build-std on stable because it's the recommended way to use these targets, people should switch to nightly.
2025-12-27 15:46:57 +01:00
Jonathan Brouwer e2e271b7b0 Rollup merge of #150410 - crescentrose:document-socket-cloexec, r=ChrisDenton
Document default SOCK_CLOEXEC flag on new UnixStream

Currently, the `std::os::unix::net::UnixStream` docs do not specify that the SOCK_CLOEXEC flag is set on new sockets. This commit adds a note clarifying that, in line with the note abuot the `MSG_NOSIGNAL` flag.
2025-12-27 15:46:56 +01:00
Jonathan Brouwer adbcef3c12 Rollup merge of #150397 - BioTomateHP:patch-1, r=petrochenkov
Update hir.rs: fix typo ("aligement" -> "alignment"), conform to max_width
2025-12-27 15:46:56 +01:00
Jonathan Brouwer af77f2d644 Rollup merge of #150362 - heathdutton:fix-rustdoc-duplicate-reexports-150211, r=notriddle
rustdoc: fix duplicate Re-exports sections

Fixes rust-lang/rust#150211

When a module contains both `pub extern crate` and `pub use` items, they were being rendered under two separate "Re-exports" section headers instead of one.

This fix tracks the current section and only renders a new header when the section actually changes, consolidating items that belong to the same section under a single header.
2025-12-27 15:46:55 +01:00
AprilNEA f29c5168b2 Add test for never type fallback in try blocks with Into<!>
Closes #125364

This test verifies that the never type fallback behavior
in try blocks with `Into<!>` bounds works correctly across
different editions:

- Edition 2021: Fallback to `()` causes type error
- Edition 2024: Fallback to `!` compiles successfully
2025-12-27 22:38:27 +08:00
bors 4c6706452c Auto merge of #150430 - JonathanBrouwer:rollup-seh9m66, r=JonathanBrouwer
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#150393 (Document relative and absolute paths handling in `--remap-path-prefix`)
 - rust-lang/rust#150405 (Don't use `matches!` when `==` suffices)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-27 12:58:59 +00:00
Jonathan Brouwer d63068b3b4 Rollup merge of #150405 - estebank:matches-could-be-equals, r=Kivooeo
Don't use `matches!` when `==` suffices

In the codebase we sometimes use `matches!` for values that can actually just be compared. Replace them with `==`.

Subset of rust-lang/rust#149933.
2025-12-27 13:42:01 +01:00
Jonathan Brouwer b1fd0b3f2f Rollup merge of #150393 - Urgau:remap-path-relative-doc, r=jieyouxu
Document relative and absolute paths handling in `--remap-path-prefix`

After what we have been through with https://github.com/rust-lang/rust/pull/150110 and https://github.com/rust-lang/rust/pull/150283 in the compiler, I think it would be good to document the user-facing parts of the relative and absolute paths handling in `--remap-path-prefix`.

r? `@jieyouxu`
2025-12-27 13:42:01 +01:00
Noratrieb 7898df42b9 Improve missing core error for tier 3 targets
Tier 3 targets can't be installed via rustup, so don't recommend that.
Additionally, do recommend build-std on stable because it's the
recommended way to use these targets, people should switch to nightly.
2025-12-27 13:17:28 +01:00
Marcondiro f7cb82e70a lexer/parser: ensure deps use the same unicode version
Add a compile time check in rustc_lexer and rustc_parse ensuring that unicode-related dependencies within the crate use the same unicode version.
These checks are inspired by the examples privided by @clarfonthey.
2025-12-27 11:20:42 +01:00
Marco Cavenati ca64688b37 parser/lexer: bump to Unicode 17, use faster unicode-ident
Replace unicode-xid with unicode-ident which is 6 times faster
2025-12-27 11:20:24 +01:00
Ivan ee9db30421 fix late night markdown 2025-12-27 10:59:21 +01:00