From 42f6596205035ba50520a2c155a921bf386e406f Mon Sep 17 00:00:00 2001 From: Leonard Chan Date: Thu, 27 Aug 2026 20:39:08 +0000 Subject: [PATCH 1/2] compiler: Make +fix-cortex-a53-835769 a default feature for aarch64 fuchsia This matches the default target features for aarch64 fuchsia emitted by clang. --- .../src/spec/targets/aarch64_unknown_fuchsia.rs | 2 +- .../aarch64-fuchsia-target-features.rs | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tests/codegen-llvm/aarch64-fuchsia-target-features.rs diff --git a/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs b/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs index d16110cfd66f9..8dede888055f7 100644 --- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs +++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs @@ -5,7 +5,7 @@ use crate::spec::{ pub(crate) fn target() -> Target { let mut base = base::fuchsia::opts(); base.cpu = "generic".into(); - base.features = "+v8a,+crc,+aes,+sha2,+neon".into(); + base.features = "+v8a,+crc,+aes,+sha2,+neon,+fix-cortex-a53-835769".into(); base.max_atomic_width = Some(128); base.stack_probes = StackProbeType::Inline; base.supported_sanitizers = SanitizerSet::ADDRESS diff --git a/tests/codegen-llvm/aarch64-fuchsia-target-features.rs b/tests/codegen-llvm/aarch64-fuchsia-target-features.rs new file mode 100644 index 0000000000000..32cdc2ce8a553 --- /dev/null +++ b/tests/codegen-llvm/aarch64-fuchsia-target-features.rs @@ -0,0 +1,14 @@ +//@ add-minicore +//@ compile-flags: --crate-type=rlib --target=aarch64-unknown-fuchsia +//@ needs-llvm-components: aarch64 + +// CHECK: attributes #0 = { {{.*}}"target-features"="{{.*}}+fix-cortex-a53-835769{{.*}}" } + +#![feature(no_core, lang_items)] +#![no_core] + +extern crate minicore; +use minicore::*; + +#[no_mangle] +pub fn test() {} From b5e7cbfb9b588982a93a0ec322e26d0dbee8cdc1 Mon Sep 17 00:00:00 2001 From: mehdiakiki Date: Mon, 24 Aug 2026 19:27:25 +0100 Subject: [PATCH 2/2] Allow Unpin impls for local extern type --- .../src/coherence/builtin.rs | 2 ++ tests/crashes/155053.rs | 11 ----------- .../pin-ergonomics/impl-unpin-extern-type.rs | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 11 deletions(-) delete mode 100644 tests/crashes/155053.rs create mode 100644 tests/ui/pin-ergonomics/impl-unpin-extern-type.rs diff --git a/compiler/rustc_hir_analysis/src/coherence/builtin.rs b/compiler/rustc_hir_analysis/src/coherence/builtin.rs index 34a3f155baf43..f7faefa240abe 100644 --- a/compiler/rustc_hir_analysis/src/coherence/builtin.rs +++ b/compiler/rustc_hir_analysis/src/coherence/builtin.rs @@ -153,6 +153,8 @@ fn visit_implementation_of_unpin(checker: &Checker<'_>) -> Result<(), ErrorGuara })); } ty::Adt(_, _) => {} + // `extern type`s have no fields, so they can't be structurally pinned. + ty::Foreign(_) => {} _ => { return Err(tcx.dcx().span_delayed_bug(span, "impl of `Unpin` for a non-adt type")); } diff --git a/tests/crashes/155053.rs b/tests/crashes/155053.rs deleted file mode 100644 index 31b9ccaf20540..0000000000000 --- a/tests/crashes/155053.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ known-bug: #155053 -#![feature(pin_ergonomics)] -#![feature(extern_types)] - -unsafe extern "C" { - type ExternType; -} - -impl Unpin for ExternType {} - -fn main() {} diff --git a/tests/ui/pin-ergonomics/impl-unpin-extern-type.rs b/tests/ui/pin-ergonomics/impl-unpin-extern-type.rs new file mode 100644 index 0000000000000..953c71ea84311 --- /dev/null +++ b/tests/ui/pin-ergonomics/impl-unpin-extern-type.rs @@ -0,0 +1,18 @@ +//! Verify that a local `extern type` can manually implement `Unpin` with `pin_ergonomics` enabled. +//! Unlike a `#[pin_v2]` ADT, an extern type has no fields that could be structually pinned. +//! +//! Regression test for . + +//@ check-pass + +#![feature(pin_ergonomics)] +#![feature(extern_types)] +#![allow(incomplete_features)] + +unsafe extern "C" { + type ExternType; +} + +impl Unpin for ExternType {} + +fn main() {}