-
Notifications
You must be signed in to change notification settings - Fork 34
item.ident
for ItemKind::Impl
#106
Comments
This isn't up to Syntex, we just copy the parser out of the Rust compiler. I tracked this down to the following pull request from March: rust-lang/rust#32570. @eddyb can I interest you in reintroducing Failing that, you can always build the ident in Rainicorn. The Impl(Unsafety, ImplPolarity, Generics, Option<TraitRef>, P<Ty>, Vec<ImplItem>) The pub fn impl_pretty_name(trait_ref: &Option<TraitRef>, ty: Option<&Ty>) -> Ident {
let mut pretty = match ty {
Some(t) => pprust::ty_to_string(t),
None => String::from("..")
};
match *trait_ref {
Some(ref trait_ref) => {
pretty.push('.');
pretty.push_str(&pprust::path_to_string(&trait_ref.path));
}
None => {}
}
token::gensym_ident(&pretty[..])
} |
@dtolnay No, it was a horrible hack. Usually if you want that kind of information, you have a |
What's a I should note that I pretty much just want the identifier from an |
@eddyb: this is in syntex, so we don't have a |
Not really, no, you can't get anything semantically interesting in that case, so the hack is one of the better options. |
Like I said, for this use case I don't want anything semantic, just pure syntax. I will give @dtolnay code a try then, and report back 👍 |
It used to be with syntax_syntex version 0.28 or that for
item: &Item
that were of kindItemKind::Impl
, theitem.ident
would have the identifier that the impl applied to. However, in recent versions of syntax_syntex, that no longer seems to be the case, the ident is just the empty string. Is there still some straightforward way to obtain that information?The ident for impls was used by the Rainicorn tool to provide Outline/Structure view for IDES.
The text was updated successfully, but these errors were encountered: