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 #83340

Closed
L3afMe opened this issue Mar 21, 2021 · 3 comments · Fixed by #83343
Closed

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

L3afMe opened this issue Mar 21, 2021 · 3 comments · Fixed by #83343
Assignees
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

@L3afMe
Copy link

L3afMe commented Mar 21, 2021

Code

I tried finding a minified way to reproduce the error but couldn't manage to do it, here's where it occurs:
https://github.com/L3afMe/colou-rs/blob/master/src/main.rs#L117-L152

Meta

rustc --version --verbose:

rustc 1.52.0-nightly (107896c32 2021-03-15)
binary: rustc
commit-hash: 107896c32d5dda4db508968ff34997a39d286966
commit-date: 2021-03-15
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 12.0.0

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:1513:17
Backtrace

   0: rust_begin_unwind
             at /rustc/107896c32d5dda4db508968ff34997a39d286966/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/107896c32d5dda4db508968ff34997a39d286966/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/107896c32d5dda4db508968ff34997a39d286966/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::configure_and_expand::{{closure}}
  19: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
  20: rustc_interface::passes::configure_and_expand
  21: rustc_interface::queries::Queries::expansion
  22: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  23: rustc_span::with_source_map
  24: scoped_tls::ScopedKey<T>::set

@L3afMe L3afMe 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 Mar 21, 2021
@osa1
Copy link
Contributor

osa1 commented Mar 21, 2021

Smaller repro:

fn main() {
    println!(
        "\
            \n {} │",
    );
}

@osa1
Copy link
Contributor

osa1 commented Mar 21, 2021

@rustbot claim

PR coming.

@osa1
Copy link
Contributor

osa1 commented Mar 21, 2021

This revealed another bug (#83344). When both are fixed the error message is now:

   Compiling colou-rs v0.1.0 (/home/omer/rust/issue83340/colou-rs)
error: 27 positional arguments in format string, but there are 26 arguments
   --> src/main.rs:118:16
    |
118 |             "  {}\
    |                ^^
119 |             \n ╭───────────╮ ╭───────────╮\
120 |             \n │   {}   │ │  {} │\
    |                    ^^        ^^
121 |             \n │  {}  │ │  {}  │\
    |                   ^^       ^^
122 |             \n │  {}  │ │  {}  │\
    |                   ^^       ^^
123 |             \n │  {}  │ │  {}  │\
    |                   ^^       ^^
124 |             \n ╰───────────╯ │  {}  │\
    |                                 ^^
125 |             \n ╭───────────╮ ╰───────────╯\
126 |             \n │ {} │ ╭───────────╮\
    |                  ^^
127 |             \n │  {}  │ │   {}  │\
    |                   ^^        ^^
128 |             \n │  {}  │ │  {}  │\
    |                   ^^       ^^
129 |             \n │  {}  │ │  {}  │\
    |                   ^^       ^^
130 |             \n ╰───────────╯ │  {}  │\
    |                                 ^^
131 |             \n ╭───────────╮ │  {}  │\
    |                                 ^^
132 |             \n │   {}   │ │  {}  │\
    |                    ^^        ^^
133 |             \n │  {}  │ │  {}  │\
    |                   ^^       ^^
134 |             \n │  {}  │ │  {}  │\
    |                   ^^       ^^
135 |             \n │  {}  │ │  {}  │\
    |                   ^^       ^^
136 |             \n ╰───────────╯ ╰───────────╯",
137 |             ulb.paint(format!("Complementary color for {}", color.to_hex())),
    |             ----------------------------------------------------------------
138 |             ul.paint("Triad"),     ul.paint("Tetradic"),
    |             -----------------      --------------------
139 |             triad[0].paint_hex(),  tetradic[0].paint_hex(),
    |             --------------------   -----------------------
140 |             triad[1].paint_hex(),  tetradic[1].paint_hex(),
    |             --------------------   -----------------------
141 |             triad[2].paint_hex(),  tetradic[2].paint_hex(),
    |             --------------------   -----------------------
142 |                                    tetradic[3].paint_hex(),
    |                                    -----------------------
143 |             ul.paint("Analogous"), 
    |             ---------------------
144 |             anal[0].paint_hex(),   ul.paint("Shades"),
    |             -------------------    ------------------
145 |             anal[1].paint_hex(),   anal[0].paint_hex(),
    |             -------------------    -------------------
146 |             anal[2].paint_hex(),   anal[0].paint_hex(),
    |             -------------------    -------------------
147 |                                    anal[0].paint_hex(),
    |                                    -------------------
148 |             ul.paint("Split"),     anal[0].paint_hex(),
    |             -----------------      -------------------
149 |             s_comp[0].paint_hex(), anal[0].paint_hex(),
    |             ---------------------  -------------------
150 |             s_comp[1].paint_hex(), anal[0].paint_hex(),
    |             ---------------------  -------------------
151 |             s_comp[2].paint_hex(), anal[0].paint_hex(),
    |             ---------------------  -------------------

warning: unused import: `hsv::HSVColor`
 --> src/colors/rgb.rs:1:53
  |
1 | use crate::colors::{ansi::ColorAnsi, hsl::HSLColor, hsv::HSVColor, ColorComponent, ColorComponentConvert, Error};
  |                                                     ^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error: aborting due to previous error; 1 warning emitted

error: could not compile `colou-rs`

To learn more, run the command again with --verbose.

fanninpm added a commit to fanninpm/glacier that referenced this issue Mar 26, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 26, 2021
Simplify and fix byte skipping in format! string parser

Fixes '\\' handling in format strings.

Fixes rust-lang#83340
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Mar 27, 2021
JohnTitor added a commit to JohnTitor/rust that referenced this issue Mar 27, 2021
Simplify and fix byte skipping in format! string parser

Fixes '\\' handling in format strings.

Fixes rust-lang#83340
JohnTitor added a commit to JohnTitor/rust that referenced this issue Mar 27, 2021
Simplify and fix byte skipping in format! string parser

Fixes '\\' handling in format strings.

Fixes rust-lang#83340
@bors bors closed this as completed in ae8ef70 Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

3 participants