From b413596da6b17537dd8c8b626fbad97f921a2759 Mon Sep 17 00:00:00 2001 From: Douglas Campos Date: Wed, 6 Sep 2017 22:06:50 -0400 Subject: [PATCH] add broken test --- .../no-trait-method-issue-40473.rs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/test/run-pass/mir-inlining/no-trait-method-issue-40473.rs diff --git a/src/test/run-pass/mir-inlining/no-trait-method-issue-40473.rs b/src/test/run-pass/mir-inlining/no-trait-method-issue-40473.rs new file mode 100644 index 000000000000..3a18fcfd2883 --- /dev/null +++ b/src/test/run-pass/mir-inlining/no-trait-method-issue-40473.rs @@ -0,0 +1,23 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags:-Zmir-opt-level=2 +pub trait Foo { + fn bar(&self) -> usize { 2 } +} + +impl Foo for () { + fn bar(&self) -> usize { 3 } +} + +fn main() { + let result = ().bar(); + assert_eq!(result, 3); +}