Commit graph

313125 commits

Author SHA1 Message Date
Shunpoco
258708fa6d implement js check 2025-12-25 23:41:58 +00:00
Shunpoco
70d8c6163b implement shellcheck 2025-12-25 23:41:58 +00:00
Shunpoco
b305a98349 implpement if_installed for spellcheck
for other extra checks, it is WIP.
2025-12-25 12:23:08 +00:00
Shunpoco
9f7dc2e474 Extract version check from ensure_version_or_cargo_install
Define a new function ensure_version which is extracted (and modified) from ensure_version_or_cargo_install.
2025-12-25 12:15:11 +00:00
bors
8188f6c808 Auto merge of #149709 - Urgau:overhaul-filenames, r=davidtwco
Overhaul filename handling for cross-compiler consistency

This PR overhauls the way we handle filenames in the compiler and `rmeta` in order to achieve achieve cross-compiler consistency (ie. having the same path no matter if the filename was created in the current compiler session or is coming from `rmeta`).

This is required as some parts of the compiler rely on consistent paths for the soundness of generated code (see rust-lang/rust#148328).

In order to achieved consistency multiple steps are being taken by this PR:
 - by making `RealFileName` immutable
 - by only having `SourceMap::to_real_filename` create `RealFileName`
   - currently `RealFileName` can be created from any `Path` and are remapped afterwards, which creates consistency issue
 - by also making `RealFileName` holds it's working directory, embeddable name and the remapped scopes
   - this removes the need for a `Session`, to know the current(!) scopes and cwd, which is invalid as they may not be equal to the scopes used when creating the filename

In order for `SourceMap::to_real_filename` to know which scopes to apply `FilePathMapping` now takes the current remapping scopes to apply, which makes `FileNameDisplayPreference` and company useless and are removed.

This PR is split-up in multiple commits (unfortunately not atomic), but should help review the changes.

Unblocks https://github.com/rust-lang/rust/pull/147611
Fixes https://github.com/rust-lang/rust/issues/148328
2025-12-13 14:32:09 +00:00
bors
eb171a227f Auto merge of #147372 - jieyouxu:rust-analyzer-main-tests, r=Kobzol
Run main rust-analyzer tests in rust-lang/rust CI

Part of rust-lang/rust#147370.
MCP: https://github.com/rust-lang/compiler-team/issues/923

This PR prepares `rust-analyzer` crates with `in-rust-tree` cargo featues where needed, and and updates bootstrap to run the main `rust-analyzer` tests in rust-lang/rust CI, not just the `proc-macro-srv` crate tests.

This supersedes the earlier attempt at https://github.com/rust-lang/rust/pull/136779. I was honestly expecting more failures in this PR, but looking back at the previous attempt, that makes sense because we no longer run `i686-mingw` (32-bit windows-gnu) which had a _bunch_ of these failures. In the earlier attempt I also disabled the `i686-mingw`-related failures for `i686-msvc` since I didn't feel like digging into 32-bit msvc at the time. Try results from this PR shows that it's most likely limited to 32-bit windows-gnu specifically.

### `rust-analyzer` test remarks

- I actually had to _remove_ the `CARGO_WORKSPACE_DIR` `expect-test`-hack in order for `expect-test` to be able to find the test expectation HTML files (for `syntax_highlighting` tests in `ide`). When I added the hack, ironically, it made `expect-test` unable to find the expectation files. I think this was because previously the path was of the `proc-macro-srv` crate specifically, now we point to the root r-a workspace?
- The `cfg`-related differences on `aarch64-apple-darwin` might've been fixed? I can't tell, but we don't seem to be observing the differences now.
- I'm not sure why `config::{generate_config_documentation, generate_package_json_config}` no longer fails. Perhaps they were fixed to no longer try to write to source directory?

### Review remarks

- Commit 1 updates r-a crates that are involved in tests needing artifacts from `rustc_private` compiler crates to use the `in-rust-tree` cargo feature. I briefly tried to use a plain `--cfg=in_rust_tree`, but quickly realized it was very hacky, and needed invasive bootstrap changes. The cargo feature approach seems most "natural"/well-supported to both bootstrap and cargo.
- Commit 2 updates bootstrap to not only run the `proc-macro-srv` tests, but the whole r-a tests.
- Commit 3 restricts r-a main tests to non-32-bit targets we test in CI, since (1) r-a repo does not run tests against 32-bit platforms, and (2) there are some target pointer width sensitive hash differences causing tests to fail. Notably, this means that we also no longer run r-a `proc-macro-srv` tests against 32-bit targets, but we don't expect that crate to be have target pointer width differences. Discussed this in [#t-compiler/rust-analyzer > 32-bit tests?](https://rust-lang.zulipchat.com/#narrow/channel/185405-t-compiler.2Frust-analyzer/topic/32-bit.20tests.3F/with/563145736).

---

// try-job: aarch64-gnu
// try-job: aarch64-apple
// try-job: x86_64-mingw-1
// try-job: i686-msvc-1
// try-job: x86_64-msvc-1
// try-job: aarch64-msvc-1
2025-12-13 10:11:41 +00:00
bors
ce63e5d9ea Auto merge of #149941 - jhpratt:rollup-9p1xc2t, r=jhpratt
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#145278 (Update `rustc_codegen_gcc` rotate operation document)
 - rust-lang/rust#148837 (Use `let...else` instead of `match foo { ... _ => return };` and `if let ... else return`)
 - rust-lang/rust#149177 (Add proper suggestion for associated function with unknown field)
 - rust-lang/rust#149843 (Inherit attributes in delegation)
 - rust-lang/rust#149860 (Fix: Prevent macro-expanded extern crates from shadowing extern arguments)
 - rust-lang/rust#149874 (Weak for Arc pointer is marked as DynSend/DynSync)
 - rust-lang/rust#149903 (Remove unused code in `cfg_old`)
 - rust-lang/rust#149911 (bootstrap: Don't pass an unused `--color` to compiletest)
 - rust-lang/rust#149916 (Add a sanity check in case of any duplicate nodes)
 - rust-lang/rust#149924 (`declare_lint_pass` for `INLINE_ALWAYS_MISMATCHING_TARGET_FEATURES`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-13 07:00:41 +00:00
Jacob Pratt
3eba6b1fb9
Rollup merge of #149924 - JamieCunliffe:inline-lint-unknown, r=davidtwco
`declare_lint_pass` for `INLINE_ALWAYS_MISMATCHING_TARGET_FEATURES`

The `INLINE_ALWAYS_MISMATCHING_TARGET_FEATURES` lint was missing from this causing it to be an unknown lint when attempting to allow it.

r? ``@davidtwco``
2025-12-13 00:55:59 -05:00
Jacob Pratt
754b4a4945
Rollup merge of #149916 - zetanumbers:double_node_sanity, r=petrochenkov
Add a sanity check in case of any duplicate nodes

A simple check in case compiler tries to encode a dep node twice like in rust-lang/rust#141540.

Also if we'd try to mark a red node as green as it may then create a bad `DepNodeIndex` like in rust-lang/rust#148295.

If it prevents rust-lang/rust#141540 from emitting a faulty `dep-graph.bin` file via panic then it means you will be able to temporarily fix it by simply restarting cargo or rust-analyzer without cleaning up incremental cache.
2025-12-13 00:55:59 -05:00
Jacob Pratt
aec47812cf
Rollup merge of #149911 - Zalathar:no-color, r=jieyouxu
bootstrap: Don't pass an unused `--color` to compiletest

- Follow-up to https://github.com/rust-lang/rust/pull/149850

---

This flag was an artifact of compiletest's old libtest-based test executor, and currently doesn't influence compiletest's output at all.

A follow-up commit also inlines `force_coloring_in_ci` into its only remaining caller, and updates its comment.
2025-12-13 00:55:58 -05:00
Jacob Pratt
6b29f18654
Rollup merge of #149903 - JonathanBrouwer:cfg_old_cleanup, r=jdonszelmann
Remove unused code in `cfg_old`

r? ```@jdonszelmann```

Fixes one of the todos from https://github.com/rust-lang/rust/issues/149865
2025-12-13 00:55:58 -05:00
Jacob Pratt
bcde603308
Rollup merge of #149874 - azhogin:azhogin/arc_weak_dyn_send_sync, r=eholk
Weak for Arc pointer is marked as DynSend/DynSync

`std::sync::Weak` (weak pointer for Arc) added to DynSend and DynSync (looks like it was missed to add there when implemented).
2025-12-13 00:55:57 -05:00
Jacob Pratt
47f1502c73
Rollup merge of #149860 - Delta17920:fix/149821-root-cause, r=petrochenkov
Fix: Prevent macro-expanded extern crates from shadowing extern arguments

prevents an ICE by fixing a logic bug in `build_reduced_graph.rs`.
the bug caused the compiler to correctly detect and report a shadowing error for a macro-expanded `extern crate` but then continue processing the invalid item, corrupting the resolver's internal state (`extern_prelude`) and leading to a crash in later resolution passes the fix adds an early return after the shadowing error is reported to ensure the invalid item is not added to the resolution graph.

Fixes rust-lang/rust#149821
2025-12-13 00:55:56 -05:00
Jacob Pratt
e7ba4a5e6d
Rollup merge of #149843 - aerooneqq:inherit-attributes-in-delegation, r=petrochenkov
Inherit attributes in delegation

This PR adds support for inheriting attributes of the original function of the delegation and is a part of rust-lang/rust#118212, for now we inherit only #[must_use] attribute, but we can add other attributes to inherit. The list of processed attributes can be found [here](https://github.com/aerooneqq/public-docs/blob/master/rust/delegation/processed_attributes.md).

r? ``@petrochenkov``
2025-12-13 00:55:56 -05:00
Jacob Pratt
d175f11e0e
Rollup merge of #149177 - chenyukang:yukang-fix-assoc-func-149038, r=estebank
Add proper suggestion for associated function with unknown field

Fixes rust-lang/rust#149038

The first commit is changing the old suggestion to verbose,
the second commit is a new added suggestion.

r? ``@estebank``
2025-12-13 00:55:55 -05:00
Jacob Pratt
b32845c61a
Rollup merge of #148837 - estebank:let-else, r=Kivooeo
Use `let...else` instead of `match foo { ... _ => return };` and `if let ... else return`
2025-12-13 00:55:55 -05:00
Jacob Pratt
397339e928
Rollup merge of #145278 - notJoon:doc/rotate-operation, r=antoyo
Update `rustc_codegen_gcc` rotate operation document

## Description

This PR resolves a TODO comment in the `rustc_codegen_gcc` backend by documenting that the rotate operations (`rotate_left` and `rotate_right`) already implement the optimized branchless algorithm from comment.

The existing implementation already uses the optimal branchless rotation pattern:
- For left rotation: `(x << n) | (x >> (-n & (width-1)))`
- For right rotation: `(x >> n) | (x << (-n & (width-1)))`

This pattern avoids branches and generates efficient machine code across different platforms, which was the goal mentioned in the original TODO.

## Changes

- Removed the TODO comment that suggested implementing the algorithm from https://blog.regehr.org/archives/1063
2025-12-13 00:55:54 -05:00
bors
dc47a69ed9 Auto merge of #149136 - BoxyUwU:mgca_explicit_anon_consts, r=oli-obk
MGCA: Syntactically distinguish anon const const args

r? oli-obk

tracking issue: rust-lang/rust#132980

This PR requires that when `feature(min_generic_const_args)` is enabled, anon const const args are *syntactically* distinguishable from other kinds of args. We use `const { ... }` in const argument position to denote an anon const:
```rust
#![feature(min_generic_const_args)]

// no longer allowed as `1 + 1` is represented via an anon const and
// there is no syntactic marker
type Foo = [(); 1 + 1];

// allowed, `const { ... }` indicates an anon const representation
type Foo = [(); const { 1 + 1 }];
```

This restriction is only placed when mgca is enabled. There should be no effect on stable. This restriction is not enforced for unbraced literals which we continue to implicitly wrap in an anon const: `tests/ui/const-generics/mgca/explicit_anon_consts_literals_hack.rs`

This restriction allows us to create `DefId`s for anon consts only when actually required. When it is syntactically ambiguous whether a const argument is an anon const or not we are forced to conservatively create a `DefId` for every const argument even if it doesn't wind up needing one.

This works fine on stable but under `mgca` we can wind up with anon consts nested inside non-anon-const const arguments resulting in a broken `DefId` tree. See rust-lang/rust#148838 where an anon const arg inside of a path arg winds up with a parent of a conservatively created `DefId` that doesn't actually correspond to an anon const, resulting in an ICE.

With rust-lang/rust#149114 every field initialiser in a const argument would become a place where there could *possibly* be an anon const. This would also get worse once we support tuple constructors- now every function argument is a place where there could possibly be an anon const.

We introduce this restriction to avoid creating massive amounts of unused `DefId`s that make the parent tree significantly more complicated, and to avoid having to paper over this issue in things like `generics_of`.

Fixes rust-lang/rust#148838

It also must be syntactically clear from context whether `'_` means an inference lifetime or an elided lifetime parameter. This restriction will allow us to properly resolve `'_` in const arguments in mgca. This PR doesn't actually fix handle this, but we could do so trivially after this lands.
2025-12-12 21:35:31 +00:00
bors
fa5eda19b9 Auto merge of #149917 - GuillaumeGomez:malformed-attribute-suggestions, r=JonathanBrouwer
If there are too many suggestions for malformed attribute, do not suggest them

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

This not only covers for doc attributes but for all attributes, so don't hesitate to tell me if you want it to be limited to only doc attributes (although I think it's actually a nice improvement overall).

Also, I picked 3 as the maximum number of suggestions before it becomes noise, but it's very much open to debate.

r? `@JonathanBrouwer`
2025-12-12 18:18:14 +00:00
Esteban Küber
97c7742151 revert one change from rustc_next_trait_solver 2025-12-12 17:55:26 +00:00
Esteban Küber
a49c175380 #![deny(clippy::manual_let_else)] in some rustc modules 2025-12-12 17:53:19 +00:00
Esteban Küber
146711fc24 Use let...else instead of match foo { ... _ => return }; and if let ... else return 2025-12-12 17:52:39 +00:00
aerooneqq
0a3fd24287 Support attribute inheritance in delegation 2025-12-12 20:34:54 +03:00
delta17920
0748492e2b Fix: Prevent macro-expanded extern crates from shadowing extern arguments 2025-12-12 16:22:25 +00:00
Boxy Uwu
acc3a0e2da Syntactically distinguish anon const const args 2025-12-12 15:45:37 +00:00
Guillaume Gomez
d025cdef7d If there are too many suggestions for malformed attribute, do not suggest them 2025-12-12 14:55:17 +01:00
Daria Sukhonina
c7b5fb5695 Also check in case it tries to mark red node as green 2025-12-12 16:44:17 +03:00
Jonathan Brouwer
0ab4b8b9e0
Remove the E0536 error code 2025-12-12 14:38:12 +01:00
Daria Sukhonina
02bace8476 Add a sanity check in case of any duplicate nodes 2025-12-12 16:35:48 +03:00
Jamie Cunliffe
93c3ac2868 declare_lint_pass for INLINE_ALWAYS_MISMATCHING_TARGET_FEATURES
The `INLINE_ALWAYS_MISMATCHING_TARGET_FEATURES` lint was missing from
this causing it to be an unknown lint when attempting to allow it.
2025-12-12 13:25:21 +00:00
bors
3391c01336 Auto merge of #149909 - matthiaskrgr:rollup-596c34w, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#149655 (bootstrap: add rustc-dev install target)
 - rust-lang/rust#149789 (Cleanup in the attribute parsers)
 - rust-lang/rust#149791 (Remove uses of `cfg({any()/all()})`)
 - rust-lang/rust#149792 (Suggest `cfg(false)` instead of `cfg(FALSE)`)
 - rust-lang/rust#149883 (add regression test for `proc_macro` error subdiagnostics)
 - rust-lang/rust#149884 (Clippy subtree update)
 - rust-lang/rust#149896 (Add myself(makai410) to the review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-12 13:00:47 +00:00
Zalathar
0e7dc32894 Inline BootstrapCommand::force_coloring_in_ci into its only call site
This logic is cargo-specific anyway, so there is no need for it to be a
generally-available helper method.
2025-12-12 22:41:27 +11:00
Matthias Krüger
eaf470bbc3
Rollup merge of #149896 - makai410:ping-me, r=jieyouxu
Add myself(makai410) to the review rotation

Per the https://github.com/rust-lang/team/pull/2177 .
2025-12-12 12:19:12 +01:00
Matthias Krüger
e0e575cfa9
Rollup merge of #149884 - flip1995:clippy-subtree-update, r=matthiaskrgr
Clippy subtree update

r? ``````@Manishearth``````

Cargo.lock update due to Clippy version bump.
2025-12-12 12:19:11 +01:00
Matthias Krüger
1553fcc240
Rollup merge of #149883 - cyrgani:sub-err-diag, r=Kivooeo
add regression test for `proc_macro` error subdiagnostics

The previous ICE was already fixed by rust-lang/rust#148188, but no test was added at that time.
Closes rust-lang/rust#145305.
2025-12-12 12:19:10 +01:00
Matthias Krüger
d952bac929
Rollup merge of #149792 - clubby789:cfg-FALSE, r=jdonszelmann
Suggest `cfg(false)` instead of `cfg(FALSE)`

Split from rust-lang/rust#149791

cc ```````@Urgau```````
2025-12-12 12:19:10 +01:00
Matthias Krüger
b826d06771
Rollup merge of #149791 - clubby789:cfg-bool-lints, r=jdonszelmann
Remove uses of `cfg({any()/all()})`

~~This implements the followup warning suggested in https://github.com/rust-lang/rfcs/pull/3695~~
~~Lint against an empty `cfg(any/all)`, suggest the boolean literal equivalents.~~
https://github.com/rust-lang/rust/pull/149791#issuecomment-3638624348

Tracking issue: https://github.com/rust-lang/rust/issues/131204
2025-12-12 12:19:09 +01:00
Matthias Krüger
c511c6088e
Rollup merge of #149789 - JonathanBrouwer:remove-lifetime-param, r=jdonszelmann
Cleanup in the attribute parsers

* Removes a bunch of unused lifetimes in the attribute parsers
* Creates two variants of `PathParser`, because we statically know which variant we're in

r? ```````@jdonszelmann```````
2025-12-12 12:19:08 +01:00
Matthias Krüger
675af3cf52
Rollup merge of #149655 - Nadrieril:install-rustc-dev, r=Kobzol
bootstrap: add rustc-dev install target

I'm entirely new to bootstrap but there seemed to be no easy way to construct a sysroot with tools and librustc_driver.so. `./x install` is the command for that but as far as I can tell it doesn't include the rustc-dev files. This is my attempt at adding that.

