A literal string cannot be changed



examples/variables/change-literal-string/src/main.rs
fn main() {
    let mut name = "Foo";
    println!("{name}");

    name.push_str(" Bar");
}

error[E0599]: no method named `push_str` found for reference `&str` in the current scope
 --> examples/variables/change_literal_string.rs:5:10
  |
5 |     name.push_str(" Bar");
  |          ^^^^^^^^ method not found in `&str`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.