Change:
The following scenario used to work fine 1.25.0: This would create two .bc files that could be linked together into a program, but when I try this on 1.26.{0,1,2} the compiler crashes like so:
Possibly dupe/related to ?
Yea I think this is a dupe, handling over there
The issue you mention seems to have something to do with impl trait (and looks like it goes away when the use is removed?) , whereas the issue I posted here crashes with even the simplest rust code. Are they really the same?
Hmm... you're right. I mean impl Trait in the other issue is just the trigger, the cause is in a normal function calling another one, but here you have another crate
I've discovered that if I tell the compiler to emit another type along with like this issue goes away. It makes me suspect this piece of code in : I'm wondering if by not running the code-gen or linking when outputting the metadata is causing this.
Triage: still repros:
Since , doesn't include optimized MIR, so produced rlib cannot be used to perform codegen. It would be nice to detect that particular situtation and produce more meaningful error describing that this is unsupported.
PR with fix:

Discussion:
.label = value moved from here .note = The current maximum size is {$limit}, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]` <ins> monomorphize_no_optimized_mir = missing optimized MIR for an item in the crate `{$crate_name}` .note = missing optimized MIR for this item (was the crate `{$crate_name}` compiled with `--emit=metadata`?) </ins> monomorphize_recursion_limit = reached the recursion limit while instantiating `{$shrunk}` .note = `{$def_path_str}` defined here

use std::path::PathBuf; use crate::errors::{ <del> EncounteredErrorWhileInstantiating, LargeAssignmentsLint, RecursionLimit, TypeLengthLimit, </del> <ins> EncounteredErrorWhileInstantiating, LargeAssignmentsLint, NoOptimizedMir, RecursionLimit, TypeLengthLimit, </ins> }; #[derive(PartialEq)]

} if !tcx.is_mir_available(def_id) { <del> bug!("no MIR available for {:?}", def_id); </del> <ins> tcx.sess.emit_fatal(NoOptimizedMir { span: tcx.def_span(def_id), crate_name: tcx.crate_name(def_id.krate), }); </ins> } true

use rustc_errors::ErrorGuaranteed; use rustc_errors::IntoDiagnostic; use rustc_macros::{Diagnostic, LintDiagnostic}; <del> use rustc_span::Span; </del> <ins> use rustc_span::{Span, Symbol}; </ins> #[derive(Diagnostic)] #[diag(monomorphize_recursion_limit)]

pub type_length: usize, } <ins> #[derive(Diagnostic)] #[diag(monomorphize_no_optimized_mir)] pub struct NoOptimizedMir { #[note] pub span: Span, pub crate_name: Symbol, } </ins> pub struct UnusedGenericParamsHint { pub span: Span, pub param_spans: Vec<Span>,

pub struct Foo { pub field: i32, } <ins> pub fn missing_optimized_mir() { println!("indeed"); } </ins>

<ins> // aux-build:rmeta-meta.rs // no-prefer-dynamic // build-fail // Check that we do not ICE when we need optimized MIR but it is missing. extern crate rmeta_meta; fn main() { rmeta_meta::missing_optimized_mir(); } </ins>

<ins> error: missing optimized MIR for an item in the crate `rmeta_meta` | note: missing optimized MIR for this item (was the crate `rmeta_meta` compiled with `--emit=metadata`?) --> $DIR/auxiliary/rmeta-meta.rs:10:1 | LL | pub fn missing_optimized_mir() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error </ins>