Skip to content

Commit da81ca3

Browse files
authored
Public in private manifest errors (#16002)
### What does this PR try to resolve? This is a stab at #13096, adding Cargo.toml context to public-in-private errors. It intercepts public-in-private warnings from rustc and modifies them by adding a little context. I had a bit of difficulty with renamed crates (like, `foo_renamed = { version = "0.1.0", package = "foo" }`). Surprisingly for me, rustc's errors mention the original package name (foo) and not the renamed one (foo_renamed), even though the renamed one is that one that's guaranteed unique. This PR does its best to figure out which package is the one being referred to, but if there's non-uniqueness involved then it just gives up and doesn't provide context.
2 parents 5b48cf2 + ea98c6b commit da81ca3

File tree

4 files changed

+825
-45
lines changed

4 files changed

+825
-45
lines changed

src/cargo/core/compiler/build_context/target_info.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,10 @@ impl<'gctx> RustcTargetData<'gctx> {
11051105
}
11061106
unsupported
11071107
}
1108+
1109+
pub fn requested_kinds(&self) -> &[CompileKind] {
1110+
&self.requested_kinds
1111+
}
11081112
}
11091113

11101114
/// Structure used to deal with Rustdoc fingerprinting

0 commit comments

Comments
 (0)