Closed
Description
Got an ICE when compiling some code using parser-combinators, unfortunately I am not sure I can decouple the code from using the library so I uploaded a github repo with the file and cargo dependency needed here. Just run it with cargo build
and it should ICE.
extern crate parser_combinators;
use std::marker::PhantomData;
trait AstId { type Untyped: Clone; }
impl AstId for String { type Untyped = String; }
pub fn parse_module() {
use parser_combinators::primitives::State;
use parser_combinators::*;
struct ParserEnv<Id> {
_marker: PhantomData<fn (String) -> Id>
}
impl <Id> ParserEnv<Id>
where Id: AstId {
fn ident(&self) -> Id::Untyped {
panic!()
}
fn record_type(&self, input: State<&'static str>) -> ParseResult<Vec<(Id::Untyped, Id::Untyped)>, &'static str> {
many::<Vec<_>, _>(value(self.ident())
.and(value(self.ident()))//Remove this line and fix replace the tuple in the return type with Id::Untyped for another ICE
.map(|x| x)//Remove this call to map and it compiles
).parse_state(input)
}
}
let env: ParserEnv<String> = ParserEnv {
_marker: PhantomData
};
parser(|i| env.record_type(i));
}
src\lib.rs:1:1: 1:1 error: internal compiler error: projection error while selecting?
src\lib.rs:1 extern crate parser_combinators;
^
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', C:/bot/slave/nightly-dist-rustc-win-64/build/src/libsyntax\diagnostic.rs:176
stack backtrace:
1: 0x63cb8722 - sys::backtrace::write::h17240dc0eaceafe7Rgs
2: 0x63cc1b96 - rt::unwind::register::hf97832460d72cd16gOv
3: 0x63c85390 - rt::unwind::begin_unwind_inner::hcf167426fb12ee63qLv
4: 0x6e3c9f09 - diagnostic::SpanHandler::span_bug::hff33238cf6a98a20u6B
5: 0x6e3c9eaf - diagnostic::SpanHandler::span_bug::hff33238cf6a98a20u6B
6: 0x6d4022e2 - session::Session::span_bug::h067231b8894ea4e01nr
7: 0x6d6db057 - middle::traits::evaluate_builtin_bound::hadd7218901ef36aacMV
8: 0x6d6feebf - middle::ty::closure_upvars::h88bda868b374aa76MK8
9: 0x6d5900a5 - middle::ty::type_is_sized::h4fc04eb191053d6fAS5
10: 0x6abbe207 - trans::context::CrateContext<'b, 'tcx>::sess::h47ba7f6b66031d03EJt
11: 0x6abd59f8 - trans::context::CrateContext<'b, 'tcx>::get_intrinsic::h06903648e28e2397lKt
12: 0x6acd54fa - trans::_match::ReassignmentChecker.euv..Delegate<'tcx>::mutate::hc923a533a27d041b5qI
13: 0x6abd45e7 - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::needs_invoke::h867326256dc0c0ab0xp
14: 0x6abe397d - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::push_custom_cleanup_scope_with_debug_loc::h65206fced3061d72K2o
15: 0x6abe2073 - trans::datum::Rvalue.KindOps::post_store::h62afad44cee1556apFv
16: 0x6abe4234 - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::pop_and_trans_custom_cleanup_scope::h4e8777762ff791d0yap
17: 0x6ac23851 - trans::context::CrateContext<'b, 'tcx>::fn_pointer_shims::h6740281c1906aee88Nt
18: 0x6ac13bcf - trans::datum::Expr.KindOps::is_by_ref::he67898a485dd01554Hv
19: 0x6ac28db5 - trans::debuginfo::ast..Expr.ToDebugLoc::debug_loc::h2b8f89cc044a8ffalGz
20: 0x6ac25d1c - trans::debuginfo::ast..Expr.ToDebugLoc::debug_loc::h2b8f89cc044a8ffalGz
21: 0x6ac85402 - trans::expr::Dest...std..clone..Clone::clone::h2d8a6879a209d263z9z
22: 0x6ac5cf95 - trans::context::CrateContext<'b, 'tcx>::check_drop_flag_for_sanity::h93f0f1f9855d31d6CYt
23: 0x6abe3c30 - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::push_custom_cleanup_scope_with_debug_loc::h65206fced3061d72K2o
24: 0x6abe2073 - trans::datum::Rvalue.KindOps::post_store::h62afad44cee1556apFv
25: 0x6abe4234 - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::pop_and_trans_custom_cleanup_scope::h4e8777762ff791d0yap
26: 0x6ac23851 - trans::context::CrateContext<'b, 'tcx>::fn_pointer_shims::h6740281c1906aee88Nt
27: 0x6ac13bcf - trans::datum::Expr.KindOps::is_by_ref::he67898a485dd01554Hv
28: 0x6ac12533 - trans::datum::Expr.KindOps::is_by_ref::he67898a485dd01554Hv
29: 0x6ac2763e - trans::debuginfo::ast..Expr.ToDebugLoc::debug_loc::h2b8f89cc044a8ffalGz
30: 0x6ac25d1c - trans::debuginfo::ast..Expr.ToDebugLoc::debug_loc::h2b8f89cc044a8ffalGz
31: 0x6ac85402 - trans::expr::Dest...std..clone..Clone::clone::h2d8a6879a209d263z9z
32: 0x6ac5cf95 - trans::context::CrateContext<'b, 'tcx>::check_drop_flag_for_sanity::h93f0f1f9855d31d6CYt
33: 0x6abe3c30 - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::push_custom_cleanup_scope_with_debug_loc::h65206fced3061d72K2o
34: 0x6abe2073 - trans::datum::Rvalue.KindOps::post_store::h62afad44cee1556apFv
35: 0x6ac30671 - trans::context::CrateContext<'b, 'tcx>::closure_vals::hf48aea36c2fc6b90aVt
36: 0x6ac8630c - trans::expr::Dest...std..clone..Clone::clone::h2d8a6879a209d263z9z
37: 0x6ac84713 - trans::expr::Dest...std..clone..Clone::clone::h2d8a6879a209d263z9z
38: 0x6abc58e5 - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::pop_custom_cleanup_scope::h70d9afa64f76b22fG8o
39: 0x6ac1fe7f - trans::context::CrateContext<'b, 'tcx>::fn_pointer_shims::h6740281c1906aee88Nt
40: 0x6ac25286 - trans::common::ExprOrMethodCall...std..cmp..PartialEq::ne::hc61d8507405d927clds
41: 0x6ac8626a - trans::expr::Dest...std..clone..Clone::clone::h2d8a6879a209d263z9z
42: 0x6ac5cf95 - trans::context::CrateContext<'b, 'tcx>::check_drop_flag_for_sanity::h93f0f1f9855d31d6CYt
43: 0x6ac5cb28 - trans::context::CrateContext<'b, 'tcx>::check_drop_flag_for_sanity::h93f0f1f9855d31d6CYt
44: 0x6abe3952 - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::push_custom_cleanup_scope_with_debug_loc::h65206fced3061d72K2o
45: 0x6abe2073 - trans::datum::Rvalue.KindOps::post_store::h62afad44cee1556apFv
46: 0x6abe4234 - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::pop_and_trans_custom_cleanup_scope::h4e8777762ff791d0yap
47: 0x6abe6b99 - trans::base::TransItemVisitor<'a, 'tcx>.Visitor<'v>::visit_item::h0ea287790196486dCbi
48: 0x6abf4816 - trans::base::trans_crate::h467a88bab46e74c484i
49: 0x6fca8ce6 - driver::phase_4_translate_to_llvm::hac244219d972fac5nOa
50: 0x6fc82d31 - driver::compile_input::h8ffd252a42277d1cQba
51: 0x6fd352e3 - run_compiler::h7a90a6d5e81af66175b
52: 0x6fd32e6f - run::h27aab490c2c97a88N5b
53: 0x6fd32429 - run::h27aab490c2c97a88N5b
54: 0x63cfb2dc - rust_try
55: 0x63cfb2b9 - rust_try
56: 0x6fd326a5 - run::h27aab490c2c97a88N5b
57: 0x63cbfe54 - sys::process::Command::cwd::h8d65332726b1cb469uu
58: 0x776559cd - BaseThreadInitThunk
Could not compile `rust-error`.
To learn more, run the command again with --verbose.
Versions:
cargo 0.2.0-nightly (ac61996 2015-05-17) (built 2015-05-18)
rustc 1.2.0-nightly (0cc99f9 2015-05-17) (built 2015-05-18)
binary: rustc
commit-hash: 0cc99f9
commit-date: 2015-05-17
build-date: 2015-05-18
host: x86_64-pc-windows-gnu
release: 1.2.0-nightly