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

rustdoc ICE #48463

Closed
GuillaumeGomez opened this issue Feb 23, 2018 · 5 comments
Closed

rustdoc ICE #48463

GuillaumeGomez opened this issue Feb 23, 2018 · 5 comments
Assignees
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@GuillaumeGomez
Copy link
Member

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:335:21
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.25.0-nightly (b1f8e6fb0 2018-02-22) running on x86_64-unknown-linux-gnu
error: Could not document `glib`.

I'll check where we use an unwrap.

@GuillaumeGomez GuillaumeGomez added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-dev-tools-rustdoc labels Feb 23, 2018
@GuillaumeGomez GuillaumeGomez self-assigned this Feb 23, 2018
@GuillaumeGomez
Copy link
Member Author

More information:

 Documenting glib v0.4.1 (file:///D:/eap/rust/0/glib)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', libcore\option.rs:335:21
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: mingw_set_invalid_parameter_handler
   1: mingw_set_invalid_parameter_handler
   2: mingw_set_invalid_parameter_handler
   3: mingw_set_invalid_parameter_handler
   4: mingw_set_invalid_parameter_handler
   5: mingw_set_invalid_parameter_handler
   6: mingw_set_invalid_parameter_handler
   7: mingw_set_invalid_parameter_handler
   8: mingw_set_invalid_parameter_handler
   9: mingw_set_invalid_parameter_handler
  10: mingw_set_invalid_parameter_handler
  11: mingw_set_invalid_parameter_handler
  12: mingw_set_invalid_parameter_handler
  13: mingw_set_invalid_parameter_handler
  14: mingw_set_invalid_parameter_handler
  15: rustdoc::clean::get_auto_traits_with_def_id
             at librustdoc\clean/auto_trait.rs:21
             at librustdoc\clean/mod.rs:3372
  16: rustdoc::clean::inline::build_impls
             at librustdoc\clean/inline.rs:246
  17: rustdoc::clean::build_deref_target_impls
             at librustdoc\clean/mod.rs:3431
  18: <rustdoc::doctree::Impl as rustdoc::clean::Clean<alloc::vec::Vec<rustdoc::clean::Item>>>::clean
             at librustdoc\clean/mod.rs:3384
  19: <rustdoc::doctree::Module as rustdoc::clean::Clean<rustdoc::clean::Item>>::clean
             at librustdoc\clean/mod.rs:541
             at C:\projects\rust\src\libcore\ops/function.rs:271
             at C:\projects\rust\src\libcore/option.rs:404
             at C:\projects\rust\src\libcore\iter/mod.rs:2448
             at C:\projects\rust\src\liballoc/vec.rs:1906
             at C:\projects\rust\src\liballoc/vec.rs:1803
             at C:\projects\rust\src\liballoc/vec.rs:1767
             at librustdoc\clean/mod.rs:541
  20: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::spec_extend
             at librustdoc\clean/mod.rs:536
             at C:\projects\rust\src\libcore\ops/function.rs:271
             at C:\projects\rust\src\libcore/option.rs:404
             at C:\projects\rust\src\libcore\iter/mod.rs:1311
             at C:\projects\rust\src\liballoc/vec.rs:1829
  21: <rustdoc::doctree::Module as rustdoc::clean::Clean<rustdoc::clean::Item>>::clean
             at C:\projects\rust\src\liballoc/vec.rs:1767
             at librustdoc\clean/mod.rs:536
  22: <rustdoc::visit_ast::RustdocVisitor<'a, 'tcx, 'rcx> as rustdoc::clean::Clean<rustdoc::clean::Crate>>::clean
             at librustdoc\clean/mod.rs:166
  23: rustdoc::core::run_core::{{closure}}
             at librustdoc/core.rs:270
  24: rustc::ty::context::TyCtxt::create_and_enter
             at C:\projects\rust\src\librustc_driver/driver.rs:1094
             at C:\projects\rust\src\librustc\ty/context.rs:1573
             at C:\projects\rust\src\libstd\thread/local.rs:377
             at C:\projects\rust\src\libstd\thread/local.rs:288
             at C:\projects\rust\src\librustc\ty/context.rs:1570
             at C:\projects\rust\src\librustc\ty/context.rs:1557
             at C:\projects\rust\src\libstd\thread/local.rs:377
             at C:\projects\rust\src\libstd\thread/local.rs:288
             at C:\projects\rust\src\librustc\ty/context.rs:1554
             at C:\projects\rust\src\librustc\ty/context.rs:1197
  25: rustdoc::core::run_core
             at C:\projects\rust\src\librustc_driver/driver.rs:1007
             at librustdoc/core.rs:217

error: internal compiler error: unexpected panic

@QuietMisdreavus
Copy link
Member

Reproduction:

use std::any::Any;
use std::ops::Deref;

pub struct AnyValue {
    val: Box<Any>,
}

impl Deref for AnyValue {
    type Target = Any;

    fn deref(&self) -> &Any {
        &*self.val
    }
}

@Aaron1011
Copy link
Member

I'd like to work on this (especially because it seems to be related to my PR.

@QuietMisdreavus
Copy link
Member

@Aaron1011 Are you on IRC? @GuillaumeGomez and i are discussing this in #rust-docs right now.

@QuietMisdreavus
Copy link
Member

Looks like we narrowed it down:

ResolvedPath { did, .. } => {
ret.extend(inline::build_impls(cx, did, true));
continue
}

When building up a Deref impl, it also pulls in methods for the trait. But here it's also asking to pull in the auto-trait impls as well. This fails here because it's trying to ask the compiler for the type of a trait, which is invalid, hence the ICE. However, auto-trait impls don't propagate through Deref anyway, so this can be bypassed entirely by changing that true to false to skip asking for auto-traits.

kennytm added a commit to kennytm/rust that referenced this issue Feb 27, 2018
…mpl-fix, r=QuietMisdreavus

Fix auto trait impl rustdoc ice

Fixes rust-lang#48463.

r? @QuietMisdreavus
kennytm added a commit to kennytm/rust that referenced this issue Feb 28, 2018
…mpl-fix, r=QuietMisdreavus

Fix auto trait impl rustdoc ice

Fixes rust-lang#48463.

r? @QuietMisdreavus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants