Skip to content

Regression in the behavior of file!() when using workspaces #47462

Closed
@sgrif

Description

@sgrif

I'm not sure if this is a Rust issue or a Cargo issue, but since it manifests using file!() I figured I'd raise it here. I'm not sure when the actual regression occurred, as it was previously masked in our build by #47139.

The change we're seeing is that file!() is now returning a path relative to the root of the workspace, rather than the root of the project. This specifically breaks our tests which have code like:

let path = Path::new(file!())
    .parent()
    .unwrap()
    .join("other_stuff.txt");
File::open(&path).read_to_string(&mut s).unwrap();

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.relnotesMarks issues that should be documented in the release notes of the next release.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions