Rollup merge of #97302 - compiler-errors:writeback-ascending, r=cjgillot
Do writeback of Closure params before visiting the parent expression This means that given the expression: ``` let x = |a: Vec<_>| {}; ``` We will visit the HIR node for `a` before `x`, and report the ambiguity on the former instead of the latter. This also moves writeback for struct field ids and const blocks before, but the ordering of this and walking the expr doesn't seem to matter.
This commit is contained in:
commit
d858d280e4
3 changed files with 43 additions and 7 deletions
|
@ -263,8 +263,6 @@ impl<'cx, 'tcx> Visitor<'tcx> for WritebackCx<'cx, 'tcx> {
|
|||
self.fix_scalar_builtin_expr(e);
|
||||
self.fix_index_builtin_expr(e);
|
||||
|
||||
self.visit_node_id(e.span, e.hir_id);
|
||||
|
||||
match e.kind {
|
||||
hir::ExprKind::Closure(_, _, body, _, _) => {
|
||||
let body = self.fcx.tcx.hir().body(body);
|
||||
|
@ -291,6 +289,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for WritebackCx<'cx, 'tcx> {
|
|||
_ => {}
|
||||
}
|
||||
|
||||
self.visit_node_id(e.span, e.hir_id);
|
||||
intravisit::walk_expr(self, e);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue