Skip to content

Commit 020de11

Browse files
committed
Make missing optimized MIR error more informative
1 parent d25496f commit 020de11

File tree

5 files changed

+5
-3
lines changed

5 files changed

+5
-3
lines changed

Diff for: compiler/rustc_monomorphize/messages.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ monomorphize_large_assignments =
4848
.note = The current maximum size is {$limit}, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
4949
5050
monomorphize_no_optimized_mir =
51-
missing optimized MIR for an item in the crate `{$crate_name}`
51+
missing optimized MIR for `{$instance}` in the crate `{$crate_name}`
5252
.note = missing optimized MIR for this item (was the crate `{$crate_name}` compiled with `--emit=metadata`?)
5353
5454
monomorphize_recursion_limit =

Diff for: compiler/rustc_monomorphize/src/collector.rs

+1
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,7 @@ fn should_codegen_locally<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) ->
989989
tcx.dcx().emit_fatal(NoOptimizedMir {
990990
span: tcx.def_span(def_id),
991991
crate_name: tcx.crate_name(def_id.krate),
992+
instance: instance.to_string(),
992993
});
993994
}
994995

Diff for: compiler/rustc_monomorphize/src/errors.rs

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub(crate) struct NoOptimizedMir {
2424
#[note]
2525
pub span: Span,
2626
pub crate_name: Symbol,
27+
pub instance: String,
2728
}
2829

2930
#[derive(LintDiagnostic)]

Diff for: tests/ui/rmeta/no_optitimized_mir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ fn main() {
1010
rmeta_meta::missing_optimized_mir();
1111
}
1212

13-
//~? ERROR missing optimized MIR for an item in the crate `rmeta_meta`
13+
//~? ERROR missing optimized MIR for `missing_optimized_mir` in the crate `rmeta_meta`

Diff for: tests/ui/rmeta/no_optitimized_mir.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: missing optimized MIR for an item in the crate `rmeta_meta`
1+
error: missing optimized MIR for `missing_optimized_mir` in the crate `rmeta_meta`
22
|
33
note: missing optimized MIR for this item (was the crate `rmeta_meta` compiled with `--emit=metadata`?)
44
--> $DIR/auxiliary/rmeta-meta.rs:10:1

0 commit comments

Comments
 (0)