correct span, add help message and add UI test when query depth overflows

This commit is contained in:
SparrowLii 2022-09-15 15:45:17 +08:00
parent 44506f38e0
commit 89fd6ae458
8 changed files with 82 additions and 24 deletions

View file

@ -1,5 +1,6 @@
use rustc_errors::AddSubdiagnostic;
use rustc_span::Span;
use rustc_session::Limit;
use rustc_span::{Span, Symbol};
pub struct CycleStack {
pub span: Span,
@ -76,17 +77,20 @@ pub struct IncrementCompilation {
}
#[derive(SessionDiagnostic)]
#[help]
#[diag(query_system::query_overflow)]
pub struct QueryOverflow {
#[primary_span]
pub span: Option<Span>,
#[subdiagnostic]
pub layout_of_depth: Option<LayoutOfDepth>,
pub suggested_limit: Limit,
pub crate_name: Symbol,
}
#[derive(SessionSubdiagnostic)]
#[note(query_system::layout_of_depth)]
pub struct LayoutOfDepth {
#[primary_span]
pub span: Span,
pub desc: String,
pub depth: usize,
}