Add regression test for ICE when deprecated note is not resolved on the correct DefId

This commit is contained in:
Guillaume Gomez 2026-01-17 17:03:04 +01:00
parent b3a5f53e8f
commit 1faaa76961
2 changed files with 50 additions and 0 deletions

View file

@ -0,0 +1,16 @@
// This test ensures that the intra-doc link from reexported deprecated attribute note
// are resolved where they are declared.
#![deny(rustdoc::broken_intra_doc_links)]
#[doc(inline)]
pub use bar::sql_function_proc as sql_function;
pub fn define_sql_function() {}
pub mod bar {
#[deprecated(note = "Use [`define_sql_function`] instead")]
//~^ ERROR: unresolved link
//~| ERROR: unresolved link
pub fn sql_function_proc() {}
}

View file

@ -0,0 +1,34 @@
error: unresolved link to `define_sql_function`
--> $DIR/deprecated-note-from-reexported.rs:12:25
|
LL | #[deprecated(note = "Use [`define_sql_function`] instead")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the link appears in this line:
Use [`define_sql_function`] instead
^^^^^^^^^^^^^^^^^^^^^
= note: no item named `define_sql_function` in scope
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
note: the lint level is defined here
--> $DIR/deprecated-note-from-reexported.rs:4:9
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: unresolved link to `define_sql_function`
--> $DIR/deprecated-note-from-reexported.rs:12:25
|
LL | #[deprecated(note = "Use [`define_sql_function`] instead")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the link appears in this line:
Use [`define_sql_function`] instead
^^^^^^^^^^^^^^^^^^^^^
= note: no item named `define_sql_function` in scope
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 2 previous errors