-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Fix : Handle inconsistent resolution gracefully #149855
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
Conversation
|
|
Closing this PR per our policy rust-lang/compiler-team#893. First of all, it suppresses an ICE instead of fixing the root cause & checking And second less important it will create a burden on reviewers, because it would require deep analysis of resolver internals to verify correctness ICEs in Rust must be fixed, not suppressed. A proper fix requires understanding why the resolver gets inconsistent, not just masking the symptom. |
|
upd: this is answer to their deleted comment Sorry, but I don't know what should you do next, if you know a lot of how resolver works - then, maybe, it would be correct for you to do a deep dive and try to find original problem in resolver, not just replace The only thing I know for sure for now is that the current fix is not correct, and I don't have time to do investigation of real error for you, and, more important I don't want to our reviewers do this work and spend their time for this Don't take it close to your heart, if I see that author spend their time to solve the issue and understand the root problem, then I'd love to do a review myself even though I don't know much about resolver, I'd love to spend my time for understanding fix and problem to make a good review the same way as author put their time and effort to land a good fix, but I don't want to do this dive when I see that author is not understand the code or not put the effort into the fix, I'm against fix just for fix in this case, this shall be fixed with a proper solution |
|
I opened a different pr with the root cause fix rather than just masking |
|
@Kivooeo i understand your review it's my fault I took a completely wrong approach. It's my third pr for this repo so I am getting used to it sorry for wasting your time |
This PR fixes an Internal Compiler Error (ICE) that occurs when a macro-expanded
extern crateshadows a name passed with--extern.The Issue
When
extern crate std as core;is expanded from a macro whilecoreis already imported (e.g. viause core;oruse crate::*;), the resolver ends up in an inconsistent state where theinitial_resdiffers from the final resolutionres. Previously, this triggered aspan_bug!panic infinalize_import.The Fix
The resolver already correctly identifies and reports the shadowing error (
macro-expanded extern crate items cannot shadow names passed with --extern).This PR modifies
finalize_importto check if any errors have already been reported (this.dcx().has_errors()). If an error exists, we suppress the panic, assuming the inconsistency is a side-effect of the invalid code. As a fallback safety measure,span_bug!was replaced withspan_delayed_bugto ensure we don't crash if the shadowing error were to be suppressed in the future.Test
Added regression test:
tests/ui/resolve/ice-inconsistent-resolution-149821.rsFixes #149821