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

ICE "attempting to document proc-macro re-export" #52129

Closed
Bobo1239 opened this issue Jul 7, 2018 · 3 comments
Closed

ICE "attempting to document proc-macro re-export" #52129

Bobo1239 opened this issue Jul 7, 2018 · 3 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@Bobo1239
Copy link
Contributor

Bobo1239 commented Jul 7, 2018

Running cargo doc on synstructure 0.6.1 (which is transitively depended on by the latest failure_derive release) fails with an ICE.
Repro:

git clone git@github.com:mystor/synstructure
cd synstructure
git checkout 41cd679439568ecd32acd46569ad89c36239af86
cargo doc
thread '<unnamed>' panicked at 'attempting to document proc-macro re-export', librustdoc/clean/inline.rs:474:39
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: internal compiler error: unexpected panic
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
note: rustc 1.29.0-nightly (e06c87544 2018-07-06) running on x86_64-unknown-linux-gnu
error: Could not document `synstructure`.
Caused by:
  process didn't exit successfully: `rustdoc --crate-name synstructure src/lib.rs -o /home/bobo1239/Development/Rust/synstructure/target/doc -L dependency=/home/bobo1239/Development/Rust/synstructure/target/debug/deps --extern quote=/home/bobo1239/Development/Rust/synstructure/target/debug/deps/libquote-60e72af659eb759e.rmeta --extern syn=/home/bobo1239/Development/Rust/synstructure/target/debug/deps/libsyn-8c0b65e753b5dc70.rmeta` (exit code: 101)

Meta

rustc --version --verbose:

rustc 1.29.0-nightly (e06c87544 2018-07-06)
binary: rustc
commit-hash: e06c875442e91cc2c597135d1e807a69e73eee26
commit-date: 2018-07-06
host: x86_64-unknown-linux-gnu
release: 1.29.0-nightly
LLVM version: 6.0

Backtrace:

thread '<unnamed>' panicked at 'attempting to document proc-macro re-export', librustdoc/clean/inline.rs:474:39
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:475
   5: std::panicking::begin_panic
             at /checkout/src/libstd/panicking.rs:409
   6: rustdoc::clean::inline::try_inline
             at librustdoc/clean/inline.rs:474
             at librustdoc/clean/inline.rs:107
   7: rustdoc::clean::inline::build_module::fill_in
             at librustdoc/clean/inline.rs:442
   8: <rustdoc::doctree::Import as rustdoc::clean::Clean<alloc::vec::Vec<rustdoc::clean::Item>>>::clean
             at librustdoc/clean/inline.rs:427
             at librustdoc/clean/inline.rs:134
             at librustdoc/clean/mod.rs:3938
   9: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::spec_extend
             at librustdoc/clean/mod.rs:590
             at /checkout/src/libcore/ops/function.rs:271
             at /checkout/src/libcore/option.rs:414
             at /checkout/src/libcore/iter/mod.rs:1392
             at /checkout/src/libcore/iter/mod.rs:2684
             at /checkout/src/libcore/iter/mod.rs:2521
             at /checkout/src/liballoc/vec.rs:1963
             at /checkout/src/liballoc/vec.rs:1860
  10: <rustdoc::doctree::Module as rustdoc::clean::Clean<rustdoc::clean::Item>>::clean
             at /checkout/src/liballoc/vec.rs:1824
             at librustdoc/clean/mod.rs:590
  11: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::spec_extend
             at librustdoc/clean/mod.rs:596
             at /checkout/src/libcore/ops/function.rs:271
             at /checkout/src/libcore/option.rs:414
             at /checkout/src/libcore/iter/mod.rs:1392
             at /checkout/src/liballoc/vec.rs:1886
  12: <rustdoc::doctree::Module as rustdoc::clean::Clean<rustdoc::clean::Item>>::clean
             at /checkout/src/liballoc/vec.rs:1824
             at librustdoc/clean/mod.rs:596
  13: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::spec_extend
             at librustdoc/clean/mod.rs:596
             at /checkout/src/libcore/ops/function.rs:271
             at /checkout/src/libcore/option.rs:414
             at /checkout/src/libcore/iter/mod.rs:1392
             at /checkout/src/liballoc/vec.rs:1886
  14: <rustdoc::doctree::Module as rustdoc::clean::Clean<rustdoc::clean::Item>>::clean
             at /checkout/src/liballoc/vec.rs:1824
             at librustdoc/clean/mod.rs:596
  15: <rustdoc::visit_ast::RustdocVisitor<'a, 'tcx, 'rcx> as rustdoc::clean::Clean<rustdoc::clean::Crate>>::clean
             at librustdoc/clean/mod.rs:167
  16: rustdoc::core::run_core::{{closure}}::{{closure}}
             at librustdoc/core.rs:363
  17: rustc::ty::context::tls::enter_context
             at /checkout/src/librustc_driver/driver.rs:1315
             at /checkout/src/librustc/ty/context.rs:1862
             at /checkout/src/librustc/ty/context.rs:1830
             at /checkout/src/librustc/ty/context.rs:1769
             at /checkout/src/librustc/ty/context.rs:1829
  18: <std::thread::local::LocalKey<T>>::with
             at /checkout/src/librustc/ty/context.rs:1861
             at /checkout/src/librustc/ty/context.rs:1819
             at /checkout/src/libstd/thread/local.rs:294
             at /checkout/src/libstd/thread/local.rs:248
             at /checkout/src/librustc/ty/context.rs:1811
             at /checkout/src/libstd/thread/local.rs:294
             at /checkout/src/libstd/thread/local.rs:248
  19: rustc::ty::context::TyCtxt::create_and_enter
             at /checkout/src/librustc/ty/context.rs:1803
             at /checkout/src/librustc/ty/context.rs:1841
             at /checkout/src/librustc/ty/context.rs:1186
  20: rustc_driver::driver::phase_3_run_analysis_passes
             at /checkout/src/librustc_driver/driver.rs:1227
  21: <scoped_tls::ScopedKey<T>>::set
             at librustdoc/core.rs:308
             at /checkout/src/librustc_driver/driver.rs:73
             at /cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-0.1.2/src/lib.rs:155
  22: rustdoc::core::run_core
             at /checkout/src/librustc_driver/driver.rs:72
             at librustdoc/core.rs:236
  23: <scoped_tls::ScopedKey<T>>::set
             at librustdoc/lib.rs:674
             at /cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-0.1.2/src/lib.rs:155
             at /checkout/src/libsyntax/lib.rs:98
             at /cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-0.1.2/src/lib.rs:155
  24: syntax::with_globals
             at /checkout/src/libsyntax/lib.rs:97
  25: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at librustdoc/lib.rs:670
             at /checkout/src/librustc_driver/lib.rs:1613
             at /checkout/src/libstd/panic.rs:313
  26: std::panicking::try::do_call
             at /checkout/src/libstd/panicking.rs:310
  27: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  28: rustc_driver::monitor
             at /checkout/src/libstd/panicking.rs:289
             at /checkout/src/libstd/panic.rs:392
             at /checkout/src/librustc_driver/lib.rs:1545
             at /checkout/src/librustc_driver/lib.rs:1612
  29: rustdoc::rust_input
             at librustdoc/lib.rs:670
  30: rustdoc::main_args
             at librustdoc/lib.rs:590
             at librustdoc/lib.rs:545
  31: <scoped_tls::ScopedKey<T>>::set
             at librustdoc/lib.rs:116
             at /checkout/src/libcore/option.rs:414
             at librustdoc/lib.rs:116
             at /cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-0.1.2/src/lib.rs:155
             at /checkout/src/libsyntax/lib.rs:98
             at /cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-0.1.2/src/lib.rs:155
  32: syntax::with_globals
             at /checkout/src/libsyntax/lib.rs:97
  33: std::panicking::try::do_call
             at /checkout/src/libstd/thread/mod.rs:409
             at /checkout/src/libstd/panic.rs:313
             at /checkout/src/libstd/panicking.rs:310
  34: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  35: <F as alloc::boxed::FnBox<A>>::call_box
             at /checkout/src/libstd/panicking.rs:289
             at /checkout/src/libstd/panic.rs:392
             at /checkout/src/libstd/thread/mod.rs:408
             at /checkout/src/liballoc/boxed.rs:640
  36: std::sys_common::thread::start_thread
             at /checkout/src/liballoc/boxed.rs:650
             at libstd/sys_common/thread.rs:24
  37: std::sys::unix::thread::Thread::new::thread_start
             at libstd/sys/unix/thread.rs:90
  38: start_thread
  39: clone
@stokhos stokhos added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jul 7, 2018
@ollie27
Copy link
Member

ollie27 commented Jul 8, 2018

This was caused by #51611. It used to be a silent failure but was changed into an ICE. cc. @QuietMisdreavus

@KamilaBorowska
Copy link
Contributor

@QuietMisdreavus
Copy link
Member

Minimal reproduction:

extern crate proc_macro;

pub use proc_macro::*;

...although it depends on quote!() being both a bang macro and a proc-macro. I have a patch ready to ignore this, but i dunno how to reduce it to a test that doesn't depend on libproc_macro's quote!().

bors added a commit that referenced this issue Jul 15, 2018
rustdoc: don't panic when the cross-re-export handler sees a proc-macro

When i moved the macro cross-re-export inlining code into `clean::inline`, i thought that if a macro had a `Def` that said it was a bang macro, it wouldn't be a proc macro. I thought wrong. Turns out, the `quote!()` in `libproc_macro` is actually a proc-macro, and when the `quote!()` macro is re-exported, this proc-macro is accessed in its place. This causes any `proc_macro::*` glob re-export to pull in this proc-macro, causing the assertion i added to fire, leading to an ICE. This replaces that with an Option that ignores proc-macros for the time being.

Fixes #52129
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

5 participants