Commit graph

310054 commits

Author SHA1 Message Date
Guillaume Gomez
66b4e93ba8 Add instructions on what to do in case casts other than to integers is ever working for function pointers 2025-11-10 20:44:33 +01:00
Guillaume Gomez
d05f297164 Add more test for function_cast_as_integer lint 2025-11-10 16:38:28 +01:00
Guillaume Gomez
f22600e9a0 Fix typos 2025-11-10 16:38:28 +01:00
Guillaume Gomez
0a2c473ae7 Convert function_cast_as_integer lint suggestion to plain *const () cast 2025-11-10 16:38:28 +01:00
Guillaume Gomez
a99d100ce8 Allow function_casts_as_integer in miri source code 2025-11-10 16:38:28 +01:00
Guillaume Gomez
6e14beae2a Allow function_casts_as_integer in coretest test 2025-11-10 16:38:28 +01:00
Guillaume Gomez
065d41ed76 Allow function_casts_as_integer in non-related miri tests 2025-11-10 16:38:28 +01:00
Guillaume Gomez
37eb9069c0 Allow function_casts_as_integer in non-related clippy ui tests 2025-11-10 16:38:28 +01:00
Guillaume Gomez
2ac32ae7a0 Add ui test for function_casts_as_integer lint 2025-11-10 16:38:28 +01:00
Guillaume Gomez
725f4ad24b Allow function_casts_as_integer in non-related ui tests 2025-11-10 16:38:28 +01:00
Guillaume Gomez
40be1db6b8 Fix new function_casts_as_integer lint errors in core, std, panic_unwind and compiler crates 2025-11-10 16:38:28 +01:00
Guillaume Gomez
a23b8c48a5 Add new function_casts_as_integer lint 2025-11-10 16:38:27 +01:00
bors
a7b3715826 Auto merge of #148564 - Kobzol:rename-master-to-main, r=marcoieni
Change default branch references

As per https://blog.rust-lang.org/inside-rust/2025/10/16/renaming-the-default-branch-of-rust-lang-rust/.

Please do not approve this, we will merge it with Marco on Monday November 10.

r? `@marcoieni`
2025-11-10 09:24:04 +00:00
Jakub Beránek
bc0126d451
Change default branch to main 2025-11-10 10:21:34 +01:00
bors
00426d642a Auto merge of #148685 - Zalathar:lldb-python, r=jieyouxu
compiletest: Run the `lldb_batchmode.py` script in LLDB's embedded Python

Historically, LLDB debuginfo tests have used a Python script to control LLDB via its Python API, instead of invoking the `lldb` command directly.

Unfortunately, this requires us to find and use a version of Python that is compatible with LLDB's Python bindings.

However, it turns out that there is a simpler way to find a compatible Python interpreter: use the one that is embedded in LLDB itself, via the `script` command.
2025-11-10 05:45:10 +00:00
bors
5f666a6ec9 Auto merge of #148679 - dianqk:update-llvm, r=cuviper
Update LLVM to 21.1.5

Includes some fixes for BPF.
2025-11-10 02:29:57 +00:00
bors
8401398e1f Auto merge of #148762 - matthiaskrgr:rollup-4oifvkr, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#148248 (Constify `ControlFlow` methods without unstable bounds)
 - rust-lang/rust#148285 (Constify `ControlFlow` methods with unstable bounds)
 - rust-lang/rust#148510 (compiletest: Do the known-directives check only once, and improve its error message)
 - rust-lang/rust#148655 (Fix invalid macro tag generation for keywords which can be followed by values)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-09 23:15:34 +00:00
Matthias Krüger
5430082e39
Rollup merge of #148655 - GuillaumeGomez:keyword-as-macros, r=yotamofek,fmease
Fix invalid macro tag generation for keywords which can be followed by values

Fixes https://github.com/rust-lang/rust/issues/148617.

The problem didn't come from the `generate-macro-expansion` feature but was actually uncovered thanks to it.

Keywords like `if` or `return`, when followed by a `!` were considered as macros, which was wrong and let to invalid class stack and to the panic.

~~While working on it, I realized that `_` was considered as a keyword, so I fixed that as well in the second commit.~~ (reverted, see https://github.com/rust-lang/rust/pull/148655#issuecomment-3508220823, https://github.com/rust-lang/rust/pull/148655#issuecomment-3508262637)

r? `@yotamofek`
2025-11-09 20:59:54 +01:00
Matthias Krüger
192bb9cc43
Rollup merge of #148510 - Zalathar:known-directives, r=jieyouxu
compiletest: Do the known-directives check only once, and improve its error message

This PR is a combination of three changes:
- Store the list of known directives in a set, so that checking a directive name doesn't require a linear scan
- Extract the known-directives check out of `iter_directives` and do it only once, instead of multiple times per file
- Improve the error message for unknown directives, [as requested on Zulip](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Compiletest.20directive.20parsing.20error/with/553598083)

The change to error messages is fused with the extraction, since doing it independently would have been more awkward.

---

## Before

```text
Testing stage1 with compiletest suite=coverage mode=coverage-map (aarch64-apple-darwin)
errors encountered during EarlyProps parsing: /Users/stuart/Dev/rust/rust/tests/coverage/trivial.rs
2025-11-05T01:55:46.440012Z ERROR compiletest::directives: /Users/stuart/Dev/rust/rust/tests/coverage/trivial.rs:2: detected unknown compiletest test directive `add-core-stubs`

thread '<unnamed>' (36268582) panicked at src/tools/compiletest/src/directives.rs:72:13:
errors encountered during EarlyProps parsing
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

## After

```text
Testing stage1 with compiletest suite=coverage mode=coverage-map (aarch64-apple-darwin)

thread '<unnamed>' (36270772) panicked at src/tools/compiletest/src/lib.rs:876:9:
directives check failed:
ERROR: unknown compiletest directive `add-core-stubs` at /Users/stuart/Dev/rust/rust/tests/coverage/trivial.rs:2
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
2025-11-09 20:59:53 +01:00
Matthias Krüger
5591d7e134
Rollup merge of #148285 - nxsaken:const_control_flow_1, r=Mark-Simulacrum
Constify `ControlFlow` methods with unstable bounds

Feature: `const_control_flow`
Tracking issue: rust-lang/rust#148739

This PR constifies the methods on `ControlFlow` with a dependency on rust-lang/rust#143874.
2025-11-09 20:59:53 +01:00
Matthias Krüger
5598d535da
Rollup merge of #148248 - nxsaken:const_control_flow, r=Mark-Simulacrum
Constify `ControlFlow` methods without unstable bounds

Feature: `min_const_control_flow`
Tracking issue: rust-lang/rust#148738

This PR constifies some of the methods on `ControlFlow`.
2025-11-09 20:59:52 +01:00
bors
6647be9364 Auto merge of #148435 - ZhongyaoChen:promote-riscv64a23-to-tier2, r=jieyouxu
Implement the MCP 932: Promote riscv64a23-unknown-linux-gnu to Tier 2

Implement the [MCP 932](https://github.com/rust-lang/compiler-team/issues/932): Promote riscv64a23-unknown-linux-gnu to Tier 2 without host tools.

Closes rust-lang/rust#148353.

Changes:
- Update target tier from 3 to 2 in target specification
- Update platform documentation
- Add CI/CD support for automatic building and distribution via rustup

r? jieyouxu
cc `@davidtwco` `@Noratrieb`
2025-11-09 19:57:56 +00:00
Guillaume Gomez
2c4a593b5c Add regression tests for keywords wrongly considered as macros 2025-11-09 18:00:52 +01:00
Guillaume Gomez
d1dda8d25e Fix invalid macro tag generation for keywords which can be followed by values 2025-11-09 18:00:52 +01:00
bors
86b95ebc24 Auto merge of #148753 - matthiaskrgr:rollup-48jzbqw, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#148683 (Remove `#[const_trait]`)
 - rust-lang/rust#148687 (std: use a non-poisoning `RwLock` for the panic hook)
 - rust-lang/rust#148709 (fix: disable self-contained linker when bootstrap-override-lld is set)
 - rust-lang/rust#148716 (mgca: Finish implementation of `#[type_const]`)
 - rust-lang/rust#148722 (Add Crystal Durham to .mailmap)
 - rust-lang/rust#148723 (bootstrap: Render doctest timing reports as text, not JSON)
 - rust-lang/rust#148724 (tidy: Don't bypass stderr output capture in unit tests)
 - rust-lang/rust#148734 (miri subtree update)
 - rust-lang/rust#148736 (Fix typo in unstable-book link)
 - rust-lang/rust#148744 (Add myself(chenyukang) to the review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-09 16:44:31 +00:00
Matthias Krüger
a2c4f03ea7
Rollup merge of #148744 - chenyukang:yukang-add-to-rotation, r=jieyouxu
Add myself(chenyukang) to the review rotation

hope I have more time to catch up 💙
2025-11-09 17:37:10 +01:00
Matthias Krüger
afa0e7521e
Rollup merge of #148736 - luca3s:fix-typo, r=Zalathar
Fix typo in unstable-book link

This prevented the links from being rendered. Sorry for not noticing this before my changes were merged yesterday.

Introduced in https://github.com/rust-lang/rust/pull/147935
cc ``@petrochenkov``
2025-11-09 17:37:10 +01:00
Matthias Krüger
2fffcf0acf
Rollup merge of #148734 - RalfJung:miri, r=RalfJung
miri subtree update

Subtree update of `miri` to 7d5ae365eb.

Created using https://github.com/rust-lang/josh-sync.

r? ``@ghost``
2025-11-09 17:37:09 +01:00
Matthias Krüger
f94ad14676
Rollup merge of #148724 - Zalathar:tidyselftest, r=jieyouxu
tidy: Don't bypass stderr output capture in unit tests

In unit tests, writes to stderr that don't use `eprint!` or `eprintln!` will not be captured, and instead interfere with test harness output, making it unreadable.

<details>
<summary><b>Detailed before/after</b></summary>

## Before
```text
$ x test tidyselftest --no-doc
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.03s
Testing stage1 tidy (aarch64-apple-darwin)
   Compiling tidy v0.1.0 (/Users/stuart/Dev/rust/rust/src/tools/tidy)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.23s
     Running unittests src/lib.rs (build/aarch64-apple-darwin/bootstrap-tools/aarch64-apple-darwin/release/deps/tidy-c33a0cc08cf46c66)

running 20 tests
tidy [alphabetical-test]: bad:3 found `tidy-alphabetical-start` expecting `tidy-alphabetical-end`
tidy [alphabetical-test]: FAIL
tidy [alphabetical-test]: bad: reached end of file expecting `tidy-alphabetical-end`tidy [alphabetical-test]: bad:4: line not in alphabetical order
tidy [alphabetical-test]: bad:5 found `tidy-alphabetical-end` expecting `tidy-alphabetical-start`
tidy [alphabetical-test]: FAIL
tidy [alphabetical-test]: FAIL
tidy [alphabetical-test].: tidy [alphabetical-test...bad:4: line not in alphabetical order..]: tidy [alphabetical-test]: ..
bad:7: line not in alphabetical order
tidy [tidy [bad:2 found `tidy-alphabetical-end` expecting `tidy-alphabetical-start`
alphabetical-testtidy [tidy [alphabetical-test]: bad:4: line not in alphabetical order

.tidy [alphabetical-test]..]alphabetical-testtidy []: bad:4: line not in alphabetical orderalphabetical-testalphabetical-test]: tidy [FAILalphabetical-test
]: FAIL
]: FAIL
: FAIL
: bad:4: line not in alphabetical order

tidy [alphabetical-test]: FAIL
tidy [.alphabetical-test]: FAIL
.tidy [alphabetical-test]: FAIL
..tidy [alphabetical-test]: bad:3: line not in alphabetical order
tidy [alphabetical-test]: FAIL
tidy [alphabetical-test]: bad:3: line not in alphabetical order
tidy [alphabetical-test]: FAIL
.....

test result: ok. 20 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.01ms

     Running unittests src/main.rs (build/aarch64-apple-darwin/bootstrap-tools/aarch64-apple-darwin/release/deps/rust_tidy-25232a69af4dd751)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 26.88µs

	finished in 0.255 seconds
Build completed successfully in 0:00:00
```

## After
```text
$ x test tidyselftest --no-doc
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.03s
Testing stage1 tidy (aarch64-apple-darwin)
   Compiling tidy v0.1.0 (/Users/stuart/Dev/rust/rust/src/tools/tidy)
    Finished `release` profile [optimized + debuginfo] target(s) in 1.74s
     Running unittests src/lib.rs (build/aarch64-apple-darwin/bootstrap-tools/aarch64-apple-darwin/release/deps/tidy-c33a0cc08cf46c66)

running 20 tests
....................

test result: ok. 20 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.35ms

     Running unittests src/main.rs (build/aarch64-apple-darwin/bootstrap-tools/aarch64-apple-darwin/release/deps/rust_tidy-25232a69af4dd751)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 27.17µs

	finished in 1.764 seconds
Build completed successfully in 0:00:02
```

</details>
2025-11-09 17:37:08 +01:00
Matthias Krüger
d08475a037
Rollup merge of #148723 - Zalathar:bootstrap-doctest, r=jieyouxu
bootstrap: Render doctest timing reports as text, not JSON

These doctest timing reports were added to libtest/rustdoc in https://github.com/rust-lang/rust/pull/144909, but bootstrap's custom test-output renderer wasn't taught about them, so they were being printed as raw JSON instead.

Before:
```text
{ "type": "report", "total_time": 0.738403958, "compilation_time": 0.731513292 }
```

After:
```text
all doctests ran in 0.73s; merged doctests compilation took 0.72s
```

<details>
<summary><b>Detailed before/after in context</b></summary>

## Before

```text
$ x test rustc_mir_transform --doc
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.03s
Testing stage1 {rustc_mir_transform} (aarch64-apple-darwin)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.12s
   Doc-tests rustc_mir_transform

running 19 tests
iiiiiiiiiiii.......

test result: ok. 7 passed; 0 failed; 12 ignored; 0 measured; 0 filtered out; finished in 3.28ms

running 7 tests
iiiiiii

test result: ok. 0 passed; 0 failed; 7 ignored; 0 measured; 0 filtered out; finished in 403.67µs

{ "type": "report", "total_time": 0.738403958, "compilation_time": 0.731513292 }
	finished in 1.505 seconds
Build completed successfully in 0:00:01
```

## After

```text
$ x test rustc_mir_transform --doc
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.03s
Testing stage1 {rustc_mir_transform} (aarch64-apple-darwin)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.12s
   Doc-tests rustc_mir_transform

running 19 tests
iiiiiiiiiiii.......

test result: ok. 7 passed; 0 failed; 12 ignored; 0 measured; 0 filtered out; finished in 3.12ms

running 7 tests
iiiiiii

test result: ok. 0 passed; 0 failed; 7 ignored; 0 measured; 0 filtered out; finished in 395.67µs

all doctests ran in 0.73s; merged doctests compilation took 0.72s
	finished in 1.493 seconds
Build completed successfully in 0:00:01
```

</details>
2025-11-09 17:37:08 +01:00
Matthias Krüger
fb571c96d0
Rollup merge of #148722 - CAD97:git-dislikes-my-emoji, r=Mark-Simulacrum
Add Crystal Durham to .mailmap

🏳️‍⚧️

- https://github.com/CAD97/blog/discussions/3
2025-11-09 17:37:07 +01:00
Matthias Krüger
7e9b67d355
Rollup merge of #148716 - camelid:finish-type_const, r=BoxyUwU
mgca: Finish implementation of `#[type_const]`

tracking issue: rust-lang/rust#132980
fixes rust-lang/rust#140729
fixes rust-lang/rust#140860

- **Fix `#[type_const]` attribute placement validation**
- **Perform WF-checking on type_const RHS's**
- **Check type_const type is ConstParamTy_ and that RHS matches it**
- **Check that impls of `#[type_const]` consts also have the attr**

r? ```@BoxyUwU```
2025-11-09 17:37:07 +01:00
Matthias Krüger
7df5f5ca29
Rollup merge of #148709 - karolzwolak:bootstrap-override-lld-should-disable-self-contained-lld, r=Mark-Simulacrum
fix: disable self-contained linker when bootstrap-override-lld is set

Part of rust-lang/rust#148708.

Makes `rust.bootstrap-override-lld` set to `true` or `"external"` disable self-contained linker — actually using linker from one's system.
2025-11-09 17:37:06 +01:00
Matthias Krüger
243d494350
Rollup merge of #148687 - joboet:nonpoison-hook-rwlock, r=ChrisDenton
std: use a non-poisoning `RwLock` for the panic hook

The code ignored poison errors using `PoisonError` anyway.
2025-11-09 17:37:05 +01:00
Matthias Krüger
e5a69bb215
Rollup merge of #148683 - fmease:rm-const_trait-attr, r=fee1-dead
Remove `#[const_trait]`

Remove `#[const_trait]` since we now have `const trait`. Update all structured diagnostics that still suggested the attribute.

r? ```@rust-lang/project-const-traits```
2025-11-09 17:37:05 +01:00
yukang
479df91c0c Add myself(chenyukang) to the review rotation 2025-11-09 20:46:03 +08:00
bors
ab67c37c6d Auto merge of #148660 - fmease:cross-crate-cfg, r=GuillaumeGomez
Encode cfg trace, not its early counterpart to fix cross-crate `doc(auto_cfg)`

Fixes rust-lang/rust#141301.

<details><summary>Rambling about <code>target_feature</code> which I didn't touch here</summary>

Regarding https://github.com/rust-lang/rust/issues/141301#issuecomment-3390100259 (`#[target_feature(enable = …)]` on inlined cross-crate re-exports), it has the same underlying cause (namely, we neither encode `target_feature` nor `AttributeKind::TargetFeature` in the crate metadata). However, I didn't make that change because I first want to experiment with querying `TyCtxt::codegen_fn_attrs` in rustdoc instead which already works cross-crate (and also use to it for reconstructing `no_mangle`, `export_name`, `link_section` to avoid encoding these attributes unnecessarily (basically reverting rust-lang/rust#144050) as suggested in https://github.com/rust-lang/rust/issues/144004#issuecomment-3077725837).

</details>

r? GuillaumeGomez
2025-11-09 11:44:27 +00:00
nxsaken
d05133f3a4 Update feature name, add tracking issue number 2025-11-09 13:36:35 +04:00
nxsaken
3175799208 Add tracking issue number 2025-11-09 13:33:47 +04:00
nxsaken
852bd86d17 Constify ControlFlow methods (unstable bounds) 2025-11-09 13:30:59 +04:00
Lucas Baumann
1496ffa12b Fix typo in unstable-book link.
This prevented the links from being rendered. Sorry for not
noticing this before my changes were merged yesterday.
2025-11-09 09:53:09 +01:00
bors
20f1c045c4 Auto merge of #148721 - Zalathar:rollup-398va3y, r=Zalathar
Rollup of 22 pull requests

Successful merges:

 - rust-lang/rust#128666 (Add `overflow_checks` intrinsic)
 - rust-lang/rust#146305 (Add correct suggestion for multi-references for self type in method)
 - rust-lang/rust#147179 ([DebugInfo] Fix container types failing to find template args)
 - rust-lang/rust#147743 (Show packed field alignment in mir_transform_unaligned_packed_ref)
 - rust-lang/rust#148079 (Rename `downcast_[ref|mut]_unchecked` -> `downcast_unchecked_[ref|mut]`)
 - rust-lang/rust#148084 (Optimize path components iteration on platforms that don't have prefixes)
 - rust-lang/rust#148126 (Fix rust stdlib build failing for VxWorks)
 - rust-lang/rust#148204 (Modify contributor email entries in .mailmap)
 - rust-lang/rust#148279 (rustc_builtin_macros: rename bench parameter to avoid collisions with user-defined function names)
 - rust-lang/rust#148333 (constify result unwrap unchecked)
 - rust-lang/rust#148539 (Add Allocator proxy impls for Box, Rc, and Arc)
 - rust-lang/rust#148601 (`invalid_atomic_ordering`: also lint `update` & `try_update`)
 - rust-lang/rust#148612 (Add note for identifier with attempted hygiene violation)
 - rust-lang/rust#148613 (Switch hexagon targets to rust-lld)
 - rust-lang/rust#148619 (Enable std locking functions on AIX)
 - rust-lang/rust#148644 ([bootstrap] Make `--open` option work with `doc src/tools/error_index_generator`)
 - rust-lang/rust#148649 (don't completely reset `HeadUsages`)
 - rust-lang/rust#148673 (Remove a remnant of `dyn*` from the parser)
 - rust-lang/rust#148675 (Remove eslint-js from npm dependencies)
 - rust-lang/rust#148680 (Recover `[T: N]` as `[T; N]`)
 - rust-lang/rust#148688 (Remove unused argument `features` from `eval_config_entry`)
 - rust-lang/rust#148711 (Use the current lint note id when parsing `cfg!()`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-09 08:27:35 +00:00
Noah Lev
db2fbdb714 Check that impls of #[type_const] consts also have the attr 2025-11-08 23:05:08 -05:00
Noah Lev
9ba89327df Check type_const type is ConstParamTy_ and that RHS matches it 2025-11-08 23:05:08 -05:00
Noah Lev
c0939d4ec0 Perform WF-checking on type_const RHS's 2025-11-08 23:05:08 -05:00
Noah Lev
e56de95478 Fix #[type_const] attribute placement validation 2025-11-08 23:05:08 -05:00
Zalathar
38ae4496e7 tidy: Don't bypass stderr output capture in unit tests
In unit tests, writes to stderr that don't use `eprint!` or `eprintln!` will
not be captured, and instead interfere with test harness output, making it
unreadable.
2025-11-09 14:42:13 +11:00
Zalathar
610391fff9 bootstrap: Render doctest timing reports as text, not JSON 2025-11-09 14:29:09 +11:00
Crystal Durham
3fdde5f526 Add Crystal Durham to .mailmap
🏳️‍⚧️
2025-11-08 22:13:10 -05:00
Stuart Cook
4cf1d39fc2
Rollup merge of #148711 - JonathanBrouwer:cfg_macro_lint_node_id, r=Kivooeo
Use the current lint note id when parsing `cfg!()`
2025-11-09 13:22:36 +11:00