Commit graph

310022 commits

Author SHA1 Message Date
Frank King
5ef48ed448 Implement &pin patterns and ref pin bindings 2025-11-10 09:57:08 +08: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
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
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
Stuart Cook
74e90d8804
Rollup merge of #148688 - JonathanBrouwer:remove_features, r=jdonszelmann
Remove unused argument `features` from `eval_config_entry`
2025-11-09 13:22:35 +11:00
Stuart Cook
784e91df60
Rollup merge of #148680 - ShE3py:array-colon, r=JonathanBrouwer
Recover `[T: N]` as `[T; N]`

`;` is similar and (keyboard-wise) next to `:`, so a verbose suggestion may help to see the difference.

Parent PR: rust-lang/rust#143905

---
`@rustbot` label +A-parser +A-array +A-diagnostics +A-suggestion-diagnostics +D-papercut
2025-11-09 13:22:34 +11:00
Stuart Cook
9fe2f4ccb6
Rollup merge of #148675 - Kobzol:eslint-js, r=yotamofek
Remove eslint-js from npm dependencies

Testing if this unblocks CI.

r? ```@ghost```
2025-11-09 13:22:34 +11:00
Stuart Cook
2fe69a9d7e
Rollup merge of #148673 - fmease:del-dyn_star-remnant, r=JonathanBrouwer
Remove a remnant of `dyn*` from the parser

Follow-up to https://github.com/rust-lang/rust/pull/146664 and https://github.com/rust-lang/rust/pull/143036.

`is_explicit_dyn_type` still checked for `TokenKind::Star` which made no sense now that `dyn*` is no more.

Removing it doesn't represent a functional change and merely affects diagnostics. That's because the check only dictated whether to interpret `dyn` as the start of a trait object type in Rust 2015 (where this identifier is only a *contextual* keyword). However, we would still fail at the `*` later on as it doesn't start a bound.

While at it, I also took the time to clean up in the vicinity.
2025-11-09 13:22:33 +11:00
Stuart Cook
ec4e6e6559
Rollup merge of #148649 - lcnr:rarwwww, r=BoxyUwU
don't completely reset `HeadUsages`

This is really subtle ☠️ I've actually went and added testing for `search_graph.ignore_candidate_head_usages` to https://github.com/lcnr/search_graph_fuzz now. I should have done that when I originally implemented but didn't quite know how to do so back then.

The search graph is far too subtle to think through it manually. I've added the affected proof tree to https://github.com/rust-lang/trait-system-refactor-initiative/blob/main/notes/next-solver/search-graph/general.md#keeping-provisional-cache-entries-on-rerun. It's

