rust/tests/ui/mir/mir-inlining/no-trait-method-issue-40473.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
325 B
Rust
Raw Normal View History

// run-pass
// compile-flags:-Zmir-opt-level=3
2017-09-06 21:06:50 -05:00
pub trait Foo {
fn bar(&self) -> usize { 2 }
}
impl Foo for () {
fn bar(&self) -> usize { 3 }
}
2017-09-06 22:10:08 -05:00
// Test a case where MIR would inline the default trait method
// instead of bailing out. Issue #40473.
2017-09-06 21:06:50 -05:00
fn main() {
let result = ().bar();
assert_eq!(result, 3);
}