File tree 1 file changed +12
-1
lines changed
src/librustc_mir/interpret
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -529,6 +529,17 @@ pub fn const_eval_provider<'a, 'tcx>(
529
529
} )
530
530
}
531
531
532
+ // This function creates dep graph edges from statics to all referred to statics.
533
+ // This is necessary, because the `const_eval` query cannot directly call itself
534
+ // for other statics, because we cannot prevent recursion in queries.
535
+ //
536
+ // see test/incremental/static_refering_to_other_static2/issue.rs for an example
537
+ // where not creating those edges would cause static A, which refers to static B
538
+ // to point to the old allocation of static B, even though B has changed.
539
+ //
540
+ // In the future we will want to remove this funcion in favour of a system that
541
+ // makes sure that statics don't need to have edges to other statics as long as
542
+ // they are only referring by reference and not inspecting the other static's body.
532
543
fn create_depgraph_edges < ' a , ' tcx > (
533
544
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
534
545
alloc_id : AllocId ,
@@ -548,4 +559,4 @@ fn create_depgraph_edges<'a, 'tcx>(
548
559
}
549
560
}
550
561
}
551
- }
562
+ }
You can’t perform that action at this time.
0 commit comments