Rollup merge of #111633 - nnethercote:avoid-ref-format, r=WaffleLapkin
Avoid `&format("...")` calls in error message code. Some error message cleanups. Best reviewed one commit at a time. r? `@davidtwco`
This commit is contained in:
commit
08efb9d652
37 changed files with 139 additions and 147 deletions
|
@ -700,7 +700,11 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
/// Constructs a `TyKind::Error` type and registers a `delay_span_bug` with the given `msg` to
|
||||
/// ensure it gets used.
|
||||
#[track_caller]
|
||||
pub fn ty_error_with_message<S: Into<MultiSpan>>(self, span: S, msg: &str) -> Ty<'tcx> {
|
||||
pub fn ty_error_with_message<S: Into<MultiSpan>>(
|
||||
self,
|
||||
span: S,
|
||||
msg: impl Into<DiagnosticMessage>,
|
||||
) -> Ty<'tcx> {
|
||||
let reported = self.sess.delay_span_bug(span, msg);
|
||||
self.mk_ty_from_kind(Error(reported))
|
||||
}
|
||||
|
@ -2433,7 +2437,7 @@ impl<'tcx> TyCtxtAt<'tcx> {
|
|||
/// Constructs a `TyKind::Error` type and registers a `delay_span_bug` with the given `msg` to
|
||||
/// ensure it gets used.
|
||||
#[track_caller]
|
||||
pub fn ty_error_with_message(self, msg: &str) -> Ty<'tcx> {
|
||||
pub fn ty_error_with_message(self, msg: impl Into<DiagnosticMessage>) -> Ty<'tcx> {
|
||||
self.tcx.ty_error_with_message(self.span, msg)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ pub struct LayoutCx<'tcx, C> {
|
|||
impl<'tcx> LayoutCalculator for LayoutCx<'tcx, TyCtxt<'tcx>> {
|
||||
type TargetDataLayoutRef = &'tcx TargetDataLayout;
|
||||
|
||||
fn delay_bug(&self, txt: &str) {
|
||||
fn delay_bug(&self, txt: String) {
|
||||
self.tcx.sess.delay_span_bug(DUMMY_SP, txt);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue