Skip to content

Conversation

fitzgen
Copy link
Member

@fitzgen fitzgen commented Feb 13, 2017

This is a bunch of pre-cursor work to properly determining which template type parameters are actually used or not.

First three commits are mechanical / code motion / renaming.

Fourth is the meat of this PR, making a bunch of things more generic and introducing the concept of an EdgeKind in the IR graph.

Last commit is just cargo fmt.

r? @emilio

Also moves it out to its own ir::traversal module, and moves ItemSet to the
ir::item module.
And its `collect_types` method to `trace`.
This makes the IR traversal infrastructure generic. It makes it so we can use
the same traversal code for whitelisting traversals and asserting no dangling
item references. Therefore the queue of items to visit is generic (whitelisting
uses DFS, while asserting against dangling uses BFS), the storage for the seen
set (whitelisting uses a simple set, asserting against dangling uses a map from
item to the item from which it was discovered).

It also introduces the concept of different kinds of edges in the IR graph, and
the ability to choose which edges to follow. This means we can simplify
non-transitive whitelisting to a simple function that always returns "no do not
follow this edge". It plays an important part for future analysis of which
template declaration type parameters are used or not.
@fitzgen
Copy link
Member Author

fitzgen commented Feb 13, 2017

Also, see the fourth commit's commit message for some more details.

@emilio
Copy link
Contributor

emilio commented Feb 14, 2017

This looks unobjectionable to me, thanks for doing this!

@bors-servo r+

@bors-servo
Copy link

📌 Commit 6d2f907 has been approved by emilio

bors-servo pushed a commit that referenced this pull request Feb 14, 2017
Cleanup IR graph traversal

This is a bunch of pre-cursor work to properly determining which template type parameters are actually used or not.

First three commits are mechanical / code motion / renaming.

Fourth is the meat of this PR, making a bunch of things more generic and introducing the concept of an `EdgeKind` in the IR graph.

Last commit is just `cargo fmt`.

r? @emilio
@bors-servo
Copy link

⌛ Testing commit 6d2f907 with merge 696e2bb...

@bors-servo
Copy link

☀️ Test successful - status-travis
Approved by: emilio
Pushing 696e2bb to master...

@bors-servo bors-servo merged commit 6d2f907 into rust-lang:master Feb 14, 2017
@fitzgen fitzgen deleted the cleanup-ir-graph-traversal branch February 14, 2017 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants