diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-16 16:27:02 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-01-23 08:09:05 +1100 |
| commit | e164cf30f8f96551cedece4ed199d7ecb5832648 (patch) | |
| tree | 0dd488e397afda47649c87f00686a58a96e06122 /compiler/rustc_passes/src | |
| parent | 82ca070c1680004da7d25abcc1d3d793d00abf06 (diff) | |
| download | rust-e164cf30f8f96551cedece4ed199d7ecb5832648.tar.gz rust-e164cf30f8f96551cedece4ed199d7ecb5832648.zip | |
Rename `TyCtxt::emit_spanned_lint` as `TyCtxt::emit_node_span_lint`.
Diffstat (limited to 'compiler/rustc_passes/src')
| -rw-r--r-- | compiler/rustc_passes/src/check_attr.rs | 84 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/dead.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/liveness.rs | 18 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/naked_functions.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_passes/src/stability.rs | 8 |
5 files changed, 58 insertions, 58 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 20ed2573e3a..9d9741bbe89 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -246,13 +246,13 @@ impl<'tcx> CheckAttrVisitor<'tcx> { attr.ident().and_then(|ident| BUILTIN_ATTRIBUTE_MAP.get(&ident.name)) { match attr.style { - ast::AttrStyle::Outer => self.tcx.emit_spanned_lint( + ast::AttrStyle::Outer => self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, errors::OuterCrateLevelAttr, ), - ast::AttrStyle::Inner => self.tcx.emit_spanned_lint( + ast::AttrStyle::Inner => self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -274,7 +274,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { } fn inline_attr_str_error_with_macro_def(&self, hir_id: HirId, attr: &Attribute, sym: &str) { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -283,7 +283,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { } fn inline_attr_str_error_without_macro_def(&self, hir_id: HirId, attr: &Attribute, sym: &str) { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -304,7 +304,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { /// Checks if `#[diagnostic::on_unimplemented]` is applied to a trait definition fn check_diagnostic_on_unimplemented(&self, attr_span: Span, hir_id: HirId, target: Target) { if !matches!(target, Target::Trait) { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES, hir_id, attr_span, @@ -320,7 +320,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { | Target::Closure | Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) => true, Target::Method(MethodKind::Trait { body: false }) | Target::ForeignFn => { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -333,7 +333,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { // accidentally, to be compatible with crates depending on them, we can't throw an // error here. Target::AssocConst => { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -366,7 +366,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { // function prototypes can't be covered Target::Method(MethodKind::Trait { body: false }) | Target::ForeignFn => { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -376,7 +376,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { } Target::Mod | Target::ForeignMod | Target::Impl | Target::Trait => { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -386,7 +386,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { } Target::Expression | Target::Statement | Target::Arm => { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -413,7 +413,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { allowed_target: Target, ) { if target != allowed_target { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -630,7 +630,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { // FIXME: #[target_feature] was previously erroneously allowed on statements and some // crates used this, so only emit a warning. Target::Statement => { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -769,7 +769,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { return false; } if let Err(entry) = aliases.try_insert(doc_alias_str.to_owned(), span) { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, span, @@ -914,7 +914,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { } } _ => { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( INVALID_DOC_ATTRIBUTES, hir_id, meta.span(), @@ -937,7 +937,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { target: Target, ) -> bool { if target != Target::ExternCrate { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( INVALID_DOC_ATTRIBUTES, hir_id, meta.span(), @@ -951,7 +951,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { } if self.tcx.extern_mod_stmt_cnum(hir_id.owner).is_none() { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( INVALID_DOC_ATTRIBUTES, hir_id, meta.span(), @@ -996,7 +996,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { .then_some(errors::AttrCrateLevelOnlySugg { attr: attr.span.with_lo(bang_span).with_hi(bang_span), }); - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( INVALID_DOC_ATTRIBUTES, hir_id, meta.span(), @@ -1016,7 +1016,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { match (i_meta.name_or_empty(), i_meta.meta_item()) { (sym::attr | sym::no_crate_inject, _) => {} (_, Some(m)) => { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( INVALID_DOC_ATTRIBUTES, hir_id, i_meta.span(), @@ -1027,7 +1027,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { is_valid = false; } (_, None) => { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( INVALID_DOC_ATTRIBUTES, hir_id, i_meta.span(), @@ -1038,7 +1038,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { } } } else { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( INVALID_DOC_ATTRIBUTES, hir_id, meta.span(), @@ -1055,7 +1055,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { if meta.meta_item_list().is_some() { true } else { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( INVALID_DOC_ATTRIBUTES, hir_id, meta.span(), @@ -1188,7 +1188,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { _ => { let path = rustc_ast_pretty::pprust::path_to_string(&i_meta.path); if i_meta.has_name(sym::spotlight) { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( INVALID_DOC_ATTRIBUTES, hir_id, i_meta.span, @@ -1204,7 +1204,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { }; // If there are multiple attributes, the suggestion would suggest // deleting all of them, which is incorrect. - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( INVALID_DOC_ATTRIBUTES, hir_id, i_meta.span, @@ -1219,7 +1219,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { }, ); } else { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( INVALID_DOC_ATTRIBUTES, hir_id, i_meta.span, @@ -1230,7 +1230,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { } } } else { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( INVALID_DOC_ATTRIBUTES, hir_id, meta.span(), @@ -1343,7 +1343,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { _ => "a", }; - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -1380,7 +1380,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { _ => { // FIXME: #[cold] was previously allowed on non-functions and some crates used // this, so only emit a warning. - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -1400,7 +1400,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { return; } - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -1424,14 +1424,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> { // used this, so only emit a warning. let attr_span = matches!(target, Target::ForeignMod).then_some(attr.span); if let Some(s) = attr.value_str() { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, errors::LinkName { span, attr_span, value: s.as_str() }, ); } else { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -1710,7 +1710,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { _ => { // FIXME: #[link_section] was previously allowed on non-functions/statics and some // crates used this, so only emit a warning. - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -1741,7 +1741,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { Target::ForeignStatic => "static", _ => unreachable!(), }; - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -1751,7 +1751,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { _ => { // FIXME: #[no_mangle] was previously allowed on non-functions/statics and some // crates used this, so only emit a warning. - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -1929,7 +1929,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { return false; })) { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( CONFLICTING_REPR_HINTS, hir_id, hint_spans.collect::<Vec<Span>>(), @@ -2171,7 +2171,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { fn check_deprecated(&self, hir_id: HirId, attr: &Attribute, _span: Span, target: Target) { match target { Target::Closure | Target::Expression | Target::Statement | Target::Arm => { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -2187,7 +2187,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { match target { Target::ExternCrate | Target::Mod => {} _ => { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -2199,7 +2199,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { fn check_macro_export(&self, hir_id: HirId, attr: &Attribute, target: Target) { if target != Target::MacroDef { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -2209,7 +2209,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { && !meta_item_list.is_empty() { if meta_item_list.len() > 1 { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( INVALID_MACRO_EXPORT_ARGUMENTS, hir_id, attr.span, @@ -2217,7 +2217,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { ); } else { if meta_item_list[0].name_or_empty() != sym::local_inner_macros { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( INVALID_MACRO_EXPORT_ARGUMENTS, hir_id, meta_item_list[0].span(), @@ -2234,7 +2234,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { let is_decl_macro = !macro_definition.macro_rules; if is_decl_macro { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -2276,7 +2276,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { return; }; - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, attr.span, @@ -2609,7 +2609,7 @@ fn check_duplicates( } else { (attr.span, *entry.get()) }; - tcx.emit_spanned_lint( + tcx.emit_node_span_lint( UNUSED_ATTRIBUTES, hir_id, this, diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index d7f17ac4547..d3909ce3a1c 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -199,7 +199,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { && !assign.span.from_expansion() { let is_field_assign = matches!(lhs.kind, hir::ExprKind::Field(..)); - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( lint::builtin::DEAD_CODE, assign.hir_id, assign.span, @@ -899,7 +899,7 @@ impl<'tcx> DeadVisitor<'tcx> { }; let hir_id = tcx.local_def_id_to_hir_id(first_item.def_id); - self.tcx.emit_spanned_lint(DEAD_CODE, hir_id, MultiSpan::from_spans(spans), diag); + self.tcx.emit_node_span_lint(DEAD_CODE, hir_id, MultiSpan::from_spans(spans), diag); } fn warn_multiple( diff --git a/compiler/rustc_passes/src/liveness.rs b/compiler/rustc_passes/src/liveness.rs index 92687c705ae..99f8186d554 100644 --- a/compiler/rustc_passes/src/liveness.rs +++ b/compiler/rustc_passes/src/liveness.rs @@ -1285,7 +1285,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { // that we do not emit the same warning twice if the uninhabited type // is indeed `!`. - self.ir.tcx.emit_spanned_lint( + self.ir.tcx.emit_node_span_lint( lint::builtin::UNREACHABLE_CODE, expr_id, expr_span, @@ -1446,7 +1446,7 @@ impl<'tcx> Liveness<'_, 'tcx> { if self.used_on_entry(entry_ln, var) { if !self.live_on_entry(entry_ln, var) { if let Some(name) = self.should_warn(var) { - self.ir.tcx.emit_spanned_lint( + self.ir.tcx.emit_node_span_lint( lint::builtin::UNUSED_ASSIGNMENTS, var_hir_id, vec![span], @@ -1456,7 +1456,7 @@ impl<'tcx> Liveness<'_, 'tcx> { } } else { if let Some(name) = self.should_warn(var) { - self.ir.tcx.emit_spanned_lint( + self.ir.tcx.emit_node_span_lint( lint::builtin::UNUSED_VARIABLES, var_hir_id, vec![span], @@ -1478,7 +1478,7 @@ impl<'tcx> Liveness<'_, 'tcx> { if !self.live_on_entry(ln, var) && let Some(name) = self.should_warn(var) { - self.ir.tcx.emit_spanned_lint( + self.ir.tcx.emit_node_span_lint( lint::builtin::UNUSED_ASSIGNMENTS, hir_id, spans, @@ -1552,7 +1552,7 @@ impl<'tcx> Liveness<'_, 'tcx> { if ln == self.exit_ln { false } else { self.assigned_on_exit(ln, var) }; if is_assigned { - self.ir.tcx.emit_spanned_lint( + self.ir.tcx.emit_node_span_lint( lint::builtin::UNUSED_VARIABLES, first_hir_id, hir_ids_and_spans @@ -1574,7 +1574,7 @@ impl<'tcx> Liveness<'_, 'tcx> { span.with_hi(BytePos(span.hi().0 + 1)) }) .collect(); - self.ir.tcx.emit_spanned_lint( + self.ir.tcx.emit_node_span_lint( lint::builtin::UNUSED_VARIABLES, first_hir_id, hir_ids_and_spans.iter().map(|(_, pat_span, _)| *pat_span).collect::<Vec<_>>(), @@ -1599,7 +1599,7 @@ impl<'tcx> Liveness<'_, 'tcx> { let non_shorthands = non_shorthands.into_iter().map(|(_, pat_span, _)| pat_span).collect(); - self.ir.tcx.emit_spanned_lint( + self.ir.tcx.emit_node_span_lint( lint::builtin::UNUSED_VARIABLES, first_hir_id, hir_ids_and_spans @@ -1638,7 +1638,7 @@ impl<'tcx> Liveness<'_, 'tcx> { } }; - self.ir.tcx.emit_spanned_lint( + self.ir.tcx.emit_node_span_lint( lint::builtin::UNUSED_VARIABLES, first_hir_id, hir_ids_and_spans @@ -1690,7 +1690,7 @@ impl<'tcx> Liveness<'_, 'tcx> { if !self.live_on_exit(ln, var) && let Some(name) = self.should_warn(var) { - self.ir.tcx.emit_spanned_lint( + self.ir.tcx.emit_node_span_lint( lint::builtin::UNUSED_ASSIGNMENTS, hir_id, spans, diff --git a/compiler/rustc_passes/src/naked_functions.rs b/compiler/rustc_passes/src/naked_functions.rs index d2cfdb7bf47..0455d6d4acb 100644 --- a/compiler/rustc_passes/src/naked_functions.rs +++ b/compiler/rustc_passes/src/naked_functions.rs @@ -70,7 +70,7 @@ fn check_abi(tcx: TyCtxt<'_>, def_id: LocalDefId, abi: Abi) { if abi == Abi::Rust { let hir_id = tcx.local_def_id_to_hir_id(def_id); let span = tcx.def_span(def_id); - tcx.emit_spanned_lint( + tcx.emit_node_span_lint( UNDEFINED_NAKED_FUNCTION_ABI, hir_id, span, diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index 18b9ba0f042..c1fe8c2133b 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -122,7 +122,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> { if matches!(kind, AnnotationKind::Prohibited | AnnotationKind::DeprecationProhibited) { let hir_id = self.tcx.local_def_id_to_hir_id(def_id); - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( USELESS_DEPRECATED, hir_id, *span, @@ -739,7 +739,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'tcx> { // do not lint when the trait isn't resolved, since resolution error should // be fixed first if t.path.res != Res::Err && c.fully_stable { - self.tcx.emit_spanned_lint( + self.tcx.emit_node_span_lint( INEFFECTIVE_UNSTABLE_TRAIT_IMPL, item.hir_id(), span, @@ -1073,7 +1073,7 @@ fn unnecessary_partially_stable_feature_lint( implies: Symbol, since: Symbol, ) { - tcx.emit_spanned_lint( + tcx.emit_node_span_lint( lint::builtin::STABLE_FEATURES, hir::CRATE_HIR_ID, span, @@ -1096,7 +1096,7 @@ fn unnecessary_stable_feature_lint( if since.as_str() == VERSION_PLACEHOLDER { since = sym::env_CFG_RELEASE; } - tcx.emit_spanned_lint( + tcx.emit_node_span_lint( lint::builtin::STABLE_FEATURES, hir::CRATE_HIR_ID, span, |
