Commit Graph

48471 Commits

Author SHA1 Message Date
Esteban Küber
bb74f47327 Do not suggest borrow that is already there in fully-qualified call
When encountering `&str::from("value")` do not suggest `&&str::from("value")`.

Fix #132041.
2025-07-01 21:49:56 +00:00
Pavel Grigorenko
8bb7fdb236 NoArgsAttributeParser: use an assoc const instead 2025-07-02 00:21:12 +03:00
Michael Goulet
2516c33982 Remove support for dyn* 2025-07-01 19:00:21 +00:00
bors
71e4c005ca Auto merge of #143287 - GuillaumeGomez:rollup-fdjcti9, r=GuillaumeGomez
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#136801 (Implement `Random` for tuple)
 - rust-lang/rust#141867 (Describe Future invariants more precisely)
 - rust-lang/rust#142760 (docs(fs): Touch up grammar on lock api)
 - rust-lang/rust#143181 (Improve testing and error messages for malformed attributes)
 - rust-lang/rust#143210 (`tests/ui`: A New Order [19/N] )
 - rust-lang/rust#143212 (`tests/ui`: A New Order [20/N])
 - rust-lang/rust#143230 ([COMPILETEST-UNTANGLE 2/N] Make some compiletest errors/warnings/help more visually obvious)
 - rust-lang/rust#143240 (Port `#[rustc_object_lifetime_default]` to the new attribute parsing …)
 - rust-lang/rust#143255 (Do not enable LLD by default in the dist profile)
 - rust-lang/rust#143262 (mir: Mark `Statement` and `BasicBlockData` as `#[non_exhaustive]`)
 - rust-lang/rust#143269 (bootstrap: make comment more clear)
 - rust-lang/rust#143279 (Remove `ItemKind::descr` method)

Failed merges:

 - rust-lang/rust#143237 (Port `#[no_implicit_prelude]` to the new attribute parsing infrastructure)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-01 18:09:52 +00:00
Josh Stone
e851e3e16e Update cfg(bootstrap) 2025-07-01 10:55:49 -07:00
Josh Stone
9ce8930da6 Update version placeholders 2025-07-01 10:54:33 -07:00
Guillaume Gomez
189bfc1e63 Rollup merge of #143279 - GuillaumeGomez:rm-itemkind-descr, r=oli-obk
Remove `ItemKind::descr` method

Follow-up of rust-lang/rust#143234.

After this PR is merged, it will remain two `descr` methods:

 * `hir::GenericArg::descr`
 * `hir::AssocItemConstraintKind::descr`

For both these enums, I don't think there is the right equivalent in `hir::DefKind` so unless I missed something, we can't remove these two methods because we can't convert these enums into `hir::DefKind`.

r? `@oli-obk`
2025-07-01 17:47:06 +02:00
Guillaume Gomez
b47008a7c2 Rollup merge of #143262 - dianqk:non_exhaustive, r=oli-obk
mir: Mark `Statement` and `BasicBlockData` as `#[non_exhaustive]`

Ensure they are always created using constructors.

r? oli-obk
2025-07-01 17:47:05 +02:00
Guillaume Gomez
61bb076459 Rollup merge of #143240 - JonathanBrouwer:object_lifetime_default_parser, r=oli-obk
Port `#[rustc_object_lifetime_default]` to the new attribute parsing …

Ports rustc_object_lifetime_default to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197

r? `@oli-obk`
cc `@jdonszelmann`
2025-07-01 17:47:04 +02:00
Guillaume Gomez
1f881177b2 Rollup merge of #143181 - JonathanBrouwer:malformed-attrs, r=oli-obk
Improve testing and error messages for malformed attributes

This PR has been split into 5 commits for reviewability, I recommend reviewing them one-by-one.
This first commit introduces more tests, the other 4 commits fix 4 bugs discovered by the test.

r? `@oli-obk`
cc `@jdonszelmann`

Fixes https://github.com/rust-lang/rust/issues/143136
2025-07-01 17:47:01 +02:00
bors
4e97337005 Auto merge of #142030 - oli-obk:wfck-less-hir, r=compiler-errors
Start moving wf checking away from HIR

I'm trying to only access the HIR in the error path. My hope is that once we move significant portions of wfcheck off HIR that incremental will be able to cache wfcheck queries significantly better.

I think I am reaching a blocker because we normally need to provide good spans to `ObligationCause`, so that the trait solver can report good errors. In some cases I have been able to use bad spans and improve them depending on the `ObligationCauseCode` (by loading HIR in the case where we actually want to error). To scale that further we'll likely need to remove spans from the `ObligationCause` entirely (leaving it to some variants of `ObligationCauseCode` to have a span when they can't recompute the information later). Unsure this is the right approach, but we've already been using it. I will create an MCP about it, but that should not affect this PR, which is fairly limited in where it does those kind of tricks.

