Skip to content

Conversation

@ShoyuVanilla
Copy link
Member

@ShoyuVanilla ShoyuVanilla commented Nov 10, 2025

Fixes #20932

The example outputs of cargo config get --format toml --show-origin are in https://github.com/rust-lang/cargo/blob/8c4a25c6d68b2be0b65cfda8c31aab58c88d4cbd/tests/testsuite/cargo_config/mod.rs

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 10, 2025
}
})
.collect();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

) -> Option<Self> {
let mut cargo_config = sysroot.tool(Tool::Cargo, manifest.parent(), extra_env);
cargo_config
.args(["-Z", "unstable-options", "config", "get", "--format", "toml", "--show-origin"])
Copy link
Member Author

@ShoyuVanilla ShoyuVanilla Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, --show-origin flag works only with toml format

@ShoyuVanilla ShoyuVanilla force-pushed the cargo-config-origin branch 4 times, most recently from 48e160f to 3374118 Compare November 11, 2025 01:30
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels quite hacky, but if there is no other way then LGTM. We can't merge this yet until we solve the subtree problem, though.

let toml = DeTable::parse(toml_str)
.inspect_err(|err| tracing::debug!("Failed to parse cargo config into toml: {err:?}"))
.ok()?;
let line_ends = toml_str.lines().fold(vec![], |mut acc, l| {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map().collect() instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RUST_TARGET_PATH usage broken since 0.3.2658

3 participants