# Rust: error[E0369]: binary operation `+` cannot be applied to type `Foo` / cannot add `&str` to `&str`

**Code:** `E0369: binary operation cannot be applied to type` · **Category:** Rust · **Seen on:** Rust

An operator (`+`, `==`, `<`) isn't implemented for the operand types.

## 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?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/rust/e0369-binary-operation-cannot-be-applied)
