Skip to content

Conversation

@jonas-schievink
Copy link
Contributor

Fixes #5115


/// Maps names of associated items to the item's ID. Only includes items whose defining trait is
/// exported.
assoc_map: FxHashMap<String, SmallVec<[AssocItemId; 1]>>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like it makes sense to use SmalStr here? Or maybe just fold this into fts and use high-order bit of the value to distingusish ItemInNs from AssocItemId?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't put it in the fst because this is currently always queried exactly. I guess I could filter non-exact assoc. item matches out afterwards though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it seems a bit wasteful to do heap allocation for each assoc item. It shouldn't matter that much (as assoc items are very are), but still

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I went with SmolStr since the FST building code is already cursed enough)

Jonas Schievink added 2 commits July 2, 2020 13:34
@matklad
Copy link
Contributor

matklad commented Jul 2, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Jul 2, 2020

@bors bors bot merged commit e75b4fc into rust-lang:master Jul 2, 2020
@jonas-schievink jonas-schievink deleted the trait-method-map branch July 2, 2020 14:07
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.

Trait auto import not working for some cases (e.g. tokio AsyncWriteExt in async method)

2 participants