-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Beta ICE: ItemLocalIds not assigned densely #56128
Comments
probably a backport of whatever is causing #55475 |
It's funny how |
Building the beta locally, I get this error, which is a slightly different message
|
(Though it seems to be related to the same root problem) |
(Ah, this check is only done when |
Minimized reproduction: mod bar {
pub(super) use self::baz::{x, y};
// ^^^^^ assert has to do with this path
//
// the other thing you need is the `{x, y}` part, which I think causes this to expand into
// two copies of the same `pub use` internally
mod baz {
pub fn x() { }
pub fn y() { }
}
}
fn main() { } |
OK I see the bug I think |
My theory wasn't quite right. Clearly it has something to do with sharing ids. You can see that in some paths, we clone the ids from the visibility kind: rust/src/librustc/hir/lowering.rs Lines 3023 to 3028 in 4b3a1d9
But in others, we do not: rust/src/librustc/hir/lowering.rs Lines 3111 to 3118 in 4b3a1d9
However, just adding clone operations to both paths didn't quite suffice. |
Oh, actually, it sort of did. It solves my immediate ICE, but now I am getting another ICE, and this one matches the original message ("not dense"). |
I think the problem is that we are cloning the restricted paths that are getting duplicated and then never using the original, un-cloned paths. |
OK, so, I have a fix but there is one part I do not understand. In particular, I have to remove this line: rust/src/librustc/hir/lowering.rs Line 3142 in 4b3a1d9
which seems to have been there since @pietroalbini originally added this code. But from what I can tell it is this line that makes the ICE, because the "original" visibility never winds up in the tree anywhere (we always clone it for all the derived HIR paths). |
I'll open my PR and cc the relevant folks. |
@pietroalbini and I have been conversing on Zulip, log here. |
Pending fix in #56143 |
…y, r=petrochenkov Issue 56128 segment id ice nightly Tentative fix for #56128 From what I can tell, the problem is that if you have `pub(super) use foo::{a, b}`, then when we explode the `a` and `b`, the segment ids from the `super` path were not getting cloned. However, once I fixed *that*, then I ran into a problem that the "visibility" node-ids were not present in the final HIR -- this is because the visibility of the "stem" that is returned in this case was getting reset to inherited. I don't *think* it is a problem to undo that, so that the visibility is returned unmodified. Fixes #55475 Fixes #56128 cc @nrc @petrochenkov
Hi! I am seeing an ICE in rust-analyzer, when updating rustc from
rustc 1.31.0-beta.14
torustc 1.31.0-beta.15
(so, seems pretty bad?).Error message:
Steps to reproduce:
The text was updated successfully, but these errors were encountered: