Skip to content

Commit 75bf1ee

Browse files
committed
Rename LintContext::emit_spanned_lint as LintContext::emit_span_lint.
1 parent 77b1e1e commit 75bf1ee

27 files changed

+112
-128
lines changed

compiler/rustc_lint/src/array_into_iter.rs

+1-1
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

+30-30
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

@@ -1249,7 +1249,7 @@ impl<'tcx> LateLintPass<'tcx> for UnstableFeatures {
12491249
if attr.has_name(sym::feature) {
12501250
if let Some(items) = attr.meta_item_list() {
12511251
for item in items {
1252-
cx.emit_spanned_lint(UNSTABLE_FEATURES, item.span(), BuiltinUnstableFeatures);
1252+
cx.emit_span_lint(UNSTABLE_FEATURES, item.span(), BuiltinUnstableFeatures);
12531253
}
12541254
}
12551255
}
@@ -1303,7 +1303,7 @@ impl<'tcx> LateLintPass<'tcx> for UngatedAsyncFnTrackCaller {
13031303
// Now, check if the function has the `#[track_caller]` attribute
13041304
&& let Some(attr) = cx.tcx.get_attr(def_id, sym::track_caller)
13051305
{
1306-
cx.emit_spanned_lint(
1306+
cx.emit_span_lint(
13071307
UNGATED_ASYNC_FN_TRACK_CALLER,
13081308
attr.span,
13091309
BuiltinUngatedAsyncFnTrackCaller { label: span, session: &cx.tcx.sess },
@@ -1369,7 +1369,7 @@ impl UnreachablePub {
13691369
applicability = Applicability::MaybeIncorrect;
13701370
}
13711371
let def_span = cx.tcx.def_span(def_id);
1372-
cx.emit_spanned_lint(
1372+
cx.emit_span_lint(
13731373
UNREACHABLE_PUB,
13741374
def_span,
13751375
BuiltinUnreachablePub {
@@ -1498,7 +1498,7 @@ impl<'tcx> LateLintPass<'tcx> for TypeAliasBounds {
14981498
suggested_changing_assoc_types = true;
14991499
SuggestChangingAssocTypes { ty: hir_ty }
15001500
});
1501-
cx.emit_spanned_lint(
1501+
cx.emit_span_lint(
15021502
TYPE_ALIAS_BOUNDS,
15031503
where_spans,
15041504
BuiltinTypeAliasWhereClause {
@@ -1514,7 +1514,7 @@ impl<'tcx> LateLintPass<'tcx> for TypeAliasBounds {
15141514
suggested_changing_assoc_types = true;
15151515
SuggestChangingAssocTypes { ty: hir_ty }
15161516
});
1517-
cx.emit_spanned_lint(
1517+
cx.emit_span_lint(
15181518
TYPE_ALIAS_BOUNDS,
15191519
inline_spans,
15201520
BuiltinTypeAliasGenericBounds { suggestion, sub },
@@ -1613,7 +1613,7 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
16131613
| ClauseKind::ConstEvaluatable(..) => continue,
16141614
};
16151615
if predicate.is_global() {
1616-
cx.emit_spanned_lint(
1616+
cx.emit_span_lint(
16171617
TRIVIAL_BOUNDS,
16181618
span,
16191619
BuiltinTrivialBounds { predicate_kind_name, predicate },
@@ -1731,7 +1731,7 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns {
17311731
replace,
17321732
});
17331733
} else {
1734-
cx.emit_spanned_lint(
1734+
cx.emit_span_lint(
17351735
ELLIPSIS_INCLUSIVE_RANGE_PATTERNS,
17361736
pat.span,
17371737
BuiltinEllipsisInclusiveRangePatternsLint::Parenthesise {
@@ -1749,7 +1749,7 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns {
17491749
replace: replace.to_string(),
17501750
});
17511751
} else {
1752-
cx.emit_spanned_lint(
1752+
cx.emit_span_lint(
17531753
ELLIPSIS_INCLUSIVE_RANGE_PATTERNS,
17541754
join,
17551755
BuiltinEllipsisInclusiveRangePatternsLint::NonParenthesise {
@@ -1875,7 +1875,7 @@ impl KeywordIdents {
18751875
return;
18761876
}
18771877

1878-
cx.emit_spanned_lint(
1878+
cx.emit_span_lint(
18791879
KEYWORD_IDENTS,
18801880
ident.span,
18811881
BuiltinKeywordIdents { kw: ident, next: next_edition, suggestion: ident.span },
@@ -2183,7 +2183,7 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitOutlivesRequirements {
21832183
lint_spans.sort_unstable();
21842184
lint_spans.dedup();
21852185

2186-
cx.emit_spanned_lint(
2186+
cx.emit_span_lint(
21872187
EXPLICIT_OUTLIVES_REQUIREMENTS,
21882188
lint_spans.clone(),
21892189
BuiltinExplicitOutlives {
@@ -2270,13 +2270,13 @@ impl EarlyLintPass for IncompleteInternalFeatures {
22702270
let help =
22712271
HAS_MIN_FEATURES.contains(&name).then_some(BuiltinIncompleteFeaturesHelp);
22722272

2273-
cx.emit_spanned_lint(
2273+
cx.emit_span_lint(
22742274
INCOMPLETE_FEATURES,
22752275
span,
22762276
BuiltinIncompleteFeatures { name, note, help },
22772277
);
22782278
} else {
2279-
cx.emit_spanned_lint(INTERNAL_FEATURES, span, BuiltinInternalFeatures { name });
2279+
cx.emit_span_lint(INTERNAL_FEATURES, span, BuiltinInternalFeatures { name });
22802280
}
22812281
});
22822282
}
@@ -2592,7 +2592,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
25922592
InitKind::Uninit => fluent::lint_builtin_unpermitted_type_init_uninit,
25932593
};
25942594
let sub = BuiltinUnpermittedTypeInitSub { err };
2595-
cx.emit_spanned_lint(
2595+
cx.emit_span_lint(
25962596
INVALID_VALUE,
25972597
expr.span,
25982598
BuiltinUnpermittedTypeInit {
@@ -2680,7 +2680,7 @@ impl<'tcx> LateLintPass<'tcx> for DerefNullPtr {
26802680

26812681
if let rustc_hir::ExprKind::Unary(rustc_hir::UnOp::Deref, expr_deref) = expr.kind {
26822682
if is_null_ptr(cx, expr_deref) {
2683-
cx.emit_spanned_lint(
2683+
cx.emit_span_lint(
26842684
DEREF_NULLPTR,
26852685
expr.span,
26862686
BuiltinDerefNullptr { label: expr.span },
@@ -2905,12 +2905,12 @@ impl EarlyLintPass for SpecialModuleName {
29052905
}
29062906

29072907
match item.ident.name.as_str() {
2908-
"lib" => cx.emit_spanned_lint(
2908+
"lib" => cx.emit_span_lint(
29092909
SPECIAL_MODULE_NAME,
29102910
item.span,
29112911
BuiltinSpecialModuleNameUsed::Lib,
29122912
),
2913-
"main" => cx.emit_spanned_lint(
2913+
"main" => cx.emit_span_lint(
29142914
SPECIAL_MODULE_NAME,
29152915
item.span,
29162916
BuiltinSpecialModuleNameUsed::Main,

compiler/rustc_lint/src/context.rs

+1-1
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

+1-1
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

+5-5
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

+2-6
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

+1-1
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

+1-1
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)