Rollup merge of #150883 - improve-deprecated-intra-doc-span, r=camelid
Improve span for "unresolved intra doc link" on `deprecated` attribute Follow-up of rust-lang/rust#150721. To make this work, I replaced the `Symbol` by an `Ident` to keep the `Span` information. cc @folkertdev r? @camelid
This commit is contained in:
commit
dc6afd74dd
9 changed files with 42 additions and 29 deletions
|
|
@ -235,14 +235,14 @@ impl AttributeExt for Attribute {
|
|||
}
|
||||
}
|
||||
|
||||
fn deprecation_note(&self) -> Option<Symbol> {
|
||||
fn deprecation_note(&self) -> Option<Ident> {
|
||||
match &self.kind {
|
||||
AttrKind::Normal(normal) if normal.item.path == sym::deprecated => {
|
||||
let meta = &normal.item;
|
||||
|
||||
// #[deprecated = "..."]
|
||||
if let Some(s) = meta.value_str() {
|
||||
return Some(s);
|
||||
return Some(Ident { name: s, span: meta.span() });
|
||||
}
|
||||
|
||||
// #[deprecated(note = "...")]
|
||||
|
|
@ -252,7 +252,7 @@ impl AttributeExt for Attribute {
|
|||
&& mi.path == sym::note
|
||||
&& let Some(s) = mi.value_str()
|
||||
{
|
||||
return Some(s);
|
||||
return Some(Ident { name: s, span: mi.span });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -905,7 +905,7 @@ pub trait AttributeExt: Debug {
|
|||
/// Returns the deprecation note if this is deprecation attribute.
|
||||
/// * `#[deprecated = "note"]` returns `Some("note")`.
|
||||
/// * `#[deprecated(note = "note", ...)]` returns `Some("note")`.
|
||||
fn deprecation_note(&self) -> Option<Symbol>;
|
||||
fn deprecation_note(&self) -> Option<Ident>;
|
||||
|
||||
fn is_proc_macro_attr(&self) -> bool {
|
||||
[sym::proc_macro, sym::proc_macro_attribute, sym::proc_macro_derive]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue