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:
@@ -312,6 +312,7 @@ impl Session {
|
||||
) -> Diag<'a> {
|
||||
let mut err = self.dcx().create_err(err);
|
||||
if err.code.is_none() {
|
||||
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||
err.code(E0658);
|
||||
}
|
||||
add_feature_diagnostics(&mut err, self, feature);
|
||||
@@ -1022,6 +1023,7 @@ fn default_emitter(
|
||||
|
||||
// JUSTIFICATION: literally session construction
|
||||
#[allow(rustc::bad_opt_access)]
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
pub fn build_session(
|
||||
early_dcx: EarlyDiagCtxt,
|
||||
sopts: config::Options,
|
||||
|
||||
Reference in New Issue
Block a user