Commit Graph

171433 Commits

Author SHA1 Message Date
Jonathan Brouwer ef4cff2ea3 Rollup merge of #153015 - joboet:atomic_alias_generic, r=jhpratt
core: make atomic primitives type aliases of `Atomic<T>`

Tracking issue: https://github.com/rust-lang/rust/issues/130539

This makes `AtomicI32` and friends type aliases of `Atomic<T>` by encoding their alignment requirements via the use of an internal `Storage` associated type. This is also used to encode that `AtomicBool` store a `u8` internally.

Modulo the `Send`/`Sync` implementations, this PR does not move any trait implementations, methods or associated functions – I'll leave that for another PR.
2026-03-02 20:10:34 +01:00
Jonathan Brouwer 1654b17cd8 Rollup merge of #151780 - rwardd:ryan/fix-option-permutations, r=nikic
Updated slice tests to pass for big endian hosts for `multiple-option-or-permutations.rs`

It was discovered that the FileCheck tests when performing an `Option::or` operation on a slice was failing when tested on a big endian host.

The compiler explorer link is here outlining the codegen output differences - https://rust.godbolt.org/z/qdE7d3G4f

This MR relaxes the constraints for the `*slice_u8` variants of the test (by changing `CHECK-NEXT` to `CHECK-DAG`), whilst still maintaining the check for the necessary `or` logic.

Huge thanks to @Gelbpunkt for identifying this issue! It has been confirmed that this fix passes on a big endian target now as well.

Closes rust-lang/rust#151718
2026-03-02 20:10:33 +01:00
Jonathan Brouwer 6d16e3b73b Rollup merge of #153153 - folkertdev:thumb-and-arm, r=jieyouxu
add tests for thumb interworking

fixes https://github.com/rust-lang/rust/issues/151946

thumb programs (using a 16-bit instruction encoding) can call arm (32-bit instruction encoding) code. Doing so requires switching from thumb mode to arm mode, executing, then switching back. Test that this happens correctly, in particular for naked functions.

cc @thejpster can you confirm the output looks good here and that we're testing all of the relevant things
r? jieyouxu  because this is doing some interesting things testing-wise

I believe that we need run-make here because we need to look at the assembly after the linker has run. It will correct calls from thumb to arm: depending on the thumb version this either uses a special instruction or inserts  a call to a thunk that handles switching between thumb and arm mode.
2026-03-02 20:10:31 +01:00
joboet 88cec3a1c0 update debuginfo visualizers and tests 2026-03-02 11:57:03 +01:00
Folkert de Vries 2d8ceee19c add tests for a thumb program calling arm code
and in particular for naked functions in that scenario
2026-03-02 10:53:51 +01:00
joboet 4d09563d8d bless UI tests referencing atomic primitives 2026-03-02 00:23:24 +01:00
joboet 95e571ded1 update references to Atomic in diagnostics
... and remove some unused diagnostic items.
2026-03-02 00:23:23 +01:00
Jonathan Brouwer db167a8094 Rollup merge of #153231 - JonathanBrouwer:move_diag_arg_map, r=Kivooeo
diags: Pass `DiagArgMap` instead of `FluentArgs` into `format_diag_message`

This PR no longer exposes `FluentArgs` outside of `translation.rs`, instead using the already existing `DiagArgMap`.
This is in preparation of a few upcoming PRs, as well as just making the code slightly nicer.

Will do a perf run because this technically calls `to_fluent_args` a few more times than previously, but not expecting this to be significant
2026-03-01 17:43:42 +01:00
Jonathan Brouwer 51f35d76a2 Pass DiagArgMap instead of FluentArgs into format_diag_message 2026-03-01 10:07:39 +01:00
Matthias Krüger d9c27fd712 Rollup merge of #153229 - BennoLossin:frt-fmt, r=ytmimi
rustfmt: add test for field representing type builtin syntax

