1
Fork 0

Auto merge of #127200 - fee1-dead-contrib:trait_def_const_trait, r=compiler-errors

Add `constness` to `TraitDef`

Second attempt at fixing the regression @ https://github.com/rust-lang/rust/pull/120639#issuecomment-2198373716

r? project-const-traits
This commit is contained in:
bors 2024-07-09 06:51:35 +00:00
commit 5be2ec7245
9 changed files with 42 additions and 31 deletions

View file

@ -625,9 +625,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
_ => Const::No,
}
} else {
self.tcx
.get_attr(def_id, sym::const_trait)
.map_or(Const::No, |attr| Const::Yes(attr.span))
if self.tcx.is_const_trait(def_id) {
// FIXME(effects) span
Const::Yes(self.tcx.def_ident_span(def_id).unwrap())
} else {
Const::No
}
}
} else {
Const::No