-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Don't ICE on layout computation failure #111580
Conversation
Yup, seems like I need it too for codegen_gcc. Should I put the message somewhere more centralized? A separate message in gcc? Please advise, thanks! |
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.
I think rustc_codegen_ssa is shared between all codegen backends, that might be a good place to put the shared error. |
This comment has been minimized.
This comment has been minimized.
if let LayoutError::SizeOverflow(_) = err { | ||
self.sess().emit_fatal(Spanned { span, node: err }) | ||
} else { | ||
span_bug!(span, "failed to get layout for `{}`: {}", ty, err) | ||
self.tcx.sess.emit_fatal(ssa_errors::FailedToGetLayout { span, ty, err }) | ||
} |
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.
Could we go without the branch in the 3 handle_layout_err
methods, and always emit the same diagnostic struct?
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.
Perhaps...
Or now I'm thinking, maybe the more correct thing to do here is:
if let LayoutError::SizeOverflow(_) | LayoutError::Cycle = err {
self.tcx.sess.emit_fatal(ssa_errors::FailedToGetLayout { span, ty, err })
} else {
span_bug!(span, "failed to get layout for `{}`: {}", ty, err)
}
since @oli-obk only really made changes for LayoutError::Cycle
, the rest is still probably a bug?
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.
since @oli-obk only really made changes for
LayoutError::Cycle
, the rest is still probably a bug?
correct, but I don't think the value of separating that is very high. We could just always take the if
arm in all the cases you changed. Worst case a bug will be an error.
03b3783
to
ec276ea
Compare
This comment has been minimized.
This comment has been minimized.
How do I run/bless tests for other archs? Is there some remote machine I can use? I made the change as suggested above and blessed tests, but |
@@ -483,7 +483,7 @@ impl<'tcx> LayoutOfHelpers<'tcx> for RevealAllLayoutCx<'tcx> { | |||
if let layout::LayoutError::SizeOverflow(_) = err { |
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.
This condition can also go away in favor of just always emitting the error
There's not an easy way, unfortunately - I don't think the docker containers support emulating x86 on aarch64. Maybe ask in https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/Cloud.20compute.20.2F.20Dev.20desktop.20feedback if you can get permissions on the cloud-dev machines? https://forge.rust-lang.org/infra/docs/dev-desktop.html |
This comment has been minimized.
This comment has been minimized.
Yeah I initially tried the docker route and didn't get too far, then realized I do have a spare 64bit x86 machine, dusted it out and just did it there. And now I am stuck running into stuff that runs only on 32bit, urgh. I might just manually edit the stderr based on CI output for now... |
You could avoid the blessing issue by always taking the logic from the |
@rustbot author |
☔ The latest upstream changes (presumably #111858) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
@rustbot label -S-waiting-on-author +S-waiting-on-review |
if let LayoutError::SizeOverflow(_) | LayoutError::ReferencesError(_) = err { | ||
self.0.sess.span_fatal(span, err.to_string()) | ||
} else { | ||
span_bug!(span, "failed to get layout for `{}`: {}", ty, err) | ||
self.0.sess.span_fatal(span, format!("failed to get layout for `{}`: {}", ty, err)) | ||
} | ||
} |
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.
is the diagnostic unhelpful if we just remove the if
condition and always do self.0.sess.span_fatal(span, err.to_string())
?
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.
That was what I did initially, but since it changed a bunch of output I got blocked by having to bless tests on platforms I can't run. Perhaps having it tackled in a separate PR by someone who's better setup to do the blessing might be a good idea?
The PR lgtm now, please squash all commits |
Squashed, thanks! @oli-obk |
@bors r+ rollup |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#111580 (Don't ICE on layout computation failure) - rust-lang#114923 (doc: update lld-flavor ref) - rust-lang#115174 (tests: add test for rust-lang#67992) - rust-lang#115187 (Add new interface to smir) - rust-lang#115300 (Tweaks and improvements on SMIR around generics_of and predicates_of) - rust-lang#115340 (some more is_zst that should be is_1zst) r? `@ghost` `@rustbot` modify labels: rollup
Don't ICE on layout computation failure Fixes rust-lang#111176 regression. r? `@oli-obk`
Don't ICE on layout computation failure Fixes rust-lang#111176 regression. r? `@oli-obk`
Fixes #111176 regression.
r? @oli-obk