Rust
E0053 Method Signature Mismatch Fix
The method is there and the name is right — the compiler is objecting to one part of its type. A parameter typed i16 where the trait says u16, a return type that differs, a receiver that borrows the wrong way, an owned String where the trait promises a borrowed &str: each one is E0053, and each fix is the same move in a different place — rewrite that part of the implementation's signature so it matches the trait exactly, because callers are compiled against the trait's version, not yours.
Written November 26, 2026 · Tested with Rust 1.99.1 · 14 min read
- The error: a parameter of the wrong type
- A different part: the return type
- The receiver is part of the signature: mutability
- Borrowed in the trait, owned in the implementation
Written November 26, 2026
Tested with Rust 1.99.1
What this guide is
A trait declaration is a contract written in types. When a trait declares fn label(&self, width: u16) -> String;, every implementation of that trait owes a method with exactly that receiver, those parameter types, and that return type — not a close version, not a convertible version, the same types. E0053 is what the compiler reports when an implementation supplies the method but changes one part of its type: a method has an incompatible type for trait.
That is why every repair below changes a signature, never a call site and never a method body. The method's logic is usually fine; it is simply attached to the wrong type. The shapes differ only in which part of the signature drifted — a parameter type, the return type, the receiver's mutability, or a borrowed parameter written as an owned one — and in each case the compiler's notes print both signatures side by side, so the differing part can be read straight off the error.
The error: a parameter of the wrong type
This program implements the trait Label for Tag, but the implementation types the width parameter as i16 where the trait declares u16:
trait Label {
fn label(&self, width: u16) -> String;
}
struct Tag;
impl Label for Tag {
fn label(&self, width: i16) -> String {
format!("tag-{width}")
}
}
fn main() {
let tag = Tag;
println!("{}", tag.label(12));
}
$ rustc --edition 2021 broken_param.rs -o broken_param.bin
error[E0053]: method `label` has an incompatible type for trait
--> broken_param.rs:8:28
|
8 | fn label(&self, width: i16) -> String {
| ^^^ expected `u16`, found `i16`
|
note: type in trait
--> broken_param.rs:2:28
|
2 | fn label(&self, width: u16) -> String;
| ^^^
= note: expected signature `fn(&Tag, u16) -> String`
found signature `fn(&Tag, i16) -> String`
help: change the parameter type to match the trait
|
8 - fn label(&self, width: i16) -> String {
8 + fn label(&self, width: u16) -> String {
|
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0053`.
Read the notes, because they are the whole diagnosis. The span underlines only the differing parameter — i16 — and the note headed type in trait points back at the declaration. Below that, both signatures are printed in full: expected fn(&Tag, u16) -> String, found fn(&Tag, i16) -> String. Wherever your own error's two signature lines differ is exactly where the fix goes; everything that matches is left alone. The help then rewrites the one line for you.
The repair is to change the implementation's parameter type to the trait's. The body does not change — it formats whatever width it is given:
trait Label {
fn label(&self, width: u16) -> String;
}
struct Tag;
impl Label for Tag {
fn label(&self, width: u16) -> String {
format!("tag-{width}")
}
}
fn main() {
let tag = Tag;
println!("{}", tag.label(12));
}
$ rustc --edition 2021 fixed_param.rs -o fixed_param.bin
$ ./fixed_param.bin
tag-12
The program prints tag-12 and exits with status 0. Resist the other direction: changing the trait to i16 would also silence the error, but the trait is the contract other code is compiled against. Unless the trait itself is the mistake — a deliberate, project-wide decision — the implementation moves to the trait, never the other way round.
A different part: the return type
The same code covers a mismatch at the other end of the signature. Here the parameter matches and the return type does not: the trait promises String, the implementation returns the u16 it was given:
trait Label {
fn label(&self, width: u16) -> String;
}
struct Tag;
impl Label for Tag {
fn label(&self, width: u16) -> u16 {
width
}
}
fn main() {
let tag = Tag;
println!("{}", tag.label(12));
}
$ rustc --edition 2021 broken_return.rs -o broken_return.bin
error[E0053]: method `label` has an incompatible type for trait
--> broken_return.rs:8:36
|
8 | fn label(&self, width: u16) -> u16 {
| ^^^ expected `String`, found `u16`
|
note: type in trait
--> broken_return.rs:2:36
|
2 | fn label(&self, width: u16) -> String;
| ^^^^^^
= note: expected signature `fn(&Tag, _) -> String`
found signature `fn(&Tag, _) -> u16`
help: change the output type to match the trait
|
8 - fn label(&self, width: u16) -> u16 {
8 + fn label(&self, width: u16) -> String {
|
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0053`.
The shape is identical and the wording shifts by one word: the span now sits on the return type, the note reads expected signature fn(&Tag, _) -> String against found signature fn(&Tag, _) -> u16, and the help says to change the output type to match the trait. Fixing it means the implementation actually produces the promised type — here, formatting the width into a String, which is the same corrected program as the previous section:
$ rustc --edition 2021 fixed_return.rs -o fixed_return.bin
$ ./fixed_return.bin
tag-12
The program prints tag-12 and exits with status 0. A return-type mismatch is the shape most often produced by an unfinished edit: the trait was changed to return a richer type, the call sites were updated, and one implementation still returns the old type. The two signature lines in the note are the fastest way to find which implementation was missed — the compiler names it in the header.
The receiver is part of the signature: mutability
The receiver counts as part of the method's type, so &self and &mut self are different signatures, not a detail the compiler overlooks. This trait requires a mutable receiver, because resetting a counter has to change it; the implementation takes a shared one:
trait Reset {
fn reset(&mut self);
}
struct Counter {
value: u32,
}
impl Reset for Counter {
fn reset(&self) {
println!("value = {}", self.value);
}
}
fn main() {
let mut counter = Counter { value: 7 };
counter.reset();
println!("value = {}", counter.value);
}
$ rustc --edition 2021 broken_receiver.rs -o broken_receiver.bin
error[E0053]: method `reset` has an incompatible type for trait
--> broken_receiver.rs:10:14
|
10 | fn reset(&self) {
| ^^^^^ types differ in mutability
|
note: type in trait
--> broken_receiver.rs:2:14
|
2 | fn reset(&mut self);
| ^^^^^^^^^
= note: expected signature `fn(&mut Counter)`
found signature `fn(&Counter)`
help: change the self-receiver type to match the trait
|
10 | fn reset(&mut self) {
| +++
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0053`.
The label is different from the other shapes — types differ in mutability — and the signatures are printed as fn(&mut Counter) expected against fn(&Counter) found. The help rewrites the receiver in place, adding the mut the trait declares.
Matching the trait means the implementation takes &mut self, which is also what its body needs in order to do the work the trait describes:
trait Reset {
fn reset(&mut self);
}
struct Counter {
value: u32,
}
impl Reset for Counter {
fn reset(&mut self) {
self.value = 0;
}
}
fn main() {
let mut counter = Counter { value: 7 };
counter.reset();
println!("value = {}", counter.value);
}
$ rustc --edition 2021 fixed_receiver.rs -o fixed_receiver.bin
$ ./fixed_receiver.bin
value = 0
The program prints value = 0 and exits with status 0. Note what else had to agree: the call site declares the counter mut, because a &mut self method can only be called on a mutable binding. That is not extra ceremony — it is the trait's contract reaching the caller, and it is why the receiver in a trait declaration is a real design decision rather than a default to copy.
Borrowed in the trait, owned in the implementation
A reference is a different type from the value it points at, so a parameter declared as &str is not satisfied by a parameter typed String, even though one converts to the other at a call site. This trait borrows the name; the implementation takes ownership of it:
trait Greet {
fn greet(&self, name: &str) -> String;
}
struct Host;
impl Greet for Host {
fn greet(&self, name: String) -> String {
format!("hello, {name}")
}
}
fn main() {
let host = Host;
println!("{}", host.greet("Ada"));
}
$ rustc --edition 2021 broken_ref.rs -o broken_ref.bin
error[E0053]: method `greet` has an incompatible type for trait
--> broken_ref.rs:8:27
|
8 | fn greet(&self, name: String) -> String {
| ^^^^^^ expected `&str`, found `String`
|
note: type in trait
--> broken_ref.rs:2:27
|
2 | fn greet(&self, name: &str) -> String;
| ^^^^
= note: expected signature `fn(&Host, &str) -> String`
found signature `fn(&Host, String) -> String`
help: change the parameter type to match the trait
|
8 - fn greet(&self, name: String) -> String {
8 + fn greet(&self, name: &str) -> String {
|
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0053`.
The span underlines String, the note compares fn(&Host, &str) -> String with fn(&Host, String) -> String, and the help changes the parameter type to match the trait. No conversion inside the body fixes this — an &str parameter and a String parameter are different types, and the check is on the types themselves, before any body is considered.
The corrected implementation borrows, exactly as declared:
trait Greet {
fn greet(&self, name: &str) -> String;
}
struct Host;
impl Greet for Host {
fn greet(&self, name: &str) -> String {
format!("hello, {name}")
}
}
fn main() {
let host = Host;
println!("{}", host.greet("Ada"));
}
$ rustc --edition 2021 fixed_ref.rs -o fixed_ref.bin
$ ./fixed_ref.bin
hello, Ada
The program prints hello, Ada and exits with status 0, called with a string literal that was never owned by the caller in the first place. The direction matters for API design as well as for this error: a trait that declares &str promises implementors will not demand ownership, and a trait that declares String promises callers must give it up. Whichever the trait says is what every implementation must repeat.
Neighboring case: the wrong number of parameters is a different error
Changing how many parameters a method takes is not E0053. This program adds a second parameter to the same label method:
trait Label {
fn label(&self, width: u16) -> String;
}
struct Tag;
impl Label for Tag {
fn label(&self, width: u16, extra: u16) -> String {
format!("tag-{width}-{extra}")
}
}
fn main() {
let tag = Tag;
println!("{}", tag.label(12));
}
$ rustc --edition 2021 neighbour_count.rs -o neighbour_count.bin
error[E0050]: method `label` has 3 parameters but the declaration in trait `Label::label` has 2
--> neighbour_count.rs:8:14
|
2 | fn label(&self, width: u16) -> String;
| ----------------- trait requires 2 parameters
...
8 | fn label(&self, width: u16, extra: u16) -> String {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 2 parameters, found 3
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0050`.
The code is E0050, not E0053, and its header counts instead of comparing types: the method has 3 parameters but the declaration in the trait has 2 — the receiver is counted on both sides. The split between the two codes is a useful diagnostic shortcut. E0053 means the method has the right shape and one type inside it differs; E0050 means the shape itself has the wrong number of parts. A missing method altogether is E0046, and a method the trait never declared is E0407 — four different defects around the same impl block, each fixed differently.
The exact rule: the implementation's signature must match the declaration
The official page for E0053 states the rule in one sentence: the parameters of any trait method must match between a trait implementation and the trait definition. Its erroneous example changes two things at once — a u16 parameter implemented as i16, with the comment error, expected u16, found i16, and a &self method implemented as &mut self, with the comment error, types differ in mutability — the two labels the programs above reproduce one at a time.
The Rust Book's chapter on traits gives the reason the match has to be exact: after a method signature in a trait, instead of an implementation there is a semicolon, each implementing type must provide its own body for the method, and the compiler will enforce that any type with the trait has the method defined with this signature exactly. Exactly is the operative word — it is what rules out fixing a mismatch with a conversion inside the body.
The Reference's page on traits states the same obligation from the declaration side: trait functions may omit the function body by replacing it with a semicolon, and that indicates that the implementation must define the function. The definition the implementation supplies is checked against the declaration as a whole type — receiver, parameters, and return — which is why a difference in any one part produces the same error code with a different underlined span.
The fixes, ranked
- First, read the two signature lines in the note. Expected is the trait's signature, found is yours; the part that differs between them is the whole bug, and the help line usually rewrites it for you.
- Second, change the implementation to match the trait — the parameter type, the return type, or the receiver, whichever the span underlines. The trait is the contract; callers and other implementations are compiled against it.
- Third, if the differing part is the receiver, check the call sites after fixing it. A method that now takes
&mut selfneeds mutable bindings at its calls, and that requirement is the trait working as designed. - Fourth, treat a borrowed-versus-owned difference as a type difference, because the compiler does. Change the implementation's parameter to the borrowed form the trait declares, or — only as a deliberate trait redesign — change the trait and every implementation together.
- Only change the trait itself when the trait is genuinely wrong, and then change it once, deliberately, knowing every implementation and caller moves with it. Silencing one E0053 by editing the trait trades one error here for mismatches everywhere else.
- Do not paper over a mismatch with a conversion, a cast, or a wrapper inside the body. The check is on the signature's types; a body that converts still leaves the wrong signature in place and the error untouched.
Which fix for which cause
| Cause | Message | Fix |
|---|---|---|
| Parameter type differs | E0053, expected u16, found i16 |
Match the impl parameter to the trait |
| Return type differs | E0053, expected String, found u16 |
Return the trait's type from the impl |
| Receiver mutability differs | E0053, types differ in mutability | Match &self / &mut self to the trait |
| Borrowed vs owned parameter | E0053, expected &str, found String |
Use the trait's borrowed form in the impl |
| Wrong number of parameters | E0050, has 3 parameters, declaration has 2 | Add or remove a parameter to match |
Checklist
- Find the two signature lines in your error's notes before editing anything. The difference between expected and found is the complete list of what to change.
- Note which part the span underlines: a parameter, the return type, or the receiver. Same code, three different edits.
- Change the implementation, not the trait, unless the trait is the deliberate redesign. One impl moving is a fix; the contract moving is a project decision.
- After a receiver fix, check the call sites again for
mutbindings. The compiler will ask for them, and that is the contract arriving, not a new problem. - Count parameters if the header mentions a number. A count in the header means E0050, and the repair is about how many parameters there are, not what type they have.
- If the method is missing entirely or not in the trait at all, you are in a different error — E0046 for a missing item, E0407 for an extra one — and signature edits will not help.
Related guides on this site
- E0049 Method Type Parameter Count Fix
- E0271 Type Mismatch Resolving Fix
- E0631 Type Mismatch in Closure Fix
- Fix Rust E0308 "mismatched types" — Convert the Value, Fix the Signature, or Give Both Sides One Type
Sources
- Rust Compiler Error Index, E0053 — for the parameters of any trait method having to match between a trait implementation and the trait definition, and for its two erroneous shapes: a parameter of a different type, and a receiver whose mutability differs.
- The Rust Book, Traits: Defining Shared Behavior — for a trait method signature ending in a semicolon, for each implementing type providing its own body, and for the compiler enforcing that the method is defined with the trait's signature exactly.
- The Rust Reference, Traits — for a trait function omitting its body by replacing it with a semicolon to indicate that the implementation must define the function.
- Rust Compiler Error Index, E0050 — for an attempted implementation of a trait method having the wrong number of function parameters, and for the fix of giving the implementation the same parameters as the declaration.
Keep Exploring
The full Rust hub \u2014 ownership, structs and enums, async, and measured comparisons.
Every guide on the site in one list, grouped by topic.
Every browser-only checker and verifier on the site.
The C++, Python, Sysadmin, Rust, Go, and TypeScript hubs.