about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2019-11-08 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2019-11-10 21:01:02 +0100
commit70b146c2cb435880c8a1f05384611e6de50ec2a3 (patch)
tree6b16e686cb725cd75021c2cf872809e932c63094
parent267fc6dcf6bbd5faa67ddd4e0cf74def77051892 (diff)
downloadrust-70b146c2cb435880c8a1f05384611e6de50ec2a3.tar.gz
rust-70b146c2cb435880c8a1f05384611e6de50ec2a3.zip
Add warning annotations to rustdoc-ui tests
-rw-r--r--src/test/rustdoc-ui/intra-links-warning-crlf.rs7
-rw-r--r--src/test/rustdoc-ui/intra-links-warning-crlf.stderr6
-rw-r--r--src/test/rustdoc-ui/intra-links-warning.rs33
-rw-r--r--src/test/rustdoc-ui/intra-links-warning.stderr34
-rw-r--r--src/test/rustdoc-ui/invalid-syntax.rs13
-rw-r--r--src/test/rustdoc-ui/invalid-syntax.stderr20
6 files changed, 67 insertions, 46 deletions
diff --git a/src/test/rustdoc-ui/intra-links-warning-crlf.rs b/src/test/rustdoc-ui/intra-links-warning-crlf.rs
index 67bd9f73eeb..ccd2841ff0b 100644
--- a/src/test/rustdoc-ui/intra-links-warning-crlf.rs
+++ b/src/test/rustdoc-ui/intra-links-warning-crlf.rs
@@ -1,19 +1,21 @@
 // ignore-tidy-cr
-
-// build-pass (FIXME(62277): could be check-pass?)
+// build-pass
 
 // This file checks the spans of intra-link warnings in a file with CRLF line endings. The
 // .gitattributes file in this directory should enforce it.
 
 /// [error]
 pub struct A;
+//~^^ WARNING `[error]` cannot be resolved
 
 ///
 /// docs [error1]
+//~^ WARNING `[error1]` cannot be resolved
 
 /// docs [error2]
 ///
 pub struct B;
+//~^^^ WARNING `[error2]` cannot be resolved
 
 /**
  * This is a multi-line comment.
@@ -21,3 +23,4 @@ pub struct B;
  * It also has an [error].
  */
 pub struct C;
+//~^^^ WARNING `[error]` cannot be resolved
diff --git a/src/test/rustdoc-ui/intra-links-warning-crlf.stderr b/src/test/rustdoc-ui/intra-links-warning-crlf.stderr
index 720f2106e3d..b4e11c29ed5 100644
--- a/src/test/rustdoc-ui/intra-links-warning-crlf.stderr
+++ b/src/test/rustdoc-ui/intra-links-warning-crlf.stderr
@@ -1,5 +1,5 @@
 warning: `[error]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning-crlf.rs:8:6
+  --> $DIR/intra-links-warning-crlf.rs:7:6
    |
 LL | /// [error]
    |      ^^^^^ cannot be resolved, ignoring
@@ -16,7 +16,7 @@ LL | /// docs [error1]
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[error2]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning-crlf.rs:14:11
+  --> $DIR/intra-links-warning-crlf.rs:15:11
    |
 LL | /// docs [error2]
    |           ^^^^^^ cannot be resolved, ignoring
@@ -24,7 +24,7 @@ LL | /// docs [error2]
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[error]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning-crlf.rs:21:20
+  --> $DIR/intra-links-warning-crlf.rs:23:20
    |
 LL |  * It also has an [error].
    |                    ^^^^^ cannot be resolved, ignoring
diff --git a/src/test/rustdoc-ui/intra-links-warning.rs b/src/test/rustdoc-ui/intra-links-warning.rs
index 20770efa953..b0c637521f9 100644
--- a/src/test/rustdoc-ui/intra-links-warning.rs
+++ b/src/test/rustdoc-ui/intra-links-warning.rs
@@ -1,30 +1,37 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// build-pass
 
        //! Test with [Foo::baz], [Bar::foo], ...
+//~^ WARNING `[Foo::baz]` cannot be resolved
+//~| WARNING `[Bar::foo]` cannot be resolved
      //! , [Uniooon::X] and [Qux::Z].
+//~^ WARNING `[Uniooon::X]` cannot be resolved
+//~| WARNING `[Qux::Z]` cannot be resolved
        //!
       //! , [Uniooon::X] and [Qux::Z].
+//~^ WARNING `[Uniooon::X]` cannot be resolved
+//~| WARNING `[Qux::Z]` cannot be resolved
 
        /// [Qux:Y]
+//~^ WARNING `[Qux:Y]` cannot be resolved
 pub struct Foo {
     pub bar: usize,
 }
 
 /// Foo
-/// bar [BarA] bar
+/// bar [BarA] bar //~ WARNING `[BarA]` cannot be resolved
 /// baz
 pub fn a() {}
 
 /**
  * Foo
- * bar [BarB] bar
+ * bar [BarB] bar //~ WARNING `[BarB]` cannot be resolved
  * baz
  */
 pub fn b() {}
 
 /** Foo
 
-bar [BarC] bar
+bar [BarC] bar //~ WARNING `[BarC]` cannot be resolved
 baz
 
     let bar_c_1 = 0;
@@ -35,12 +42,12 @@ baz
 */
 pub fn c() {}
 
-#[doc = "Foo\nbar [BarD] bar\nbaz"]
+#[doc = "Foo\nbar [BarD] bar\nbaz"] //~ WARNING `[BarD]` cannot be resolved
 pub fn d() {}
 
 macro_rules! f {
     ($f:expr) => {
-        #[doc = $f]
+        #[doc = $f] //~ WARNING `[BarF]` cannot be resolved
         pub fn f() {}
     }
 }
@@ -48,30 +55,30 @@ f!("Foo\nbar [BarF] bar\nbaz");
 
 /** # for example,
  *
- * time to introduce a link [error]*/
+ * time to introduce a link [error]*/ //~ WARNING `[error]` cannot be resolved
 pub struct A;
 
 /**
  * # for example,
  *
- * time to introduce a link [error]
+ * time to introduce a link [error] //~ WARNING `[error]` cannot be resolved
  */
 pub struct B;
 
-#[doc = "single line [error]"]
+#[doc = "single line [error]"] //~ WARNING `[error]` cannot be resolved
 pub struct C;
 
-#[doc = "single line with \"escaping\" [error]"]
+#[doc = "single line with \"escaping\" [error]"] //~ WARNING `[error]` cannot be resolved
 pub struct D;
 
-/// Item docs.
+/// Item docs. //~ WARNING `[error]` cannot be resolved
 #[doc="Hello there!"]
 /// [error]
 pub struct E;
 
 ///
-/// docs [error1]
+/// docs [error1] //~ WARNING `[error1]` cannot be resolved
 
-/// docs [error2]
+/// docs [error2] //~ WARNING `[error2]` cannot be resolved
 ///
 pub struct F;
diff --git a/src/test/rustdoc-ui/intra-links-warning.stderr b/src/test/rustdoc-ui/intra-links-warning.stderr
index dac564b3041..27cc3aeb081 100644
--- a/src/test/rustdoc-ui/intra-links-warning.stderr
+++ b/src/test/rustdoc-ui/intra-links-warning.stderr
@@ -16,7 +16,7 @@ LL |        //! Test with [Foo::baz], [Bar::foo], ...
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[Uniooon::X]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning.rs:4:13
+  --> $DIR/intra-links-warning.rs:6:13
    |
 LL |      //! , [Uniooon::X] and [Qux::Z].
    |             ^^^^^^^^^^ cannot be resolved, ignoring
@@ -24,7 +24,7 @@ LL |      //! , [Uniooon::X] and [Qux::Z].
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[Qux::Z]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning.rs:4:30
+  --> $DIR/intra-links-warning.rs:6:30
    |
 LL |      //! , [Uniooon::X] and [Qux::Z].
    |                              ^^^^^^ cannot be resolved, ignoring
@@ -32,7 +32,7 @@ LL |      //! , [Uniooon::X] and [Qux::Z].
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[Uniooon::X]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning.rs:6:14
+  --> $DIR/intra-links-warning.rs:10:14
    |
 LL |       //! , [Uniooon::X] and [Qux::Z].
    |              ^^^^^^^^^^ cannot be resolved, ignoring
@@ -40,7 +40,7 @@ LL |       //! , [Uniooon::X] and [Qux::Z].
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[Qux::Z]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning.rs:6:31
+  --> $DIR/intra-links-warning.rs:10:31
    |
 LL |       //! , [Uniooon::X] and [Qux::Z].
    |                               ^^^^^^ cannot be resolved, ignoring
@@ -48,7 +48,7 @@ LL |       //! , [Uniooon::X] and [Qux::Z].
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[Qux:Y]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning.rs:8:13
+  --> $DIR/intra-links-warning.rs:14:13
    |
 LL |        /// [Qux:Y]
    |             ^^^^^ cannot be resolved, ignoring
@@ -56,7 +56,7 @@ LL |        /// [Qux:Y]
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[error]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning.rs:51:30
+  --> $DIR/intra-links-warning.rs:58:30
    |
 LL |  * time to introduce a link [error]*/
    |                              ^^^^^ cannot be resolved, ignoring
@@ -64,7 +64,7 @@ LL |  * time to introduce a link [error]*/
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[error]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning.rs:57:30
+  --> $DIR/intra-links-warning.rs:64:30
    |
 LL |  * time to introduce a link [error]
    |                              ^^^^^ cannot be resolved, ignoring
@@ -72,7 +72,7 @@ LL |  * time to introduce a link [error]
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[error]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning.rs:61:1
+  --> $DIR/intra-links-warning.rs:68:1
    |
 LL | #[doc = "single line [error]"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -84,7 +84,7 @@ LL | #[doc = "single line [error]"]
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[error]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning.rs:64:1
+  --> $DIR/intra-links-warning.rs:71:1
    |
 LL | #[doc = "single line with \"escaping\" [error]"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -96,7 +96,7 @@ LL | #[doc = "single line with \"escaping\" [error]"]
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[error]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning.rs:67:1
+  --> $DIR/intra-links-warning.rs:74:1
    |
 LL | / /// Item docs.
 LL | | #[doc="Hello there!"]
@@ -110,7 +110,7 @@ LL | | /// [error]
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[error1]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning.rs:73:11
+  --> $DIR/intra-links-warning.rs:80:11
    |
 LL | /// docs [error1]
    |           ^^^^^^ cannot be resolved, ignoring
@@ -118,7 +118,7 @@ LL | /// docs [error1]
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[error2]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning.rs:75:11
+  --> $DIR/intra-links-warning.rs:82:11
    |
 LL | /// docs [error2]
    |           ^^^^^^ cannot be resolved, ignoring
@@ -126,7 +126,7 @@ LL | /// docs [error2]
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[BarA]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning.rs:14:10
+  --> $DIR/intra-links-warning.rs:21:10
    |
 LL | /// bar [BarA] bar
    |          ^^^^ cannot be resolved, ignoring
@@ -134,7 +134,7 @@ LL | /// bar [BarA] bar
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[BarB]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning.rs:20:9
+  --> $DIR/intra-links-warning.rs:27:9
    |
 LL |  * bar [BarB] bar
    |         ^^^^ cannot be resolved, ignoring
@@ -142,7 +142,7 @@ LL |  * bar [BarB] bar
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[BarC]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning.rs:27:6
+  --> $DIR/intra-links-warning.rs:34:6
    |
 LL | bar [BarC] bar
    |      ^^^^ cannot be resolved, ignoring
@@ -150,7 +150,7 @@ LL | bar [BarC] bar
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[BarD]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning.rs:38:1
+  --> $DIR/intra-links-warning.rs:45:1
    |
 LL | #[doc = "Foo\nbar [BarD] bar\nbaz"]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -162,7 +162,7 @@ LL | #[doc = "Foo\nbar [BarD] bar\nbaz"]
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`
 
 warning: `[BarF]` cannot be resolved, ignoring it...
