From 20724ef44954bac578bf0ca8f354f7ae139d2eb5 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 10 Oct 2022 16:49:53 +0200 Subject: [PATCH] Improve error messages --- compiler/rustc_error_messages/locales/en-US/passes.ftl | 2 +- src/librustdoc/visit_ast.rs | 4 ++-- src/test/rustdoc-ui/doc_auto_cfg.stderr | 2 +- src/test/rustdoc-ui/doc_no_auto_cfg.stderr | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_error_messages/locales/en-US/passes.ftl b/compiler/rustc_error_messages/locales/en-US/passes.ftl index cd20d6976aeb2..4a8245ebbe0e9 100644 --- a/compiler/rustc_error_messages/locales/en-US/passes.ftl +++ b/compiler/rustc_error_messages/locales/en-US/passes.ftl @@ -77,7 +77,7 @@ passes_doc_alias_malformed = passes_doc_auto_cfg_malformed = `#![doc({$attr_str})]` attribute doesn't expect a value -passes_doc_both_auto_cfg = please don't specify both `doc(auto_cfg)` and `doc(no_auto_cfg)` +passes_doc_both_auto_cfg = conflicting attributes `doc(auto_cfg)` and `doc(no_auto_cfg)` .label = the other is specified here passes_doc_no_auto_cfg_enabled_by_default = `doc(no_auto_cfg)` is enabled by default before the 2024 edition diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index fe99471975b4d..042b275278c50 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -168,8 +168,8 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { .sess() .diagnostic() .struct_warn( - "the `doc_auto_cfg` feature is used but `#![doc(auto_cfg)]` isn't so it \ - won't do anything", + "feature `doc_auto_cfg` now requires attribute `#![doc(auto_cfg)]` to \ + enable the behavior", ) .emit(); } diff --git a/src/test/rustdoc-ui/doc_auto_cfg.stderr b/src/test/rustdoc-ui/doc_auto_cfg.stderr index 9268eeaae275d..b9c4c6483ba96 100644 --- a/src/test/rustdoc-ui/doc_auto_cfg.stderr +++ b/src/test/rustdoc-ui/doc_auto_cfg.stderr @@ -1,4 +1,4 @@ -warning: the `doc_auto_cfg` feature is used but `#![doc(auto_cfg)]` isn't so it won't do anything +warning: feature `doc_auto_cfg` now requires attribute `#![doc(auto_cfg)]` to enable the behavior warning: 1 warning emitted diff --git a/src/test/rustdoc-ui/doc_no_auto_cfg.stderr b/src/test/rustdoc-ui/doc_no_auto_cfg.stderr index 91fcf0b1a4c46..af47df28d9383 100644 --- a/src/test/rustdoc-ui/doc_no_auto_cfg.stderr +++ b/src/test/rustdoc-ui/doc_no_auto_cfg.stderr @@ -46,7 +46,7 @@ error: `doc(no_auto_cfg)` is enabled by default before the 2024 edition LL | #![doc(auto_cfg, no_auto_cfg)] | ^^^^^^^^^^^ -error: please don't specify both `doc(auto_cfg)` and `doc(no_auto_cfg)` +error: conflicting attributes `doc(auto_cfg)` and `doc(no_auto_cfg)` --> $DIR/doc_no_auto_cfg.rs:3:8 | LL | #![doc(no_auto_cfg)]