Skip to content

ICE when generating docs #46271

Closed
Closed

Description

@Michael-F-Bryan

On the latest nightly (e97ba83 2017-11-25) there's an ICE when generating the docs for the atty crate. Presumably somewhere along the line internal bookkeeping got confused and an invalid NodeId was generated (or a valid one was deleted), resulting in a panic during the phase 3 analysis passes.

It looks like this is a regression in the latest nightly because it was works just fine on the (5f44c653c 2017-11-24) build.

Minimal Example:

$ cargo new dummy
     Created library `dummy` project
$ cd dummy
$ cargo add atty
$ RUST_BACKTRACE=full cargo doc
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling libc v0.2.33
 Documenting libc v0.2.33
   Compiling atty v0.2.3
 Documenting atty v0.2.3
error: internal compiler error: /checkout/src/librustc/hir/map/mod.rs:298: called HirMap::read() with invalid NodeId

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.23.0-nightly (e97ba8328 2017-11-25) running on x86_64-unknown-linux-gnu

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:501:8
stack backtrace:
   0:     0x7fd1e2817c2b - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h1ce402f4dccb5698
                               at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1:     0x7fd1e280ec0e - std::sys_common::backtrace::print::h55c96f65d7235993
                               at /checkout/src/libstd/sys_common/backtrace.rs:68
                               at /checkout/src/libstd/sys_common/backtrace.rs:57
   2:     0x7fd1e2823b10 - _ZN3std9panicking12default_hook28_$u7b$$u7b$closure$u7d$$u7d$17haba1b8b7cf61bd7aE.llvm.526D1984
                               at /checkout/src/libstd/panicking.rs:381
   3:     0x7fd1e2823815 - _ZN3std9panicking12default_hook17h7be06c8634f460d7E.llvm.526D1984
                               at /checkout/src/libstd/panicking.rs:391
   4:     0x7fd1e2823feb - std::panicking::rust_panic_with_hook::h2be23432ffb4c204
                               at /checkout/src/libstd/panicking.rs:577
   5:     0x7fd1e318ab77 - std::panicking::begin_panic::h28c81c4c0cdf4c69
   6:     0x7fd1e31a2921 - rustc_errors::Handler::bug::h3b10b8fa0aba89a9
   7:     0x7fd1e47db4df - <std::thread::local::LocalKey<T>>::with::hb7233c79388bcb56
   8:     0x7fd1e4af57fe - rustc::ty::context::tls::with_opt::hcdba978ba842b0a7
   9:     0x7fd1e460a137 - _ZN5rustc7session16opt_span_bug_fmt17hb56476d414c941fdE.llvm.1FD79818
  10:     0x7fd1e460a046 - rustc::session::bug_fmt::h148122f0b4a2fc72
  11:     0x7fd1e4954b6d - rustc::hir::map::Map::read::h6c37e24df5a52b88
  12:     0x7fd1e49576ed - rustc::hir::map::Map::span::h24b98904b0fc9b3e
  13:     0x7fd1e491e423 - _ZN5rustc9dep_graph5graph8DepGraph14with_task_impl17h68ec3a1599129d45E.llvm.BAC8A759
  14:     0x7fd1e4564893 - rustc_errors::Handler::track_diagnostics::h03a8f4feb900350d
  15:     0x7fd1e4ab74af - rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::cycle_check::h5c86d9422008a20e
  16:     0x7fd1e46db77e - rustc::ty::maps::<impl rustc::ty::maps::queries::def_span<'tcx>>::force::h43503f8edc09a3d9
  17:     0x7fd1e46dbd9d - rustc::ty::maps::<impl rustc::ty::maps::queries::def_span<'tcx>>::try_get::h008fa80f38be9cec
  18:     0x7fd1e486b56a - rustc::ty::maps::TyCtxtAt::def_span::hbcaeb771c1631aee
  19:     0x7fd1e47260c4 - rustc::ty::maps::<impl rustc::ty::maps::queries::extern_mod_stmt_cnum<'tcx>>::try_get::h27ee8706106e4024
  20:     0x7fd1e486e94a - rustc::ty::maps::TyCtxtAt::extern_mod_stmt_cnum::hb4193a83d0e4e32c
  21:     0x7fd1e4aff170 - rustc::ty::maps::<impl rustc::ty::context::TyCtxt<'a, 'tcx, 'lcx>>::extern_mod_stmt_cnum::hc809b1ab1d193e3b
  22:     0x7fd1e5f0bb71 - rustc_typeck::check_unused::check_crate::h7f7b546a03efb217
  23:     0x7fd1e5ff21d6 - rustc_typeck::check_crate::h418a4ca4886371c9
  24:     0x55b06f47c42a - <std::thread::local::LocalKey<T>>::with::hdfd852279eb6b52d
                               at /checkout/src/librustc_driver/driver.rs:1041
                               at /checkout/src/librustc/ty/context.rs:1453
                               at /checkout/src/libstd/thread/local.rs:377
                               at /checkout/src/libstd/thread/local.rs:288
  25:     0x55b06f47d02d - <std::thread::local::LocalKey<T>>::with::hf52f8a939f7bc32d
                               at /checkout/src/librustc/ty/context.rs:1450
                               at /checkout/src/libstd/thread/local.rs:377
                               at /checkout/src/libstd/thread/local.rs:288
  26:     0x55b06f3603c4 - rustc::ty::context::TyCtxt::create_and_enter::he8d409a0d6f33129
  27:     0x55b06f29ac16 - rustc_driver::driver::phase_3_run_analysis_passes::h8dc82e2d661d53a4
                               at /checkout/src/librustc_driver/driver.rs:1018
  28:     0x55b06f36e732 - rustdoc::core::run_core::h6b6400baa0975073
                               at /checkout/src/librustdoc/core.rs:182
  29:     0x55b06f2a5886 - std::sys_common::backtrace::__rust_begin_short_backtrace::h48f63b8c8d11bac5
                               at /checkout/src/librustdoc/lib.rs:504
                               at /checkout/src/librustc_driver/lib.rs:1216
                               at /checkout/src/libstd/sys_common/backtrace.rs:133
  30:     0x55b06f37bc2d - _ZN3std9panicking3try7do_call17hbd51d01ae49b5078E.llvm.8062FEE3
                               at /checkout/src/libstd/thread/mod.rs:406
  31:     0x7fd1e2852cee - __rust_maybe_catch_panic
                               at /checkout/src/libpanic_unwind/lib.rs:101
  32:     0x55b06f358b63 - _ZN50_$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$8call_box17h69343f0219729beeE.llvm.1F73C0E0
                               at /checkout/src/libstd/panicking.rs:459
                               at /checkout/src/liballoc/boxed.rs:825
  33:     0x7fd1e28113c7 - std::sys_common::thread::start_thread::hebc1ffd0e5c0e31f
                               at /checkout/src/liballoc/boxed.rs:835
  34:     0x7fd1e2829998 - _ZN3std3sys4unix6thread6Thread3new12thread_start17h6af1de78c77e3921E.llvm.96D7229C
                               at /checkout/src/libstd/sys/unix/thread.rs:90
  35:     0x7fd1e25a9089 - start_thread
  36:     0x7fd1e20c947e - __clone
  37:                0x0 - <unknown>

error: Could not document `atty`.

Caused by:
  process didn't exit successfully: `rustdoc --crate-name atty /home/michael/.cargo/registry/src/github.life-white.uk-1ecc6299db9ec823/atty-0.2.3/src/lib.rs -o /tmp/dummy/target/doc -L dependency=/tmp/dummy/target/debug/deps --extern libc=/tmp/dummy/target/debug/deps/liblibc-637e21c9105ecc6e.rlib` (exit code: 101)

This was on an up-to-date Arch Linux machine.

$ rustc --version --verbose
rustc 1.23.0-nightly (e97ba8328 2017-11-25)
binary: rustc
commit-hash: e97ba83287a6f0f85cc9cc7a51ab309487e17038
commit-date: 2017-11-25
host: x86_64-unknown-linux-gnu
release: 1.23.0-nightly
LLVM version: 4.0
$ cargo --version --verbose
cargo 0.24.0-nightly (abd137ad1 2017-11-12)
release: 0.24.0
commit-hash: abd137ad14a8f352b48f24b11c3995d716deb260
commit-date: 2017-11-12

Activity

  1. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    C-bugCategory: This is a bug.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    and removed
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    on Nov 26, 2017
  2. kennytm commented on Nov 26, 2017

    @kennytm
    Member

    For reference: 5f44c65...e97ba83

  3. kennytm commented on Nov 26, 2017

    @kennytm
    Member

    Simplified repro, no dependency needed:

    pub fn x() {
    	extern crate core;
    }
  4. kennytm commented on Nov 26, 2017

    @kennytm
    Member

    bisect-rust found the commit to be 5f44c65. Hold on, something's wrong.

    Edit: I've inverted the failure condition when bisecting 😂

    The actual regressing commit is e97ba83 #46115 @alexcrichton.

    searched commits bbd7932a66b56da9a1c7d8cc30dc931922b356c0 through d4dc289f4bd5bff48b4eba393521b3eb899723a8
    regression in 12; Some(Commit { sha: "e97ba83287a6f0f85cc9cc7a51ab309487e17038", date: 2017-11-25T19:00:45Z, summary: "Auto merge of #46115 - alexcrichton:add-wasm-target, r=kennytm" })
    
  5. kennytm commented on Nov 26, 2017

    @kennytm
    Member

    The issue here is likely due to the everybody-loops pass moved to a different place. Previously it was called immediately after phase 1, now it is called in the middle of phase 2. I'm now trying to see if putting it at the end of phase 2 would help. If not we'd put it back to the beginning of phase 2.

    Edit: neither is working.

  6. est31 commented on Nov 28, 2017

    @est31
    Member
  7. Mark-Simulacrum commented on Nov 29, 2017

    @Mark-Simulacrum
    Member

    @rust-lang/dev-tools @GuillaumeGomez Can we prioritize fixing this? It looks like a relatively widespread problem...

  8. changed the title [-]ICE when generating docs for atty[/-] [+]ICE when generating docs[/+] on Nov 29, 2017
  9. GuillaumeGomez commented on Nov 29, 2017

    @GuillaumeGomez
    Member

    Sure. Will take a look in the next days.

  10. alexcrichton commented on Nov 30, 2017

    @alexcrichton
    Member

    Minimized:

    pub fn foo() {
        extern crate std;
    }

    I believe I see what's going on, will try to make a fix.

  11. alexcrichton commented on Nov 30, 2017

    @alexcrichton
    Member

    I've posted a fix for this issue at #46405

  12. added a commit that references this issue on Dec 1, 2017
  13. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    on May 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions