Skip to content
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

Procedural macro error #37844

Closed
gsquire opened this issue Nov 17, 2016 · 6 comments
Closed

Procedural macro error #37844

gsquire opened this issue Nov 17, 2016 · 6 comments

Comments

@gsquire
Copy link
Contributor

gsquire commented Nov 17, 2016

While trying to test out a simple function for the reqwest module, I found an odd error when trying to derive serde's Deserialize trait on a custom type.

Sample code (please see comment below on how to run):

#![feature(proc_macro)]
extern crate reqwest;

#[macro_use]
extern crate serde_derive;

#[derive(Debug, Deserialize)]
struct Something {
    Origin: String,
}

fn main() {
    let mut res = reqwest::get("https://httpbin.org/ip").unwrap();

    println!("JSON: {:?}", res.json::<Something>());
}

Meta:

rustc 1.15.0-nightly (0ed951993 2016-11-14)
binary: rustc
commit-hash: 0ed951993fb5721a303ca5fa743543dd9f3f6b10
commit-date: 2016-11-14
host: x86_64-apple-darwin
release: 1.15.0-nightly
LLVM version: 3.9

Backtrace:

thread 'rustc' panicked at 'Box<Any>', ../src/librustc_errors/lib.rs:424
stack backtrace:
   1:        0x10d3534ea - std::sys::imp::backtrace::tracing::imp::write::h944c02ac40aee2d7
   2:        0x10d36077f - std::panicking::default_hook::{{closure}}::h6875a2976258b020
   3:        0x10d36032d - std::panicking::default_hook::h88ffbc5922643264
   4:        0x10d360c46 - std::panicking::rust_panic_with_hook::ha5aed1dfc0e220e3
   5:        0x10aaddf2a - std::panicking::begin_panic::h264cdc75d51b518b
   6:        0x10aaeed34 - rustc_errors::Handler::bug::h620f7270292f0095
   7:        0x109e54ecc - rustc::session::opt_span_bug_fmt::{{closure}}::h4a9b70c3df8b4b3a
   8:        0x109e54cd9 - rustc::session::opt_span_bug_fmt::h7d83586c6e2c7ae6
   9:        0x109e5485a - rustc::session::bug_fmt::he2d2f00a4afa9d1e
  10:        0x109389b73 - rustc_metadata::decoder::<impl rustc_metadata::cstore::CrateMetadata>::entry::h5e3d8114267e9116
  11:        0x1093924ab - rustc_metadata::cstore_impl::<impl rustc::middle::cstore::CrateStore<'tcx> for rustc_metadata::cstore::CStore>::visibility::h2949b511f18961ee
  12:        0x10939af66 - rustc_metadata::cstore_impl::<impl rustc::middle::cstore::CrateStore<'tcx> for rustc_metadata::cstore::CStore>::visible_parent_map::hab53861eb74bce8d
  13:        0x109e9e1c4 - rustc::ty::item_path::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::push_item_path::haa7f7a9afda5f72a
  14:        0x109eea2d5 - rustc::util::ppaux::parameterized::h7bcfb1fd3d8a947a
  15:        0x10d3a4cb5 - core::fmt::write::h01739b8f12f355f9
  16:        0x109e86c4c - rustc::traits::specialize::specialization_graph::Graph::insert::h62250bf0632d4218
  17:        0x109ebad12 - rustc::ty::trait_def::TraitDef::add_impl_for_specialization::h39896639aba068c7
  18:        0x109183b67 - <rustc_typeck::coherence::overlap::OverlapChecker<'cx, 'tcx> as rustc::hir::intravisit::Visitor<'v>>::visit_item::h5ba64bfdace3da91
  19:        0x10918caab - rustc_typeck::coherence::check_coherence::h7b433ad2f4520d1a
  20:        0x1091936a1 - rustc_typeck::check_crate::h4045752b69a796e8
  21:        0x108c301ac - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::h97a3a12d948df547
  22:        0x108c2d37d - rustc_driver::driver::phase_3_run_analysis_passes::hb0ad9de18d423e67
  23:        0x108c14bc5 - rustc_driver::driver::compile_input::h8e119234b60571d5
  24:        0x108c5a229 - rustc_driver::run_compiler::hbdfc4f84e2e0f4b9
  25:        0x108b79988 - std::panicking::try::do_call::hf679f17bf3b43b0b
  26:        0x10d3631fa - __rust_maybe_catch_panic
  27:        0x108b9daaf - <F as alloc::boxed::FnBox<A>>::call_box::h506fb5d7b8891cd4
  28:        0x10d35f8d4 - std::sys::imp::thread::Thread::new::thread_start::h8084b1107992ae5b
  29:     0x7fff9185299c - _pthread_body
  30:     0x7fff91852919 - _pthread_start

error: Could not compile `reqwest`.

In order to run the example you will need to apply this patch I have been working on in order to add a helper function for reqwest. It can be found here. The base commit is seanmonstar/reqwest@6967f92

@keeperofdakeys
Copy link
Contributor

keeperofdakeys commented Nov 18, 2016

This is probably similar to #37788, which should be fixed in the next nightly.

@gsquire
Copy link
Contributor Author

gsquire commented Nov 18, 2016

Hmm, I am still seeing the error with this nightly version:

rustc 1.15.0-nightly (ba872f270 2016-11-17)
binary: rustc
commit-hash: ba872f270781ada15426cfac7db20b30b81777dc
commit-date: 2016-11-17
host: x86_64-apple-darwin
release: 1.15.0-nightly
LLVM version: 3.9

Perhaps the patch is going to be in the upcoming nightly?

@keeperofdakeys
Copy link
Contributor

Running this myself, I get the same error message as the issue I linked.

error: internal compiler error: ../src/librustc_metadata/decoder.rs:490: entry: id not found: DefIndex(1) in crate "serde_derive" with number 44

It also looks like the latest nightly failed, so keep an eye out until the next one is released.

@gsquire
Copy link
Contributor Author

gsquire commented Nov 18, 2016

@keeperofdakeys Thanks for following up. I will close this ticket when things settle with the issue.

@zimurgh
Copy link

zimurgh commented Nov 19, 2016

Hi, I'm having this problem too. Is there a way to track when the next nightly release will be? Or is there a previous nightly version that one can override to in order to temporarily avoid this bug?

@keeperofdakeys
Copy link
Contributor

The latest nightly appears to fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants