Skip to content

Commit d8ce69b

Browse files
committed
Derive both Diagnostic and LintDiagnostic on some tys
1 parent 4c02f16 commit d8ce69b

File tree

4 files changed

+7
-42
lines changed

4 files changed

+7
-42
lines changed

compiler/rustc_hir_analysis/src/coherence/orphan.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -514,12 +514,12 @@ fn lint_uncovered_ty_params<'tcx>(
514514
Some(local_type) => tcx.emit_node_lint(
515515
UNCOVERED_PARAM_IN_PROJECTION,
516516
hir_id,
517-
errors::TyParamFirstLocalLint { span, note: (), param: name, local_type },
517+
errors::TyParamFirstLocal { span, note: (), param: name, local_type },
518518
),
519519
None => tcx.emit_node_lint(
520520
UNCOVERED_PARAM_IN_PROJECTION,
521521
hir_id,
522-
errors::TyParamSomeLint { span, note: (), param: name },
522+
errors::TyParamSome { span, note: (), param: name },
523523
),
524524
};
525525
}

compiler/rustc_hir_analysis/src/errors.rs

+2-29
Original file line numberDiff line numberDiff line change
@@ -1358,9 +1358,7 @@ pub struct CrossCrateTraitsDefined {
13581358
pub traits: String,
13591359
}
13601360

1361-
// FIXME(fmease): Deduplicate:
1362-
1363-
#[derive(Diagnostic)]
1361+
#[derive(Diagnostic, LintDiagnostic)]
13641362
#[diag(hir_analysis_ty_param_first_local, code = E0210)]
13651363
#[note]
13661364
pub struct TyParamFirstLocal<'tcx> {
@@ -1373,20 +1371,7 @@ pub struct TyParamFirstLocal<'tcx> {
13731371
pub local_type: Ty<'tcx>,
13741372
}
13751373

1376-
#[derive(LintDiagnostic)]
1377-
#[diag(hir_analysis_ty_param_first_local, code = E0210)]
1378-
#[note]
1379-
pub struct TyParamFirstLocalLint<'tcx> {
1380-
#[primary_span]
1381-
#[label]
1382-
pub span: Span,
1383-
#[note(hir_analysis_case_note)]
1384-
pub note: (),
1385-
pub param: Symbol,
1386-
pub local_type: Ty<'tcx>,
1387-
}
1388-
1389-
#[derive(Diagnostic)]
1374+
#[derive(Diagnostic, LintDiagnostic)]
13901375
#[diag(hir_analysis_ty_param_some, code = E0210)]
13911376
#[note]
13921377
pub struct TyParamSome {
@@ -1398,18 +1383,6 @@ pub struct TyParamSome {
13981383
pub param: Symbol,
13991384
}
14001385

1401-
#[derive(LintDiagnostic)]
1402-
#[diag(hir_analysis_ty_param_some, code = E0210)]
1403-
#[note]
1404-
pub struct TyParamSomeLint {
1405-
#[primary_span]
1406-
#[label]
1407-
pub span: Span,
1408-
#[note(hir_analysis_only_note)]
1409-
pub note: (),
1410-
pub param: Symbol,
1411-
}
1412-
14131386
#[derive(Diagnostic)]
14141387
pub enum OnlyCurrentTraits {
14151388
#[diag(hir_analysis_only_current_traits_outside, code = E0117)]

compiler/rustc_passes/src/check_attr.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1907,8 +1907,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
19071907
});
19081908
}
19091909
if is_explicit_rust && (int_reprs > 0 || is_c || is_simd) {
1910-
let hint_spans = hint_spans.clone().collect();
1911-
self.dcx().emit_err(errors::ReprConflicting { hint_spans });
1910+
self.dcx().emit_err(errors::ReprConflicting { spans: hint_spans.clone().collect() });
19121911
}
19131912
// Warn on repr(u8, u16), repr(C, simd), and c-like-enum-repr(C, u8)
19141913
if (int_reprs > 1)
@@ -1925,7 +1924,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
19251924
self.tcx.emit_node_lint(
19261925
CONFLICTING_REPR_HINTS,
19271926
hir_id,
1928-
errors::ReprConflictingLint { spans: hint_spans.collect() },
1927+
errors::ReprConflicting { spans: hint_spans.collect() },
19291928
);
19301929
}
19311930
}

compiler/rustc_passes/src/errors.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -609,16 +609,9 @@ pub struct ReprIdent {
609609
pub span: Span,
610610
}
611611

612-
#[derive(Diagnostic)]
612+
#[derive(Diagnostic, LintDiagnostic)]
613613
#[diag(passes_repr_conflicting, code = E0566)]
614614
pub struct ReprConflicting {
615-
#[primary_span]
616-
pub hint_spans: Vec<Span>,
617-
}
618-
619-
#[derive(LintDiagnostic)]
620-
#[diag(passes_repr_conflicting, code = E0566)]
621-
pub struct ReprConflictingLint {
622615
#[primary_span]
623616
pub spans: Vec<Span>,
624617
}

0 commit comments

Comments
 (0)