Skip to content

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

Closed
@bjorn3

Description

@bjorn3

Reproduction branch: https://github.com/bjorn3/rustc_codegen_cranelift/tree/syntax_assertion_fail

When applying the change from the last commit I get a panic in my code during the call to SourceMap::lookup_char_pos.

$ rustc -V
rustc 1.34.0-nightly (8a57831a4 2019-02-02)
$ uname -a
Darwin iMac.local 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64
Backtrace
thread 'rustc' panicked at 'assertion failed: bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32', src/libsyntax/source_map.rs:832:17
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::_print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::begin_panic
   7: syntax::source_map::SourceMap::bytepos_to_file_charpos
   8: syntax::source_map::SourceMap::lookup_char_pos
   9: rustc_codegen_cranelift::debuginfo::FunctionDebugContext::define::{{closure}}
  10: rustc_codegen_cranelift::debuginfo::FunctionDebugContext::define
  11: rustc_codegen_cranelift::base::trans_fn::{{closure}}::{{closure}}
  12: <core::option::Option<T>>::map
  13: rustc_codegen_cranelift::base::trans_fn::{{closure}}
  14: <cranelift_module::module::Module<B>>::define_function_peek_compiled
  15: rustc_codegen_cranelift::base::trans_fn
  16: rustc_codegen_cranelift::base::trans_mono_item
  17: rustc_codegen_cranelift::codegen_mono_items::{{closure}}::{{closure}}
  18: rustc_codegen_cranelift::unimpl::try_unimpl::{{closure}}
  19: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  20: std::panicking::try::do_call
  21: __rust_maybe_catch_panic
  22: std::panicking::try
  23: std::panic::catch_unwind
  24: rustc_codegen_cranelift::unimpl::try_unimpl
  25: rustc_codegen_cranelift::codegen_mono_items::{{closure}}
  26: rustc_codegen_cranelift::time
  27: rustc_codegen_cranelift::codegen_mono_items
  28: rustc_codegen_cranelift::codegen_cgus
  29: <rustc_codegen_cranelift::CraneliftCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
  30: rustc::util::common::time
  31: rustc_driver::driver::phase_4_codegen
  32: rustc_driver::driver::compile_input::{{closure}}
  33: <std::thread::local::LocalKey<T>>::with
  34: rustc::ty::context::TyCtxt::create_and_enter
  35: rustc_driver::driver::compile_input
  36: rustc_driver::run_compiler_with_pool
  37: <scoped_tls::ScopedKey<T>>::set
  38: rustc_driver::run_compiler
  39: <scoped_tls::ScopedKey<T>>::set

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.D-Unicode-unawareDiagnostics: Diagnostics that are unaware of Unicode and trigger codepoint boundary assertionsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been 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.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions