From 5e698662cdddb6a53c724b301989553e54b27936 Mon Sep 17 00:00:00 2001 From: Jean IBARZ Date: Sun, 29 Mar 2026 14:15:38 +0200 Subject: [PATCH 1/4] Add regression test for TransmuteFrom ICE with min_generic_const_args Exercises TransmuteFrom with min_generic_const_args, which previously caused an ICE in well-formedness checking. --- .../transmute-from-const-args-ice-150457.rs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/ui/transmutability/transmute-from-const-args-ice-150457.rs diff --git a/tests/ui/transmutability/transmute-from-const-args-ice-150457.rs b/tests/ui/transmutability/transmute-from-const-args-ice-150457.rs new file mode 100644 index 000000000000..8c1b709127b0 --- /dev/null +++ b/tests/ui/transmutability/transmute-from-const-args-ice-150457.rs @@ -0,0 +1,31 @@ +//! Ensure `TransmuteFrom` with `min_generic_const_args` doesn't ICE +//! during well-formedness checking. +//! +//! Regression test for . + +//@ check-pass + +#![feature(transmutability)] +#![feature(min_generic_const_args)] + +use std::mem::{Assume, TransmuteFrom}; + +struct W<'a>(&'a ()); + +fn test<'a>() +where + W<'a>: TransmuteFrom< + (), + { + Assume { + alignment: const { true }, + lifetimes: const { true }, + safety: const { true }, + validity: true, + } + }, + >, +{ +} + +fn main() {} From dae0c011084c7877b47dda1e7514fa7685c94e9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 29 Mar 2026 18:25:55 +0000 Subject: [PATCH 2/4] Tweak wording of E0275 WF errors Modify the main error message to read better: ``` error[E0275]: overflow evaluating whether `&'a mut Bar` is well-formed ``` --- .../src/error_reporting/traits/overflow.rs | 9 +++++++++ tests/ui/associated-types/issue-64855-2.rs | 2 +- tests/ui/associated-types/issue-64855-2.stderr | 2 +- tests/ui/associated-types/issue-64855.rs | 2 +- tests/ui/associated-types/issue-64855.stderr | 2 +- .../const-generics/generic_const_exprs/adt_wf_hang.rs | 2 +- .../generic_const_exprs/adt_wf_hang.stderr | 2 +- .../ui/const-generics/mgca/const-ctor-overflow-eval.rs | 10 +++++----- .../mgca/const-ctor-overflow-eval.stderr | 10 +++++----- tests/ui/higher-ranked/trait-bounds/issue-95230.rs | 2 +- tests/ui/higher-ranked/trait-bounds/issue-95230.stderr | 2 +- tests/ui/traits/next-solver/alias-bound-unsound.rs | 4 ++-- tests/ui/traits/next-solver/alias-bound-unsound.stderr | 4 ++-- .../item-bound-via-impl-where-clause.next.stderr | 2 +- .../coinduction/item-bound-via-impl-where-clause.rs | 2 +- .../next-solver/normalize/normalize-param-env-2.stderr | 2 +- 16 files changed, 34 insertions(+), 25 deletions(-) diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/overflow.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/overflow.rs index a0876d8fe759..a543f549bdae 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/overflow.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/overflow.rs @@ -99,6 +99,15 @@ fn with_short_path<'tcx, T>(tcx: TyCtxt<'tcx>, value: T) -> String "overflow assigning `{a}` to `{b}`", ) } + ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(term)) => { + let term = with_short_path(self.tcx, term); + struct_span_code_err!( + self.dcx(), + span, + E0275, + "overflow evaluating whether `{term}` is well-formed", + ) + } _ => { let pred_str = with_short_path(self.tcx, predicate); struct_span_code_err!( diff --git a/tests/ui/associated-types/issue-64855-2.rs b/tests/ui/associated-types/issue-64855-2.rs index 20b8ff17e9e5..5509ebb2e4e9 100644 --- a/tests/ui/associated-types/issue-64855-2.rs +++ b/tests/ui/associated-types/issue-64855-2.rs @@ -3,6 +3,6 @@ // also inadvertently a test for the (non-)co-inductiveness of WF predicates. pub struct Bar<'a>(&'a Self) where Self: ; -//~^ ERROR overflow evaluating the requirement `Bar<'a> well-formed` +//~^ ERROR overflow evaluating whether `Bar<'a>` is well-formed fn main() {} diff --git a/tests/ui/associated-types/issue-64855-2.stderr b/tests/ui/associated-types/issue-64855-2.stderr index 22292a8721a1..75da64505916 100644 --- a/tests/ui/associated-types/issue-64855-2.stderr +++ b/tests/ui/associated-types/issue-64855-2.stderr @@ -1,4 +1,4 @@ -error[E0275]: overflow evaluating the requirement `Bar<'a> well-formed` +error[E0275]: overflow evaluating whether `Bar<'a>` is well-formed --> $DIR/issue-64855-2.rs:5:36 | LL | pub struct Bar<'a>(&'a Self) where Self: ; diff --git a/tests/ui/associated-types/issue-64855.rs b/tests/ui/associated-types/issue-64855.rs index 5d325b981a2c..003f11f4a509 100644 --- a/tests/ui/associated-types/issue-64855.rs +++ b/tests/ui/associated-types/issue-64855.rs @@ -8,6 +8,6 @@ pub trait Foo { pub struct Bar(::Type) where Self: ; //~^ ERROR the trait bound `Bar: Foo` is not satisfied -//~| ERROR overflow evaluating the requirement `Bar well-formed` +//~| ERROR overflow evaluating whether `Bar` is well-formed fn main() {} diff --git a/tests/ui/associated-types/issue-64855.stderr b/tests/ui/associated-types/issue-64855.stderr index 4358ab473651..9472dbf6adb6 100644 --- a/tests/ui/associated-types/issue-64855.stderr +++ b/tests/ui/associated-types/issue-64855.stderr @@ -15,7 +15,7 @@ help: this trait has no implementations, consider adding one LL | pub trait Foo { | ^^^^^^^^^^^^^ -error[E0275]: overflow evaluating the requirement `Bar well-formed` +error[E0275]: overflow evaluating whether `Bar` is well-formed --> $DIR/issue-64855.rs:9:46 | LL | pub struct Bar(::Type) where Self: ; diff --git a/tests/ui/const-generics/generic_const_exprs/adt_wf_hang.rs b/tests/ui/const-generics/generic_const_exprs/adt_wf_hang.rs index 5d538d2679dd..1516b0571490 100644 --- a/tests/ui/const-generics/generic_const_exprs/adt_wf_hang.rs +++ b/tests/ui/const-generics/generic_const_exprs/adt_wf_hang.rs @@ -9,6 +9,6 @@ struct S() where S<{ U }>:; -//~^ ERROR: overflow evaluating the requirement `S<{ U }> well-formed` +//~^ ERROR: overflow evaluating whether `S<{ U }>` is well-formed fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/adt_wf_hang.stderr b/tests/ui/const-generics/generic_const_exprs/adt_wf_hang.stderr index b244acb37dde..1eb2890d4cbc 100644 --- a/tests/ui/const-generics/generic_const_exprs/adt_wf_hang.stderr +++ b/tests/ui/const-generics/generic_const_exprs/adt_wf_hang.stderr @@ -1,4 +1,4 @@ -error[E0275]: overflow evaluating the requirement `S<{ U }> well-formed` +error[E0275]: overflow evaluating whether `S<{ U }>` is well-formed --> $DIR/adt_wf_hang.rs:11:5 | LL | S<{ U }>:; diff --git a/tests/ui/const-generics/mgca/const-ctor-overflow-eval.rs b/tests/ui/const-generics/mgca/const-ctor-overflow-eval.rs index 6a4ee3ed1772..ec74a6e53012 100644 --- a/tests/ui/const-generics/mgca/const-ctor-overflow-eval.rs +++ b/tests/ui/const-generics/mgca/const-ctor-overflow-eval.rs @@ -6,14 +6,14 @@ struct U; #[derive(ConstParamTy, PartialEq, Eq)] -//~^ ERROR overflow evaluating the requirement `S well-formed` -//~| ERROR overflow evaluating the requirement `S well-formed` +//~^ ERROR overflow evaluating whether `S` is well-formed +//~| ERROR overflow evaluating whether `S` is well-formed struct S() where S<{ U }>:; -//~^ ERROR overflow evaluating the requirement `S well-formed` -//~| ERROR overflow evaluating the requirement `S well-formed` -//~| ERROR overflow evaluating the requirement `S well-formed` +//~^ ERROR overflow evaluating whether `S` is well-formed +//~| ERROR overflow evaluating whether `S` is well-formed +//~| ERROR overflow evaluating whether `S` is well-formed fn main() {} diff --git a/tests/ui/const-generics/mgca/const-ctor-overflow-eval.stderr b/tests/ui/const-generics/mgca/const-ctor-overflow-eval.stderr index 4c5ad645bc45..bb393cad567e 100644 --- a/tests/ui/const-generics/mgca/const-ctor-overflow-eval.stderr +++ b/tests/ui/const-generics/mgca/const-ctor-overflow-eval.stderr @@ -1,4 +1,4 @@ -error[E0275]: overflow evaluating the requirement `S well-formed` +error[E0275]: overflow evaluating whether `S` is well-formed --> $DIR/const-ctor-overflow-eval.rs:14:5 | LL | S<{ U }>:; @@ -13,7 +13,7 @@ LL | where LL | S<{ U }>:; | ^^^^^^^^ required by this bound in `S` -error[E0275]: overflow evaluating the requirement `S well-formed` +error[E0275]: overflow evaluating whether `S` is well-formed --> $DIR/const-ctor-overflow-eval.rs:14:5 | LL | S<{ U }>:; @@ -29,7 +29,7 @@ LL | S<{ U }>:; | ^^^^^^^^ required by this bound in `S` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0275]: overflow evaluating the requirement `S well-formed` +error[E0275]: overflow evaluating whether `S` is well-formed --> $DIR/const-ctor-overflow-eval.rs:14:5 | LL | S<{ U }>:; @@ -45,7 +45,7 @@ LL | S<{ U }>:; | ^^^^^^^^ required by this bound in `S` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0275]: overflow evaluating the requirement `S well-formed` +error[E0275]: overflow evaluating whether `S` is well-formed --> $DIR/const-ctor-overflow-eval.rs:8:24 | LL | #[derive(ConstParamTy, PartialEq, Eq)] @@ -60,7 +60,7 @@ LL | where LL | S<{ U }>:; | ^^^^^^^^ required by this bound in `S` -error[E0275]: overflow evaluating the requirement `S well-formed` +error[E0275]: overflow evaluating whether `S` is well-formed --> $DIR/const-ctor-overflow-eval.rs:8:35 | LL | #[derive(ConstParamTy, PartialEq, Eq)] diff --git a/tests/ui/higher-ranked/trait-bounds/issue-95230.rs b/tests/ui/higher-ranked/trait-bounds/issue-95230.rs index 821a04ff0655..b0f623ce3321 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-95230.rs +++ b/tests/ui/higher-ranked/trait-bounds/issue-95230.rs @@ -5,6 +5,6 @@ pub struct Bar where for<'a> &'a mut Self:; -//~^ ERROR overflow evaluating the requirement `for<'a> &'a mut Bar well-formed` +//~^ ERROR: overflow evaluating whether `&'a mut Bar` is well-formed fn main() {} diff --git a/tests/ui/higher-ranked/trait-bounds/issue-95230.stderr b/tests/ui/higher-ranked/trait-bounds/issue-95230.stderr index 7070af75d290..9e85c689f69d 100644 --- a/tests/ui/higher-ranked/trait-bounds/issue-95230.stderr +++ b/tests/ui/higher-ranked/trait-bounds/issue-95230.stderr @@ -1,4 +1,4 @@ -error[E0275]: overflow evaluating the requirement `for<'a> &'a mut Bar well-formed` +error[E0275]: overflow evaluating whether `&'a mut Bar` is well-formed --> $DIR/issue-95230.rs:7:13 | LL | for<'a> &'a mut Self:; diff --git a/tests/ui/traits/next-solver/alias-bound-unsound.rs b/tests/ui/traits/next-solver/alias-bound-unsound.rs index 7b91078c639e..b2015b336b24 100644 --- a/tests/ui/traits/next-solver/alias-bound-unsound.rs +++ b/tests/ui/traits/next-solver/alias-bound-unsound.rs @@ -26,8 +26,8 @@ impl Foo for () { fn main() { let x = String::from("hello, world"); let _ = identity(<() as Foo>::copy_me(&x)); - //~^ ERROR overflow evaluating the requirement `<() as Foo>::Item well-formed` - //~| ERROR overflow evaluating the requirement `&<() as Foo>::Item well-formed` + //~^ ERROR overflow evaluating whether `<() as Foo>::Item` is well-formed + //~| ERROR overflow evaluating whether `&<() as Foo>::Item` is well-formed //~| ERROR overflow evaluating the requirement `<() as Foo>::Item == String` //~| ERROR overflow evaluating the requirement `<() as Foo>::Item == _` //~| ERROR overflow evaluating the requirement `<() as Foo>::Item == _` diff --git a/tests/ui/traits/next-solver/alias-bound-unsound.stderr b/tests/ui/traits/next-solver/alias-bound-unsound.stderr index 3509aea717ef..ebfaf469ddf8 100644 --- a/tests/ui/traits/next-solver/alias-bound-unsound.stderr +++ b/tests/ui/traits/next-solver/alias-bound-unsound.stderr @@ -32,13 +32,13 @@ LL | let _ = identity(<() as Foo>::copy_me(&x)); | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error[E0275]: overflow evaluating the requirement `&<() as Foo>::Item well-formed` +error[E0275]: overflow evaluating whether `&<() as Foo>::Item` is well-formed --> $DIR/alias-bound-unsound.rs:28:43 | LL | let _ = identity(<() as Foo>::copy_me(&x)); | ^^ -error[E0275]: overflow evaluating the requirement `<() as Foo>::Item well-formed` +error[E0275]: overflow evaluating whether `<() as Foo>::Item` is well-formed --> $DIR/alias-bound-unsound.rs:28:22 | LL | let _ = identity(<() as Foo>::copy_me(&x)); diff --git a/tests/ui/traits/next-solver/cycles/coinduction/item-bound-via-impl-where-clause.next.stderr b/tests/ui/traits/next-solver/cycles/coinduction/item-bound-via-impl-where-clause.next.stderr index 451c1442ed29..ed6e595d0afb 100644 --- a/tests/ui/traits/next-solver/cycles/coinduction/item-bound-via-impl-where-clause.next.stderr +++ b/tests/ui/traits/next-solver/cycles/coinduction/item-bound-via-impl-where-clause.next.stderr @@ -30,7 +30,7 @@ LL | let s: String = transmute::<_, String>(vec![65_u8, 66, 67]); | = note: the return type of a function must have a statically known size -error[E0275]: overflow evaluating the requirement `< as Trait>::Proof as Trait>::Proof well-formed` +error[E0275]: overflow evaluating whether `< as Trait>::Proof as Trait>::Proof` is well-formed --> $DIR/item-bound-via-impl-where-clause.rs:31:21 | LL | let s: String = transmute::<_, String>(vec![65_u8, 66, 67]); diff --git a/tests/ui/traits/next-solver/cycles/coinduction/item-bound-via-impl-where-clause.rs b/tests/ui/traits/next-solver/cycles/coinduction/item-bound-via-impl-where-clause.rs index 39381d17f7af..6ac0c1481c79 100644 --- a/tests/ui/traits/next-solver/cycles/coinduction/item-bound-via-impl-where-clause.rs +++ b/tests/ui/traits/next-solver/cycles/coinduction/item-bound-via-impl-where-clause.rs @@ -33,7 +33,7 @@ fn main() { //[next]~| ERROR overflow evaluating the requirement `< as Trait>::Proof as Trait>::Proof == _` //[next]~| ERROR overflow evaluating the requirement `< as Trait>::Proof as Trait>::Proof == String` //[next]~| ERROR overflow evaluating the requirement `< as Trait>::Proof as Trait>::Proof: Sized` - //[next]~| ERROR overflow evaluating the requirement `< as Trait>::Proof as Trait>::Proof well-formed` + //[next]~| ERROR overflow evaluating whether `< as Trait>::Proof as Trait>::Proof` is well-formed //[next]~| ERROR overflow evaluating the requirement `< as Trait>::Proof as Trait>::Proof == _` println!("{}", s); // ABC } diff --git a/tests/ui/traits/next-solver/normalize/normalize-param-env-2.stderr b/tests/ui/traits/next-solver/normalize/normalize-param-env-2.stderr index 82a5f33628e6..cb1bbd4c6171 100644 --- a/tests/ui/traits/next-solver/normalize/normalize-param-env-2.stderr +++ b/tests/ui/traits/next-solver/normalize/normalize-param-env-2.stderr @@ -27,7 +27,7 @@ error[E0275]: overflow evaluating the requirement `<() as A>::Assoc: A` LL | Self::Assoc: A, | ^^^^ -error[E0275]: overflow evaluating the requirement `<() as A>::Assoc well-formed` +error[E0275]: overflow evaluating whether `<() as A>::Assoc` is well-formed --> $DIR/normalize-param-env-2.rs:24:22 | LL | Self::Assoc: A, From 0740609ea38a7274911952fa90c28b89c71f6611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 29 Mar 2026 21:07:47 +0000 Subject: [PATCH 3/4] Point at binop lhs and rhs when expression is multiline ``` error[E0277]: cannot add `()` to `u32` --> $DIR/multiline-span-simple.rs:13:18 | LL | foo(1 as u32 + | -------- ^ no implementation for `u32 + ()` LL | LL | / bar(x, LL | | LL | | y), | |______________- ``` --- .../src/error_reporting/traits/suggestions.rs | 11 ++++++++++- tests/ui/span/multiline-span-simple.stderr | 9 +++++++-- tests/ui/typeck/unit-type-add-error-11771.stderr | 8 ++++++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs index 4a6d5eb48f8f..93afa1bf5f26 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs @@ -2916,12 +2916,21 @@ pub(super) fn note_obligation_cause_code( | ObligationCauseCode::CheckAssociatedTypeBounds { .. } | ObligationCauseCode::LetElse | ObligationCauseCode::UnOp { .. } - | ObligationCauseCode::BinOp { .. } | ObligationCauseCode::AscribeUserTypeProvePredicate(..) | ObligationCauseCode::AlwaysApplicableImpl | ObligationCauseCode::ConstParam(_) | ObligationCauseCode::ReferenceOutlivesReferent(..) | ObligationCauseCode::ObjectTypeBound(..) => {} + ObligationCauseCode::BinOp { lhs_hir_id, rhs_hir_id, .. } => { + if let hir::Node::Expr(lhs) = tcx.hir_node(lhs_hir_id) + && let hir::Node::Expr(rhs) = tcx.hir_node(rhs_hir_id) + && tcx.sess.source_map().lookup_char_pos(lhs.span.lo()).line + != tcx.sess.source_map().lookup_char_pos(rhs.span.hi()).line + { + err.span_label(lhs.span, ""); + err.span_label(rhs.span, ""); + } + } ObligationCauseCode::RustCall => { if let Some(pred) = predicate.as_trait_clause() && tcx.is_lang_item(pred.def_id(), LangItem::Sized) diff --git a/tests/ui/span/multiline-span-simple.stderr b/tests/ui/span/multiline-span-simple.stderr index e013b3c06bc1..ea7aff370fe1 100644 --- a/tests/ui/span/multiline-span-simple.stderr +++ b/tests/ui/span/multiline-span-simple.stderr @@ -1,8 +1,13 @@ error[E0277]: cannot add `()` to `u32` --> $DIR/multiline-span-simple.rs:13:18 | -LL | foo(1 as u32 + - | ^ no implementation for `u32 + ()` +LL | foo(1 as u32 + + | -------- ^ no implementation for `u32 + ()` +LL | +LL | / bar(x, +LL | | +LL | | y), + | |______________- | = help: the trait `Add<()>` is not implemented for `u32` help: the following other types implement trait `Add` diff --git a/tests/ui/typeck/unit-type-add-error-11771.stderr b/tests/ui/typeck/unit-type-add-error-11771.stderr index 155cc0935245..4b8f59e543fa 100644 --- a/tests/ui/typeck/unit-type-add-error-11771.stderr +++ b/tests/ui/typeck/unit-type-add-error-11771.stderr @@ -2,7 +2,9 @@ error[E0277]: cannot add `()` to `{integer}` --> $DIR/unit-type-add-error-11771.rs:5:7 | LL | 1 + - | ^ no implementation for `{integer} + ()` + | - ^ no implementation for `{integer} + ()` +LL | x + | - | = help: the trait `Add<()>` is not implemented for `{integer}` = help: the following other types implement trait `Add`: @@ -20,7 +22,9 @@ error[E0277]: cannot add `()` to `{integer}` --> $DIR/unit-type-add-error-11771.rs:10:7 | LL | 1 + - | ^ no implementation for `{integer} + ()` + | - ^ no implementation for `{integer} + ()` +LL | x + | - | = help: the trait `Add<()>` is not implemented for `{integer}` = help: the following other types implement trait `Add`: From 6e984cd4bf5535d707b9eeacd023637f6031f1cb Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Sun, 29 Mar 2026 21:37:07 +0800 Subject: [PATCH 4/4] loongarch: use "_mcount" as the default mcount symbol Set the `mcount` field to "_mcount" for all LoongArch targets to match Clang/GCC behavior [1]. This fixes linking failures when using `-Z instrument-mcount`, where the runtime expects "_mcount" instead of "mcount". [1] https://github.com/llvm/llvm-project/blob/main/clang/lib/Basic/Targets/LoongArch.h#L60 --- .../rustc_target/src/spec/targets/loongarch32_unknown_none.rs | 1 + .../src/spec/targets/loongarch32_unknown_none_softfloat.rs | 1 + .../src/spec/targets/loongarch64_unknown_linux_gnu.rs | 1 + .../src/spec/targets/loongarch64_unknown_linux_musl.rs | 1 + .../src/spec/targets/loongarch64_unknown_linux_ohos.rs | 1 + .../rustc_target/src/spec/targets/loongarch64_unknown_none.rs | 1 + .../src/spec/targets/loongarch64_unknown_none_softfloat.rs | 1 + 7 files changed, 7 insertions(+) diff --git a/compiler/rustc_target/src/spec/targets/loongarch32_unknown_none.rs b/compiler/rustc_target/src/spec/targets/loongarch32_unknown_none.rs index 2a53d4256b76..7e074b73919f 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch32_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch32_unknown_none.rs @@ -22,6 +22,7 @@ pub(crate) fn target() -> Target { linker: Some("rust-lld".into()), llvm_abiname: LlvmAbi::Ilp32d, max_atomic_width: Some(32), + mcount: "_mcount".into(), relocation_model: RelocModel::Static, panic_strategy: PanicStrategy::Abort, ..Default::default() diff --git a/compiler/rustc_target/src/spec/targets/loongarch32_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/targets/loongarch32_unknown_none_softfloat.rs index e9a9260db8ea..4e6807012e89 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch32_unknown_none_softfloat.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch32_unknown_none_softfloat.rs @@ -23,6 +23,7 @@ pub(crate) fn target() -> Target { linker: Some("rust-lld".into()), llvm_abiname: LlvmAbi::Ilp32s, max_atomic_width: Some(32), + mcount: "_mcount".into(), relocation_model: RelocModel::Static, panic_strategy: PanicStrategy::Abort, ..Default::default() diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs index 180d064570ab..8dad88bfc46f 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs @@ -20,6 +20,7 @@ pub(crate) fn target() -> Target { features: "+f,+d,+lsx,+relax".into(), llvm_abiname: LlvmAbi::Lp64d, max_atomic_width: Some(64), + mcount: "_mcount".into(), supported_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs index 246e28a243af..91a028988548 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs @@ -20,6 +20,7 @@ pub(crate) fn target() -> Target { features: "+f,+d,+lsx,+relax".into(), llvm_abiname: LlvmAbi::Lp64d, max_atomic_width: Some(64), + mcount: "_mcount".into(), crt_static_default: false, supported_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::CFI diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_ohos.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_ohos.rs index 461a7bd26268..679235673488 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_ohos.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_ohos.rs @@ -20,6 +20,7 @@ pub(crate) fn target() -> Target { features: "+f,+d,+lsx,+relax".into(), llvm_abiname: LlvmAbi::Lp64d, max_atomic_width: Some(64), + mcount: "_mcount".into(), supported_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::LEAK diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs index 2a9f0dcfd2ef..2d3b217e7789 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none.rs @@ -22,6 +22,7 @@ pub(crate) fn target() -> Target { linker: Some("rust-lld".into()), llvm_abiname: LlvmAbi::Lp64d, max_atomic_width: Some(64), + mcount: "_mcount".into(), relocation_model: RelocModel::Static, panic_strategy: PanicStrategy::Abort, code_model: Some(CodeModel::Medium), diff --git a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs index efed9778caab..f5e2fb4eb832 100644 --- a/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs +++ b/compiler/rustc_target/src/spec/targets/loongarch64_unknown_none_softfloat.rs @@ -23,6 +23,7 @@ pub(crate) fn target() -> Target { linker: Some("rust-lld".into()), llvm_abiname: LlvmAbi::Lp64s, max_atomic_width: Some(64), + mcount: "_mcount".into(), relocation_model: RelocModel::Static, panic_strategy: PanicStrategy::Abort, code_model: Some(CodeModel::Medium),