@@ -32,15 +32,15 @@ pub fn check_validity_requirement<'tcx>(
32
32
33
33
let layout_cx = LayoutCx { tcx, param_env : param_env_and_ty. param_env } ;
34
34
if kind == ValidityRequirement :: Uninit || tcx. sess . opts . unstable_opts . strict_init_checks {
35
- might_permit_raw_init_strict ( layout, & layout_cx, kind)
35
+ check_validity_requirement_strict ( layout, & layout_cx, kind)
36
36
} else {
37
- might_permit_raw_init_lax ( layout, & layout_cx, kind)
37
+ check_validity_requirement_lax ( layout, & layout_cx, kind)
38
38
}
39
39
}
40
40
41
- /// Implements the 'strict' version of the `might_permit_raw_init ` checks; see that function for
41
+ /// Implements the 'strict' version of the `check_validity_requirement ` checks; see that function for
42
42
/// details.
43
- fn might_permit_raw_init_strict < ' tcx > (
43
+ fn check_validity_requirement_strict < ' tcx > (
44
44
ty : TyAndLayout < ' tcx > ,
45
45
cx : & LayoutCx < ' tcx , TyCtxt < ' tcx > > ,
46
46
kind : ValidityRequirement ,
@@ -65,6 +65,8 @@ fn might_permit_raw_init_strict<'tcx>(
65
65
// This does *not* actually check that references are dereferenceable, but since all types that
66
66
// require dereferenceability also require non-null, we don't actually get any false negatives
67
67
// due to this.
68
+ // The value we are validating is temporary and discarded at the end of this function, so
69
+ // there is no point in reseting provenance and padding.
68
70
Ok ( cx
69
71
. validate_operand (
70
72
& allocated. into ( ) ,
@@ -74,9 +76,9 @@ fn might_permit_raw_init_strict<'tcx>(
74
76
. is_ok ( ) )
75
77
}
76
78
77
- /// Implements the 'lax' (default) version of the `might_permit_raw_init ` checks; see that function for
79
+ /// Implements the 'lax' (default) version of the `check_validity_requirement ` checks; see that function for
78
80
/// details.
79
- fn might_permit_raw_init_lax < ' tcx > (
81
+ fn check_validity_requirement_lax < ' tcx > (
80
82
this : TyAndLayout < ' tcx > ,
81
83
cx : & LayoutCx < ' tcx , TyCtxt < ' tcx > > ,
82
84
init_kind : ValidityRequirement ,
@@ -141,7 +143,7 @@ fn might_permit_raw_init_lax<'tcx>(
141
143
}
142
144
FieldsShape :: Arbitrary { offsets, .. } => {
143
145
for idx in 0 ..offsets. len ( ) {
144
- if !might_permit_raw_init_lax ( this. field ( cx, idx) , cx, init_kind) ? {
146
+ if !check_validity_requirement_lax ( this. field ( cx, idx) , cx, init_kind) ? {
145
147
// We found a field that is unhappy with this kind of initialization.
146
148
return Ok ( false ) ;
147
149
}
0 commit comments