mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Rollup merge of #81060 - nagisa:nagisa/regression-50041, r=Mark-Simulacrum
Add a regression test for #50041 AFAICT the test case never landed alongside the fix for the issue.
This commit is contained in:
commit
b67689bdf5
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