@@ -20,17 +20,18 @@ pub struct FutureCompatOverlapError<'tcx> {
20
20
pub kind : FutureCompatOverlapErrorKind ,
21
21
}
22
22
23
- /// The result of attempting to insert an impl into a group of children.
23
+ /// The result of overlap_check, we would attempt to insert an impl into a group of children
24
+ /// afterwards.
24
25
#[ derive( Debug ) ]
25
- enum Inserted < ' tcx > {
26
- /// The impl was inserted as a new child in this group of children.
27
- BecameNewSibling ( Option < FutureCompatOverlapError < ' tcx > > ) ,
26
+ enum OverlapResult < ' tcx > {
27
+ /// The impl is going to be inserted as a new child in this group of children.
28
+ NoOverlap ( Option < FutureCompatOverlapError < ' tcx > > ) ,
28
29
29
30
/// The impl should replace existing impls [X1, ..], because the impl specializes X1, X2, etc.
30
- ReplaceChildren ( Vec < DefId > ) ,
31
+ SpecializeAll ( Vec < DefId > ) ,
31
32
32
33
/// The impl is a specialization of an existing child.
33
- ShouldRecurseOn ( DefId ) ,
34
+ SpecializeOne ( DefId ) ,
34
35
}
35
36
36
37
trait ChildrenExt < ' tcx > {
@@ -43,7 +44,7 @@ trait ChildrenExt<'tcx> {
43
44
impl_def_id : DefId ,
44
45
simplified_self : Option < SimplifiedType > ,
45
46
overlap_mode : OverlapMode ,
46
- ) -> Result < Inserted < ' tcx > , OverlapError < ' tcx > > ;
47
+ ) -> Result < OverlapResult < ' tcx > , OverlapError < ' tcx > > ;
47
48
}
48
49
49
50
impl < ' tcx > ChildrenExt < ' tcx > for Children {
@@ -90,7 +91,7 @@ impl<'tcx> ChildrenExt<'tcx> for Children {
90
91
impl_def_id : DefId ,
91
92
simplified_self : Option < SimplifiedType > ,
92
93
overlap_mode : OverlapMode ,
93
- ) -> Result < Inserted < ' tcx > , OverlapError < ' tcx > > {
94
+ ) -> Result < OverlapResult < ' tcx > , OverlapError < ' tcx > > {
94
95
let mut last_lint = None ;
95
96
let mut replace_children = Vec :: new ( ) ;
96
97
@@ -184,7 +185,7 @@ impl<'tcx> ChildrenExt<'tcx> for Children {
184
185
) ;
185
186
186
187
// The impl specializes `possible_sibling`.
187
- return Ok ( Inserted :: ShouldRecurseOn ( possible_sibling) ) ;
188
+ return Ok ( OverlapResult :: SpecializeOne ( possible_sibling) ) ;
188
189
} else if ge && !le {
189
190
debug ! (
190
191
"placing as parent of TraitRef {:?}" ,
@@ -199,13 +200,13 @@ impl<'tcx> ChildrenExt<'tcx> for Children {
199
200
}
200
201
201
202
if !replace_children. is_empty ( ) {
202
- return Ok ( Inserted :: ReplaceChildren ( replace_children) ) ;
203
+ return Ok ( OverlapResult :: SpecializeAll ( replace_children) ) ;
203
204
}
204
205
205
206
// No overlap with any potential siblings, so add as a new sibling.
206
207
debug ! ( "placing as new sibling" ) ;
207
208
self . insert_blindly ( tcx, impl_def_id) ;
208
- Ok ( Inserted :: BecameNewSibling ( last_lint) )
209
+ Ok ( OverlapResult :: NoOverlap ( last_lint) )
209
210
}
210
211
}
211
212
@@ -306,7 +307,7 @@ impl<'tcx> GraphExt<'tcx> for Graph {
306
307
307
308
// Descend the specialization tree, where `parent` is the current parent node.
308
309
loop {
309
- use self :: Inserted :: * ;
310
+ use self :: OverlapResult :: * ;
310
311
311
312
let insert_result = self . children . entry ( parent) . or_default ( ) . insert (
312
313
tcx,
@@ -316,11 +317,11 @@ impl<'tcx> GraphExt<'tcx> for Graph {
316
317
) ?;
317
318
318
319
match insert_result {
319
- BecameNewSibling ( opt_lint) => {
320
+ NoOverlap ( opt_lint) => {
320
321
last_lint = opt_lint;
321
322
break ;
322
323
}
323
- ReplaceChildren ( grand_children_to_be) => {
324
+ SpecializeAll ( grand_children_to_be) => {
324
325
// We currently have
325
326
//
326
327
// P
@@ -359,7 +360,7 @@ impl<'tcx> GraphExt<'tcx> for Graph {
359
360
}
360
361
break ;
361
362
}
362
- ShouldRecurseOn ( new_parent) => {
363
+ SpecializeOne ( new_parent) => {
363
364
parent = new_parent;
364
365
}
365
366
}
0 commit comments