Skip to content

Instantly share code, notes, and snippets.

@durka
Created April 12, 2018 01:55
Show Gist options
  • Save durka/112563168498b5a0896713146d75d262 to your computer and use it in GitHub Desktop.
Save durka/112563168498b5a0896713146d75d262 to your computer and use it in GitHub Desktop.
$ RUST_BACKTRACE=1 cargo script --debug -D quote -e 'extern crate proc_macro; proc_macro::TokenStream::from(quote!(1 + 1))'
Updating registry `https://github.com/rust-lang/crates.io-index`
Compiling expr v0.1.0 (file:///Users/alex/.cargo/script-cache/expr-c9c44fbc071235a7)
Finished dev [unoptimized + debuginfo] target(s) in 3.97 secs
thread 'main' panicked at 'proc_macro::__internal::with_sess() called before set_parse_sess()!', libproc_macro/lib.rs:898:9
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
1: std::sys_common::backtrace::print
2: std::panicking::default_hook::{{closure}}
3: std::panicking::default_hook
4: std::panicking::rust_panic_with_hook
5: std::panicking::begin_panic
6: proc_macro::__internal::with_sess
7: <proc_macro::TokenStream as core::str::FromStr>::from_str
8: <str as core::str::StrExt>::parse
at /Users/travis/build/rust-lang/rust/src/libcore/str/mod.rs:2534
9: alloc::str::<impl str>::parse
at /Users/travis/build/rust-lang/rust/src/liballoc/str.rs:1798
10: <core::cell::RefMut<'b, T> as core::ops::deref::DerefMut>::deref_mut
at ./.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.3.6/src/stable.rs:127
11: <T as core::convert::Into<U>>::into
at /Users/travis/build/rust-lang/rust/src/libcore/convert.rs:400
12: <core::cell::RefMut<'b, T> as core::ops::deref::DerefMut>::deref_mut
at ./.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-0.3.6/src/lib.rs:103
13: <T as core::convert::Into<U>>::into
at /Users/travis/build/rust-lang/rust/src/libcore/convert.rs:400
14: <core::marker::PhantomData<T> as core::clone::Clone>::clone
at ./.cargo/registry/src/github.com-1ecc6299db9ec823/quote-0.5.1/src/tokens.rs:115
15: expr::try_main
at ./.cargo/script-cache/expr-c9c44fbc071235a7/expr.rs:19
16: expr::main
at ./.cargo/script-cache/expr-c9c44fbc071235a7/expr.rs:5
17: std::rt::lang_start::{{closure}}
at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74
18: std::panicking::try::do_call
19: __rust_maybe_catch_panic
20: std::rt::lang_start_internal
21: std::rt::lang_start
at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74
22: expr::try_main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment