Skip to content

Commit c473d14

Browse files
committed
Correct binding scope when building MIR.
1 parent 198e0a2 commit c473d14

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
@@ -765,6 +765,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
765765
pattern,
766766
&ProjectedUserTypesNode::None,
767767
&mut |this, name, mode, var, span, ty, user_tys| {
768+
let saved_scope = this.source_scope;
769+
this.set_correct_source_scope_for_arg(var.0, saved_scope, span);
768770
let vis_scope = *visibility_scope
769771
.get_or_insert_with(|| this.new_source_scope(scope_span, LintLevel::Inherited));
770772
let source_info = SourceInfo { span, scope: this.source_scope };
@@ -782,6 +784,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
782784
opt_match_place.map(|(x, y)| (x.cloned(), y)),
783785
pattern.span,
784786
);
787+
this.source_scope = saved_scope;
785788
},
786789
);
787790
if let Some(guard_expr) = guard {

0 commit comments

Comments
 (0)