@@ -37,24 +37,17 @@ impl<'tcx> Visitor<'tcx> for PackedRefChecker<'_, 'tcx> {
37
37
}
38
38
39
39
fn visit_place ( & mut self , place : & Place < ' tcx > , context : PlaceContext , _location : Location ) {
40
- if context. is_borrow ( ) {
41
- if util:: is_disaligned ( self . tcx , self . body , self . param_env , * place) {
42
- let def_id = self . body . source . instance . def_id ( ) ;
43
- if let Some ( impl_def_id) = self . tcx . impl_of_method ( def_id)
44
- && self . tcx . is_builtin_derived ( impl_def_id)
45
- {
46
- // If we ever reach here it means that the generated derive
47
- // code is somehow doing an unaligned reference, which it
48
- // shouldn't do.
49
- span_bug ! (
50
- self . source_info. span,
51
- "builtin derive created an unaligned reference"
52
- ) ;
53
- } else {
54
- self . tcx
55
- . dcx ( )
56
- . emit_err ( errors:: UnalignedPackedRef { span : self . source_info . span } ) ;
57
- }
40
+ if context. is_borrow ( ) && util:: is_disaligned ( self . tcx , self . body , self . param_env , * place) {
41
+ let def_id = self . body . source . instance . def_id ( ) ;
42
+ if let Some ( impl_def_id) = self . tcx . impl_of_method ( def_id)
43
+ && self . tcx . is_builtin_derived ( impl_def_id)
44
+ {
45
+ // If we ever reach here it means that the generated derive
46
+ // code is somehow doing an unaligned reference, which it
47
+ // shouldn't do.
48
+ span_bug ! ( self . source_info. span, "builtin derive created an unaligned reference" ) ;
49
+ } else {
50
+ self . tcx . dcx ( ) . emit_err ( errors:: UnalignedPackedRef { span : self . source_info . span } ) ;
58
51
}
59
52
}
60
53
}
0 commit comments