Rollup merge of #121382 - nnethercote:rework-untranslatable_diagnostic-lint, r=davidtwco
Rework `untranslatable_diagnostic` lint Currently it only checks calls to functions marked with `#[rustc_lint_diagnostics]`. This PR changes it to check calls to any function with an `impl Into<{D,Subd}iagnosticMessage>` parameter. This greatly improves its coverage and doesn't rely on people remembering to add `#[rustc_lint_diagnostics]`. It also lets us add `#[rustc_lint_diagnostics]` to a number of functions that don't have an `impl Into<{D,Subd}iagnosticMessage>`, such as `Diag::span`. r? ``@davidtwco``
This commit is contained in:
commit
efe9deace8
42 changed files with 305 additions and 89 deletions
|
@ -17,6 +17,7 @@ use rustc_target::abi::call::FnAbi;
|
|||
use rustc_target::abi::*;
|
||||
use rustc_target::spec::{abi::Abi as SpecAbi, HasTargetSpec, PanicStrategy, Target};
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::cmp;
|
||||
use std::fmt;
|
||||
use std::num::NonZero;
|
||||
|
@ -268,7 +269,7 @@ pub struct LayoutCx<'tcx, C> {
|
|||
impl<'tcx> LayoutCalculator for LayoutCx<'tcx, TyCtxt<'tcx>> {
|
||||
type TargetDataLayoutRef = &'tcx TargetDataLayout;
|
||||
|
||||
fn delayed_bug(&self, txt: String) {
|
||||
fn delayed_bug(&self, txt: impl Into<Cow<'static, str>>) {
|
||||
self.tcx.dcx().delayed_bug(txt);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue