about summary refs log tree commit diff
path: root/tests/crashes/126680.rs
blob: dcb6ccad6b42209c111279292b1c26e69561d625 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//@ known-bug: rust-lang/rust#126680
//@ compile-flags: -Zvalidate-mir
#![feature(type_alias_impl_trait)]
type Bar = impl std::fmt::Display;

use std::path::Path;

struct A {
    pub func: fn(check: Bar, b: Option<&Path>),
}

#[define_opaque(Bar)]
fn foo() -> A {
    A {
        func: |check, b| {
            if check {
                ()
            } else if let Some(_) = b.and_then(|p| p.parent()) {
                ()
            }
        },
    }
}

fn main() {}