about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/lints.rs
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2025-07-17 03:58:33 +0200
committerGitHub <noreply@github.com>2025-07-17 03:58:33 +0200
commit36a362bff5a9bdd18719079d111976a37542d65d (patch)
tree968fce3ca900dbca87a4932c5cb1bb62152657e7 /compiler/rustc_lint/src/lints.rs
parenta07ae6287acb7ab95b7c70372da49a6822ffcefb (diff)
parentd627e252ae5f1d282f3c2ca6c0a0e24154552e8a (diff)
downloadrust-36a362bff5a9bdd18719079d111976a37542d65d.tar.gz
rust-36a362bff5a9bdd18719079d111976a37542d65d.zip
Rollup merge of #143856 - mladedav:dm/private-reexport, r=petrochenkov
Linting public reexport of private dependencies

Part of public/private dependencies rust-lang/rust#44663
Partially addresses rust-lang/rust#71043

I'm adding a warning for reexports of private dependencies into `rustc_resolve`. I get that this should not be a warning, but should instead be a lint to be controlled by the feature gate, but I did not figure out how exactly to do that at that point. I tried doing the same thing as is done in `rustc_privacy`, but the linting system is not ready yet as far as I understand the error I got, so I made a warning for now instead. Some guidance on how to emit lints with `dcx` would be appreciated.

This also sets the `std_detect` crate as a public dependency of `std` because some macros are reexported from there. I did not check closer, but the other option may be to allow the specific reexports instead.
Diffstat (limited to 'compiler/rustc_lint/src/lints.rs')
-rw-r--r--compiler/rustc_lint/src/lints.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs
index 19989cbcce6..b1afbf298e3 100644
--- a/compiler/rustc_lint/src/lints.rs
+++ b/compiler/rustc_lint/src/lints.rs
@@ -3095,6 +3095,14 @@ pub(crate) struct HiddenGlobReexports {
 }
 
 #[derive(LintDiagnostic)]
+#[diag(lint_reexport_private_dependency)]
+pub(crate) struct ReexportPrivateDependency {
+    pub name: String,
+    pub kind: String,
+    pub krate: Symbol,
+}
+
+#[derive(LintDiagnostic)]
 #[diag(lint_unnecessary_qualification)]
 pub(crate) struct UnusedQualifications {
     #[suggestion(style = "verbose", code = "", applicability = "machine-applicable")]