Skip to content

Panic at unwrap if docs were built using CARGO_BUILD_TARGET #38

@ssokolow

Description

@ssokolow

If CARGO_BUILD_TARGET (or any other method of specifying a non-default target) is set, the docs get placed in target/<target>/doc/<package> rather than target/doc/<package>.

The current cargo installable version of cargo-deadlinks (as of a few minutes ago) panics when it encounters this and you haven't manually specified --dir.

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/libcore/result.rs:1009:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:211
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:227
   4: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:491
   5: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:398
   6: rust_begin_unwind
             at src/libstd/panicking.rs:325
   7: core::panicking::panic_fmt
             at src/libcore/panicking.rs:95
   8: core::result::unwrap_failed
   9: cargo_deadlinks::main
  10: std::rt::lang_start::{{closure}}
  11: std::panicking::try::do_call
             at src/libstd/rt.rs:59
             at src/libstd/panicking.rs:310
  12: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:102
  13: std::rt::lang_start_internal
             at src/libstd/panicking.rs:289
             at src/libstd/panic.rs:398
             at src/libstd/rt.rs:58
  14: main
  15: __libc_start_main
  16: <unknown>

Instead, it should do two things:

  1. Check for and take CARGO_BUILD_TARGET into account.
  2. Exit gracefully if it can't find the docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cargoArea: Determining directories based on `cargo metadata`C-bugCategory: This is a bugC-enhancementCategory: This is a new featureS-blockedStatus: Blocked on another project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions