@@ -75,7 +75,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
75
75
TerminatorKind :: Return |
76
76
TerminatorKind :: Unreachable |
77
77
TerminatorKind :: FalseEdges { .. } => {
78
- // safe (at least as emitted during MIR construction)
78
+ // safe (at least as emitted during MIR construction)
79
79
}
80
80
81
81
TerminatorKind :: Call { ref func, .. } => {
@@ -117,12 +117,17 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
117
117
rvalue : & Rvalue < ' tcx > ,
118
118
location : Location )
119
119
{
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
+ }
126
131
}
127
132
self . super_rvalue ( rvalue, location) ;
128
133
}
0 commit comments