emit diagnostic after post-monomorphization errors
Emit a diagnostic when the monomorphized item collector encounters errors during a step of the recursive item collection. These post-monomorphization errors otherwise only show the erroneous expression without a trace, making them very obscure and hard to pinpoint whenever they happen in dependencies.
This commit is contained in:
parent
68424e2f01
commit
d14dd9f763
2 changed files with 53 additions and 2 deletions
|
@ -186,6 +186,15 @@ impl<'tcx> MonoItem<'tcx> {
|
|||
pub fn codegen_dep_node(&self, tcx: TyCtxt<'tcx>) -> DepNode {
|
||||
crate::dep_graph::make_compile_mono_item(tcx, self)
|
||||
}
|
||||
|
||||
/// Returns the item's `CrateNum`
|
||||
pub fn krate(&self) -> CrateNum {
|
||||
match self {
|
||||
MonoItem::Fn(ref instance) => instance.def_id().krate,
|
||||
MonoItem::Static(def_id) => def_id.krate,
|
||||
MonoItem::GlobalAsm(..) => LOCAL_CRATE,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for MonoItem<'tcx> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue