Skip to content

Commit ada058d

Browse files
committed
Rename Inserted to OverlapResult
1 parent 478cbb4 commit ada058d

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs

+16-15
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,18 @@ pub struct FutureCompatOverlapError<'tcx> {
2020
pub kind: FutureCompatOverlapErrorKind,
2121
}
2222

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.
2425
#[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>>),
2829

2930
/// The impl should replace existing impls [X1, ..], because the impl specializes X1, X2, etc.
30-
ReplaceChildren(Vec<DefId>),
31+
SpecializeAll(Vec<DefId>),
3132

3233
/// The impl is a specialization of an existing child.
33-
ShouldRecurseOn(DefId),
34+
SpecializeOne(DefId),
3435
}
3536

3637
trait ChildrenExt<'tcx> {
@@ -43,7 +44,7 @@ trait ChildrenExt<'tcx> {
4344
impl_def_id: DefId,
4445
simplified_self: Option<SimplifiedType>,
4546
overlap_mode: OverlapMode,
46-
) -> Result<Inserted<'tcx>, OverlapError<'tcx>>;
47+
) -> Result<OverlapResult<'tcx>, OverlapError<'tcx>>;
4748
}
4849

4950
impl<'tcx> ChildrenExt<'tcx> for Children {
@@ -90,7 +91,7 @@ impl<'tcx> ChildrenExt<'tcx> for Children {
9091
impl_def_id: DefId,
9192
simplified_self: Option<SimplifiedType>,
9293
overlap_mode: OverlapMode,
93-
) -> Result<Inserted<'tcx>, OverlapError<'tcx>> {
94+
) -> Result<OverlapResult<'tcx>, OverlapError<'tcx>> {
9495
let mut last_lint = None;
9596
let mut replace_children = Vec::new();
9697

@@ -184,7 +185,7 @@ impl<'tcx> ChildrenExt<'tcx> for Children {
184185
);
185186

186187
// The impl specializes `possible_sibling`.
187-
return Ok(Inserted::ShouldRecurseOn(possible_sibling));
188+
return Ok(OverlapResult::SpecializeOne(possible_sibling));
188189
} else if ge && !le {
189190
debug!(
190191
"placing as parent of TraitRef {:?}",
@@ -199,13 +200,13 @@ impl<'tcx> ChildrenExt<'tcx> for Children {
199200
}
200201

201202
if !replace_children.is_empty() {
202-
return Ok(Inserted::ReplaceChildren(replace_children));
203+
return Ok(OverlapResult::SpecializeAll(replace_children));
203204
}
204205

205206
// No overlap with any potential siblings, so add as a new sibling.
206207
debug!("placing as new sibling");
207208
self.insert_blindly(tcx, impl_def_id);
208-
Ok(Inserted::BecameNewSibling(last_lint))
209+
Ok(OverlapResult::NoOverlap(last_lint))
209210
}
210211
}
211212

@@ -306,7 +307,7 @@ impl<'tcx> GraphExt<'tcx> for Graph {
306307

307308
// Descend the specialization tree, where `parent` is the current parent node.
308309
loop {
309-
use self::Inserted::*;
310+
use self::OverlapResult::*;
310311

311312
let insert_result = self.children.entry(parent).or_default().insert(
312313
tcx,
@@ -316,11 +317,11 @@ impl<'tcx> GraphExt<'tcx> for Graph {
316317
)?;
317318

318319
match insert_result {
319-
BecameNewSibling(opt_lint) => {
320+
NoOverlap(opt_lint) => {
320321
last_lint = opt_lint;
321322
break;
322323
}
323-
ReplaceChildren(grand_children_to_be) => {
324+
SpecializeAll(grand_children_to_be) => {
324325
// We currently have
325326
//
326327
// P
@@ -359,7 +360,7 @@ impl<'tcx> GraphExt<'tcx> for Graph {
359360
}
360361
break;
361362
}
362-
ShouldRecurseOn(new_parent) => {
363+
SpecializeOne(new_parent) => {
363364
parent = new_parent;
364365
}
365366
}

0 commit comments

Comments
 (0)