-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #81060 - nagisa:nagisa/regression-50041, r=Mark-Simul…
…acrum Add a regression test for #50041 AFAICT the test case never landed alongside the fix for the issue.
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |