Skip to content

Commit

Permalink
Cleanup README include in include_str
Browse files Browse the repository at this point in the history
When running cargo doc, the include_str command works fine, however,
cargo publish relocates the package into target/package, so the relative
path to the README is different, causing cargo publish to fail.

External discussion at:

rust-lang/cargo#13309
https://users.rust-lang.org/t/include-str-does-not-work-when-releasing-because-of-changed-pathes/15551/14

The solution suggested in those links is to symlink the top level README
inside your package, and then consistently refer to the README in the
package.  That README will be copied into the right place during cargo
publish.
  • Loading branch information
dburgener committed Jan 21, 2025
1 parent a4fd1d4 commit cb71c60
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lalrpop/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "lalrpop"
description = "convenient LR(1) parser generator"
readme = "../README.md"
readme = "README.md"
workspace = ".."
default-run = "lalrpop"

Expand Down
1 change: 1 addition & 0 deletions lalrpop/README.md
2 changes: 1 addition & 1 deletion lalrpop/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![doc = include_str!("../../README.md")]
#![doc = include_str!("../README.md")]
#![warn(missing_docs)]
// Need this for rusty_peg
#![recursion_limit = "256"]
Expand Down

0 comments on commit cb71c60

Please sign in to comment.