From 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:39 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/const_prop/issue-86351.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/ui/const_prop/issue-86351.rs (limited to 'tests/ui/const_prop/issue-86351.rs') diff --git a/tests/ui/const_prop/issue-86351.rs b/tests/ui/const_prop/issue-86351.rs new file mode 100644 index 000000000..b5f1e7f74 --- /dev/null +++ b/tests/ui/const_prop/issue-86351.rs @@ -0,0 +1,22 @@ +// compile-flags: --crate-type=lib -Zmir-opt-level=2 +// build-pass +// ^-- Must be build-pass, because check-pass will not run const prop. + +pub trait TestTrait { + type MyType; + fn func() -> Option + where + Self: Sized; +} + +impl dyn TestTrait +where + Self: Sized, +{ + pub fn other_func() -> Option { + match Self::func() { + Some(me) => Some(me), + None => None, + } + } +} -- cgit v1.2.3