]> git.lizzy.rs Git - rust.git/commit
Auto merge of #54906 - qnighy:fix-issue-50452, r=nikomatsakis
authorbors <bors@rust-lang.org>
Thu, 15 Nov 2018 09:51:53 +0000 (09:51 +0000)
committerbors <bors@rust-lang.org>
Thu, 15 Nov 2018 09:51:53 +0000 (09:51 +0000)
commit99e3fca27d141e2d100ebaf5d5a4104234ae201a
tree87fcbbd4e8a7272f316769a6c2d94b3d85baa7da
parent4ec0ba9545f7c848aafc0bc1b8762507395edd41
parent3a8e0afdbcc0a5c5f27b86d2a062a44410c15e0e
Auto merge of #54906 - qnighy:fix-issue-50452, r=nikomatsakis

Reattach all grandchildren when constructing specialization graph.

Specialization graphs are constructed by incrementally adding impls in the order of declaration. If the impl being added has its specializations in the graph already, they should be reattached under the impl. However, the current implementation only reattaches the one found first. Therefore, in the following specialization graph,

```
  Tr1
   |
   I3
  /  \
 I1  I2
```

If `I1`, `I2`, and `I3` are declared in this order, the compiler mistakenly constructs the following graph:

```
  Tr1
  /  \
 I3  I2
  |
 I1
```

This patch fixes the reattach procedure to include all specializing grandchildren-to-be.

Fixes #50452.
src/librustc/traits/specialize/specialization_graph.rs