diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-01-16 17:30:12 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-16 17:30:12 +0000 |
| commit | b67689bdf504522bbd1bc0c8480c6c6cdbb042b8 (patch) | |
| tree | a0fdb0207354702ddf4960c5248dd3f4866eb2b5 /src/test | |
| parent | 9df8dcbcde0221a62816d28a7c3bb2e0444ccad3 (diff) | |
| parent | af0d099004e1b1ffe19109fba5813aebfd435437 (diff) | |
| download | rust-b67689bdf504522bbd1bc0c8480c6c6cdbb042b8.tar.gz rust-b67689bdf504522bbd1bc0c8480c6c6cdbb042b8.zip | |
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.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/mir/ssa-analysis-regression-50041.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/ui/mir/ssa-analysis-regression-50041.rs b/src/test/ui/mir/ssa-analysis-regression-50041.rs new file mode 100644 index 00000000000..c818f2976e1 --- /dev/null +++ b/src/test/ui/mir/ssa-analysis-regression-50041.rs @@ -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 +} |
