Skip to content

String concatenation with + only type-checks if the first operand is an owned pointer #3682

Description

@andymatuschak

I've got the following source file, with various permutations to the parameter on line 2:

fn main() {
    io::println(~"foo" + ~"foo");
}
  • ~"foo" + ~"foo": compiles as expected; outputs foofoo
  • "foo" + ~"foo": fails to compile: error: binary operation + cannot be applied to type &static/str
  • ~"foo" + "foo": compiles as expected; outputs foofoo
  • "foo" + "foo": fails to compile: error: binary operation + cannot be applied to type &static/str
  • ~"foo" + @"foo": compiles as expected; outputs foofoo
  • @"foo" + ~"foo": fails to compile: error: binary operation + cannot be applied to type @str
  • @"foo" + @"foo": fails to compile: error: binary operation + cannot be applied to type @str

This is f96a2a2 running on Mac OS 10.8.2.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions