Skip to content

Commit d60e930

Browse files
authored
Rollup merge of rust-lang#100730 - CleanCut:diagnostics-rustc_monomorphize, r=davidtwco
Migrate rustc_monomorphize to use SessionDiagnostic ### Description - Migrates diagnostics in `rustc_monomorphize` to use `SessionDiagnostic` - Adds an `impl IntoDiagnosticArg for PathBuf` ### TODO / Help! - [x] I'm having trouble figuring out how to apply an optional note. 😕 Help!? - Resolved. It was bad docs. Fixed in https://github.com/rust-lang/rustc-dev-guide/pull/1437/files - [x] `errors:RecursionLimit` should be `#[fatal ...]`, but that doesn't exist so it's `#[error ...]` at the moment. - Maybe I can switch after this is merged in? --> rust-lang#100694 - Or maybe I need to manually implement `SessionDiagnostic` instead of deriving it? - [x] How does one go about converting an error inside of [a call to struct_span_lint_hir](https://github.com/rust-lang/rust/blob/8064a495086c2e63c0ef77e8e82fe3b9b5dc535f/compiler/rustc_monomorphize/src/collector.rs#L917-L927)? - [x] ~What placeholder do you use in the fluent template to refer to the value in a vector? It seems like [this code](https://github.com/rust-lang/rust/blob/0b79f758c9aa6646606662a6d623a0752286cd17/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs#L83-L114) ought to have the answer (or something near it)...but I can't figure it out.~ You can't. Punted.
2 parents 5e494b4 + 8c93170 commit d60e930

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/base.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -925,8 +925,11 @@ pub(crate) fn codegen_panic_inner<'tcx>(
925925
args: &[Value],
926926
span: Span,
927927
) {
928-
let def_id =
929-
fx.tcx.lang_items().require(lang_item).unwrap_or_else(|s| fx.tcx.sess.span_fatal(span, &s));
928+
let def_id = fx
929+
.tcx
930+
.lang_items()
931+
.require(lang_item)
932+
.unwrap_or_else(|e| fx.tcx.sess.span_fatal(span, e.to_string()));
930933

931934
let instance = Instance::mono(fx.tcx, def_id).polymorphize(fx.tcx);
932935
let symbol_name = fx.tcx.symbol_name(instance).name;

0 commit comments

Comments
 (0)