Add warning annotations to rustdoc-ui tests

This commit is contained in:
Tomasz Miąsko 2019-11-08 00:00:00 +00:00
parent 267fc6dcf6
commit 70b146c2cb
6 changed files with 67 additions and 46 deletions

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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]
| ^^^^^^^^^^^

View File

@ -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

View File

@ -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 | /// \____/
| ^^^^^^