Skip to content

incr. comp.: Attribute errors when compiling crate with serde_derive. #39636

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
belgum opened this issue Feb 8, 2017 · 5 comments
Closed

incr. comp.: Attribute errors when compiling crate with serde_derive. #39636

belgum opened this issue Feb 8, 2017 · 5 comments
Labels
A-incr-comp Area: Incremental compilation I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@belgum
Copy link

belgum commented Feb 8, 2017

I'm running into an issue with incremental compilation where compiling the below code and then compiling it again with the #[serde(tag = "variant")] tag removed causes an ICE (it also fails if the steps are reversed i.e. compile first without and then with the attribute).

extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;

#[derive(Deserialize)]
#[serde(tag = "variant")] // if this attribute is added or removed after an incr comp build it causes an ICE
enum A {
    A1 { x: usize },
}

fn main() {
    // The below line also seems necessary to trigger the ICE
    let a: A = serde_json::from_str("").unwrap();
}

And the backtrace from the compiler:

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libcore/option.rs:323
stack backtrace:
   1:        0x10fa145ec - std::sys::imp::backtrace::tracing::imp::write::hf587afb8e94ad165
   2:        0x10fa2104e - std::panicking::default_hook::{{closure}}::haf3443cb412055ce
   3:        0x10fa20bf3 - std::panicking::default_hook::h742f925bfab3bbfa
   4:        0x10fa21507 - std::panicking::rust_panic_with_hook::h6f06ff8d28a94df6
   5:        0x10fa213b4 - std::panicking::begin_panic::h7b9167ba3324cfae
   6:        0x10fa212d2 - std::panicking::begin_panic_fmt::hb5f8f1fe0fe23e28
   7:        0x10fa21237 - rust_begin_unwind
   8:        0x10fa5ee40 - core::panicking::panic_fmt::he6eb92dab4407c61
   9:        0x10fa5ed44 - core::panicking::panic::h16db271caf2c9025
  10:        0x10aeba3e1 - rustc_incremental::persist::load::decode_dep_graph::hd9a1e8a507634d7f
  11:        0x10aeb0c8f - rustc_incremental::persist::load::load_dep_graph::h5f726d61d7f24d69
  12:        0x10aa1301a - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::h46c275184428de94
  13:        0x10aa065da - rustc_driver::driver::phase_3_run_analysis_passes::h9f46d8470c4871d9
  14:        0x10a9f5ba0 - rustc_driver::driver::compile_input::h550b23c65a0bc968
  15:        0x10aa3d24e - rustc_driver::run_compiler::h65867e99dfb91e54
  16:        0x10a9550d8 - std::panicking::try::do_call::hdfa57184047b194c
  17:        0x10fa2411a - __rust_maybe_catch_panic
  18:        0x10a97db33 - <F as alloc::boxed::FnBox<A>>::call_box::h7af5270adbc74627
  19:        0x10fa20174 - std::sys::imp::thread::Thread::new::thread_start::h4ad0b40513420e9c
  20:     0x7fff89ee799c - _pthread_body
  21:     0x7fff89ee7919 - _pthread_start

I'm running rustc 1.17.0-nightly (c49d10207 2017-02-07) and cargo-0.18.0-nightly (de2919f 2017-02-06) on OS X 10.11.6

@sfackler sfackler added A-incr-comp Area: Incremental compilation I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Feb 8, 2017
@michaelwoerister
Copy link
Member

Might be the same root cause as in #39569.
cc @nikomatsakis

@keeperofdakeys
Copy link
Contributor

Just to make things clear, does this happen when incremental compilation is not enabled?

@belgum
Copy link
Author

belgum commented Feb 8, 2017

No, it only happens when when incremental compilation is enabled.

@nikomatsakis
Copy link
Contributor

@belgum I think this was fixed, can you verify?

@Mark-Simulacrum
Copy link
Member

I'm going to close pending verification; if @belgum can check today and confirms as not fixed, we will reopen.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-incr-comp Area: Incremental compilation I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

6 participants