Fix invalid jump to def link generated on derive attributes

This commit is contained in:
Guillaume Gomez 2025-10-22 16:58:35 +02:00
parent b2ee1b333a
commit 21db004f58
2 changed files with 4 additions and 2 deletions

View file

@ -7,7 +7,6 @@ use rustc_hir::intravisit::{self, Visitor, VisitorExt};
use rustc_hir::{ExprKind, HirId, Item, ItemKind, Mod, Node, QPath};
use rustc_middle::hir::nested_filter;
use rustc_middle::ty::TyCtxt;
use rustc_span::hygiene::MacroKind;
use rustc_span::{BytePos, ExpnKind};
use crate::clean::{self, PrimitiveType, rustc_span};
@ -194,7 +193,7 @@ impl SpanMapVisitor<'_> {
}
let macro_name = match data.kind {
ExpnKind::Macro(MacroKind::Bang, macro_name) => macro_name,
ExpnKind::Macro(_, macro_name) => macro_name,
// Even though we don't handle this kind of macro, this `data` still comes from
// expansion so we return `true` so we don't go any deeper in this code.
_ => return true,

View file

@ -26,6 +26,9 @@ impl C {
pub fn wat() {}
}
//@ has - '//a[@href="{{channel}}/core/fmt/macros/macro.Debug.html"]' 'Debug'
//@ has - '//a[@href="{{channel}}/core/cmp/macro.PartialEq.html"]' 'PartialEq'
#[derive(Debug, PartialEq)]
pub struct Bar;
impl Trait for Bar {
type T = Foo;