@@ -609,34 +609,33 @@ impl<'a, 'tcx> MirUsedCollector<'a, 'tcx> {
609
609
let limit = Size :: from_bytes ( limit) ;
610
610
let ty = operand. ty ( self . body , self . tcx ) ;
611
611
let ty = self . monomorphize ( ty) ;
612
- let layout = self . tcx . layout_of ( ty:: ParamEnv :: reveal_all ( ) . and ( ty) ) ;
613
- if let Ok ( layout) = layout {
614
- if layout. size > limit {
615
- debug ! ( ?layout) ;
616
- let source_info = self . body . source_info ( location) ;
617
- debug ! ( ?source_info) ;
618
- let lint_root = source_info. scope . lint_root ( & self . body . source_scopes ) ;
619
- debug ! ( ?lint_root) ;
620
- let Some ( lint_root) = lint_root else {
621
- // This happens when the issue is in a function from a foreign crate that
622
- // we monomorphized in the current crate. We can't get a `HirId` for things
623
- // in other crates.
624
- // FIXME: Find out where to report the lint on. Maybe simply crate-level lint root
625
- // but correct span? This would make the lint at least accept crate-level lint attributes.
626
- return ;
627
- } ;
628
- self . tcx . emit_spanned_lint (
629
- LARGE_ASSIGNMENTS ,
630
- lint_root,
631
- source_info. span ,
632
- LargeAssignmentsLint {
633
- span : source_info. span ,
634
- size : layout. size . bytes ( ) ,
635
- limit : limit. bytes ( ) ,
636
- } ,
637
- )
638
- }
612
+ let Ok ( layout) = self . tcx . layout_of ( ty:: ParamEnv :: reveal_all ( ) . and ( ty) ) else { return } ;
613
+ if layout. size <= limit {
614
+ return ;
639
615
}
616
+ debug ! ( ?layout) ;
617
+ let source_info = self . body . source_info ( location) ;
618
+ debug ! ( ?source_info) ;
619
+ let lint_root = source_info. scope . lint_root ( & self . body . source_scopes ) ;
620
+ debug ! ( ?lint_root) ;
621
+ let Some ( lint_root) = lint_root else {
622
+ // This happens when the issue is in a function from a foreign crate that
623
+ // we monomorphized in the current crate. We can't get a `HirId` for things
624
+ // in other crates.
625
+ // FIXME: Find out where to report the lint on. Maybe simply crate-level lint root
626
+ // but correct span? This would make the lint at least accept crate-level lint attributes.
627
+ return ;
628
+ } ;
629
+ self . tcx . emit_spanned_lint (
630
+ LARGE_ASSIGNMENTS ,
631
+ lint_root,
632
+ source_info. span ,
633
+ LargeAssignmentsLint {
634
+ span : source_info. span ,
635
+ size : layout. size . bytes ( ) ,
636
+ limit : limit. bytes ( ) ,
637
+ } ,
638
+ ) ;
640
639
}
641
640
}
642
641
0 commit comments