Closed
Description
The problem
I'm hitting a panic from an assertion when attempting to document a library with a nested impl trait in argument position. In the repro the method a
hits the assertion and panics, whereas b
passes and documents successfully.
Output
$ cargo doc --no-deps
Documenting doc-impl-trait-repro v0.1.0 (file:///Users/user/dev/doc-impl-trait-repro)
thread '<unnamed>' panicked at 'assertion failed: cx.impl_trait_bounds.borrow().is_empty()', librustdoc/clean/mod.rs:4050:5
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: rustdoc::clean::enter_impl_trait
7: <rustc::hir::ImplItem as rustdoc::clean::Clean<rustdoc::clean::Item>>::clean
8: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter
9: <rustdoc::doctree::Impl as rustdoc::clean::Clean<alloc::vec::Vec<rustdoc::clean::Item>>>::clean
10: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::spec_extend
11: <rustdoc::doctree::Module as rustdoc::clean::Clean<rustdoc::clean::Item>>::clean
12: <rustdoc::visit_ast::RustdocVisitor<'a, 'tcx, 'rcx> as rustdoc::clean::Clean<rustdoc::clean::Crate>>::clean
13: rustdoc::core::run_core::{{closure}}
14: rustc::ty::context::tls::enter_global
15: rustc::ty::context::TyCtxt::create_and_enter
16: rustc_driver::driver::phase_3_run_analysis_passes
17: rustdoc::core::run_core
18: <scoped_tls::ScopedKey<T>>::set
19: syntax::with_globals
20: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
21: std::panicking::try::do_call
22: __rust_maybe_catch_panic
23: rustc_driver::monitor
24: rustdoc::rust_input
25: rustdoc::main_args
26: <scoped_tls::ScopedKey<T>>::set
27: syntax::with_globals
28: std::panicking::try::do_call
29: __rust_maybe_catch_panic
30: <F as alloc::boxed::FnBox<A>>::call_box
31: std::sys_common::thread::start_thread
32: std::sys::unix::thread::Thread::new::thread_start
33: _pthread_body
34: _pthread_start
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.27.0-nightly (79252ff4e 2018-04-29) running on x86_64-apple-darwin
error: Could not document `doc-impl-trait-repro`.
Caused by:
process didn't exit successfully: `rustdoc --crate-name doc_impl_trait_repro src/lib.rs -o /Users/user/dev/doc-impl-trait-repro/target/doc -L dependency=/Users/user/dev/doc-impl-trait-repro/target/debug/deps` (exit code: 101)
Repro
use std::io::Read;
struct D<R>(R);
struct A;
impl A {
// thread '<unnamed>' panicked at 'assertion failed: cx.impl_trait_bounds.borrow().is_empty()', librustdoc/clean/mod.rs:4050:5
fn a(&self, d: impl IntoIterator<Item = D<impl Read>>) -> Result<(), ()> { unimplemented!() }
// ok
fn b(&self, d: impl IntoIterator<Item = D<()>>) -> Result<(), ()> { unimplemented!() }
}
Meta
rustc 1.27.0-nightly (79252ff4e 2018-04-29)
binary: rustc
commit-hash: 79252ff4e25d82f9fe856cb66f127b79cdace163
commit-date: 2018-04-29
host: x86_64-apple-darwin
release: 1.27.0-nightly
LLVM version: 6.0