diff options
Diffstat (limited to 'tests/ui/traits/trait-method-signature-mismatch.rs')
| -rw-r--r-- | tests/ui/traits/trait-method-signature-mismatch.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/ui/traits/trait-method-signature-mismatch.rs b/tests/ui/traits/trait-method-signature-mismatch.rs index 719005d6643..118aff69e4e 100644 --- a/tests/ui/traits/trait-method-signature-mismatch.rs +++ b/tests/ui/traits/trait-method-signature-mismatch.rs @@ -1,10 +1,15 @@ +//! This test verifies that implementing a trait method with a signature that does not +//! exactly match its declaration in the trait results in a compilation error. +//! Specifically, it checks for errors when the number of parameters or the return type +//! in the `impl` differs from the trait definition. + trait Foo { fn foo(&mut self, x: i32, y: i32) -> i32; } impl Foo for i32 { fn foo( - &mut self, //~ ERROR + &mut self, //~ ERROR method `foo` has 2 parameters but the declaration x: i32, ) { } |
