Skip to content

Commit af0d099

Browse files
committed
Add a regression test for #50041
AFAICT the test case never landed alongside the fix for the issue.
1 parent d03fe84 commit af0d099

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// build-pass
2+
// compile-flags: -Z mir-opt-level=3
3+
4+
#![crate_type="lib"]
5+
#![feature(lang_items)]
6+
#![no_std]
7+
8+
#[lang = "owned_box"]
9+
pub struct Box<T: ?Sized>(*mut T);
10+
11+
impl<T: ?Sized> Drop for Box<T> {
12+
fn drop(&mut self) {
13+
}
14+
}
15+
16+
#[lang = "box_free"]
17+
#[inline(always)]
18+
unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
19+
dealloc(ptr)
20+
}
21+
22+
#[inline(never)]
23+
fn dealloc<T: ?Sized>(_: *mut T) {
24+
}
25+
26+
pub struct Foo<T>(T);
27+
28+
pub fn foo(a: Option<Box<Foo<usize>>>) -> usize {
29+
let f = match a {
30+
None => Foo(0),
31+
Some(vec) => *vec,
32+
};
33+
f.0
34+
}

0 commit comments

Comments
 (0)