Commit graph

308340 commits

Author SHA1 Message Date
Chayim Refael Friedman
9cb7d985e3
Merge pull request #20769 from ChayimFriedman2/ns-cleanup4
minor: Add regression test for another (long-standing) bug fixed by the new solver
2025-09-30 15:18:42 +00:00
joboet
3534594029
std: merge address family computation 2025-09-30 17:10:22 +02:00
Chayim Refael Friedman
bf6f75f98e Add regression test for another (long-standing) bug fixed by the new solver 2025-09-30 18:07:27 +03:00
Alex Macleod
3ca0738650
Fix if_then_some_else_none FP when return exists in block expr (#15783)
Closes rust-lang/rust-clippy#15770

changelog: [`if_then_some_else_none`] fix FP when return exists in block
expr
2025-09-30 15:06:35 +00:00
Ada Alakbarova
1da0092218
redundant_pattern_match: clean-up
- cast `&[Arm]` to `&[Arm; 2]` early on to hopefully avoid bounds checks
- use `if let [pattern] = X { .. }` instead of
  `if let patterns = X { let pattern = patterns[0]; .. }`
- use `Symbol`s instead of `&str`s
- reduce indentation
2025-09-30 16:56:06 +02:00
joboet
aa1263e768
std: add missing unsafe blocks 2025-09-30 16:55:21 +02:00
Jakub Beránek
5f54d8bfd8
Remove usage of compiletest-use-stage0-libtest from CI 2025-09-30 16:08:48 +02:00
A4-Tacks
083d279d2e
Add else-block support for convert_to_guarded_return
Add support for else-block of never-type for `convert_to_guarded_return`

Example
---
```rust
fn main() {
    if$0 let Ok(x) = Err(92) {
        foo(x);
    } else {
        return
    }
}
```

**Before this PR**:

Assist not applicable

**After this PR**:

```rust
fn main() {
    let Ok(x) = Err(92) else {
        return
    };
    foo(x);
}
```
2025-09-30 21:40:57 +08:00
Taiki Endo
9e79fac035 Add repr(align(2)) to RcInner and ArcInner 2025-09-30 22:39:10 +09:00
lcnr
198777a08e remove unnecessary test directives 2025-09-30 15:03:58 +02:00
Chayim Refael Friedman
8575ada259
Merge pull request #20768 from ChayimFriedman2/std-error-syntaxerror
minor: Impl `std::error::Error` for `SyntaxError`
2025-09-30 12:52:35 +00:00
Chayim Refael Friedman
fef865731c Impl std::error::Error for SyntaxError 2025-09-30 15:40:54 +03:00
Jana Dönszelmann
817e181ee8
test bevy compute_implied_bounds hack with new trait solver 2025-09-30 14:37:29 +02:00
Stuart Cook
22643032d4
Rollup merge of #147167 - jyn514:rustdoc-tests, r=Kobzol
Don't condition RUSTDOC_LIBDIR on `--no-doc`

In d94e7ff065, `rustdoc_path` was changed to ignore `want_rustdoc` (which is just whether `--no-doc` was passed). But RUSTDOC_LIBDIR wasn't kept in sync. Rather than trying to keep `rustdoc_path` in sync with `RUSTDOC_LIBDIR`, just pass LIBDIR to the rustc shim unconditionally.

This fix allows calling `ensure(doc::Step)` from a non-doc top-level Step, even if `--no-doc` was present in the command line.
2025-09-30 22:25:17 +10:00
Stuart Cook
156d150381
Rollup merge of #147109 - BoxyUwU:rename_concrete_opaques, r=lcnr
Rename various "concrete opaque type" things to say "hidden type"

r? lcnr

I've found "concrete opaque type" terminology to be somewhat confusing as in conversation and when explaining opaque type stuff to people I always just talk about things in terms of hidden types. Also the hidden types of opaques are very much not *concrete* in the same sense that a type without any generic parameters is concrete which is an unfortunate overlap in terminology.

I've tried to update comments to also stop referring to things as concrete opaque types but this is mostly best effort as it difficult to find all such cases amongst the massive amounts of uses of "concrete" or "hidden" across the whole compiler.
2025-09-30 22:25:17 +10:00
Stuart Cook
5a6ac8c322
Rollup merge of #146649 - folkertdev:cmse-call-erase-regions, r=lcnr
cmse: fix 'region variables should not be hashed'

tracking issue: https://github.com/rust-lang/rust/issues/81391
fixes https://github.com/rust-lang/rust/issues/131639

Some background: the `cmse-nonsecure-call` calling convention is used for a call from "secure" to "non-secure" code. To make sure that "non-secure" cannot read any secrets, restrictions are put on the signatures of functions with this calling convention: they can only use 4 arguments for passing arguments, and one register for passing a result. No arguments are passed via the stack, and all other registers are cleared before the call.

We check during `hir_ty_lowering` that the signature follows these rules. We do that by determining and then inspecting the layout of the type. That works well overall, but can run into asserts when the type itself is ill-formed. This PR fixes one such case.

I believe that the fix here, just erasing the regions, is the right shape, but there may be some nuance that I'm missing.

r? types
2025-09-30 22:25:16 +10:00
Stuart Cook
1aa426b335
Rollup merge of #146011 - estebank:lifetime-obligation-span, r=lcnr
Point at fn bound that introduced lifetime obligation

The last note is new
```
error[E0597]: `c` does not live long enough
  --> $DIR/without-precise-captures-we-are-powerless.rs:19:20
   |
LL | fn simple<'a>(x: &'a i32) {
   |           -- lifetime `'a` defined here
...
LL |     let c = async move || { println!("{}", *x); };
   |         - binding `c` declared here
LL |     outlives::<'a>(c());
   |     ---------------^---
   |     |              |
   |     |              borrowed value does not live long enough
   |     argument requires that `c` is borrowed for `'a`
LL |     outlives::<'a>(call_once(c));
LL | }
   | - `c` dropped here while still borrowed
   |
