Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reattach all grandchildren when constructing specialization graph. #54906

Merged
merged 1 commit into from
Nov 15, 2018

Conversation

qnighy
Copy link
Contributor

@qnighy qnighy commented Oct 8, 2018

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.

@rust-highfive
Copy link
Collaborator

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 8, 2018
@TimNN
Copy link
Contributor

TimNN commented Oct 23, 2018

Ping from triage @eddyb: This PR requires your review.

@eddyb
Copy link
Member

eddyb commented Nov 5, 2018

r? @nikomatsakis or @aturon

@rust-highfive rust-highfive assigned nikomatsakis and unassigned eddyb Nov 5, 2018
@eddyb
Copy link
Member

eddyb commented Nov 5, 2018

@TimNN In general, I think @rust-highfive should maybe be made to re-roll, in cases like these.

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Nov 14, 2018

📌 Commit 3a8e0af has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 14, 2018
@nikomatsakis
Copy link
Contributor

Good catch, @qnighy =)

kennytm added a commit to kennytm/rust that referenced this pull request Nov 15, 2018
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 rust-lang#50452.
bors added a commit that referenced this pull request Nov 15, 2018
Rollup of 16 pull requests

Successful merges:

 - #54906 (Reattach all grandchildren when constructing specialization graph.)
 - #55182 (Redox: Update to new changes)
 - #55211 (Add BufWriter::buffer method)
 - #55507 (Add link to std::mem::size_of to size_of intrinsic documentation)
 - #55530 (Speed up String::from_utf16)
 - #55556 (Use `Mmap` to open the rmeta file.)
 - #55622 (NetBSD: link libstd with librt in addition to libpthread)
 - #55827 (A few tweaks to iterations/collecting)
 - #55901 (fix various typos in doc comments)
 - #55926 (Change sidebar selector to fix compatibility with docs.rs)
 - #55930 (A handful of hir tweaks)
 - #55932 (core/char: Speed up `to_digit()` for `radix <= 10`)
 - #55935 (appveyor: Use VS2017 for all our images)
 - #55936 (save-analysis: be even more aggressive about ignorning macro-generated defs)
 - #55948 (submodules: update clippy from d8b4269 to 7e0ddef)
 - #55956 (add tests for some fixed ICEs)
@bors
Copy link
Contributor

bors commented Nov 15, 2018

⌛ Testing commit 3a8e0af with merge 99e3fca...

bors added a commit that referenced this pull request Nov 15, 2018
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.
@bors
Copy link
Contributor

bors commented Nov 15, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 99e3fca to master...

@bors bors merged commit 3a8e0af into rust-lang:master Nov 15, 2018
@qnighy qnighy deleted the fix-issue-50452 branch November 15, 2018 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing module order causes specialization to fail
6 participants