File tree 3 files changed +8
-13
lines changed
3 files changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -153,21 +153,16 @@ impl QueryContext for QueryCtxt<'_> {
153
153
}
154
154
155
155
fn depth_limit_error ( self , job : QueryJobId ) {
156
- let mut span = None ;
157
- let mut note = None ;
158
- if let Some ( ( info, depth) ) = job. try_find_dep_kind_root ( self . collect_active_jobs ( ) ) {
159
- span = Some ( info. job . span ) ;
160
- note = Some ( QueryOverflowNote { desc : info. query . description , depth } ) ;
161
- }
156
+ let ( info, depth) = job. find_dep_kind_root ( self . collect_active_jobs ( ) ) ;
162
157
163
158
let suggested_limit = match self . recursion_limit ( ) {
164
159
Limit ( 0 ) => Limit ( 2 ) ,
165
160
limit => limit * 2 ,
166
161
} ;
167
162
168
163
self . sess . dcx ( ) . emit_fatal ( QueryOverflow {
169
- span,
170
- note,
164
+ span : info . job . span ,
165
+ note : QueryOverflowNote { desc : info . query . description , depth } ,
171
166
suggested_limit,
172
167
crate_name : self . crate_name ( LOCAL_CRATE ) ,
173
168
} ) ;
Original file line number Diff line number Diff line change @@ -82,9 +82,9 @@ pub(crate) struct IncrementCompilation {
82
82
#[ diag( query_system_query_overflow) ]
83
83
pub struct QueryOverflow {
84
84
#[ primary_span]
85
- pub span : Option < Span > ,
85
+ pub span : Span ,
86
86
#[ subdiagnostic]
87
- pub note : Option < QueryOverflowNote > ,
87
+ pub note : QueryOverflowNote ,
88
88
pub suggested_limit : Limit ,
89
89
pub crate_name : Symbol ,
90
90
}
Original file line number Diff line number Diff line change @@ -136,18 +136,18 @@ impl QueryJobId {
136
136
137
137
#[ cold]
138
138
#[ inline( never) ]
139
- pub fn try_find_dep_kind_root ( & self , query_map : QueryMap ) -> Option < ( QueryJobInfo , usize ) > {
139
+ pub fn find_dep_kind_root ( & self , query_map : QueryMap ) -> ( QueryJobInfo , usize ) {
140
140
let mut depth = 1 ;
141
141
let info = query_map. get ( & self ) . unwrap ( ) ;
142
142
let dep_kind = info. query . dep_kind ;
143
143
let mut current_id = info. job . parent ;
144
- let mut last_layout = Some ( ( info. clone ( ) , depth) ) ;
144
+ let mut last_layout = ( info. clone ( ) , depth) ;
145
145
146
146
while let Some ( id) = current_id {
147
147
let info = query_map. get ( & id) . unwrap ( ) ;
148
148
if info. query . dep_kind == dep_kind {
149
149
depth += 1 ;
150
- last_layout = Some ( ( info. clone ( ) , depth) ) ;
150
+ last_layout = ( info. clone ( ) , depth) ;
151
151
}
152
152
current_id = info. job . parent ;
153
153
}
You can’t perform that action at this time.
0 commit comments