From 3390ff97b22e082bb553cc0f175ae5ca18bd5e60 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 22 Apr 2020 11:08:50 +0200 Subject: Add error code to inner doc comment attribute error --- src/librustc_error_codes/error_codes/E0753.md | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/librustc_error_codes/error_codes/E0753.md (limited to 'src/librustc_error_codes/error_codes') diff --git a/src/librustc_error_codes/error_codes/E0753.md b/src/librustc_error_codes/error_codes/E0753.md new file mode 100644 index 00000000000..a69da964aee --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0753.md @@ -0,0 +1,31 @@ +An inner doc comment was used in an invalid context. + +Erroneous code example: + +```compile_fail,E0753 +fn foo() {} +//! foo +// ^ error! +fn main() {} +``` + +Inner document can only be used before items. For example: + +``` +//! A working comment applied to the module! +fn foo() { + //! Another working comment! +} +fn main() {} +``` + +In case you want to document the item following the doc comment, you might want +to use outer doc comment: + +``` +/// I am an outer doc comment +#[doc = "I am also an outer doc comment!"] +fn foo() { + // ... +} +``` -- cgit 1.4.1-3-g733a5