Fix static string lints
This commit is contained in:
@@ -9,7 +9,9 @@ use crate::def_collector::collect_definitions;
|
||||
use crate::imports::{Import, ImportKind};
|
||||
use crate::macros::{MacroRulesBinding, MacroRulesScope, MacroRulesScopeRef};
|
||||
use crate::Namespace::{self, MacroNS, TypeNS, ValueNS};
|
||||
use crate::{Determinacy, ExternPreludeEntry, Finalize, Module, ModuleKind, ModuleOrUniformRoot};
|
||||
use crate::{
|
||||
errors, Determinacy, ExternPreludeEntry, Finalize, Module, ModuleKind, ModuleOrUniformRoot,
|
||||
};
|
||||
use crate::{
|
||||
MacroData, NameBinding, NameBindingKind, ParentScope, PathResult, PerNS, ResolutionError,
|
||||
};
|
||||
@@ -523,11 +525,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
|
||||
ident.name = crate_name;
|
||||
}
|
||||
|
||||
self.r
|
||||
.tcx
|
||||
.sess
|
||||
.struct_span_err(item.span, "`$crate` may not be imported")
|
||||
.emit();
|
||||
self.r.tcx.sess.emit_err(errors::CrateImported { span: item.span });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1028,11 +1026,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
|
||||
self.r
|
||||
.tcx
|
||||
.sess
|
||||
.struct_span_err(
|
||||
attr.span,
|
||||
"`#[macro_use]` is not supported on `extern crate self`",
|
||||
)
|
||||
.emit();
|
||||
.emit_err(errors::MacroUseExternCrateSelf { span: attr.span });
|
||||
}
|
||||
}
|
||||
let ill_formed = |span| {
|
||||
|
||||
@@ -517,3 +517,25 @@ pub(crate) struct ProcMacroSameCrate {
|
||||
#[help]
|
||||
pub(crate) is_test: bool,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_imported_crate)]
|
||||
pub(crate) struct CrateImported {
|
||||
#[primary_span]
|
||||
pub(crate) span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_macro_use_extern_crate_self)]
|
||||
pub(crate) struct MacroUseExternCrateSelf {
|
||||
#[primary_span]
|
||||
pub(crate) span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_accessible_unsure)]
|
||||
#[note]
|
||||
pub(crate) struct CfgAccessibleUnsure {
|
||||
#[primary_span]
|
||||
pub(crate) span: Span,
|
||||
}
|
||||
|
||||
@@ -436,9 +436,7 @@ impl<'a, 'tcx> ResolverExpand for Resolver<'a, 'tcx> {
|
||||
// HACK(Urgau): This shouldn't be necessary
|
||||
PathResult::Failed { is_error_from_last_segment: false, .. } => {
|
||||
self.tcx.sess
|
||||
.struct_span_err(span, "not sure whether the path is accessible or not")
|
||||
.note("the type may have associated items, but we are currently not checking them")
|
||||
.emit();
|
||||
.emit_err(errors::CfgAccessibleUnsure { span });
|
||||
|
||||
// If we get a partially resolved NonModule in one namespace, we should get the
|
||||
// same result in any other namespaces, so we can return early.
|
||||
|
||||
Reference in New Issue
Block a user