-
Notifications
You must be signed in to change notification settings - Fork 933
Closed
Labels
1x-backport:completedbugPanic, non-idempotency, invalid code, etc.Panic, non-idempotency, invalid code, etc.
Description
Describe the bug
In some situations, rustfmt will panic with the following error:
thread 'main' panicked at 'internal error: entered unreachable code', src/tools/rustfmt/src/types.rs:764:59
To Reproduce
This is a repost of rust-lang/cargo#8388, so I don't know the original code (the reporter said it was close source and could not share). However, here are some examples that can trigger it:
type T = typeof(1);
struct S;
impl T for .. {
}
Of course these aren't valid, but they hit this line. I'm not sure if there are legitimate cases that would hit this. Another guess is that maybe the user had format-on-save, and was in the middle of some unfinished code?
Meta
- rustfmt version:
rustfmt 1.4.19-nightly (cef1c0d5 2020-07-21)
- From where did you install rustfmt?: rustup
- How do you run rustfmt:
cargo fmt
Metadata
Metadata
Assignees
Labels
1x-backport:completedbugPanic, non-idempotency, invalid code, etc.Panic, non-idempotency, invalid code, etc.