Skip to content

Paths outside of Cargo workspace fail to resolve at build time #1727

@Sewer56

Description

@Sewer56

Checklist

Describe your issue

Users can include documentation, or other embedded text in the source via a multitude of ways

#![doc = include_str!(concat!("../", env!("CARGO_PKG_README")))]
#![doc = include_str!("../README.MD")]

etc.

If the path to README.MD falls outside of the current workspace, e.g.

README.MD
src/
    Cargo.toml              (workspace root)
    project/
        lib.rs                    (references README.MD, level above workspace root)
        Cargo.toml

Then compilation fails with cross

error: couldn't read `lossless-transform-utils/src/../../../README.MD`: No such file or directory (os error 2)
 --> lossless-transform-utils/src/lib.rs:1:10
  |
1 | #![doc = include_str!("../../../README.MD")]
  |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |

But it does succeed with cargo

What target(s) are you cross-compiling for?

powerpc64-unknown-linux-gnu

Which operating system is the host (e.g computer cross is on) running?

  • macOS
  • Windows
  • Linux / BSD
  • other OS (specify in description)

What architecture is the host?

  • x86_64 / AMD64
  • arm32
  • arm64 (including Mac M1)

What container engine is cross using?

  • docker
  • podman
  • other container engine (specify in description)

cross version

cross 0.2.5 (49cd054 2025-09-26)

Example

No response

Additional information / notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions