Skip to content

Commit

Permalink
Remove span hack that doesnt do anything
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Nov 23, 2024
1 parent 60bf4b0 commit 565166d
Showing 1 changed file with 1 addition and 34 deletions.
35 changes: 1 addition & 34 deletions compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
let tcx = self.tcx();
// FIXME: Marked `mut` so that we can replace the spans further below with a more
// appropriate one, but this should be handled earlier in the span assignment.
let mut associated_types: FxIndexMap<Span, Vec<_>> = associated_types
let associated_types: FxIndexMap<Span, Vec<_>> = associated_types
.into_iter()
.map(|(span, def_ids)| {
(span, def_ids.into_iter().map(|did| tcx.associated_item(did)).collect())
Expand Down Expand Up @@ -769,39 +769,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
hir::Node::Expr(_) | hir::Node::Pat(_) => true,
_ => false,
};
match bound.trait_ref.path.segments {
// FIXME: `trait_ref.path.span` can point to a full path with multiple
// segments, even though `trait_ref.path.segments` is of length `1`. Work
// around that bug here, even though it should be fixed elsewhere.
// This would otherwise cause an invalid suggestion. For an example, look at
// `tests/ui/issues/issue-28344.rs` where instead of the following:
//
// error[E0191]: the value of the associated type `Output`
// (from trait `std::ops::BitXor`) must be specified
// --> $DIR/issue-28344.rs:4:17
// |
// LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8);
// | ^^^^^^ help: specify the associated type:
// | `BitXor<Output = Type>`
//
// we would output:
//
// error[E0191]: the value of the associated type `Output`
// (from trait `std::ops::BitXor`) must be specified
// --> $DIR/issue-28344.rs:4:17
// |
// LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8);
// | ^^^^^^^^^^^^^ help: specify the associated type:
// | `BitXor::bitor<Output = Type>`
[segment] if segment.args.is_none() => {
trait_bound_spans = vec![segment.ident.span];
associated_types = associated_types
.into_values()
.map(|items| (segment.ident.span, items))
.collect();
}
_ => {}
}
}

// We get all the associated items that _are_ set,
Expand Down

0 comments on commit 565166d

Please sign in to comment.