improve diagnostics for const eval query overflow
This commit is contained in:
parent
83853ccdc3
commit
38e10e5619
7 changed files with 32 additions and 26 deletions
|
@ -27,7 +27,7 @@ use rustc_query_system::query::{
|
|||
QueryCache, QueryConfig, QueryContext, QueryJobId, QueryMap, QuerySideEffects, QueryStackFrame,
|
||||
force_query,
|
||||
};
|
||||
use rustc_query_system::{LayoutOfDepth, QueryOverflow};
|
||||
use rustc_query_system::{QueryOverflow, QueryOverflowNote};
|
||||
use rustc_serialize::{Decodable, Encodable};
|
||||
use rustc_session::Limit;
|
||||
use rustc_span::def_id::LOCAL_CRATE;
|
||||
|
@ -154,12 +154,10 @@ impl QueryContext for QueryCtxt<'_> {
|
|||
|
||||
fn depth_limit_error(self, job: QueryJobId) {
|
||||
let mut span = None;
|
||||
let mut layout_of_depth = None;
|
||||
if let Some((info, depth)) =
|
||||
job.try_find_layout_root(self.collect_active_jobs(), dep_kinds::layout_of)
|
||||
{
|
||||
let mut note = None;
|
||||
if let Some((info, depth)) = job.try_find_dep_kind_root(self.collect_active_jobs()) {
|
||||
span = Some(info.job.span);
|
||||
layout_of_depth = Some(LayoutOfDepth { desc: info.query.description, depth });
|
||||
note = Some(QueryOverflowNote { desc: info.query.description, depth });
|
||||
}
|
||||
|
||||
let suggested_limit = match self.recursion_limit() {
|
||||
|
@ -169,7 +167,7 @@ impl QueryContext for QueryCtxt<'_> {
|
|||
|
||||
self.sess.dcx().emit_fatal(QueryOverflow {
|
||||
span,
|
||||
layout_of_depth,
|
||||
note,
|
||||
suggested_limit,
|
||||
crate_name: self.crate_name(LOCAL_CRATE),
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue