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

ICE: rustfmt: silent emitter attempted to translate a diagnostic #121638

Open
matthiaskrgr opened this issue Feb 26, 2024 · 6 comments
Open

ICE: rustfmt: silent emitter attempted to translate a diagnostic #121638

matthiaskrgr opened this issue Feb 26, 2024 · 6 comments
Labels
A-rustfmt Area: Rustfmt C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

enum Enum<T: Melon<5>> {  SVariant { _v: T }, UVariant }

type AliasFixed = Enum<()>;

macro_rules! test {
    () => (test!(UVariant));
    ($variant:ident) => (if let AliasFixed::$variant::<3> {} = 5 (PartialEq, Eq, Copy, Clone) else { false });
}

fn main() {
    test!();
}

Meta

rustc --version --verbose:

rustfmt 1.7.0-nightly (0ecbd06 2024-02-25)

Error output

rustfmt --check file.rs

<output>
Backtrace

thread 'main' panicked at src/tools/rustfmt/src/parse/session.rs:42:9:
silent emitter attempted to translate a diagnostic
stack backtrace:
   0:     0x7fc5b718ca06 - std::backtrace_rs::backtrace::libunwind::trace::hccc68910ff13f958
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7fc5b718ca06 - std::backtrace_rs::backtrace::trace_unsynchronized::hdd46fbd3506eaa92
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fc5b718ca06 - std::sys_common::backtrace::_print_fmt::h9ad5ddd930964dc6
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7fc5b718ca06 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb776b6ec91daeedd
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fc5b71dd98c - core::fmt::rt::Argument::fmt::h2572fa2911ad0fb3
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/core/src/fmt/rt.rs:142:9
   5:     0x7fc5b71dd98c - core::fmt::write::hff271b7e044cedf7
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/core/src/fmt/mod.rs:1120:17
   6:     0x7fc5b71813cf - std::io::Write::write_fmt::h912c793bec133142
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/io/mod.rs:1846:15
   7:     0x7fc5b718c7b4 - std::sys_common::backtrace::_print::hea0a6eee0651d2b8
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fc5b718c7b4 - std::sys_common::backtrace::print::h18c37b9b3c9e91a8
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fc5b718f4fb - std::panicking::default_hook::{{closure}}::h0be5e0bb06f8054c
  10:     0x7fc5b718f249 - std::panicking::default_hook::h4893d748ed70c8dd
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panicking.rs:292:9
  11:     0x7fc5ba0a083c - std[d552d81111d10822]::panicking::update_hook::<alloc[c9232cf8044bd381]::boxed::Box<rustc_driver_impl[8fe79628258f8a06]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fc5b718fc60 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h148c64496bcc724c
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/alloc/src/boxed.rs:2030:9
  13:     0x7fc5b718fc60 - std::panicking::rust_panic_with_hook::h18f7fbcd19143e05
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panicking.rs:783:13
  14:     0x7fc5b718f969 - std::panicking::begin_panic_handler::{{closure}}::h9b1e5e4a583f1a9f
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panicking.rs:649:13
  15:     0x7fc5b718cee6 - std::sys_common::backtrace::__rust_end_short_backtrace::h5a04e37630d644c0
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7fc5b718f6d4 - rust_begin_unwind
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panicking.rs:645:5
  17:     0x7fc5b71d9ea5 - core::panicking::panic_fmt::h6be3da941e46ae73
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/core/src/panicking.rs:72:14
  18:     0x5639a018902f - <rustfmt_nightly[8d4f808e9469a8c9]::parse::session::SilentEmitter as rustc_errors[fcee4e46eb3cda72]::translation::Translate>::fallback_fluent_bundle
  19:     0x5639a0104901 - <rustfmt_nightly[8d4f808e9469a8c9]::parse::session::SilentOnIgnoredFilesEmitter as rustc_errors[fcee4e46eb3cda72]::translation::Translate>::translate_message
  20:     0x7fc5b876e520 - <rustc_errors[fcee4e46eb3cda72]::DiagCtxt>::eagerly_translate::<indexmap[9ba59d78c0581370]::map::iter::Iter<alloc[c9232cf8044bd381]::borrow::Cow<str>, rustc_errors[fcee4e46eb3cda72]::diagnostic::DiagnosticArgValue>>
  21:     0x7fc5b8751c34 - <rustc_parse[afc5b6d65a3b334f]::errors::IfExpressionMissingThenBlock as rustc_errors[fcee4e46eb3cda72]::diagnostic::IntoDiagnostic>::into_diagnostic
  22:     0x7fc5bb7a7dd3 - <rustc_parse[afc5b6d65a3b334f]::parser::Parser>::parse_if_after_cond
  23:     0x7fc5bb5da20c - <rustc_parse[afc5b6d65a3b334f]::parser::Parser>::parse_expr_dot_or_call
  24:     0x7fc5bb5d2a6a - <rustc_parse[afc5b6d65a3b334f]::parser::Parser>::parse_expr_prefix
  25:     0x7fc5bb5cf1f6 - <rustc_parse[afc5b6d65a3b334f]::parser::Parser>::parse_expr_assoc_with
  26:     0x7fc5bbac86fc - <rustc_parse[afc5b6d65a3b334f]::parser::Parser>::parse_stmt_without_recovery
  27:     0x7fc5bbac57b6 - <rustc_parse[afc5b6d65a3b334f]::parser::Parser>::parse_block_tail
  28:     0x7fc5bb9f1ef0 - <rustc_parse[afc5b6d65a3b334f]::parser::Parser>::parse_fn
  29:     0x7fc5bbd7f61b - <rustc_parse[afc5b6d65a3b334f]::parser::Parser>::parse_item_kind
  30:     0x7fc5bb7ab1be - <rustc_parse[afc5b6d65a3b334f]::parser::Parser>::parse_item_common
  31:     0x7fc5bb7a8c2a - <rustc_parse[afc5b6d65a3b334f]::parser::Parser>::parse_mod
  32:     0x7fc5bc4e2af1 - <rustc_parse[afc5b6d65a3b334f]::parser::Parser>::parse_crate_mod
  33:     0x5639a0188bdf - <rustfmt_nightly[8d4f808e9469a8c9]::parse::parser::Parser>::parse_crate
  34:     0x5639a01422a4 - <rustfmt_nightly[8d4f808e9469a8c9]::Session<alloc[c9232cf8044bd381]::vec::Vec<u8>>>::format_input_inner::{closure#0}
  35:     0x5639a01b5208 - rustfmt_nightly[8d4f808e9469a8c9]::format_snippet
  36:     0x5639a01b5eb2 - rustfmt_nightly[8d4f808e9469a8c9]::format_code_block
  37:     0x5639a01696b2 - <rustfmt_nightly[8d4f808e9469a8c9]::lists::ListItems<core[bd769e7ba7008c3]::slice::iter::Iter<rustfmt_nightly[8d4f808e9469a8c9]::macros::MacroBranch>, rustfmt_nightly[8d4f808e9469a8c9]::macros::rewrite_macro_def::{closure#1}, rustfmt_nightly[8d4f808e9469a8c9]::macros::rewrite_macro_def::{closure#2}, rustfmt_nightly[8d4f808e9469a8c9]::macros::rewrite_macro_def::{closure#3}> as core[bd769e7ba7008c3]::iter::traits::iterator::Iterator>::next::{closure#0}
  38:     0x5639a016ea23 - rustfmt_nightly[8d4f808e9469a8c9]::macros::rewrite_macro_def
  39:     0x5639a01aa4c5 - <rustfmt_nightly[8d4f808e9469a8c9]::visitor::FmtVisitor>::visit_item
  40:     0x5639a018eae6 - <rustfmt_nightly[8d4f808e9469a8c9]::visitor::FmtVisitor>::visit_items_with_reordering
  41:     0x5639a01ae6cb - <rustfmt_nightly[8d4f808e9469a8c9]::visitor::FmtVisitor>::format_separate_mod
  42:     0x5639a00287be - <rustfmt_nightly[8d4f808e9469a8c9]::Session<std[d552d81111d10822]::io::stdio::Stdout>>::format_input_inner::{closure#0}
  43:     0x5639a003de41 - rustfmt[61a5e1a68eb86e51]::format_and_emit_report::<std[d552d81111d10822]::io::stdio::Stdout>
  44:     0x5639a003c2dc - rustfmt[61a5e1a68eb86e51]::execute
  45:     0x5639a00379ab - rustfmt[61a5e1a68eb86e51]::main
  46:     0x5639a0022083 - std[d552d81111d10822]::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
  47:     0x5639a0024329 - std[d552d81111d10822]::rt::lang_start::<()>::{closure#0}
  48:     0x7fc5b7171e93 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hd871a26e604b1b61
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/core/src/ops/function.rs:284:13
  49:     0x7fc5b7171e93 - std::panicking::try::do_call::h8c535df1c0082533
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panicking.rs:552:40
  50:     0x7fc5b7171e93 - std::panicking::try::hb983a17d8c2d0d25
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panicking.rs:516:19
  51:     0x7fc5b7171e93 - std::panic::catch_unwind::hc39ef01f5f7bff9a
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panic.rs:142:14
  52:     0x7fc5b7171e93 - std::rt::lang_start_internal::{{closure}}::h5d0060bca314125e
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/rt.rs:148:48
  53:     0x7fc5b7171e93 - std::panicking::try::do_call::h9eec93bd1b7794e8
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panicking.rs:552:40
  54:     0x7fc5b7171e93 - std::panicking::try::h4e014b77ab3dfd3d
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panicking.rs:516:19
  55:     0x7fc5b7171e93 - std::panic::catch_unwind::ha2f220b987d764b1
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/panic.rs:142:14
  56:     0x7fc5b7171e93 - std::rt::lang_start_internal::h55152906ff6b99c9
                               at /rustc/0ecbd0605770f45c9151715e66ba2b3cae367fcb/library/std/src/rt.rs:148:20
  57:     0x5639a003f005 - main
  58:     0x7fc5b6c29d90 - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  59:     0x7fc5b6c29e40 - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:392:3
  60:     0x5639a00116f9 - <unknown>
  61:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rustfmt/issues/new?labels=bug

note: please attach the file at `/home/gh-matthiaskrgr/glacier2/fixed/rustc-ice-2024-02-26T15_55_50-1973730.txt` to your bug report

query stack during panic:
end of query stack
Diff in /home/gh-matthiaskrgr/glacier2/fixed/icemaker_omni_4/5FDE66DB04A164775D5E5B8D7E65FD863D3B95DF714FBB75A0D76795307AB1D5.rs at line 1:
-enum Enum<T: Melon<5>> {  SVariant { _v: T }, UVariant }
+enum Enum<T: Melon<5>> {
+    SVariant { _v: T },
+    UVariant,
+}

 type AliasFixed = Enum<()>;

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. A-rustfmt Area: Rustfmt labels Feb 26, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 26, 2024
@matthiaskrgr matthiaskrgr changed the title ICE: rustfmt: `silent emitter attempted to translate a diagnostic ICE: rustfmt: silent emitter attempted to translate a diagnostic Feb 26, 2024
@jieyouxu jieyouxu added S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Feb 26, 2024
@matthiaskrgr
Copy link
Member Author

This bisects to #121454 , interesting...

@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Feb 26, 2024

I'm wondering if there is something broken on how cargo bisect rustc handles components :|

edit: it no werky >:(
rust-lang/cargo-bisect-rustc#321

@matthiaskrgr
Copy link
Member Author

This is probably #121085 cc @davidtwco

@matthiaskrgr
Copy link
Member Author

This seems kinda bad imo since using rustfmt on save, and saving broken code in order to get rustc to update diagnostics in an IDE is not uncommon.
@rustbot prioritize

@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Feb 26, 2024
@DaniPopes
Copy link
Contributor

See rust-lang/rustfmt#6082, #121301

@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-high

@rustbot rustbot added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustfmt Area: Rustfmt C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants