Skip to content

Commit db08c17

Browse files
committed
Review comments.
1 parent 9883151 commit db08c17

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

compiler/rustc_ast/src/visit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl<'a> FnKind<'a> {
7676
pub fn header(&self) -> Option<&'a FnHeader> {
7777
match *self {
7878
FnKind::Fn(_, _, sig, _, _, _) => Some(&sig.header),
79-
FnKind::Closure(_, _, _, _) => None,
79+
FnKind::Closure(..) => None,
8080
}
8181
}
8282

compiler/rustc_ast_lowering/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
14041404
let ident = Ident::new(name, span);
14051405
let (param, bounds, path) = self.lower_universal_param_and_bounds(
14061406
*def_node_id,
1407-
t.span,
1407+
span,
14081408
ident,
14091409
bounds,
14101410
);

compiler/rustc_resolve/src/def_collector.rs

+9-13
Original file line numberDiff line numberDiff line change
@@ -182,18 +182,6 @@ impl<'a, 'b, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'b, 'tcx> {
182182
}
183183

184184
fn visit_fn(&mut self, fn_kind: FnKind<'a>, span: Span, _: NodeId) {
185-
let walk_fn_decl = |this: &mut Self,
186-
coroutine_kind: CoroutineKind,
187-
FnDecl { inputs, output }: &'a FnDecl| {
188-
for param in inputs {
189-
this.visit_param(param);
190-
}
191-
192-
let (return_id, return_span) = coroutine_kind.return_id();
193-
let return_def = this.create_def(return_id, kw::Empty, DefKind::OpaqueTy, return_span);
194-
this.with_parent(return_def, |this| this.visit_fn_ret_ty(output));
195-
};
196-
197185
match fn_kind {
198186
FnKind::Fn(_ctxt, _ident, FnSig { header, decl, span: _ }, _vis, generics, body)
199187
if let Some(coroutine_kind) = header.coroutine_kind =>
@@ -204,7 +192,15 @@ impl<'a, 'b, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'b, 'tcx> {
204192
// For async functions, we need to create their inner defs inside of a
205193
// closure to match their desugared representation. Besides that,
206194
// we must mirror everything that `visit::walk_fn` below does.
207-
walk_fn_decl(self, coroutine_kind, decl);
195+
let FnDecl { inputs, output } = &**decl;
196+
for param in inputs {
197+
self.visit_param(param);
198+
}
199+
200+
let (return_id, return_span) = coroutine_kind.return_id();
201+
let return_def =
202+
self.create_def(return_id, kw::Empty, DefKind::OpaqueTy, return_span);
203+
self.with_parent(return_def, |this| this.visit_fn_ret_ty(output));
208204

209205
// If this async fn has no body (i.e. it's an async fn signature in a trait)
210206
// then the closure_def will never be used, and we should avoid generating a

0 commit comments

Comments
 (0)