@@ -75,7 +75,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
7575 TerminatorKind :: Return |
7676 TerminatorKind :: Unreachable |
7777 TerminatorKind :: FalseEdges { .. } => {
78- // safe (at least as emitted during MIR construction)
78+ // safe (at least as emitted during MIR construction)
7979 }
8080
8181 TerminatorKind :: Call { ref func, .. } => {
@@ -117,12 +117,17 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
117117 rvalue : & Rvalue < ' tcx > ,
118118 location : Location )
119119 {
120- if let & Rvalue :: Aggregate (
121- box AggregateKind :: Closure ( def_id, _) ,
122- _
123- ) = rvalue {
124- let unsafety_violations = self . tcx . unsafety_violations ( def_id) ;
125- self . register_violations ( & unsafety_violations) ;
120+ if let & Rvalue :: Aggregate ( box ref aggregate, _) = rvalue {
121+ match aggregate {
122+ & AggregateKind :: Array ( ..) |
123+ & AggregateKind :: Tuple |
124+ & AggregateKind :: Adt ( ..) => { }
125+ & AggregateKind :: Closure ( def_id, _) |
126+ & AggregateKind :: Generator ( def_id, _, _) => {
127+ let unsafety_violations = self . tcx . unsafety_violations ( def_id) ;
128+ self . register_violations ( & unsafety_violations) ;
129+ }
130+ }
126131 }
127132 self . super_rvalue ( rvalue, location) ;
128133 }
0 commit comments