File tree 3 files changed +6
-16
lines changed
rustc_trait_selection/src/traits/specialize
3 files changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -32,23 +32,11 @@ pub struct Graph {
32
32
33
33
/// Whether an error was emitted while constructing the graph.
34
34
pub has_errored : bool ,
35
-
36
- /// Overlap mode to be used
37
- pub overlap_mode : OverlapMode ,
38
35
}
39
36
40
37
impl Graph {
41
38
pub fn new ( ) -> Graph {
42
- Graph {
43
- parent : Default :: default ( ) ,
44
- children : Default :: default ( ) ,
45
- has_errored : false ,
46
- overlap_mode : OverlapMode :: Stable ,
47
- }
48
- }
49
-
50
- pub fn set_overlap_mode ( & mut self , overlap_mode : OverlapMode ) {
51
- self . overlap_mode = overlap_mode;
39
+ Graph { parent : Default :: default ( ) , children : Default :: default ( ) , has_errored : false }
52
40
}
53
41
54
42
/// The parent of a given impl, which is the `DefId` of the trait when the
Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ pub(super) fn specialization_graph_provider(
257
257
trait_id : DefId ,
258
258
) -> specialization_graph:: Graph {
259
259
let mut sg = specialization_graph:: Graph :: new ( ) ;
260
- sg . set_overlap_mode ( specialization_graph:: OverlapMode :: get ( tcx, trait_id) ) ;
260
+ let overlap_mode = specialization_graph:: OverlapMode :: get ( tcx, trait_id) ;
261
261
262
262
let mut trait_impls: Vec < _ > = tcx. all_impls ( trait_id) . collect ( ) ;
263
263
@@ -271,7 +271,7 @@ pub(super) fn specialization_graph_provider(
271
271
for impl_def_id in trait_impls {
272
272
if let Some ( impl_def_id) = impl_def_id. as_local ( ) {
273
273
// This is where impl overlap checking happens:
274
- let insert_result = sg. insert ( tcx, impl_def_id. to_def_id ( ) ) ;
274
+ let insert_result = sg. insert ( tcx, impl_def_id. to_def_id ( ) , overlap_mode ) ;
275
275
// Report error if there was one.
276
276
let ( overlap, used_to_be_allowed) = match insert_result {
277
277
Err ( overlap) => ( Some ( overlap) , None ) ,
Original file line number Diff line number Diff line change @@ -277,6 +277,7 @@ pub trait GraphExt {
277
277
& mut self ,
278
278
tcx : TyCtxt < ' _ > ,
279
279
impl_def_id : DefId ,
280
+ overlap_mode : OverlapMode ,
280
281
) -> Result < Option < FutureCompatOverlapError > , OverlapError > ;
281
282
282
283
/// Insert cached metadata mapping from a child impl back to its parent.
@@ -291,6 +292,7 @@ impl GraphExt for Graph {
291
292
& mut self ,
292
293
tcx : TyCtxt < ' _ > ,
293
294
impl_def_id : DefId ,
295
+ overlap_mode : OverlapMode ,
294
296
) -> Result < Option < FutureCompatOverlapError > , OverlapError > {
295
297
assert ! ( impl_def_id. is_local( ) ) ;
296
298
@@ -335,7 +337,7 @@ impl GraphExt for Graph {
335
337
tcx,
336
338
impl_def_id,
337
339
simplified,
338
- self . overlap_mode ,
340
+ overlap_mode,
339
341
) ?;
340
342
341
343
match insert_result {
You can’t perform that action at this time.
0 commit comments