As requested by @ytmimi in https://github.com/rust-lang/rust/pull/152730#issuecomment-3977458690.

Not sure if you want/need a more complex example. Just let me know.
2026-03-01 09:39:59 +01:00
Matthias Krüger 1b674490eb Rollup merge of #152949 - Shunpoco:tidy-ci, r=Kobzol
Introduce --ci flag in tidy

## Context
Currently tidy doesn't have `--ci` flag. Even if bootstrap has --ci=true, it isn't passed to tidy. As a result, some parts of tidy where we need to turn on `ci mode` are never executed on our local.

## Change
This PR introduces --ci flag in tidy, and modify CiInfo and other parts of tidy where currently use `CiEnv::is_ci()` for checking if the running environment is ci or not.
2026-03-01 09:39:57 +01:00
bors 821537498d Auto merge of #153232 - JonathanBrouwer:rollup-rdNJcbm, r=JonathanBrouwer
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#146989 (Inhibit all-absent-variant optimization for all enum reprs that inhibit layout optimization, not just repr(C).)
 - rust-lang/rust#151991 (std: sys: pal: uefi: os: Implement split_paths)
 - rust-lang/rust#152794 (Fix ICE in `try_to_raw_bytes` when array elements have mismatched)
 - rust-lang/rust#153052 (std random.rs: update link to RTEMS docs)
 - rust-lang/rust#153054 (docs: note env var influence on `temp_dir` and `env_clear` on Windows)
 - rust-lang/rust#153061 (cleanup `tests/ui/box`, part 2)
 - rust-lang/rust#153197 (style: Update doctests for `TryFrom<integer> for bool` and `From<bool> for float`)
 - rust-lang/rust#153210 (Fix ICE on empty file with -Zquery-dep-graph)
 - rust-lang/rust#153228 (Remove `TranslationError`)
2026-02-28 21:58:21 +00:00
Shunpoco af299893fd Introduce --ci flag in tidy
* add --ci flag in tidy

This commit introduces --ci flag in tidy because currently bootstrap can't pass its ci env information to tidy. It also modifies how CiInfo initialize its ci_env variable. tidy codes which uses CiEnv::is_ci for checking ci are now using ci_env in CiInfo.
* address review
- Fix comment
- Use Option for ci flag in order to have true/false explicitly or unspecified (implicit false)
* integrate CiInfo into TidyCtx
* remove CiInfo
* CiEnv::current() should be called when ci flag is not added
* extract base_commit() to a separate function
* use &TidyCtx instead of clone
2026-02-28 21:37:32 +00:00
bors 38c0de8dcb Auto merge of #153050 - JayanAXHF:refactor/change-is-type-const, r=BoxyUwU
refactor(mgca): Change `DefKind::Const` and `DefKind::AssocConst` to have a `is_type_const` flag



Addresses rust-lang/rust#152940 

- Changed `DefKind::Const` and `DefKind::AssocConst` to have a `is_type_const` flag.
- changed `is_type_const` query to check for this flag
- removed `is_rhs_type_const` query

r? @BoxyUwU
2026-02-28 18:27:06 +00:00
Jonathan Brouwer 6e8d9c1242 Adjust uses of format_diag_message to remove unwrap 2026-02-28 18:46:53 +01:00
Benno Lossin d41e16bcea rustfmt: add test for field representing type builtin syntax 2026-02-28 18:38:30 +01:00
JayanAXHF efc150e5b3 refactor(mgca): Change DefKind::Const and DefKind::AssocConst to have a is_type_const flag
* refactor: add `is_type_const` flag to `DefKind::Const` and `AssocConst`
* refactor(cleanup) remove the `rhs_is_type_const` query
* style: fix formatting
* refactor: refactor stuff in librustdoc for new Const and AssocConst
* refactor: refactor clippy for the changes
* chore: formatting
* fix: fix test
* fix: fix suggestions
* Update context.rs

Co-authored-by: Boxy <rust@boxyuwu.dev>
* changed AssocKind::Const to store data about being a type const
2026-02-28 17:27:46 +00:00
bors ba1567989e Auto merge of #153217 - JonathanBrouwer:rollup-iXVG70B, r=JonathanBrouwer
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#153211 (`rust-analyzer` subtree update)
 - rust-lang/rust#149027 (Improve cross-crate trait impl param mismatch suggestions )
 - rust-lang/rust#152730 (add field representing types)
 - rust-lang/rust#153136 (Correctly handle `#[doc(alias = "...")]` attribute on inlined reexports)
 - rust-lang/rust#152165 (Normalize capture place `ty`s to prevent ICE)
 - rust-lang/rust#152615 (refactor 'valid for read/write' definition: exclude null)
 - rust-lang/rust#153109 (Fix LegacyKeyValueFormat report from docker build: aarch64-gnu-debug)
 - rust-lang/rust#153172 (Fix comment about placeholders)
 - rust-lang/rust#153187 (Fix ICE when macro-expanded extern crate shadows std)
 - rust-lang/rust#153190 (Don't allow subdiagnostic to use variables from their parent)
 - rust-lang/rust#153200 (Remove redundant clone)
 - rust-lang/rust#153216 (mark two polonius tests as known-bug)
2026-02-28 12:23:16 +00:00
Jonathan Brouwer 185833ee7a Rollup merge of #153109 - homersimpsons:chore/fix-LegacyKeyValueFormat-aarch64-gnu-debug, r=marcoieni
Fix LegacyKeyValueFormat report from docker build: aarch64-gnu-debug

Part of rust-lang/rust#152305

r? @marcoieni
2026-02-28 12:52:55 +01:00
Jonathan Brouwer c3f1dabba2 Rollup merge of #153136 - GuillaumeGomez:reexport-doc-alias, r=lolbinarycat
Correctly handle `#[doc(alias = "...")]` attribute on inlined reexports

Fixes rust-lang/rust#152939.

During the doc attributing migration to the new API, this information got lost. At least now we have a test for it. :)

r? @lolbinarycat
2026-02-28 12:52:53 +01:00
Jonathan Brouwer 1acf1c5367 Rollup merge of #152730 - BennoLossin:field-projections-lang-item, r=oli-obk
add field representing types

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152730)*

> [!NOTE]
> This is a rewrite of #146307 by using a lang item instead of a custom `TyKind`. We still need a `hir::TyKind::FieldOf` variant, because resolving the field name cannot be done before HIR construction. The advantage of doing it this way is that we don't need to make any changes to types after HIR (including symbol mangling). At the very beginning of this feature implementation, I tried to do it using a lang item, but then quickly abandoned the approach, because at that time I was still intending to support nested fields.

Here is a [range-diff](https://triagebot.infra.rust-lang.org/gh-range-diff/rust-lang/rust/605f49b27444a738ea4032cb77e3bdc4eb811bab..d15f5052095b3549111854a2555dd7026b0a729e/605f49b27444a738ea4032cb77e3bdc4eb811bab..f5f42d1e03495dbaa23671c46b15fccddeb3492f) between the two PRs

---

# Add Field Representing Types (FRTs)

This PR implements the first step of the field projection lang experiment (Tracking Issue: rust-lang/rust#145383). Field representing types (FRTs) are a new kind of type. They can be named through the use of the `field_of!` macro with the first argument being the type and the second the name of the field (or variant and field in the case of an enum). No nested fields are supported.

FRTs natively implement the `Field` trait that's also added in this PR. It exposes information about the field such as the type of the field, the type of the base (i.e. the type that contains the field) and the offset within that base type. Only fields of non-packed structs are supported, fields of enums an unions have unique types for each field, but those do not implement the `Field` trait.

This PR was created in collaboration with @dingxiangfei2009, it wouldn't have been possible without him, so huge thanks for mentoring me!

I updated my library solution for field projections to use the FRTs from `core` instead of creating my own using the hash of the name of the field. See the [Rust-for-Linux/field-projection `lang-experiment` branch](https://github.com/Rust-for-Linux/field-projection/tree/lang-experiment).

## API added to `core::field`

```rust
pub unsafe trait Field {
    type Base;

    type Type;

    const OFFSET: usize;
}

pub macro field_of($Container:ty, $($fields:expr)+ $(,)?);
```

Along with a perma-unstable type that the compiler uses in the expansion of the macro:

```rust
#[unstable(feature = "field_representing_type_raw", issue = "none")]
pub struct FieldRepresentingType<T: ?Sized, const VARIANT: u32, const FIELD: u32> {
    _phantom: PhantomData<T>,
}
```

## Explanation of Field Representing Types (FRTs)

FRTs are used for compile-time & trait-level reflection for fields of structs & tuples. Each struct & tuple has a unique compiler-generated type nameable through the `field_of!` macro. This type natively contains information about the field such as the outermost container, type of the field and its offset. Users may implement additional traits on these types in order to record custom information (for example a crate may define a [`PinnableField` trait](https://github.com/Rust-for-Linux/field-projection/blob/lang-experiment/src/marker.rs#L9-L23) that records whether the field is structurally pinned).

They are the foundation of field projections, a general operation that's generic over the fields of a struct. This genericism needs to be expressible in the trait system. FRTs make this possible, since an operation generic over fields can just be a function with a generic parameter `F: Field`.

> [!NOTE]
> The approach of field projections has changed considerably since this PR was opened. In the end we might not need FRTs, so this API is highly experimental.

FRTs should act as though they were defined as `struct MyStruct_my_field<StructGenerics>;` next to the struct. So it should be local to the crate defining the struct so that one can implement any trait for the FRT from that crate. The `Field` traits should be implemented by the compiler & populated with correct information (`unsafe` code needs to be able to rely on them being correct).

## TODOs

There are some `FIXME(FRTs)` scattered around the code:
- Diagnostics for `field_of!` can be improved
  - `tests/ui/field_representing_types/nonexistent.rs`
  - `tests/ui/field_representing_types/non-struct.rs`
  - `tests/ui/field_representing_types/offset.rs`
  - `tests/ui/field_representing_types/not-field-if-packed.rs`
  - `tests/ui/field_representing_types/invalid.rs`
- Simple type alias already seem to work, but might need some extra work in `compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs`

r? @oli-obk
2026-02-28 12:52:52 +01:00
Jonathan Brouwer 54776ead12 Rollup merge of #153211 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to https://github.com/rust-lang/rust-analyzer/commit/fbc7b76b27d2029d8000ad63225546ff59789752.

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

r? @ghost
2026-02-28 12:52:51 +01:00
bors 1d113d2f30 Auto merge of #152948 - GrigorenkoPV:sym-ascii, r=JonathanBrouwer
pre-intern single-letter `sym::[a-zA-Z]`

As suggested in https://github.com/rust-lang/rust/pull/152624#discussion_r2822059367.

Needs a perf run I guess.
2026-02-28 08:38:11 +00:00
Lukas Wirth 7a221089b3 Merge pull request #21669 from Shourya742/2026-02-18-add-span-parent
Implement Span::SpanParent for proc-macro-srv
2026-02-28 07:25:41 +00:00
bors 846cb1e850 Auto merge of #152838 - Kobzol:cargo-miri-cargo-in-tree-, r=jieyouxu
Use in-tree Cargo when testing stage 2+ cargo miri



Closes: https://github.com/rust-lang/rust/issues/152772

r? @jieyouxu
2026-02-28 05:04:20 +00:00
bors 1eb36c6516 Auto merge of #153192 - cuviper:version-1.96.0, r=cuviper
Bump the version number to 1.96.0

https://forge.rust-lang.org/release/process.html#bump-the-stable-version-number-friday-the-week-before

cc @rust-lang/release 
r? cuviper
2026-02-28 01:37:20 +00:00
Guillaume Gomez f6e527ed28 Improve code by ensuring that if new doc attributes are added, we will be forced to take them into account when inlining 2026-02-27 19:22:20 +01:00
Josh Stone 07897a815e Bump the version number to 1.96.0 2026-02-27 09:38:23 -08:00
Benno Lossin 7b428597ff add field representing types 2026-02-27 15:54:20 +01:00
Jonathan Brouwer 57fe4c06de Rollup merge of #153117 - arferreira:cleanup-macro-path-iter, r=GuillaumeGomez
Remove mutation from macro path URL construction

Resolves the `FIXME` in `generate_macro_def_id_path`.
The old code mutated `path` to build the URL — popping the macro name, pushing an interned filename, then restoring the original at the end. None of that was necessary. A slice pattern gives us `module_path` and `last` without touching the original, and `push_fmt(format_args!(...))` writes the filename directly into the URL builder, same as `make_href` already does.
Also tightened the error guards: the original `path.len() < 2` is now two distinct checks with messages that describe the actual failure (empty path vs. single-element path missing the crate prefix).

r? @GuillaumeGomez
2026-02-27 14:05:36 +01:00
Guillaume 6df216934c Fix LegacyKeyValueFormat report from docker build: aarch64-gnu-debug 2026-02-27 13:03:28 +01:00
Jieyou Xu ec7c117cda bootstrap: force a CI LLVM stamp bump
To see if this helps with
<https://github.com/rust-lang/rust/issues/153127>.
2026-02-27 19:24:21 +08:00
SpiZeak 2879033280 fix: migrate to SyntaxEditor in generate_derive assist 2026-02-27 11:09:44 +01:00
Shoyu Vanilla (Flint) 720020d67a Merge pull request #21710 from SpiZeak/migrate-fix-visibility
Migrate fix_visibility assist to use SyntaxEditor
2026-02-27 07:55:59 +00:00
SpiZeak 171dae6725 feat: migrate fix_visibility assist to SyntaxEditor 2026-02-27 08:19:56 +01:00
Laurențiu Nicola 148f0b1acf Use -Zlockfile-path on every 1.95 nightly 2026-02-27 08:53:39 +02:00
bors 0ee5907d59 Auto merge of #153145 - ytmimi:rustfmt-subtree-update, r=ytmimi
rustfmt subtree update

r? @ghost
2026-02-27 03:08:01 +00:00
Shoyu Vanilla (Flint) 17c945f68e Merge pull request #21706 from A4-Tacks/redundant-enum-variant-pat
fix: no complete enum variant qualifier in pat
2026-02-27 02:17:11 +00:00
Shoyu Vanilla (Flint) f7e81f5ae2 Merge pull request #21698 from A4-Tacks/indent-iflet-with-match
fix: Fix scrutinee expr indent for replace_if_let_with_match
2026-02-27 02:12:58 +00:00
Shoyu Vanilla (Flint) 4a2f9eb863 Merge pull request #21699 from Albab-Hasan/fix/ptr-cast-add-auto-trait-not-detected
fix: Detect E0804 when casting raw ptr-to-dyn adds auto traits
2026-02-27 02:11:49 +00:00
Yacin Tmimi e9cf384a91 Merge commit 'cebab3e99259be82ff069e5ae89e91855d79e534' into rustfmt-subtree-update 2026-02-26 11:57:15 -05:00
Guillaume Gomez 526c1afb5c Correctly handle #[doc(alias = "...")] attribute on inlined reexports 2026-02-26 16:07:37 +01:00
bors bb779a9156 Auto merge of #153124 - JonathanBrouwer:rollup-3OajkjU, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#153079 (Revert "Move aarch64-apple dist builder to dynamic llvm linking")
 - rust-lang/rust#152651 (Avoid duplicate `requirement` diag args in `RegionOriginNote`)
 - rust-lang/rust#152978 (Port `#[rustc_autodiff]` to the attribute parser infrastructure)
 - rust-lang/rust#153091 (Migration of `LintDiagnostic` - part 4)
 - rust-lang/rust#153112 (Query key cleanups)
 - rust-lang/rust#153118 (mailmap: add redddy)
 - rust-lang/rust#153120 (Clean up some code related to `QueryVTable::execute_query_fn`)
2026-02-26 12:20:45 +00:00
Jonathan Brouwer 7aa4f04b64 Rollup merge of #153079 - RalfJung:revert-macos-dyn, r=jieyouxu
Revert "Move aarch64-apple dist builder to dynamic llvm linking"

Reverts c033de932e (part of https://github.com/rust-lang/rust/pull/152768) in order to fix  https://github.com/rust-lang/rust/issues/153077.
2026-02-26 09:57:02 +01:00
Lukas Wirth 6c2ec54fa5 Merge pull request #21708 from lnicola/no-invalid-notification-panic
fix: Don't panic on invalid LSP notifications
2026-02-26 08:27:07 +00:00
bors 69b78537fa Auto merge of #153067 - arlosi:update-cargo, r=ehuss
Update cargo submodule

8 commits in 8cc0cb136772b8f54eafe0d163fcb7226a06af0c..f298b8c82da0cba538516b45b04a480fc501d4c0 2026-02-17 12:16:26 +0000 to 2026-02-24 21:59:20 +0000
- fix(host-config): fix panic when cross-compiling with host-config (rust-lang/cargo#16674)
- doc: improve documentation on using cfg values with build scripts (rust-lang/cargo#16671)
- Fix typo in cargo-yank docs (rust-lang/cargo#16656)
- fix(job_queue): Handle Clippy CLI arguments in `fix` message (rust-lang/cargo#16652)
- Add a test for fingerprint checking when a symlink target changes (rust-lang/cargo#16661)
- Fix parallel locking when `-Zfine-grain-locking` is enabled (rust-lang/cargo#16659)
- fix(cli): Remove `--lockfile-path` (rust-lang/cargo#16621)
- test(build-std): Update error message (rust-lang/cargo#16658)
2026-02-26 08:03:30 +00:00
arferreira a2266501dc Remove mutation from macro path URL construction in generate_macro_def_id_path 2026-02-25 22:39:43 -05:00
Jacob Pratt 236327e901 Rollup merge of #153092 - mu001999-contrib:cleanup/redundant-self, r=JonathanBrouwer
Remove redundant self usages

Extracted from https://github.com/rust-lang/rust/pull/152996.

r? petrochenkov
2026-02-25 21:42:58 -05:00
Jacob Pratt 0bb904e236 Rollup merge of #153071 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/reference

4 commits in 442cbef9105662887d5eae2882ca551f3726bf28..50a1075e879be75aeec436252c84eef0fad489f4
2026-02-25 00:55:28 UTC to 2026-02-24 17:09:35 UTC

- Fix formatting of markdown grammar with cut (rust-lang/reference#2183)
- Add support for named repeat ranges (rust-lang/reference#2181)
- paths: align singular/plural in `paths.canonical.intro` (rust-lang/reference#2142)
- `cfg_select!` macro (rust-lang/reference#2103)
2026-02-25 21:42:58 -05:00
Jacob Pratt e66871096a Rollup merge of #153111 - arferreira:refactor-url-parts-return-is-absolute, r=notriddle
Refactor url_parts to return is_absolute instead of out param

Follow-up from rust-lang/rust#152977.

Changes `url_parts` to return `Result<(UrlPartsBuilder, bool), HrefError>` instead of taking `is_absolute: &mut bool` as an out parameter. Also clarifies variable name in `generate_item_def_id_path` where the final URL string was called `url_parts`.

No behavior change, pure refactor.

r? @notriddle
2026-02-25 21:42:55 -05:00