Auto merge of #154573 - jhpratt:rollup-ABgmddY, r=jhpratt

Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#154548 (Add regression test for TransmuteFrom ICE with min_generic_const_args)
 - rust-lang/rust#154563 (Point at binop lhs and rhs when expression is multiline)
 - rust-lang/rust#154564 (Tweak wording of E0275 WF errors)
 - rust-lang/rust#154566 (loongarch: use "_mcount" as the default mcount symbol)
This commit is contained in:
bors
2026-03-30 10:54:25 +00:00
27 changed files with 95 additions and 30 deletions
@@ -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()
@@ -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()
@@ -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
@@ -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
@@ -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
@@ -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),
@@ -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),
@@ -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!(
@@ -2915,12 +2915,21 @@ pub(super) fn note_obligation_cause_code<G: EmissionGuarantee, T>(
| 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)
+1 -1
View File
@@ -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() {}
@@ -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: ;
+1 -1
View File
@@ -8,6 +8,6 @@ pub trait Foo {
pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
//~^ ERROR the trait bound `Bar<T>: Foo` is not satisfied
//~| ERROR overflow evaluating the requirement `Bar<T> well-formed`
//~| ERROR overflow evaluating whether `Bar<T>` is well-formed
fn main() {}
+1 -1
View File
@@ -15,7 +15,7 @@ help: this trait has no implementations, consider adding one
LL | pub trait Foo {
| ^^^^^^^^^^^^^
error[E0275]: overflow evaluating the requirement `Bar<T> well-formed`
error[E0275]: overflow evaluating whether `Bar<T>` is well-formed
--> $DIR/issue-64855.rs:9:46
|
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
@@ -9,6 +9,6 @@
struct S<const N: U>()
where
S<{ U }>:;
//~^ ERROR: overflow evaluating the requirement `S<{ U }> well-formed`
//~^ ERROR: overflow evaluating whether `S<{ U }>` is well-formed
fn main() {}
@@ -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 }>:;
@@ -6,14 +6,14 @@
struct U;
#[derive(ConstParamTy, PartialEq, Eq)]
//~^ ERROR overflow evaluating the requirement `S<U> well-formed`
//~| ERROR overflow evaluating the requirement `S<U> well-formed`
//~^ ERROR overflow evaluating whether `S<U>` is well-formed
//~| ERROR overflow evaluating whether `S<U>` is well-formed
struct S<const N: U>()
where
S<{ U }>:;
//~^ ERROR overflow evaluating the requirement `S<U> well-formed`
//~| ERROR overflow evaluating the requirement `S<U> well-formed`
//~| ERROR overflow evaluating the requirement `S<U> well-formed`
//~^ ERROR overflow evaluating whether `S<U>` is well-formed
//~| ERROR overflow evaluating whether `S<U>` is well-formed
//~| ERROR overflow evaluating whether `S<U>` is well-formed
fn main() {}
@@ -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/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<U> well-formed`
error[E0275]: overflow evaluating whether `S<U>` 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<U> well-formed`
error[E0275]: overflow evaluating whether `S<U>` 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<U> well-formed`
error[E0275]: overflow evaluating whether `S<U>` 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<U> well-formed`
error[E0275]: overflow evaluating whether `S<U>` is well-formed
--> $DIR/const-ctor-overflow-eval.rs:8:35
|
LL | #[derive(ConstParamTy, PartialEq, Eq)]
@@ -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() {}
@@ -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:;
+7 -2
View File
@@ -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<Rhs>`
@@ -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 == _`
@@ -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));
@@ -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 `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::Proof well-formed`
error[E0275]: overflow evaluating whether `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::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]);
@@ -33,7 +33,7 @@ fn main() {
//[next]~| ERROR overflow evaluating the requirement `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::Proof == _`
//[next]~| ERROR overflow evaluating the requirement `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::Proof == String`
//[next]~| ERROR overflow evaluating the requirement `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::Proof: Sized`
//[next]~| ERROR overflow evaluating the requirement `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::Proof well-formed`
//[next]~| ERROR overflow evaluating whether `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::Proof` is well-formed
//[next]~| ERROR overflow evaluating the requirement `<<Vec<u8> as Trait<String>>::Proof as Trait<String>>::Proof == _`
println!("{}", s); // ABC
}
@@ -27,7 +27,7 @@ error[E0275]: overflow evaluating the requirement `<() as A<T>>::Assoc: A<T>`
LL | Self::Assoc: A<T>,
| ^^^^
error[E0275]: overflow evaluating the requirement `<() as A<T>>::Assoc well-formed`
error[E0275]: overflow evaluating whether `<() as A<T>>::Assoc` is well-formed
--> $DIR/normalize-param-env-2.rs:24:22
|
LL | Self::Assoc: A<T>,
@@ -0,0 +1,31 @@
//! Ensure `TransmuteFrom` with `min_generic_const_args` doesn't ICE
//! during well-formedness checking.
//!
//! Regression test for <https://github.com/rust-lang/rust/issues/150457>.
//@ 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() {}
@@ -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<Rhs>`:
@@ -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<Rhs>`: