Skip to content

Instantly share code, notes, and snippets.

@m4rw3r
m4rw3r / nom_http_parser.rs
Created Sep 7, 2015
Version of the attoparsec example using the parser combinator Nom version 0.3.11.
View nom_http_parser.rs
#[macro_use]
extern crate nom;
use nom::IResult;
use std::env;
use std::fs::File;
#[derive(Debug)]
struct Request<'a> {
method: &'a [u8],
@m4rw3r
m4rw3r / combine_http_parser_1.0.0.rs
Last active Sep 7, 2015
Version of the attoparsec example using the parser combinator Combine version 1.0.0.
View combine_http_parser_1.0.0.rs
extern crate combine;
use combine::*;
use combine::primitives::Error;
use std::fs::File;
use std::env;
#[derive(Debug)]
@m4rw3r
m4rw3r / http_parser.rs
Created Sep 7, 2015
Second version of the attoparsec benchmark for parsing HTTP header dumps writtien in rust using my experimental parser combinator, post version 3.
View http_parser.rs
//! http parser comparable to the http-parser found in attoparsec's examples.
//!
//! Reads data in the following format:
//!
//! ```text
//! GET /robot.txt HTTP/1.1
//! Host: localhost
//! Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
//!
//! ```
@m4rw3r
m4rw3r / gist:e2cc5196c662ccdab02b
Created Sep 7, 2015
make check-stage2-ctest when removing if !data.has_escaping_regions() in librustc/middle/traits/project.rs::AssociatedTypeNormalizer::fold_ty
View gist:e2cc5196c662ccdab02b
failures:
---- [compile-fail] compile-fail/associated-types-outlives.rs stdout ----
error: expected error on line 32 not found: cannot move out of `x` because it is borrowed
status: exit code: 101
command: x86_64-apple-darwin/stage2/bin/rustc /Users/m4rw3r/Projects/Clones/rust/src/test/compile-fail/associated-types-outlives.rs -L x86_64-apple-darwin/test/compile-fail/ --target=x86_64-apple-darwin -L x86_64-apple-darwin/test/compile-fail/associated-types-outlives.stage2-x86_64-apple-darwin.compile-fail.libaux -C prefer-dynamic -o x86_64-apple-darwin/test/compile-fail/associated-types-outlives.stage2-x86_64-apple-darwin --cfg rtopt -O -L x86_64-apple-darwin/rt
stdout:
------------------------------------------
View gist:7c47fe9f64c74dc5ce8c
running 1920 tests
fatal runtime error: Could not unwind stack, error = 5
/bin/sh: line 1: 65851 Illegal instruction: 4 DYLD_LIBRARY_PATH=/Users/m4rw3r/Projects/Clones/rust/x86_64-apple-darwin/stage1/lib:$DYLD_LIBRARY_PATH x86_64-apple-darwin/stage1/bin/compiletest --compile-lib-path x86_64-apple-darwin/stage1/lib --run-lib-path x86_64-apple-darwin/stage1/lib/rustlib/x86_64-apple-darwin/lib --rustc-path x86_64-apple-darwin/stage1/bin/rustc --rustdoc-path x86_64-apple-darwin/stage1/bin/rustdoc --llvm-bin-path /Users/m4rw3r/Projects/Clones/rust/x86_64-apple-darwin/llvm/Release/bin --aux-base /Users/m4rw3r/Projects/Clones/rust/src/test/auxiliary/ --stage-id stage1-x86_64-apple-darwin --target x86_64-apple-darwin --host x86_64-apple-darwin --python "/opt/local/bin/python2.7" --gdb-version="GNU gdb (GDB) 7.9.1" --lldb-version="lldb-330.0.48" --android-cross-path=/opt/ndk_standalone --adb-path= --adb-test-dir= --host-rustcflags " --cfg rtopt -O -L x86_64-apple-darwin/rt" --lldb-python-dir=/Applications/Xcode.ap
View rustc.diff
diff --git a/src/librustc/middle/infer/mod.rs b/src/librustc/middle/infer/mod.rs
index b752e04..ad8d197 100644
--- a/src/librustc/middle/infer/mod.rs
+++ b/src/librustc/middle/infer/mod.rs
@@ -484,6 +484,7 @@ pub fn normalize_associated_type<'a, 'tcx, T>(infcx: &InferCtxt<'a,'tcx>, value:
where T : TypeFoldable<'tcx> + HasTypeFlags
{
debug!("normalize_associated_type(t={:?})", value);
+ debug!("normalize_associated_types(infcx.deanonymize={:?})", infcx.deanonymize);
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::
@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
@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
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
You can’t perform that action at this time.