303456 Commits

Author SHA1 Message Date
Esteban Küber
c439a59dbd Change the desugaring of assert! for better error output
In the desugaring of `assert!`, we now expand to a `match` expression
instead of `if !cond {..}`.

The span of incorrect conditions will point only at the expression, and not
the whole `assert!` invocation.

```
error[E0308]: mismatched types
  --> $DIR/issue-14091.rs:2:13
   |
LL |     assert!(1,1);
   |             ^ expected `bool`, found integer
```

We no longer mention the expression needing to implement the `Not` trait.

```
error[E0308]: mismatched types
  --> $DIR/issue-14091-2.rs:15:13
   |
LL |     assert!(x, x);
   |             ^ expected `bool`, found `BytePos`
```

`assert!(val)` now desugars to:

```rust
match val {
    true => {},
    _ => $crate::panic::panic_2021!(),
}
```

Fix #122159.

We make some minor changes to some diagnostics to avoid span overlap on
type mismatch or inverted "expected"/"found" on type errors.

We remove some unnecessary parens from core, alloc and miri.

address review comments
2025-08-12 16:30:48 +00:00
Josh Triplett
e1fc89af5b rustdoc: Minimal fixes to compile with MacroKinds
This makes the minimal fixes necessary for rustdoc to compile and pass
existing tests with the switch to `MacroKinds`. It only works for macros
that don't actually have multiple kinds, and will panic (with a `todo!`)
if it encounters a macro with multiple kinds.

rustdoc needs further fixes to handle macros with multiple kinds, and to
handle attributes and derive macros that aren't proc macros.
2025-08-12 09:24:45 -07:00
Josh Triplett
33ba4a2f11 clippy: Update for switch to MacroKinds
This updates two clippy lints which had exceptions for `MacroKind::Bang`
macros to extend those exceptions to any macro, now that a macro_rules
macro can be any kind of macro.
2025-08-12 09:24:45 -07:00
Josh Triplett
b74e1cb769 mbe: Rename macro parsing state names to use Bang instead of Not
The use of `Not` to describe the `!` in `macro_rules!` reads
confusingly, and also results in search collisions with the diagnostic
structure `MacroRulesNot` elsewhere in the compiler. Rename it to use
the more conventional `Bang` for `!`.
2025-08-12 09:24:45 -07:00
Josh Triplett
ba231db3f3 Detect and report macro kind mismatches early, and more precisely
This eliminates the case in `failed_to_match_macro` to check for a
function-like invocation of a macro with no function-like rules.

Instead, macro kind mismatches now result in an unresolved macro, and we
detect this case in `unresolved_macro_suggestions`, which now carefully
distinguishes between a kind mismatch and other errors.

This also handles cases of forward-referenced attributes and cyclic
attributes.

Expand test coverage to include all of these cases.
2025-08-12 09:24:45 -07:00
Josh Triplett
c81fcaca1c Only suggest changing #[derive(mymacro)] to #[mymacro] for attribute macros 2025-08-12 09:24:45 -07:00
Josh Triplett
d7b30bef7e Expand documentation of GlobDelegation
I discovered this via research through the git log, and I want to leave
additional guidance for future macro spelunkers.
2025-08-12 09:24:45 -07:00
Josh Triplett
0b855bcdc9 Switch to a bitflags MacroKinds to support macros with more than one kind
Review everything that uses `MacroKind`, and switch anything that could
refer to more than one kind to use `MacroKinds`.

Add a new `SyntaxExtensionKind::MacroRules` for `macro_rules!` macros,
using the concrete `MacroRulesMacroExpander` type, and have it track
which kinds it can handle. Eliminate the separate optional `attr_ext`,
now that a `SyntaxExtension` can handle multiple macro kinds.

This also avoids the need to downcast when calling methods on
`MacroRulesMacroExpander`, such as `get_unused_rule`.

Integrate macro kind checking into name resolution's
`sub_namespace_match`, so that we only find a macro if it's the right
type, and eliminate the special-case hack for attributes.
2025-08-12 09:24:45 -07:00
bors
8e62bfd311 Auto merge of #144678 - jdonszelmann:no-mangle-extern, r=bjorn3
Make no_mangle on foreign items explicit instead of implicit

