Skip to content

Commit 495a2c1

Browse files
authored
Merge pull request rust-osdev#69 from rust-osdev/fix-doctests
Fix nightly breakage of doctests in workspaces
2 parents 0a5fa3d + ba94e67 commit 495a2c1

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Unreleased
22

3+
- Fix nightly breakage of doctests in workspaces ([#69](https://github.com/rust-osdev/bootimage/pull/69))
4+
35
# 0.10.1 – 2020-08-03
46

57
- Parse `--version` argument without subcommand (`bootimage --version`) ([#67](https://github.com/rust-osdev/bootimage/pull/67))

src/builder/mod.rs

Lines 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)