Skip to content

Commit b8e9076

Browse files
committed
Add regression test for #86351
Signed-off-by: Yuki Okushi <[email protected]>
1 parent 90a9f69 commit b8e9076

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/ui/const_prop/issue-86351.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// compile-flags: --crate-type=lib -Zmir-opt-level=2
2+
// build-pass
3+
// ^-- Must be build-pass, because check-pass will not run const prop.
4+
5+
pub trait TestTrait {
6+
type MyType;
7+
fn func() -> Option<Self>
8+
where
9+
Self: Sized;
10+
}
11+
12+
impl<T> dyn TestTrait<MyType = T>
13+
where
14+
Self: Sized,
15+
{
16+
pub fn other_func() -> Option<Self> {
17+
match Self::func() {
18+
Some(me) => Some(me),
19+
None => None,
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)