summaryrefslogtreecommitdiffstats
path: root/src/test/ui/mir/mir-inlining/no-trait-method-issue-40473.rs
blob: 8b3cb703dc0de181d9645939739611b2322696ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// run-pass
// compile-flags:-Zmir-opt-level=3
pub trait Foo {
    fn bar(&self) -> usize { 2 }
}

impl Foo for () {
    fn bar(&self) -> usize { 3 }
}

// Test a case where MIR would inline the default trait method
// instead of bailing out. Issue #40473.
fn main() {
    let result = ().bar();
    assert_eq!(result, 3);
}