Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make uninit checks stricter but avoid issues for old hyper #99389

Closed
wants to merge 8 commits into from
Prev Previous commit
Next Next commit
We ignore all references to size 0 align 1 data.
  • Loading branch information
5225225 committed Aug 1, 2022
commit a2f44ac649af95a294520a5ec49080b94f495e91
5 changes: 3 additions & 2 deletions compiler/rustc_middle/src/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3498,7 +3498,7 @@ fn make_thin_self_ptr<'tcx>(
///
/// This code is intentionally conservative, and will not detect
/// * making uninitialized types who have a full valid range (ints, floats, raw pointers)
/// * uninit `&[T]` where T has align 1 (only inside arrays). This includes `&str`
/// * uninit `&T` where T has align 1 size 0 (only inside arrays).
/// * zero init enums where a discriminant with tag 0 exists, but is invalid to be zeroed
/// * zero init type that does not allow zero init (only inside arrays)
///
Expand Down Expand Up @@ -3547,7 +3547,8 @@ where
// See: https://github.com/rust-lang/rust/pull/99389
if inside_array {
match init_kind {
// FIXME(#66151) We need to ignore uninit slice references with an alignment of 1
// FIXME(#66151) We need to ignore uninit references with an alignment of 1 and
// size 0
// (as in, &[u8] and &str)
// Since if we do not, old versions of `hyper` with no semver compatible fix
// (0.11, 0.12, 0.13) break.
Expand Down