Especially b862d8828e is interesting here, because I think it improves spans in all cases
2025-07-01 14:59:58 +00:00
Jonathan Brouwer
57a5e3b6d2 Fix duplicate errors for link_section, rustc_layout_scalar_valid_range_start and rustc_layout_scalar_valid_range_end 2025-07-01 16:40:47 +02:00
Jonathan Brouwer
1e474c2c6c Port #[rustc_object_lifetime_default] to the new attribute parsing infrastructure 2025-07-01 16:31:23 +02:00
Jonathan Brouwer
d22ce4c5eb Fix duplicate help on export_name and others
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01 16:10:07 +02:00
Jonathan Brouwer
0b67d14b31 Fix #[rustc_macro_transparency] giving two errors
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01 16:10:07 +02:00
Jonathan Brouwer
149bdde97e Fix #[must_use = 1] not giving an error
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01 16:10:05 +02:00
Jonathan Brouwer
86b54d5729 Fix double error for export_name
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01 16:10:02 +02:00
Folkert de Vries
8fdf0ef0ae loop match: handle opaque patterns
fixes issue 143203
2025-07-01 15:53:52 +02:00
Folkert de Vries
aa7cc5d2f4 loop match: run exhaustiveness check 2025-07-01 15:53:50 +02:00
Guillaume Gomez
022c91465a Remove ItemKind::descr method 2025-07-01 14:36:28 +02:00
Camille GILLOT
cbc3cf716e Avoid computing layouts inside coroutines. 2025-07-01 12:06:39 +00:00
xizheyin
e7c3703c53 Suggest use another lifetime specifier instead of underscore lifetime
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-01 19:58:27 +08:00
bors
076a0a26fd Auto merge of #143013 - bjorn3:split_exported_symbols, r=oli-obk
Split exported_symbols for generic and non-generic symbols

This reduces metadata decoder overhead during the monomorphization collector.
2025-07-01 11:53:02 +00:00
Camille GILLOT
4750dff54e Remove extraneous types. 2025-07-01 11:40:44 +00:00
Camille GILLOT
be41333604 Store a full Ty with each Value. 2025-07-01 11:40:36 +00:00
Camille GILLOT
ac70dc85e7 Introduce Value::RawPtr as it behaves differently from other aggregates. 2025-07-01 11:38:50 +00:00
Camille GILLOT
fba4177d0f Simplify assignments. 2025-07-01 11:37:02 +00:00
bors
86e05cd300 Auto merge of #142921 - JonathanBrouwer:rustc_attributes_parser, r=oli-obk
Port `#[rustc_layout_scalar_valid_range_start/end]` to the new attrib…

Ports `rustc_layout_scalar_valid_range_start` and `rustc_layout_scalar_valid_range_end` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197

r? `@jdonszelmann`
2025-07-01 08:33:00 +00:00
Benjamin Schulz
7d6764a45b Detect more cases of unused_parens around types 2025-07-01 08:56:20 +02:00
bors
f46ce66fcc Auto merge of #143267 - matthiaskrgr:rollup-suvzar6, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#143125 (Disable f16 on Aarch64 without neon for llvm < 20.1.1)
 - rust-lang/rust#143156 (inherit `#[align]` from trait method prototypes)
 - rust-lang/rust#143178 (rustdoc default faviocon)
 - rust-lang/rust#143234 (Replace `ItemCtxt::report_placeholder_type_error` match with a call to `TyCtxt::def_descr`)
 - rust-lang/rust#143245 (mbe: Add tests and restructure metavariable expressions)
 - rust-lang/rust#143257 (Upgrade dependencies in run-make-support)
 - rust-lang/rust#143263 (linkify CodeSuggestion in doc comments)
 - rust-lang/rust#143264 (fix: Emit suggestion filename if primary diagnostic span is dummy)

Failed merges:

 - rust-lang/rust#143251 (bootstrap: add build.tidy-extra-checks option)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-01 05:31:05 +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
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
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 Schafer
c8fac7779e fix: Emit suggestion filename if primary diagnostic span is dummy 2025-06-30 19:24:22 -06: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
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
Michael Goulet
08278eb1d5 Don't recompute DisambiguatorState for every RPITIT in trait definition 2025-06-30 21:21:35 +00:00
Pavel Grigorenko
187babc35f NoArgsAttributeParser 2025-06-30 23:19:04 +03: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
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