-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String concatenation with + only type-checks if the first operand is an owned pointer #3682
Comments
Because of this bug, there's an example in the tutorial (http://dl.rust-lang.org/doc/tutorial.html) that fails to compile: fn main() { io::println("hello " + world::explore()); } main.rs:2:24: 2:52 error: binary operation + cannot be applied to type |
I've been annoyed by this a lot lately. |
An easy general workaround is to start any such concatenation expression |
(obviously the previous suggestion is just allowing for some notational convenience; it is not attempting to address efficiency issues.) |
Not critical for 0.6; de-milestoning |
Reproduced. Still valid. Papercut rather than wrong, though. Wondering if @nikomatsakis dynamic sized types proposal will fix some quantity of this. |
This relates to #4920, as well. |
show proper UB when making a too large allocation request Fixes rust-lang/miri#3679
I've got the following source file, with various permutations to the parameter on line 2:
~"foo" + ~"foo"
: compiles as expected; outputsfoofoo
"foo" + ~"foo"
: fails to compile: error: binary operation + cannot be applied to type&static/str
~"foo" + "foo"
: compiles as expected; outputsfoofoo
"foo" + "foo"
: fails to compile: error: binary operation + cannot be applied to type&static/str
~"foo" + @"foo"
: compiles as expected; outputsfoofoo
@"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.
The text was updated successfully, but these errors were encountered: