Skip to content

Commit a2f44ac

Browse files
committed
We ignore all references to size 0 align 1 data.
1 parent 6770c21 commit a2f44ac

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/rustc_middle/src/ty/layout.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -3498,7 +3498,7 @@ fn make_thin_self_ptr<'tcx>(
34983498
///
34993499
/// This code is intentionally conservative, and will not detect
35003500
/// * making uninitialized types who have a full valid range (ints, floats, raw pointers)
3501-
/// * uninit `&[T]` where T has align 1 (only inside arrays). This includes `&str`
3501+
/// * uninit `&T` where T has align 1 size 0 (only inside arrays).
35023502
/// * zero init enums where a discriminant with tag 0 exists, but is invalid to be zeroed
35033503
/// * zero init type that does not allow zero init (only inside arrays)
35043504
///
@@ -3547,7 +3547,8 @@ where
35473547
// See: https://github.com/rust-lang/rust/pull/99389
35483548
if inside_array {
35493549
match init_kind {
3550-
// FIXME(#66151) We need to ignore uninit slice references with an alignment of 1
3550+
// FIXME(#66151) We need to ignore uninit references with an alignment of 1 and
3551+
// size 0
35513552
// (as in, &[u8] and &str)
35523553
// Since if we do not, old versions of `hyper` with no semver compatible fix
35533554
// (0.11, 0.12, 0.13) break.

0 commit comments

Comments
 (0)