Skip to content

Commit 64a0a1c

Browse files
committed
Correct binding scope when building MIR.
1 parent 0f9f06d commit 64a0a1c

File tree

1 file changed

+3
-0
lines changed
  • compiler/rustc_mir_build/src/builder/matches

1 file changed

+3
-0
lines changed

compiler/rustc_mir_build/src/builder/matches/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
763763
pattern,
764764
&ProjectedUserTypesNode::None,
765765
&mut |this, name, mode, var, span, ty, user_tys| {
766+
let saved_scope = this.source_scope;
767+
this.set_correct_source_scope_for_arg(var.0, saved_scope, span);
766768
let vis_scope = *visibility_scope
767769
.get_or_insert_with(|| this.new_source_scope(scope_span, LintLevel::Inherited));
768770
let source_info = SourceInfo { span, scope: this.source_scope };
@@ -780,6 +782,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
780782
opt_match_place.map(|(x, y)| (x.cloned(), y)),
781783
pattern.span,
782784
);
785+
this.source_scope = saved_scope;
783786
},
784787
);
785788
if let Some(guard_expr) = guard {

0 commit comments

Comments
 (0)