Skip to content

[EXPERIMENT] Rollup of 9 pull requests#152476

Closed
Zalathar wants to merge 23 commits intorust-lang:mainfrom
Zalathar:rollup-f5mMs9g
Closed

[EXPERIMENT] Rollup of 9 pull requests#152476
Zalathar wants to merge 23 commits intorust-lang:mainfrom
Zalathar:rollup-f5mMs9g

Conversation

@Zalathar
Copy link
Member

Successful merges:

r? @ghost

Create a similar rollup

bjorn3 and others added 23 commits January 8, 2026 10:45
Co-authored-by: beetrees <b@beetr.ee>
aliases may be rigid even if they don't reference params. If the alias isn't well-formed, trying to normalize it as part of the input should have already failed
This essentially folds the call to `region_from_element` into `RegionInferenceContext`,
and simplifies the error variant for this case. It also clarifies the type
information on the methods called to emphasise the fact that they only ever use
placeholder regions in the diagnostics, and completely ignore any other element.
This also changes the signature of `call_query_method` to not return a value,
because its only caller immediately discards the value anyway.
Add note when inherent impl for a alias type defined outside of the crate

Fixes rust-lang#141679

r? compiler
… r=tgross35

Fix passing/returning structs with the 64-bit SPARC ABI

Fixes the 64-bit SPARC part of rust-lang#115609 by replacing the current implementation with a new implementation modelled on the RISC-V calling convention code ([SPARC ABI reference](https://sparc.org/wp-content/uploads/2014/01/SCD.2.4.1.pdf.gz)).

Pinging `sparcv9-sun-solaris` target maintainers: @psumbera @kulikjak
Fixes rust-lang#115336
Fixes rust-lang#115399
Fixes rust-lang#122620
Fixes rust-lang#147883
r? @workingjubilee
…li-obk

Add field representing types

# Add Field Representing Types (FRTs)

