]> git.proxmox.com Git - rustc.git/blob - src/test/ui/mir/mir-inlining/no-trait-method-issue-40473.rs
New upstream version 1.52.0~beta.3+dfsg1
[rustc.git] / src / test / ui / mir / mir-inlining / no-trait-method-issue-40473.rs
1 // run-pass
2 // compile-flags:-Zmir-opt-level=3
3 pub trait Foo {
4 fn bar(&self) -> usize { 2 }
5 }
6
7 impl Foo for () {
8 fn bar(&self) -> usize { 3 }
9 }
10
11 // Test a case where MIR would inline the default trait method
12 // instead of bailing out. Issue #40473.
13 fn main() {
14 let result = ().bar();
15 assert_eq!(result, 3);
16 }