for a followup PR I'm working on I need some foreign items to mangle. I could add a new attribute: `no_no_mangle` or something silly like that but by explicitly putting `no_mangle` in the codegen fn attrs of foreign items we can default it to `no_mangle` and then easily remove it when we don't want it.

I guess you'd know about this r? `@bjorn3.` Shouldn't be too hard to review :)

Builds on rust-lang/rust#144655 which should merge first.
2025-08-12 16:20:24 +00:00
Jakub Beránek
0b8c6ad2b7
Remove one dependency from tracing bootstrap build 2025-08-12 17:39:07 +02:00
Jakub Beránek
f7defc0fe5
Resolve review remarks 2025-08-12 15:05:05 +02:00
bors
d9dba3a554 Auto merge of #145300 - Zalathar:rollup-0eqbt6a, r=Zalathar
Rollup of 17 pull requests

Successful merges:

 - rust-lang/rust#131477 (Apple: Always pass SDK root when linking with `cc`, and pass it via `SDKROOT` env var)
 - rust-lang/rust#139806 (std: sys: pal: uefi: Overhaul Time)
 - rust-lang/rust#144386 (Extract TraitImplHeader in AST/HIR)
 - rust-lang/rust#144921 (Don't emit `rustdoc::broken_intra_doc_links` for GitHub-flavored Markdown admonitions like `[!NOTE]`)
 - rust-lang/rust#145155 (Port `#[allow_internal_unsafe]` to the new attribute system (attempt 2))
 - rust-lang/rust#145214 (fix: re-enable self-assignment)
 - rust-lang/rust#145216 (rustdoc: correct negative-to-implicit discriminant display)
 - rust-lang/rust#145238 (Tweak invalid builtin attribute output)
 - rust-lang/rust#145249 (Rename entered trace span variables from `_span` to  `_trace`)
 - rust-lang/rust#145251 (Support using #[unstable_feature_bound] on trait)
 - rust-lang/rust#145253 (Document compiler and stdlib in stage1 in `pr-check-2` CI job)
 - rust-lang/rust#145260 (Make explicit guarantees about `Vec`’s allocator)
 - rust-lang/rust#145263 (Update books)
 - rust-lang/rust#145273 (Account for new `assert!` desugaring in `!condition` suggestion)
 - rust-lang/rust#145283 (Make I-miscompile imply I-prioritize)
 - rust-lang/rust#145291 (bootstrap: Only warn about `rust.debug-assertions` if downloading rustc)
 - rust-lang/rust#145292 (Fix a typo in range docs)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-08-12 12:37:26 +00:00
Rej Ect
0d723234b3
chore(ci): upgrade checkout to v5
chore(ci): upgrade checkout to v5
2025-08-12 15:26:29 +03:00
Sacha Ayoun
427be23b22 Address dangling doc
Signed-off-by: Sacha Ayoun <sachaayoun@gmail.com>
2025-08-12 13:18:48 +01:00
Mara Bos
08acba3071 Revert "Partially outline code inside the panic! macro".
Without any tests/benchmarks that show some improvement, it's hard to
know whether the change had any positive effect at all. (And if it did,
whether that effect is still achieved today.)
2025-08-12 12:52:39 +02:00
Mara Bos
bd44d855f5 Link to payload_as_str() from payload(). 2025-08-12 12:50:48 +02:00
Stuart Cook
7c4bedc962
Rollup merge of #145292 - ada4a:patch-2, r=tgross35
Fix a typo in range docs
2025-08-12 20:38:00 +10:00
Stuart Cook
04f29fde10
Rollup merge of #145291 - Zalathar:no-warning, r=Kobzol
bootstrap: Only warn about `rust.debug-assertions` if downloading rustc

The changes in rust-lang/rust#145149 had the unwanted side-effect of causing bootstrap to *always* warn about `rust.debug-assertions = true`, even if rustc isn't going to be downloaded anyway.

cc ``@Shourya742`` ``@Kobzol``
2025-08-12 20:37:59 +10:00
Stuart Cook
dcc0b6b7b8
Rollup merge of #145283 - theemathas:patch-1, r=Noratrieb
Make I-miscompile imply I-prioritize

