-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Functions with an immediate return value shouldn't have an extra argument #6575
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
Comments
@catamorphism I'm going to try to figure this one out. Any advice on where I should be looking outside of type_of::type_of_fn? I'm guessing I need to update call sites (so maybe middle::trans::callee.rs?), & I'm guessing there may be some sort of issue wrt argument indices being shifted around or something like that -- beyond that I think I'm flying blind :) |
Yup, you'll need to update Various Code In Trans (tm). If I were going to do this, I would just change it in one place and see what breaks -- lots of tests should fail catastrophically in that case :-) But that may not be the best way. I suspect one thing that would be just as helpful as fixing the bug is adding documentation as you go along to the code that deals with args. |
If I were going to do this, I would just change it in one place and see what breaks -- lots of tests should fail catastrophically in that case I totally would if I could get the build to do anything but segfault with this change :) All good, I think I'm just going to have to do a bit of whack-a-mole. |
Yes, unfortunately the way the build works is not the best thing for testing -- there are easier test cases you could be running than the entire compiler itself, but |
Not sure I follow -- doesn't that leave me in the position of needing to build the stage1 compiler? This seems to be falling over in stage0: https://gist.github.com/thomaslee/5617386 (Must say I've not spent a whole lot of time trying to understand the bootstrapping thing -- my laziness may be my undoing here :P) That said, I think I'm making a little progress -- just stumbled across rustc::middle::trans::common::first_real_arg, which I believe is going to be at the root of a lot of the hurtiness associated with this issue. That aside, would love clarification wrt using the stage1 compiler to test this if you still think it's relevant! |
Ah, I see what's confusing. If you build Hopefully that's a little clearer... |
Awesome, that helps a whole lot. Thanks very much! |
I've managed to get the whole toolchain through stage 1 with a few hacks with this WIP: Still seems to need some work: it's crashing hard building libcore at stage 2 & there's some nasty hacks in there to work around the fact dtors somehow get either one or both of the implicit parameters. stage 2 borkage looks like this: https://gist.github.com/thomaslee/5625937 Slow going, but there's some definite progress here. |
This lets us use #ifdefs to determine which stage of the build we happen to be in, which is useful in the event we need to make changes to rustrt that are incompatible with the code generated by stage0. This should help pave the way to completing rust-lang#6575, which will likely require changes to type signatures for spawn_fn & glue_fn in rustrt.
Fix for #6575. In the trans phase, rustc emits code for a function parameter that goes completely unused in the event the return type of the function in question happens to be an immediate. This patch modifies rustc & parts of rustrt to ensure that the vestigial parameter is no longer present in compiled code.
Fixed by commit e3d0c1e |
Change env var used for testing Clippy This changes the variable used for testing Clippy in the internal test suite: ``` CLIPPY_TESTS -> __CLIPPY_INTERNAL_TESTS ``` `CLIPPY_TESTS` is understandably used in environments of Clippy users, so we shouldn't use it in our test suite. changelog: Fix oversight which caused Clippy to lint deps in some environments. Once again fixes rust-lang/rust-clippy#3874
as per comment in
trans::type_of::type_of_fn
The text was updated successfully, but these errors were encountered: