Introspection : resolve items imports

Hello,

I am trying to manipulate the documentation of a crate via syn. One problem I have is that I want to group together the documentation of structure and its methods, but this require some (potentially complicated) analysis of item paths. For example :

/// Struct documentation
pub struct MyStruct;

type Alias = MyStruct;

mod implementation {
    impl super::Alias { // refers to `MyStruct`
        /// Method documentation
        pub fn method(&self) {
            // ...
        }
    }
}

So I think my options here are :

  1. Use some rustdoc internal mechanism (how ?)
  2. Use a crate that could resolve super::Alias to MyStruct ; to my knowledge, no such crate exists yet...
  3. Use some rustc option to print a 'resolved' version of this file ? (in which impl super::Alias would become impl crate::MyStruct, or something like that... I haven't found one :frowning:)
  4. Parse all use ... and type ... myself... I would rather use a pre-existing tool :sweat_smile:

For now, I haven't found anything and I am stuck to option 4... Is there some crate, or an obvious answer I am missing ?