Skip to content

Commit

Permalink
No need to store original_span in ClauseWithSupertraitSpan
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Nov 25, 2024
1 parent d386717 commit 4a896e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {

for (base_trait_ref, original_span) in regular_traits_refs_spans {
let base_pred: ty::Predicate<'tcx> = base_trait_ref.upcast(tcx);
for ClauseWithSupertraitSpan { pred, original_span, supertrait_span } in
for ClauseWithSupertraitSpan { pred, supertrait_span } in
traits::elaborate(tcx, [ClauseWithSupertraitSpan::new(base_pred, original_span)])
.filter_only_self()
{
Expand Down
11 changes: 2 additions & 9 deletions compiler/rustc_type_ir/src/elaborate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,12 @@ pub trait Elaboratable<I: Interner> {

pub struct ClauseWithSupertraitSpan<I: Interner> {
pub pred: I::Predicate,
// Span of the original elaborated predicate.
pub original_span: I::Span,
// Span of the supertrait predicatae that lead to this clause.
pub supertrait_span: I::Span,
}
impl<I: Interner> ClauseWithSupertraitSpan<I> {
pub fn new(pred: I::Predicate, span: I::Span) -> Self {
ClauseWithSupertraitSpan { pred, original_span: span, supertrait_span: span }
ClauseWithSupertraitSpan { pred, supertrait_span: span }
}
}
impl<I: Interner> Elaboratable<I> for ClauseWithSupertraitSpan<I> {
Expand All @@ -63,7 +61,6 @@ impl<I: Interner> Elaboratable<I> for ClauseWithSupertraitSpan<I> {
fn child(&self, clause: <I as Interner>::Clause) -> Self {
ClauseWithSupertraitSpan {
pred: clause.as_predicate(),
original_span: self.original_span,
supertrait_span: self.supertrait_span,
}
}
Expand All @@ -75,11 +72,7 @@ impl<I: Interner> Elaboratable<I> for ClauseWithSupertraitSpan<I> {
_parent_trait_pred: crate::Binder<I, crate::TraitPredicate<I>>,
_index: usize,
) -> Self {
ClauseWithSupertraitSpan {
pred: clause.as_predicate(),
original_span: self.original_span,
supertrait_span: supertrait_span,
}
ClauseWithSupertraitSpan { pred: clause.as_predicate(), supertrait_span: supertrait_span }
}
}

Expand Down

0 comments on commit 4a896e7

Please sign in to comment.