Rollup merge of #99704 - fee1-dead-contrib:add_self_tilde_const_trait, r=oli-obk
Add `Self: ~const Trait` to traits with `#[const_trait]` r? `@oli-obk`
This commit is contained in:
commit
28b44ff5d4
30 changed files with 199 additions and 209 deletions
|
@ -2090,10 +2090,17 @@ fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicates<'_> {
|
|||
// from the trait itself that *shouldn't* be shown as the source of
|
||||
// an obligation and instead be skipped. Otherwise we'd use
|
||||
// `tcx.def_span(def_id);`
|
||||
|
||||
let constness = if tcx.has_attr(def_id, sym::const_trait) {
|
||||
ty::BoundConstness::ConstIfConst
|
||||
} else {
|
||||
ty::BoundConstness::NotConst
|
||||
};
|
||||
|
||||
let span = rustc_span::DUMMY_SP;
|
||||
result.predicates =
|
||||
tcx.arena.alloc_from_iter(result.predicates.iter().copied().chain(std::iter::once((
|
||||
ty::TraitRef::identity(tcx, def_id).without_const().to_predicate(tcx),
|
||||
ty::TraitRef::identity(tcx, def_id).with_constness(constness).to_predicate(tcx),
|
||||
span,
|
||||
))));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue