From bc1fbf55db9671be7bb04bbf5f68b48f8ee17b2e Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Fri, 5 Mar 2021 10:04:22 -0500 Subject: Move rustdoc UI tests into a subdirectory This also adds a little leeway to the test limit. --- src/test/ui/cfg-rustdoc.rs | 6 --- src/test/ui/cfg-rustdoc.stderr | 9 ---- src/test/ui/check-doc-alias-attr-location.rs | 25 ---------- src/test/ui/check-doc-alias-attr-location.stderr | 26 ---------- src/test/ui/check-doc-alias-attr.rs | 16 ------ src/test/ui/check-doc-alias-attr.stderr | 58 ---------------------- src/test/ui/doc-alias-crate-level.rs | 8 --- src/test/ui/doc-alias-crate-level.stderr | 14 ------ src/test/ui/doc-alias-same-name.rs | 4 -- src/test/ui/doc-alias-same-name.stderr | 8 --- src/test/ui/doc_keyword.rs | 12 ----- src/test/ui/doc_keyword.stderr | 20 -------- src/test/ui/lex-bare-cr-nondoc-comment.rs | 9 ---- ...crlf-line-endings-string-literal-doc-comment.rs | 38 -------------- src/test/ui/parser/lex-bare-cr-nondoc-comment.rs | 9 ++++ ...crlf-line-endings-string-literal-doc-comment.rs | 38 ++++++++++++++ src/test/ui/rustdoc/README.md | 3 ++ src/test/ui/rustdoc/cfg-rustdoc.rs | 6 +++ src/test/ui/rustdoc/cfg-rustdoc.stderr | 9 ++++ .../ui/rustdoc/check-doc-alias-attr-location.rs | 25 ++++++++++ .../rustdoc/check-doc-alias-attr-location.stderr | 26 ++++++++++ src/test/ui/rustdoc/check-doc-alias-attr.rs | 16 ++++++ src/test/ui/rustdoc/check-doc-alias-attr.stderr | 58 ++++++++++++++++++++++ src/test/ui/rustdoc/doc-alias-crate-level.rs | 8 +++ src/test/ui/rustdoc/doc-alias-crate-level.stderr | 14 ++++++ src/test/ui/rustdoc/doc-alias-same-name.rs | 4 ++ src/test/ui/rustdoc/doc-alias-same-name.stderr | 8 +++ src/test/ui/rustdoc/doc_keyword.rs | 12 +++++ src/test/ui/rustdoc/doc_keyword.stderr | 20 ++++++++ src/test/ui/rustdoc/unterminated-doc-comment.rs | 1 + .../ui/rustdoc/unterminated-doc-comment.stderr | 9 ++++ src/test/ui/unterminated-doc-comment.rs | 1 - src/test/ui/unterminated-doc-comment.stderr | 9 ---- 33 files changed, 266 insertions(+), 263 deletions(-) delete mode 100644 src/test/ui/cfg-rustdoc.rs delete mode 100644 src/test/ui/cfg-rustdoc.stderr delete mode 100644 src/test/ui/check-doc-alias-attr-location.rs delete mode 100644 src/test/ui/check-doc-alias-attr-location.stderr delete mode 100644 src/test/ui/check-doc-alias-attr.rs delete mode 100644 src/test/ui/check-doc-alias-attr.stderr delete mode 100644 src/test/ui/doc-alias-crate-level.rs delete mode 100644 src/test/ui/doc-alias-crate-level.stderr delete mode 100644 src/test/ui/doc-alias-same-name.rs delete mode 100644 src/test/ui/doc-alias-same-name.stderr delete mode 100644 src/test/ui/doc_keyword.rs delete mode 100644 src/test/ui/doc_keyword.stderr delete mode 100644 src/test/ui/lex-bare-cr-nondoc-comment.rs delete mode 100644 src/test/ui/lexer-crlf-line-endings-string-literal-doc-comment.rs create mode 100644 src/test/ui/parser/lex-bare-cr-nondoc-comment.rs create mode 100644 src/test/ui/parser/lexer-crlf-line-endings-string-literal-doc-comment.rs create mode 100644 src/test/ui/rustdoc/README.md create mode 100644 src/test/ui/rustdoc/cfg-rustdoc.rs create mode 100644 src/test/ui/rustdoc/cfg-rustdoc.stderr create mode 100644 src/test/ui/rustdoc/check-doc-alias-attr-location.rs create mode 100644 src/test/ui/rustdoc/check-doc-alias-attr-location.stderr create mode 100644 src/test/ui/rustdoc/check-doc-alias-attr.rs create mode 100644 src/test/ui/rustdoc/check-doc-alias-attr.stderr create mode 100644 src/test/ui/rustdoc/doc-alias-crate-level.rs create mode 100644 src/test/ui/rustdoc/doc-alias-crate-level.stderr create mode 100644 src/test/ui/rustdoc/doc-alias-same-name.rs create mode 100644 src/test/ui/rustdoc/doc-alias-same-name.stderr create mode 100644 src/test/ui/rustdoc/doc_keyword.rs create mode 100644 src/test/ui/rustdoc/doc_keyword.stderr create mode 100644 src/test/ui/rustdoc/unterminated-doc-comment.rs create mode 100644 src/test/ui/rustdoc/unterminated-doc-comment.stderr delete mode 100644 src/test/ui/unterminated-doc-comment.rs delete mode 100644 src/test/ui/unterminated-doc-comment.stderr (limited to 'src/test') diff --git a/src/test/ui/cfg-rustdoc.rs b/src/test/ui/cfg-rustdoc.rs deleted file mode 100644 index dd8e1ed97c4..00000000000 --- a/src/test/ui/cfg-rustdoc.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[cfg(doc)] -pub struct Foo; - -fn main() { - let f = Foo; //~ ERROR -} diff --git a/src/test/ui/cfg-rustdoc.stderr b/src/test/ui/cfg-rustdoc.stderr deleted file mode 100644 index c687d186989..00000000000 --- a/src/test/ui/cfg-rustdoc.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0425]: cannot find value `Foo` in this scope - --> $DIR/cfg-rustdoc.rs:5:13 - | -LL | let f = Foo; - | ^^^ not found in this scope - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/check-doc-alias-attr-location.rs b/src/test/ui/check-doc-alias-attr-location.rs deleted file mode 100644 index 007d2ae6506..00000000000 --- a/src/test/ui/check-doc-alias-attr-location.rs +++ /dev/null @@ -1,25 +0,0 @@ -#![crate_type="lib"] - -pub struct Bar; -pub trait Foo { - type X; - fn foo() -> Self::X; -} - -#[doc(alias = "foo")] //~ ERROR -extern "C" {} - -#[doc(alias = "bar")] //~ ERROR -impl Bar { - #[doc(alias = "const")] - const A: u32 = 0; -} - -#[doc(alias = "foobar")] //~ ERROR -impl Foo for Bar { - #[doc(alias = "assoc")] //~ ERROR - type X = i32; - fn foo() -> Self::X { - 0 - } -} diff --git a/src/test/ui/check-doc-alias-attr-location.stderr b/src/test/ui/check-doc-alias-attr-location.stderr deleted file mode 100644 index a66e9939eaf..00000000000 --- a/src/test/ui/check-doc-alias-attr-location.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: `#[doc(alias = "...")]` isn't allowed on extern block - --> $DIR/check-doc-alias-attr-location.rs:9:7 - | -LL | #[doc(alias = "foo")] - | ^^^^^^^^^^^^^ - -error: `#[doc(alias = "...")]` isn't allowed on implementation block - --> $DIR/check-doc-alias-attr-location.rs:12:7 - | -LL | #[doc(alias = "bar")] - | ^^^^^^^^^^^^^ - -error: `#[doc(alias = "...")]` isn't allowed on implementation block - --> $DIR/check-doc-alias-attr-location.rs:18:7 - | -LL | #[doc(alias = "foobar")] - | ^^^^^^^^^^^^^^^^ - -error: `#[doc(alias = "...")]` isn't allowed on type alias in implementation block - --> $DIR/check-doc-alias-attr-location.rs:20:11 - | -LL | #[doc(alias = "assoc")] - | ^^^^^^^^^^^^^^^ - -error: aborting due to 4 previous errors - diff --git a/src/test/ui/check-doc-alias-attr.rs b/src/test/ui/check-doc-alias-attr.rs deleted file mode 100644 index 912e35f9165..00000000000 --- a/src/test/ui/check-doc-alias-attr.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![crate_type = "lib"] - -#[doc(alias = "foo")] // ok! -pub struct Bar; - -#[doc(alias)] //~ ERROR -#[doc(alias = 0)] //~ ERROR -#[doc(alias("bar"))] //~ ERROR -#[doc(alias = "\"")] //~ ERROR -#[doc(alias = "\n")] //~ ERROR -#[doc(alias = " -")] //~^ ERROR -#[doc(alias = "\t")] //~ ERROR -#[doc(alias = " hello")] //~ ERROR -#[doc(alias = "hello ")] //~ ERROR -pub struct Foo; diff --git a/src/test/ui/check-doc-alias-attr.stderr b/src/test/ui/check-doc-alias-attr.stderr deleted file mode 100644 index 1c7fc83bb8d..00000000000 --- a/src/test/ui/check-doc-alias-attr.stderr +++ /dev/null @@ -1,58 +0,0 @@ -error: doc alias attribute expects a string: #[doc(alias = "a")] - --> $DIR/check-doc-alias-attr.rs:6:7 - | -LL | #[doc(alias)] - | ^^^^^ - -error: doc alias attribute expects a string: #[doc(alias = "a")] - --> $DIR/check-doc-alias-attr.rs:7:7 - | -LL | #[doc(alias = 0)] - | ^^^^^^^^^ - -error: doc alias attribute expects a string: #[doc(alias = "a")] - --> $DIR/check-doc-alias-attr.rs:8:7 - | -LL | #[doc(alias("bar"))] - | ^^^^^^^^^^^^ - -error: '\"' character isn't allowed in `#[doc(alias = "...")]` - --> $DIR/check-doc-alias-attr.rs:9:15 - | -LL | #[doc(alias = "\"")] - | ^^^^ - -error: '\n' character isn't allowed in `#[doc(alias = "...")]` - --> $DIR/check-doc-alias-attr.rs:10:15 - | -LL | #[doc(alias = "\n")] - | ^^^^ - -error: '\n' character isn't allowed in `#[doc(alias = "...")]` - --> $DIR/check-doc-alias-attr.rs:11:15 - | -LL | #[doc(alias = " - | _______________^ -LL | | ")] - | |_^ - -error: '\t' character isn't allowed in `#[doc(alias = "...")]` - --> $DIR/check-doc-alias-attr.rs:13:15 - | -LL | #[doc(alias = "\t")] - | ^^^^ - -error: `#[doc(alias = "...")]` cannot start or end with ' ' - --> $DIR/check-doc-alias-attr.rs:14:15 - | -LL | #[doc(alias = " hello")] - | ^^^^^^^^ - -error: `#[doc(alias = "...")]` cannot start or end with ' ' - --> $DIR/check-doc-alias-attr.rs:15:15 - | -LL | #[doc(alias = "hello ")] - | ^^^^^^^^ - -error: aborting due to 9 previous errors - diff --git a/src/test/ui/doc-alias-crate-level.rs b/src/test/ui/doc-alias-crate-level.rs deleted file mode 100644 index c7783aae5ea..00000000000 --- a/src/test/ui/doc-alias-crate-level.rs +++ /dev/null @@ -1,8 +0,0 @@ -// compile-flags: -Zdeduplicate-diagnostics=no - -#![crate_type = "lib"] - -#![doc(alias = "not working!")] //~ ERROR - -#[doc(alias = "shouldn't work!")] //~ ERROR -pub struct Foo; diff --git a/src/test/ui/doc-alias-crate-level.stderr b/src/test/ui/doc-alias-crate-level.stderr deleted file mode 100644 index c0467514ae1..00000000000 --- a/src/test/ui/doc-alias-crate-level.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: '\'' character isn't allowed in `#[doc(alias = "...")]` - --> $DIR/doc-alias-crate-level.rs:7:15 - | -LL | #[doc(alias = "shouldn't work!")] - | ^^^^^^^^^^^^^^^^^ - -error: `#![doc(alias = "...")]` isn't allowed as a crate level attribute - --> $DIR/doc-alias-crate-level.rs:5:8 - | -LL | #![doc(alias = "not working!")] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/doc-alias-same-name.rs b/src/test/ui/doc-alias-same-name.rs deleted file mode 100644 index da97c267618..00000000000 --- a/src/test/ui/doc-alias-same-name.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![crate_type = "lib"] - -#[doc(alias = "Foo")] //~ ERROR -pub struct Foo; diff --git a/src/test/ui/doc-alias-same-name.stderr b/src/test/ui/doc-alias-same-name.stderr deleted file mode 100644 index 5ba09a2eae1..00000000000 --- a/src/test/ui/doc-alias-same-name.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: `#[doc(alias = "...")]` is the same as the item's name - --> $DIR/doc-alias-same-name.rs:3:7 - | -LL | #[doc(alias = "Foo")] - | ^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/doc_keyword.rs b/src/test/ui/doc_keyword.rs deleted file mode 100644 index 4c72e7e9684..00000000000 --- a/src/test/ui/doc_keyword.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![crate_type = "lib"] -#![feature(doc_keyword)] - -#![doc(keyword = "hello")] //~ ERROR - -#[doc(keyword = "hell")] //~ ERROR -mod foo { - fn hell() {} -} - -#[doc(keyword = "hall")] //~ ERROR -fn foo() {} diff --git a/src/test/ui/doc_keyword.stderr b/src/test/ui/doc_keyword.stderr deleted file mode 100644 index d72a876163e..00000000000 --- a/src/test/ui/doc_keyword.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: `#[doc(keyword = "...")]` can only be used on empty modules - --> $DIR/doc_keyword.rs:6:7 - | -LL | #[doc(keyword = "hell")] - | ^^^^^^^^^^^^^^^^ - -error: `#[doc(keyword = "...")]` can only be used on modules - --> $DIR/doc_keyword.rs:11:7 - | -LL | #[doc(keyword = "hall")] - | ^^^^^^^^^^^^^^^^ - -error: `#![doc(keyword = "...")]` isn't allowed as a crate level attribute - --> $DIR/doc_keyword.rs:4:8 - | -LL | #![doc(keyword = "hello")] - | ^^^^^^^^^^^^^^^^^ - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/lex-bare-cr-nondoc-comment.rs b/src/test/ui/lex-bare-cr-nondoc-comment.rs deleted file mode 100644 index 5b528d6e1e1..00000000000 --- a/src/test/ui/lex-bare-cr-nondoc-comment.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass -// ignore-tidy-cr - -// nondoc comment with bare CR: ' ' -//// nondoc comment with bare CR: ' ' -/* block nondoc comment with bare CR: ' ' */ - -fn main() { -} diff --git a/src/test/ui/lexer-crlf-line-endings-string-literal-doc-comment.rs b/src/test/ui/lexer-crlf-line-endings-string-literal-doc-comment.rs deleted file mode 100644 index 802be7f5afb..00000000000 --- a/src/test/ui/lexer-crlf-line-endings-string-literal-doc-comment.rs +++ /dev/null @@ -1,38 +0,0 @@ -// run-pass -// ignore-tidy-cr -// ignore-tidy-cr (repeated again because of tidy bug) -// license is ignored because tidy can't handle the CRLF here properly. - -// N.B., this file needs CRLF line endings. The .gitattributes file in -// this directory should enforce it. - -// ignore-pretty issue #37195 - -/// Doc comment that ends in CRLF -pub fn foo() {} - -/** Block doc comment that - * contains CRLF characters - */ -pub fn bar() {} - -fn main() { - let s = "string -literal"; - assert_eq!(s, "string\nliteral"); - - let s = "literal with \ - escaped newline"; - assert_eq!(s, "literal with escaped newline"); - - let s = r"string -literal"; - assert_eq!(s, "string\nliteral"); - let s = br"byte string -literal"; - assert_eq!(s, "byte string\nliteral".as_bytes()); - - // validate that our source file has CRLF endings - let source = include_str!("lexer-crlf-line-endings-string-literal-doc-comment.rs"); - assert!(source.contains("string\r\nliteral")); -} diff --git a/src/test/ui/parser/lex-bare-cr-nondoc-comment.rs b/src/test/ui/parser/lex-bare-cr-nondoc-comment.rs new file mode 100644 index 00000000000..5b528d6e1e1 --- /dev/null +++ b/src/test/ui/parser/lex-bare-cr-nondoc-comment.rs @@ -0,0 +1,9 @@ +// run-pass +// ignore-tidy-cr + +// nondoc comment with bare CR: ' ' +//// nondoc comment with bare CR: ' ' +/* block nondoc comment with bare CR: ' ' */ + +fn main() { +} diff --git a/src/test/ui/parser/lexer-crlf-line-endings-string-literal-doc-comment.rs b/src/test/ui/parser/lexer-crlf-line-endings-string-literal-doc-comment.rs new file mode 100644 index 00000000000..802be7f5afb --- /dev/null +++ b/src/test/ui/parser/lexer-crlf-line-endings-string-literal-doc-comment.rs @@ -0,0 +1,38 @@ +// run-pass +// ignore-tidy-cr +// ignore-tidy-cr (repeated again because of tidy bug) +// license is ignored because tidy can't handle the CRLF here properly. + +// N.B., this file needs CRLF line endings. The .gitattributes file in +// this directory should enforce it. + +// ignore-pretty issue #37195 + +/// Doc comment that ends in CRLF +pub fn foo() {} + +/** Block doc comment that + * contains CRLF characters + */ +pub fn bar() {} + +fn main() { + let s = "string +literal"; + assert_eq!(s, "string\nliteral"); + + let s = "literal with \ + escaped newline"; + assert_eq!(s, "literal with escaped newline"); + + let s = r"string +literal"; + assert_eq!(s, "string\nliteral"); + let s = br"byte string +literal"; + assert_eq!(s, "byte string\nliteral".as_bytes()); + + // validate that our source file has CRLF endings + let source = include_str!("lexer-crlf-line-endings-string-literal-doc-comment.rs"); + assert!(source.contains("string\r\nliteral")); +} diff --git a/src/test/ui/rustdoc/README.md b/src/test/ui/rustdoc/README.md new file mode 100644 index 00000000000..1c98ab038ab --- /dev/null +++ b/src/test/ui/rustdoc/README.md @@ -0,0 +1,3 @@ +This directory is for tests that have to do with rustdoc, but test the behavior +of rustc. For example, rustc should not warn that an attribute rustdoc uses is +unknown. diff --git a/src/test/ui/rustdoc/cfg-rustdoc.rs b/src/test/ui/rustdoc/cfg-rustdoc.rs new file mode 100644 index 00000000000..dd8e1ed97c4 --- /dev/null +++ b/src/test/ui/rustdoc/cfg-rustdoc.rs @@ -0,0 +1,6 @@ +#[cfg(doc)] +pub struct Foo; + +fn main() { + let f = Foo; //~ ERROR +} diff --git a/src/test/ui/rustdoc/cfg-rustdoc.stderr b/src/test/ui/rustdoc/cfg-rustdoc.stderr new file mode 100644 index 00000000000..c687d186989 --- /dev/null +++ b/src/test/ui/rustdoc/cfg-rustdoc.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `Foo` in this scope + --> $DIR/cfg-rustdoc.rs:5:13 + | +LL | let f = Foo; + | ^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/rustdoc/check-doc-alias-attr-location.rs b/src/test/ui/rustdoc/check-doc-alias-attr-location.rs new file mode 100644 index 00000000000..007d2ae6506 --- /dev/null +++ b/src/test/ui/rustdoc/check-doc-alias-attr-location.rs @@ -0,0 +1,25 @@ +#![crate_type="lib"] + +pub struct Bar; +pub trait Foo { + type X; + fn foo() -> Self::X; +} + +#[doc(alias = "foo")] //~ ERROR +extern "C" {} + +#[doc(alias = "bar")] //~ ERROR +impl Bar { + #[doc(alias = "const")] + const A: u32 = 0; +} + +#[doc(alias = "foobar")] //~ ERROR +impl Foo for Bar { + #[doc(alias = "assoc")] //~ ERROR + type X = i32; + fn foo() -> Self::X { + 0 + } +} diff --git a/src/test/ui/rustdoc/check-doc-alias-attr-location.stderr b/src/test/ui/rustdoc/check-doc-alias-attr-location.stderr new file mode 100644 index 00000000000..a66e9939eaf --- /dev/null +++ b/src/test/ui/rustdoc/check-doc-alias-attr-location.stderr @@ -0,0 +1,26 @@ +error: `#[doc(alias = "...")]` isn't allowed on extern block + --> $DIR/check-doc-alias-attr-location.rs:9:7 + | +LL | #[doc(alias = "foo")] + | ^^^^^^^^^^^^^ + +error: `#[doc(alias = "...")]` isn't allowed on implementation block + --> $DIR/check-doc-alias-attr-location.rs:12:7 + | +LL | #[doc(alias = "bar")] + | ^^^^^^^^^^^^^ + +error: `#[doc(alias = "...")]` isn't allowed on implementation block + --> $DIR/check-doc-alias-attr-location.rs:18:7 + | +LL | #[doc(alias = "foobar")] + | ^^^^^^^^^^^^^^^^ + +error: `#[doc(alias = "...")]` isn't allowed on type alias in implementation block + --> $DIR/check-doc-alias-attr-location.rs:20:11 + | +LL | #[doc(alias = "assoc")] + | ^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/rustdoc/check-doc-alias-attr.rs b/src/test/ui/rustdoc/check-doc-alias-attr.rs new file mode 100644 index 00000000000..912e35f9165 --- /dev/null +++ b/src/test/ui/rustdoc/check-doc-alias-attr.rs @@ -0,0 +1,16 @@ +#![crate_type = "lib"] + +#[doc(alias = "foo")] // ok! +pub struct Bar; + +#[doc(alias)] //~ ERROR +#[doc(alias = 0)] //~ ERROR +#[doc(alias("bar"))] //~ ERROR +#[doc(alias = "\"")] //~ ERROR +#[doc(alias = "\n")] //~ ERROR +#[doc(alias = " +")] //~^ ERROR +#[doc(alias = "\t")] //~ ERROR +#[doc(alias = " hello")] //~ ERROR +#[doc(alias = "hello ")] //~ ERROR +pub struct Foo; diff --git a/src/test/ui/rustdoc/check-doc-alias-attr.stderr b/src/test/ui/rustdoc/check-doc-alias-attr.stderr new file mode 100644 index 00000000000..1c7fc83bb8d --- /dev/null +++ b/src/test/ui/rustdoc/check-doc-alias-attr.stderr @@ -0,0 +1,58 @@ +error: doc alias attribute expects a string: #[doc(alias = "a")] + --> $DIR/check-doc-alias-attr.rs:6:7 + | +LL | #[doc(alias)] + | ^^^^^ + +error: doc alias attribute expects a string: #[doc(alias = "a")] + --> $DIR/check-doc-alias-attr.rs:7:7 + | +LL | #[doc(alias = 0)] + | ^^^^^^^^^ + +error: doc alias attribute expects a string: #[doc(alias = "a")] + --> $DIR/check-doc-alias-attr.rs:8:7 + | +LL | #[doc(alias("bar"))] + | ^^^^^^^^^^^^ + +error: '\"' character isn't allowed in `#[doc(alias = "...")]` + --> $DIR/check-doc-alias-attr.rs:9:15 + | +LL | #[doc(alias = "\"")] + | ^^^^ + +error: '\n' character isn't allowed in `#[doc(alias = "...")]` + --> $DIR/check-doc-alias-attr.rs:10:15 + | +LL | #[doc(alias = "\n")] + | ^^^^ + +error: '\n' character isn't allowed in `#[doc(alias = "...")]` + --> $DIR/check-doc-alias-attr.rs:11:15 + | +LL | #[doc(alias = " + | _______________^ +LL | | ")] + | |_^ + +error: '\t' character isn't allowed in `#[doc(alias = "...")]` + --> $DIR/check-doc-alias-attr.rs:13:15 + | +LL | #[doc(alias = "\t")] + | ^^^^ + +error: `#[doc(alias = "...")]` cannot start or end with ' ' + --> $DIR/check-doc-alias-attr.rs:14:15 + | +LL | #[doc(alias = " hello")] + | ^^^^^^^^ + +error: `#[doc(alias = "...")]` cannot start or end with ' ' + --> $DIR/check-doc-alias-attr.rs:15:15 + | +LL | #[doc(alias = "hello ")] + | ^^^^^^^^ + +error: aborting due to 9 previous errors + diff --git a/src/test/ui/rustdoc/doc-alias-crate-level.rs b/src/test/ui/rustdoc/doc-alias-crate-level.rs new file mode 100644 index 00000000000..c7783aae5ea --- /dev/null +++ b/src/test/ui/rustdoc/doc-alias-crate-level.rs @@ -0,0 +1,8 @@ +// compile-flags: -Zdeduplicate-diagnostics=no + +#![crate_type = "lib"] + +#![doc(alias = "not working!")] //~ ERROR + +#[doc(alias = "shouldn't work!")] //~ ERROR +pub struct Foo; diff --git a/src/test/ui/rustdoc/doc-alias-crate-level.stderr b/src/test/ui/rustdoc/doc-alias-crate-level.stderr new file mode 100644 index 00000000000..c0467514ae1 --- /dev/null +++ b/src/test/ui/rustdoc/doc-alias-crate-level.stderr @@ -0,0 +1,14 @@ +error: '\'' character isn't allowed in `#[doc(alias = "...")]` + --> $DIR/doc-alias-crate-level.rs:7:15 + | +LL | #[doc(alias = "shouldn't work!")] + | ^^^^^^^^^^^^^^^^^ + +error: `#![doc(alias = "...")]` isn't allowed as a crate level attribute + --> $DIR/doc-alias-crate-level.rs:5:8 + | +LL | #![doc(alias = "not working!")] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/rustdoc/doc-alias-same-name.rs b/src/test/ui/rustdoc/doc-alias-same-name.rs new file mode 100644 index 00000000000..da97c267618 --- /dev/null +++ b/src/test/ui/rustdoc/doc-alias-same-name.rs @@ -0,0 +1,4 @@ +#![crate_type = "lib"] + +#[doc(alias = "Foo")] //~ ERROR +pub struct Foo; diff --git a/src/test/ui/rustdoc/doc-alias-same-name.stderr b/src/test/ui/rustdoc/doc-alias-same-name.stderr new file mode 100644 index 00000000000..5ba09a2eae1 --- /dev/null +++ b/src/test/ui/rustdoc/doc-alias-same-name.stderr @@ -0,0 +1,8 @@ +error: `#[doc(alias = "...")]` is the same as the item's name + --> $DIR/doc-alias-same-name.rs:3:7 + | +LL | #[doc(alias = "Foo")] + | ^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/rustdoc/doc_keyword.rs b/src/test/ui/rustdoc/doc_keyword.rs new file mode 100644 index 00000000000..4c72e7e9684 --- /dev/null +++ b/src/test/ui/rustdoc/doc_keyword.rs @@ -0,0 +1,12 @@ +#![crate_type = "lib"] +#![feature(doc_keyword)] + +#![doc(keyword = "hello")] //~ ERROR + +#[doc(keyword = "hell")] //~ ERROR +mod foo { + fn hell() {} +} + +#[doc(keyword = "hall")] //~ ERROR +fn foo() {} diff --git a/src/test/ui/rustdoc/doc_keyword.stderr b/src/test/ui/rustdoc/doc_keyword.stderr new file mode 100644 index 00000000000..d72a876163e --- /dev/null +++ b/src/test/ui/rustdoc/doc_keyword.stderr @@ -0,0 +1,20 @@ +error: `#[doc(keyword = "...")]` can only be used on empty modules + --> $DIR/doc_keyword.rs:6:7 + | +LL | #[doc(keyword = "hell")] + | ^^^^^^^^^^^^^^^^ + +error: `#[doc(keyword = "...")]` can only be used on modules + --> $DIR/doc_keyword.rs:11:7 + | +LL | #[doc(keyword = "hall")] + | ^^^^^^^^^^^^^^^^ + +error: `#![doc(keyword = "...")]` isn't allowed as a crate level attribute + --> $DIR/doc_keyword.rs:4:8 + | +LL | #![doc(keyword = "hello")] + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/rustdoc/unterminated-doc-comment.rs b/src/test/ui/rustdoc/unterminated-doc-comment.rs new file mode 100644 index 00000000000..82546fe73da --- /dev/null +++ b/src/test/ui/rustdoc/unterminated-doc-comment.rs @@ -0,0 +1 @@ +/*! //~ ERROR E0758 diff --git a/src/test/ui/rustdoc/unterminated-doc-comment.stderr b/src/test/ui/rustdoc/unterminated-doc-comment.stderr new file mode 100644 index 00000000000..2d5e537973e --- /dev/null +++ b/src/test/ui/rustdoc/unterminated-doc-comment.stderr @@ -0,0 +1,9 @@ +error[E0758]: unterminated block doc-comment + --> $DIR/unterminated-doc-comment.rs:1:1 + | +LL | /*! + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0758`. diff --git a/src/test/ui/unterminated-doc-comment.rs b/src/test/ui/unterminated-doc-comment.rs deleted file mode 100644 index 82546fe73da..00000000000 --- a/src/test/ui/unterminated-doc-comment.rs +++ /dev/null @@ -1 +0,0 @@ -/*! //~ ERROR E0758 diff --git a/src/test/ui/unterminated-doc-comment.stderr b/src/test/ui/unterminated-doc-comment.stderr deleted file mode 100644 index 2d5e537973e..00000000000 --- a/src/test/ui/unterminated-doc-comment.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0758]: unterminated block doc-comment - --> $DIR/unterminated-doc-comment.rs:1:1 - | -LL | /*! - | ^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0758`. -- cgit 1.4.1-3-g733a5