mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Rollup merge of #94478 - GuillaumeGomez:macro-generated-intra-doc-link, r=notriddle
Fix panic when handling intra doc links generated from macro Fixes #78591. Fixes #92789. r? ``@notriddle``
This commit is contained in:
commit
64e16d379b
@ -178,7 +178,7 @@ crate fn source_span_for_markdown_range(
|
||||
|
||||
'outer: for (line_no, md_line) in md_lines.enumerate() {
|
||||
loop {
|
||||
let source_line = src_lines.next().expect("could not find markdown in source");
|
||||
let source_line = src_lines.next()?;
|
||||
match source_line.find(md_line) {
|
||||
Some(offset) => {
|
||||
if line_no == starting_line {
|
||||
|
1
src/test/rustdoc-ui/auxiliary/module_macro_doc.rs
Normal file
1
src/test/rustdoc-ui/auxiliary/module_macro_doc.rs
Normal file
@ -0,0 +1 @@
|
||||
//! [`long_cat`] is really long
|
12
src/test/rustdoc-ui/macro-docs.rs
Normal file
12
src/test/rustdoc-ui/macro-docs.rs
Normal file
@ -0,0 +1,12 @@
|
||||
// check-pass
|
||||
|
||||
macro_rules! m {
|
||||
() => {
|
||||
/// A
|
||||
//~^ WARNING
|
||||
#[path = "auxiliary/module_macro_doc.rs"]
|
||||
pub mod mymodule;
|
||||
}
|
||||
}
|
||||
|
||||
m!();
|
20
src/test/rustdoc-ui/macro-docs.stderr
Normal file
20
src/test/rustdoc-ui/macro-docs.stderr
Normal file
@ -0,0 +1,20 @@
|
||||
warning: unresolved link to `long_cat`
|
||||
--> $DIR/macro-docs.rs:5:9
|
||||
|
|
||||
LL | /// A
|
||||
| ^^^^^
|
||||
...
|
||||
LL | m!();
|
||||
| ---- in this macro invocation
|
||||
|
|
||||
= note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
|
||||
= note: the link appears in this line:
|
||||
|
||||
[`long_cat`] is really long
|
||||
^^^^^^^^^^
|
||||
= note: no item named `long_cat` in scope
|
||||
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
|
||||
= note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
0
src/test/rustdoc-ui/macro-docs.stdout
Normal file
0
src/test/rustdoc-ui/macro-docs.stdout
Normal file
Loading…
Reference in New Issue
Block a user