Skip to content
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

.unwrap() when expecting fmt::Result #120090

Closed
uselessgoddess opened this issue Jan 18, 2024 · 3 comments · Fixed by #120101
Closed

.unwrap() when expecting fmt::Result #120090

uselessgoddess opened this issue Jan 18, 2024 · 3 comments · Fixed by #120101
Assignees
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@uselessgoddess
Copy link

uselessgoddess commented Jan 18, 2024

Reading the compiler code (specifically the one responsible for mir output) I found these .unwrap()s where probably expected ?.

write!(fmt, "(").unwrap();
}
ProjectionElem::Deref => {
write!(fmt, "(*").unwrap();

@uselessgoddess uselessgoddess added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 18, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 18, 2024
@clubby789
Copy link
Contributor

Have you actually encountered an ICE due to this?

@uselessgoddess
Copy link
Author

No, I just happened to find that. It's not a ICE, just a typo in the code

@saethlin saethlin added C-enhancement Category: An issue proposing an enhancement or a PR with one. and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ C-bug Category: This is a bug. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 18, 2024
@mj10021
Copy link
Contributor

mj10021 commented Jan 18, 2024

@rustbot claim

@bors bors closed this as completed in ca0c740 Jan 19, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 19, 2024
Rollup merge of rust-lang#120101 - mj10021:issue-120090-fix, r=WaffleLapkin

change `.unwrap()` to `?` on write where `fmt::Result` is returned

Fixes rust-lang#120090 which points out that some of the `.unwrap()`s in `rustc_middle/src/mir/pretty.rs` are likely meant to be `?`s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants