about summary refs log tree commit diff
path: root/tests/ui/delegation/bad-resolve.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/delegation/bad-resolve.rs')
-rw-r--r--tests/ui/delegation/bad-resolve.rs47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/ui/delegation/bad-resolve.rs b/tests/ui/delegation/bad-resolve.rs
new file mode 100644
index 00000000000..df456f94507
--- /dev/null
+++ b/tests/ui/delegation/bad-resolve.rs
@@ -0,0 +1,47 @@
+#![feature(fn_delegation)]
+//~^ WARN the feature `fn_delegation` is incomplete
+
+trait Trait {
+    const C: u32 = 0;
+    type Type;
+    fn bar() {}
+    fn foo(&self, x: i32) -> i32 { x }
+}
+
+struct F;
+impl Trait for F {
+    type Type = i32;
+}
+
+impl F {
+    fn foo(&self, x: i32) -> i32 { x }
+}
+
+struct S(F);
+
+impl Trait for S {
+//~^ ERROR not all trait items implemented, missing: `Type`
+    reuse <F as Trait>::C;
+    //~^ ERROR item `C` is an associated method, which doesn't match its trait `Trait`
+    //~| ERROR expected function, found associated constant `Trait::C`
+    reuse <F as Trait>::Type;
+    //~^ ERROR item `Type` is an associated method, which doesn't match its trait `Trait`
+    //~| ERROR expected method or associated constant, found associated type `Trait::Type`
+    reuse <F as Trait>::baz;
+    //~^ ERROR method `baz` is not a member of trait `Trait`
+    //~| ERROR cannot find method or associated constant `baz` in trait `Trait`
+    reuse <F as Trait>::bar;
+
+    reuse foo { &self.0 }
+    //~^ ERROR cannot find function `foo` in this scope
+    reuse F::foo { &self.0 }
+    //~^ ERROR cannot find function `foo` in `F`
+    //~| ERROR duplicate definitions with name `foo`
+}
+
+impl S {
+    reuse F::foo { &self.0 }
+    //~^ ERROR cannot find function `foo` in `F`
+}
+
+fn main() {}