note: requirement that `c` is borrowed for `'a` introduced here
  --> $DIR/without-precise-captures-we-are-powerless.rs:7:33
   |
LL | fn outlives<'a>(_: impl Sized + 'a) {}
   |                                 ^^
```

When encountering a `ConstraintCategory::Predicate` in a funtion call, point at the `Span` for that `Predicate` to explain where the lifetime obligation originates from.

CC rust-lang/rust#55307.
2025-09-30 22:25:16 +10:00
Stuart Cook
97e2d3c579
Rollup merge of #140916 - moatom:140578, r=chenyukang
Fix unuseful span in type error in some format_args!() invocations

Fixed https://github.com/rust-lang/rust/issues/140578.

r? ``@m-ou-se``
2025-09-30 22:25:15 +10:00
joboet
eba1416c01
std: improve internal socket functions 2025-09-30 12:43:36 +02:00
Chayim Refael Friedman
b2071862ae Migrate inference to next solver 2025-09-30 13:10:59 +03:00
Zalathar
cc6329a9bc Replace MetadataType with the MetadataKindId constants 2025-09-30 20:10:30 +10:00
Zalathar
906bf49ade Declare all "fixed" metadata kinds as MetadataKindId 2025-09-30 20:10:10 +10:00
Zalathar
cd40bbfe29 Move MetadataKindId into its own submodule 2025-09-30 20:07:54 +10:00
lcnr
5139facb36 add tests 2025-09-30 12:02:43 +02:00
joboet
d615d2ff34
std: call WinSock cleanup function directly instead of through its reexport 2025-09-30 11:59:08 +02:00
Tomoaki Kobayashi
b13b87a1c3 Fix unuseful span in type error in some format_args!() invocations 2025-09-30 17:20:51 +09:00
Walnut
1f8bef51e3 fix tuple child creation 2025-09-30 03:04:23 -05:00
Samuel Tardieu
189b4c31f3
fix(new_without_default): if new has #[cfg], copy that onto impl Default (#15720)
Fixes https://github.com/rust-lang/rust-clippy/issues/14552

changelog: [`new_without_default`]: if `new` has `#[cfg]`, copy that
onto `impl Default`
2025-09-30 08:01:15 +00:00
Marco Ieni
ce830e67b4
Merge pull request #2570 from rust-lang/tshepang/branch-rename
rename primary git branch
2025-09-30 09:24:58 +02:00
Tomoaki Kobayashi
0fd6f1113b Add test for unuseful span in type error in some format_args!() invocations 2025-09-30 15:50:30 +09:00
bors
a2db928053 Auto merge of #147143 - estebank:verbose-ret-type, r=fee1-dead
Make replacement suggestion `_` in type verbose

