Skip to content

Commit ed6468d

Browse files
committedJan 8, 2020
Auto merge of #67770 - Centril:reduce-diversity-2, r=petrochenkov
More reductions in error handling diversity In this follow up to #67744, we: - Remove all fatal / error / warning macros in `syntax` except for `struct_span_err`, which is moved to `rustc_errors`. - Lintify some hard-coded warnings which used warning macros. - Defatalize some errors. In general, the goal here is to make it painful to use fatal or unstructured errors and so we hopefully won't see many of these creep in. Fixes #67933.
2 parents 87540bd + 20ebb80 commit ed6468d

File tree

111 files changed

+629
-655
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+629
-655
lines changed
 

‎Cargo.lock

+2
Original file line numberDiff line numberDiff line change
@@ -3804,6 +3804,7 @@ version = "0.0.0"
38043804
dependencies = [
38053805
"rustc",
38063806
"rustc_error_codes",
3807+
"rustc_errors",
38073808
"rustc_hir",
38083809
"rustc_metadata",
38093810
"rustc_span",
@@ -3818,6 +3819,7 @@ dependencies = [
38183819
"rustc",
38193820
"rustc_data_structures",
38203821
"rustc_error_codes",
3822+
"rustc_errors",
38213823
"rustc_hir",
38223824
"rustc_span",
38233825
"rustc_typeck",

‎src/librustc/hir/check_attr.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ use crate::hir::intravisit::{self, NestedVisitorMap, Visitor};
88
use crate::lint::builtin::UNUSED_ATTRIBUTES;
99
use crate::ty::query::Providers;
1010
use crate::ty::TyCtxt;
11+
12+
use errors::struct_span_err;
1113
use rustc_error_codes::*;
1214
use rustc_hir as hir;
1315
use rustc_hir::def_id::DefId;
@@ -430,21 +432,27 @@ impl CheckAttrVisitor<'tcx> {
430432
// Error on repr(transparent, <anything else>).
431433
if is_transparent && hints.len() > 1 {
432434
let hint_spans: Vec<_> = hint_spans.clone().collect();
433-
span_err!(
435+
struct_span_err!(
434436
self.tcx.sess,
435437
hint_spans,
436438
E0692,
437439
"transparent {} cannot have other repr hints",
438440
target
439-
);
441+
)
442+
.emit();
440443
}
441444
// Warn on repr(u8, u16), repr(C, simd), and c-like-enum-repr(C, u8)
442445
if (int_reprs > 1)
443446
|| (is_simd && is_c)
444447
|| (int_reprs == 1 && is_c && item.map_or(false, |item| is_c_like_enum(item)))
445448
{
446-
let hint_spans: Vec<_> = hint_spans.collect();
447-
span_warn!(self.tcx.sess, hint_spans, E0566, "conflicting representation hints");
449+
struct_span_err!(
450+
self.tcx.sess,
451+
hint_spans.collect::<Vec<Span>>(),
452+
E0566,
453+
"conflicting representation hints",
454+
)
455+
.emit();
448456
}
449457
}
450458

0 commit comments

Comments
 (0)