Skip to content

Commit

Permalink
fix free type resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Medowhill committed Aug 2, 2024
1 parent 657e5d4 commit 92f46ab
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1784,9 +1784,19 @@ impl<'tcx> Visitor<'tcx> for FreeTypeVisitor<'tcx> {
}

fn visit_ty(&mut self, ty: &'tcx Ty<'tcx>) {
if let TyKind::Path(QPath::Resolved(_, path)) = &ty.kind {
if let TyKind::Path(QPath::Resolved(ty, path)) = &ty.kind {
if let Some(x) = span_and_args_of_path(path) {
self.undefined_types.push(x);
let (span, args) = x;
let span = if let Some(ty) = ty {
let lo = ty.span.lo() - BytePos(1);
let span = span.with_lo(lo);
let s = self.tcx.sess.source_map().span_to_snippet(span).unwrap();
assert_eq!(s.chars().next().unwrap(), '<');
span
} else {
span
};
self.undefined_types.push((span, args));
}
}
intravisit::walk_ty(self, ty);
Expand Down

0 comments on commit 92f46ab

Please sign in to comment.