-
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
Expend syntax::with_globals coverage and allow nested calls #53526
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
This comment has been minimized.
This comment has been minimized.
r? @Zoxc |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
So I have to stop here. The test "super-fast-paren-parsing.rs" was failed and I have no idea. As the comment was talked about "big stack" maybe an issue about a slightly bigger call stack. Need to check in a real computer. |
How are you getting on with this, @earthengine? Let me know if you could use some help, as I'm quite keen to get this issue solved too. Once you're done, maybe r? @oli-obk or @eddyb. |
It is now passed the tests. So it should be fine now! The problem seems to be that, when the compiler needs to spawn a new thread, as I used the unwrapped call for r? @oli-obk |
Can you add the ICEing test from the issue as a regression test and squash the commits? Other than that it looks fine to me, but it seems very band-aidy. Not sure who we can ping on this though. |
This fix seems questionable to me, but I haven't looked at the issues yet. |
As this is the very first pull request, I don't know what a "regression test" mean and how to do it properly. I was thinking adding tests though; but any tests given will be fixed at some stage though, as the code is in a error detection/prevention branch, tests for the ICEs will be fixed and so the test will be no longer appropriate. I can squash the commits though. Will be done tonight. |
@earthengine I think @oli-obk just means to add your test case from the issue (a minimal reproducible version) to |
The point is that ICE was NOT fixed, yet (so the minimal reproducible cannot be put in |
@earthengine Okay. In that case wait until you (or whoever) fixes the ICE before adding the run-pass regression test. (Do you have any idea how to fix the ICE, for that matter?) |
The ICE is not in my scope right now. The scope of this PR is to give more precise detail about some panicking ICEs, and so it is not targeting any specific ICE. For this reason, I don't think we should wait for any ICEs to be fixed, as it is helping addressing issues, not fixes them. If we DO need a test, it will be like add a compiler option (I don't even know when I can dig deep enough to address the actual ICEs, though) |
I think the clean fix here is to change We might be able to test ICE output to check that we get the "correct" ICE with the ui tests. |
This is what I have tried but didn't work. The reason is that
Actually I did this in my own computer! It is just that I am not sure it is good to have that test in the code base, as they will not last long. |
|
This is what I thought. But then Even the latest form of this PR didn't resolve this though; when the new thread being created, it will work on an irrelevant instance of the globals, and so the main thread will still only get the empty values. But it only happen when there is a need to spawn a new thread and so pretty limited. So it seems to be that the proper fix, is find a way to transfer a initialized value to the |
My commits is now squashed without modification. |
I'm going to close this in favour of #53624 since it doesn't modify the globals themselves. Thanks for pushing ahead on this issue! |
#53448 (and proberly #53469) is partialy fixed in the sense the error messages, if any, will be shown as
rather than "cannot access a scoped thread local variable without calling
set
first".Problem analysis
run_compiler
function is wrapped by asyntax::with_globals
call to ensure it have access tosyntax::GLOBALS
. However, as we have code after runningrun_compile
requires to emit errors, when it needs to show the position of the error, it willpanic
assyntax::GLOBALS
is unavailable.This pull request fixed this by introducing a new call to
syntax::with_globals
inrun
. So code inrun
will use biggersyntax::with_globals
coverage than other calls torun_compiler
.It also makes calling
syntax::with_globals
when it is already called in the outside code uses the already initialized globals, rather than creating new instances.Although this does not actually fix #53448 nor #53469, it will make similar errors never hide the useful error message any more, and so will help diagnosis simular situations easier.
My very first pull request on the compiler ever. Please advise me if I did anything wrong.