Commit Graph

300570 Commits

Author SHA1 Message Date
Jieyou Xu
c3fb7d1d1c Make some compiletest errors/warnings/help more visually obvious 2025-07-01 13:06:18 +08:00
The Miri Cronjob Bot
e6371c9379 Merge from rustc 2025-07-01 05:05:50 +00:00
The Miri Cronjob Bot
0c3c9e4438 Preparing for merge from rustc 2025-07-01 04:58:24 +00:00
Matthias Krüger
3944c8ce44 Rollup merge of #143264 - Muscraft:fix-suggestion-filename, r=compiler-errors
fix: Emit suggestion filename if primary diagnostic span is dummy

While working on using `annotate-snippets` as `rustc`'s emitter, I came across [`tests/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr`](b03b3a7ec9/tests/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr), which lacked a filename for both the annotation and the suggestion, which seemed like a bug to me. After some investigation, I found that this is happening because the primary span is a dummy, so its filename doesn't get output, and its filename matches the one for the suggestion, so the suggestion's filename doesn't get output. To fix this issue, I made it so that the filename for a suggestion will get output if the primary span is a dummy.
2025-07-01 04:25:38 +02:00
Matthias Krüger
bce74545ea Rollup merge of #143263 - ComputerDruid:linkify_CodeSuggestion, r=compiler-errors
linkify CodeSuggestion in doc comments
2025-07-01 04:25:38 +02:00
Matthias Krüger
b6cd765b19 Rollup merge of #143257 - tgross35:run-make-deps, r=jieyouxu
Upgrade dependencies in run-make-support

The main purpose of this is to upgrade `object` and `gimli`, which will allow us to drop outdated versions once backtrace also updates. The only semver breakage in `object`'s is in `elf::R_RISCV_GNU_*` and `pe::IMAGE_WEAK_EXTERN_*` constants, as well as Mach-O dyld, which don't appear to be used here. `gimli` is similar, there is only minor breakage related to dyld.

These version upgrades were also done in the library.

`bstr`, `similar`, and `regex` are also upgraded to the latest minor version here to match what the lockfile already uses. The `regex` comment about `memchr` version hasn't been relevant to this lockfile since e95d15a115 ("Pin memchr to 2.5.0 in the library rather than rustc_ast") and is no longer relevant in the library lockfile either.

Object Changelog: https://github.com/gimli-rs/object/blob/master/CHANGELOG.md#0370
Gimli changelog: https://github.com/gimli-rs/gimli/blob/master/CHANGELOG.md#0320
2025-07-01 04:25:37 +02:00
Matthias Krüger
cfe1942a3f Rollup merge of #143245 - tgross35:metavariable-expr-organization, r=petrochenkov
mbe: Add tests and restructure metavariable expressions

Add tests that show better diagnostics, and factor `concat` handling to a separate function. Each commit message has further details.

This performs the nonfunctional perparation for further changes such as https://github.com/rust-lang/rust/pull/142950 and https://github.com/rust-lang/rust/pull/142975 .
2025-07-01 04:25:36 +02:00
Matthias Krüger
e2ea213874 Rollup merge of #143234 - GuillaumeGomez:ice-143128, r=oli-obk
Replace `ItemCtxt::report_placeholder_type_error` match with a call to `TyCtxt::def_descr`

Fixes rust-lang/rust#143128.

We could likely use `tcx.def_descr` in more places (and therefore remove more `descr` methods). If it's something that we want to do, I can send a follow-up.

r? `@oli-obk`
2025-07-01 04:25:36 +02:00
Matthias Krüger
79e96c0dc5 Rollup merge of #143178 - eeshvardasikcm:master, r=notriddle
rustdoc default faviocon

rust-lang/rust#143154
default favicon now appears to be the new behavior, instead of no favicon.
2025-07-01 04:25:35 +02:00
Matthias Krüger
96fd669328 Rollup merge of #143156 - folkertdev:fn-align-inherit-from-trait, r=workingjubilee
inherit `#[align]` from trait method prototypes

````@workingjubilee```` this seems straightforward enough. Now that we're planning to make `-Cmin-function-alignment` a target modifier, I don't think there are any cross-crate complications here?

````@Jules-Bertholet```` is this the behavior you had in mind? In particular the inheritance of the attribute of a default impl is maybe a bit unintuitive at first? (but I think it's ok if that behavior is explicitly documented).

r? ghost
2025-07-01 04:25:35 +02:00
Matthias Krüger
74d1d59e7c Rollup merge of #143125 - tgross35:aarch64-neon-llvm19-f16, r=cuviper
Disable f16 on Aarch64 without neon for llvm < 20.1.1

This check was added unconditionally in c51b229140 ("Disable f16 on Aarch64 without `neon`") and reverted in 4a8d35709e ("Revert "Disable `f16` on Aarch64 without `neon`"") since it did not fail in Rust's build. However, it is still possible to hit this crash if using LLVM 19 built with assertions, so disable the type conditionally based on version here.

Note that for these builds, a similar patch is needed in the build script for `compiler-builtins` since it does not yet use `cfg(target_has_reliable_f16)` (hopefully to be resolved in the near future).

Report: https://github.com/rust-lang/rust/pull/139276#issuecomment-3014781652
Original LLVM issue: https://github.com/llvm/llvm-project/issues/129394
2025-07-01 04:25:34 +02:00
bors
6988a8fea7 Auto merge of #141875 - nnethercote:ByteSymbol, r=petrochenkov
Introduce `ByteSymbol`

It's like `Symbol` but for byte strings. The interner is now used for both `Symbol` and `ByteSymbol`. E.g. if you intern `"dog"` and `b"dog"` you'll get a `Symbol` and a `ByteSymbol` with the same index and the characters will only be stored once.

The motivation for this is to eliminate the `Arc`s in `ast::LitKind`, to make `ast::LitKind` impl `Copy`, and to avoid the need to arena-allocate `ast::LitKind` in HIR. The latter change reduces peak memory by a non-trivial amount on literal-heavy benchmarks such as `deep-vector` and `tuple-stress`.

`Encoder`, `Decoder`, `SpanEncoder`, and `SpanDecoder` all get some changes so that they can handle normal strings and byte strings.
2025-07-01 02:22:42 +00:00
Scott McMurray
fd3161c201 Mention as_chunks in the docs for chunks 2025-06-30 18:58:43 -07:00
Scott Schafer
c8fac7779e fix: Emit suggestion filename if primary diagnostic span is dummy 2025-06-30 19:24:22 -06:00
Jeremy Smart
1e6e4bb95a make compiler_builtins a private dependency 2025-06-30 20:27:10 -04:00
Michael Goulet
ef4f71957d Remove doc comments from TyCtxtFeed 2025-07-01 00:14:06 +00:00
Michael Goulet
96fea30d92 Feed explicit_predicates_of instead of predicates_of 2025-07-01 00:01:40 +00:00
dianqk
90e0835004 mir: Mark Statement and BasicBlockData as #[non_exhaustive]
Ensure they are always created using constructors.
2025-07-01 07:14:13 +08:00
Dan Johnson
4e83298ae8 linkify CodeSuggestion in doc comments 2025-06-30 16:00:18 -07:00
bors
44b7484252 Auto merge of #143254 - matthiaskrgr:rollup-7x8bxek, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#143019 (Ensure -V --verbose processes both codegen_backend and codegen-backend)
 - rust-lang/rust#143140 (give Pointer::into_parts a more scary name and offer a safer alternative)
 - rust-lang/rust#143175 (Make combining LLD with external LLVM config a hard error)
 - rust-lang/rust#143180 (Use `tracing-forest` instead of `tracing-tree` for bootstrap tracing)
 - rust-lang/rust#143223 (Improve macro stats printing)
 - rust-lang/rust#143228 (Handle build scripts better in `-Zmacro-stats` output.)
 - rust-lang/rust#143229 ([COMPILETEST-UNTANGLE 1/N] Move some some early config checks to the lib and move the compiletest binary)
 - rust-lang/rust#143246 (Subtree update of `rust-analyzer`)
 - rust-lang/rust#143248 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-30 22:36:52 +00:00
bors
fdad98d746 Auto merge of #143254 - matthiaskrgr:rollup-7x8bxek, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#143019 (Ensure -V --verbose processes both codegen_backend and codegen-backend)
 - rust-lang/rust#143140 (give Pointer::into_parts a more scary name and offer a safer alternative)
 - rust-lang/rust#143175 (Make combining LLD with external LLVM config a hard error)
 - rust-lang/rust#143180 (Use `tracing-forest` instead of `tracing-tree` for bootstrap tracing)
 - rust-lang/rust#143223 (Improve macro stats printing)
 - rust-lang/rust#143228 (Handle build scripts better in `-Zmacro-stats` output.)
 - rust-lang/rust#143229 ([COMPILETEST-UNTANGLE 1/N] Move some some early config checks to the lib and move the compiletest binary)
 - rust-lang/rust#143246 (Subtree update of `rust-analyzer`)
 - rust-lang/rust#143248 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-30 22:36:52 +00:00
Jeremy Smart
3bf650f980 add failing test, bless incorrect output 2025-06-30 18:03:39 -04:00
Kivooeo
9a7db566d7 moved tests 2025-07-01 02:45:14 +05:00
Michael Goulet
08278eb1d5 Don't recompute DisambiguatorState for every RPITIT in trait definition 2025-06-30 21:21:35 +00:00
Trevor Gross
18a621abe4 Upgrade dependencies in run-make-support
The main purpose of this is to upgrade `object` and `gimli`, which will
allow us to drop outdated versions once backtrace also updates.
The only semver breakage in `object`'s is in `elf::R_RISCV_GNU_*` and
`pe::IMAGE_WEAK_EXTERN_*` constants, as well as Mach-O dyld, which don't
appear to be used here. `gimli` is similar, there is only minor breakage
related to dyld.

These version upgrades were also done in the library.

`bstr`, `similar`, and `regex` are also upgraded to the latest minor
version here to match what the lockfile already uses. The `regex`
comment about `memchr` version hasn't been relevant to this lockfile
since e95d15a115 ("Pin memchr to 2.5.0 in the library rather than
rustc_ast") and is no longer relevant in the library lockfile either.

Object Changelog: https://github.com/gimli-rs/object/blob/master/CHANGELOG.md#0370
Gimli changelog: https://github.com/gimli-rs/gimli/blob/master/CHANGELOG.md#0320
2025-06-30 15:46:36 -05:00
Pavel Grigorenko
187babc35f NoArgsAttributeParser 2025-06-30 23:19:04 +03:00
llogiq
bca8931bbb Fix coerce_container_to_any false positive on autoderef (#15057)
Fixes the false positive reported in rust-lang/rust-clippy#15045. ~I
still need to work out how to fix the suggestion.~

changelog: none
2025-06-30 20:00:06 +00:00
Samuel Tardieu
8ceb91e1c7 Do not remove as if it changes the type
While `expr as T` can be removed as a statement if `expr` has no
side-effect, the `as T` part alone cannot be removed if the type
of `expr` would be ambiguous without the cast.
2025-06-30 21:03:39 +02:00
Trevor Gross
a1a066999b mbe: Move MetaVarExprConcatElem closer to where it is used
Move this structure directly above the `parse_<expr>` functions that
return it to keep top-down flow.

This is a non-functional change.
2025-06-30 19:02:36 +00:00
Trevor Gross
3d9e510461 mbe: Factor concat metavariable handling out
Move the `concat` implementation to a separate function so it is easier
to work on. Other metavariable expressions are already split this way.

This is a non-functional change.
2025-06-30 19:02:36 +00:00
Trevor Gross
128945fdbf mbe: Shorten MetaVarExpr -> Mve in structural diagnostics
More diagnostic structs related to metavariable expressions will be
introduced. Introduce the abbreviation "mve" which is reasonably
unambiguous (`rg Mve` and `rg '(\b|_|-)mve(\b|_|-)'` return no results
outside of a Thumb target feature) and use it for these diagnostic
types. A new module is also created.
2025-06-30 19:02:36 +00:00
Trevor Gross
b3d74da9b8 mbe: Extend metavariable expression tests
Add tests showing the current state to make it more clear when output
gets updated later in refactoring.
2025-06-30 19:02:36 +00:00
Trevor Gross
876835de11 mbe: Split metavariable usage tests off from syntax tests
`syntax-errors` currently contains both syntax error tests (which don't
need expansion) and tests for incorrect instantiations of the `count`
metavariable expression (which do need expansion). Split the
expansion-dependent tests to a separate file and remove unneeded
invocations from `syntax-errors`, to ensure we are catching these before
expansion.
2025-06-30 19:00:42 +00:00
Matthias Krüger
3f6dc54f5c Rollup merge of #143248 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/book

2 commits in 8a6d44e45b7b564eeb6bae30507e1fbac439d72d..ef1ce8f87a8b18feb1b6a9cf9a4939a79bde6795
2025-06-28 18:06:08 UTC to 2025-06-26 23:08:19 UTC

- Chapter 14 from tech review (rust-lang/book#4423)
- Chapter 13 from tech review (rust-lang/book#4421)

## rust-embedded/book

1 commits in 10fa1e084365f23f24ad0000df541923385b73b6..41f688a598a5022b749e23d37f3c524f6a0b28e1
2025-06-27 07:21:31 UTC to 2025-06-27 07:21:31 UTC

- Fix incorrect type for semihosted stdout stream rust-lang/rust#394 (rust-embedded/book#395)

## rust-lang/reference

4 commits in 50fc1628f36563958399123829c73755fa7a8421..e9fc99f107840813916f62e16b3f6d9556e1f2d8
2025-06-28 20:00:14 UTC to 2025-06-24 19:02:48 UTC

- fix: swap places for 2 words in associated-items.md sentence. (rust-lang/reference#1871)
- Add new temporary lifetime extension rule (rust-lang/reference#1813)
- Fix smart punctuation inside grammar terminals (rust-lang/reference#1869)
- Fix placement of codegen link definitions (rust-lang/reference#1868)

## rust-lang/rust-by-example

1 commits in 05c7d8bae65f23a1837430c5a19be129d414f5ec..288b4e4948add43f387cad35adc7b1c54ca6fe12
2025-06-25 12:35:59 UTC to 2025-06-25 12:35:59 UTC

- allow easy fixes (rust-lang/rust-by-example#1941)
2025-06-30 20:49:45 +02:00
Matthias Krüger
6d41b3479f Rollup merge of #143246 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? ``@ghost``
2025-06-30 20:49:44 +02:00
Matthias Krüger
8156725d2e Rollup merge of #143229 - jieyouxu:compiletest-maintenance-1, r=Kobzol
[COMPILETEST-UNTANGLE 1/N] Move some some early config checks to the lib and move the compiletest binary

This is part of a patch series to untangle `compiletest` to hopefully nudge it towards being more maintainable.

This PR:

- Moves some early config checks (some warnings) to the compiletest library.
- Moves `src/main.rs` to `src/bin/main.rs` to make the separation (as in, compiletest's library component vs the tool binary component) more obvious.

r? ``@Kobzol`` (or reroll)
2025-06-30 20:49:44 +02:00
Matthias Krüger
f2231d5324 Rollup merge of #143228 - nnethercote:macro-stats-build-scripts, r=Kobzol
Handle build scripts better in `-Zmacro-stats` output.

Currently all build scripts are listed as `build_script_build` in the stats header. This commit uses `CARGO_PKG_NAME` to improve that.

I tried it on Bevy, it works well, giving output like this on the build script:
```
MACRO EXPANSION STATS: serde build script
```
and this on the crate itself:
```
MACRO EXPANSION STATS: serde
```

r? `@Kobzol`
2025-06-30 20:49:43 +02:00
Matthias Krüger
172fc60e5f Rollup merge of #143223 - nnethercote:improve-macro-stats-printing, r=petrochenkov
Improve macro stats printing

Fix a small formatting issue that has been annoying me.

r? ``@petrochenkov``
2025-06-30 20:49:43 +02:00
Matthias Krüger
d3c02b48df Rollup merge of #143180 - jieyouxu:forest, r=Kobzol
Use `tracing-forest` instead of `tracing-tree` for bootstrap tracing

I find the `tracing-forest` output easier to comprehend.

Note that this is not a strict improvement -- `tracing-forest` output contains some emojis and redundant log levels, but customizing it seems to be... non-trivial. Despite this, I still find `tracing-forest` easier to follow than `tracing-tree`, even when I tried to tune `tracing-tree` output.

### Preview

```bash
BOOTSTRAP_TRACING=debug ./x test library/std --dry-run
```

With `tracing-forest` (this PR), it looks like

![Screenshot 2025-06-29 174802](https://github.com/user-attachments/assets/1ab9150f-48f8-4fb3-b004-27bcf8bbc0f5)

With `tracing-tree` (before this PR), it looked like

![Screenshot 2025-06-29 175227](https://github.com/user-attachments/assets/659e254d-15ab-47dd-af11-98e2331d4d7a)

r? `@Kobzol`
2025-06-30 20:49:42 +02:00
Matthias Krüger
7d904aeb90 Rollup merge of #143140 - RalfJung:ptr-into-parts, r=oli-obk
give Pointer::into_parts a more scary name and offer a safer alternative

`into_parts` is a bit too innocent of a name for a somewhat subtle operation.
r? `@oli-obk`
2025-06-30 20:49:41 +02:00
Matthias Krüger
1be0c62069 Rollup merge of #143175 - Kobzol:bootstrap-lld-external-llvm-config, r=Jieyouxu
Make combining LLD with external LLVM config a hard error

Younger me made this only a warning in https://github.com/rust-lang/rust/pull/139853, because our post-dist tests were relying on this. But that was not a good idea, because there are a bunch of places in bootstrap that outright try to build LLD/copy LLD to sysroot when `lld_enabled` is true (rightfully so), which is causing issues (https://github.com/rust-lang/rust/issues/143076). Instead of piling more hacks, I'd like to just disallow this, and if we need to use a hack, do it only for our CI.

If this breaks the CI post-dist tests, I'll either add some special environment variable for it, or, as an alternative, make the error back into a warning, but also disable `lld_enabled` when this situation happens.

try-job: dist-x86_64-linux

Fixes: https://github.com/rust-lang/rust/pull/143175
2025-06-30 20:49:41 +02:00
Matthias Krüger
8292936d74 Rollup merge of #143140 - RalfJung:ptr-into-parts, r=oli-obk
give Pointer::into_parts a more scary name and offer a safer alternative

`into_parts` is a bit too innocent of a name for a somewhat subtle operation.
r? `@oli-obk`
2025-06-30 20:49:41 +02:00
Matthias Krüger
8b8cd35edc Rollup merge of #143019 - danielframpton:codegen-backend-parse, r=bjorn3
Ensure -V --verbose processes both codegen_backend and codegen-backend
2025-06-30 20:49:40 +02:00
bors
f26e580230 Auto merge of #143239 - GuillaumeGomez:subtree-update_cg_gcc_2025-06-30, r=GuillaumeGomez
GCC backend subtree update

cc `@antoyo`

r? ghost
2025-06-30 18:47:06 +00:00
bors
43e9b04296 Auto merge of #143239 - GuillaumeGomez:subtree-update_cg_gcc_2025-06-30, r=GuillaumeGomez
GCC backend subtree update

cc `@antoyo`

r? ghost
2025-06-30 18:47:06 +00:00
Timo
936baca0cd Consider deref'ed argument as non-temporary (#15172)
If there are more than one dereference (there is one corresponding
matched with a borrow in any case), consider that the argument might
point to a place expression, which is the safest choice.

Also, use an appropriate number of dereferences in suggestions involving
arguments using themselves multiple dereferences.

Fixes rust-lang/rust-clippy#15166

changelog: [`swap_with_temporary`]: fix false positive leading to
different semantics being suggested, and use the right number of
dereferences in suggestion

r? y21

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_SUMMARY_START -->

### Summary Notes

-
[beta-nomination](https://github.com/rust-lang/rust-clippy/pull/15172#issuecomment-3016752569)
by [samueltardieu](https://github.com/samueltardieu)

*Managed by `@rustbot`—see
[help](https://forge.rust-lang.org/triagebot/note.html) for details*

<!-- TRIAGEBOT_SUMMARY_END -->
<!-- TRIAGEBOT_END -->
2025-06-30 18:46:11 +00:00
Guillaume Gomez
74fda50f3b Remove unused descr methods 2025-06-30 20:36:16 +02:00
Guillaume Gomez
76df2656df Replace ItemCtxt::report_placeholder_type_error match with a call to TyCtxt::def_descr 2025-06-30 20:36:16 +02:00
Daniel Frampton
bb65bc8cba Ensure -V --verbose processes both codegen_backend and codegen-backend 2025-06-30 11:11:00 -07:00
Samuel Tardieu
c69905a995 Do not remove method call if type is adjusted
Propose to replace `x.map_or(false, |y| y == z)` by `x == Some(z)` only
if `x` is not adjusted. Otherwise, the type of `x` in the comparaison
may not be the expected one, as it may be the product of an auto-deref.
2025-06-30 19:51:13 +02:00