Skip to content

Commit c20c548

Browse files
committed
Rename DiagnosticImportance as DiagImportance.
1 parent de1f540 commit c20c548

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

compiler/rustc_const_eval/src/transform/check_consts/check.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,12 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
318318
assert!(err.is_error());
319319

320320
match op.importance() {
321-
ops::DiagnosticImportance::Primary => {
321+
ops::DiagImportance::Primary => {
322322
let reported = err.emit();
323323
self.error_emitted = Some(reported);
324324
}
325325

326-
ops::DiagnosticImportance::Secondary => self.secondary_errors.push(err),
326+
ops::DiagImportance::Secondary => self.secondary_errors.push(err),
327327
}
328328
}
329329

compiler/rustc_const_eval/src/transform/check_consts/ops.rs

+12-14
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub enum Status {
2929
}
3030

3131
#[derive(Clone, Copy)]
32-
pub enum DiagnosticImportance {
32+
pub enum DiagImportance {
3333
/// An operation that must be removed for const-checking to pass.
3434
Primary,
3535

@@ -44,8 +44,8 @@ pub trait NonConstOp<'tcx>: std::fmt::Debug {
4444
Status::Forbidden
4545
}
4646

47-
fn importance(&self) -> DiagnosticImportance {
48-
DiagnosticImportance::Primary
47+
fn importance(&self) -> DiagImportance {
48+
DiagImportance::Primary
4949
}
5050

5151
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx>;
@@ -427,10 +427,10 @@ impl<'tcx> NonConstOp<'tcx> for TransientCellBorrow {
427427
/// it in the future for static items.
428428
pub struct CellBorrow;
429429
impl<'tcx> NonConstOp<'tcx> for CellBorrow {
430-
fn importance(&self) -> DiagnosticImportance {
430+
fn importance(&self) -> DiagImportance {
431431
// Most likely the code will try to do mutation with these borrows, which
432432
// triggers its own errors. Only show this one if that does not happen.
433-
DiagnosticImportance::Secondary
433+
DiagImportance::Secondary
434434
}
435435
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> {
436436
// FIXME: Maybe a more elegant solution to this if else case
@@ -463,10 +463,10 @@ impl<'tcx> NonConstOp<'tcx> for MutBorrow {
463463
Status::Forbidden
464464
}
465465

466-
fn importance(&self) -> DiagnosticImportance {
466+
fn importance(&self) -> DiagImportance {
467467
// Most likely the code will try to do mutation with these borrows, which
468468
// triggers its own errors. Only show this one if that does not happen.
469-
DiagnosticImportance::Secondary
469+
DiagImportance::Secondary
470470
}
471471

472472
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> {
@@ -515,9 +515,9 @@ impl<'tcx> NonConstOp<'tcx> for MutDeref {
515515
Status::Unstable(sym::const_mut_refs)
516516
}
517517

518-
fn importance(&self) -> DiagnosticImportance {
518+
fn importance(&self) -> DiagImportance {
519519
// Usually a side-effect of a `TransientMutBorrow` somewhere.
520-
DiagnosticImportance::Secondary
520+
DiagImportance::Secondary
521521
}
522522

523523
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> Diag<'tcx> {
@@ -625,12 +625,10 @@ pub mod ty {
625625
Status::Unstable(sym::const_mut_refs)
626626
}
627627

628-
fn importance(&self) -> DiagnosticImportance {
628+
fn importance(&self) -> DiagImportance {
629629
match self.0 {
630-
mir::LocalKind::Temp => DiagnosticImportance::Secondary,
631-
mir::LocalKind::ReturnPointer | mir::LocalKind::Arg => {
632-
DiagnosticImportance::Primary
633-
}
630+
mir::LocalKind::Temp => DiagImportance::Secondary,
631+
mir::LocalKind::ReturnPointer | mir::LocalKind::Arg => DiagImportance::Primary,
634632
}
635633
}
636634

0 commit comments

Comments
 (0)