Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 54492a9

Browse filesBrowse files
committed
Fix nightly breakage of doctests in workspaces
In rust-lang/cargo#8954 the working directory for the runner executable changed for doctests. Before, the working directory was the crate dir, now it is the workspace dir. This lead to a bug in bootimage because it now looked for the `test-args` and other config option in the workpace root `Cargo.toml`, instead of the crate-specific `Cargo.toml`. This commit fixes this by using the `CARGO_MANIFEST_DIR` environment variable for determining the `Cargo.toml` path, instead of directly using `cargo locate-project` as before.
1 parent 0a5fa3d commit 54492a9
Copy full SHA for 54492a9

File tree

Expand file treeCollapse file tree

1 file changed

+12
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-1
lines changed

‎src/builder/mod.rs

Copy file name to clipboardExpand all lines: src/builder/mod.rs
+12-1Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,18 @@ impl Builder {
2626
///
2727
/// If None is passed for `manifest_path`, it is automatically searched.
2828
pub fn new(manifest_path: Option<PathBuf>) -> Result<Self, BuilderError> {
29-
let manifest_path = manifest_path.unwrap_or(locate_cargo_manifest::locate_manifest()?);
29+
let manifest_path = match manifest_path.or_else(|| {
30+
std::env::var("CARGO_MANIFEST_DIR")
31+
.ok()
32+
.map(|dir| Path::new(&dir).join("Cargo.toml"))
33+
}) {
34+
Some(path) => path,
35+
None => {
36+
println!("WARNING: `CARGO_MANIFEST_DIR` env variable not set");
37+
locate_cargo_manifest::locate_manifest()?
38+
}
39+
};
40+
3041
Ok(Builder {
3142
manifest_path,
3243
project_metadata: None,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.