Skip to content

Commit 1881bfa

Browse files
committed
Rename LintContext::emit_spanned_lint as LintContext::emit_span_lint.
1 parent c915e90 commit 1881bfa

27 files changed

+112
-128
lines changed

compiler/rustc_lint/src/array_into_iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl<'tcx> LateLintPass<'tcx> for ArrayIntoIter {
132132
} else {
133133
None
134134
};
135-
cx.emit_spanned_lint(
135+
cx.emit_span_lint(
136136
ARRAY_INTO_ITER,
137137
call.ident.span,
138138
ArrayIntoIterDiag { target, suggestion: call.ident.span, sub },

compiler/rustc_lint/src/builtin.rs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl EarlyLintPass for WhileTrue {
121121
"{}loop",
122122
label.map_or_else(String::new, |label| format!("{}: ", label.ident,))
123123
);
124-
cx.emit_spanned_lint(
124+
cx.emit_span_lint(
125125
WHILE_TRUE,
126126
condition_span,
127127
BuiltinWhileTrue { suggestion: condition_span, replace },
@@ -162,7 +162,7 @@ impl BoxPointers {
162162
if let GenericArgKind::Type(leaf_ty) = leaf.unpack()
163163
&& leaf_ty.is_box()
164164
{
165-
cx.emit_spanned_lint(BOX_POINTERS, span, BuiltinBoxPointers { ty });
165+
cx.emit_span_lint(BOX_POINTERS, span, BuiltinBoxPointers { ty });
166166
}
167167
}
168168
}
@@ -265,7 +265,7 @@ impl<'tcx> LateLintPass<'tcx> for NonShorthandFieldPatterns {
265265
if cx.tcx.find_field_index(ident, variant)
266266
== Some(cx.typeck_results().field_index(fieldpat.hir_id))
267267
{
268-
cx.emit_spanned_lint(
268+
cx.emit_span_lint(
269269
NON_SHORTHAND_FIELD_PATTERNS,
270270
fieldpat.span,
271271
BuiltinNonShorthandFieldPatterns {
@@ -334,7 +334,7 @@ impl UnsafeCode {
334334
return;
335335
}
336336

337-
cx.emit_spanned_lint(UNSAFE_CODE, span, decorate);
337+
cx.emit_span_lint(UNSAFE_CODE, span, decorate);
338338
}
339339
}
340340

@@ -509,7 +509,7 @@ impl MissingDoc {
509509
let attrs = cx.tcx.hir().attrs(cx.tcx.local_def_id_to_hir_id(def_id));
510510
let has_doc = attrs.iter().any(has_doc);
511511
if !has_doc {
512-
cx.emit_spanned_lint(
512+
cx.emit_span_lint(
513513
MISSING_DOCS,
514514
cx.tcx.def_span(def_id),
515515
BuiltinMissingDoc { article, desc },
@@ -710,7 +710,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations {
710710
)
711711
.is_ok()
712712
{
713-
cx.emit_spanned_lint(MISSING_COPY_IMPLEMENTATIONS, item.span, BuiltinMissingCopyImpl);
713+
cx.emit_span_lint(MISSING_COPY_IMPLEMENTATIONS, item.span, BuiltinMissingCopyImpl);
714714
}
715715
}
716716
}
@@ -795,7 +795,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDebugImplementations {
795795
.next()
796796
.is_some();
797797
if !has_impl {
798-
cx.emit_spanned_lint(
798+
cx.emit_span_lint(
799799
MISSING_DEBUG_IMPLEMENTATIONS,
800800
item.span,
801801
BuiltinMissingDebugImpl { tcx: cx.tcx, def_id: debug },
@@ -874,7 +874,7 @@ impl EarlyLintPass for AnonymousParameters {
874874
} else {
875875
("<type>", Applicability::HasPlaceholders)
876876
};
877-
cx.emit_spanned_lint(
877+
cx.emit_span_lint(
878878
ANONYMOUS_PARAMETERS,
879879
arg.pat.span,
880880
BuiltinAnonymousParams { suggestion: (arg.pat.span, appl), ty_snip },
@@ -921,7 +921,7 @@ impl EarlyLintPass for DeprecatedAttr {
921921
BuiltinDeprecatedAttrLinkSuggestion::Default { suggestion: attr.span }
922922
}
923923
};
924-
cx.emit_spanned_lint(
924+
cx.emit_span_lint(
925925
DEPRECATED,
926926
attr.span,
927927
BuiltinDeprecatedAttrLink { name, reason, link, suggestion },
@@ -931,7 +931,7 @@ impl EarlyLintPass for DeprecatedAttr {
931931
}
932932
}
933933
if attr.has_name(sym::no_start) || attr.has_name(sym::crate_id) {
934-
cx.emit_spanned_lint(
934+
cx.emit_span_lint(
935935
DEPRECATED,
936936
attr.span,
937937
BuiltinDeprecatedAttrUsed {
@@ -973,7 +973,7 @@ fn warn_if_doc(cx: &EarlyContext<'_>, node_span: Span, node_kind: &str, attrs: &
973973
BuiltinUnusedDocCommentSub::BlockHelp
974974
}
975975
};
976-
cx.emit_spanned_lint(
976+
cx.emit_span_lint(
977977
UNUSED_DOC_COMMENTS,
978978
span,
979979
BuiltinUnusedDocComment { kind: node_kind, label: node_span, sub },
@@ -1107,7 +1107,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidNoMangleItems {
11071107
match param.kind {
11081108
GenericParamKind::Lifetime { .. } => {}
11091109
GenericParamKind::Type { .. } | GenericParamKind::Const { .. } => {
1110-
cx.emit_spanned_lint(
1110+
cx.emit_span_lint(
11111111
NO_MANGLE_GENERIC_ITEMS,
11121112
span,
11131113
BuiltinNoMangleGeneric { suggestion: no_mangle_attr.span },
@@ -1138,7 +1138,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidNoMangleItems {
11381138

11391139
// Const items do not refer to a particular location in memory, and therefore
11401140
// don't have anything to attach a symbol to
1141-
cx.emit_spanned_lint(
1141+
cx.emit_span_lint(
11421142
NO_MANGLE_CONST_ITEMS,
11431143
it.span,
11441144
BuiltinConstNoMangle { suggestion },
@@ -1201,7 +1201,7 @@ impl<'tcx> LateLintPass<'tcx> for MutableTransmutes {
12011201
get_transmute_from_to(cx, expr).map(|(ty1, ty2)| (ty1.kind(), ty2.kind()))
12021202
{
12031203
if from_mutbl < to_mutbl {
1204-
cx.emit_spanned_lint(MUTABLE_TRANSMUTES, expr.span, BuiltinMutablesTransmutes);
1204+
cx.emit_span_lint(MUTABLE_TRANSMUTES, expr.span, BuiltinMutablesTransmutes);
12051205
}
12061206
}
12071207

@@ -1270,7 +1270,7 @@ impl<'tcx> LateLintPass<'tcx> for UnstableFeatures {
12701270
&& let Some(items) = attr.meta_item_list()
12711271
{
12721272
for item in items {
1273-
cx.emit_spanned_lint(UNSTABLE_FEATURES, item.span(), BuiltinUnstableFeatures);
1273+
cx.emit_span_lint(UNSTABLE_FEATURES, item.span(), BuiltinUnstableFeatures);
12741274
}
12751275
}
12761276
}
@@ -1323,7 +1323,7 @@ impl<'tcx> LateLintPass<'tcx> for UngatedAsyncFnTrackCaller {
13231323
// Now, check if the function has the `#[track_caller]` attribute
13241324
&& let Some(attr) = cx.tcx.get_attr(def_id, sym::track_caller)
13251325
{
1326-
cx.emit_spanned_lint(
1326+
cx.emit_span_lint(
13271327
UNGATED_ASYNC_FN_TRACK_CALLER,
13281328
attr.span,
13291329
BuiltinUngatedAsyncFnTrackCaller { label: span, session: &cx.tcx.sess },
@@ -1389,7 +1389,7 @@ impl UnreachablePub {
13891389
applicability = Applicability::MaybeIncorrect;
13901390
}
13911391
let def_span = cx.tcx.def_span(def_id);
1392-
cx.emit_spanned_lint(
1392+
cx.emit_span_lint(
13931393
UNREACHABLE_PUB,
13941394
def_span,
13951395
BuiltinUnreachablePub {
@@ -1518,7 +1518,7 @@ impl<'tcx> LateLintPass<'tcx> for TypeAliasBounds {
15181518
suggested_changing_assoc_types = true;
15191519
SuggestChangingAssocTypes { ty: hir_ty }
15201520
});
1521-
cx.emit_spanned_lint(
1521+
cx.emit_span_lint(
15221522
TYPE_ALIAS_BOUNDS,
15231523
where_spans,
15241524
BuiltinTypeAliasWhereClause {
@@ -1534,7 +1534,7 @@ impl<'tcx> LateLintPass<'tcx> for TypeAliasBounds {
15341534
suggested_changing_assoc_types = true;
15351535
SuggestChangingAssocTypes { ty: hir_ty }
15361536
});
1537-
cx.emit_spanned_lint(
1537+
cx.emit_span_lint(
15381538
TYPE_ALIAS_BOUNDS,
15391539
inline_spans,
15401540
BuiltinTypeAliasGenericBounds { suggestion, sub },
@@ -1633,7 +1633,7 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
16331633
| ClauseKind::ConstEvaluatable(..) => continue,
16341634
};
16351635
if predicate.is_global() {
1636-
cx.emit_spanned_lint(
1636+
cx.emit_span_lint(
16371637
TRIVIAL_BOUNDS,
16381638
span,
16391639
BuiltinTrivialBounds { predicate_kind_name, predicate },
@@ -1751,7 +1751,7 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns {
17511751
replace,
17521752
});
17531753
} else {
1754-
cx.emit_spanned_lint(
1754+
cx.emit_span_lint(
17551755
ELLIPSIS_INCLUSIVE_RANGE_PATTERNS,
17561756
pat.span,
17571757
BuiltinEllipsisInclusiveRangePatternsLint::Parenthesise {
@@ -1769,7 +1769,7 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns {
17691769
replace: replace.to_string(),
17701770
});
17711771
} else {
1772-
cx.emit_spanned_lint(
1772+
cx.emit_span_lint(
17731773
ELLIPSIS_INCLUSIVE_RANGE_PATTERNS,
17741774
join,
17751775
BuiltinEllipsisInclusiveRangePatternsLint::NonParenthesise {
@@ -1895,7 +1895,7 @@ impl KeywordIdents {
18951895
return;
18961896
}
18971897

1898-
cx.emit_spanned_lint(
1898+
cx.emit_span_lint(
18991899
KEYWORD_IDENTS,
19001900
ident.span,
19011901
BuiltinKeywordIdents { kw: ident, next: next_edition, suggestion: ident.span },
@@ -2203,7 +2203,7 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitOutlivesRequirements {
22032203
lint_spans.sort_unstable();
22042204
lint_spans.dedup();
22052205

2206-
cx.emit_spanned_lint(
2206+
cx.emit_span_lint(
22072207
EXPLICIT_OUTLIVES_REQUIREMENTS,
22082208
lint_spans.clone(),
22092209
BuiltinExplicitOutlives {
@@ -2290,13 +2290,13 @@ impl EarlyLintPass for IncompleteInternalFeatures {
22902290
let help =
22912291
HAS_MIN_FEATURES.contains(&name).then_some(BuiltinIncompleteFeaturesHelp);
22922292

2293-
cx.emit_spanned_lint(
2293+
cx.emit_span_lint(
22942294
INCOMPLETE_FEATURES,
22952295
span,
22962296
BuiltinIncompleteFeatures { name, note, help },
22972297
);
22982298
} else {
2299-
cx.emit_spanned_lint(INTERNAL_FEATURES, span, BuiltinInternalFeatures { name });
2299+
cx.emit_span_lint(INTERNAL_FEATURES, span, BuiltinInternalFeatures { name });
23002300
}
23012301
});
23022302
}
@@ -2612,7 +2612,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
26122612
InitKind::Uninit => fluent::lint_builtin_unpermitted_type_init_uninit,
26132613
};
26142614
let sub = BuiltinUnpermittedTypeInitSub { err };
2615-
cx.emit_spanned_lint(
2615+
cx.emit_span_lint(
26162616
INVALID_VALUE,
26172617
expr.span,
26182618
BuiltinUnpermittedTypeInit {
@@ -2700,7 +2700,7 @@ impl<'tcx> LateLintPass<'tcx> for DerefNullPtr {
27002700

27012701
if let rustc_hir::ExprKind::Unary(rustc_hir::UnOp::Deref, expr_deref) = expr.kind {
27022702
if is_null_ptr(cx, expr_deref) {
2703-
cx.emit_spanned_lint(
2703+
cx.emit_span_lint(
27042704
DEREF_NULLPTR,
27052705
expr.span,
27062706
BuiltinDerefNullptr { label: expr.span },
@@ -2925,12 +2925,12 @@ impl EarlyLintPass for SpecialModuleName {
29252925
}
29262926

29272927
match item.ident.name.as_str() {
2928-
"lib" => cx.emit_spanned_lint(
2928+
"lib" => cx.emit_span_lint(
29292929
SPECIAL_MODULE_NAME,
29302930
item.span,
29312931
BuiltinSpecialModuleNameUsed::Lib,
29322932
),
2933-
"main" => cx.emit_spanned_lint(
2933+
"main" => cx.emit_span_lint(
29342934
SPECIAL_MODULE_NAME,
29352935
item.span,
29362936
BuiltinSpecialModuleNameUsed::Main,

compiler/rustc_lint/src/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ pub trait LintContext {
565565

566566
/// Emit a lint at `span` from a lint struct (some type that implements `DecorateLint`,
567567
/// typically generated by `#[derive(LintDiagnostic)]`).
568-
fn emit_spanned_lint<S: Into<MultiSpan>>(
568+
fn emit_span_lint<S: Into<MultiSpan>>(
569569
&self,
570570
lint: &'static Lint,
571571
span: S,

compiler/rustc_lint/src/deref_into_dyn_supertrait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<'tcx> LateLintPass<'tcx> for DerefIntoDynSupertrait {
7878
.find_map(|i| (i.ident.name == sym::Target).then_some(i.span))
7979
.map(|label| SupertraitAsDerefTargetLabel { label });
8080
let span = tcx.def_span(item.owner_id.def_id);
81-
cx.emit_spanned_lint(
81+
cx.emit_span_lint(
8282
DEREF_INTO_DYN_SUPERTRAIT,
8383
span,
8484
SupertraitAsDerefTarget {

compiler/rustc_lint/src/drop_forget_useless.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,28 +149,28 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless {
149149
let drop_is_single_call_in_arm = is_single_call_in_arm(cx, arg, expr);
150150
match fn_name {
151151
sym::mem_drop if arg_ty.is_ref() && !drop_is_single_call_in_arm => {
152-
cx.emit_spanned_lint(
152+
cx.emit_span_lint(
153153
DROPPING_REFERENCES,
154154
expr.span,
155155
DropRefDiag { arg_ty, label: arg.span },
156156
);
157157
}
158158
sym::mem_forget if arg_ty.is_ref() => {
159-
cx.emit_spanned_lint(
159+
cx.emit_span_lint(
160160
FORGETTING_REFERENCES,
161161
expr.span,
162162
ForgetRefDiag { arg_ty, label: arg.span },
163163
);
164164
}
165165
sym::mem_drop if is_copy && !drop_is_single_call_in_arm => {
166-
cx.emit_spanned_lint(
166+
cx.emit_span_lint(
167167
DROPPING_COPY_TYPES,
168168
expr.span,
169169
DropCopyDiag { arg_ty, label: arg.span },
170170
);
171171
}
172172
sym::mem_forget if is_copy => {
173-
cx.emit_spanned_lint(
173+
cx.emit_span_lint(
174174
FORGETTING_COPY_TYPES,
175175
expr.span,
176176
ForgetCopyDiag { arg_ty, label: arg.span },
@@ -180,7 +180,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless {
180180
if let ty::Adt(adt, _) = arg_ty.kind()
181181
&& adt.is_manually_drop() =>
182182
{
183-
cx.emit_spanned_lint(
183+
cx.emit_span_lint(
184184
UNDROPPED_MANUALLY_DROPS,
185185
expr.span,
186186
UndroppedManuallyDropsDiag {

compiler/rustc_lint/src/enum_intrinsics_non_enums.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn enforce_mem_discriminant(
5353
) {
5454
let ty_param = cx.typeck_results().node_args(func_expr.hir_id).type_at(0);
5555
if is_non_enum(ty_param) {
56-
cx.emit_spanned_lint(
56+
cx.emit_span_lint(
5757
ENUM_INTRINSICS_NON_ENUMS,
5858
expr_span,
5959
EnumIntrinsicsMemDiscriminate { ty_param, note: args_span },
@@ -64,11 +64,7 @@ fn enforce_mem_discriminant(
6464
fn enforce_mem_variant_count(cx: &LateContext<'_>, func_expr: &hir::Expr<'_>, span: Span) {
6565
let ty_param = cx.typeck_results().node_args(func_expr.hir_id).type_at(0);
6666
if is_non_enum(ty_param) {
67-
cx.emit_spanned_lint(
68-
ENUM_INTRINSICS_NON_ENUMS,
69-
span,
70-
EnumIntrinsicsMemVariant { ty_param },
71-
);
67+
cx.emit_span_lint(ENUM_INTRINSICS_NON_ENUMS, span, EnumIntrinsicsMemVariant { ty_param });
7268
}
7369
}
7470

compiler/rustc_lint/src/for_loops_over_fallibles.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl<'tcx> LateLintPass<'tcx> for ForLoopsOverFallibles {
8181
end_span: pat.span.between(arg.span),
8282
};
8383

84-
cx.emit_spanned_lint(
84+
cx.emit_span_lint(
8585
FOR_LOOPS_OVER_FALLIBLES,
8686
arg.span,
8787
ForLoopsOverFalliblesDiag { article, ty, sub, question_mark, suggestion },

compiler/rustc_lint/src/hidden_unicode_codepoints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl HiddenUnicodeCodepoints {
7474
HiddenUnicodeCodepointsDiagSub::NoEscape { spans }
7575
};
7676

77-
cx.emit_spanned_lint(
77+
cx.emit_span_lint(
7878
TEXT_DIRECTION_CODEPOINT_IN_LITERAL,
7979
span,
8080
HiddenUnicodeCodepointsDiag { label, count, span_label: span, labels, sub },

0 commit comments

Comments
 (0)