-  --> $DIR/intra-links-warning.rs:43:9
+  --> $DIR/intra-links-warning.rs:50:9
    |
 LL |         #[doc = $f]
    |         ^^^^^^^^^^^
diff --git a/src/test/rustdoc-ui/invalid-syntax.rs b/src/test/rustdoc-ui/invalid-syntax.rs
index 97a0f4aaec1..34e92c42104 100644
--- a/src/test/rustdoc-ui/invalid-syntax.rs
+++ b/src/test/rustdoc-ui/invalid-syntax.rs
@@ -1,9 +1,10 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// build-pass
 
 /// ```
 /// \__________pkt->size___________/          \_result->size_/ \__pkt->size__/
 /// ```
 pub fn foo() {}
+//~^^^^ WARNING could not parse code block as Rust code
 
 /// ```
 ///    |
@@ -11,6 +12,7 @@ pub fn foo() {}
 ///    |     ^^^^^^ did you mean `baz::foobar`?
 /// ```
 pub fn bar() {}
+//~^^^^^^ WARNING could not parse code block as Rust code
 
 /// ```
 /// valid
@@ -24,6 +26,7 @@ pub fn bar() {}
 /// "invalid
 /// ```
 pub fn valid_and_invalid() {}
+//~^^^^^^^^ WARNING could not parse code block as Rust code
 
 /// This is a normal doc comment, but...
 ///
@@ -35,6 +38,7 @@ pub fn valid_and_invalid() {}
 ///
 /// Good thing we tested it!
 pub fn baz() {}
+//~^^^^^^ WARNING could not parse code block as Rust code
 
 /// Indented block start
 ///
