Do not store overlap_mode, just pass it down on insert
This commit is contained in:
parent
a9bfb5d837
commit
0decf14ef1
3 changed files with 6 additions and 16 deletions
|
@ -257,7 +257,7 @@ pub(super) fn specialization_graph_provider(
|
|||
trait_id: DefId,
|
||||
) -> specialization_graph::Graph {
|
||||
let mut sg = specialization_graph::Graph::new();
|
||||
sg.set_overlap_mode(specialization_graph::OverlapMode::get(tcx, trait_id));
|
||||
let overlap_mode = specialization_graph::OverlapMode::get(tcx, trait_id);
|
||||
|
||||
let mut trait_impls: Vec<_> = tcx.all_impls(trait_id).collect();
|
||||
|
||||
|
@ -271,7 +271,7 @@ pub(super) fn specialization_graph_provider(
|
|||
for impl_def_id in trait_impls {
|
||||
if let Some(impl_def_id) = impl_def_id.as_local() {
|
||||
// This is where impl overlap checking happens:
|
||||
let insert_result = sg.insert(tcx, impl_def_id.to_def_id());
|
||||
let insert_result = sg.insert(tcx, impl_def_id.to_def_id(), overlap_mode);
|
||||
// Report error if there was one.
|
||||
let (overlap, used_to_be_allowed) = match insert_result {
|
||||
Err(overlap) => (Some(overlap), None),
|
||||
|
|
|
@ -277,6 +277,7 @@ pub trait GraphExt {
|
|||
&mut self,
|
||||
tcx: TyCtxt<'_>,
|
||||
impl_def_id: DefId,
|
||||
overlap_mode: OverlapMode,
|
||||
) -> Result<Option<FutureCompatOverlapError>, OverlapError>;
|
||||
|
||||
/// Insert cached metadata mapping from a child impl back to its parent.
|
||||
|
@ -291,6 +292,7 @@ impl GraphExt for Graph {
|
|||
&mut self,
|
||||
tcx: TyCtxt<'_>,
|
||||
impl_def_id: DefId,
|
||||
overlap_mode: OverlapMode,
|
||||
) -> Result<Option<FutureCompatOverlapError>, OverlapError> {
|
||||
assert!(impl_def_id.is_local());
|
||||
|
||||
|
@ -335,7 +337,7 @@ impl GraphExt for Graph {
|
|||
tcx,
|
||||
impl_def_id,
|
||||
simplified,
|
||||
self.overlap_mode,
|
||||
overlap_mode,
|
||||
)?;
|
||||
|
||||
match insert_result {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue