Skip to content
This repository was archived by the owner on May 3, 2026. It is now read-only.
This repository was archived by the owner on May 3, 2026. It is now read-only.

smartstring breaks std::string::String? #7

Description

@miquels

smartstring 0.2.3.
rust 1.44.1

this fails:

$ cat main.rs
use smartstring;

fn main() {
    println!("{}", "Hello".to_string() + &(" World".to_string()));
}

in a weird way:

$ cargo run
   Compiling smartstring-test v0.1.0 (/home/mikevs/devel/rust/smartstring-test)
warning: unused import: `smartstring`
 --> src/main.rs:1:5
  |
1 | use smartstring;
  |     ^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error[E0277]: cannot add `&std::string::String` to `std::string::String`
 --> src/main.rs:4:40
  |
4 |     println!("{}", "Hello".to_string() + &(" World".to_string()));
  |                                        ^ no implementation for `std::string::String + &std::string::String`
  |
  = help: the trait `std::ops::Add<&std::string::String>` is not implemented for `std::string::String`

error: aborting due to previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0277`.
error: could not compile `smartstring-test`.

To learn more, run the command again with --verbose.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions