rust/tests/ui/mir/ssa-analysis-regression-50041.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
588 B
Rust
Raw Normal View History

//@ build-pass
//@ compile-flags: -Z mir-opt-level=4
2022-05-14 04:53:03 +00:00
#![crate_type = "lib"]
#![feature(lang_items)]
#![no_std]
2022-05-09 04:23:52 +00:00
struct NonNull<T: ?Sized>(*const T);
2022-05-14 04:53:03 +00:00
struct Unique<T: ?Sized>(NonNull<T>);
#[lang = "owned_box"]
2022-05-14 04:53:03 +00:00
pub struct Box<T: ?Sized>(Unique<T>);
impl<T: ?Sized> Drop for Box<T> {
#[inline(always)]
fn drop(&mut self) {
dealloc(self.0.0.0)
}
}
#[inline(never)]
2022-05-09 04:23:52 +00:00
fn dealloc<T: ?Sized>(_: *const T) {}
pub struct Foo<T>(T);
pub fn foo(a: Option<Box<Foo<usize>>>) -> usize {
let f = match a {
None => Foo(0),
Some(vec) => *vec,
};
f.0
}