diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-04-30 09:04:15 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-04-30 09:04:15 +0000 |
| commit | 91f422dfda98b17688986cca817dbff9a4f8b9cb (patch) | |
| tree | 0af0334240959c1499456cb94065e8ea9a127157 /compiler/rustc_monomorphize/src | |
| parent | 9a98c63b30bd8419be662b8fb3f3b22ba33d72c5 (diff) | |
Also report the call site of PME errors locally.
Note this does not produce a full stack all the way to the first call that specifies all monomorphic parameters, it's just shallowly mentioning the last call site.
Diffstat (limited to 'compiler/rustc_monomorphize/src')
| -rw-r--r-- | compiler/rustc_monomorphize/src/collector.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 0e0a4fbc215..1828aecb375 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -182,7 +182,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::sync::{par_iter, MTLock, MTRef, ParallelIterator}; use rustc_hir as hir; use rustc_hir::def::DefKind; -use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId, LOCAL_CRATE}; +use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId}; use rustc_hir::lang_items::LangItem; use rustc_index::bit_set::GrowableBitSet; use rustc_middle::mir::interpret::{AllocId, ConstValue}; @@ -393,6 +393,7 @@ fn collect_items_rec<'tcx>( // error count. If it has changed, a PME occurred, and we trigger some diagnostics about the // current step of mono items collection. // + // FIXME: don't rely on global state, instead bubble up errors. Note: this is very hard to do. let error_count = tcx.sess.diagnostic().err_count(); match starting_point.node { @@ -473,12 +474,9 @@ fn collect_items_rec<'tcx>( } // Check for PMEs and emit a diagnostic if one happened. To try to show relevant edges of the - // mono item graph where the PME diagnostics are currently the most problematic (e.g. ones - // involving a dependency, and the lack of context is confusing) in this MVP, we focus on - // diagnostics on edges crossing a crate boundary: the collected mono items which are not - // defined in the local crate. + // mono item graph. if tcx.sess.diagnostic().err_count() > error_count - && starting_point.node.krate() != LOCAL_CRATE + && starting_point.node.is_generic_fn() && starting_point.node.is_user_defined() { let formatted_item = with_no_trimmed_paths!(starting_point.node.to_string()); |
