Skip to content

Commit 5148dac

Browse files
committed
Don't treat const param default as projection
1 parent 4feb722 commit 5148dac

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

compiler/rustc_trait_selection/src/traits/dyn_compatibility.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,8 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for IllegalSelfTypeVisitor<'tcx> {
867867
ty::ConstKind::Unevaluated(proj) if self.tcx.features().min_generic_const_args() => {
868868
match self.allow_self_projections {
869869
AllowSelfProjections::Yes
870-
if let trait_def_id = self.tcx.parent(proj.def)
870+
if matches!(self.tcx.def_kind(proj.def), DefKind::AssocConst { .. })
871+
&& let trait_def_id = self.tcx.parent(proj.def)
871872
&& self.tcx.def_kind(trait_def_id) == DefKind::Trait =>
872873
{
873874
let trait_ref = ty::TraitRef::from_assoc(self.tcx, trait_def_id, proj.args);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//! Regression test for <https://github.com/rust-lang/rust/issues/156293>
2+
//@ edition: 2024
3+
//@ check-pass
4+
5+
#![feature(min_generic_const_args, transmutability)]
6+
7+
trait Foo {
8+
type AssocB: std::mem::TransmuteFrom<()>;
9+
}
10+
11+
fn main() {}

0 commit comments

Comments
 (0)