Skip to content

Commit 47732a4

Browse files
committed
Prevent lowering item ids from behaving differently than lowering items
1 parent a83733f commit 47732a4

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/librustc/hir/lowering.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2797,11 +2797,28 @@ impl<'a> LoweringContext<'a> {
27972797
struct IdVisitor { ids: SmallVector<hir::ItemId> }
27982798
impl<'a> Visitor<'a> for IdVisitor {
27992799
fn visit_ty(&mut self, ty: &'a Ty) {
2800-
if let TyKind::ImplTrait(id, _) = ty.node {
2801-
self.ids.push(hir::ItemId { id });
2800+
match ty.node {
2801+
| TyKind::Typeof(_)
2802+
| TyKind::BareFn(_)
2803+
=> return,
2804+
2805+
TyKind::ImplTrait(id, _) => self.ids.push(hir::ItemId { id }),
2806+
_ => {},
28022807
}
28032808
visit::walk_ty(self, ty);
28042809
}
2810+
fn visit_path_segment(
2811+
&mut self,
2812+
path_span: Span,
2813+
path_segment: &'v PathSegment,
2814+
) {
2815+
if let Some(ref p) = path_segment.parameters {
2816+
if let PathParameters::Parenthesized(..) = **p {
2817+
return;
2818+
}
2819+
}
2820+
visit::walk_path_segment(self, path_span, path_segment)
2821+
}
28052822
}
28062823
let mut visitor = IdVisitor { ids: SmallVector::one(hir::ItemId { id: i.id }) };
28072824
match decl.output {

0 commit comments

Comments
 (0)