diff options
| author | Makai <m4kai410@gmail.com> | 2025-08-13 20:22:18 +0800 |
|---|---|---|
| committer | Makai <m4kai410@gmail.com> | 2025-08-13 20:22:18 +0800 |
| commit | 0c8485f02332f18a41f93ecd1cc3e9611040238b (patch) | |
| tree | 2c7d9cbc54544e76e3c67f4aeb69d2a8bd12fcfe /compiler/rustc_resolve/src/imports.rs | |
| parent | 577166503aee7290e09374da21f4045c455acfd5 (diff) | |
| download | rust-0c8485f02332f18a41f93ecd1cc3e9611040238b.tar.gz rust-0c8485f02332f18a41f93ecd1cc3e9611040238b.zip | |
suggest using `pub(crate)` for E0364
Diffstat (limited to 'compiler/rustc_resolve/src/imports.rs')
| -rw-r--r-- | compiler/rustc_resolve/src/imports.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 403d440bee7..be4771dcb31 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -30,7 +30,7 @@ use crate::diagnostics::{DiagMode, Suggestion, import_candidates}; use crate::errors::{ CannotBeReexportedCratePublic, CannotBeReexportedCratePublicNS, CannotBeReexportedPrivate, CannotBeReexportedPrivateNS, CannotDetermineImportResolution, CannotGlobImportAllCrates, - ConsiderAddingMacroExport, ConsiderMarkingAsPub, + ConsiderAddingMacroExport, ConsiderMarkingAsPub, ConsiderMarkingAsPubCrate, }; use crate::{ AmbiguityError, AmbiguityKind, BindingKey, CmResolver, Determinacy, Finalize, ImportSuggestion, @@ -188,6 +188,9 @@ pub(crate) struct ImportData<'ra> { /// |`use foo` | `ModuleOrUniformRoot::CurrentScope` | - | pub imported_module: Cell<Option<ModuleOrUniformRoot<'ra>>>, pub vis: Visibility, + + /// Span of the visibility. + pub vis_span: Span, } /// All imports are unique and allocated on a same arena, @@ -1373,6 +1376,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { err.subdiagnostic( ConsiderAddingMacroExport { span: binding.span, }); + err.subdiagnostic( ConsiderMarkingAsPubCrate { + vis_span: import.vis_span, + }); } _ => { err.subdiagnostic( ConsiderMarkingAsPub { |
