Stream: t-compiler

Topic: Make `associated_items` query work cross crate

ecstatic-morse (Feb 16 2020 at 23:02, on Zulip):

Currently, we have a query that returns a list of the DefIds for all associated items, as well as a query that finds the ty::AssocItem for the associated item with the given DefId using a linear search. Finally, we have an associated_items query which returns a list of ty::AssocItem, but which only works in the local crate. This query is implemented by calling associated_item on each DefId returned by associated_item_def_ids, meaning it takes O(n²) time where n is the number of associated items. The result is cached so we only ever pay this cost once.

ecstatic-morse (Feb 16 2020 at 23:06, on Zulip):

I want to do away with the associated_item_def_ids query and cache the results of associated_items cross-crate. ty::AssocItem is a small, Copy header that already contains the DefId for that item. This would avoid the quadratic behavior.

Last update: May 29 2020 at 18:00UTC