From 881c5b5a6dd8d22a184c5f2cfb2f054ad0d2a113 Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Sat, 11 Nov 2017 23:14:01 +0900 Subject: [PATCH] Add a test for #2021 --- tests/source/match.rs | 9 +++++++++ tests/target/match.rs | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/tests/source/match.rs b/tests/source/match.rs index 19d30b0dd00..7f15b88f4e9 100644 --- a/tests/source/match.rs +++ b/tests/source/match.rs @@ -425,3 +425,12 @@ fn issue_2099() { match x {} } + +// #2021 +impl<'tcx> Const<'tcx> { + pub fn from_constval<'a>() -> Const<'tcx> { + let val = match *cv { + ConstVal::Variant(_) | ConstVal::Aggregate(..) | ConstVal::Unevaluated(..) => bug!("MIR must not use `{:?}` (aggregates are expanded to MIR rvalues)", cv), + }; + } +} diff --git a/tests/target/match.rs b/tests/target/match.rs index 676b8603f2c..257a26d15ba 100644 --- a/tests/target/match.rs +++ b/tests/target/match.rs @@ -463,3 +463,15 @@ fn issue_2099() { match x {} } + +// #2021 +impl<'tcx> Const<'tcx> { + pub fn from_constval<'a>() -> Const<'tcx> { + let val = match *cv { + ConstVal::Variant(_) | ConstVal::Aggregate(..) | ConstVal::Unevaluated(..) => bug!( + "MIR must not use `{:?}` (aggregates are expanded to MIR rvalues)", + cv + ), + }; + } +}