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.
This commit is contained in:
León Orell Valerian Liehr
2025-07-17 03:58:33 +02:00
committed by GitHub
9 changed files with 93 additions and 22 deletions

View File

@@ -1773,9 +1773,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
let exported_ambiguities = self.tcx.sess.time("compute_effective_visibilities", || {
EffectiveVisibilitiesVisitor::compute_effective_visibilities(self, krate)
});
self.tcx.sess.time("check_hidden_glob_reexports", || {
self.check_hidden_glob_reexports(exported_ambiguities)
});
self.tcx.sess.time("lint_reexports", || self.lint_reexports(exported_ambiguities));
self.tcx
.sess
.time("finalize_macro_resolutions", || self.finalize_macro_resolutions(krate));