Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
58e901b6fd1163172149fd422565523b17eed5f0
rust/tests/rustdoc-ui/intra-doc/macro-rules.rs

25 lines
297 B
Rust
Raw Normal View History

rustdoc: Special-case macro lookups less Previously, rustdoc had 3 fallbacks it used: 1. `resolve_macro_path` 2. `all_macros` 3. `resolve_str_path_error` Ideally, it would only use `resolve_str_path_error`, to be consistent with other namespaces. Unfortunately, that doesn't consider macros that aren't defined at module scope; consider for instance ```rust { struct S; macro_rules! mac { () => {} } // `mac`'s scope starts here /// `mac` <- `resolve_str_path_error` won't see this struct Z; //`mac`'s scope ends here } ``` This changes it to only use `all_macros` and `resolve_str_path_error`, and gives `resolve_str_path_error` precedence over `all_macros` in case there are two macros with the same name in the same module. This also adds a failing test case which will catch trying to remove `all_macros`.
2022-02-06 18:39:42 -06:00
// check-pass
#![allow(rustdoc::private_intra_doc_links)]
macro_rules! foo {
() => {};
}
/// [foo!]
pub fn baz() {}
rustdoc: Track `macro_rules` scopes during early doc link resolution This way links referring to `macro_rules` items are resolved correctly
2022-04-28 15:52:54 +03:00
#[macro_use]
mod macros {
macro_rules! escaping {
() => {};
}
}
pub mod inner {
/// [foo!]
/// [escaping]
pub fn baz() {
foo!();
}
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 508ms Template: 4ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API