Skip to content

Commit cd69b0a

Browse files
committed
make it even more conservative
1 parent e2b1a5a commit cd69b0a

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
@@ -1129,11 +1129,14 @@ impl<'a, Ty> TyLayout<'a, Ty> {
11291129
FieldPlacement::Array { .. } =>
11301130
// FIXME(#66151): The widely use smallvec 0.6 creates uninit arrays
11311131
// with any element type, so let us not (yet) complain about that.
1132-
// count == 0 ||
1133-
// self.field(cx, 0).to_result()?.might_permit_raw_init(cx, zero)?
1132+
/* count == 0 ||
1133+
self.field(cx, 0).to_result()?.might_permit_raw_init(cx, zero)? */
11341134
true,
1135-
FieldPlacement::Arbitrary { ref offsets, .. } => {
1136-
let mut res = true;
1135+
FieldPlacement::Arbitrary { .. } => {
1136+
// FIXME(#66151) cargo depends on sized-chunks 0.3.0 which
1137+
// has some illegal zero-initialization, so let us not (yet)
1138+
// complain about aggregates either.
1139+
/* let mut res = true;
11371140
// Check that all fields accept zero-init.
11381141
for idx in 0..offsets.len() {
11391142
let field = self.field(cx, idx).to_result()?;
@@ -1142,7 +1145,8 @@ impl<'a, Ty> TyLayout<'a, Ty> {
11421145
break;
11431146
}
11441147
}
1145-
res
1148+
res */
1149+
true
11461150
}
11471151
}
11481152
}

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)