-
Notifications
You must be signed in to change notification settings - Fork 13.4k
trait that omits & on self type signals LLVM assertion failure #4406
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I just ran into this. I don't think your trait is bogus, just in case that was implied by its name; by-value Self is part of the language (see #5086). (Though the fact that we assert-fail obviously is bogus.) |
I agree, nothing bogus about this, just a bug. |
Not critical for 0.6; de-milestoning |
Probably the same problem as #5321. |
I believe I just ran into this again (while attempting to double-check if the ICE for Issue #4776 has indeed gone away), though the assertion error message has changed slightly.
(yes, actually, by porting John's original test forward to modernized syntax, I confirmed that the error message has changed on the LLVM side, it seems). |
Currently we pass all "self" arguments by reference, for the pointer variants this means that we end up with double indirection which causes a unnecessary performance hit. The fix itself is pretty straight-forward and just means that "self" needs to be handled like any other argument, except for by-value "self" which still needs to be passed by reference. This is because non-pointer types can't just be stuffed into the environment slot which is used to pass "self". What made things tricky is that there was also a bug in the typechecker where the method map entries are created. For type impls, that stored the base type instead of the actual self-type in the method map, e.g. Foo instead of &Foo for &self. That worked with pass-by-reference, but fails with pass-by-value which needs the real type. Code that makes use of methods seems to be about 10% faster with this change. Also, build times are reduced by about 4%. Fixes rust-lang#4355, rust-lang#4402, rust-lang#5280, rust-lang#4406 and rust-lang#7285
Currently we pass all "self" arguments by reference, for the pointer variants this means that we end up with double indirection which causes a unnecessary performance hit. The fix itself is pretty straight-forward and just means that "self" needs to be handled like any other argument, except for by-value "self" which still needs to be passed by reference. This is because non-pointer types can't just be stuffed into the environment slot which is used to pass "self". What made things tricky is that there was also a bug in the typechecker where the method map entries are created. For type impls, that stored the base type instead of the actual self-type in the method map, e.g. Foo instead of &Foo for &self. That worked with pass-by-reference, but fails with pass-by-value which needs the real type. Code that makes use of methods seems to be about 10% faster with this change. Also, build times are reduced by about 4%. Fixes #4355, #4402, #5280, #4406 and #7285
Fixed by #7452. |
Compiling this program:
produces this error message:
(Original bug report follows)
Compiling this program:
Produces this error message:
The text was updated successfully, but these errors were encountered: