Skip to content

ICE when combine some macro and trait #21087

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

Closed
bombless opened this issue Jan 13, 2015 · 1 comment
Closed

ICE when combine some macro and trait #21087

bombless opened this issue Jan 13, 2015 · 1 comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-trait-system Area: Trait system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@bombless
Copy link
Contributor

This crash occurred when I compile some code that simulate C# linq.

I use Windows 8.1 64-bit but I tried to compile this code with playpen and it also crashed so I think the bug is not related to platform.

rustc 1.0.0-nightly (44a287e 2015-01-08 17:03:40 -0800)
binary: rustc
commit-hash: 44a287e
commit-date: 2015-01-08 17:03:40 -0800
host: i686-pc-windows-gnu
release: 1.0.0-nightly

trait A<T> { fn b(self, T); }
impl<T> A<T> for (){ fn b(self, _: T) {} }
macro_rules! c {
    { $d:expr, $e:expr } => ( $d.b(|&:| $e.b(|&:| ())) )
}
fn main(){ c! { (), () } }
thread 'rustc' panicked at 'assertion failed: begin <= end', C:\bot\slave\nightly-dist-rustc-win-32\build\src\libcore\str\mod.rs:1243

stack backtrace:
   1: 0x62f3ce2f - rt::unwind::register::he1c697e5991dcbf88Dz
   2: 0x62ec350c - rt::unwind::begin_unwind_inner::ha377d8b3de16ce78GBz
   3: 0x62ec3924 - rt::unwind::begin_unwind_fmt::h25a41fc73b9f5e87dAz
   4: 0x62f3c98f - rust_begin_unwind
   5: 0x62f52035 - panicking::panic_fmt::h18e6db1f11aad203pfl
   6: 0x62f4e844 - panicking::panic::h8e2ab44bb07b5550sdl
   7: 0x62f5b7fb - str::slice_error_fail::hdbd045e792bc4657BZs
   8: 0x658bc83e - codemap::CodeMap::span_to_snippet::he902ade52a32b95fx4E
   9:  0x100127a - trans::monomorphize::MonoId<'tcx>...std..cmp..PartialEq::ne::h727788bba72f2338pSd
  10:  0x10c8f82 - trans::base::IsUnboxedClosureFlag...std..clone..Clone::clone::h06447aa38520ecc0QYt
  11:  0x104e2d8 - trans::type_::Type...std..cmp..PartialEq::ne::hf9eef0ba524265afTFJ
  12:  0x104b367 - trans::type_::Type...std..cmp..PartialEq::ne::hf9eef0ba524265afTFJ
  13:  0x10033d1 - trans::expr::Dest...std..cmp..PartialEq::eq::hb0839a09c08a2b84tvh
  14:  0x10155e1 - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::pop_custom_cleanup_scope::h886690550c88d0c9mKK
  15:  0x1048d8b - trans::type_::Type...std..cmp..PartialEq::ne::hf9eef0ba524265afTFJ
  16:  0x104c343 - trans::type_::Type...std..cmp..PartialEq::ne::hf9eef0ba524265afTFJ
  17:  0x10023f4 - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::pop_and_trans_ast_cleanup_scope::hac20a52d4741489fMFK
  18:  0x1002fed - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::pop_and_trans_ast_cleanup_scope::hac20a52d4741489fMFK
  19:  0x10cb633 - trans::base::IsUnboxedClosureFlag...std..clone..Clone::clone::h06447aa38520ecc0QYt
  20:   0xfee211 - trans::context::CrateContext<'b, 'tcx>::sess::h79316aba111d1863Itm
  21:   0xfe9b27 - trans::context::CrateContext<'b, 'tcx>::stats::h24ccf80bb6dc7b15EGm
  22:  0x10d1827 - trans::base::trans_crate::h11d67a5a21c53016Wsv
  23: 0x6b7ea1cd - driver::phase_4_translate_to_llvm::hef7eb92877dd1b88PFa
  24: 0x6b7c3248 - driver::compile_input::hdb1b2f5e3352478cxba
  25: 0x6b892829 - run::h9a36f6fac224e9f5V3b
  26: 0x6b890caf - run::h9a36f6fac224e9f5V3b
  27: 0x6b88f9af - run::h9a36f6fac224e9f5V3b
  28: 0x62f6879c - rust_try
  29: 0x62f2e597 - sys::tcp::TcpListener::bind::h84f1a79868ba93248qw
  30: 0x772f919f - BaseThreadInitThunk
  31: 0x77b90bbb - RtlInitializeExceptionChain

@kmcallister kmcallister added A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-trait-system Area: Trait system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Jan 14, 2015
@bombless
Copy link
Contributor Author

trait A<T> { fn b(self, T); }
impl<T> A<T> for (){ fn b(self, _: T) {} }
macro_rules! c {
    { $d:expr, $e:expr } => ( $d.b(|| $e.b(|| ())) )
}
fn main(){ c! { (), () } }

Seems that it has been fixed... not sure how.
http://is.gd/oQJi9M

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-trait-system Area: Trait system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants