Skip to content

Commit 864bbae

Browse files
committed
Prevent lowering item ids from behaving differently than lowering items
1 parent 92c974d commit 864bbae

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/librustc/hir/lowering.rs

+19-2
Original file line numberDiff line numberDiff line change
@@ -2811,11 +2811,28 @@ impl<'a> LoweringContext<'a> {
28112811
struct IdVisitor { ids: SmallVector<hir::ItemId> }
28122812
impl<'a> Visitor<'a> for IdVisitor {
28132813
fn visit_ty(&mut self, ty: &'a Ty) {
2814-
if let TyKind::ImplTrait(id, _) = ty.node {
2815-
self.ids.push(hir::ItemId { id });
2814+
match ty.node {
2815+
| TyKind::Typeof(_)
2816+
| TyKind::BareFn(_)
2817+
=> return,
2818+
2819+
TyKind::ImplTrait(id, _) => self.ids.push(hir::ItemId { id }),
2820+
_ => {},
28162821
}
28172822
visit::walk_ty(self, ty);
28182823
}
2824+
fn visit_path_segment(
2825+
&mut self,
2826+
path_span: Span,
2827+
path_segment: &'v PathSegment,
2828+
) {
2829+
if let Some(ref p) = path_segment.parameters {
2830+
if let PathParameters::Parenthesized(..) = **p {
2831+
return;
2832+
}
2833+
}
2834+
visit::walk_path_segment(self, path_span, path_segment)
2835+
}
28192836
}
28202837
let mut visitor = IdVisitor { ids: SmallVector::one(hir::ItemId { id: i.id }) };
28212838
match decl.output {

0 commit comments

Comments
 (0)