Skip to content

Instantly share code, notes, and snippets.

View gist:99f41345954590dbf2e4
Running target/debug/parser-4592a6b517fc46f5
running 5 tests
test mdo::test::mdo ... ok
test mdo::test::mdo_closure ... ok
test monad::test::associativity ... ok
test monad::test::right_identity ... ok
test monad::test::left_identity ... ok
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured
View lib.rs
#![crate_name = "parser"]
#![crate_type = "lib"]
use std::ops::Add;
/// ```
/// use parser::test;
///
/// assert_eq!(test::<i32>(1)(2), 3);
/// ```
View cargo.toml
[package]
name = "test"
version = "0.1.0"
authors = ["Martin Wernstål <m4rw3r@gmail.com>"]
[dependencies.parser]
path = "/Users/m4rw3r/Projects/Self/rust_parser"
View gist:f8f0567314f76b846fbb
error: internal compiler error: fictitious type impl Parser<u8, &'static [u8], error::Error<u8>> + Sized + 'static in sizing_type_of()
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
thread 'rustc' panicked at 'Box<Any>', src/libsyntax/diagnostic.rs:253
stack backtrace:
1: 0x1070328f5 - sys::backtrace::write::hbde7a04ac5266f40Cxs
2: 0x10703b9fe - panicking::on_panic::hebff0ba18b62efb1kYw
3: 0x106ff53e2 - rt::unwind::begin_unwind_inner::hda386695be757df8vGw
4: 0x104c6741f - rt::unwind::begin_unwind::h4700935743387377434
View gist:d28556a92cff33c1ab15
error: internal compiler error: fictitious type impl Parser<u8, &'static [u8], error::Error<u8>> + Sized + 'static in sizing_type_of()
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
thread 'rustc' panicked at 'Box<Any>', src/libsyntax/diagnostic.rs:253
stack backtrace:
1: 0x1080028f5 - sys::backtrace::write::ha0bc4a9bddc6a867Cxs
2: 0x10800b9fe - panicking::on_panic::ha9dfbe03b50c004akYw
3: 0x107fc53e2 - rt::unwind::begin_unwind_inner::hca93a9fd146d03e3vGw
View rust.diff
diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs
index 61e81d7..69328e8 100644
--- a/src/librustc_trans/trans/base.rs
+++ b/src/librustc_trans/trans/base.rs
@@ -2343,6 +2343,8 @@ pub fn get_item_val(ccx: &CrateContext, id: ast::NodeId) -> ValueRef {
let val = match item {
ast_map::NodeItem(i) => {
let ty = ccx.tcx().node_id_to_type(i.id);
+ let ty = monomorphize::normalize_associated_type(ccx.tcx(), &ty);
+
View gist:38569bc40401b60d90f9
➜ rust_parser git:(unboxed-closures_http_parser) RUST_LOG=rustc_trans::trans::type_of cargo build
Compiling parser v0.0.1 (file:///Users/m4rw3r/Projects/Self/rust_parser)
DEBUG:rustc_trans::trans::type_of: type_of &'static [&'static str]
DEBUG:rustc_trans::trans::type_of: type_of [&'static str]
DEBUG:rustc_trans::trans::type_of: type_of &'static str
DEBUG:rustc_trans::trans::type_of: --> mapped t=&'static str &'static str to llty=%str_slice = type { i8*, i64 }
DEBUG:rustc_trans::trans::type_of: --> mapped t=[&'static str] [&'static str] to llty=%str_slice = type { i8*, i64 }
DEBUG:rustc_trans::trans::type_of: --> mapped t=&'static [&'static str] &'static [&'static str] to llty={ %str_slice*, i64 }
DEBUG:rustc_trans::trans::type_of: type_of u8
DEBUG:rustc_trans::trans::type_of: --> mapped t=u8 u8 to llty=i8
@m4rw3r
m4rw3r / gist:161f67e3ebeb88dc04c4
Created Sep 6, 2015
Output of RUST_LOG=rustc_trans::base with added logging around monomorphize before calls to register_fn. Node..., pre and Node..., post are before and after monomorphization.
View gist:161f67e3ebeb88dc04c4
Compiling parser v0.0.1 (file:///Users/m4rw3r/Projects/Self/rust_parser)
DEBUG:rustc_trans::trans::base: new InsnCtxt: text
DEBUG:rustc_trans::trans::base: new InsnCtxt: trans_mod
DEBUG:rustc_trans::trans::base: new InsnCtxt: trans_item
DEBUG:rustc_trans::trans::base: new InsnCtxt: trans_item
DEBUG:rustc_trans::trans::base: new InsnCtxt: trans_item
DEBUG:rustc_trans::trans::base: new InsnCtxt: trans_item
DEBUG:rustc_trans::trans::base: new InsnCtxt: trans_mod
DEBUG:rustc_trans::trans::base: new InsnCtxt: trans_item
DEBUG:rustc_trans::trans::base: new InsnCtxt: trans_item
@m4rw3r
m4rw3r / gist:813ac04d1dc494a1b119
Created Sep 6, 2015
Output of RUST_LOG=rustc_trans::base with added logging around monomorphize before calls to register_fn. Node..., pre and Node..., post are before and after monomorphization. Includes result from ty.has_anonymized_types().
View gist:813ac04d1dc494a1b119
Compiling parser v0.0.1 (file:///Users/m4rw3r/Projects/Self/rust_parser)
DEBUG:rustc_trans::trans::base: new InsnCtxt: text
DEBUG:rustc_trans::trans::base: new InsnCtxt: trans_mod
DEBUG:rustc_trans::trans::base: new InsnCtxt: trans_item
DEBUG:rustc_trans::trans::base: new InsnCtxt: trans_item
DEBUG:rustc_trans::trans::base: new InsnCtxt: trans_item
DEBUG:rustc_trans::trans::base: new InsnCtxt: trans_item
DEBUG:rustc_trans::trans::base: new InsnCtxt: trans_mod
DEBUG:rustc_trans::trans::base: new InsnCtxt: trans_item
DEBUG:rustc_trans::trans::base: new InsnCtxt: trans_item
View gist:c6b675dff898ef88f46d
DEBUG:rustc::middle::infer: normalize_associated_type(t=FnConverging(impl Parser<'static, u8, u8, error::Error<u8>> + Sized + 'static))
DEBUG:rustc::middle::infer: normalize_associated_types(infcx.deanonymize=true)
DEBUG:rustc::middle::infer: erase_regions(FnConverging(impl Parser<'static, u8, u8, error::Error<u8>> + Sized + 'static)) = FnConverging(impl Parser<u8, u8, error::Error<u8>> + Sized + 'static)
DEBUG:rustc::middle::traits::project: AssociatedTypeNormalizer::fold(value=FnConverging(impl Parser<u8, u8, error::Error<u8>> + Sized + 'static), has_projection_types=false, deanonymize=true, has_associated_types=true)
DEBUG:rustc::middle::traits::project: AssociatedTypeNormalizer::fold_ty(ty=impl Parser<u8, u8, error::Error<u8>> + Sized + 'static)
DEBUG:rustc::middle::traits::project: AssociatedTypeNormalizer::fold_ty(ty=u8)
DEBUG:rustc::middle::traits::project: AssociatedTypeNormalizer::fold_ty(ty=u8)
DEBUG:rustc::middle::traits::project: AssociatedTypeNormalizer::fold_ty(ty=error::Error<u8>)
DEBUG:rustc::
You can’t perform that action at this time.