This PR implements the first step of the field projection lang experiment (Tracking Issue: rust-lang#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)+ $(,)?);
```

## 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).

## Design Decisions

During the development several desirable properties of FRTs were discovered. Either due to simplifying the implementation or because of language design reasons. These decisions are:

* FRTs are inhabited ZSTs, they have the same layout as `()`
  * They only contain type information via the `Field` trait. Their only use of the values is a future ergonomics change that allows skipping turbofish syntax.
  * This simplifies const-eval.
  * They are thus also `Freeze`
* The coherence check of FRTs amounts to checking coherence of the base type.

  So `field_of!(Foo, bar)` is local if `Foo` is local (`Bar` is allowed to be foreign). Fundamental types are **not** handled specially, so `field_of!(MaybeUninit<Struct>, value)` still is local to `core` (aside from the fact that non-visible fields cannot be accessed in the first place).

* Traits may be implemented for FRTs in the usual way (so if the FRT or the trait is local). There is an exception:
  * `Drop`: It requires supporting non-ADTs and as such it simplified the implementation to not allow it. A future PR can add this if required.
* The `Field` trait is not user-implementable
  * this also can be lifted in the future, but for now only FRTs will implement it.
* FRTs implement all auto traits as well as `Copy` and `Clone`.

## TODOs

There are several `FIXME(FRTs)` scattered around the code:
- rustdoc doesn't yet support them, this can be implemented later
  - `src/librustdoc/json/conversions.rs`
- Debuginfo and symbol mangling is not implemented, for this PR they aren't important, but later we should implement it
    - `compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs`
    - `compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs`
    - `compiler/rustc_symbol_mangling/src/v0.rs`
- 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`
…=wesleywiser

Don't compute FnAbi for LLVM intrinsics in backends

~~This removes support for `extern "unadjusted"` for anything other than LLVM intrinsics. It only makes sense in the context of calling LLVM intrinsics anyway as it exposes the way the LLVM backend internally represents types. Perhaps it should be renamed to `extern "llvm-intrinsic"`?~~

Follow up to rust-lang#148533
…=chenyukang

Add FCW for derive helper attributes that will conflict with built-in attributes

Adds a future-compatibility-warning deny-by-default lint that helps catch invalid derive helper attribute names early.

This issues the lint, saying that `ignore` helper will clash with the built-in `ignore` attribute.

```rust
#![crate_type = "proc-macro"]
#![deny(ambiguous_derive_helpers)]
use proc_macro::TokenStream;

#[proc_macro_derive(Trait, attributes(ignore))]
pub fn example(input: TokenStream) -> TokenStream {
    TokenStream::new()
}
```

If you actually tried to use that `ignore` helper attribute, you won't be able to due to the ambiguity:

```rust
#[derive(Trait)]
struct Foo {
    #[ignore]
    field: (),
}
```

Produces:

```
error[E0659]: `ignore` is ambiguous
 --> src/lib.rs:5:7
  |
5 |     #[ignore]
  |       ^^^^^^ ambiguous name
  |
  = note: ambiguous because of a name conflict with a builtin attribute
  = note: `ignore` could refer to a built-in attribute
note: `ignore` could also refer to the derive helper attribute defined here
 --> src/lib.rs:3:10
  |
3 | #[derive(Trait)]
  |          ^^^^^
```
layout: handle rigid aliases without params

fixes rust-lang#151791

r? types
…ror-handling, r=lcnr

Borrowck: simplify diagnostics for placeholders

This folds the call to `region_from_element` into `RegionInferenceContext`, and simplifies the error variant for this case to only talk about regions as opposed to elements. This is the only case where a `RegionElement` leaks out of region inference, so now they can be considered internal to region inference (though that currently isn't expressed). It also clarifies the type information on the methods called to emphasise the fact that they only ever use placeholder regions in the diagnostics completely ignore any other element.

It also adds a bunch of FIXMEs to some fishy statements that conjure universes from what seems like arbitrary integers.

This was lifted from rust-lang#142623.

r? @lcnr
Add note for `?Sized` params in int-ptr casts diag

Close rust-lang#74756
Clarify names of `QueryVTable` functions for "executing" a query

In the query system, there are several layers of functions involved in “executing” a query, with very different responsibilities at each layer, making it important to be able to tell them apart.

This PR renames two of the function pointers in `QueryVTable`, along with their associated helper functions, to hopefully do a better job of indicating what their actual responsibilities are.

r? nnethercote
@rust-bors rust-bors bot added the rollup A PR which is a rollup label Feb 11, 2026
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-rustdoc-json Area: Rustdoc JSON backend PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 11, 2026
@rustbot rustbot added T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Feb 11, 2026
@Zalathar
Copy link
Member Author

(Not a real rollup; just running some early try jobs on the approved PRs not in the main rollup.)

@bors try jobs=x86_64-msvc-1,i686-msvc-1,x86_64-mingw-1,test-various,armhf-gnu,aarch64-apple

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Feb 11, 2026
Rollup of 9 pull requests


try-job: x86_64-msvc-1
try-job: i686-msvc-1
try-job: x86_64-mingw-1
try-job: test-various
try-job: armhf-gnu
try-job: aarch64-apple
@Zalathar Zalathar changed the title Rollup of 9 pull requests [EXPERIMENT] Rollup of 9 pull requests Feb 11, 2026
@rust-log-analyzer
Copy link
Collaborator

The job test-various failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
REPOSITORY                                   TAG       IMAGE ID       CREATED       SIZE
ghcr.io/dependabot/dependabot-updater-core   latest    b72a662c47e3   11 days ago   790MB
=> Removing docker images...
Deleted Images:
untagged: ghcr.io/dependabot/dependabot-updater-core:latest
untagged: ghcr.io/dependabot/dependabot-updater-core@sha256:57ef9cc45f72cc4258ee1baa8243bc3cd55c0a0e570b6768c37346247be35f0d
deleted: sha256:b72a662c47e31df2e7bf59368b2b83be239f02a1baa721393717711a1a719df9
deleted: sha256:3e13ccd80f19769f39008cfc6549938e1ea4905f47b028c1df2dd6085191386c
deleted: sha256:842807995a512b2c5a9b241a3aecdbe79af6b0642d96fa5460cfcf0c9d8be295
deleted: sha256:0f9074b9f46f4570eb7cb4b65fcb3c3d909f9b1d14ca66b30508117b6deda303
deleted: sha256:2ca99cb9251d19157c56b5d91c8961bb4b35196a5ca9b4ffdccbf24abbfe2a5f
---
test [ui] tests/ui/abi/anon-extern-mod.rs ... ok
test [ui] tests/ui/abi/arm-unadjusted-intrinsic.rs#aarch64 ... ok
test [ui] tests/ui/abi/arm-unadjusted-intrinsic.rs#arm ... ok
test [ui] tests/ui/abi/bad-custom.rs ... ignored, ignored on targets without inline assembly support
test [ui] tests/ui/abi/avr-sram.rs#disable_sram ... ok
test [ui] tests/ui/abi/avr-sram.rs#has_sram ... ok
test [ui] tests/ui/abi/avr-sram.rs#no_sram ... ok
test [ui] tests/ui/abi/c-zst.rs#aarch64-darwin ... ok
test [ui] tests/ui/abi/c-zst.rs#powerpc-linux ... ok
test [ui] tests/ui/abi/c-stack-as-value.rs ... ok
test [ui] tests/ui/abi/c-zst.rs#s390x-linux ... ok
test [ui] tests/ui/abi/c-zst.rs#x86_64-linux ... ok
---
test [ui] tests/ui/asm/aarch64/type-f16.rs ... ignored, ignored on targets without inline assembly support
test [ui] tests/ui/asm/aarch64/arm64ec-sve.rs ... ok
test [ui] tests/ui/array-slice-vec/vector-no-ann-2.rs ... ok
test [ui] tests/ui/array-slice-vec/vector-slice-matching-8498.rs ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#hf ... ok
test [ui] tests/ui/asm/asm-with-nested-closure.rs ... ignored, ignored on targets without inline assembly support
test [ui] tests/ui/asm/aarch64v8r.rs#r82 ... ok
test [ui] tests/ui/asm/arm-low-dreg.rs ... ok
test [ui] tests/ui/asm/binary_asm_labels.rs ... ignored, only executed when the architecture is x86_64
test [ui] tests/ui/asm/binary_asm_labels_allowed.rs ... ignored, only executed when the architecture is aarch64
---
test [ui] tests/ui/asm/conditionally-sized-ptr.rs ... ignored, ignored on targets without inline assembly support
test [ui] tests/ui/asm/const-error.rs ... ignored, ignored on targets without inline assembly support
test [ui] tests/ui/asm/const-refs-to-static.rs ... ignored, ignored on targets without inline assembly support
test [ui] tests/ui/asm/const-resolve-error.rs ... ignored, ignored on targets without inline assembly support
test [ui] tests/ui/asm/aarch64v8r.rs#sf ... ok
test [ui] tests/ui/asm/empty_global_asm.rs ... ignored, ignored on targets without inline assembly support
test [ui] tests/ui/asm/fail-const-eval-issue-121099.rs ... ignored, ignored on targets without inline assembly support
test [ui] tests/ui/asm/generic-const.rs ... ignored, ignored on targets without inline assembly support
test [ui] tests/ui/asm/generic_const_simd_vec_len.rs ... ignored, only executed when the architecture is x86_64
test [ui] tests/ui/asm/global-asm-isnt-really-a-mir-body.rs#cfi ... ignored, ignored on targets without inline assembly support
---
test [ui] tests/ui/const-generics/occurs-check/bind-param.rs ... ok
test [ui] tests/ui/const-generics/occurs-check/unused-substs-4.rs ... ok
test [ui] tests/ui/const-generics/ogca/basic.rs ... ok
test [ui] tests/ui/const-generics/occurs-check/unused-substs-5.rs ... ok
test [ui] tests/ui/const-generics/ogca/basic-fail.rs ... ok
test [ui] tests/ui/const-generics/ogca/coherence-ambiguous.rs ... ok
test [ui] tests/ui/const-generics/ogca/rhs-but-not-root.rs ... ok
test [ui] tests/ui/const-generics/opaque_types2.rs ... ok
test [ui] tests/ui/const-generics/opaque_types.rs ... ok
test [ui] tests/ui/const-generics/outer-lifetime-in-const-generic-default.rs ... ok
test [ui] tests/ui/const-generics/overlapping_impls.rs ... ok
test [ui] tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs#min ... ok
---
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#thin2 ... ignored, ignored on targets without threading support
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#thin3 ... ignored, ignored on targets without threading support
test [ui] tests/ui/extern/issue-36122-accessing-externed-dst.rs ... ok
test [ui] tests/ui/extern/issue-47725.rs ... ok
test [ui] tests/ui/extern/lgamma-linkage.rs ... ignored, ignored when the architecture is wasm32 (wasi-libc does not have lgamma)
test [ui] tests/ui/extern/issue-13655.rs ... ok
test [ui] tests/ui/extern/issue-95829.rs ... ok
test [ui] tests/ui/extern/not-in-block.rs ... ok
test [ui] tests/ui/extern/unsized-extern-derefmove.rs ... ok
test [ui] tests/ui/extern/issue-80074.rs ... ok
---
test [ui] tests/ui/feature-gates/feature-gate-macro-derive.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-macro-metavar-expr-concat.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-marker_trait_attr.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-may-dangle.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-mgca-type-const-syntax.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-min-generic-const-args.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-movrs_target_feature.rs ... ignored, only executed when the architecture is x86_64
test [ui] tests/ui/feature-gates/feature-gate-min_const_fn.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-more-maybe-bounds.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-naked_functions_rustic_abi.rs ... ignored, only executed when the architecture is x86_64
---
test [ui] tests/ui/imports/ambiguous-9.rs ... ok
test [ui] tests/ui/imports/ambiguous-glob-vs-expanded-extern.rs ... ok
test [ui] tests/ui/imports/ambiguous-import-visibility-module.rs ... ok
test [ui] tests/ui/imports/ambiguous-8.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-glob-vs-multiouter.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-globvsglob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-no-implicit-prelude.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-core-glob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-std-glob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-pick-core.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-pick-std.rs ... ok
---

failures:

---- [ui] tests/ui/reflection/dump.rs#bit32 stdout ----
Saved the actual run.stdout to `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/reflection/dump.bit32/dump.bit32.run.stdout`
diff of run.stdout:

11                     offset: 1,
12                 },
13                 Field {
-                     ty: TypeId(0x41223169ff28813ba79b7268a2a968d9),
15                     offset: 2,
16                 },
17             ],

179 Type {
180     kind: Reference(
181         Reference {
-             pointee: TypeId(0x641e3def269c37acc6dcb92bf8c5f196),
183             mutable: false,
184         },
185     ),


The actual run.stdout differed from the expected run.stdout

error in revision `bit32`: 1 errors occurred comparing run output.
status: exit status: 0
command: cd "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/reflection/dump.bit32" && RUSTC="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" RUST_TEST_THREADS="4" "/wasmtime-v38.0.4-x86_64-linux/wasmtime" "run" "-C" "cache=n" "--dir" "." "--env" "RUSTC_BOOTSTRAP" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/reflection/dump.bit32/a.wasm"
--- stdout -------------------------------
Type {
    kind: Tuple(
        Tuple {
            fields: [
                Field {
                    ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb),
                    offset: 0,
                },
                Field {
                    ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb),
                    offset: 1,
                },
                Field {
                    ty: TypeId(0x76973a66f24df6db7173e51528fa5bec),
                    offset: 2,
                },
            ],
        },
    ),
    size: Some(
        2,
    ),
}
Type {
    kind: Array(
        Array {
            element_ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb),
            len: 2,
        },
    ),
    size: Some(
        2,
    ),
---
}
Type {
    kind: Reference(
        Reference {
            pointee: TypeId(0xda1b6da9bd297bb2900de9303aadea79),
            mutable: false,
        },
    ),
    size: Some(
        8,
    ),
}
Type {
    kind: Reference(
        Reference {
            pointee: TypeId(0x474ccf3b5db264ef53916706f7d7bb2c),
            mutable: false,
        },
    ),
    size: Some(
        8,
    ),
}
Type {
    kind: Reference(
        Reference {
            pointee: TypeId(0x2a675f7e9d3320493042d9e4b41ba9eb),
            mutable: false,
        },
    ),
    size: Some(
        8,
---
}
Type {
    kind: Slice(
        Slice {
            element_ty: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb),
        },
    ),
    size: None,
}
Type {
    kind: Reference(
        Reference {
            pointee: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb),
            mutable: false,
        },
    ),
    size: Some(
        4,
    ),
}
Type {
    kind: Reference(
        Reference {
            pointee: TypeId(0x0596b48cc04376e64d5c788c2aa46bdb),
            mutable: true,
        },
    ),
    size: Some(
        4,

@rust-bors rust-bors bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 11, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 11, 2026

💔 Test for 4f6a0db failed: CI. Failed job:

@Zalathar Zalathar closed this Feb 11, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Feb 11, 2026
@Zalathar Zalathar deleted the rollup-f5mMs9g branch February 11, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-rustdoc-json Area: Rustdoc JSON backend PG-exploit-mitigations Project group: Exploit mitigations rollup A PR which is a rollup T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.