Skip to content

Commit d938ba4

Browse files
committed
coherence: check builtin impls after the specialization graph is ready
Fixes rust-lang#33187.
1 parent 7309bab commit d938ba4

File tree

1 file changed

+5
-11
lines changed
  • src/librustc_typeck/coherence

1 file changed

+5
-11
lines changed

src/librustc_typeck/coherence/mod.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,10 @@ struct CoherenceChecker<'a, 'tcx: 'a> {
3939
tcx: TyCtxt<'a, 'tcx, 'tcx>,
4040
}
4141

42-
struct CoherenceCheckVisitor<'a, 'tcx: 'a> {
43-
cc: &'a CoherenceChecker<'a, 'tcx>,
44-
}
45-
46-
impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for CoherenceCheckVisitor<'a, 'tcx> {
42+
impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for CoherenceChecker<'a, 'tcx> {
4743
fn visit_item(&mut self, item: &Item) {
4844
if let ItemImpl(..) = item.node {
49-
self.cc.check_implementation(item)
45+
self.check_implementation(item)
5046
}
5147
}
5248

@@ -81,14 +77,11 @@ impl<'a, 'tcx> CoherenceChecker<'a, 'tcx> {
8177
}
8278
}
8379

84-
fn check(&self) {
80+
fn check(&mut self) {
8581
// Check implementations and traits. This populates the tables
8682
// containing the inherent methods and extension methods. It also
8783
// builds up the trait inheritance table.
88-
self.tcx.visit_all_item_likes_in_krate(
89-
DepNode::CoherenceCheckImpl,
90-
&mut CoherenceCheckVisitor { cc: self });
91-
builtin::check(self.tcx);
84+
self.tcx.visit_all_item_likes_in_krate(DepNode::CoherenceCheckImpl, self);
9285
}
9386

9487
fn check_implementation(&self, item: &Item) {
@@ -174,4 +167,5 @@ pub fn check_coherence(ccx: &CrateCtxt) {
174167
unsafety::check(ccx.tcx);
175168
orphan::check(ccx.tcx);
176169
overlap::check(ccx.tcx);
170+
builtin::check(ccx.tcx);
177171
}

0 commit comments

Comments
 (0)