`./x install rustc-dev` now does what you expect (at least on my machine™). If I'm understanding correctly this also means that `./x install` will now include rustc-dev files if `build.tools` contains `"rustc-dev"`.
2025-12-12 12:19:04 +01:00
Zalathar
3f63f521c1 Don't pass an unused --color to compiletest
This flag was an artifact of compiletest's old libtest-based test executor, and
currently doesn't influence compiletest's output at all.
2025-12-12 22:10:52 +11:00
bors
2a3a62d26e Auto merge of #148477 - lqd:crater-wfcheck, r=lcnr,BoxyUwU
don't normalize where-clauses when checking well-formedness

WfCheck checks where-clauses after normalization, and we'd like to see what would break if it didn't for https://github.com/rust-lang/trait-system-refactor-initiative/issues/255

r? ghost
2025-12-12 09:45:27 +00:00
Jonathan Brouwer
acea7df0b4
Remove last remaining usages of UnsupportedLiteral 2025-12-12 09:24:49 +01:00
Jonathan Brouwer
04fedf7173
Remove unused code in cfg_old 2025-12-12 09:12:31 +01:00
Jonathan Brouwer
aa6db80ab2
Remove lifetime param from parser functions 2025-12-12 09:02:54 +01:00
Jonathan Brouwer
86a97c41cb
Remove lifetime param from parser types 2025-12-12 08:58:16 +01:00
Jonathan Brouwer
97252d3747
Remove from MetaItemParser::from_attr 2025-12-12 08:58:10 +01:00
Urgau
cefcd99c17 Fix normalization logic of the rustdoc extract doctests tests on Windows 2025-12-12 07:34:52 +01:00
Urgau
0afd21d646 Add ignore-cross-compile to remap-path-prefix-consts run-make test 2025-12-12 07:34:52 +01:00
Urgau
0be1a9b59a Somewhat retire Options::working_dir in favor SourceMap::working_dir
We can't completely remove it as it's needed for incr comp but direct
consumers towards `SourceMap::working_dir` instead.
2025-12-12 07:34:52 +01:00
Urgau
8b035e473a Add regression test for Location::caller() in consts across crates 2025-12-12 07:34:52 +01:00