about summary refs log tree commit diff
path: root/src/librustc_error_codes
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-04-22 12:18:34 +0200
committerGitHub <noreply@github.com>2020-04-22 12:18:34 +0200
commit372d37b106f4385e28eeeffb60bdfc666ef9f59d (patch)
tree8416ff6e34f75d26d5a99780fcf855a84dd88c86 /src/librustc_error_codes
parent7b1ce6e98ddb97bc70281a6dbaf3c9b2c938917a (diff)
parent038f5b74336f310f495af0c15e4a2b4d0750cfee (diff)
downloadrust-372d37b106f4385e28eeeffb60bdfc666ef9f59d.tar.gz
rust-372d37b106f4385e28eeeffb60bdfc666ef9f59d.zip
Rollup merge of #71214 - GuillaumeGomez:add-error-code-inner-doc-error, r=Dylan-DPC
Add error code for inner doc error

r? @Dylan-DPC

cc @oli-obk
Diffstat (limited to 'src/librustc_error_codes')
-rw-r--r--src/librustc_error_codes/error_codes.rs1
-rw-r--r--src/librustc_error_codes/error_codes/E0753.md31
2 files changed, 32 insertions, 0 deletions
diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs
index bc04809eaa1..9f4b5fd85fd 100644
--- a/src/librustc_error_codes/error_codes.rs
+++ b/src/librustc_error_codes/error_codes.rs
@@ -432,6 +432,7 @@ E0749: include_str!("./error_codes/E0749.md"),
 E0750: include_str!("./error_codes/E0750.md"),
 E0751: include_str!("./error_codes/E0751.md"),
 E0752: include_str!("./error_codes/E0752.md"),
+E0753: include_str!("./error_codes/E0753.md"),
 ;
 //  E0006, // merged with E0005
 //  E0008, // cannot bind by-move into a pattern guard
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() {
+    // ...
+}
+```