-
Notifications
You must be signed in to change notification settings - Fork 14k
Fix ICE caused by invalid spans for shrink_file #148735
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
base: master
Are you sure you want to change the base?
Conversation
|
cc @Muscraft |
| WARN rustc_errors::emitter Invalid span $SRC_DIR/std/src/macros.rs:LL:COL (#4), error=SourceNotAvailable { filename: Real(Remapped { local_path: None, virtual_name: "$SRC_DIR/std/src/macros.rs" }) } | ||
| WARN rustc_errors::emitter Invalid span $SRC_DIR/std/src/macros.rs:LL:COL (#4), error=SourceNotAvailable { filename: Real(Remapped { local_path: None, virtual_name: "$SRC_DIR/std/src/macros.rs" }) } | ||
| WARN rustc_errors::emitter Invalid span $SRC_DIR/std/src/macros.rs:LL:COL (#4), error=SourceNotAvailable { filename: Real(Remapped { local_path: None, virtual_name: "$SRC_DIR/std/src/macros.rs" }) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have worries that this will not pass aarch64-msvc-1 the same way it was in my PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, it do have the same issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, I read the discussion on zulip, seems there is another standalone bug. so is it a temprary way we skip Windows for this testcase(and add it back after that bug is fixed)?
|
@bors try jobs=aarch64-msvc-1 |
This comment has been minimized.
This comment has been minimized.
Fix ICE caused by invalid spans for shrink_file try-job: aarch64-msvc-1
This comment has been minimized.
This comment has been minimized.
|
💔 Test for eca91bd failed: CI. Failed jobs:
|
| let hi_byte = spans.iter().map(|s| s.hi()).max()?; | ||
| let hi_loc = sm.lookup_char_pos(hi_byte); | ||
|
|
||
| if lo_loc.file.name != hi_loc.file.name { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if lo_loc.file.name != hi_loc.file.name { | |
| if lo_loc.file.stable_id != hi_loc.file.stable_id { |
Using the stable_id avoids issues with file name collisions when multiple versions of the same crate are present in the dependency graph. In theory, collect_annotations should be ensuring that the stable_ids match but it would be better to have it checked in both places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a few other places to use file.name to cmp, maybe we can do a cleanup in another PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing cleanup for the other places in another PR makes sense. I can open a PR for that in the next few days if you'd like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just have a check by the way, and can fire a PR later.
|
r=me once the comments are addressed. @rustbot author |
7262408 to
725b213
Compare
Fixes #148732
There are two issues in this function:
7..7is beyond the end of buffer0) will be reported after fixing the first one, is caused by spans cross file boundaries due to macro expansion. It is fixed in the second commit.r? @nnethercote
edited: also fixes #148684, added a new testcase for it in the last commit.