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

pretty printer ICEs on large expressions: assertion failed: (self.right != self.left) #17406

Closed
mahkoh opened this issue Sep 20, 2014 · 3 comments
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@mahkoh
Copy link
Contributor

mahkoh commented Sep 20, 2014

Consider the following code:

#![feature(macro_rules)]

macro_rules! gen {
    ($i:expr;) => {};
    ($i:expr; $n0:ident, $($n:ident,)*) => {
        static $n0: int = $i; gen!($i + 1; $($n,)*)
    }
}

gen! { 0;
    I0,
    I1,
    I2,
    // lots of good stuff here
    I199,
}

fn main() {
}

Output with --pretty expanded:

#![feature(macro_rules)]
#![feature(phase)]
#![no_std]
#![feature(globs)]
#[phase(plugin, link)]
extern crate "std" as std;
extern crate "native" as rt;
#[prelude_import]
use std::prelude::*;

static I0: int =

    0;
static I1: int = 0 + 1;
static I2: int = 0 + 1 + 1;
// lots of good stuff here
static I103: int =
    0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1
        + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 +
        1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1
        + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 +
        1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1
        + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1;
static I104: int =
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'assertion failed: (self.right != self.left)', /build/rust-git/src/rust/src/libsyntax/ast_util.rs:694

stack backtrace:
   1:     0x7f5dbdbb4b50 - rt::backtrace::imp::write::h7677f84be452f7e2iHq
   2:     0x7f5dbdbb7d10 - <unknown>
   3:     0x7f5dbe3683f0 - unwind::begin_unwind_inner::hed657adb365550c0MTd
   4:     0x7f5dba237660 - <unknown>
   5:     0x7f5dba39a0d0 - print::pp::Printer::pretty_print::h1865774e32c541f5LpW
   6:     0x7f5dba3abfa0 - print::pprust::State<'a>::word_space::h454016a946c40a4038X
   7:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
   8:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
   9:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  10:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  11:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  12:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  13:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  14:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  15:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  16:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  17:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  18:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  19:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  20:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  21:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  22:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  23:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  24:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  25:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  26:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  27:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  28:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  29:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  30:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  31:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  32:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  33:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  34:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  35:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  36:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  37:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  38:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  39:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  40:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  41:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  42:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  43:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  44:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  45:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  46:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  47:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  48:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  49:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  50:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  51:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  52:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  53:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  54:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  55:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  56:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  57:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  58:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  59:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  60:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  61:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  62:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  63:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  64:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  65:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  66:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  67:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  68:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  69:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  70:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  71:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  72:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  73:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  74:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  75:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  76:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  77:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  78:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  79:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  80:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  81:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  82:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  83:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  84:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  85:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  86:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  87:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  88:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  89:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  90:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  91:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  92:     0x7f5dba2ab530 - print::pprust::State<'a>::print_expr::h7be58717952ade00GRZ
  93:     0x7f5dba2a75d0 - print::pprust::State<'a>::print_item::ha8b4b7caf20d57edAIY
  94:     0x7f5dba39fce0 - print::pprust::State<'a>::print_mod::h7d36275f9c448b20vnY
  95:     0x7f5dba39f690 - print::pprust::print_crate::h9e4149b4e3dac92f3FX
  96:     0x7f5dbefd92c0 - <unknown>
  97:     0x7f5dbefd2a70 - driver::pretty::pretty_print_input::hc71b3b2ff868053faxy
  98:     0x7f5dbefe2cd0 - <unknown>
  99:     0x7f5dbefe2bb0 - <unknown>
  100:     0x7f5dbe7722b0 - <unknown>
 ... <frames omitted>

Full code here: https://gist.github.com/anonymous/87527e1e822bdb15bfdb

$ rustc -v
rustc 0.12.0-pre (8067f4425 2014-09-17 21:15:38 +0000)
@mahkoh
Copy link
Contributor Author

mahkoh commented Sep 20, 2014

Smaller:

static I104: int =
    0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1
        + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 +
        1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1
        + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 +
        1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1
        + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1;

fn main() {
}

@huonw huonw added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-pretty Area: Pretty printing (including `-Z unpretty`) labels Sep 20, 2014
@huonw huonw changed the title ICE assertion failed: (self.right != self.left) (--pretty expanded) pretty printer ICEs on large expressions: assertion failed: (self.right != self.left) Sep 20, 2014
@huonw
Copy link
Member

huonw commented Sep 20, 2014

(Fails with --pretty normal too.)

@steveklabnik
Copy link
Member

Triage: this still ICEs

@mahkoh mahkoh closed this as completed Apr 11, 2015
@rust-lang rust-lang locked and limited conversation to collaborators Apr 11, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants