Change:
I believe this is caused by . Does that look like anything to you? This doesn't seem to happen with the dist artifacts, only the settings used when testing in CI. The config used in CI is: EDIT: Almost certainly since it comes from . This is causing the reference test suite to fail. Using which is currently unreleased.
Yeah, it's a debug assertion after all. I'll look into it and relax the assertion

Discussion:
"rustc_span", "rustc_symbol_mangling", "rustc_target", <ins> "rustc_trait_selection", </ins> "rustc_type_ir", "serde_json", "smallvec",

//! //! [`PointerCoercion::Unsize`]: `rustc_middle::ty::adjustment::PointerCoercion::Unsize` <ins> use rustc_codegen_ssa::base::validate_trivial_unsize; </ins> use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths}; use crate::base::codegen_panic_nounwind;

let old_info = old_info.expect("unsized_info: missing old info for trait upcasting coercion"); if data_a.principal_def_id() == data_b.principal_def_id() { <del> // Codegen takes advantage of the additional assumption, where if the // principal trait def id of what's being casted doesn't change, // then we don't need to adjust the vtable at all. This // corresponds to the fact that `dyn Tr<A>: Unsize<dyn Tr<B>>` // requires that `A = B`; we don't allow *upcasting* objects // between the same trait with different args. If we, for // some reason, were to relax the `Unsize` trait, it could become // unsound, so let's assert here that the trait refs are *equal*. // // We can use `assert_eq` because the binders should have been anonymized, // and because higher-ranked equality now requires the binders are equal. debug_assert_eq!( data_a.principal(), data_b.principal(), </del> <ins> debug_assert!( validate_trivial_unsize(fx.tcx, data_a, data_b), </ins> "NOP unsize vtable changed principal trait ref: {data_a} -> {data_b}" ); return old_info;

rustc_span = { path = "../rustc_span" } rustc_symbol_mangling = { path = "../rustc_symbol_mangling" } rustc_target = { path = "../rustc_target" } <ins> rustc_trait_selection = { path = "../rustc_trait_selection" } </ins> rustc_type_ir = { path = "../rustc_type_ir" } serde_json = "1.0.59" smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }

use rustc_span::symbol::sym; use rustc_span::{DUMMY_SP, Symbol}; use rustc_target::abi::FIRST_VARIANT; <ins> use rustc_trait_selection::infer::at::ToTrace; use rustc_trait_selection::infer::{BoundRegionConversionTime, TyCtxtInferExt}; use rustc_trait_selection::traits::{ObligationCause, ObligationCtxt}; </ins> use tracing::{debug, info}; use crate::assert_module_sources::CguReuse;

bx.sext(cmp, ret_ty) } <ins> /// Codegen takes advantage of the additional assumption, where if the /// principal trait def id of what's being casted doesn't change, /// then we don't need to adjust the vtable at all. This /// corresponds to the fact that `dyn Tr<A>: Unsize<dyn Tr<B>>` /// requires that `A = B`; we don't allow *upcasting* objects /// between the same trait with different args. If we, for /// some reason, were to relax the `Unsize` trait, it could become /// unsound, so let's validate here that the trait refs are subtypes. pub fn validate_trivial_unsize<'tcx>( tcx: TyCtxt<'tcx>, source_data: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>, target_data: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>, ) -> bool { match (source_data.principal(), target_data.principal()) { (Some(hr_source_principal), Some(hr_target_principal)) => { let infcx = tcx.infer_ctxt().build(); let universe = infcx.universe(); let ocx = ObligationCtxt::new(&infcx); infcx.enter_forall(hr_target_principal, |target_principal| { let source_principal = infcx.instantiate_binder_with_fresh_vars( DUMMY_SP, BoundRegionConversionTime::HigherRankedType, hr_source_principal, ); let Ok(()) = ocx.eq_trace( &ObligationCause::dummy(), ty::ParamEnv::reveal_all(), ToTrace::to_trace( &ObligationCause::dummy(), hr_target_principal, hr_source_principal, ), target_principal, source_principal, ) else { return false; }; if !ocx.select_all_or_error().is_empty() { return false; } infcx.leak_check(universe, None).is_ok() }) } (None, None) => true, _ => false, } } </ins> /// Retrieves the information we are losing (making dynamic) in an unsizing /// adjustment. ///

// between the same trait with different args. If we, for // some reason, were to relax the `Unsize` trait, it could become // unsound, so let's assert here that the trait refs are *equal*. <del> // // We can use `assert_eq` because the binders should have been anonymized, // and because higher-ranked equality now requires the binders are equal. debug_assert_eq!( data_a.principal(), data_b.principal(), </del> <ins> debug_assert!( validate_trivial_unsize(cx.tcx(), data_a, data_b), </ins> "NOP unsize vtable changed principal trait ref: {data_a} -> {data_b}" );

Canonical, CanonicalQueryResponse, CanonicalVarValues, QueryResponse, }; use rustc_infer::infer::outlives::env::OutlivesEnvironment; <del> use rustc_infer::infer::{DefineOpaqueTypes, InferCtxt, InferOk, RegionResolutionError}; </del> <ins> use rustc_infer::infer::{DefineOpaqueTypes, InferCtxt, InferOk, RegionResolutionError, TypeTrace}; </ins> use rustc_macros::extension; use rustc_middle::arena::ArenaAllocatable; use rustc_middle::traits::query::NoSolution; use rustc_middle::ty::error::TypeError; use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, Upcast, Variance}; <ins> use rustc_type_ir::relate::Relate; </ins> use super::{FromSolverError, FulfillmentContext, ScrubbedTraitError, TraitEngine}; use crate::error_reporting::InferCtxtErrorExt;

.map(|infer_ok| self.register_infer_ok_obligations(infer_ok)) } <ins> pub fn eq_trace<T: Relate<TyCtxt<'tcx>>>( &self, cause: &ObligationCause<'tcx>, param_env: ty::ParamEnv<'tcx>, trace: TypeTrace<'tcx>, expected: T, actual: T, ) -> Result<(), TypeError<'tcx>> { self.infcx .at(cause, param_env) .eq_trace(DefineOpaqueTypes::Yes, trace, expected, actual) .map(|infer_ok| self.register_infer_ok_obligations(infer_ok)) } </ins> /// Checks whether `expected` is a subtype of `actual`: `expected <: actual`. pub fn sub<T: ToTrace<'tcx>>( &self,

<ins> //@ build-pass // Regression test for an overly aggressive assertion in #130855. fn main() { let subtype: &(dyn for<'a> Fn(&'a i32) -> &'a i32) = &|x| x; let supertype: &(dyn Fn(&'static i32) -> &'static i32) = subtype; } </ins>