]> git.lizzy.rs Git - rust.git/blobdiff - src/test/compile-fail/vtable-res-trait-param.rs
rollup merge of #17355 : gamazeps/issue17210
[rust.git] / src / test / compile-fail / vtable-res-trait-param.rs
index bd886f44ede848c84b492e83178d49514c9c7935..12cfe9c20fa9b5e6ba7d085e33ea949bfc1720a6 100644 (file)
@@ -9,25 +9,25 @@
 // except according to those terms.
 
 trait TraitA {
-    fn method_a() -> int;
+    fn method_a(&self) -> int;
 }
 
 trait TraitB {
-    fn gimme_an_a<A:TraitA>(a: A) -> int;
+    fn gimme_an_a<A:TraitA>(&self, a: A) -> int;
 }
 
 impl TraitB for int {
-    fn gimme_an_a<A:TraitA>(a: A) -> int {
-        a.method_a() + self
+    fn gimme_an_a<A:TraitA>(&self, a: A) -> int {
+        a.method_a() + *self
     }
 }
 
 fn call_it<B:TraitB>(b: B)  -> int {
     let y = 4u;
-    b.gimme_an_a(y) //~ ERROR failed to find an implementation of trait @TraitA
+    b.gimme_an_a(y) //~ ERROR the trait `TraitA` is not implemented
 }
 
 fn main() {
     let x = 3i;
-    assert call_it(x) == 22;
+    assert_eq!(call_it(x), 22);
 }