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: assertion failed: bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32 #125081

Closed
matthiaskrgr opened this issue May 13, 2024 · 1 comment · Fixed by #125640
Closed

ICE: assertion failed: bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32 #125081

matthiaskrgr opened this issue May 13, 2024 · 1 comment · Fixed by #125640
Labels
A-parser Area: The parsing of Rust source code to an AST. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. 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

snippet:

use std::cell::Cell;

fn main() {
    let _: Cell<&str, "a"> = Cell::new('β);
}

Version information

rustc 1.80.0-nightly (ba956ef4b 2024-05-13)
binary: rustc
commit-hash: ba956ef4b00c91579cff9b2220358ee3a46d982f
commit-date: 2024-05-13
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.4

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

Program output

error: expected `while`, `for`, `loop` or `{` after a label
 --> /tmp/icemaker_global_tempdir.RJ1zlv472JZ2/rustc_testrunner_tmpdir_reporting.T7pYNoW6wTVw/mvce.rs:4:42
  |
4 |     let _: Cell<&str, "a"> = Cell::new('β);
  |                                          ^ expected `while`, `for`, `loop` or `{` after a label
  |
help: add `'` to close the char literal
  |
4 |     let _: Cell<&str, "a"> = Cell::new('β');
  |                                          +

error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied
   --> /tmp/icemaker_global_tempdir.RJ1zlv472JZ2/rustc_testrunner_tmpdir_reporting.T7pYNoW6wTVw/mvce.rs:4:12
    |
4   |     let _: Cell<&str, "a"> = Cell::new('β);
    |            ^^^^       --- help: remove this generic argument
    |            |
    |            expected 1 generic argument
    |
note: struct defined here, with 1 generic parameter: `T`
   --> /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/cell.rs:293:12
    |
293 | pub struct Cell<T: ?Sized> {
    |            ^^^^ -

error[E0308]: mismatched types
   --> /tmp/icemaker_global_tempdir.RJ1zlv472JZ2/rustc_testrunner_tmpdir_reporting.T7pYNoW6wTVw/mvce.rs:4:40
    |
4   |     let _: Cell<&str, "a"> = Cell::new('β);
    |                              --------- ^^ expected `&str`, found `char`
    |                              |
    |                              arguments to this function are incorrect
    |
note: associated function defined here
   --> /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/cell.rs:393:18
    |
393 |     pub const fn new(value: T) -> Cell<T> {
    |                  ^^^
thread 'rustc' panicked at compiler/rustc_span/src/lib.rs:2111:17:
assertion failed: bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32
stack backtrace:
   0:     0x7c42f598ce55 - std::backtrace_rs::backtrace::libunwind::trace::he1c8af16e60d8ac3
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x7c42f598ce55 - std::backtrace_rs::backtrace::trace_unsynchronized::h0ff4fb4d1fb1eafe
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7c42f598ce55 - std::sys_common::backtrace::_print_fmt::hda02bf9854ed434b
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7c42f598ce55 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2f1348356d4dd5a6
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7c42f59dc16b - core::fmt::rt::Argument::fmt::hdfc187d135a92cff
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/core/src/fmt/rt.rs:165:63
   5:     0x7c42f59dc16b - core::fmt::write::h2e66cd8a0d755998
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/core/src/fmt/mod.rs:1169:21
   6:     0x7c42f5981bef - std::io::Write::write_fmt::ha6594d6d0318bd63
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/std/src/io/mod.rs:1835:15
   7:     0x7c42f598cc2e - std::sys_common::backtrace::_print::h7b339c0ab962de77
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7c42f598cc2e - std::sys_common::backtrace::print::hde9837078a8d5e94
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7c42f598f649 - std::panicking::default_hook::{{closure}}::h0f2e3d59d4fc9781
  10:     0x7c42f598f38d - std::panicking::default_hook::h9944960cd621bbba
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/std/src/panicking.rs:298:9
  11:     0x7c42f22eb64f - std[2aee1e20eb236dda]::panicking::update_hook::<alloc[322764ce6b1abc47]::boxed::Box<rustc_driver_impl[b3f759d8272e082a]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7c42f598fd7b - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h63db09f1011a40db
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/alloc/src/boxed.rs:2036:9
  13:     0x7c42f598fd7b - std::panicking::rust_panic_with_hook::hd5c6a18d84f2558b
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/std/src/panicking.rs:799:13
  14:     0x7c42f598fabb - std::panicking::begin_panic_handler::{{closure}}::hd605c4780fe5a47c
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/std/src/panicking.rs:656:13
  15:     0x7c42f598d319 - std::sys_common::backtrace::__rust_end_short_backtrace::ha2a0c331192f969c
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7c42f598f827 - rust_begin_unwind
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/std/src/panicking.rs:652:5
  17:     0x7c42f59d8733 - core::panicking::panic_fmt::hbb9fab08df76f63b
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/core/src/panicking.rs:72:14
  18:     0x7c42f59d87dc - core::panicking::panic::hc81b94fba70b30ca
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/core/src/panicking.rs:146:5
  19:     0x7c42f404269c - <rustc_span[18b9f7b309fe5dcc]::source_map::SourceMap>::lookup_char_pos
  20:     0x7c42f40420db - <rustc_span[18b9f7b309fe5dcc]::source_map::SourceMap>::is_valid_span
  21:     0x7c42f4648147 - <core[5a1853d728d4f28b]::iter::adapters::filter_map::FilterMap<core[5a1853d728d4f28b]::iter::adapters::cloned::Cloned<core[5a1853d728d4f28b]::iter::adapters::filter::Filter<core[5a1853d728d4f28b]::slice::iter::Iter<rustc_errors[1fa39940d3d52013]::Substitution>, <rustc_errors[1fa39940d3d52013]::CodeSuggestion>::splice_lines::{closure#0}>>, <rustc_errors[1fa39940d3d52013]::CodeSuggestion>::splice_lines::{closure#1}> as core[5a1853d728d4f28b]::iter::traits::iterator::Iterator>::next
  22:     0x7c42f41cd244 - <rustc_errors[1fa39940d3d52013]::emitter::HumanEmitter>::emit_messages_default
  23:     0x7c42f41caddc - <rustc_errors[1fa39940d3d52013]::emitter::HumanEmitter as rustc_errors[1fa39940d3d52013]::emitter::Emitter>::emit_diagnostic
  24:     0x7c42f41d12ba - <rustc_errors[1fa39940d3d52013]::DiagCtxtInner>::emit_diagnostic::{closure#3}
  25:     0x7c42f42e571f - rustc_interface[378bc30a20028389]::callbacks::track_diagnostic::<core[5a1853d728d4f28b]::option::Option<rustc_span[18b9f7b309fe5dcc]::ErrorGuaranteed>>
  26:     0x7c42f42e38aa - <rustc_errors[1fa39940d3d52013]::DiagCtxtInner>::emit_diagnostic
  27:     0x7c42f42e3799 - <rustc_errors[1fa39940d3d52013]::DiagCtxt>::emit_diagnostic
  28:     0x7c42f46717c0 - <rustc_span[18b9f7b309fe5dcc]::ErrorGuaranteed as rustc_errors[1fa39940d3d52013]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  29:     0x7c42f250068c - <rustc_hir_typeck[9965755b35d13bf6]::fn_ctxt::FnCtxt>::report_arg_errors
  30:     0x7c42f0fdd69d - <rustc_hir_typeck[9965755b35d13bf6]::fn_ctxt::FnCtxt>::confirm_builtin_call
  31:     0x7c42f3dff761 - <rustc_hir_typeck[9965755b35d13bf6]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  32:     0x7c42f3dead66 - <rustc_hir_typeck[9965755b35d13bf6]::fn_ctxt::FnCtxt>::check_decl
  33:     0x7c42f3df51bc - <rustc_hir_typeck[9965755b35d13bf6]::fn_ctxt::FnCtxt>::check_block_with_expected
  34:     0x7c42f3e00053 - <rustc_hir_typeck[9965755b35d13bf6]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  35:     0x7c42f3dc4d92 - rustc_hir_typeck[9965755b35d13bf6]::check::check_fn
  36:     0x7c42f3dba858 - rustc_hir_typeck[9965755b35d13bf6]::typeck
  37:     0x7c42f3dba2d1 - rustc_query_impl[829470001f3ffad1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[829470001f3ffad1]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[6763d32431b5f193]::query::erase::Erased<[u8; 8usize]>>
  38:     0x7c42f3be44b1 - rustc_query_system[f6e0b1d5265b4ecc]::query::plumbing::try_execute_query::<rustc_query_impl[829470001f3ffad1]::DynamicConfig<rustc_query_system[f6e0b1d5265b4ecc]::query::caches::VecCache<rustc_span[18b9f7b309fe5dcc]::def_id::LocalDefId, rustc_middle[6763d32431b5f193]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[829470001f3ffad1]::plumbing::QueryCtxt, false>
  39:     0x7c42f3be31e0 - rustc_query_impl[829470001f3ffad1]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  40:     0x7c42f3be2e17 - <rustc_middle[6763d32431b5f193]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[e435ea80bf40f43f]::check_crate::{closure#4}>::{closure#0}
  41:     0x7c42f3be1b08 - rustc_hir_analysis[e435ea80bf40f43f]::check_crate
  42:     0x7c42f418253e - rustc_interface[378bc30a20028389]::passes::analysis
  43:     0x7c42f418209b - rustc_query_impl[829470001f3ffad1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[829470001f3ffad1]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[6763d32431b5f193]::query::erase::Erased<[u8; 1usize]>>
  44:     0x7c42f4402ca5 - rustc_query_system[f6e0b1d5265b4ecc]::query::plumbing::try_execute_query::<rustc_query_impl[829470001f3ffad1]::DynamicConfig<rustc_query_system[f6e0b1d5265b4ecc]::query::caches::SingleCache<rustc_middle[6763d32431b5f193]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[829470001f3ffad1]::plumbing::QueryCtxt, false>
  45:     0x7c42f4402a09 - rustc_query_impl[829470001f3ffad1]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  46:     0x7c42f423ee0e - rustc_interface[378bc30a20028389]::interface::run_compiler::<core[5a1853d728d4f28b]::result::Result<(), rustc_span[18b9f7b309fe5dcc]::ErrorGuaranteed>, rustc_driver_impl[b3f759d8272e082a]::run_compiler::{closure#0}>::{closure#1}
  47:     0x7c42f4204a89 - std[2aee1e20eb236dda]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[378bc30a20028389]::util::run_in_thread_with_globals<rustc_interface[378bc30a20028389]::util::run_in_thread_pool_with_globals<rustc_interface[378bc30a20028389]::interface::run_compiler<core[5a1853d728d4f28b]::result::Result<(), rustc_span[18b9f7b309fe5dcc]::ErrorGuaranteed>, rustc_driver_impl[b3f759d8272e082a]::run_compiler::{closure#0}>::{closure#1}, core[5a1853d728d4f28b]::result::Result<(), rustc_span[18b9f7b309fe5dcc]::ErrorGuaranteed>>::{closure#0}, core[5a1853d728d4f28b]::result::Result<(), rustc_span[18b9f7b309fe5dcc]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5a1853d728d4f28b]::result::Result<(), rustc_span[18b9f7b309fe5dcc]::ErrorGuaranteed>>
  48:     0x7c42f4204836 - <<std[2aee1e20eb236dda]::thread::Builder>::spawn_unchecked_<rustc_interface[378bc30a20028389]::util::run_in_thread_with_globals<rustc_interface[378bc30a20028389]::util::run_in_thread_pool_with_globals<rustc_interface[378bc30a20028389]::interface::run_compiler<core[5a1853d728d4f28b]::result::Result<(), rustc_span[18b9f7b309fe5dcc]::ErrorGuaranteed>, rustc_driver_impl[b3f759d8272e082a]::run_compiler::{closure#0}>::{closure#1}, core[5a1853d728d4f28b]::result::Result<(), rustc_span[18b9f7b309fe5dcc]::ErrorGuaranteed>>::{closure#0}, core[5a1853d728d4f28b]::result::Result<(), rustc_span[18b9f7b309fe5dcc]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5a1853d728d4f28b]::result::Result<(), rustc_span[18b9f7b309fe5dcc]::ErrorGuaranteed>>::{closure#2} as core[5a1853d728d4f28b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  49:     0x7c42f5999c1b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1118031ec204f534
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/alloc/src/boxed.rs:2022:9
  50:     0x7c42f5999c1b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h46a265d132dda3f6
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/alloc/src/boxed.rs:2022:9
  51:     0x7c42f5999c1b - std::sys::pal::unix::thread::Thread::new::thread_start::hfd925ddaab3cb24c
                               at /rustc/ba956ef4b00c91579cff9b2220358ee3a46d982f/library/std/src/sys/pal/unix/thread.rs:108:17
  52:     0x7c42ef0a955a - <unknown>
  53:     0x7c42ef126a3c - <unknown>
  54:                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 make sure that you have updated to the latest nightly

note: rustc 1.80.0-nightly (ba956ef4b 2024-05-13) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0107, E0308.
For more information about an error, try `rustc --explain E0107`.

@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. labels May 13, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 13, 2024
@matthiaskrgr
Copy link
Member Author

#122217 cc @estebank

@jieyouxu jieyouxu added S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue A-parser Area: The parsing of Rust source code to an AST. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels May 13, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label May 19, 2024
@bors bors closed this as completed in 01aa2e8 May 28, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue May 28, 2024
Rollup merge of rust-lang#125640 - fmease:plz-no-stringify, r=estebank

Don't suggest turning non-char-literal exprs of ty `char` into string literals

Fixes rust-lang#125595.
Fixes rust-lang#125081.

r? estebank (rust-lang#122217) or compiler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-parser Area: The parsing of Rust source code to an AST. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. 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

Successfully merging a pull request may close this issue.

3 participants