mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-05 01:24:03 +00:00
Don't emit sugg for pub-reexport extern std
This commit is contained in:
@@ -840,7 +840,7 @@ pub(crate) struct PrivateExternCrateReexport {
|
||||
style = "verbose",
|
||||
applicability = "maybe-incorrect"
|
||||
)]
|
||||
pub sugg: Span,
|
||||
pub sugg: Option<Span>,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
|
||||
@@ -1673,8 +1673,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
|
||||
if let Some(extern_crate_id) = pub_use_of_private_extern_crate_hack(import.summary(), decl)
|
||||
{
|
||||
let ImportKind::Single { id, .. } = import.kind else { unreachable!() };
|
||||
let sugg = self.tcx.source_span(extern_crate_id).shrink_to_lo();
|
||||
let diagnostic = crate::diagnostics::PrivateExternCrateReexport { ident, sugg };
|
||||
let sugg = self.tcx.source_span(extern_crate_id);
|
||||
let diagnostic = crate::diagnostics::PrivateExternCrateReexport {
|
||||
ident,
|
||||
sugg: sugg.can_be_used_for_suggestions().then(|| sugg.shrink_to_lo()),
|
||||
};
|
||||
return Some(BufferedEarlyLint {
|
||||
lint_id: LintId::of(PUB_USE_OF_PRIVATE_EXTERN_CRATE),
|
||||
node_id: id,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
pub use std as x;
|
||||
//~^ ERROR extern crate `std` is private and cannot be re-exported
|
||||
//~^^ WARN this was previously accepted by the compiler but is being phased out
|
||||
|
||||
//@ edition: 2015
|
||||
|
||||
|
||||
@@ -7,10 +7,6 @@ LL | pub use std as x;
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #127909 <https://github.com/rust-lang/rust/issues/127909>
|
||||
= note: `#[deny(pub_use_of_private_extern_crate)]` (part of `#[deny(future_incompatible)]`) on by default
|
||||
help: consider making the `extern crate` item publicly accessible
|
||||
|
|
||||
LL | pub pub use std as x;
|
||||
| +++
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
@@ -25,8 +21,4 @@ LL | pub use std as x;
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #127909 <https://github.com/rust-lang/rust/issues/127909>
|
||||
= note: `#[deny(pub_use_of_private_extern_crate)]` (part of `#[deny(future_incompatible)]`) on by default
|
||||
help: consider making the `extern crate` item publicly accessible
|
||||
|
|
||||
LL | pub pub use std as x;
|
||||
| +++
|
||||
|
||||
|
||||
Reference in New Issue
Block a user