Skip to content

internal error: entered unreachable code: in literal form when lowering mac args eq #96847

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
Badel2 opened this issue May 8, 2022 · 3 comments · Fixed by #100426
Closed
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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.

Comments

@Badel2
Copy link
Contributor

Badel2 commented May 8, 2022

I'm seeing an internal compiler error on the following input, found by fuzz-rustc:

Code

fn main() {
    for _ in [] {
        #![doc=""]
    }
}

Error output

   Compiling playground v0.0.1 (/playground)
warning: unused doc comment
 --> src/main.rs:3:9
  |
2 | /     for _ in [] {
3 | |         #![doc=""]
  | |         ^^^^^^^^^^
4 | |     }
  | |_____- rustdoc does not generate documentation for expressions
  |
  = note: `#[warn(unused_doc_comments)]` on by default
  = help: use `//` for a plain comment

thread 'rustc' panicked at 'internal error: entered unreachable code: in literal form when lowering mac args eq: Lit { token: Lit { kind: Str, symbol: "", suffix: None }, kind: Str("", Cooked), span: src/main.rs:3:16: 3:18 (#0) }', compiler/rustc_ast_lowering/src/lib.rs:903:17

This is not unique to doc attributes, it can be replaced by any other name, but I used doc in the example because I know it is imported by default. Affected versions: nightly 2022-05-07 is affected, but beta 1.61.0-beta.5 and stable 1.60.0 are not affected

Backtrace

   Compiling playground v0.0.1 (/playground)
warning: unused doc comment
 --> src/main.rs:3:9
  |
2 | /     for _ in [] {
3 | |         #![doc=""]
  | |         ^^^^^^^^^^
4 | |     }
  | |_____- rustdoc does not generate documentation for expressions
  |
  = note: `#[warn(unused_doc_comments)]` on by default
  = help: use `//` for a plain comment

thread 'rustc' panicked at 'internal error: entered unreachable code: in literal form when lowering mac args eq: Lit { token: Lit { kind: Str, symbol: "", suffix: None }, kind: Str("", Cooked), span: src/main.rs:3:16: 3:18 (#0) }', compiler/rustc_ast_lowering/src/lib.rs:903:17
stack backtrace:
   0:     0x7f7565767ead - std::backtrace_rs::backtrace::libunwind::trace::ha82e355503b775ae
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f7565767ead - std::backtrace_rs::backtrace::trace_unsynchronized::h8e110267c4bde050
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f7565767ead - std::sys_common::backtrace::_print_fmt::h5f563af01e258275
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f7565767ead - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hea5b1fa30c1333eb
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f75657c3b6c - core::fmt::write::h82dfb1eb62467416
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/core/src/fmt/mod.rs:1194:17
   5:     0x7f75657595a1 - std::io::Write::write_fmt::h453cda435b3f142f
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/std/src/io/mod.rs:1655:15
   6:     0x7f756576abc5 - std::sys_common::backtrace::_print::hc8f28f28ca4dc2eb
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f756576abc5 - std::sys_common::backtrace::print::he50667b6c89ab0df
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f756576abc5 - std::panicking::default_hook::{{closure}}::hefe4dc9c157160a4
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/std/src/panicking.rs:295:22
   9:     0x7f756576a839 - std::panicking::default_hook::h1376b5b10508fdef
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/std/src/panicking.rs:314:9
  10:     0x7f7565f2bee1 - rustc_driver[5234e93807a03500]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f756576b396 - std::panicking::rust_panic_with_hook::h839908001643daf0
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/std/src/panicking.rs:702:17
  12:     0x7f756576b197 - std::panicking::begin_panic_handler::{{closure}}::hf027c1af338d28cd
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/std/src/panicking.rs:588:13
  13:     0x7f7565768364 - std::sys_common::backtrace::__rust_end_short_backtrace::h42726b9619ec7247
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7f756576aec9 - rust_begin_unwind
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/std/src/panicking.rs:584:5
  15:     0x7f7565730193 - core::panicking::panic_fmt::hecbeff60ca345ea1
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/core/src/panicking.rs:142:14
  16:     0x7f7567621501 - <smallvec[783a7bc302c18e9d]::SmallVec<[rustc_ast[8c13dfba7c39903e]::ast::Attribute; 8usize]> as core[6c67f8de41fca20a]::iter::traits::collect::Extend<rustc_ast[8c13dfba7c39903e]::ast::Attribute>>::extend::<core[6c67f8de41fca20a]::iter::adapters::map::Map<core[6c67f8de41fca20a]::slice::iter::Iter<rustc_ast[8c13dfba7c39903e]::ast::Attribute>, <rustc_ast_lowering[840f68559e06d09a]::LoweringContext>::lower_attrs::{closure#0}>>
  17:     0x7f75675f03ee - <rustc_ast_lowering[840f68559e06d09a]::LoweringContext>::expr
  18:     0x7f75682f17c2 - <rustc_ast_lowering[840f68559e06d09a]::LoweringContext>::lower_expr_for
  19:     0x7f75675ebbfe - <rustc_ast_lowering[840f68559e06d09a]::LoweringContext>::lower_expr_mut::{closure#0}
  20:     0x7f75675e80f2 - <rustc_ast_lowering[840f68559e06d09a]::LoweringContext>::lower_stmts
  21:     0x7f75675f401d - <rustc_ast_lowering[840f68559e06d09a]::LoweringContext>::lower_maybe_async_body
  22:     0x7f7567604da8 - <rustc_ast_lowering[840f68559e06d09a]::LoweringContext>::with_hir_id_owner::<<rustc_ast_lowering[840f68559e06d09a]::item::ItemLowerer>::with_lctx<<rustc_ast_lowering[840f68559e06d09a]::item::ItemLowerer>::lower_item::{closure#0}>::{closure#0}>
  23:     0x7f756762ad99 - <rustc_ast_lowering[840f68559e06d09a]::item::ItemLowerer>::lower_node
  24:     0x7f7567603adc - rustc_ast_lowering[840f68559e06d09a]::lower_crate
  25:     0x7f7567fdac17 - <rustc_interface[259f7f2d687dc9cd]::passes::boxed_resolver::BoxedResolver>::access::<rustc_interface[259f7f2d687dc9cd]::passes::create_global_ctxt::{closure#0}, &rustc_hir[a682107990697923]::hir::Crate>
  26:     0x7f7567fd0e43 - rustc_interface[259f7f2d687dc9cd]::passes::create_global_ctxt
  27:     0x7f7567ff415d - <rustc_interface[259f7f2d687dc9cd]::queries::Queries>::global_ctxt
  28:     0x7f7567f9d172 - <rustc_interface[259f7f2d687dc9cd]::interface::Compiler>::enter::<rustc_driver[5234e93807a03500]::run_compiler::{closure#1}::{closure#2}, core[6c67f8de41fca20a]::result::Result<core[6c67f8de41fca20a]::option::Option<rustc_interface[259f7f2d687dc9cd]::queries::Linker>, rustc_errors[473276f074908285]::ErrorGuaranteed>>
  29:     0x7f7567fc559f - rustc_span[e19c93a5cc4d231b]::with_source_map::<core[6c67f8de41fca20a]::result::Result<(), rustc_errors[473276f074908285]::ErrorGuaranteed>, rustc_interface[259f7f2d687dc9cd]::interface::create_compiler_and_run<core[6c67f8de41fca20a]::result::Result<(), rustc_errors[473276f074908285]::ErrorGuaranteed>, rustc_driver[5234e93807a03500]::run_compiler::{closure#1}>::{closure#1}>
  30:     0x7f7567f9df44 - rustc_interface[259f7f2d687dc9cd]::interface::create_compiler_and_run::<core[6c67f8de41fca20a]::result::Result<(), rustc_errors[473276f074908285]::ErrorGuaranteed>, rustc_driver[5234e93807a03500]::run_compiler::{closure#1}>
  31:     0x7f7567f9b6f2 - <scoped_tls[7f40d5f18d3a19f0]::ScopedKey<rustc_span[e19c93a5cc4d231b]::SessionGlobals>>::set::<rustc_interface[259f7f2d687dc9cd]::interface::run_compiler<core[6c67f8de41fca20a]::result::Result<(), rustc_errors[473276f074908285]::ErrorGuaranteed>, rustc_driver[5234e93807a03500]::run_compiler::{closure#1}>::{closure#0}, core[6c67f8de41fca20a]::result::Result<(), rustc_errors[473276f074908285]::ErrorGuaranteed>>
  32:     0x7f7567fb276f - std[da27fefd8cd19b64]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[259f7f2d687dc9cd]::util::run_in_thread_pool_with_globals<rustc_interface[259f7f2d687dc9cd]::interface::run_compiler<core[6c67f8de41fca20a]::result::Result<(), rustc_errors[473276f074908285]::ErrorGuaranteed>, rustc_driver[5234e93807a03500]::run_compiler::{closure#1}>::{closure#0}, core[6c67f8de41fca20a]::result::Result<(), rustc_errors[473276f074908285]::ErrorGuaranteed>>::{closure#0}, core[6c67f8de41fca20a]::result::Result<(), rustc_errors[473276f074908285]::ErrorGuaranteed>>
  33:     0x7f7567fb28a9 - <<std[da27fefd8cd19b64]::thread::Builder>::spawn_unchecked_<rustc_interface[259f7f2d687dc9cd]::util::run_in_thread_pool_with_globals<rustc_interface[259f7f2d687dc9cd]::interface::run_compiler<core[6c67f8de41fca20a]::result::Result<(), rustc_errors[473276f074908285]::ErrorGuaranteed>, rustc_driver[5234e93807a03500]::run_compiler::{closure#1}>::{closure#0}, core[6c67f8de41fca20a]::result::Result<(), rustc_errors[473276f074908285]::ErrorGuaranteed>>::{closure#0}, core[6c67f8de41fca20a]::result::Result<(), rustc_errors[473276f074908285]::ErrorGuaranteed>>::{closure#1} as core[6c67f8de41fca20a]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:     0x7f75657752e3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd85bf70b078c05e8
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/alloc/src/boxed.rs:1872:9
  35:     0x7f75657752e3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6a20ba204ab10b14
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/alloc/src/boxed.rs:1872:9
  36:     0x7f75657752e3 - std::sys::unix::thread::Thread::new::thread_start::h6522ecd8b15d879a
                               at /rustc/ea92b08383b718e79317b29470cb244c48557cd5/library/std/src/sys/unix/thread.rs:108:17
  37:     0x7f75656a5609 - start_thread
  38:     0x7f75655be163 - clone
  39:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: 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: rustc 1.62.0-nightly (ea92b0838 2022-05-07) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
warning: `playground` (bin "playground") generated 1 warning
error: could not compile `playground`; 1 warning emitted

@Badel2 Badel2 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 May 8, 2022
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label May 12, 2022
@dwrensha
Copy link
Contributor

dwrensha commented Aug 7, 2022

searched nightlies: from nightly-2021-01-07 to nightly-2022-07-24
regressed nightly: nightly-2022-05-05
searched commits: from e1b71fe to 4c60a0e
regressed commit: 4c60a0e

bisected with cargo-bisect-rustc v0.6.0

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start=2021-1-7 --end=2022-07-24 --regress ice 

@dwrensha
Copy link
Contributor

dwrensha commented Aug 7, 2022

This regressed in #96546. cc @nnethercote

@nnethercote
Copy link
Contributor

Thanks for the report, @dwrensha!

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 11, 2022
bors added a commit to rust-lang-ci/rust that referenced this issue Aug 11, 2022
…iaskrgr

Rollup of 13 pull requests

Successful merges:

 - rust-lang#93896 (rustdoc: make item-infos dimmer on dark theme)
 - rust-lang#99337 (rustdoc: simplify highlight.rs)
 - rust-lang#99421 (add crt-static for android)
 - rust-lang#99500 (Fix flags when using clang as linker for Fuchsia)
 - rust-lang#99511 (make raw_eq precondition more restrictive)
 - rust-lang#99992 (Add `x.sh` and `x.ps1` shell scripts)
 - rust-lang#100112 (Fix test: chunks_mut_are_send_and_sync)
 - rust-lang#100203 (provide correct size hint for unsupported platform `CommandArgs`)
 - rust-lang#100307 (Fix rust-lang#96847)
 - rust-lang#100350 (Stringify non-shorthand visibility correctly)
 - rust-lang#100374 (Improve crate selection on rustdoc search results page)
 - rust-lang#100392 (Simplify visitors)
 - rust-lang#100418 (Add stability attributes to BacktraceStatus variants)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors closed this as completed in ce78042 Aug 12, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants