]> git.proxmox.com Git - rustc.git/blame - src/test/ui/mir/ssa-analysis-regression-50041.rs
New upstream version 1.52.0~beta.3+dfsg1
[rustc.git] / src / test / ui / mir / ssa-analysis-regression-50041.rs
CommitLineData
5869c6ff 1// build-pass
6a06907d 2// compile-flags: -Z mir-opt-level=4
5869c6ff
XL
3
4#![crate_type="lib"]
5#![feature(lang_items)]
6#![no_std]
7
8#[lang = "owned_box"]
9pub struct Box<T: ?Sized>(*mut T);
10
11impl<T: ?Sized> Drop for Box<T> {
12 fn drop(&mut self) {
13 }
14}
15
16#[lang = "box_free"]
17#[inline(always)]
18unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
19 dealloc(ptr)
20}
21
22#[inline(never)]
23fn dealloc<T: ?Sized>(_: *mut T) {
24}
25
26pub struct Foo<T>(T);
27
28pub 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}