From 954ce3fc77e9883c567726d49586833699104041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Tue, 10 Mar 2026 23:12:23 +0000 Subject: [PATCH 1/7] When multiple traits are applicable for method, do not specialize main message to the first one that applied When calling a method that appears on `Iterator`, we often say "`Foo` is not an iterator", even if that method exists in other traits, which is quite confusing and many times nonsensical. Now, if we mention multiple traits we revert the main message back: ``` error[E0599]: no method named `take` found for struct `Foo` in the current scope --> $DIR/method-call-err-msg.rs:19:7 | LL | pub struct Foo; | -------------- method `take` not found for this struct because it doesn't satisfy `Foo: Iterator` ... LL | / y.zero() LL | | .take() | | -^^^^ `Foo` is not an iterator | |______| | | = note: the following trait bounds were not satisfied: `Foo: Iterator` which is required by `&mut Foo: Iterator` note: the trait `Iterator` must be implemented --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL = help: items from traits can only be used if the trait is implemented and in scope = note: the following traits define an item `take`, perhaps you need to implement one of them: candidate #1: `Iterator` candidate #2: `std::io::Read` ``` --- compiler/rustc_hir_typeck/src/method/suggest.rs | 11 +++++++++++ tests/ui/methods/method-call-err-msg.rs | 10 +++++----- tests/ui/methods/method-call-err-msg.stderr | 2 +- tests/ui/traits/method-on-unbounded-type-param.stderr | 6 +++--- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index 1fe82bc7ff6b8..3ddb4a1c75f0c 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -4404,6 +4404,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { name = item_name, ) }; + if candidates_len > 1 { + let rcvr_ty_kind = match rcvr_ty.peel_refs().kind() { + ty::Param(_) => "type parameter", + ty::Adt(def, _) => self.tcx.def_descr(def.did()), + _ => "type", + }; + err.primary_message(format!( + "no method named `{item_name}` found for {rcvr_ty_kind} `{rcvr_ty}` in the \ + current scope", + )); + } // Obtain the span for `param` and use it for a structured suggestion. if let Some(param) = param_type { let generics = self.tcx.generics_of(self.body_id.to_def_id()); diff --git a/tests/ui/methods/method-call-err-msg.rs b/tests/ui/methods/method-call-err-msg.rs index 4807a956aa236..cd5c617dde21a 100644 --- a/tests/ui/methods/method-call-err-msg.rs +++ b/tests/ui/methods/method-call-err-msg.rs @@ -10,13 +10,13 @@ impl Foo { fn main() { let x = Foo; - x.zero(0) //~ ERROR this method takes 0 arguments but 1 argument was supplied - .one() //~ ERROR this method takes 1 argument but 0 arguments were supplied - .two(0); //~ ERROR this method takes 2 arguments but 1 argument was supplied + x.zero(0) //~ ERROR: this method takes 0 arguments but 1 argument was supplied + .one() //~ ERROR: this method takes 1 argument but 0 arguments were supplied + .two(0); //~ ERROR: this method takes 2 arguments but 1 argument was supplied let y = Foo; y.zero() - .take() //~ ERROR not an iterator + .take() //~ ERROR: no method named `take` found for struct `Foo` in the current scope .one(0); - y.three::(); //~ ERROR this method takes 3 arguments but 0 arguments were supplied + y.three::(); //~ ERROR: this method takes 3 arguments but 0 arguments were supplied } diff --git a/tests/ui/methods/method-call-err-msg.stderr b/tests/ui/methods/method-call-err-msg.stderr index 95de40ff891be..2b027725c225b 100644 --- a/tests/ui/methods/method-call-err-msg.stderr +++ b/tests/ui/methods/method-call-err-msg.stderr @@ -47,7 +47,7 @@ help: provide the argument LL | .two(0, /* isize */); | +++++++++++++ -error[E0599]: `Foo` is not an iterator +error[E0599]: no method named `take` found for struct `Foo` in the current scope --> $DIR/method-call-err-msg.rs:19:7 | LL | pub struct Foo; diff --git a/tests/ui/traits/method-on-unbounded-type-param.stderr b/tests/ui/traits/method-on-unbounded-type-param.stderr index 0b1f83a9de928..8e7fc7b0f6cc5 100644 --- a/tests/ui/traits/method-on-unbounded-type-param.stderr +++ b/tests/ui/traits/method-on-unbounded-type-param.stderr @@ -14,7 +14,7 @@ LL | fn f(a: T, b: T) -> std::cmp::Ordering { LL | fn f(a: T, b: T) -> std::cmp::Ordering { | +++++ -error[E0599]: the method `cmp` exists for reference `&T`, but its trait bounds were not satisfied +error[E0599]: no method named `cmp` found for type parameter `&T` in the current scope --> $DIR/method-on-unbounded-type-param.rs:5:10 | LL | (&a).cmp(&b) @@ -35,7 +35,7 @@ LL | fn g(a: T, b: T) -> std::cmp::Ordering { LL | fn g(a: T, b: T) -> std::cmp::Ordering { | +++++ -error[E0599]: the method `cmp` exists for reference `&T`, but its trait bounds were not satisfied +error[E0599]: no method named `cmp` found for type parameter `&T` in the current scope --> $DIR/method-on-unbounded-type-param.rs:8:7 | LL | a.cmp(&b) @@ -56,7 +56,7 @@ LL | fn h(a: &T, b: T) -> std::cmp::Ordering { LL | fn h(a: &T, b: T) -> std::cmp::Ordering { | +++++ -error[E0599]: the method `cmp` exists for struct `Box`, but its trait bounds were not satisfied +error[E0599]: no method named `cmp` found for struct `Box` in the current scope --> $DIR/method-on-unbounded-type-param.rs:14:7 | LL | trait T {} From ab76d390b4d65cfa514cbfb13f3276c61eb634a9 Mon Sep 17 00:00:00 2001 From: "Tim (Theemathas Chirananthavat)" Date: Tue, 13 Oct 2026 15:19:51 +0700 Subject: [PATCH 2/7] Retroactively add missing stabilized APIs to relnotes --- RELEASES.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/RELEASES.md b/RELEASES.md index b4dc100f5d5f1..93a52feea2da6 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -78,6 +78,7 @@ Stabilized APIs - [`FusedIterator for StepBy`](https://doc.rust-lang.org/stable/std/iter/struct.StepBy.html#impl-FusedIterator-for-StepBy%3CI%3E) - [`std::fs::set_times`](https://doc.rust-lang.org/stable/std/fs/fn.set_times.html) - [`std::fs::set_times_nofollow`](https://doc.rust-lang.org/stable/std/fs/fn.set_times_nofollow.html) +- [`>>::update`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.update) @@ -207,6 +208,13 @@ Stabilized APIs - [`std::range::legacy`](https://doc.rust-lang.org/stable/std/range/legacy/index.html) - [`bool::ok_or`](https://doc.rust-lang.org/stable/std/primitive.bool.html#method.ok_or) - [`bool::ok_or_else`](https://doc.rust-lang.org/stable/std/primitive.bool.html#method.ok_or_else) +- [`Option::map_or_default`](https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.map_or_default) +- [`Result::map_or_default`](https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.map_or_default) +- [`Box::as_ptr`](https://doc.rust-lang.org/stable/std/boxed/struct.Box.html#method.as_ptr) +- [`Box::as_mut_ptr`](https://doc.rust-lang.org/stable/std/boxed/struct.Box.html#method.as_mut_ptr) +- [`Path::is_empty`](https://doc.rust-lang.org/stable/std/path/struct.Path.html#method.is_empty) +- [`PathBuf::into_string`](https://doc.rust-lang.org/stable/std/path/struct.PathBuf.html#method.into_string) +- [`arch::{arm,aarch64}::vdot*`: NEON dot product intrinsics](https://github.com/rust-lang/rust/issues/117224) @@ -530,6 +538,7 @@ Stabilized APIs - [`Layout::repeat`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.repeat) - [`Layout::repeat_packed`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.repeat_packed) - [`Layout::extend_packed`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.extend_packed) +- [`core::arch::aarch64::__jcvt`](https://doc.rust-lang.org/stable/core/arch/aarch64/fn.__jcvt.html) These previously stable APIs are now stable in const contexts: From 3ea3ab853357fa9bd46398b8d9c42aae7ecb4920 Mon Sep 17 00:00:00 2001 From: hkalbasi Date: Fri, 23 Oct 2026 00:37:32 +0330 Subject: [PATCH 3/7] Allow simd types in improper_ctypes lint --- .../rustc_lint/src/types/improper_ctypes.rs | 2 +- tests/assembly-llvm/asm/amdgpu-vec-types.rs | 1 - tests/assembly-llvm/asm/amdgpu-vec-types2.rs | 1 - tests/codegen-llvm/scalable-vectors/memcpy.rs | 1 - tests/ui/abi/arm-unadjusted-intrinsic.rs | 1 - tests/ui/abi/simd-abi-checks-avx.rs | 2 -- tests/ui/abi/simd-abi-checks-avx.stderr | 24 +++++++++---------- tests/ui/abi/simd-abi-checks-empty-list.rs | 1 - .../ui/abi/simd-abi-checks-empty-list.stderr | 2 +- tests/ui/abi/simd-abi-checks-s390x.rs | 1 - tests/ui/abi/simd-abi-checks-s390x.z10.stderr | 20 ++++++++-------- ...simd-abi-checks-s390x.z13_no_vector.stderr | 20 ++++++++-------- ...imd-abi-checks-s390x.z13_soft_float.stderr | 20 ++++++++-------- tests/ui/abi/simd-abi-checks-sse.rs | 1 - tests/ui/abi/simd-abi-checks-sse.stderr | 2 +- tests/ui/codegen/deprecated-llvm-intrinsic.rs | 2 +- .../ui/target-feature/llvm-target-feature.rs | 1 - 17 files changed, 46 insertions(+), 56 deletions(-) diff --git a/compiler/rustc_lint/src/types/improper_ctypes.rs b/compiler/rustc_lint/src/types/improper_ctypes.rs index 04b381261e428..94a17ec1aef4f 100644 --- a/compiler/rustc_lint/src/types/improper_ctypes.rs +++ b/compiler/rustc_lint/src/types/improper_ctypes.rs @@ -677,7 +677,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { debug_assert!(matches!(def.adt_kind(), AdtKind::Struct | AdtKind::Union)); use FfiResult::*; - if !def.repr().c() && !def.repr().transparent() { + if !def.repr().c() && !def.repr().transparent() && !def.repr().simd() { return FfiUnsafe { ty, reason: if def.is_struct() { diff --git a/tests/assembly-llvm/asm/amdgpu-vec-types.rs b/tests/assembly-llvm/asm/amdgpu-vec-types.rs index 8ff4208636bc6..93e6513d8fd43 100644 --- a/tests/assembly-llvm/asm/amdgpu-vec-types.rs +++ b/tests/assembly-llvm/asm/amdgpu-vec-types.rs @@ -19,7 +19,6 @@ unused_variables )] #![deny(unfulfilled_lint_expectations)] -#![expect(improper_ctypes_definitions)] extern crate minicore; use minicore::simd::*; diff --git a/tests/assembly-llvm/asm/amdgpu-vec-types2.rs b/tests/assembly-llvm/asm/amdgpu-vec-types2.rs index de68dc84d1ffc..cff73966e54a5 100644 --- a/tests/assembly-llvm/asm/amdgpu-vec-types2.rs +++ b/tests/assembly-llvm/asm/amdgpu-vec-types2.rs @@ -17,7 +17,6 @@ #![allow( asm_sub_register, improper_gpu_kernel_arg, - improper_ctypes_definitions, non_camel_case_types, unused_assignments, unused_variables diff --git a/tests/codegen-llvm/scalable-vectors/memcpy.rs b/tests/codegen-llvm/scalable-vectors/memcpy.rs index 30d4b0d17ebe1..188c74bfbe269 100644 --- a/tests/codegen-llvm/scalable-vectors/memcpy.rs +++ b/tests/codegen-llvm/scalable-vectors/memcpy.rs @@ -11,7 +11,6 @@ use std::arch::aarch64::*; -#[expect(improper_ctypes)] unsafe extern "C" { fn svcreate2_s16_wrapper(__dst: *mut svint16x2_t, x0: *const svint16_t, x1: *const svint16_t); fn svcreate3_s16_wrapper( diff --git a/tests/ui/abi/arm-unadjusted-intrinsic.rs b/tests/ui/abi/arm-unadjusted-intrinsic.rs index 4340369d5ecc7..6068ef539133a 100644 --- a/tests/ui/abi/arm-unadjusted-intrinsic.rs +++ b/tests/ui/abi/arm-unadjusted-intrinsic.rs @@ -28,7 +28,6 @@ impl Copy for int8x16x4_t {} #[target_feature(enable = "neon")] #[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))] pub unsafe fn vld1q_s8_x4(a: *const i8) -> int8x16x4_t { - #[expect(improper_ctypes)] extern "llvm-intrinsic" { #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vld1x4.v16i8.p0i8")] #[cfg_attr(target_arch = "aarch64", link_name = "llvm.aarch64.neon.ld1x4.v16i8.p0i8")] diff --git a/tests/ui/abi/simd-abi-checks-avx.rs b/tests/ui/abi/simd-abi-checks-avx.rs index e47346d02ea59..dd3a1c3a0d6b6 100644 --- a/tests/ui/abi/simd-abi-checks-avx.rs +++ b/tests/ui/abi/simd-abi-checks-avx.rs @@ -4,7 +4,6 @@ #![feature(portable_simd)] #![feature(simd_ffi)] -#![expect(improper_ctypes_definitions)] use std::arch::x86_64::*; @@ -82,7 +81,6 @@ fn main() { } unsafe { - #[expect(improper_ctypes)] extern "C" { fn some_extern() -> __m256; } diff --git a/tests/ui/abi/simd-abi-checks-avx.stderr b/tests/ui/abi/simd-abi-checks-avx.stderr index 38e5310d34b26..7484d43829a00 100644 --- a/tests/ui/abi/simd-abi-checks-avx.stderr +++ b/tests/ui/abi/simd-abi-checks-avx.stderr @@ -1,5 +1,5 @@ error: this function call requires the `avx` target feature, which is not enabled in the caller - --> $DIR/simd-abi-checks-avx.rs:59:11 + --> $DIR/simd-abi-checks-avx.rs:58:11 | LL | f(g()); | ^^^ function called here @@ -8,7 +8,7 @@ LL | f(g()); = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) error: this function call requires the `avx` target feature, which is not enabled in the caller - --> $DIR/simd-abi-checks-avx.rs:59:9 + --> $DIR/simd-abi-checks-avx.rs:58:9 | LL | f(g()); | ^^^^^^ function called here @@ -17,7 +17,7 @@ LL | f(g()); = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) error: this function call requires the `avx` target feature, which is not enabled in the caller - --> $DIR/simd-abi-checks-avx.rs:65:14 + --> $DIR/simd-abi-checks-avx.rs:64:14 | LL | gavx(favx()); | ^^^^^^ function called here @@ -26,7 +26,7 @@ LL | gavx(favx()); = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) error: this function call requires the `avx` target feature, which is not enabled in the caller - --> $DIR/simd-abi-checks-avx.rs:65:9 + --> $DIR/simd-abi-checks-avx.rs:64:9 | LL | gavx(favx()); | ^^^^^^^^^^^^ function called here @@ -35,7 +35,7 @@ LL | gavx(favx()); = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) error: this function call requires the `avx` target feature, which is not enabled in the caller - --> $DIR/simd-abi-checks-avx.rs:75:19 + --> $DIR/simd-abi-checks-avx.rs:74:19 | LL | w(Wrapper(g())); | ^^^ function called here @@ -44,7 +44,7 @@ LL | w(Wrapper(g())); = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) error: this function call requires the `avx` target feature, which is not enabled in the caller - --> $DIR/simd-abi-checks-avx.rs:75:9 + --> $DIR/simd-abi-checks-avx.rs:74:9 | LL | w(Wrapper(g())); | ^^^^^^^^^^^^^^^ function called here @@ -53,7 +53,7 @@ LL | w(Wrapper(g())); = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) error: this function call requires the `avx` target feature, which is not enabled in the caller - --> $DIR/simd-abi-checks-avx.rs:89:9 + --> $DIR/simd-abi-checks-avx.rs:87:9 | LL | some_extern(); | ^^^^^^^^^^^^^ function called here @@ -62,7 +62,7 @@ LL | some_extern(); = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) error: this function definition requires the `avx` target feature, which is not enabled - --> $DIR/simd-abi-checks-avx.rs:24:1 + --> $DIR/simd-abi-checks-avx.rs:23:1 | LL | unsafe extern "C" fn g() -> __m256 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -71,7 +71,7 @@ LL | unsafe extern "C" fn g() -> __m256 { = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) error: this function definition requires the `avx` target feature, which is not enabled - --> $DIR/simd-abi-checks-avx.rs:19:1 + --> $DIR/simd-abi-checks-avx.rs:18:1 | LL | unsafe extern "C" fn f(_: __m256) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -80,7 +80,7 @@ LL | unsafe extern "C" fn f(_: __m256) { = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) error: this function definition requires the `avx` target feature, which is not enabled - --> $DIR/simd-abi-checks-avx.rs:14:1 + --> $DIR/simd-abi-checks-avx.rs:13:1 | LL | unsafe extern "C" fn w(_: Wrapper) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -89,7 +89,7 @@ LL | unsafe extern "C" fn w(_: Wrapper) { = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) error: this function call requires the `avx` target feature, which is not enabled in the caller - --> $DIR/simd-abi-checks-avx.rs:53:8 + --> $DIR/simd-abi-checks-avx.rs:52:8 | LL | || g() | ^^^ function called here @@ -98,7 +98,7 @@ LL | || g() = help: consider enabling the missing target feature globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`) note: the above error was encountered while instantiating `fn in_closure::{closure#0}` - --> $DIR/simd-abi-checks-avx.rs:81:9 + --> $DIR/simd-abi-checks-avx.rs:80:9 | LL | in_closure()(); | ^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/simd-abi-checks-empty-list.rs b/tests/ui/abi/simd-abi-checks-empty-list.rs index 52e588b028bd2..321aafe2d38f5 100644 --- a/tests/ui/abi/simd-abi-checks-empty-list.rs +++ b/tests/ui/abi/simd-abi-checks-empty-list.rs @@ -11,6 +11,5 @@ extern crate minicore; use minicore::simd::Simd; -#[expect(improper_ctypes_definitions)] pub extern "C" fn pass_by_vec(_: Simd) {} //~^ ERROR: this function definition uses SIMD vector type `Simd` which is not currently supported with the chosen ABI diff --git a/tests/ui/abi/simd-abi-checks-empty-list.stderr b/tests/ui/abi/simd-abi-checks-empty-list.stderr index e19c775eee750..457df2e439c68 100644 --- a/tests/ui/abi/simd-abi-checks-empty-list.stderr +++ b/tests/ui/abi/simd-abi-checks-empty-list.stderr @@ -1,5 +1,5 @@ error: this function definition uses SIMD vector type `Simd` which is not currently supported with the chosen ABI - --> $DIR/simd-abi-checks-empty-list.rs:15:1 + --> $DIR/simd-abi-checks-empty-list.rs:14:1 | LL | pub extern "C" fn pass_by_vec(_: Simd) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here diff --git a/tests/ui/abi/simd-abi-checks-s390x.rs b/tests/ui/abi/simd-abi-checks-s390x.rs index 95028b8286d55..d5c3d020547f5 100644 --- a/tests/ui/abi/simd-abi-checks-s390x.rs +++ b/tests/ui/abi/simd-abi-checks-s390x.rs @@ -15,7 +15,6 @@ #![feature(no_core)] #![no_core] #![crate_type = "lib"] -#![expect(improper_ctypes_definitions)] extern crate minicore; use minicore::simd::*; diff --git a/tests/ui/abi/simd-abi-checks-s390x.z10.stderr b/tests/ui/abi/simd-abi-checks-s390x.z10.stderr index 492066310c246..ea9aeeedbd2a2 100644 --- a/tests/ui/abi/simd-abi-checks-s390x.z10.stderr +++ b/tests/ui/abi/simd-abi-checks-s390x.z10.stderr @@ -1,5 +1,5 @@ error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:33:1 + --> $DIR/simd-abi-checks-s390x.rs:32:1 | LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -8,7 +8,7 @@ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:38:1 + --> $DIR/simd-abi-checks-s390x.rs:37:1 | LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -17,7 +17,7 @@ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:84:1 + --> $DIR/simd-abi-checks-s390x.rs:83:1 | LL | / extern "C" fn vector_transparent_wrapper_ret_small( LL | | x: &TransparentWrapper, @@ -28,7 +28,7 @@ LL | | ) -> TransparentWrapper { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:91:1 + --> $DIR/simd-abi-checks-s390x.rs:90:1 | LL | / extern "C" fn vector_transparent_wrapper_ret( LL | | x: &TransparentWrapper, @@ -39,7 +39,7 @@ LL | | ) -> TransparentWrapper { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:106:1 + --> $DIR/simd-abi-checks-s390x.rs:105:1 | LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -48,7 +48,7 @@ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:111:1 + --> $DIR/simd-abi-checks-s390x.rs:110:1 | LL | extern "C" fn vector_arg(x: i8x16) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -57,7 +57,7 @@ LL | extern "C" fn vector_arg(x: i8x16) -> i64 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:122:1 + --> $DIR/simd-abi-checks-s390x.rs:121:1 | LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -66,7 +66,7 @@ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper) -> i64 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:127:1 + --> $DIR/simd-abi-checks-s390x.rs:126:1 | LL | extern "C" fn vector_wrapper_arg(x: Wrapper) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -75,7 +75,7 @@ LL | extern "C" fn vector_wrapper_arg(x: Wrapper) -> i64 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:138:1 + --> $DIR/simd-abi-checks-s390x.rs:137:1 | LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -84,7 +84,7 @@ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper $DIR/simd-abi-checks-s390x.rs:143:1 + --> $DIR/simd-abi-checks-s390x.rs:142:1 | LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here diff --git a/tests/ui/abi/simd-abi-checks-s390x.z13_no_vector.stderr b/tests/ui/abi/simd-abi-checks-s390x.z13_no_vector.stderr index 492066310c246..ea9aeeedbd2a2 100644 --- a/tests/ui/abi/simd-abi-checks-s390x.z13_no_vector.stderr +++ b/tests/ui/abi/simd-abi-checks-s390x.z13_no_vector.stderr @@ -1,5 +1,5 @@ error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:33:1 + --> $DIR/simd-abi-checks-s390x.rs:32:1 | LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -8,7 +8,7 @@ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:38:1 + --> $DIR/simd-abi-checks-s390x.rs:37:1 | LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -17,7 +17,7 @@ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:84:1 + --> $DIR/simd-abi-checks-s390x.rs:83:1 | LL | / extern "C" fn vector_transparent_wrapper_ret_small( LL | | x: &TransparentWrapper, @@ -28,7 +28,7 @@ LL | | ) -> TransparentWrapper { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:91:1 + --> $DIR/simd-abi-checks-s390x.rs:90:1 | LL | / extern "C" fn vector_transparent_wrapper_ret( LL | | x: &TransparentWrapper, @@ -39,7 +39,7 @@ LL | | ) -> TransparentWrapper { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:106:1 + --> $DIR/simd-abi-checks-s390x.rs:105:1 | LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -48,7 +48,7 @@ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:111:1 + --> $DIR/simd-abi-checks-s390x.rs:110:1 | LL | extern "C" fn vector_arg(x: i8x16) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -57,7 +57,7 @@ LL | extern "C" fn vector_arg(x: i8x16) -> i64 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:122:1 + --> $DIR/simd-abi-checks-s390x.rs:121:1 | LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -66,7 +66,7 @@ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper) -> i64 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:127:1 + --> $DIR/simd-abi-checks-s390x.rs:126:1 | LL | extern "C" fn vector_wrapper_arg(x: Wrapper) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -75,7 +75,7 @@ LL | extern "C" fn vector_wrapper_arg(x: Wrapper) -> i64 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:138:1 + --> $DIR/simd-abi-checks-s390x.rs:137:1 | LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -84,7 +84,7 @@ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper $DIR/simd-abi-checks-s390x.rs:143:1 + --> $DIR/simd-abi-checks-s390x.rs:142:1 | LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here diff --git a/tests/ui/abi/simd-abi-checks-s390x.z13_soft_float.stderr b/tests/ui/abi/simd-abi-checks-s390x.z13_soft_float.stderr index 8c05e2daffa98..7cda73c5201a2 100644 --- a/tests/ui/abi/simd-abi-checks-s390x.z13_soft_float.stderr +++ b/tests/ui/abi/simd-abi-checks-s390x.z13_soft_float.stderr @@ -9,7 +9,7 @@ warning: target feature `soft-float` must be disabled to ensure that the ABI of = note: for more information, see issue #162235 error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:33:1 + --> $DIR/simd-abi-checks-s390x.rs:32:1 | LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -18,7 +18,7 @@ LL | extern "C" fn vector_ret_small(x: &i8x8) -> i8x8 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:38:1 + --> $DIR/simd-abi-checks-s390x.rs:37:1 | LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -27,7 +27,7 @@ LL | extern "C" fn vector_ret(x: &i8x16) -> i8x16 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:84:1 + --> $DIR/simd-abi-checks-s390x.rs:83:1 | LL | / extern "C" fn vector_transparent_wrapper_ret_small( LL | | x: &TransparentWrapper, @@ -38,7 +38,7 @@ LL | | ) -> TransparentWrapper { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:91:1 + --> $DIR/simd-abi-checks-s390x.rs:90:1 | LL | / extern "C" fn vector_transparent_wrapper_ret( LL | | x: &TransparentWrapper, @@ -49,7 +49,7 @@ LL | | ) -> TransparentWrapper { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:106:1 + --> $DIR/simd-abi-checks-s390x.rs:105:1 | LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -58,7 +58,7 @@ LL | extern "C" fn vector_arg_small(x: i8x8) -> i64 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:111:1 + --> $DIR/simd-abi-checks-s390x.rs:110:1 | LL | extern "C" fn vector_arg(x: i8x16) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -67,7 +67,7 @@ LL | extern "C" fn vector_arg(x: i8x16) -> i64 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:122:1 + --> $DIR/simd-abi-checks-s390x.rs:121:1 | LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -76,7 +76,7 @@ LL | extern "C" fn vector_wrapper_arg_small(x: Wrapper) -> i64 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:127:1 + --> $DIR/simd-abi-checks-s390x.rs:126:1 | LL | extern "C" fn vector_wrapper_arg(x: Wrapper) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -85,7 +85,7 @@ LL | extern "C" fn vector_wrapper_arg(x: Wrapper) -> i64 { = help: consider enabling the missing target feature globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`) error: this function definition requires the `vector` target feature, which is not enabled - --> $DIR/simd-abi-checks-s390x.rs:138:1 + --> $DIR/simd-abi-checks-s390x.rs:137:1 | LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here @@ -94,7 +94,7 @@ LL | extern "C" fn vector_transparent_wrapper_arg_small(x: TransparentWrapper $DIR/simd-abi-checks-s390x.rs:143:1 + --> $DIR/simd-abi-checks-s390x.rs:142:1 | LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper) -> i64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here diff --git a/tests/ui/abi/simd-abi-checks-sse.rs b/tests/ui/abi/simd-abi-checks-sse.rs index 4ed4b78166f9e..97dcd2b6d6ef2 100644 --- a/tests/ui/abi/simd-abi-checks-sse.rs +++ b/tests/ui/abi/simd-abi-checks-sse.rs @@ -9,7 +9,6 @@ //@ dont-require-annotations: NOTE #![feature(no_core)] #![no_core] -#![expect(improper_ctypes_definitions)] extern crate minicore; use minicore::simd::Simd; diff --git a/tests/ui/abi/simd-abi-checks-sse.stderr b/tests/ui/abi/simd-abi-checks-sse.stderr index 91f3f851fa2ca..cba48a6ce4584 100644 --- a/tests/ui/abi/simd-abi-checks-sse.stderr +++ b/tests/ui/abi/simd-abi-checks-sse.stderr @@ -1,5 +1,5 @@ error: this function definition requires the `sse` target feature, which is not enabled - --> $DIR/simd-abi-checks-sse.rs:18:1 + --> $DIR/simd-abi-checks-sse.rs:17:1 | LL | pub unsafe extern "C" fn f(_: Simd) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here diff --git a/tests/ui/codegen/deprecated-llvm-intrinsic.rs b/tests/ui/codegen/deprecated-llvm-intrinsic.rs index 0481f37a627b3..ec2a6c1a84716 100644 --- a/tests/ui/codegen/deprecated-llvm-intrinsic.rs +++ b/tests/ui/codegen/deprecated-llvm-intrinsic.rs @@ -6,7 +6,7 @@ #![feature(no_core, lang_items, link_llvm_intrinsics, simd_ffi)] #![no_std] #![no_core] -#![allow(internal_features, non_camel_case_types, improper_ctypes)] +#![allow(internal_features, non_camel_case_types)] #![crate_type = "lib"] extern crate minicore; diff --git a/tests/ui/target-feature/llvm-target-feature.rs b/tests/ui/target-feature/llvm-target-feature.rs index 6b94574d3a8e4..111e4a98054d0 100644 --- a/tests/ui/target-feature/llvm-target-feature.rs +++ b/tests/ui/target-feature/llvm-target-feature.rs @@ -13,7 +13,6 @@ #![feature(no_core, intrinsics, rustc_attrs)] #![no_core] -#![allow(improper_ctypes_definitions)] extern crate minicore; use minicore::*; From 664e1348191ea75d807c5083956e6f300bb5427b Mon Sep 17 00:00:00 2001 From: Augie Fackler Date: Fri, 23 Oct 2026 17:28:44 -0400 Subject: [PATCH 4/7] PassWrapper: stop setting Options.ExceptionModel on LLVM 24 We already set the module flag, so all we have to do is move the #endif from a few lines earlier. The struct member no longer exists in LLVM 24. --- compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index ffcef6df06e4f..1b18b1f06674c 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -420,10 +420,10 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( if (Singlethread) { Options.ThreadModel = ThreadModel::Single; } -#endif if (UseWasmEH) Options.ExceptionModel = ExceptionHandling::Wasm; +#endif Options.EmitStackSizeSection = EmitStackSizeSection; From e08a84a4f365cfa65bd70c7c0564adfb75f5318d Mon Sep 17 00:00:00 2001 From: sleepycatcoding <131554884+sleepycatcoding@users.noreply.github.com> Date: Sat, 24 Oct 2026 13:22:01 +0300 Subject: [PATCH 5/7] add tracking issue for `#![feature(char_is_xid)]` --- library/core/src/char/methods.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index 12eb4b8373d99..2a7b088070bd6 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -1120,7 +1120,7 @@ impl char { /// assert!(!' '.is_xid_continue()); /// ``` #[must_use] - #[unstable(feature = "char_is_xid", issue = "none", reason = "to be created")] + #[unstable(feature = "char_is_xid", issue = "164841")] #[inline] pub fn is_xid_continue(self) -> bool { match self { @@ -1157,7 +1157,7 @@ impl char { /// assert!(!'_'.is_xid_start()); /// ``` #[must_use] - #[unstable(feature = "char_is_xid", issue = "none", reason = "to be created")] + #[unstable(feature = "char_is_xid", issue = "164841")] #[inline] pub fn is_xid_start(self) -> bool { match self { From 43f527a9946d04f4c2508582b9b61ad05cbd3375 Mon Sep 17 00:00:00 2001 From: Max Dexheimer Date: Mon, 19 Oct 2026 13:17:40 +0200 Subject: [PATCH 6/7] Remove remaining mentions of `Unique` --- library/alloc/src/boxed.rs | 2 -- library/core/src/panic/unwind_safe.rs | 1 - src/etc/gdb_providers.py | 18 ++++++++++-------- src/etc/lldb_providers.py | 18 ++++++++++-------- src/etc/natvis/libcore.natvis | 7 ------- .../nullable-pointer-opt-closures.rs | 4 ++-- tests/ui/print_type_sizes/niche-filling.rs | 2 +- 7 files changed, 23 insertions(+), 29 deletions(-) diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs index 1c5718473a06b..f4d1d6ff0986f 100644 --- a/library/alloc/src/boxed.rs +++ b/library/alloc/src/boxed.rs @@ -2431,8 +2431,6 @@ impl fmt::Debug for Box { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Pointer for Box { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - // It's not possible to extract the inner Uniq directly from the Box, - // instead we cast it to a *const which aliases the Unique let ptr: *const T = &**self; fmt::Pointer::fmt(&ptr, f) } diff --git a/library/core/src/panic/unwind_safe.rs b/library/core/src/panic/unwind_safe.rs index 79141ec4370d7..301336fda074c 100644 --- a/library/core/src/panic/unwind_safe.rs +++ b/library/core/src/panic/unwind_safe.rs @@ -174,7 +174,6 @@ pub struct AssertUnwindSafe(#[stable(feature = "catch_unwind", since = "1.9.0 // // * By default everything is unwind safe // * pointers T contains mutability of some form are not unwind safe -// * Unique, an owning pointer, lifts an implementation // * Types like Mutex/RwLock which are explicitly poisoned are unwind safe // * Our custom AssertUnwindSafe wrapper is indeed unwind safe diff --git a/src/etc/gdb_providers.py b/src/etc/gdb_providers.py index 9c50d7e472000..f04bace1ebcd9 100644 --- a/src/etc/gdb_providers.py +++ b/src/etc/gdb_providers.py @@ -9,12 +9,14 @@ FIRST_FIELD = "__1" -def unwrap_unique_or_non_null(unique_or_nonnull): +# Gets the raw pointer out of a `NonNull` or a wrapper struct with a +# `pointer: NonNull` field (with that exact name) +def unwrap_non_null_or_wrapper(ptr): # BACKCOMPAT: rust 1.32 # https://github.com/rust-lang/rust/commit/7a0911528058e87d22ea305695f4047572c5e067 # BACKCOMPAT: rust 1.60 # https://github.com/rust-lang/rust/commit/2a91eeac1a2d27dd3de1bf55515d765da20fd86f - ptr = unique_or_nonnull["pointer"] + ptr = ptr["pointer"] return ptr if ptr.type.code == gdb.TYPE_CODE_PTR else ptr[ptr.type.fields()[0]] @@ -62,7 +64,7 @@ def __init__(self, valobj): self._valobj = valobj vec = valobj["vec"] self._length = int(vec["len"]) - self._data_ptr = unwrap_unique_or_non_null(vec["buf"]["inner"]["ptr"]) + self._data_ptr = unwrap_non_null_or_wrapper(vec["buf"]["inner"]["ptr"]) def to_string(self): return self._data_ptr.lazy_string(encoding="utf-8", length=self._length) @@ -80,7 +82,7 @@ def __init__(self, valobj): vec = buf["bytes"] if is_windows else buf self._length = int(vec["len"]) - self._data_ptr = unwrap_unique_or_non_null(vec["buf"]["inner"]["ptr"]) + self._data_ptr = unwrap_non_null_or_wrapper(vec["buf"]["inner"]["ptr"]) def to_string(self): return self._data_ptr.lazy_string(encoding="utf-8", length=self._length) @@ -160,7 +162,7 @@ class StdVecProvider(printer_base): def __init__(self, valobj): self._valobj = valobj self._length = int(valobj["len"]) - self._data_ptr = unwrap_unique_or_non_null(valobj["buf"]["inner"]["ptr"]) + self._data_ptr = unwrap_non_null_or_wrapper(valobj["buf"]["inner"]["ptr"]) ptr_ty = gdb.Type.pointer(valobj.type.template_argument(0)) self._data_ptr = self._data_ptr.reinterpret_cast(ptr_ty) @@ -196,7 +198,7 @@ def __init__(self, valobj): if cap.type.code != gdb.TYPE_CODE_INT: cap = cap[ZERO_FIELD] self._cap = int(cap) - self._data_ptr = unwrap_unique_or_non_null(valobj["buf"]["inner"]["ptr"]) + self._data_ptr = unwrap_non_null_or_wrapper(valobj["buf"]["inner"]["ptr"]) ptr_ty = gdb.Type.pointer(valobj.type.template_argument(0)) self._data_ptr = self._data_ptr.reinterpret_cast(ptr_ty) @@ -221,7 +223,7 @@ class StdRcProvider(printer_base): def __init__(self, valobj, is_atomic=False): self._valobj = valobj self._is_atomic = is_atomic - self._ptr = unwrap_unique_or_non_null(valobj["ptr"]) + self._ptr = unwrap_non_null_or_wrapper(valobj["ptr"]) self._value = self._ptr["data" if is_atomic else "value"] # FIXME(shua): the debuginfo template type should be 'str' not 'u8' if self._ptr.type.target().name == "alloc::rc::RcInner": @@ -321,7 +323,7 @@ def cast_to_internal(node): if node_ptr.type.name.startswith("alloc::collections::btree::node::BoxedNode<"): # BACKCOMPAT: rust 1.49 node_ptr = node_ptr["ptr"] - node_ptr = unwrap_unique_or_non_null(node_ptr) + node_ptr = unwrap_non_null_or_wrapper(node_ptr) leaf = node_ptr.dereference() keys = leaf["keys"] vals = leaf["vals"] diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py index 10557e8cb351c..1bb4883db8de2 100644 --- a/src/etc/lldb_providers.py +++ b/src/etc/lldb_providers.py @@ -161,12 +161,14 @@ def from_uint(self, name: str, value: int) -> SBValue: return self.valobj.CreateValueFromData(name, data, type) -def unwrap_unique_or_non_null(unique_or_nonnull: SBValue) -> SBValue: +# Gets the raw pointer out of a `NonNull` or a wrapper struct with a +# `pointer: NonNull` field (with that exact name) +def unwrap_non_null_or_wrapper(ptr: SBValue) -> SBValue: # BACKCOMPAT: rust 1.32 # https://github.com/rust-lang/rust/commit/7a0911528058e87d22ea305695f4047572c5e067 # BACKCOMPAT: rust 1.60 # https://github.com/rust-lang/rust/commit/2a91eeac1a2d27dd3de1bf55515d765da20fd86f - ptr = unique_or_nonnull.GetChildMemberWithName("pointer") + ptr = ptr.GetChildMemberWithName("pointer") return ptr if ptr.TypeIsPointerType() else ptr.GetChildAtIndex(0) @@ -417,7 +419,7 @@ def StdStringSummaryProvider(valobj: SBValue, dict: LLDBOpaque): .GetNonSyntheticValue() ) - pointer = unwrap_unique_or_non_null( + pointer = unwrap_non_null_or_wrapper( inner_vec.GetChildMemberWithName("buf") .GetChildMemberWithName("inner") .GetChildMemberWithName("ptr") @@ -453,7 +455,7 @@ def StdOsStringSummaryProvider(valobj: SBValue, _dict: LLDBOpaque) -> str: if is_windows: inner_vec = inner_vec.GetChildAtIndex(0) - pointer = unwrap_unique_or_non_null( + pointer = unwrap_non_null_or_wrapper( inner_vec.GetChildMemberWithName("buf") .GetChildMemberWithName("inner") .GetChildMemberWithName("ptr") @@ -614,7 +616,7 @@ def __init__(self, valobj: SBValue, _dict: LLDBOpaque): def update(self): inner_vec = self.valobj.GetChildMemberWithName("vec").GetNonSyntheticValue() - self.data_ptr = unwrap_unique_or_non_null( + self.data_ptr = unwrap_non_null_or_wrapper( inner_vec.GetChildMemberWithName("buf") .GetChildMemberWithName("inner") .GetChildMemberWithName("ptr") @@ -1158,7 +1160,7 @@ def get_child_at_index(self, index: int) -> Optional[SBValue]: def update(self): buf: SBValue = self.valobj.GetChildMemberWithName("buf") - self.data_ptr = unwrap_unique_or_non_null( + self.data_ptr = unwrap_non_null_or_wrapper( buf.GetChildMemberWithName("inner").GetChildMemberWithName("ptr") ) @@ -1333,7 +1335,7 @@ def update(self): cap = cap.GetChildAtIndex(0) self.cap = cap.GetValueAsUnsigned() - self.data_ptr = unwrap_unique_or_non_null( + self.data_ptr = unwrap_non_null_or_wrapper( self.buf.GetChildMemberWithName("ptr") ) @@ -1569,7 +1571,7 @@ class StdRcSyntheticProvider: def __init__(self, valobj: SBValue, _dict: LLDBOpaque, is_atomic: bool = False): self.valobj = valobj - self.ptr = unwrap_unique_or_non_null(self.valobj.GetChildMemberWithName("ptr")) + self.ptr = unwrap_non_null_or_wrapper(self.valobj.GetChildMemberWithName("ptr")) self.value = self.ptr.GetChildMemberWithName("data" if is_atomic else "value") diff --git a/src/etc/natvis/libcore.natvis b/src/etc/natvis/libcore.natvis index 20ce1cae447cf..23c061e2ab8d0 100644 --- a/src/etc/natvis/libcore.natvis +++ b/src/etc/natvis/libcore.natvis @@ -82,13 +82,6 @@ - - Unique({(void*)pointer.pointer}: {pointer.pointer}) - - pointer - - - {(bool)v.value.__0} diff --git a/tests/ui/functions-closures/nullable-pointer-opt-closures.rs b/tests/ui/functions-closures/nullable-pointer-opt-closures.rs index 2cafe1b7aba8a..343e92a5c269b 100644 --- a/tests/ui/functions-closures/nullable-pointer-opt-closures.rs +++ b/tests/ui/functions-closures/nullable-pointer-opt-closures.rs @@ -19,10 +19,10 @@ pub fn main() { assert_eq!(mem::size_of_val(&b), mem::size_of::>()); // By Value Capture - Transitive case - let a = "Hello".to_string(); // String -> Vec -> Unique -> NonZero + let a = "Hello".to_string(); // String -> Vec -> NonNull let b = Some(move || println!("{}", a)); // We captured `a` by value and since down the chain it contains - // a `NonZero` field, we can use it as the discriminant. + // a `NonNull` field, we can use it as the discriminant. assert_eq!(mem::size_of_val(&b), mem::size_of::()); // By Value - No Optimization diff --git a/tests/ui/print_type_sizes/niche-filling.rs b/tests/ui/print_type_sizes/niche-filling.rs index 1bcbdf2a999c1..2fcb1dfe3c8c2 100644 --- a/tests/ui/print_type_sizes/niche-filling.rs +++ b/tests/ui/print_type_sizes/niche-filling.rs @@ -1,7 +1,7 @@ //! This file illustrates how niche-filling enums are handled, //! modelled after cases like `Option<&u32>`, `Option` and such. //! -//! It uses `NonZero` rather than `&_` or `Unique<_>`, because +//! It uses `NonZero` rather than `&_` or `NonNull<_>`, because //! the test is not set up to deal with target-dependent pointer width. //! //! It avoids using `u64`/`i64` because on some targets that is only 4-byte From 46bc91686d3f6ec3f1da5d62f2f0811b94ae0ca3 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sat, 24 Oct 2026 15:57:45 +0200 Subject: [PATCH 7/7] Stop mangling rust_eh_personality again for now Some projects manually define rust_eh_personality as they use no_std on a target where libcore is compiled with panic=unwind and thus need rust_eh_personality to be present while it is only defined in libstd. These projects don't want to use unstable features and thus can't use a proper #[lang = "eh_personality"]. --- compiler/rustc_symbol_mangling/src/v0.rs | 7 +++++++ tests/run-make/symbols-all-mangled/rmake.rs | 4 ++++ tests/ui/sanitizer/dataflow-abilist.txt | 1 + 3 files changed, 12 insertions(+) diff --git a/compiler/rustc_symbol_mangling/src/v0.rs b/compiler/rustc_symbol_mangling/src/v0.rs index 3ead7dd7baf38..7bab29c658e66 100644 --- a/compiler/rustc_symbol_mangling/src/v0.rs +++ b/compiler/rustc_symbol_mangling/src/v0.rs @@ -132,6 +132,13 @@ pub fn eh_personality_symbol<'tcx>(tcx: TyCtxt<'tcx>) -> String { pub fn mangle_internal_symbol<'tcx>(tcx: TyCtxt<'tcx>, item_name: &str) -> String { match item_name { + // Some projects manually define rust_eh_personality as they use no_std on a target where + // libcore is compiled with panic=unwind and thus need rust_eh_personality to be present + // while it is only defined in libstd. These projects don't want to use unstable features + // and thus can't use a proper #[lang = "eh_personality"] + // FIXME mangle again once no_std on a target with std support doesn't need it or build-std + // is possible on stable for non-Cargo build systems. + "rust_eh_personality" => return item_name.to_owned(), // Apple availability symbols need to not be mangled to be usable by // C/Objective-C code. "__isPlatformVersionAtLeast" | "__isOSVersionAtLeast" => return item_name.to_owned(), diff --git a/tests/run-make/symbols-all-mangled/rmake.rs b/tests/run-make/symbols-all-mangled/rmake.rs index 99281d8be3bbf..41f857c896aa9 100644 --- a/tests/run-make/symbols-all-mangled/rmake.rs +++ b/tests/run-make/symbols-all-mangled/rmake.rs @@ -34,6 +34,10 @@ fn is_symbol_ok(sym: &str) -> bool { return true; } + if sym == "rust_eh_personality" { + return true; // Unfortunately we have to not mangle this for now + } + false } diff --git a/tests/ui/sanitizer/dataflow-abilist.txt b/tests/ui/sanitizer/dataflow-abilist.txt index 0e9b643c98254..1fa78ebd55939 100644 --- a/tests/ui/sanitizer/dataflow-abilist.txt +++ b/tests/ui/sanitizer/dataflow-abilist.txt @@ -494,4 +494,5 @@ fun:_ZN4core*=uninstrumented fun:_R*4core*=uninstrumented fun:_ZN3std*=uninstrumented fun:_R*3std*=uninstrumented +fun:rust_eh_personality=uninstrumented fun:_R*__rustc*=uninstrumented