Remove `DelayDm` · rust-lang/rust@9f67c50

3 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -367,17 +367,6 @@ impl From<Cow<'static, str>> for DiagMessage {

367367

}

368368

}

369369
370-

/// A workaround for must_produce_diag ICEs when formatting types in disabled lints.

371-

///

372-

/// Delays formatting until `.into(): DiagMessage` is used.

373-

pub struct DelayDm<F>(pub F);

374-
375-

impl<F: FnOnce() -> String> From<DelayDm<F>> for DiagMessage {

376-

fn from(DelayDm(f): DelayDm<F>) -> Self {

377-

DiagMessage::from(f())

378-

}

379-

}

380-
381370

/// Translating *into* a subdiagnostic message from a diagnostic message is a little strange - but

382371

/// the subdiagnostic functions (e.g. `span_label`) take a `SubdiagMessage` and the

383372

/// subdiagnostic derive refers to typed identifiers that are `DiagMessage`s, so need to be

Original file line numberDiff line numberDiff line change

@@ -39,7 +39,7 @@ pub use diagnostic_impls::{

3939

};

4040

pub use emitter::ColorConfig;

4141

pub use rustc_error_messages::{

42-

fallback_fluent_bundle, fluent_bundle, DelayDm, DiagMessage, FluentBundle, LanguageIdentifier,

42+

fallback_fluent_bundle, fluent_bundle, DiagMessage, FluentBundle, LanguageIdentifier,

4343

LazyFallbackBundle, MultiSpan, SpanLabel, SubdiagMessage,

4444

};

4545

pub use rustc_lint_defs::{pluralize, Applicability};

@@ -572,8 +572,8 @@ impl Drop for DiagCtxtInner {

572572

if let Some(backtrace) = &self.must_produce_diag {

573573

panic!(

574574

"must_produce_diag: `trimmed_def_paths` called but no diagnostics emitted; \

575-

use `DelayDm` for lints or `with_no_trimmed_paths` for debugging. \

576-

called at: {backtrace}"

575+

`with_no_trimmed_paths` for debugging. \

576+

called at: {backtrace}"

577577

);

578578

}

579579

}

Original file line numberDiff line numberDiff line change

@@ -3327,7 +3327,7 @@ fn for_each_def(tcx: TyCtxt<'_>, mut collect_fn: impl for<'b> FnMut(&'b Ident, N

33273327

///

33283328

/// The implementation uses similar import discovery logic to that of 'use' suggestions.

33293329

///

3330-

/// See also [`DelayDm`](rustc_error_messages::DelayDm) and [`with_no_trimmed_paths!`].

3330+

/// See also [`with_no_trimmed_paths!`].

33313331

// this is pub to be able to intra-doc-link it

33323332

pub fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> DefIdMap<Symbol> {

33333333

// Trimming paths is expensive and not optimized, since we expect it to only be used for error