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

Fix ICEs from zsts within unsized types with non-zero offsets #97738

Merged
merged 3 commits into from
Jun 7, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update src/test/ui/unsized/issue-97732.rs
Co-authored-by: Eduard-Mihai Burtescu <edy.burt@gmail.com>
Kixiron and eddyb authored Jun 6, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 10336cf1624ada36e8ba64e851d4df3f2976da81
11 changes: 8 additions & 3 deletions src/test/ui/unsized/issue-97732.rs
Original file line number Diff line number Diff line change
@@ -15,9 +15,14 @@ impl<S: ?Sized, T: ?Sized> CoerceUnsized<BoxWithZstTail<T>> for BoxWithZstTail<S
}

pub fn noop_dyn_upcast_with_zst_tail(
b: BoxWithZstTail<dyn Send + Sync>,
) -> BoxWithZstTail<dyn Send> {
b: BoxWithZstTail<dyn ToString + Send>,
) -> BoxWithZstTail<dyn ToString> {
b
}

fn main() {}
fn main() {
let original = "foo";
let boxed = BoxWithZstTail(Box::new(original) as Box<dyn ToString + Send>, ());
let noop_upcasted = noop_dyn_upcast_with_zst_tail(boxed);
assert_eq!(original, noop_upcasted.0.to_string());
}