E0369: binary operation cannot be applied to type Rust Origin: Application & API OSI layer 7 · Application Last updated 5 Nov 2026

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.

Exact message you may see 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
Seen on: Rust

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/PartialEq impl
  • References vs values (&i32 + i32 is ok, &Foo + Foo not)
  • Comparing floats with Ord
  • Generic T lacking the operator bound

⚡ Quick fix

  1. format!("{a}{b}") or a.to_string() + b
  2. #[derive(PartialEq)] / impl Add for Foo
  3. Add bounds T: std::ops::Add<Output = T>

Detailed fix by platform

Rust

  1. let s = format!("{first} {last}");

How to diagnose

  1. Operator — Trait implemented?
  2. Types — Reference/owned?
  3. 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:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

Blocking waiting for file lock on package cache / build directory — Cargo: Blocking waiting for file lock on package cache / on build directory (Rust)Blocking waiting for …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/...` (Rust)cargo: failed to get …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 (Rust)cargo: failed to sele…E0038: the trait cannot be made into an object — Rust: error[E0038]: the trait `Shape` cannot be made into an object (not dyn compatible) (Rust)E0038: the trait cann…E0277: the trait bound is not satisfied — Rust: error[E0277]: the trait bound `Foo: Display` is not satisfied / `Rc<RefCell<T>>` cannot be sent between threads safely (Rust)E0277: the trait boun…E0308 — Rust: error[E0308]: mismatched types — expected `X`, found `Y` (Rust)E0308E0599: no method named found for type — Rust: error[E0599]: no method named `push_str` found for struct `Vec<String>` in the current scope (Rust)E0599: no method name…ISO C++ forbids comparison between pointer and integer — C++: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] (C/C++)ISO C++ forbids compa…E0369: bi…

Explore the map of this error Full error map →

🧠 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.