- A
  - B
    - C (depends on B and gets dropped when rerunning)
      - D (does not depend on B so we keep it around when rerunning)
        - C (irrevant candidate)
        - A
      - B
    - D
      - C (irrevant candidate)
        - D
      - A
    - rerun
    - C (use provisional cache entry which doesn't depend on B)
    - D (use provisional cache entry which doesn't depend on B)

Fixes the ICE in https://github.com/rust-lang/trait-system-refactor-initiative/issues/246#issuecomment-3497832902. I think this issue is brittle enough that adding that as a test isn't really useful. Any small change to the search graph will prevent it from testing this. We do test this fix via the fuzzer.

r? `````@BoxyUwU`````
2025-11-09 13:22:33 +11:00
Stuart Cook
6ced155254
Rollup merge of #148644 - GuillaumeGomez:error-index-index-open, r=Kobzol
[bootstrap] Make `--open` option work with `doc src/tools/error_index_generator`

Fixes rust-lang/rust#148557.
2025-11-09 13:22:32 +11:00
Stuart Cook
9663de008a
Rollup merge of #148619 - amy-kwan:amyk/AddLockingFunctions_AIX, r=workingjubilee
Enable std locking functions on AIX

This patch enables the std locking functions on AIX by including AIX on the list of supported targets for the locking functions. Excluding AIX from the std locking functions results to compilation errors such as: ("try_lock() not supported").
2025-11-09 13:22:32 +11:00
Stuart Cook
2fe368d2d1
Rollup merge of #148613 - androm3da:bcain/hex_lld, r=JonathanBrouwer,Noratrieb
Switch hexagon targets to rust-lld

lld is a great choice for a default linker.
2025-11-09 13:22:31 +11:00
Stuart Cook
99af1bc1b9
Rollup merge of #148612 - chenyukang:yukang-fix-148580-macro-hygiene-diagnostic, r=JonathanBrouwer
Add note for identifier with attempted hygiene violation

Fixes rust-lang/rust#148580

I changed the original test to make sure we are pointing to the right scope.
2025-11-09 13:22:31 +11:00
Stuart Cook
b0c4434a7f
Rollup merge of #148601 - GrigorenkoPV:invalid_atomic_ordering, r=Kivooeo
`invalid_atomic_ordering`: also lint `update` & `try_update`

Split from rust-lang/rust#148590

Tracking issue for `update` and `try_update`: rust-lang/rust#135894
2025-11-09 13:22:30 +11:00
Stuart Cook
ebb1777398
Rollup merge of #148539 - cramertj:alloc-arc, r=Amanieu
Add Allocator proxy impls for Box, Rc, and Arc

This adds to the existing proxy impl for &T.

Fixes https://github.com/rust-lang/wg-allocators/issues/54
2025-11-09 13:22:29 +11:00
Stuart Cook
020dd317db
Rollup merge of #148333 - bend-n:const_result_unwrap_unchecked, r=mark-simulacrum
constify result unwrap unchecked

constifies unwrap unchecked on result
will make tracking issue if good
2025-11-09 13:22:29 +11:00
Stuart Cook
645aa9232b
Rollup merge of #148279 - IntegralPilot:master, r=hkBst
rustc_builtin_macros: rename bench parameter to avoid collisions with user-defined function names

Resolves rust-lang/rust#148275 by preventing name collisions in the `#[bench]` macro.

Previously, a user-defined function named "b" could not be benchmarked because
the macro-generated lambda identity collided with the same name. We now generate
the lambda ident as `__bench_<function_name>`, ensuring it is always distinct
from the user’s function.

Because the prefix is applied recursively (e.g. benchmarking `__bench_b`
produces a lambda ident `__bench___bench_b`), there is no possible function
name that can equal its corresponding lambda ident. This guarantees that
the user can safely bench a function of any valid name without risk of
identifier collision.
2025-11-09 13:22:28 +11:00
Stuart Cook
e3ced35c94
Rollup merge of #148204 - hkBst:patch-5, r=nnethercote
Modify contributor email entries in .mailmap

This adds mailmap entries for duplicates I found in https://thanks.rust-lang.org/rust/all-time/

If I added an entry for you and it is not correct, then please let me know! See the comments at the start of https://github.com/rust-lang/thanks/blob/master/mailmap/src/lib.rs for understanding these entries.

After this gets into the repo, the thanks page will be regenerated within a day, and your double entries will be merged.

cc ````````@aochagavia````````
cc ````````@fasterthanlime````````
cc ````````@jackh726````````
cc ````````@jakubadamw````````
cc ````````@yaahc````````
cc ````````@jackpot51````````
cc ````````@jonhoo````````
cc ````````@marcoieni````````
cc ````````@onur-ozkan````````
cc ````````@rylev````````
cc ````````@willcrichton````````
cc ````````@yoshuawuyts````````
2025-11-09 13:22:27 +11:00
Stuart Cook
5226e15770
Rollup merge of #148126 - hax0kartik:vx-fix-148125, r=Mark-Simulacrum
Fix rust stdlib build failing for VxWorks

Fixes rust-lang/rust#148125.

O_NOFOLLOW is not supported on VxWorks. All the other defines/functions have been added to libc(0cd5032671)
2025-11-09 13:22:27 +11:00
Stuart Cook
1ad9e955a8
Rollup merge of #148084 - the8472:prefixless-path-components-iter, r=Mark-Simulacrum
Optimize path components iteration on platforms that don't have prefixes

```
OLD

path::bench_path_components_iter 140.20ns/iter +/- 6.08
path::bench_path_file_name 57.62ns/iter +/- 1.62

NEW

path::bench_path_components_iter 126.74ns/iter +/- 1.46
path::bench_path_file_name 47.48ns/iter +/- 2.49
```
2025-11-09 13:22:26 +11:00
Stuart Cook
f424eb908e
Rollup merge of #148079 - taj-p:master, r=Mark-Simulacrum
Rename `downcast_[ref|mut]_unchecked` -> `downcast_unchecked_[ref|mut]`

## Intent

Renames `downcast_[ref|mut]_unchecked` to `downcast_unchecked_[ref|mut]` because we want to emphasise that it is the downcast that is unsafe, not the aliasing per:

https://github.com/rust-lang/rust/issues/90850#issuecomment-2749035832

## Tracking Issue: https://github.com/rust-lang/rust/issues/90850#issuecomment-3437027607

cc `@marc0246`
2025-11-09 13:22:26 +11:00
Stuart Cook
068e784890
Rollup merge of #147743 - 21aslade:packed-diagnostic, r=RalfJung
Show packed field alignment in mir_transform_unaligned_packed_ref

Fixes rust-lang/rust#147528

I left the expected padding for the field out of the error message so the message would be the same on all platforms. It also isn't always possible to know the expected alignment, so this makes the message simpler.
2025-11-09 13:22:25 +11:00
Stuart Cook
2f575f3812
Rollup merge of #147179 - Walnut356:template_lookup, r=Mark-Simulacrum
[DebugInfo] Fix container types failing to find template args

This is a less pervasive (but also less powerful) alternative to https://github.com/rust-lang/rust/pull/144394.

This change *only* provides benefits to container types on MSVC. The TL;DR is that nodes that don't populate/aren't discoverable in the PDB for various reasons are given an alternate lookup path that generates the nodes by acquiring the base-type via some gross string manipulation and then asking clang for the node it wants (e.g. `"ref$<i32>"` -> `"i32"` -> `target.FindFirstType("i32").GetPointerType()` -> `i32 *`, which is a valid type for the container to use)

The before/afters are the same as in the above PR's `*-msvc` LLDB screenshots. This works as a stopgap while the above PR is evaluated, but I think that PR is still a much better solution.
2025-11-09 13:22:24 +11:00
Stuart Cook
0a7401148e
Rollup merge of #146305 - Kivooeo:a-lot-of-references-in-self, r=JonathanBrouwer
Add correct suggestion for multi-references for self type in method

Currently the suggestion for this code

```rust
fn main() {}

struct A {
    field: i32,
}

impl A {
    fn f(&&self) {}
}
```

looks like this, which is incorrect and missleading

```rust
   Compiling playground v0.0.1 (/playground)
error: expected one of `!`, `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `)`
 --> src/main.rs:8:16
  |
8 |     fn f(&&self) {}
  |                ^ expected one of 9 possible tokens
  |
  = note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
help: explicitly ignore the parameter name
  |
8 |     fn f(_: &&self) {}
  |          ++
```

So this fixes it and make more correct suggestions

```rust
error: expected one of `!`, `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `)`
 --> /home/gh-Kivooeo/test_/src/main.rs:8:16
  |
8 |     fn f(&&self) {}
  |                ^ expected one of 9 possible tokens
  |
help: `self` should be `self`, `&self` or `&mut self`, please remove extra references
  |
8 -     fn f(&&self) {}
8 +     fn f(&self) {}
```

Implementation is pretty self-documenting, but if you have suggestions on how to improve this (according to current test, which may be not fully covering all cases, this is works very well) or have some funny edge cases to show, I would appreciate it

r? compiler
2025-11-09 13:22:23 +11:00
Stuart Cook
d3475140ee
Rollup merge of #128666 - pitaj:intrinsic-overflow_checks, r=BoxyUwU
Add `overflow_checks` intrinsic

This adds an intrinsic which allows code in a pre-built library to inherit the overflow checks option from a crate depending on it. This enables code in the standard library to explicitly change behavior based on whether `overflow_checks` are enabled, regardless of the setting used when standard library was compiled.

This is very similar to the `ub_checks` intrinsic, and refactors the two to use a common mechanism.

The primary use case for this is to allow the new `RangeFrom` iterator to yield the maximum element before overflowing, as requested [here](https://github.com/rust-lang/rust/issues/125687#issuecomment-2151118208). This PR includes a working `IterRangeFrom` implementation based on this new intrinsic that exhibits the desired behavior.

[Prior discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Ability.20to.20select.20code.20based.20on.20.60overflow_checks.60.3F)
2025-11-09 13:22:23 +11:00
bors
acda5e9f9a Auto merge of #148692 - matthiaskrgr:rollup-hryk71f, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#145656 (Stabilize s390x `vector` target feature and `is_s390x_feature_detected!` macro)
 - rust-lang/rust#147024 (std_detect: Support run-time detection on OpenBSD using elf_aux_info)
 - rust-lang/rust#147534 (Implement SIMD funnel shifts in const-eval/Miri)
 - rust-lang/rust#147540 (Stabilise `as_array` in `[_]` and `*const [_]`; stabilise `as_mut_array` in `[_]` and `*mut [_]`.)
 - rust-lang/rust#147686 (update isolate_highest_one for NonZero<T>)
 - rust-lang/rust#148230 (rustdoc: Properly highlight shebang, frontmatter & weak keywords in source code pages and code blocks)
 - rust-lang/rust#148555 (Fix rust-by-example spanish translation)
 - rust-lang/rust#148556 (Fix suggestion for returning async closures)
 - rust-lang/rust#148585 ([rustdoc] Replace `print` methods with functions to improve code readability)
 - rust-lang/rust#148600 (re-use `self.get_all_attrs` result for pass indirectly attribute)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-09 01:40:19 +00:00
bors
72b21e1a64 Auto merge of #139558 - camelid:mgca-const-items, r=oli-obk,BoxyUwU
mgca: Add ConstArg representation for const items

tracking issue: rust-lang/rust#132980
fixes rust-lang/rust#131046
fixes rust-lang/rust#134641

As part of implementing `min_generic_const_args`, we need to distinguish const items that can be used in the type system, such as in associated const equality projections, from const items containing arbitrary const code, which must be kept out of the type system. Specifically, all "type consts" must be either concrete (no generics) or generic with a trivial expression like `N` or a path to another type const item.

To syntactically distinguish these cases, we require, for now at least, that users annotate all type consts with the `#[type_const]` attribute. Then, we validate that the const's right-hand side is indeed eligible to be a type const and represent it differently in the HIR.

We accomplish this representation using a new `ConstItemRhs` enum in the HIR, and a similar but simpler enum in the AST. When `#[type_const]` is **not** applied to a const (e.g. on stable), we represent const item right-hand sides (rhs's) as HIR bodies, like before. However, when the attribute is applied, we instead lower to a `hir::ConstArg`. This syntactically distinguishes between trivial const args (paths) and arbitrary expressions, which are represented using `AnonConst`s. Then in `generics_of`, we can take advantage of the existing machinery to bar the `AnonConst` rhs's from using parent generics.
2025-11-08 22:31:33 +00:00
bendn
edd7d8a2fd
constify result unwrap unchecked 2025-11-09 04:17:15 +07:00
Jonathan Brouwer
0d64a5f467
Use the current lint note id when parsing cfg!()
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-11-08 21:02:21 +01:00