about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee <46493976+workingjubilee@users.noreply.github.com>2024-06-12 20:03:22 -0700
committerGitHub <noreply@github.com>2024-06-12 20:03:22 -0700
commit9d946a3f6fd52a2eec220f32325e8ee9edcede26 (patch)
tree4badd55e300addc0afae2a97f78a2360490393c4
parentf6cc226f09e959b2862bd14098aa7997dcecbe23 (diff)
parente171e648ea0dfd7af91c3cb8e66b53c516e910c5 (diff)
downloadrust-9d946a3f6fd52a2eec220f32325e8ee9edcede26.tar.gz
rust-9d946a3f6fd52a2eec220f32325e8ee9edcede26.zip
Rollup merge of #126356 - epage:check-cfg, r=Urgau
docs(rustc): Improve discoverable of Cargo docs

In preparing Cargo's blog post for 1.80, I tried to find the documentation for the lint configuration and I couldn't.  The link is only visible from the lint itself, which isn't where I started, and the side bar, which was collapsed for me.

The first place I went was the docs for `unexpected_cfgs` because this is configuration for that lint.  If using lint configuration were a one off, I could see skipping it here.  However, when we discussed this with at least one T-compiler member, there was interest in using this for other lints in the future.  To that end, it seems like we should be exposing this with the lint itself.

The second place I checked was the `check-cfg` documentation.  This now has a call out for the sub-page.
-rw-r--r--compiler/rustc_lint_defs/src/builtin.rs4
-rw-r--r--src/doc/rustc/src/check-cfg.md7
2 files changed, 9 insertions, 2 deletions
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
index 726bd0de129..45051394ffc 100644
--- a/compiler/rustc_lint_defs/src/builtin.rs
+++ b/compiler/rustc_lint_defs/src/builtin.rs
@@ -3257,7 +3257,11 @@ declare_lint! {
     /// See the [Checking Conditional Configurations][check-cfg] section for more
     /// details.
     ///
+    /// See the [Cargo Specifics][unexpected_cfgs_lint_config] section for configuring this lint in
+    /// `Cargo.toml`.
+    ///
     /// [check-cfg]: https://doc.rust-lang.org/nightly/rustc/check-cfg.html
+    /// [unexpected_cfgs_lint_config]: https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html#check-cfg-in-lintsrust-table
     pub UNEXPECTED_CFGS,
     Warn,
     "detects unexpected names and values in `#[cfg]` conditions",
diff --git a/src/doc/rustc/src/check-cfg.md b/src/doc/rustc/src/check-cfg.md
index 8e39adaa438..dfc4871b924 100644
--- a/src/doc/rustc/src/check-cfg.md
+++ b/src/doc/rustc/src/check-cfg.md
@@ -11,8 +11,8 @@ development process.
 In order to accomplish that goal, `rustc` accepts the `--check-cfg` flag, which specifies
 whether to check conditions and how to check them.
 
-> **Note:** No implicit expectation is added when using `--cfg`. Users are expected to
-pass all expected names and values using the _check cfg specification_.
+> **Note:** For interacting with this through Cargo,
+see [Cargo Specifics](check-cfg/cargo-specifics.md) page.
 
 [^reachable]: `rustc` promises to at least check reachable `#[cfg]`, and while non-reachable
 `#[cfg]` are not currently checked, they may well be checked in the future without it being a
@@ -23,6 +23,9 @@ breaking change.
 To specify expected names and values, the _check cfg specification_ provides the `cfg(...)`
 option which enables specifying for an expected config name and it's expected values.
 
+> **Note:** No implicit expectation is added when using `--cfg`. Users are expected to
+pass all expected names and values using the _check cfg specification_.
+
 It has this basic form:
 
 ```bash