-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
support overloaded operators in lvalues #2193
Comments
I kind of like ruby's append operator << (which in rust is reserved for lshift), maybe there is a nice alternative? |
Not unary star, I think. Likewise not unary ampersand. Too close to the memory model. Same thinking as keeping assign, move, copy as non overloadable. |
An alternative we might consider is to make the call operator |
I urge you to consider allowing the overload of []= as a special case, even if nobody can think of any other operators that need lhs overloading. This may be one of those cases where there's just one specific crucial bit of syntax. (I have been arguing with sully about the need for [] on hashtables, and I'm about to file a bug asking him to implement fn[] on hash tables, readonly for now.) |
Closing in favor of #6515, since graydon has ruled against lvalue overloads other than indexing. |
do not use int2ptr casts in strict provenance tests
In some cases, like `-Zunpretty=expanded`, Rustc will print information to the stdout that is not in json format. For those cases, we should print the message as is.
You should be able to write:
which should translate to
foo.[]=(x, y)
or something like that. This would be great as an alias for the insert() function on maps. I can't think of any other overloadable operators that are valid in lvalues... do we allow unary*
to be overloaded?The text was updated successfully, but these errors were encountered: