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 when using rustdoc-scrape-examples on example that uses proc macros #94926

Closed
AaronErhardt opened this issue Mar 14, 2022 · 5 comments
Closed
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@AaronErhardt
Copy link

Code

Use the "next" branch at Relm4: https://github.com/AaronErhardt/Relm4/tree/next

Reproduce:

# Install GTK4
# Clone repo and checkout "next"
cargo +nightly doc -Z rustdoc-scrape-examples=examples

Doesn't panic without -Z rustdoc-scrape-examples=examples.

I assume it is caused by a proc-macro because all other examples that don't use the #[component] macro seem to be scraped just fine.

Meta

rustc 1.61.0-nightly (e95b10ba4 2022-03-13)
binary: rustc
commit-hash: e95b10ba4ac4564ed25f7eef143e3182c33b3902
commit-date: 2022-03-13
host: x86_64-unknown-linux-gnu
release: 1.61.0-nightly
LLVM version: 14.0.0

Error output

thread 'rustc' panicked at 'Attempted to scrape call at [examples/simple.rs:25:9: 25:12 (#0)] whose enclosing item [examples/simple.rs:58:5: 70:6 (#0)] doesn't contain the span of the call.', src/librustdoc/scrape_examples.rs:190:9

If I read the code in librustdoc correctly, the code should have been rejected in the first place because it comes from a proc-macro, yet it wasn't and then the assertion failed.

Please contact me if you need more details.

Backtrace

stack backtrace:
   0:     0x7f4c5db019dd - std::backtrace_rs::backtrace::libunwind::trace::h7c06355936cefbfa
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f4c5db019dd - std::backtrace_rs::backtrace::trace_unsynchronized::h0d29350836df727e
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f4c5db019dd - std::sys_common::backtrace::_print_fmt::h7cc76caea8ef80df
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f4c5db019dd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h41dad21719ef8ab8
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f4c5db5b4bc - core::fmt::write::h6c4cfebe9aad777b
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/core/src/fmt/mod.rs:1190:17
   5:     0x7f4c5daf2f61 - std::io::Write::write_fmt::h01de082d65b0a1fb
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/std/src/io/mod.rs:1655:15
   6:     0x7f4c5db04a55 - std::sys_common::backtrace::_print::hcd7176b4e129c3a4
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f4c5db04a55 - std::sys_common::backtrace::print::h710200ae52dbc495
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f4c5db04a55 - std::panicking::default_hook::{{closure}}::ha61678fe9bc854f8
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/std/src/panicking.rs:295:22
   9:     0x7f4c5db04709 - std::panicking::default_hook::h583260a485b0ad61
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/std/src/panicking.rs:314:9
  10:     0x7f4c5e29d481 - rustc_driver[3f779205835928cf]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f4c48184983 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hf32585b5ab056c83
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/alloc/src/boxed.rs:1867:9
  12:     0x7f4c4813af4c - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}::h0ae4f2c309c0c207
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/proc_macro/src/bridge/client.rs:319:21
  13:     0x7f4c4815b060 - std::panicking::update_hook::{{closure}}::h676036a1507f96c2
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/std/src/panicking.rs:258:41
  14:     0x7f4c5db051a0 - std::panicking::rust_panic_with_hook::h1d1648214bd2ee6f
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/std/src/panicking.rs:702:17
  15:     0x7f4c5db04fd7 - std::panicking::begin_panic_handler::{{closure}}::h17c86375419bb484
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/std/src/panicking.rs:588:13
  16:     0x7f4c5db01e94 - std::sys_common::backtrace::__rust_end_short_backtrace::h1ab814c3b9abd6c1
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/std/src/sys_common/backtrace.rs:138:18
  17:     0x7f4c5db04d09 - rust_begin_unwind
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/std/src/panicking.rs:584:5
  18:     0x7f4c5dac8c93 - core::panicking::panic_fmt::hc535849e7e17b12d
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/core/src/panicking.rs:143:14
  19:     0x55a8b52fb9f8 - <rustdoc[75aab1f421a86b15]::scrape_examples::FindCalls as rustc_hir[2122557a729d443d]::intravisit::Visitor>::visit_expr
  20:     0x55a8b55066aa - rustc_hir[2122557a729d443d]::intravisit::walk_block::<rustdoc[75aab1f421a86b15]::scrape_examples::FindCalls>
  21:     0x55a8b52fa4bc - <rustdoc[75aab1f421a86b15]::scrape_examples::FindCalls as rustc_hir[2122557a729d443d]::intravisit::Visitor>::visit_expr
  22:     0x55a8b550cf95 - rustc_hir[2122557a729d443d]::intravisit::walk_fn::<rustdoc[75aab1f421a86b15]::scrape_examples::FindCalls>
  23:     0x55a8b550794a - rustc_hir[2122557a729d443d]::intravisit::walk_impl_item::<rustdoc[75aab1f421a86b15]::scrape_examples::FindCalls>
  24:     0x55a8b534850f - <rustc_middle[89dca5d1ec46bdf7]::hir::map::Map>::visit_all_item_likes::<rustc_hir[2122557a729d443d]::intravisit::DeepVisitor<rustdoc[75aab1f421a86b15]::scrape_examples::FindCalls>>
  25:     0x55a8b52fc65a - rustdoc[75aab1f421a86b15]::scrape_examples::run
  26:     0x55a8b5583f33 - <rustc_interface[99b5955ea177eda3]::passes::QueryContext>::enter::<rustdoc[75aab1f421a86b15]::main_options::{closure#0}::{closure#0}::{closure#1}, core[f6020851bfb369c]::result::Result<(), rustc_errors[3e8a3ffb3213487a]::ErrorGuaranteed>>
  27:     0x55a8b54b4ffb - rustc_interface[99b5955ea177eda3]::interface::create_compiler_and_run::<core[f6020851bfb369c]::result::Result<(), rustc_errors[3e8a3ffb3213487a]::ErrorGuaranteed>, rustdoc[75aab1f421a86b15]::main_options::{closure#0}>
  28:     0x55a8b5302e7d - rustdoc[75aab1f421a86b15]::main_options
  29:     0x55a8b540844b - <scoped_tls[8d179c61f4b3d0c1]::ScopedKey<rustc_span[90a733eefa3cc57d]::SessionGlobals>>::set::<rustdoc[75aab1f421a86b15]::main_args::{closure#0}, core[f6020851bfb369c]::result::Result<(), rustc_errors[3e8a3ffb3213487a]::ErrorGuaranteed>>
  30:     0x55a8b545ee9f - std[e601d6bf1b4d13f5]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[99b5955ea177eda3]::util::run_in_thread_pool_with_globals<rustdoc[75aab1f421a86b15]::main_args::{closure#0}, core[f6020851bfb369c]::result::Result<(), rustc_errors[3e8a3ffb3213487a]::ErrorGuaranteed>>::{closure#0}, core[f6020851bfb369c]::result::Result<(), rustc_errors[3e8a3ffb3213487a]::ErrorGuaranteed>>
  31:     0x55a8b55552f9 - <<std[e601d6bf1b4d13f5]::thread::Builder>::spawn_unchecked_<rustc_interface[99b5955ea177eda3]::util::run_in_thread_pool_with_globals<rustdoc[75aab1f421a86b15]::main_args::{closure#0}, core[f6020851bfb369c]::result::Result<(), rustc_errors[3e8a3ffb3213487a]::ErrorGuaranteed>>::{closure#0}, core[f6020851bfb369c]::result::Result<(), rustc_errors[3e8a3ffb3213487a]::ErrorGuaranteed>>::{closure#1} as core[f6020851bfb369c]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32:     0x7f4c5db0f333 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hab8e95631d63cb7b
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/alloc/src/boxed.rs:1853:9
  33:     0x7f4c5db0f333 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4804fab16a5dbf8e
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/alloc/src/boxed.rs:1853:9
  34:     0x7f4c5db0f333 - std::sys::unix::thread::Thread::new::thread_start::h9d17249987cabc4d
                               at /rustc/f103b2969b0088953873dc1ac92eb3387c753596/library/std/src/sys/unix/thread.rs:108:17
  35:     0x7f4c5d7cdb1a - start_thread
  36:     0x7f4c5d852650 - __clone3
  37:                0x0 - <unknown>

@AaronErhardt AaronErhardt added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 14, 2022
@Urgau
Copy link
Member

Urgau commented Mar 14, 2022

cc @willcrichton

@willcrichton
Copy link
Contributor

Thanks for the report @AaronErhardt. I will take a look and fix this soon.

@willcrichton
Copy link
Contributor

This will get fixed once #93217 lands.

@willcrichton
Copy link
Contributor

#93217 has landed today, so this should be fixed. I can't close this issue, but @AaronErhardt perhaps you can confirm in a few days once the nightly ships to docs.rs.

@AaronErhardt
Copy link
Author

Thanks for the fix, the continuous integration job for Relm4's docs work again (except for for proc-macro crates: rust-lang/cargo#10571)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants