Skip to content

Weird ICE on edge-case input on stable #88247

Closed
@kawaemon

Description

@kawaemon

Code

For more context, please read this repository because it depends on another file.

We investigated for some time, and we found that this ICE also depends on length of path of working directory.
We reproduced with length of 32 and 48.

fn main() {
    println!(include_str!("123456789123456"));

    let token = std::env::var("").expect("");

    Client::builder(token)
        .event_handler(DiscordEventHandler)
        .expect("                                  ア");
}

Meta

We couldn't reproduce on rustc 1.56.0-nightly (af140757b 2021-08-22).

rustc --version --verbose:

rustc 1.54.0 (a178d0322 2021-07-26)
binary: rustc
commit-hash: a178d0322ce20e33eac124758e837cbd80a6f633
commit-date: 2021-07-26
host: x86_64-unknown-linux-gnu
release: 1.54.0
LLVM version: 12.0.1

Error output

thread 'rustc' panicked at 'assertion failed: bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32', compiler/rustc_span/src/lib.rs:1575:17

<backtrace>

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.54.0 (a178d0322 2021-07-26) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C linker=/usr/bin/clang -C incremental -C link-arg=-fuse-ld=lld --crate-type bin

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

query stack during panic:
end of query stack
Backtrace

stack backtrace:
   0: rust_begin_unwind
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:50:5
   3: rustc_span::SourceFile::lookup_file_pos
   4: rustc_span::SourceFile::lookup_file_pos_with_col_display
   5: rustc_span::source_map::SourceMap::lookup_char_pos
   6: rustc_errors::emitter::EmitterWriter::get_multispan_max_line_num
   7: <rustc_errors::emitter::EmitterWriter as rustc_errors::emitter::Emitter>::emit_diagnostic
   8: rustc_errors::json::Diagnostic::from_errors_diagnostic
   9: <rustc_errors::json::JsonEmitter as rustc_errors::emitter::Emitter>::emit_diagnostic
  10: rustc_errors::HandlerInner::emit_diagnostic
  11: rustc_errors::diagnostic_builder::DiagnosticBuilder::emit
  12: rustc_builtin_macros::format::expand_preparsed_format_args
  13: rustc_builtin_macros::format::expand_format_args_impl
  14: rustc_expand::expand::MacroExpander::fully_expand_fragment
  15: rustc_expand::expand::MacroExpander::expand_crate
  16: rustc_session::utils::<impl rustc_session::session::Session>::time
  17: rustc_interface::passes::configure_and_expand_inner
  18: rustc_interface::passes::boxed_resolver::BoxedResolver::new
  19: rustc_interface::queries::Queries::expansion
  20: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  21: rustc_span::with_source_map
  22: rustc_interface::interface::create_compiler_and_run
  23: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    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