Skip to content

ICE failed to unescape char literal #120397

Closed

Description

@matthiaskrgr

snippet:

fn a() {
   'ab
} 

Version information

rustc 1.77.0-nightly (e7bbe8ce9 2024-01-26)
binary: rustc
commit-hash: e7bbe8ce933123a8e327c79e38bcb790595e6a65
commit-date: 2024-01-26
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error: expected `while`, `for`, `loop` or `{` after a label
 --> /tmp/icemaker_global_tempdir.awRLrWEr9xBk/rustc_testrunner_tmpdir_reporting.AYMxBOFwCLUT/mvce.rs:3:1
  |
3 | } 
  | ^ expected `while`, `for`, `loop` or `{` after a label
  |
help: add `'` to close the char literal
  |
2 |    'ab'
  |       +

thread 'rustc' panicked at compiler/rustc_ast/src/util/literal.rs:66:34:
failed to unescape char literal
stack backtrace:
   0:     0x7f6d4e98bf86 - std::backtrace_rs::backtrace::libunwind::trace::h514ead2753e1782f
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f6d4e98bf86 - std::backtrace_rs::backtrace::trace_unsynchronized::hbc462e8372651887
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f6d4e98bf86 - std::sys_common::backtrace::_print_fmt::he3092ef183bdd613
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f6d4e98bf86 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h908f80a389799910
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f6d4e9de880 - core::fmt::rt::Argument::fmt::ha9f3d8b02e25296c
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/core/src/fmt/rt.rs:142:9
   5:     0x7f6d4e9de880 - core::fmt::write::hef880bc86bd63d4b
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f6d4e97f94f - std::io::Write::write_fmt::h780869503f755b5a
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/std/src/io/mod.rs:1810:15
   7:     0x7f6d4e98bd64 - std::sys_common::backtrace::_print::h52cc78326ec17ac5
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f6d4e98bd64 - std::sys_common::backtrace::print::h44b4c057fd1c7c3f
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f6d4e98eaf7 - std::panicking::default_hook::{{closure}}::h99cbf699c09f8685
  10:     0x7f6d4e98e859 - std::panicking::default_hook::hbc89d54398681576
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/std/src/panicking.rs:292:9
  11:     0x7f6d5174acec - std[1d0ea5b5e602c844]::panicking::update_hook::<alloc[d84df3010862da1b]::boxed::Box<rustc_driver_impl[2078f68ece4ea2b8]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f6d4e98f246 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h99950b3f8a1ddee8
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/alloc/src/boxed.rs:2029:9
  13:     0x7f6d4e98f246 - std::panicking::rust_panic_with_hook::he160495ec53b11e6
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/std/src/panicking.rs:785:13
  14:     0x7f6d4e98ef59 - std::panicking::begin_panic_handler::{{closure}}::ha86f6320ad4cac49
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/std/src/panicking.rs:651:13
  15:     0x7f6d4e98c486 - std::sys_common::backtrace::__rust_end_short_backtrace::h19c3911246e5b7ea
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f6d4e98ece4 - rust_begin_unwind
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/std/src/panicking.rs:647:5
  17:     0x7f6d4e9daf85 - core::panicking::panic_fmt::hd869deda4756f0c1
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/core/src/panicking.rs:72:14
  18:     0x7f6d52b3f9cd - <rustc_ast[a2e9ff0ff4e44aed]::ast::LitKind>::from_token_lit
  19:     0x7f6d52c0b224 - <rustc_ast_lowering[10dbbff99856d352]::LoweringContext>::lower_expr_mut
  20:     0x7f6d53348ddf - <rustc_ast_lowering[10dbbff99856d352]::LoweringContext>::lower_block_noalloc
  21:     0x7f6d5334361f - <rustc_ast_lowering[10dbbff99856d352]::LoweringContext>::lower_maybe_coroutine_body
  22:     0x7f6d537c4e48 - <rustc_ast_lowering[10dbbff99856d352]::LoweringContext>::lower_item_kind
  23:     0x7f6d52da6151 - <rustc_ast_lowering[10dbbff99856d352]::item::ItemLowerer>::lower_node
  24:     0x7f6d537ad9bb - rustc_ast_lowering[10dbbff99856d352]::lower_to_hir
  25:     0x7f6d537ad124 - rustc_query_impl[210ae1d54e37601d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[210ae1d54e37601d]::query_impl::hir_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle[89c572df7d816277]::query::erase::Erased<[u8; 8usize]>>
  26:     0x7f6d537ab2f2 - rustc_query_system[2f3cbd302947754a]::query::plumbing::try_execute_query::<rustc_query_impl[210ae1d54e37601d]::DynamicConfig<rustc_query_system[2f3cbd302947754a]::query::caches::SingleCache<rustc_middle[89c572df7d816277]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[210ae1d54e37601d]::plumbing::QueryCtxt, false>
  27:     0x7f6d537aae46 - rustc_query_impl[210ae1d54e37601d]::query_impl::hir_crate::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7f6d52b8ab9f - rustc_query_impl[210ae1d54e37601d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[210ae1d54e37601d]::query_impl::hir_attrs::dynamic_query::{closure#2}::{closure#0}, rustc_middle[89c572df7d816277]::query::erase::Erased<[u8; 8usize]>>
  29:     0x7f6d52b8a127 - rustc_query_system[2f3cbd302947754a]::query::plumbing::try_execute_query::<rustc_query_impl[210ae1d54e37601d]::DynamicConfig<rustc_query_system[2f3cbd302947754a]::query::caches::VecCache<rustc_hir[95673764c296ef68]::hir_id::OwnerId, rustc_middle[89c572df7d816277]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[210ae1d54e37601d]::plumbing::QueryCtxt, false>
  30:     0x7f6d52b89e8d - rustc_query_impl[210ae1d54e37601d]::query_impl::hir_attrs::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7f6d52a58534 - <rustc_middle[89c572df7d816277]::hir::map::Map>::attrs
  32:     0x7f6d537a87c1 - rustc_passes[84bfad27b65c8e42]::entry::entry_fn
  33:     0x7f6d537a8766 - rustc_query_impl[210ae1d54e37601d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[210ae1d54e37601d]::query_impl::entry_fn::dynamic_query::{closure#2}::{closure#0}, rustc_middle[89c572df7d816277]::query::erase::Erased<[u8; 12usize]>>
  34:     0x7f6d537a8749 - <rustc_query_impl[210ae1d54e37601d]::query_impl::entry_fn::dynamic_query::{closure#2} as core[1eaf6a36b93e3ccb]::ops::function::FnOnce<(rustc_middle[89c572df7d816277]::ty::context::TyCtxt, ())>>::call_once
  35:     0x7f6d537a8049 - rustc_query_system[2f3cbd302947754a]::query::plumbing::try_execute_query::<rustc_query_impl[210ae1d54e37601d]::DynamicConfig<rustc_query_system[2f3cbd302947754a]::query::caches::SingleCache<rustc_middle[89c572df7d816277]::query::erase::Erased<[u8; 12usize]>>, false, false, false>, rustc_query_impl[210ae1d54e37601d]::plumbing::QueryCtxt, false>
  36:     0x7f6d537a7e13 - rustc_query_impl[210ae1d54e37601d]::query_impl::entry_fn::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7f6d53353555 - rustc_interface[567ccd780f164b19]::passes::analysis
  38:     0x7f6d5335345f - rustc_query_impl[210ae1d54e37601d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[210ae1d54e37601d]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[89c572df7d816277]::query::erase::Erased<[u8; 1usize]>>
  39:     0x7f6d536c7bb2 - rustc_query_system[2f3cbd302947754a]::query::plumbing::try_execute_query::<rustc_query_impl[210ae1d54e37601d]::DynamicConfig<rustc_query_system[2f3cbd302947754a]::query::caches::SingleCache<rustc_middle[89c572df7d816277]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[210ae1d54e37601d]::plumbing::QueryCtxt, false>
  40:     0x7f6d536c7915 - rustc_query_impl[210ae1d54e37601d]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7f6d53741633 - rustc_interface[567ccd780f164b19]::interface::run_compiler::<core[1eaf6a36b93e3ccb]::result::Result<(), rustc_span[950276472281dfd0]::ErrorGuaranteed>, rustc_driver_impl[2078f68ece4ea2b8]::run_compiler::{closure#0}>::{closure#0}
  42:     0x7f6d539cf306 - std[1d0ea5b5e602c844]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[567ccd780f164b19]::util::run_in_thread_with_globals<rustc_interface[567ccd780f164b19]::util::run_in_thread_pool_with_globals<rustc_interface[567ccd780f164b19]::interface::run_compiler<core[1eaf6a36b93e3ccb]::result::Result<(), rustc_span[950276472281dfd0]::ErrorGuaranteed>, rustc_driver_impl[2078f68ece4ea2b8]::run_compiler::{closure#0}>::{closure#0}, core[1eaf6a36b93e3ccb]::result::Result<(), rustc_span[950276472281dfd0]::ErrorGuaranteed>>::{closure#0}, core[1eaf6a36b93e3ccb]::result::Result<(), rustc_span[950276472281dfd0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1eaf6a36b93e3ccb]::result::Result<(), rustc_span[950276472281dfd0]::ErrorGuaranteed>>
  43:     0x7f6d539cf133 - <<std[1d0ea5b5e602c844]::thread::Builder>::spawn_unchecked_<rustc_interface[567ccd780f164b19]::util::run_in_thread_with_globals<rustc_interface[567ccd780f164b19]::util::run_in_thread_pool_with_globals<rustc_interface[567ccd780f164b19]::interface::run_compiler<core[1eaf6a36b93e3ccb]::result::Result<(), rustc_span[950276472281dfd0]::ErrorGuaranteed>, rustc_driver_impl[2078f68ece4ea2b8]::run_compiler::{closure#0}>::{closure#0}, core[1eaf6a36b93e3ccb]::result::Result<(), rustc_span[950276472281dfd0]::ErrorGuaranteed>>::{closure#0}, core[1eaf6a36b93e3ccb]::result::Result<(), rustc_span[950276472281dfd0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1eaf6a36b93e3ccb]::result::Result<(), rustc_span[950276472281dfd0]::ErrorGuaranteed>>::{closure#1} as core[1eaf6a36b93e3ccb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  44:     0x7f6d4e998835 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hba0b80fd74ce5417
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/alloc/src/boxed.rs:2015:9
  45:     0x7f6d4e998835 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0ab2d213dcdff51c
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/alloc/src/boxed.rs:2015:9
  46:     0x7f6d4e998835 - std::sys::pal::unix::thread::Thread::new::thread_start::h7eeca5a8e186b7ad
                               at /rustc/e7bbe8ce933123a8e327c79e38bcb790595e6a65/library/std/src/sys/pal/unix/thread.rs:108:17
  47:     0x7f6d4e7849eb - <unknown>
  48:     0x7f6d4e8087cc - <unknown>
  49:                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: rustc 1.77.0-nightly (e7bbe8ce9 2024-01-26) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [hir_crate] getting the crate HIR
#1 [hir_attrs] getting HIR owner attributes in ``
#2 [entry_fn] looking up the entry function of a crate
#3 [analysis] running analysis passes on this crate
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 Jan 26, 2024
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jan 26, 2024
  3. matthiaskrgr commented on Jan 26, 2024

    @matthiaskrgr
    MemberAuthor

    The assertion was added in #120329 cc @nnethercote

  4. self-assigned this
    on Jan 26, 2024
  5. nnethercote commented on Jan 26, 2024

    @nnethercote
    Contributor

    It's Saturday here, I'll fix it on Monday.

  6. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jan 26, 2024
  7. added 2 commits that reference this issue on Jan 29, 2024
    0a568fb
    306612e
  8. added a commit that references this issue on Jan 30, 2024
    c00192a
  9. added a commit that references this issue on Jan 30, 2024
    d02a140
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