late resolve, visit_fn: bail early if there's no body. · rust-lang/rust@85b585d (original) (raw)

`@@ -456,8 +456,9 @@ impl<'a, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {

`

456

456

`}

`

457

457

`fn visit_fn(&mut self, fn_kind: FnKind<'ast>, sp: Span, _: NodeId) {

`

458

458

`let rib_kind = match fn_kind {

`

459

``

`-

FnKind::Fn(FnCtxt::Foreign, ..) => return visit::walk_fn(self, fn_kind, sp),

`

460

``

`-

FnKind::Fn(FnCtxt::Free, ..) => FnItemRibKind,

`

``

459

`+

// Bail if there's no body.

`

``

460

`+

FnKind::Fn(.., None) => return visit::walk_fn(self, fn_kind, sp),

`

``

461

`+

FnKind::Fn(FnCtxt::Free, ..) | FnKind::Fn(FnCtxt::Foreign, ..) => FnItemRibKind,

`

461

462

`FnKind::Fn(FnCtxt::Assoc(_), ..) | FnKind::Closure(..) => NormalRibKind,

`

462

463

`};

`

463

464

`let previous_value = replace(&mut self.diagnostic_metadata.current_function, Some(sp));

`