OUT_DIRs value has changed in nightly. - #2223
Closed
ltratt wants to merge 1 commit into
Closed
Conversation
ltratt
enabled auto-merge
July 31, 2026 17:21
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 31, 2026
This was changed in rust-lang/cargo#17272. This might change back for all I know, but at least for now this unbreaks things.
ltratt
enabled auto-merge
July 31, 2026 17:30
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 31, 2026
Pavel-Durov
reviewed
Aug 1, 2026
| Path::new(&out_dir) | ||
| .components() | ||
| .nth_back(3) | ||
| .nth_back(4) |
Contributor
There was a problem hiding this comment.
We could do something like:
pub fn full_cargo_profile() -> String {
let target_dir = target_dir();
let out_dir = PathBuf::from(env!("OUT_DIR"));
out_dir
.ancestors()
.find(|p| p.parent() == Some(target_dir.as_path()))
.and_then(|p| p.file_name())
.and_then(|n| n.to_str())
}Way more code, but then we don't need to rely on dir layout
Pavel-Durov
reviewed
Aug 1, 2026
Comment on lines
13
to
24
| pub fn target_dir() -> PathBuf { | ||
| Path::new(env!("OUT_DIR")) | ||
| .parent() | ||
| .unwrap() | ||
| .parent() | ||
| .unwrap() | ||
| .parent() | ||
| .unwrap() | ||
| .parent() | ||
| .unwrap() | ||
| .to_owned() | ||
| } |
Contributor
There was a problem hiding this comment.
We can use cargo_metadata for that:
Suggested change
| } | |
| pub fn target_dir() -> PathBuf { | |
| let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".to_owned()); | |
| let metadata = cargo_metadata::MetadataCommand::new() | |
| .cargo_path(cargo) | |
| .no_deps() | |
| .exec() | |
| .expect("failed to run `cargo metadata`"); | |
| metadata.target_directory.into_std_path_buf().clone() | |
| } |
Pavel-Durov
reviewed
Aug 1, 2026
Comment on lines
110
to
118
| pub fn full_cargo_profile() -> String { | ||
| let out_dir = std::env::var("OUT_DIR").unwrap(); | ||
| Path::new(&out_dir) | ||
| .components() | ||
| .nth_back(3) | ||
| .nth_back(4) | ||
| .map(|x| x.as_os_str().to_str().unwrap()) | ||
| .unwrap() | ||
| .to_owned() | ||
| } |
Contributor
There was a problem hiding this comment.
Suggested change
| pub fn full_cargo_profile() -> String { | |
| let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap()); | |
| out_dir | |
| .strip_prefix(ykbuild::target_dir()) | |
| .expect("OUT_DIR is not inside cargo's target directory") | |
| .components() | |
| .next() | |
| .map(|x| x.as_os_str().to_str().unwrap()) | |
| .unwrap() | |
| .to_owned() | |
| } |
Contributor
|
Alternative PR github.com//pull/2224 |
Contributor
Author
|
Right now, I don't think we can work around this problem other than by setting the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was changed in rust-lang/cargo#17272. This might change back for all I know, but at least for now this unbreaks things.