mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 14:31:55 +00:00
Add a regression test for #50041
AFAICT the test case never landed alongside the fix for the issue.
This commit is contained in:
parent
d03fe84169
commit
af0d099004
34
src/test/ui/mir/ssa-analysis-regression-50041.rs
Normal file
34
src/test/ui/mir/ssa-analysis-regression-50041.rs
Normal file
@ -0,0 +1,34 @@
|
||||
// build-pass
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
|
||||
#![crate_type="lib"]
|
||||
#![feature(lang_items)]
|
||||
#![no_std]
|
||||
|
||||
#[lang = "owned_box"]
|
||||
pub struct Box<T: ?Sized>(*mut T);
|
||||
|
||||
impl<T: ?Sized> Drop for Box<T> {
|
||||
fn drop(&mut self) {
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "box_free"]
|
||||
#[inline(always)]
|
||||
unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
|
||||
dealloc(ptr)
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
fn dealloc<T: ?Sized>(_: *mut 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user