Skip to content

Commit e52d94e

Browse files
committed
make it even more conservative
1 parent 5c5a10e commit e52d94e

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/librustc_target/abi/mod.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -1144,11 +1144,14 @@ impl<'a, Ty> TyLayout<'a, Ty> {
11441144
FieldPlacement::Array { .. } =>
11451145
// FIXME(#66151): The widely use smallvec 0.6 creates uninit arrays
11461146
// with any element type, so let us not (yet) complain about that.
1147-
// count == 0 ||
1148-
// self.field(cx, 0).to_result()?.might_permit_raw_init(cx, zero)?
1147+
/* count == 0 ||
1148+
self.field(cx, 0).to_result()?.might_permit_raw_init(cx, zero)? */
11491149
true,
1150-
FieldPlacement::Arbitrary { ref offsets, .. } => {
1151-
let mut res = true;
1150+
FieldPlacement::Arbitrary { .. } => {
1151+
// FIXME(#66151) cargo depends on sized-chunks 0.3.0 which
1152+
// has some illegal zero-initialization, so let us not (yet)
1153+
// complain about aggregates either.
1154+
/* let mut res = true;
11521155
// Check that all fields accept zero-init.
11531156
for idx in 0..offsets.len() {
11541157
let field = self.field(cx, idx).to_result()?;
@@ -1157,7 +1160,8 @@ impl<'a, Ty> TyLayout<'a, Ty> {
11571160
break;
11581161
}
11591162
}
1160-
res
1163+
res */
1164+
true
11611165
}
11621166
}
11631167
}

src/test/ui/intrinsics/panic-uninitialized-zeroed.rs

+2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ fn main() {
9292
"attempted to zero-initialize type `*const dyn std::marker::Send`, which is invalid"
9393
);
9494

95+
/* FIXME(#66151) we conservatively do not error here yet.
9596
test_panic_msg(
9697
|| mem::uninitialized::<(NonNull<u32>, u32, u32)>(),
9798
"attempted to leave type `(std::ptr::NonNull<u32>, u32, u32)` uninitialized, \
@@ -102,6 +103,7 @@ fn main() {
102103
"attempted to zero-initialize type `(std::ptr::NonNull<u32>, u32, u32)`, \
103104
which is invalid"
104105
);
106+
*/
105107

106108
test_panic_msg(
107109
|| mem::uninitialized::<bool>(),

0 commit comments

Comments
 (0)