Skip to content

Add library to mdbook crate#3071

Open
UebelAndre wants to merge 1 commit intorust-lang:masterfrom
UebelAndre:binary
Open

Add library to mdbook crate#3071
UebelAndre wants to merge 1 commit intorust-lang:masterfrom
UebelAndre:binary

Conversation

@UebelAndre
Copy link
Copy Markdown

This change adds a library to the mdbook crate so the entrypoint can be consumed without the need for a nightly toolchain to be able to use -Z bindeps (rust-lang/cargo#9096)

closes #2954

@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label Apr 16, 2026
@UebelAndre
Copy link
Copy Markdown
Author

Admittedly this change is quite weird but do want to find a conclusion to #2954

For reviewers, lib.rs is a copy of main.rs, no changes were made with the exception of the docstring on main.

@UebelAndre
Copy link
Copy Markdown
Author

re: https://github.com/rust-lang/mdBook/actions/runs/24518893029/job/71670723888?pr=3071


error: running cargo-doc on crate 'mdbook' failed with output:
-----
warning: placeholder v0.0.0 (/home/runner/work/mdBook/mdBook/target/semver-checks/registry-mdbook-0_5_2-default-321f64277e8a6c7d) ignoring invalid dependency `mdbook` which is missing a lib target
error: no library targets found in package `mdbook`

-----

error: failed to build rustdoc for crate mdbook v0.5.2
note: this is usually due to a compilation error in the crate,
      and is unlikely to be a bug in cargo-semver-checks
note: the following command can be used to reproduce the error:
      cargo new --lib example &&
          cd example &&
          echo '[workspace]' >> Cargo.toml &&
          cargo add mdbook@=0.5.2 --features default,search,serve,watch &&
          cargo check &&
          cargo doc

This seems to build locally but I wonder if there's confusion in the lack of a library in the previous release

mbook % cargo new --lib example &&
          cd example &&
          echo '[workspace]' >> Cargo.toml &&
          cargo add mdbook@=0.5.2 --features default,search,serve,watch &&
          cargo check &&
          cargo doc

    Creating library `example` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
    Updating crates.io index
      Adding mdbook =0.5.2 to dependencies
             Features:
             + search
             + serve
             + watch
    Updating crates.io index
     Locking 233 packages to latest Rust 1.95.0 compatible versions
      Adding generic-array v0.14.7 (available: v0.14.9)
      Adding matchit v0.8.4 (available: v0.8.6)
  Downloaded tokio-tungstenite v0.29.0
  Downloaded mdbook-summary v0.5.2
  Downloaded mdbook-preprocessor v0.5.2
  Downloaded mdbook-markdown v0.5.2
  Downloaded mdbook-driver v0.5.2
  Downloaded mdbook-renderer v0.5.2
  Downloaded markup5ever v0.36.1
  Downloaded ego-tree v0.10.0
  Downloaded toml_parser v1.1.2+spec-1.1.0
  Downloaded mdbook-core v0.5.2
  Downloaded html5ever v0.36.1
  Downloaded tungstenite v0.29.0
  Downloaded rand v0.9.4
  Downloaded pulldown-cmark v0.13.3
  Downloaded mdbook v0.5.2
  Downloaded hyper v1.9.0
  Downloaded axum v0.8.9
  Downloaded mdbook-html v0.5.2
  Downloaded 18 crates (1.7MiB) in 0.66s
warning: example v0.1.0 (/Users/user/Code/mbook/example) ignoring invalid dependency `mdbook` which is missing a lib target
    Checking example v0.1.0 (/Users/user/Code/mbook/example)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.91s
warning: example v0.1.0 (/Users/user/Code/mbook/example) ignoring invalid dependency `mdbook` which is missing a lib target
 Documenting example v0.1.0 (/Users/user/Code/mbook/example)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.68s
   Generated /Users/user/Code/mbook/example/target/doc/example/index.html

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 21, 2026

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: waiting on a review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose mdbook as a Library

2 participants