-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Change in resolution of relative paths in doctest included with #[doc = include_str(...)] in 1.83.0 #133824
Labels
A-attributes
Area: Attributes (`#[…]`, `#![…]`)
A-doctests
Area: Documentation tests, run by rustdoc
C-bug
Category: This is a bug.
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
Comments
andrewhickman
added a commit
to andrewhickman/prost-reflect
that referenced
this issue
Dec 3, 2024
Workaround for rust-lang/rust#133824
andrewhickman
added a commit
to andrewhickman/prost-reflect
that referenced
this issue
Dec 3, 2024
* Fix lints * Fix lint * Correct MSRV in README to match value in changelog, CI and Cargo.toml * Update dependencies * Fix build in 1.83.0 Workaround for rust-lang/rust#133824
(Sorry label raced) |
After manual checkout: Indeed, fixed on beta (1.84). Sorry for the inconvenience. |
This was referenced Dec 10, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-attributes
Area: Attributes (`#[…]`, `#![…]`)
A-doctests
Area: Documentation tests, run by rustdoc
C-bug
Category: This is a bug.
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
When using attribute an attribute like
#[doc = include_str("../doc/docs.md")]
to include documentation from a file, if the file contains doctests, the resolution of relative paths in the test at compile time has changed. For example, ifdoc/docs.md
usesinclude_bytes!
, previously the path would need to be relative to the file containing#[doc]
, but in 1.82.0, it is relative todocs/docs.md
.This is easily worked around by using absolute paths like
concat!(env!("CARGO_MANIFEST_DIR"), "/src/foo")
, and I don't know if this behaviour is actually defined anywhere, but I thought I'd report it anyway.Code
A minimal reproduction of this issue is here: https://github.com/andrewhickman/doctestissue. The doctest in this repo passes in 1.82.0 but fails to compile in 1.83.0 with
Version it worked on
Rust 1.82.0 runs the doctest in the reproduction successfully
Version with regression
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: