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

Macro expansion causes rustc assert fail (self.right != self.left) #16098

Closed
jrvanwhy opened this issue Jul 30, 2014 · 1 comment · Fixed by #18099
Closed

Macro expansion causes rustc assert fail (self.right != self.left) #16098

jrvanwhy opened this issue Jul 30, 2014 · 1 comment · Fixed by #18099
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@jrvanwhy
Copy link
Contributor

Ran into a compiler bug, failed assert in rustc.
Please let me know if I could supply more useful information.

Environment:

OS: Linux Mint Debian Edition, latest update pack (Feb. 2014)
Architecture: x86_64
rustc version: rustc 0.12.0-pre-nightly (b2bd99860 2014-07-28 22:36:39 +0000)

The error message:

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)', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/ast_util.rs:784

My code (probably invalid Rust -- I am currently learning the language):

#![feature(macro_rules)]

macro_rules! prob1 {
    (0) => {
        0
    };
    ($n:expr) => {
        if ($n % 3 == 0) || ($n % 5 == 0) {
            $n + prob1!($n - 1);
        } else {
            prob1!($n - 1);
        }
    };
}

fn main() {
    println!("Problem 1: {}", prob1!(1000));
}

Backtrace, obtained via RUST_BACKTRACE=1

stack backtrace:
   1:     0x7f01e3f734f0 - rt::backtrace::imp::write::h03fe52a45ed407a80aq
   2:     0x7f01e3f76c80 - failure::on_fail::he03d41fc6819285a9vq
   3:     0x7f01e4732bb0 - unwind::begin_unwind_inner::h7022fde17a459823EXd
   4:     0x7f01e47328a0 - unwind::begin_unwind_fmt::h731662d6eb5c04d36Ud
   5:     0x7f01e0fd7910 - print::pp::Printer::pretty_print::h24b582f09e05fc4bl5T
   6:     0x7f01e1002630 - print::pprust::State<'a>::print_literal::hc8ab973221a13afeDLZ
   7:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
   8:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
   9:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  10:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  11:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  12:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  13:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  14:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  15:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  16:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  17:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  18:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  19:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  20:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  21:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  22:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  23:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  24:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  25:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  26:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  27:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  28:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  29:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  30:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  31:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  32:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  33:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  34:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  35:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  36:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  37:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  38:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  39:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  40:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  41:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  42:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  43:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  44:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  45:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  46:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  47:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  48:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  49:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  50:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  51:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  52:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  53:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  54:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  55:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  56:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  57:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  58:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  59:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  60:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  61:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  62:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  63:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  64:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  65:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  66:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  67:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  68:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  69:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  70:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  71:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  72:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  73:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  74:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  75:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  76:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  77:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  78:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  79:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  80:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  81:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  82:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  83:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  84:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  85:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  86:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  87:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  88:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  89:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  90:     0x7f01e0fe6a60 - print::pprust::State<'a>::print_expr::hc2244506b925e470WyX
  91:     0x7f01e0fe6a20 - print::pprust::expr_to_string::closure.$x22closure$x22$LP$47517$RP$
  92:     0x7f01e0fde7c0 - print::pprust::to_string::hf055a8b72d47613bkCV
  93:     0x7f01e0f75af0 - parse::token::to_string::he340146fdd57640a5BQ
  94:     0x7f01e1137ee0 - ext::tt::macro_parser::parse::hf97c32ab0ab7bb6084a
  95:     0x7f01e113d180 - ext::tt::macro_rules::MacroRulesMacroExpander.TTMacroExpander::expand::h19b8cd401d8c2880hvb
  96:     0x7f01e10b06c0 - ext::expand::expand_expr::he2349cf4d5024f5b2D6
  97:     0x7f01e1030a80 - ext::expand::MacroExpander<'a, 'b>.Folder::fold_expr::hfc9eb4ac1474ffa0kB7
  98:     0x7f01e10b5d10 - fold::noop_fold_expr::h3331155030911906123
  99:     0x7f01e10b06c0 - ext::expand::expand_expr::he2349cf4d5024f5b2D6
  100:     0x7f01e1030a80 - ext::expand::MacroExpander<'a, 'b>.Folder::fold_expr::hfc9eb4ac1474ffa0kB7
 ... <frames omitted>
@jdm jdm added the I-ICE label Jul 30, 2014
@mahkoh
Copy link
Contributor

mahkoh commented Oct 13, 2014

No longer valid.

@alexcrichton alexcrichton added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 13, 2014
bors added a commit that referenced this issue Oct 18, 2014
Closes #9249.
Closes #13105.
Closes #13837.
Closes #13847.
Closes #15207.
Closes #15261.
Closes #16048. 
Closes #16098.
Closes #16256.
Closes #16562.
Closes #16596.
Closes #16709.
Closes #16747.
Closes #17025.
Closes #17121.
Closes #17450.
Closes #17636.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants