@@ -259,12 +259,15 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
259
259
let scope = self . declare_bindings (
260
260
None ,
261
261
body. span ,
262
- LintLevel :: Inherited ,
263
262
& arm. patterns [ 0 ] ,
264
263
ArmHasGuard ( arm. guard . is_some ( ) ) ,
265
264
Some ( ( Some ( & scrutinee_place) , scrutinee_span) ) ,
266
265
) ;
267
266
267
+ if let Some ( source_scope) = scope {
268
+ this. source_scope = source_scope;
269
+ }
270
+
268
271
for candidate in candidates {
269
272
self . bind_and_guard_matched_candidate (
270
273
candidate,
@@ -275,9 +278,6 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
275
278
) ;
276
279
}
277
280
278
- if let Some ( source_scope) = scope {
279
- self . source_scope = source_scope;
280
- }
281
281
282
282
unpack ! ( arm_block = self . into( destination, arm_block, body) ) ;
283
283
@@ -489,33 +489,20 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
489
489
& mut self ,
490
490
mut visibility_scope : Option < SourceScope > ,
491
491
scope_span : Span ,
492
- lint_level : LintLevel ,
493
492
pattern : & Pattern < ' tcx > ,
494
493
has_guard : ArmHasGuard ,
495
494
opt_match_place : Option < ( Option < & Place < ' tcx > > , Span ) > ,
496
495
) -> Option < SourceScope > {
497
- assert ! (
498
- !( visibility_scope. is_some( ) && lint_level. is_explicit( ) ) ,
499
- "can't have both a visibility and a lint scope at the same time"
500
- ) ;
501
- let mut scope = self . source_scope ;
502
496
debug ! ( "declare_bindings: pattern={:?}" , pattern) ;
503
497
self . visit_bindings (
504
498
& pattern,
505
499
UserTypeProjections :: none ( ) ,
506
500
& mut |this, mutability, name, mode, var, span, ty, user_ty| {
507
501
if visibility_scope. is_none ( ) {
508
- // If we have lints, create a new source scope
509
- // that marks the lints for the locals. See the comment
510
- // on the `source_info` field for why this is needed.
511
- if lint_level. is_explicit ( ) {
512
- scope = this. new_source_scope ( scope_span, lint_level, None ) ;
513
- }
514
- visibility_scope = Some ( this. new_source_scope ( scope_span,
515
- LintLevel :: Inherited ,
516
- None ) ) ;
502
+ visibility_scope =
503
+ Some ( this. new_source_scope ( scope_span, LintLevel :: Inherited , None ) ) ;
517
504
}
518
- let source_info = SourceInfo { span, scope } ;
505
+ let source_info = SourceInfo { span, this . source_scope } ;
519
506
let visibility_scope = visibility_scope. unwrap ( ) ;
520
507
this. declare_binding (
521
508
source_info,
0 commit comments