Skip to content

Commit f6faa05

Browse files
Rollup merge of rust-lang#156325 - cijiugechu:generics-transmutefrom, r=BoxyUwU
Don't treat const param default as projection Avoid treating const param default as associated const projection. Closes rust-lang#156293
2 parents c978cbe + b11537f commit f6faa05

2 files changed

Lines changed: 14 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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//! Regression test for <https://github.com/rust-lang/rust/issues/156293>
2+
//@ check-pass
3+
4+
#![feature(min_generic_const_args)]
5+
6+
trait Bar<const N: bool = false> {}
7+
8+
trait Foo {
9+
type AssocB: Bar;
10+
}
11+
12+
fn main() {}

0 commit comments

Comments
 (0)