Since I-unsound already implies I-prioritize, it makes sense that I-miscompile should do the same.
2025-08-12 20:37:58 +10:00
Stuart Cook
2102eebd56
Rollup merge of #145273 - estebank:not-not, r=samueltardieu
Account for new `assert!` desugaring in `!condition` suggestion

`rustc` in https://github.com/rust-lang/rust/pull/122661 is going to change the desugaring of `assert!` to be

```rust
match condition {
    true => {}
    _ => panic!(),
}
```
which will make the edge-case of `condition` being `impl Not<Output = bool>` while not being `bool` itself no longer a straightforward suggestion, but `!!condition` will coerce the expression to be `bool`, so it can be machine applicable.

Transposing https://github.com/rust-lang/rust-clippy/pull/15453/ to the rustc repo.

r? `````@samueltardieu`````
2025-08-12 20:37:57 +10:00
Stuart Cook
0264abc065
Rollup merge of #145263 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/reference

6 commits in 1be151c051a082b542548c62cafbcb055fa8944f..59b8af811886313577615c2cf0e045f01faed88b
2025-08-10 18:21:53 UTC to 2025-08-08 01:00:04 UTC

- Add LoongArch32 to inline-assembly documentation (rust-lang/reference#1942)
- Update `no_builtins` to use the attribute template (rust-lang/reference#1909)
- Update `global_allocator` to use the attribute template (rust-lang/reference#1919)
- Update `windows_subsystem` to use the attribute template (rust-lang/reference#1920)
- Remove note on accepted invalid `should_panic` syntax (rust-lang/reference#1955)
- specify relative drop order of pattern bindings (rust-lang/reference#1953)

## rust-lang/rust-by-example

1 commits in bd1279cdc9865bfff605e741fb76a0b2f07314a7..adc1f3b9012ad3255eea2054ca30596a953d053d
2025-08-08 12:02:24 UTC to 2025-08-08 12:02:24 UTC

- Update Chinese translations in `zh.po` (rust-lang/rust-by-example#1950)
2025-08-12 20:37:57 +10:00
Stuart Cook
30ed54e3e4
Rollup merge of #145260 - SabrinaJewson:vec-allocator-docs, r=dtolnay
Make explicit guarantees about `Vec`’s allocator

This commit amends the documentation of `Vec::as_mut_ptr` and `Vec::into_raw_parts` to make it explicit that such calls may be paired with calls to `dealloc` with a suitable layout. This guarantee was effectively already provided by the docs of `Vec::from_raw_parts` mentioning `alloc`.

Additionally, we copy-paste and adjust the “Memory layout” section from the documentation of `std::boxed` to `std::vec`. This explains the allocator guarantees in more detail.
2025-08-12 20:37:56 +10:00
Stuart Cook
1c38519319
Rollup merge of #145253 - Kobzol:pr-check-2-doc-stage-1, r=jieyouxu
Document compiler and stdlib in stage1 in `pr-check-2` CI job

This restores the original behavior pre-https://github.com/rust-lang/rust/pull/145011 (I thought that stage 2 makes more sense here, but it made the job ~30m slower, which is bad).

Let's see what will be the "new" duration, it should be ~55 minutes.

r? ```````@jieyouxu```````
2025-08-12 20:37:55 +10:00
Stuart Cook
42af95b18e
Rollup merge of #145251 - tiif:support_trait, r=BoxyUwU
Support using #[unstable_feature_bound] on trait

This is needed to unblock https://github.com/rust-lang/rust/pull/145095

r? ```````@BoxyUwU```````
2025-08-12 20:37:55 +10:00
Stuart Cook
769d32b117
Rollup merge of #145249 - Stypox:_span-to-_trace, r=joshtriplett
Rename entered trace span variables from `_span` to  `_trace`

This PR just changes the name of `EnteredTraceSpan` variables used to automatically close tracing spans when going out of scope. This renaming was needed because `_span` could possibly be confused with the `Span` type in rustc, so I used `_trace` as suggested in https://github.com/rust-lang/rust/pull/144727#discussion_r2247267670.
2025-08-12 20:37:54 +10:00
Stuart Cook
d862ae2fce
Rollup merge of #145238 - estebank:attr-overhaul, r=jdonszelmann
Tweak invalid builtin attribute output

 - Add link to reference/docs when possible
 - More accurate suggestions by supporting multiple alternative suggestions

```
error: malformed `crate_type` attribute input
  --> $DIR/crate-type-macro-call.rs:1:1
   |
LL | #![crate_type = foo!()]
   | ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/linkage.html>
help: the following are the possible correct uses
   |
LL - #![crate_type = foo!()]
LL + #![crate_type = "bin"]
   |
LL - #![crate_type = foo!()]
LL + #![crate_type = "cdylib"]
   |
LL - #![crate_type = foo!()]
LL + #![crate_type = "dylib"]
   |
LL - #![crate_type = foo!()]
LL + #![crate_type = "lib"]
   |
   = and 4 other candidates
```
2025-08-12 20:37:53 +10:00
Stuart Cook
38483d8eb1
Rollup merge of #145216 - eval-exec:fix-145125-enum-rustdoc, r=fmease
rustdoc: correct negative-to-implicit discriminant display

This PR want to fix rust-lang/rust#145125

In:
7f7b8ef27d/compiler/rustc_middle/src/ty/util.rs (L33-L38)

the `Discr`'s `val` field is `u128`, so we can't use `discr.val as i128` to represent `Discr`'s signed value.

We should use `Discr`'s `Display` trait to display signed value.

7f7b8ef27d/compiler/rustc_middle/src/ty/util.rs (L60-L73)
2025-08-12 20:37:52 +10:00
Stuart Cook
55cb4b294c
Rollup merge of #145214 - notJoon:fix/enable-self-assignment, r=petrochenkov
fix: re-enable self-assignment

## Description

Re-enables the self-assignment detection that was previously disabled due to unrelated regressions. The fix detects useless assignments like `x = x` and `foo.field = foo.field`.

## History

The original regressions (rust-lang/rust#81626, rust-lang/rust#81658) were specifically about false positives in write-only field detection, not self-assignment detection. Belows are brief history for the rule that I understand.

- Self-assignment detection was originally implemented in rust-lang/rust#87129 to address rust-lang/rust#75356
- The implementation was disabled alongside the revert of rust-lang/rust#81473's "write-only fields" detection
- rust-lang/rust#81473 was reverted via rust-lang/rust#86212 and rust-lang/rust#83171 due to false positives in write-only field detection (rust-lang/rust#81626, rust-lang/rust#81658)
- The self-assignment detection feature got removed, even though it wasn't the reason for the problems

This PR only re-enables the self-assignment checks, which are orthogonal to the problematic write-only field analysis.

## Changes
- Removed `#[allow(dead_code)]` from `compiler/rustc_passes/src/dead.rs` file
    - `handle_assign` and
    - `check_for_self_assign`
- Added `ExprKind::Assign` handling in `visit_expr` to call both methods
- Updated test expectations in `tests/ui/lint/dead-code/self-assign.rs`
2025-08-12 20:37:52 +10:00
Stuart Cook
9fd7702305
Rollup merge of #145155 - scrabsha:push-tkvwkolzooyq, r=jdonszelmann
Port `#[allow_internal_unsafe]` to the new attribute system (attempt 2)

This is a slightly modified version of ae1487aa9922de7642c448cc0908584026699e1c, which caused a performance regression (reverted in https://github.com/rust-lang/rust/pull/145086#issue-3303428759). The diff between this PR and the previous one can be seen in 027a1def.

r? ```````@jdonszelmann``````` 💖
2025-08-12 20:37:51 +10:00
Stuart Cook
31e5316cd9
Rollup merge of #144921 - lolbinarycat:rustdoc-intra-doc-gfm-141866, r=fmease,GuillaumeGomez
Don't emit `rustdoc::broken_intra_doc_links` for GitHub-flavored Markdown admonitions like `[!NOTE]`

fixes rust-lang/rust#141866
2025-08-12 20:37:50 +10:00
Stuart Cook
378a26f165
Rollup merge of #144386 - camsteffen:imploftrait, r=fmease
Extract TraitImplHeader in AST/HIR

Several fields of `Impl` are only applicable when it's a trait impl. This moves those fields into a new struct that is only present for trait impls.
2025-08-12 20:37:49 +10:00
Stuart Cook
52f92d540c
Rollup merge of #139806 - Ayush1325:uefi-systemtime, r=joboet
std: sys: pal: uefi: Overhaul Time

Use UEFI time format for SystemTime.

All calculations and comparisons are being done using UnixTime since UEFI Time format does not seem good fit for those calculations.

I have tested the conversions and calculations, but I am not sure if there is a way to run unit tests for platform specific code in Rust source.

The only real benefit from using UEFI Time representation is that to and fro conversion will preserve `daylight` and `timezone` values.

r? `@joboet`
2025-08-12 20:37:49 +10:00
Stuart Cook
f22c389169
Rollup merge of #131477 - madsmtm:sdkroot-via-env-var, r=nnethercote
Apple: Always pass SDK root when linking with `cc`, and pass it via `SDKROOT` env var

Fixes https://github.com/rust-lang/rust/issues/80817, fixes https://github.com/rust-lang/rust/issues/96943, and generally simplifies our linker invocation on Apple platforms.

Part of https://github.com/rust-lang/rust/issues/129432.

### Necessary background on trampoline binaries

The developer binaries such as `/usr/bin/cc` and `/usr/bin/clang` are actually trampolines (similar in spirit to the Rust binaries in `~/.cargo/bin`) which effectively invokes `xcrun` to get the current Xcode developer directory, which allows it to find the actual binary under `/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/*`.

This binary is then launched with the following environment variables set (but none of them are set if `SDKROOT` is set explicitly):
- `SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk`
- `LIBRARY_PATH=/usr/local/lib` (appended)
- `CPATH=/usr/local/include` (appended)
- `MANPATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/share/man:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/share/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man:` (prepended)

This allows the user to type e.g. `clang foo.c` in their terminal on macOS, and have it automatically pick up a suitable Clang binary and SDK from either an installed Xcode.app or the Xcode Command Line Tools.
(It acts roughly as-if you typed `xcrun -sdk macosx clang foo.c`).

### Finding a suitable SDK

All compilation on macOS is cross-compilation using SDKs, there are no system headers any more (`/usr/include` is gone), and the system libraries are elsewhere in the file system (`/usr/lib` is basically empty). Instead, the logic for finding the SDK is handled by the `/usr/bin/cc` trampoline (see above).

But relying on the `cc` trampoline doesn't work when:
- Cross-compiling, since a different SDK is needed there.
- Invoking the linker directly, since the linker doesn't understand `SDKROOT`.
- Linking build scripts inside Xcode (see https://github.com/rust-lang/rust/issues/80817), since Xcode prepends `/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin` to `PATH`, which means `cc` refers to the _actual_ Clang binary, and we end up with the wrong SDK root specified.

Basically, we cannot rely on the trampoline at all, so the last commit removes the special-casing that was done when linking with `cc` for macOS (i.e. the most common path), so that **we now always invoke `xcrun` (if `SDKROOT` is not explicitly specified) to find the SDK root**.

Making sure this is non-breaking has a few difficulties though, namely that the user might not have Xcode installed, and that the compiler driver may not understand the `-isysroot` flag. These difficulties are explored below.

#### No Xcode

There are several compiler drivers which work without Xcode by bundling their own SDK, including `zig cc`, Nixpkgs' `clang` and Homebrew's `llvm` package. Additionally, `xcrun` is rarely available when cross-compiling from non-macOS and instead the user might provide a downloaded SDK manually with `-Clink-args=...`.

We do still want to _try_ to invoke `xcrun` if possible, since it is usually the SDK that the user wants (and if not, the environment should override `xcrun`, such as is done by Nixpkgs). But we do not want failure to invoke `xcrun` to stop the linking process. This is changed in the second-to-last commit.

#### `SDKROOT` vs. `-isysroot`

The exact reasoning why we do not always pass the SDK root when linking on macOS eludes me (the git history dead ends in rust-lang/rust#100286), but I suspect it's because we want to support compiler drivers which do not support the `-isysroot` option.

To make sure that such use-cases continue to work, we now pass the SDK root via the `SDKROOT` environment variable. This way, compiler drivers that support setting the SDK root (such as Clang and GCC) can use it, while compiler drivers that don't (presumably because they figure out the SDK in some other way) can just ignore it.

One small danger here would be if there's some compiler driver out there which works with the `-isysroot` flag, but not with the `SDKROOT` environment variable. I am not aware of any?

In a sense, this also shifts the blame; if a compiler driver does not understand `SDKROOT`, it won't work with e.g. `xcrun -sdk macosx15.0 $tool` either, so it can more clearly be argued that this is incorrect behaviour on the part of the tool.

Note also that this overrides the behaviour discussed above (`/usr/bin/cc` sets some extra environment variables), I will argue that is fine since `MANPATH` and `CPATH` is useless when linking, and `/usr/local/lib` is empty on a default system at least since macOS 10.14 (it might be filled by extra libraries installed by the user, but I'll argue that if we want it to be part of the default library search path, we should set it explicitly so that it's also set when linking with `-Clinker=ld`).

### Considered alternatives

- Invoke `/usr/bin/cc` instead of `cc`.
  - This breaks many other use-cases though where overriding `cc` in the PATH is desired.
- Look up `which cc`, and do special logic if in Xcode toolchain.
  - Seems brittle, and besides, it's not the `cc` in the Xcode toolchain that's wrong, it's the `/usr/bin/cc` behaviour that is a bit too magical.
- Invoke `xcrun --sdk macosx cc`.
  - This completely ignores `SDKROOT`, so we'd still have to parse that first to figure out if it's suitable or not, but would probably be workable.
- Maybe somehow configure the linker with extra flags such that it'll be able to link regardless of linking for macOS or e.g. iOS? Though I doubt this is possible.
- Bundle the SDK, similar to `zig-cc`.
  - Comes with it's own host of problems.

### Testing

Tested that this works with the following `-Clinker=...`:
- [x] Default (`cc`)
- [x] `/usr/bin/ld`
- [x] Actual Clang from Xcode (`/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang`)
- [x] `/usr/bin/clang` (invoked via `clang` instead of `cc`)
- [x] Homebrew's `llvm` package (ignores `SDKROOT`, uses their own SDK)
- [x] Homebrew's `gcc` package (`SDKROOT` is preferred over their own SDK)
- [x] ~Macports `clang`~ Couldn't get it to build
- [x] Macports `gcc` (`SDKROOT` is preferred over their own SDK)
- [x] Zig CC installed via. homebrew (ignores both `-isysroot` and `SDKROOT`, uses their own SDK)
- [x] Nixpkgs `clang` (ignores `SDKROOT`, uses their own SDK)
- [x] Nixpkgs `gcc` (ignores `SDKROOT`, uses their own SDK)
- [x] ~[`cosmocc`](https://github.com/jart/cosmopolitan)?~ Doesn't accept common flags (like `-arch`)

CC ```````@BlackHoleFox``````` ```````@thomcc```````
2025-08-12 20:37:48 +10:00
Jana Dönszelmann
7aa8707639
make no_mangle explicit on foreign items 2025-08-12 12:07:14 +02:00
Nikita Popov
3fb4be20c1 Update to LLVM 21.1.0 rc3 2025-08-12 12:01:55 +02:00
Jakub Beránek
df2da84a61
Change format of messages in Builder::fmt 2025-08-12 10:42:14 +02:00
Jakub Beránek
fbfcfa6bce
Unify all groups in bootstrap to use Builder::msg 2025-08-12 10:15:56 +02:00
lcnr
db1a64c93b simplify stack handling, be completely lazy 2025-08-12 10:08:26 +02:00
Jakub Beránek
a279ba4349
Consolidate stageN directories in the build directory
Now stageN-X corresponds to stage N X, as it should.
2025-08-12 09:45:25 +02:00
Ada Alakbarova
5e4f465655
fix typo 2025-08-12 09:43:17 +02:00
Zalathar
e454022422 bootstrap: Only warn about rust.debug-assertions if downloading rustc 2025-08-12 17:14:57 +10:00
Tom Vijlbrief
2563e4a7ff [AVR] Changed data_layout 2025-08-12 08:33:27 +02:00
SabrinaJewson
1ce4b370e4
Handle the capacity == 0 case 2025-08-12 05:12:34 +01:00
黑怕
57901fe092 E0793: Clarify that it applies to unions as well 2025-08-12 11:38:33 +08:00
Tim (Theemathas) Chirananthavat
f336cc777b
Make I-miscompile imply I-prioritize
Since I-unsound already implies I-prioritize, it makes sense that I-miscompile should do the same.
2025-08-12 08:26:11 +07:00
bors
a1531335fe Auto merge of #143054 - lcnr:search_graph-3, r=BoxyUwU
search graph: improve rebasing and add forced ambiguity support

Based on rust-lang/rust#142774

This slightly strengthens rebasing and actually checks for the property we want to maintain. There are two additional optimizations we can and should do here:
- we should be able to just always rebase if cycle heads already have a provisional result from a previous iteration
- we currently only apply provisional cache entries if the `path_to_entry` matches exactly. We should be able to extend this e.g. if you have an entry for `B` in `ABA` where the path `BA` is coinductive, then we can use this entry even if the current path from `A` to `B` is inductive.

---

I've also added support for `PathKind::ForcedAmbiguity` which always forced the initial provisional result to be ambiguous. A am using this for cycles involving negative reasons, which is currently only used by the fuzzer in https://github.com/lcnr/search_graph_fuzz. Consider the following setup: A goal `A` which only holds if `B` does not hold, and `B` which only holds if `A` does not hold.

- A only holds if B does not hold, results in X
  - B only holds if A does not hold, results in !X
    - A cycle, provisional result X
- B only holds if A does not hold, results in X
  - A only holds if B does not hold, results in !X
    - B cycle, provisional result X

With negative reasoning, the result of cycle participants depends on their position in the cycle. This means using cache entries while other entries are on the stack/have been popped is wrong. It's also generally just kinda iffy. By always forcing the initial provisional result of such cycles to be ambiguity, we can avoid this, as "not maybe" is just "maybe" again.

Rust kind of has negative reasoning due to incompleteness, consider the following setup:
- `T::Foo eq u32`
  - normalize `T::Foo`
    - via impl -> `u32`
    - via param_env -> `T`
      - nested goals...

`T::Foo eq u32` holds exactly if the nested goals of the `param_env` candidate do not hold, as preferring that candidate over the impl causes the alias-relate to fail. This means the current provisional cache may cause us to ignore `param_env` preference in rare cases. This is not unsound and I don't care about it, as we already have this behavior when rerunning on changed fixpoint results:
- `T: Trait`
  - via impl ok
  - via env
    - `T: Trait` non-productive cycle
- result OK, rerun changed provisional result
- `T: Trait`
  - via impl ok
  - via env
    - `T: Trait` using the provisional result, can be thought of as recursively expanding the proof tree
      - via impl ok
      - via env <don't care>
- prefer the env candidate, reached fixpoint

---

One could imaging changing `ParamEnv` candidates or the impl shadowing check to use `PathKind::ForcedAmbiguity` to make the search graph less observable instead of only using it for fuzzing. However, incomplete candidate preference isn't really negative reasoning and doing this is a breaking change https://github.com/rust-lang/trait-system-refactor-initiative/issues/114

r? `@compiler-errors`
2025-08-11 22:51:07 +00:00
Cameron Steffen
bf266dc834 Propagate TraitImplHeader to hir 2025-08-11 17:05:42 -05:00
Cameron Steffen
5bc23ce255 Extract ast TraitImplHeader 2025-08-11 17:05:36 -05:00
Matthew Maurer
258915a555 llvm: Accept new LLVM lifetime format
LLVM removed the size parameter from the lifetime format.
Tolerate not having that size parameter.
2025-08-11 22:00:41 +00:00
Cameron Steffen
3aa0ac0a8a Tweak trait modifier errors 2025-08-11 16:58:21 -05:00