Rust: error[E0369]: binary operation `+` cannot be applied to type `Foo` / cannot add `&str` to `&str`
An operator (+, ==, <) isn't implemented for the operand types.
error[E0369]: binary operation `+` cannot be applied to type `&str`cannot add `&str` to `&str`error[E0369]: binary operation `==` cannot be applied to type `Foo`binary operation `+` cannot be applied to type `T`error[E0369]: binary operation `<` cannot be applied Meaning
Implement the operator trait (impl Add for Foo, #[derive(PartialEq)] for ==), convert types (String + &str, format!), or dereference references. &str + &str isn't allowed: use format!("{a}{b}") or a.to_owned() + b. Floats don't implement Eq/Ord.
Common causes
&str + &str- Custom struct without
Add/PartialEqimpl - References vs values (
&i32 + i32is ok,&Foo + Foonot) - Comparing floats with Ord
- Generic
Tlacking the operator bound
⚡ Quick fix
format!("{a}{b}")ora.to_string() + b#[derive(PartialEq)]/impl Add for Foo- Add bounds
T: std::ops::Add<Output = T>
Detailed fix by platform
Rust
let s = format!("{first} {last}");
How to diagnose
- Operator — Trait implemented?
- Types — Reference/owned?
- Bound — Generic?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Blocking waiting for file lock on package cache / build directory Cargo: Blocking waiting for file lock on package cache / on build directory
- cargo: failed to get from registry (spurious network error) Cargo: warning: spurious network error (2 tries remaining): [35] SSL connect error / error: failed to download from `https://index.crates.io/...`
- cargo: failed to select a version for the requirement Cargo: error: failed to select a version for the requirement `serde = "^2.0"` — candidate versions found which didn't match: 1.0.197
Most viewed in Rust
- E0382 Rust: error[E0382]: borrow of moved value: `x`
- E0502 Rust: error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
- feature edition2024 is required / Cargo.lock version too new Cargo: error: failed to parse manifest — feature `edition2024` is required / lock file version 4 requires `-Znext-lockfile-bump`
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026