```
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
  --> $DIR/in-signature.rs:6:21
   |
LL | fn arr_fn() -> [u8; _] {
   |                     ^ not allowed in type signatures
   |
help: replace with the correct return type
   |
LL - fn arr_fn() -> [u8; _] {
LL + fn arr_fn() -> [u8; 3] {
   |
```
2025-09-30 05:48:32 +00:00
Oli Scherer
fb75fbba95
Merge pull request #4610 from rust-lang/rustup-2025-09-30
Automatic Rustup
2025-09-30 05:44:09 +00:00
Shoyu Vanilla (Flint)
5969470982
Merge pull request #20745 from Oblarg/fix-negative-int-literals-in-macro-by-example
Fix negative integer literals in const generics in declarative macro context
2025-09-30 05:06:47 +00:00
The Miri Cronjob Bot
73562f00ee Merge ref '29b7717de2' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 29b7717de2
Filtered ref: fb4b6388017a4b5fa9806863ffe33ed23df840d4
Upstream diff: f957826bff...29b7717de2

This merge was created using https://github.com/rust-lang/josh-sync.
2025-09-30 05:01:17 +00:00
The Miri Cronjob Bot
8b51a63dbb Prepare for merging from rust-lang/rust
This updates the rust-version file to 29b7717de2.
2025-09-30 04:53:35 +00:00
Zalathar
e491056ac5 Pass around DirectiveLine instead of bare strings 2025-09-30 12:52:38 +10:00
Zalathar
ffaf607cf2 Remove parse_negative_name_directive
This isn't actually used for anything, and its presence complicates the
migration to `DirectiveLine`.
2025-09-30 12:37:46 +10:00
Zalathar
505a2084e6 Split off a separate name/value parser for debuginfo test commands 2025-09-30 12:37:24 +10:00
bors
c5dc558e6c Auto merge of #147169 - jhpratt:rollup-65ooei8, r=jhpratt
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#145883 (Make macOS dist build configuration match where reasonable)
 - rust-lang/rust#146457 (Skip cleanups on unsupported targets)
 - rust-lang/rust#147152 (builtin `Fn`-trait impls: instantiate binder before the return type `Sized` check)
 - rust-lang/rust#147153 ([rustdoc] Move doc cfg propagation pass before items stripping passes)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-30 02:34:18 +00:00
Jacob Pratt
745b8f6b74
Rollup merge of #147153 - GuillaumeGomez:doc-propagation-before-stripping-items, r=lolbinarycat
[rustdoc] Move doc cfg propagation pass before items stripping passes

Follow-up of https://github.com/rust-lang/rust/pull/138907.

r? lolbinarycat
2025-09-29 21:37:52 -04:00
Jacob Pratt
afd620f548
Rollup merge of #147152 - lcnr:instantiate-pre-sized-check, r=BoxyUwU
builtin `Fn`-trait impls: instantiate binder before the return type `Sized` check

fixes
- https://github.com/rust-lang/trait-system-refactor-initiative/issues/220
- https://github.com/rust-lang/trait-system-refactor-initiative/issues/204

r? `@BoxyUwU`
2025-09-29 21:37:51 -04:00
Jacob Pratt
b310eb91ab
Rollup merge of #146457 - alexcrichton:wasm-no-exn-instructions, r=bjorn3
Skip cleanups on unsupported targets

This commit is an update to the `AbortUnwindingCalls` MIR pass in the compiler. Specifically a new boolean is added for "can this target possibly unwind" and if that's `false` then terminators are all adjusted to be unreachable/not present. The end result is that this fixes rust-lang/rust#140293 for wasm targets.

The motivation for this PR is that currently on WebAssembly targets the usage of the `C-unwind` ABI can lead LLVM to either (a) emit exception-handling instructions or (b) hit a LLVM-ICE-style codegen error. WebAssembly as a base instruction set does not support unwinding at all, and a later proposal to WebAssembly, the exception-handling proposal, was what enabled this. This means that the current intent of WebAssembly targets is that they maintain the baseline of "don't emit exception-handling instructions unless enabled". The commit here is intended to restore this behavior by skipping these instructions even when `C-unwind` is present.

Exception-handling is a relatively tricky and also murky topic in WebAssembly, however. There are two sets of instructions LLVM can emit for WebAssembly exceptions, Rust's Emscripten target supports exceptions, WASI targets do not, the LLVM flags to enable this are not always obvious, and additionally this all touches on "changing exception-handling behavior should be a target-level concern, not a feature". Effectively WebAssembly's exception-handling integration into Rust is not finalized at this time. The best idea at this time is that a parallel set of targets will eventually be added which support exceptions, but it's not clear if/when to do this. In the meantime the goal is to keep existing targets working while still enabling experimentation with exception-handling with `-Zbuild-std` and various permutations of LLVM flags.

To that extent this commit does not blanket disable these landing pads and cleanup routines for WebAssembly but instead checks to see if panic=unwind is enabled or if `+exception-handling` is enabled. Tests are updated here as well to account for this where, by default, using a `C-unwind` ABI won't affect Rust codegen at all. If `+exception-handling` is enabled, however, then Rust codegen will look like native platforms where exceptions are caught and the program aborts. More-or-less I've done my best to keep exceptions working on wasm where it's possible to have them work, but turned them off where they're not supposed to be emitted.

Closes rust-lang/rust#140293
2025-09-29 21:37:50 -04:00
Jacob Pratt
c3e118b4db
Rollup merge of #145883 - shepmaster:unify-macos-ci, r=madsmtm
Make macOS dist build configuration match where reasonable

r? `@madsmtm`
2025-09-29 21:37:50 -04:00
Jason Newcomb
1a415e6ddf
double_parens: add structured suggestions, fix bug (#15420)
The issue that I saw made me rethink the lint design by quite a lot, so
I decided to include that change in this PR

fixes rust-lang/rust-clippy#9000

changelog: [`double_parens`]: add structured suggestions
changelog: [`double_parens`]: fix FP when macros are involved
2025-09-29 23:33:37 +00:00
Ada Alakbarova
7a04adae7d
fix(new_without_default): if new has #[cfg], copy that onto impl Default 2025-09-30 01:24:10 +02:00
Ada Alakbarova
93355f1c7b
clean-up
- reduce indentation
- use `snippet_with_applicability`
2025-09-30 01:08:56 +02:00
Jynn Nelson
73f6b08022 Don't condition RUSTDOC_LIBDIR on --no-doc
In d94e7ff065, `rustdoc_path` was changed
to ignore `want_rustdoc` (which is just whether `--no-doc` was passed).
But RUSTDOC_LIBDIR wasn't kept in sync. Rather than trying to keep
`rustdoc_path` in sync with `RUSTDOC_LIBDIR`, just pass LIBDIR to the
rustc shim unconditionally.

This fix allows calling `ensure(doc::Step)` from a non-doc top-level
Step, even if `--no-doc` was present in the command line.
2025-09-29 16:02:22 -07:00
Samuel Tardieu
b05d55eeed
fix(should_implement_trait): only suggest traits that are in the prelude (#15776)
Fixes https://github.com/rust-lang/rust-clippy/issues/6752

changelog: [should_implement_trait]: only suggest traits that are in the
prelude
2025-09-29 22:30:39 +00:00
bors
29b7717de2 Auto merge of #147162 - matthiaskrgr:rollup-4bv1xzb, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#146937 (std: implement `hostname`)
 - rust-lang/rust#147040 (mbe: macro_check: Fix function comments referencing non-existent parameters)
 - rust-lang/rust#147131 (Use MirPatch in simplify_branches.)
 - rust-lang/rust#147133 (Remove one loop in `extract_cfg_from_attrs`)
 - rust-lang/rust#147150 (Emit allocator attributes for allocator shim)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-29 22:21:32 +00:00
cyrgani
d7773f6b1c explicitly implement !Send and !Sync 2025-09-30 00:09:12 +02:00