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

thread 'main' panicked at 'internal error: entered unreachable code', src/tools/rustfmt/src/types.rs:764:59 #8388

Closed
tronta opened this issue Jun 20, 2020 · 2 comments
Labels
C-bug Category: bug

Comments

@tronta
Copy link

tronta commented Jun 20, 2020

Problem
When executing a cargo fmt on my code I get the following backtrace
thread 'main' panicked at 'internal error: entered unreachable code', src/tools/rustfmt/src/types.rs:764:59
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:78
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:59
4: core::fmt::write
at src/libcore/fmt/mod.rs:1069
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1504
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:62
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:198
9: std::panicking::default_hook
at src/libstd/panicking.rs:218
10: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:511
11: std::panicking::begin_panic
12: rustfmt_nightly::types::::rewrite
13: rustfmt_nightly::items::::rewrite
14: <rustfmt_nightly::lists::ListItems<I,F1,F2,F3> as core::iter::traits::iterator::Iterator>::next
15: <alloc::vec::Vec as alloc::vec::SpecExtend<T,I>>::from_iter
16: rustfmt_nightly::items::rewrite_fn_base
17: rustfmt_nightly::visitor::FmtVisitor::visit_fn
18: rustfmt_nightly::visitor::FmtVisitor::visit_impl_item
19: rustfmt_nightly::items::::visit_impl_items
20: rustfmt_nightly::items::format_impl
21: rustfmt_nightly::visitor::FmtVisitor::visit_item
22: rustfmt_nightly::reorder::::visit_items_with_reordering
23: rustfmt_nightly::visitor::FmtVisitor::format_separate_mod
24: rustfmt_nightly::formatting::format_project
25: rustc_ap_rustc_ast::attr::with_globals
26: rustfmt_nightly::Session::format
27: rustfmt::format_and_emit_report
28: rustfmt_nightly::Session::override_config
29: rustfmt::execute
30: rustfmt::main
31: std::rt::lang_start::{{closure}}
32: std::rt::lang_start_internal::{{closure}}
at src/libstd/rt.rs:52
33: std::panicking::try::do_call
at src/libstd/panicking.rs:331
34: std::panicking::try
at src/libstd/panicking.rs:274
35: std::panic::catch_unwind
at src/libstd/panic.rs:394
36: std::rt::lang_start_internal
at src/libstd/rt.rs:51
37: main
38: __libc_start_main
39:

Steps

As it is proprietary software, I hestate to paste code in here.
If you need sth special, I'm happy to help.

Possible Solution(s)

Notes

Output of cargo version:
cargo 1.44.1 (88ba857 2020-06-11)

@tronta tronta added the C-bug Category: bug label Jun 20, 2020
@ehuss
Copy link
Contributor

ehuss commented Jun 21, 2020

Thanks for the report. This looks like a rustfmt bug. Can you move this issue over to https://github.com/rust-lang/rustfmt/issues?

It looks like it is hitting this line. Looks like the typeof keyword can trigger it. I'm not sure what the other scenarios are, though.

@ehuss
Copy link
Contributor

ehuss commented Jul 29, 2020

Moved to rust-lang/rustfmt#4357

@ehuss ehuss closed this as completed Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants