Skip to content

Commit b582f80

Browse files
committedMay 27, 2024
Auto merge of #125410 - fmease:adj-lint-diag-api, r=nnethercote
[perf] Delay the construction of early lint diag structs Attacks some of the perf regressions from #124417 (comment). See individual commits for details. The first three commits are not strictly necessary. However, the 2nd one (06bc4fc, *Remove `LintDiagnostic::msg`*) makes the main change way nicer to implement. It's also pretty sweet on its own if I may say so myself.
2 parents fec98b3 + 37bf2d2 commit b582f80

File tree

50 files changed

+600
-751
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+600
-751
lines changed
 

‎compiler/rustc_codegen_ssa/src/codegen_attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,8 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
576576
lint::builtin::INLINE_NO_SANITIZE,
577577
hir_id,
578578
no_sanitize_span,
579-
"`no_sanitize` will have no effect after inlining",
580579
|lint| {
580+
lint.primary_message("`no_sanitize` will have no effect after inlining");
581581
lint.span_note(inline_span, "inlining requested here");
582582
},
583583
)

‎compiler/rustc_error_messages/src/lib.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -364,17 +364,6 @@ impl From<Cow<'static, str>> for DiagMessage {
364364
}
365365
}
366366

367-
/// A workaround for must_produce_diag ICEs when formatting types in disabled lints.
368-
///
369-
/// Delays formatting until `.into(): DiagMessage` is used.
370-
pub struct DelayDm<F>(pub F);
371-
372-
impl<F: FnOnce() -> String> From<DelayDm<F>> for DiagMessage {
373-
fn from(DelayDm(f): DelayDm<F>) -> Self {
374-
DiagMessage::from(f())
375-
}
376-
}
377-
378367
/// Translating *into* a subdiagnostic message from a diagnostic message is a little strange - but
379368
/// the subdiagnostic functions (e.g. `span_label`) take a `SubdiagMessage` and the
380369
/// subdiagnostic derive refers to typed identifiers that are `DiagMessage`s, so need to be

0 commit comments

Comments
 (0)
Please sign in to comment.