Skip to content

ICE: attrs: None at diagnostics.rs:791:52 #118530

Closed

Description

@matthiaskrgr

Code

fn bar() -> String {
    #[cfg]
    [1, 2, 3].iter()
    #[feature]
    attr::fn bar() -> String {
    #[attr]
    [1, 2, 3].iter().map().collect::<String>()
    #[attr]

}()
}

Meta

rustc --version --verbose:

rustc 1.76.0-nightly (0919ad183 2023-12-02)
binary: rustc
commit-hash: 0919ad18381f6f4fcaddc809e786553e028bbde0
commit-date: 2023-12-02
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.5

Error output

error: expected identifier, found keyword `fn`
 --> treereduce_1E33.out:5:11
  |
5 |     attr::fn bar() -> String {
  |           ^^ expected identifier, found keyword
Backtrace

thread 'rustc' panicked at compiler/rustc_parse/src/parser/diagnostics.rs:791:52:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7efc70f8b28c - std::backtrace_rs::backtrace::libunwind::trace::hf60fec8ebc0c5e46
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7efc70f8b28c - std::backtrace_rs::backtrace::trace_unsynchronized::h6b0117997e292206
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7efc70f8b28c - std::sys_common::backtrace::_print_fmt::h44b32f67603b518c
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7efc70f8b28c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h27fb11da10f33041
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7efc70fde2c0 - core::fmt::rt::Argument::fmt::h3fc263cbfb58e262
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/core/src/fmt/rt.rs:142:9
   5:     0x7efc70fde2c0 - core::fmt::write::h02278e02d2d5f049
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/core/src/fmt/mod.rs:1120:17
   6:     0x7efc70f7f17f - std::io::Write::write_fmt::hffc80e01f3ab27bb
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/std/src/io/mod.rs:1810:15
   7:     0x7efc70f8b074 - std::sys_common::backtrace::_print::h2544e68645d26127
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7efc70f8b074 - std::sys_common::backtrace::print::h2e0aa5ce667bab38
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7efc70f8dd07 - std::panicking::default_hook::{{closure}}::h0a15ec650eef3042
  10:     0x7efc70f8da6f - std::panicking::default_hook::heb7c98638cae941f
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/std/src/panicking.rs:292:9
  11:     0x7efc73cf1e80 - std[87e1f5a9db75d886]::panicking::update_hook::<alloc[3858379072058137]::boxed::Box<rustc_driver_impl[cfa48c30a51debc9]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7efc70f8e448 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hdf7e5e901896fee8
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/alloc/src/boxed.rs:2021:9
  13:     0x7efc70f8e448 - std::panicking::rust_panic_with_hook::h5b2da380fe2b9567
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/std/src/panicking.rs:783:13
  14:     0x7efc70f8e169 - std::panicking::begin_panic_handler::{{closure}}::h3f96784bf0ca7405
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/std/src/panicking.rs:649:13
  15:     0x7efc70f8b756 - std::sys_common::backtrace::__rust_end_short_backtrace::hf79e6243acc919d5
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7efc70f8df02 - rust_begin_unwind
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/std/src/panicking.rs:645:5
  17:     0x7efc70fda995 - core::panicking::panic_fmt::h30900c9a84f4042b
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/core/src/panicking.rs:72:14
  18:     0x7efc70fdaa43 - core::panicking::panic::h234da1d28a5ceaa3
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/core/src/panicking.rs:142:5
  19:     0x7efc72a15d47 - <rustc_parse[af32aa468c2a8517]::parser::Parser>::attr_on_non_tail_expr
  20:     0x7efc757098b0 - <rustc_parse[af32aa468c2a8517]::parser::Parser>::parse_block_tail
  21:     0x7efc753da5a2 - <rustc_parse[af32aa468c2a8517]::parser::Parser>::parse_fn
  22:     0x7efc756f77ef - <rustc_parse[af32aa468c2a8517]::parser::Parser>::parse_item_kind
  23:     0x7efc753f293f - <rustc_parse[af32aa468c2a8517]::parser::Parser>::parse_item_common
  24:     0x7efc753effec - <rustc_parse[af32aa468c2a8517]::parser::Parser>::parse_mod
  25:     0x7efc75f8b490 - rustc_interface[940fd56aa190939d]::passes::parse
  26:     0x7efc75f8b20e - <rustc_interface[940fd56aa190939d]::queries::Queries>::parse
  27:     0x7efc75f81f25 - rustc_interface[940fd56aa190939d]::interface::run_compiler::<core[75c7cbfbe7f98c9f]::result::Result<(), rustc_span[63578016ae5b5f6e]::ErrorGuaranteed>, rustc_driver_impl[cfa48c30a51debc9]::run_compiler::{closure#0}>::{closure#0}
  28:     0x7efc75f75549 - std[87e1f5a9db75d886]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[940fd56aa190939d]::util::run_in_thread_with_globals<rustc_interface[940fd56aa190939d]::util::run_in_thread_pool_with_globals<rustc_interface[940fd56aa190939d]::interface::run_compiler<core[75c7cbfbe7f98c9f]::result::Result<(), rustc_span[63578016ae5b5f6e]::ErrorGuaranteed>, rustc_driver_impl[cfa48c30a51debc9]::run_compiler::{closure#0}>::{closure#0}, core[75c7cbfbe7f98c9f]::result::Result<(), rustc_span[63578016ae5b5f6e]::ErrorGuaranteed>>::{closure#0}, core[75c7cbfbe7f98c9f]::result::Result<(), rustc_span[63578016ae5b5f6e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[75c7cbfbe7f98c9f]::result::Result<(), rustc_span[63578016ae5b5f6e]::ErrorGuaranteed>>
  29:     0x7efc75f75373 - <<std[87e1f5a9db75d886]::thread::Builder>::spawn_unchecked_<rustc_interface[940fd56aa190939d]::util::run_in_thread_with_globals<rustc_interface[940fd56aa190939d]::util::run_in_thread_pool_with_globals<rustc_interface[940fd56aa190939d]::interface::run_compiler<core[75c7cbfbe7f98c9f]::result::Result<(), rustc_span[63578016ae5b5f6e]::ErrorGuaranteed>, rustc_driver_impl[cfa48c30a51debc9]::run_compiler::{closure#0}>::{closure#0}, core[75c7cbfbe7f98c9f]::result::Result<(), rustc_span[63578016ae5b5f6e]::ErrorGuaranteed>>::{closure#0}, core[75c7cbfbe7f98c9f]::result::Result<(), rustc_span[63578016ae5b5f6e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[75c7cbfbe7f98c9f]::result::Result<(), rustc_span[63578016ae5b5f6e]::ErrorGuaranteed>>::{closure#1} as core[75c7cbfbe7f98c9f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  30:     0x7efc70f982d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7c5f0316c4d081e7
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/alloc/src/boxed.rs:2007:9
  31:     0x7efc70f982d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha58713453cbc0382
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/alloc/src/boxed.rs:2007:9
  32:     0x7efc70f982d5 - std::sys::unix::thread::Thread::new::thread_start::h8f26f58dd762698d
                               at /rustc/0919ad18381f6f4fcaddc809e786553e028bbde0/library/std/src/sys/unix/thread.rs:108:17
  33:     0x7efc70d889eb - <unknown>
  34:     0x7efc70e0c7cc - <unknown>
  35:                0x0 - <unknown>

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please attach the file at `/tmp/im/rustc-ice-2023-12-02T11_37_08-2631626.txt` to your bug report

query stack during panic:
end of query stack
error: aborting due to 1 previous error

Activity

  1. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    C-bugCategory: This is a bug.
    on Dec 2, 2023
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Dec 2, 2023
  3. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Dec 2, 2023
  4. self-assigned this
    on Dec 2, 2023
  5. added a commit that references this issue on Dec 3, 2023
    225e36c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions