use rls_data::{SigElement, Signature};
+use rustc_ast_pretty::pprust;
use rustc_hir::def::{DefKind, Res};
use syntax::ast::{self, Extern, NodeId};
-use syntax::print::pprust;
pub fn item_signature(item: &ast::Item, scx: &SaveContext<'_, '_>) -> Option<Signature> {
if !scx.config.signatures {
Ok(sig)
}
- ast::ItemKind::Impl(
+ ast::ItemKind::Impl {
unsafety,
polarity,
defaultness,
+ constness,
ref generics,
- ref opt_trait,
- ref ty,
- _,
- ) => {
+ ref of_trait,
+ ref self_ty,
+ items: _,
+ } => {
let mut text = String::new();
if let ast::Defaultness::Default = defaultness {
text.push_str("default ");
text.push_str("unsafe ");
}
text.push_str("impl");
+ if constness == ast::Constness::Const {
+ text.push_str(" const");
+ }
let generics_sig = generics.make(offset + text.len(), id, scx)?;
text.push_str(&generics_sig.text);
text.push(' ');
- let trait_sig = if let Some(ref t) = *opt_trait {
+ let trait_sig = if let Some(ref t) = *of_trait {
if polarity == ast::ImplPolarity::Negative {
text.push('!');
}
text_sig(String::new())
};
- let ty_sig = ty.make(offset + text.len(), id, scx)?;
+ let ty_sig = self_ty.make(offset + text.len(), id, scx)?;
text.push_str(&ty_sig.text);
text.push_str(" {}");