summaryrefslogtreecommitdiffstats
path: root/src/test/ui/traits/static-method-overwriting.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/traits/static-method-overwriting.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/ui/traits/static-method-overwriting.rs b/src/test/ui/traits/static-method-overwriting.rs
new file mode 100644
index 000000000..f669ffae6
--- /dev/null
+++ b/src/test/ui/traits/static-method-overwriting.rs
@@ -0,0 +1,34 @@
+// run-pass
+#![allow(dead_code)]
+mod base {
+ pub trait HasNew {
+ fn new() -> Self;
+ }
+
+ pub struct Foo {
+ dummy: (),
+ }
+
+ impl ::base::HasNew for Foo {
+ fn new() -> Foo {
+ println!("Foo");
+ Foo { dummy: () }
+ }
+ }
+
+ pub struct Bar {
+ dummy: (),
+ }
+
+ impl ::base::HasNew for Bar {
+ fn new() -> Bar {
+ println!("Bar");
+ Bar { dummy: () }
+ }
+ }
+}
+
+pub fn main() {
+ let _f: base::Foo = base::HasNew::new();
+ let _b: base::Bar = base::HasNew::new();
+}