@@ -43,6 +47,7 @@ pub fn baz() {}
 ///
 /// Indented block end
 pub fn quux() {}
+//~^^^^^ could not parse code block as Rust code
 
 /// Unclosed fence
 ///
@@ -54,26 +59,31 @@ pub fn xyzzy() {}
 ///
 ///     ```
 pub fn blah() {}
+//~^^ WARNING could not parse code block as Rust code
 
 /// ```edition2018
 /// \_
 /// ```
 pub fn blargh() {}
+//~^^^^ WARNING could not parse code block as Rust code
 
 #[doc = "```"]
 /// \_
 #[doc = "```"]
 pub fn crazy_attrs() {}
+//~^^^^ WARNING doc comment contains an invalid Rust code block
 
 /// ```rust
 /// ```
 pub fn empty_rust() {}
+//~^^^ WARNING Rust code block is empty
 
 /// ```
 ///
 ///
 /// ```
 pub fn empty_rust_with_whitespace() {}
+//~^^^^^ WARNING Rust code block is empty
 
 /// ```
 /// let x = 1;
@@ -82,3 +92,4 @@ pub fn empty_rust_with_whitespace() {}
 ///     \____/
 ///
 pub fn indent_after_fenced() {}
+//~^^^ WARNING could not parse code block as Rust code
diff --git a/src/test/rustdoc-ui/invalid-syntax.stderr b/src/test/rustdoc-ui/invalid-syntax.stderr
index 84c10028fd1..fe5442163ea 100644
--- a/src/test/rustdoc-ui/invalid-syntax.stderr
+++ b/src/test/rustdoc-ui/invalid-syntax.stderr
@@ -53,7 +53,7 @@ help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it
   |                                          ^
 
 warning: could not parse code block as Rust code
-  --> $DIR/invalid-syntax.rs:8:5
+  --> $DIR/invalid-syntax.rs:9:5
    |
 LL |   /// ```
    |  _____^
@@ -75,7 +75,7 @@ error: unknown start of token: \
   | ^
 
 warning: could not parse code block as Rust code
-  --> $DIR/invalid-syntax.rs:19:5
+  --> $DIR/invalid-syntax.rs:21:5
    |
 LL |   /// ```
    |  _____^
@@ -95,7 +95,7 @@ error: unknown start of token: \
   | ^
 
 warning: could not parse code block as Rust code
-  --> $DIR/invalid-syntax.rs:32:5
+  --> $DIR/invalid-syntax.rs:35:5
    |
 LL |   /// ```rust
    |  _____^
@@ -110,7 +110,7 @@ error: unknown start of token: \
   |     ^
 
 warning: could not parse code block as Rust code
-  --> $DIR/invalid-syntax.rs:41:9
+  --> $DIR/invalid-syntax.rs:45:9
    |
 LL |   ///     code with bad syntax
    |  _________^
@@ -151,7 +151,7 @@ help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it
   |   ^
 
 warning: could not parse code block as Rust code
-  --> $DIR/invalid-syntax.rs:55:9
+  --> $DIR/invalid-syntax.rs:60:9
    |
 LL | ///     ```
    |         ^^^
@@ -163,7 +163,7 @@ error: unknown start of token: \
   | ^
 
 warning: could not parse code block as Rust code
-  --> $DIR/invalid-syntax.rs:58:5
+  --> $DIR/invalid-syntax.rs:64:5
    |
 LL |   /// ```edition2018
    |  _____^
@@ -178,7 +178,7 @@ error: unknown start of token: \
   | ^
 
 warning: doc comment contains an invalid Rust code block
-  --> $DIR/invalid-syntax.rs:63:1
+  --> $DIR/invalid-syntax.rs:70:1
    |
 LL | / #[doc = "```"]
 LL | | /// \_
@@ -188,7 +188,7 @@ LL | | #[doc = "```"]
    = help: mark blocks that do not contain Rust code as text: ```text
 
 warning: Rust code block is empty
-  --> $DIR/invalid-syntax.rs:68:5
+  --> $DIR/invalid-syntax.rs:76:5
    |
 LL |   /// ```rust
    |  _____^
@@ -196,7 +196,7 @@ LL | | /// ```
    | |_______^
 
 warning: Rust code block is empty
-  --> $DIR/invalid-syntax.rs:72:5
+  --> $DIR/invalid-syntax.rs:81:5
    |
 LL |   /// ```
    |  _____^
@@ -217,7 +217,7 @@ error: unknown start of token: \
   | ^
 
 warning: could not parse code block as Rust code
-  --> $DIR/invalid-syntax.rs:82:9
+  --> $DIR/invalid-syntax.rs:92:9
    |
 LL | ///     \____/
    |         ^^^^^^