Skip to content

Commit

Permalink
Update src/test/ui/unsized/issue-97732.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Eduard-Mihai Burtescu <edy.burt@gmail.com>
  • Loading branch information
Kixiron and eddyb committed Jun 6, 2022
1 parent 857453d commit 10336cf
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/test/ui/unsized/issue-97732.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

0 comments on commit 10336cf

Please sign in to comment.