Tweak nearest_common_ancestor().#50649
Merged
bors merged 1 commit intorust-lang:masterfrom May 18, 2018
Merged
Conversation
- Remove the "no nearest common ancestor found" case, because it's never hit in practise. (This means `closure_is_enclosed_by` can also be removed.) - Add a comment about why `SmallVec` is used for the "seen" structures. - Use `&Scope` instead of `Scope` to avoid some `map()` calls. - Use `any(p)` instead of `position(p).is_some()`.
| let mut mb = Some(&scope_b); | ||
|
|
||
| // A HashSet<Scope> is a more obvious choice for these, but SmallVec is | ||
| // faster because the set size is normally small so linear search is |
Member
There was a problem hiding this comment.
Did you verify this? It sounds like it should be true but I've run into some surprises because FxHashSet is so fast.
Contributor
Author
There was a problem hiding this comment.
I did verify it. The difference was small but noticeable.
Contributor
|
@bors r+ 🍑 |
Collaborator
|
📌 Commit a91f6f7 has been approved by |
Member
|
@bors rollup |
Mark-Simulacrum
added a commit
to Mark-Simulacrum/rust
that referenced
this pull request
May 17, 2018
…cestor, r=nikomatsakis Tweak `nearest_common_ancestor()`. - Remove the "no nearest common ancestor found" case, because it's never hit in practise. (This means `closure_is_enclosed_by` can also be removed.) - Add a comment about why `SmallVec` is used for the "seen" structures. - Use `&Scope` instead of `Scope` to avoid some `map()` calls. - Use `any(p)` instead of `position(p).is_some()`. r? @nikomatsakis
bors
added a commit
that referenced
this pull request
May 18, 2018
Rollup of 10 pull requests Successful merges: - #50387 (Remove leftover tab in libtest outputs) - #50553 (Add Option::xor method) - #50610 (Improve format string errors) - #50649 (Tweak `nearest_common_ancestor()`.) - #50790 (Fix grammar documentation wrt Unicode identifiers) - #50791 (Fix null exclusions in grammar docs) - #50806 (Add `bless` x.py subcommand for easy ui test replacement) - #50818 (Speed up `opt_normalize_projection_type`) - #50837 (Revert #49767) - #50839 (Make sure people know the book is free oline) Failed merges:
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this pull request
Apr 22, 2021
Remove `ScopeTree::closure_tree` Seems to be dead code since rust-lang#50649.
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this pull request
Apr 22, 2021
Remove `ScopeTree::closure_tree` Seems to be dead code since rust-lang#50649.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove the "no nearest common ancestor found" case, because it's never
hit in practise. (This means
closure_is_enclosed_bycan also beremoved.)
Add a comment about why
SmallVecis used for the "seen" structures.Use
&Scopeinstead ofScopeto avoid somemap()calls.Use
any(p)instead ofposition(p).is_some().r? @nikomatsakis