1
Fork 0

Rename struct_span_err! as struct_span_code_err!.

Because it takes an error code after the span. This avoids the confusing
overlap with the `DiagCtxt::struct_span_err` method, which doesn't take
an error code.
This commit is contained in:
Nicholas Nethercote 2024-01-04 09:08:36 +11:00
parent 99b1b0f85c
commit 4864cb8aef
46 changed files with 277 additions and 224 deletions

View file

@ -60,8 +60,8 @@ use crate::traits::{
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
use rustc_errors::{
error_code, pluralize, struct_span_err, Applicability, DiagCtxt, Diagnostic, DiagnosticBuilder,
DiagnosticStyledString, ErrorGuaranteed, IntoDiagnosticArg,
error_code, pluralize, struct_span_code_err, Applicability, DiagCtxt, Diagnostic,
DiagnosticBuilder, DiagnosticStyledString, ErrorGuaranteed, IntoDiagnosticArg,
};
use rustc_hir as hir;
use rustc_hir::def::DefKind;
@ -2780,7 +2780,7 @@ impl<'tcx> InferCtxt<'tcx> {
infer::Nll(..) => bug!("NLL variable found in lexical phase"),
};
struct_span_err!(
struct_span_code_err!(
self.tcx.dcx(),
var_origin.span(),
E0495,

View file

@ -2,7 +2,7 @@ use super::ObjectSafetyViolation;
use crate::infer::InferCtxt;
use rustc_data_structures::fx::FxIndexSet;
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, MultiSpan};
use rustc_errors::{struct_span_code_err, Applicability, DiagnosticBuilder, MultiSpan};
use rustc_hir as hir;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::intravisit::Map;
@ -20,7 +20,7 @@ impl<'tcx> InferCtxt<'tcx> {
trait_item_def_id: DefId,
requirement: &dyn fmt::Display,
) -> DiagnosticBuilder<'tcx> {
let mut err = struct_span_err!(
let mut err = struct_span_code_err!(
self.tcx.dcx(),
error_span,
E0276,
@ -52,7 +52,7 @@ pub fn report_object_safety_error<'tcx>(
hir::Node::Item(item) => Some(item.ident.span),
_ => None,
});
let mut err = struct_span_err!(
let mut err = struct_span_code_err!(
tcx.dcx(),
span,
E0038,