I'm currently working on a way to look up item attributes applied to the code item, including ones derived from the parent items.
Short-term goal is to check for
allow(..) attributes in items case diagnostic, but the long-term goal is to provide an interface to make this kind of information to any
hir item that needs it.
So far I'm struggling with finding a way to find a next parent item which has attributes, e.g. `function -> function -> impl block -> mod -> mod -> crate root".
In this example, given the
InnerData structure ID, I would want to sequentially get the IDs of the following items:
impl Data ->
And of course, this structure can be split over multiple files, if that's important.
Ideally, I would want to be able to do the least possible amount of work getting the parent, so that traversal could be efficiently finished once required item is found.
Do you have any hints how to achieve this (or at least direction to think in)?