Commit graph

308340 commits

Author SHA1 Message Date
Yotam Ofek
978ab7c542 nicer serde impls 2025-10-07 13:23:10 +03:00
Yotam Ofek
eb8d87d1d8 avoid in-process serializing&deserializing 2025-10-07 12:58:05 +03:00
Shoyu Vanilla (Flint)
4494f87960
Merge pull request #20792 from A4-Tacks/minor-fix-make-extract-ty-alias
minor: Fix using `make::ty` for extract_type_alias
2025-10-07 09:31:17 +00:00
Shoyu Vanilla (Flint)
8f312c24f5
Merge pull request #19771 from A4-Tacks/gen-blanket-trait-impl
Add ide-assist: generate blanket trait impl
2025-10-07 08:52:48 +00:00
James Barford-Evans
43f7eaa0ba Fix; correct placement of type inference error for method calls 2025-10-07 09:51:16 +01:00
Timo
c1f61242e2
legacy_numeric_constants: add ctxt check for internal macro (#15816)
Fixes rust-lang/rust-clippy#15805

ICE bisects to 9457d640b7, which handles the span incorrectly when part
of the path originates from internal declarative macro.

changelog: none
2025-10-07 08:34:10 +00:00
Lukas Wirth
7e57c42024
Merge pull request #20803 from SomeoneToIgnore/nocapture
Replace `--show-output` task defaults with `--nocapture`
2025-10-07 08:27:08 +00:00
Tim (Theemathas) Chirananthavat
0fe466cc25
Fix doc comment 2025-10-07 14:47:39 +07:00
Jonathan Brouwer
1589c6c12d
Add regression test for link_section targets 2025-10-07 09:40:27 +02:00
Zalathar
525ed4cc5c Read the whole test file before parsing directives
Few tests are larger than a handful of kilobytes, and nowadays we scan the
whole file for directives anyway, so there's little reason not to just read the
whole thing up-front.

This avoids having to deal with I/O within `iter_directives`, which should make
it easier to overhaul directive processing.
2025-10-07 18:02:52 +11:00
bors
4a54b26d30 Auto merge of #147428 - matthiaskrgr:rollup-k3nlxlu, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#145495 (Use declarative macro for `#[derive(TryFromU32)]`)
 - rust-lang/rust#147165 (test: Subtract code_offset from width for ui_testing)
 - rust-lang/rust#147354 (Fix wrong span for hightlight for duplicated diff lines)
 - rust-lang/rust#147395 (Improve diagnostics: update note and add help message)
 - rust-lang/rust#147396 (Fluent tidy improvements)
 - rust-lang/rust#147407 (Update books)
 - rust-lang/rust#147413 (don't panic on extern with just multiple quotes in the name)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-10-07 06:42:11 +00:00
Samuel Tardieu
f3c020cd55
Use expect for lint warnings (#15625)
changelog:none
2025-10-07 06:40:53 +00:00
Matthias Krüger
21bf6db483
Rollup merge of #147413 - karolzwolak:extern-multiple-quotes, r=fmease
don't panic on extern with just multiple quotes in the name

Continues rust-lang/rust#147377.
That PR fixed ICE when the extern name was a single quote `"'"`, but multiple quotes like `"''"` cause the same problem.
I had a random revelation that the trimming can remove more than one quote.
r? ``@nnethercote``
2025-10-07 07:04:20 +02:00
Matthias Krüger
0471a5814a
Rollup merge of #147407 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/reference

4 commits in e11adf6016a362766eea5a3f9832e193994dd0c8..8efb9805686722dba511b7b27281bb6b77d32130
2025-10-06 15:04:20 UTC to 2025-10-01 17:30:01 UTC

- Clarify that "or it is dropped" is meant restrictively (rust-lang/reference#2035)
- add lifetime extension tests for tuple struct temporaries (rust-lang/reference#2033)
- Add `target_env = "macabi"` and `target_env = "sim"` (rust-lang/reference#1781)
- Typo fixes for the Tokens page (additions -> editions) (rust-lang/reference#2031)
2025-10-07 07:04:20 +02:00
Matthias Krüger
1afc08dbfe
Rollup merge of #147396 - GuillaumeGomez:fluent-tidy-improvements, r=kobzol
Fluent tidy improvements

Follow-up of rust-lang/rust#147345 and of rust-lang/rust#147191.

It uses `fluent_syntax` to parse `fluent` files (but not for blessing, not even sure how the current one works).

I also added an `assert` to ensure we never go to previous situation where the `fluent` files were actually not checked at all.

cc ``@Kivooeo``
r? kobzol
2025-10-07 07:04:19 +02:00
Matthias Krüger
6332a76b3d
Rollup merge of #147395 - reddevilmidzy:refact-error-msg, r=Kivooeo,jackh726
Improve diagnostics: update note and add help message

I moved the content from the note to a help message, as it seemed more appropriate there, and then added new information to the note(`Modules are usually placed outside of blocks, at the top level of the file`)!

resolve: rust-lang/rust#147314
2025-10-07 07:04:18 +02:00
Matthias Krüger
3f1e8cc1b5 Rollup merge of #147165 - Muscraft:subtract-code-offset, r=davidtwco
test: Subtract code_offset from width for ui_testing

`annotate-snippets` does not have a "UI test" mode like `rustc`, [where the code offset is not subtracted from the column width](f34ba774c7/compiler/rustc_errors/src/emitter.rs (L1985-L1987)). This makes it so `annotate-snippets` will shift the output for some very long tests 5 - 7 columns to the left. As part of my work to have `rustc` use `annotate-snippets`, and to reduce the test differences between the two, I figured it would be best if `rustc` started subtracting the code offset from the width as well.

The first commit exists to keep the test output changes of adding a new line to a test separate from adding the `--diagnostic-width` flag in the second commit. This makes it easier to verify that adding the flag does not affect the test's output.

[Zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/147480-t-compiler.2Fdiagnostics/topic/annotate-snippets.20hurdles)
2025-10-07 07:04:17 +02:00
Matthias Krüger
f64703ce7a
Rollup merge of #147354 - chenyukang:yukang-fix-147070-wrong-highlight-span, r=estebank
Fix wrong span for hightlight for duplicated diff lines

Fixes rust-lang/rust#147070

From comments: https://github.com/rust-lang/rust/issues/147070#issuecomment-3368593144
The lightlight row for diff must at least 2.

r? `@estebank`
2025-10-07 07:04:17 +02:00
Matthias Krüger
4209a4661a
Rollup merge of #147165 - Muscraft:subtract-code-offset, r=davidtwco
test: Subtract code_offset from width for ui_testing

`annotate-snippets` does not have a "UI test" mode like `rustc`, [where the code offset is not subtracted from the column width](f34ba774c7/compiler/rustc_errors/src/emitter.rs (L1985-L1987)). This makes it so `annotate-snippets` will shift the output for some very long tests 5 - 7 columns to the left. As part of my work to have `rustc` use `annotate-snippets`, and to reduce the test differences between the two, I figured it would be best if `rustc` started subtracting the code offset from the width as well.

The first commit exists to keep the test output changes of adding a new line to a test separate from adding the `--diagnostic-width` flag in the second commit. This makes it easier to verify that adding the flag does not affect the test's output.

[Zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/147480-t-compiler.2Fdiagnostics/topic/annotate-snippets.20hurdles)
2025-10-07 07:04:17 +02:00
Matthias Krüger
0bf117f481
Rollup merge of #145495 - fee1-dead-contrib:push-tynlnktvrmrx, r=Zalathar
Use declarative macro for `#[derive(TryFromU32)]`

cc ``@Zalathar``
2025-10-07 07:04:16 +02:00
Nicholas Nethercote
19423b7f7f Simplify DepNodeColorMap::try_mark_green.
It uses a different implementation depending on whether the compiler
front-end is running single-threaded or multi-threaded. The two
implementations are equivalent and I think the multi-threaded one
expresses the intent more clearly, and I imagine the perf is similar. So
this commit removes the single-threaded code.
2025-10-07 15:32:34 +11:00
Nicholas Nethercote
ed6a137a32 Tweak DepNodeColorMap::get.
The most common `get` case is green. This commit changes `get` to use
use `if`/`else` instead of match, so that getting green requires one
comparison instead of two.
2025-10-07 15:32:33 +11:00
bors
d773bd07d6 Auto merge of #147099 - cjgillot:split-nop-landing, r=lcnr
Refactor remove_noop_landing_pads in two loops.

The point is to avoid clearing the CFG cache as often.

r? `@ghost` for perf
2025-10-07 03:31:27 +00:00
yukang
231c39545e Fix wrong span for hightlight for duplicated diff lines 2025-10-07 02:45:11 +00:00
bors
ff5be13e2d Auto merge of #146355 - cjgillot:gvn-union, r=jackh726
GVN: Support unions.

Supporting union values is not very hard, and allows to const-prop them.

r? `@ghost` for perf
2025-10-07 00:22:40 +00:00
Nick Drozd
5318883d75 Use expect for lint warnings 2025-10-06 20:17:12 -04:00
Jynn Nelson
bc930cd2d1 collect-license-metadata: Print a diff of the expected output
Previously, `x test collect-license-metadata` gave the following message
on errors:
```
gathering license information from REUSE (this might take a minute...)
finished gathering the license information from REUSE in 78.69s
loading existing license information
The existing /home/runner/work/ferrocene/ferrocene/license-metadata.json
file is out of date.
Run ./x run collect-license-metadata to update it.
Error: The existing
/home/runner/work/ferrocene/ferrocene/license-metadata.json file doesn't
match what REUSE reports.
Bootstrap failed while executing `test collect-license-metadata`
```

Notable, this doesn't actually say what went wrong.
Print a diff in addition so it's more clear what broke:
```
...
                "license": {
                   "copyright": [
+                    "2010 The Rust Project Developers",
                     "2016, 2017, 2018, 2019, 2020, 2021 AXE Consultants. All Rights",
+                    "License. Subject to the terms and conditions of this",
                     "Notice",
-                    "The Ferrocene Developers"
+                    "The Ferrocene Developers",
+                    "[yyyy] [name of copyright owner]"
                   ],
...
```

Currently, this prints the entire text of the JSON file as context.
That's not ideal, but it's rare for this to fail, so I think it's ok for
now.

I considered using `assert_json_diff` instead of `similar`, but its
errors are a lot harder to read IMO, even though they are better at
omitting unnecessary context:

```
Diff: json atoms at path ".files.children[0].children[10].license.copyright[0]" are not equal:
    lhs:
        "2016 The Fuchsia Authors"
    rhs:
        "2019 The Crossbeam Project Developers"

json atoms at path ".files.children[0].children[10].license.spdx" are not equal:
    lhs:
        "BSD-2-Clause AND (Apache-2.0 OR MIT)"
    rhs:
        "Apache-2.0 OR MIT"

json atom at path ".files.children[0].children[10].children" is missing from lhs

json atoms at path ".files.children[0].children[10].name" are not equal:
    lhs:
        "library/std/src/sys/sync/mutex/fuchsia.rs"
    rhs:
        "library/std/src/sync/mpmc"
...
```
2025-10-06 19:10:12 -04:00
Nicholas Nethercote
659b758be7 Make DepNodeColor tri-value.
Currently it's binary, either `Green` or `Red`. But it's almost always
used within an `Option`. So it's a bit neater, and possibly slightly
faster, to make it tri-value with `Unknown` as a first-class variant.
2025-10-07 09:37:45 +11:00
Nicholas Nethercote
a4162d9a82 Change DepNodeColorMap::insert to insert_red.
Because it's only ever used for inserting red. (`None` is only used as a
starting value, and `Green` is inserted by `try_mark_green` and
friends.)
2025-10-07 09:33:33 +11:00
Nicholas Nethercote
f644f2c1f3 Avoid passing Option<&MarkFrame<'_>>.
Two functions take arguments of this type, but the `Option` is always
`Some`, so we can just pass `&MarkFrame<'_>` instead.
2025-10-07 09:32:15 +11:00
Samuel Tardieu
a11fe5d389 Add diagnostic items for pub mod consts of FP types
They will be used in Clippy.
2025-10-06 23:59:20 +02:00
bors
68ad25392f Auto merge of #147405 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? Manishearth

`Cargo.lock` update due to `toml` version bump. This caused `serde_core` being added as a transitive dependency, so `tidy --bless` had to be run.

(Sorry for the late sync)
2025-10-06 21:12:23 +00:00
Samuel Tardieu
5b23bd479e
Remove no-rustfixes (#15827)
Remove no-rustfixes where it's not required anymore

changelog: none
2025-10-06 21:08:58 +00:00
Samuel Tardieu
2c71638be5
Implement volatile_composites lint (#15686)
Volatile reads and writes to non-primitive types are not well-defined,
and can cause problems.

Fixes rust-lang/rust-clippy#15529

changelog: [`volatile_composites`]: Lint when read/write_volatile is
used on composite types
(structs, arrays, etc) as their semantics are not well defined.
2025-10-06 21:06:29 +00:00
Jonathan Brouwer
4787834eda
Fix target list of link_section
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-10-06 23:04:09 +02:00
Karol Zwolak
cb06d91cd0 don't panic on extern with just multiple quotes in the name 2025-10-06 22:12:51 +02:00
Camille Gillot
96c3978eaa Repurpose defunct test. 2025-10-06 19:32:32 +00:00
Camille Gillot
5407eb8ca2 GVN: Support unions. 2025-10-06 19:31:40 +00:00
Alexey Semenyuk
f97b493fa5 Remove no-rustfix 2025-10-06 21:21:02 +03:00
beepster4096
a0e9cb7cb4 erase coroutine shim dereftemps 2025-10-06 10:57:27 -07:00
beepster4096
fc959e5464 remove DerefTemp and CopyFromDeref from runtime mir 2025-10-06 10:57:27 -07:00
reddevilmidzy
02126adc1b Improve diagnostics: replace 'non-inline module' with 'file module' and update note/help messages 2025-10-07 02:53:45 +09:00
Michael Howell
5c31880034 rustdoc-search: use a throbbler with no motion
This change is a response to complaints about motion sickness.
2025-10-06 10:43:49 -07:00
dswij
4f21c9929c
extend while_let_loop to loop { let else } (#15701)
now lints on
```rs
let mut x = [1,2,3].into_iter();
loop {
   let Some(x) = x.next() else { break };
   dbg!(x);
}
```
```
changelog: [`while_let_loop`]: extend to lint on `let else`
```
2025-10-06 17:29:19 +00:00
Urgau
e0c20a0476 Update S-waiting-on-team refs to new S-waiting-on-{team} labels 2025-10-06 19:25:40 +02:00
rustbot
490fd3ddd2 Update books 2025-10-06 19:01:25 +02:00
Michael Howell
2773d24fb7 rustdoc-search: put throbber at bottom of search results instead 2025-10-06 09:51:53 -07:00
Michael Howell
d3c3e25674 rustdoc-search: remove animated throbber
Complaints about it being distracting, and causing people to wait
until all of the results are loaded instead of using the incremental
results as they come in, make me think this is a bad idea.
2025-10-06 09:51:53 -07:00
Philipp Krones
e652436f2a
Allow serde_core as a dependency 2025-10-06 18:28:23 +02:00
David Barsky
d20dce21ec
Merge pull request #20796 from ChayimFriedman2/bump-salsa
internal: Bump Salsa
2025-10-06 16:23:20 +00:00