about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-02-14 19:08:48 +0100
committerRalf Jung <post@ralfj.de>2024-02-14 19:08:48 +0100
commit7a086ac8875b45adee3d2cff0f024205eb568d8d (patch)
tree138995ac33229aa6af4c1e84d891314800d71afa /src/doc
parent6539a64d73849176ff327b28a55d7d6787f293ef (diff)
parent533e3f0a840cc7d803c508a9732f411ef8682188 (diff)
downloadrust-7a086ac8875b45adee3d2cff0f024205eb568d8d.tar.gz
rust-7a086ac8875b45adee3d2cff0f024205eb568d8d.zip
Merge from rustc
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md18
-rw-r--r--src/doc/rustdoc/src/write-documentation/re-exports.md29
-rw-r--r--src/doc/unstable-book/book.toml1
-rw-r--r--src/doc/unstable-book/src/compiler-flags/check-cfg.md3
4 files changed, 50 insertions, 1 deletions
diff --git a/src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md b/src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md
index 72157b5cd9b..f7a749744e0 100644
--- a/src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md
+++ b/src/doc/rustdoc/src/write-documentation/linking-to-items-by-name.md
@@ -151,3 +151,21 @@ will be given, even if the link fails to resolve. For example, any link containi
 characters will be ignored.
 
 [#72243]: https://github.com/rust-lang/rust/issues/72243
+
+## What happens in case an intra-doc link cannot be generated
+
+In some cases (items behind a `cfg` for example), an intra-doc link cannot be generated to item.
+There are different ways to create a link in markdown, and depending on the one you use, it will
+render differently in this case:
+
+```md
+1. [a]
+2. [b][c]
+3. [d](e)
+4. [f]
+
+[f]: g
+```
+
+`1.` and `2.` will will be displayed as is in the rendered documentation (ie, `[a]` and `[b][c]`)
+whereas `3.` and `4.` will be replaced by a link targetting `e` for `[d](e)` and `g` for `[f]`.
diff --git a/src/doc/rustdoc/src/write-documentation/re-exports.md b/src/doc/rustdoc/src/write-documentation/re-exports.md
index 8ce059cc29c..34688545c74 100644
--- a/src/doc/rustdoc/src/write-documentation/re-exports.md
+++ b/src/doc/rustdoc/src/write-documentation/re-exports.md
@@ -170,3 +170,32 @@ There are a few attributes which are not inlined though:
 
 All other attributes are inherited when inlined, so that the documentation matches the behavior if
 the inlined item was directly defined at the spot where it's shown.
+
+These rules also apply if the item is inlined with a glob re-export:
+
+```rust,ignore (inline)
+mod private_mod {
+    /// First
+    #[cfg(a)]
+    pub struct InPrivate;
+}
+
+#[cfg(c)]
+pub use self::private_mod::*;
+```
+
+Otherwise, the attributes displayed will be from the re-exported item and the attributes on the
+re-export itself will be ignored:
+
+```rust,ignore (inline)
+mod private_mod {
+    /// First
+    #[cfg(a)]
+    pub struct InPrivate;
+}
+
+#[cfg(c)]
+pub use self::private_mod::InPrivate;
+```
+
+In the above case, `cfg(c)` will not be displayed in the docs.
diff --git a/src/doc/unstable-book/book.toml b/src/doc/unstable-book/book.toml
index 0cd56d09404..cef93760b33 100644
--- a/src/doc/unstable-book/book.toml
+++ b/src/doc/unstable-book/book.toml
@@ -4,3 +4,4 @@ author = "The Rust Community"
 
 [output.html]
 git-repository-url = "https://github.com/rust-lang/rust/tree/master/src/doc/unstable-book"
+edit-url-template = "https://github.com/rust-lang/rust/edit/master/src/doc/unstable-book/{path}"
diff --git a/src/doc/unstable-book/src/compiler-flags/check-cfg.md b/src/doc/unstable-book/src/compiler-flags/check-cfg.md
index bf83f6ad7c5..13027eeaf4f 100644
--- a/src/doc/unstable-book/src/compiler-flags/check-cfg.md
+++ b/src/doc/unstable-book/src/compiler-flags/check-cfg.md
@@ -77,10 +77,11 @@ Those well known names and values follows the same stability as what they refer
 Well known names and values checking is always enabled as long as at least one
 `--check-cfg` argument is present.
 
-As of `2024-01-09T`, the list of known names is as follows:
+As of `2024-02-15T`, the list of known names is as follows:
 
 <!--- See CheckCfg::fill_well_known in compiler/rustc_session/src/config.rs -->
 
+ - `clippy`
  - `debug_assertions`
  - `doc`
  - `doctest`