Finish fixing ui tests
This commit is contained in:
parent
d1277ccffa
commit
e4f57dd4b3
18 changed files with 471 additions and 186 deletions
|
|
@ -442,7 +442,12 @@ impl DocParser {
|
|||
cx.emit_lint(AttributeLintKind::DocUnknownAny { name }, path.span());
|
||||
}
|
||||
None => {
|
||||
// FIXME: is there anything to do in this case?
|
||||
let full_name =
|
||||
path.segments().map(|s| s.as_str()).intersperse("::").collect::<String>();
|
||||
cx.emit_lint(
|
||||
AttributeLintKind::DocUnknownAny { name: Symbol::intern(&full_name) },
|
||||
path.span(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@
|
|||
#![recursion_limit = "256"]
|
||||
// tidy-alphabetical-end
|
||||
#![feature(if_let_guard)]
|
||||
#![feature(iter_intersperse)]
|
||||
|
||||
#[macro_use]
|
||||
/// All the individual attribute parsers for each of rustc's built-in attributes.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ error: unknown `doc` attribute `passes`
|
|||
--> $DIR/deprecated-attrs.rs:9:8
|
||||
|
|
||||
LL | #![doc(passes = "collapse-docs unindent-comments")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no longer functions
|
||||
| ^^^^^^ no longer functions
|
||||
|
|
||||
= note: `doc` attribute `passes` no longer functions; see issue #44136 <https://github.com/rust-lang/rust/issues/44136>
|
||||
= note: `doc(passes)` is now a no-op
|
||||
|
|
@ -26,7 +26,7 @@ error: unknown `doc` attribute `plugins`
|
|||
--> $DIR/deprecated-attrs.rs:14:8
|
||||
|
|
||||
LL | #![doc(plugins = "xxx")]
|
||||
| ^^^^^^^^^^^^^^^ no longer functions
|
||||
| ^^^^^^^ no longer functions
|
||||
|
|
||||
= note: `doc` attribute `plugins` no longer functions; see issue #44136 <https://github.com/rust-lang/rust/issues/44136> and CVE-2018-1000622 <https://nvd.nist.gov/vuln/detail/CVE-2018-1000622>
|
||||
= note: `doc(plugins)` is now a no-op
|
||||
|
|
|
|||
|
|
@ -1,4 +1 @@
|
|||
#![doc(alias = "crate-level-not-working")] //~ ERROR
|
||||
|
||||
#[doc(alias = "shouldn't work!")] //~ ERROR
|
||||
pub fn foo() {}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,8 @@
|
|||
error: '\'' character isn't allowed in `#[doc(alias = "...")]`
|
||||
--> $DIR/doc-alias-crate-level.rs:3:15
|
||||
|
|
||||
LL | #[doc(alias = "shouldn't work!")]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: `#![doc(alias = "...")]` isn't allowed as a crate-level attribute
|
||||
--> $DIR/doc-alias-crate-level.rs:1:8
|
||||
--> $DIR/doc-alias-crate-level.rs:1:16
|
||||
|
|
||||
LL | #![doc(alias = "crate-level-not-working")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
|
|||
2
tests/rustdoc-ui/doc-alias.rs
Normal file
2
tests/rustdoc-ui/doc-alias.rs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#[doc(alias = "shouldn't work!")] //~ ERROR
|
||||
pub fn foo() {}
|
||||
8
tests/rustdoc-ui/doc-alias.stderr
Normal file
8
tests/rustdoc-ui/doc-alias.stderr
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
error: '\'' character isn't allowed in `#[doc(alias = "...")]`
|
||||
--> $DIR/doc-alias.rs:1:15
|
||||
|
|
||||
LL | #[doc(alias = "shouldn't work!")]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
16
tests/rustdoc-ui/doc-cfg-2.rs
Normal file
16
tests/rustdoc-ui/doc-cfg-2.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#![feature(doc_cfg)]
|
||||
|
||||
#[doc(cfg(foo), cfg(bar))]
|
||||
//~^ WARN unexpected `cfg` condition name: `foo`
|
||||
//~| WARN unexpected `cfg` condition name: `bar`
|
||||
#[doc(auto_cfg(42))] //~ ERROR
|
||||
#[doc(auto_cfg(hide(true)))] //~ ERROR
|
||||
#[doc(auto_cfg(hide(42)))] //~ ERROR
|
||||
#[doc(auto_cfg(hide("a")))] //~ ERROR
|
||||
#[doc(auto_cfg = 42)] //~ ERROR
|
||||
#[doc(auto_cfg = "a")] //~ ERROR
|
||||
// Shouldn't lint
|
||||
#[doc(auto_cfg(hide(windows)))]
|
||||
#[doc(auto_cfg(hide(feature = "windows")))]
|
||||
#[doc(auto_cfg(hide(foo)))]
|
||||
pub fn foo() {}
|
||||
60
tests/rustdoc-ui/doc-cfg-2.stderr
Normal file
60
tests/rustdoc-ui/doc-cfg-2.stderr
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
warning: unexpected `cfg` condition name: `foo`
|
||||
--> $DIR/doc-cfg-2.rs:3:11
|
||||
|
|
||||
LL | #[doc(cfg(foo), cfg(bar))]
|
||||
| ^^^
|
||||
|
|
||||
= help: expected names are: `FALSE` and `test` and 31 more
|
||||
= help: to expect this configuration use `--check-cfg=cfg(foo)`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
||||
warning: unexpected `cfg` condition name: `bar`
|
||||
--> $DIR/doc-cfg-2.rs:3:21
|
||||
|
|
||||
LL | #[doc(cfg(foo), cfg(bar))]
|
||||
| ^^^
|
||||
|
|
||||
= help: to expect this configuration use `--check-cfg=cfg(bar)`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
error: only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`
|
||||
--> $DIR/doc-cfg-2.rs:6:16
|
||||
|
|
||||
LL | #[doc(auto_cfg(42))]
|
||||
| ^^
|
||||
|
|
||||
= note: `#[deny(invalid_doc_attributes)]` on by default
|
||||
|
||||
error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value items
|
||||
--> $DIR/doc-cfg-2.rs:7:21
|
||||
|
|
||||
LL | #[doc(auto_cfg(hide(true)))]
|
||||
| ^^^^
|
||||
|
||||
error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value items
|
||||
--> $DIR/doc-cfg-2.rs:8:21
|
||||
|
|
||||
LL | #[doc(auto_cfg(hide(42)))]
|
||||
| ^^
|
||||
|
||||
error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value items
|
||||
--> $DIR/doc-cfg-2.rs:9:21
|
||||
|
|
||||
LL | #[doc(auto_cfg(hide("a")))]
|
||||
| ^^^
|
||||
|
||||
error: expected boolean for `#[doc(auto_cfg = ...)]`
|
||||
--> $DIR/doc-cfg-2.rs:10:18
|
||||
|
|
||||
LL | #[doc(auto_cfg = 42)]
|
||||
| ^^
|
||||
|
||||
error: expected boolean for `#[doc(auto_cfg = ...)]`
|
||||
--> $DIR/doc-cfg-2.rs:11:18
|
||||
|
|
||||
LL | #[doc(auto_cfg = "a")]
|
||||
| ^^^
|
||||
|
||||
error: aborting due to 6 previous errors; 2 warnings emitted
|
||||
|
||||
|
|
@ -1,22 +1,9 @@
|
|||
#![feature(doc_cfg)]
|
||||
|
||||
#[doc(cfg(), cfg(foo, bar))]
|
||||
//~^ ERROR
|
||||
//~^^ ERROR
|
||||
#[doc(cfg(foo), cfg(bar))]
|
||||
//~^ WARN unexpected `cfg` condition name: `foo`
|
||||
//~^^ WARN unexpected `cfg` condition name: `bar`
|
||||
//~^ ERROR malformed `doc` attribute input
|
||||
//~| ERROR malformed `doc` attribute input
|
||||
#[doc(cfg())] //~ ERROR
|
||||
#[doc(cfg(foo, bar))] //~ ERROR
|
||||
#[doc(auto_cfg(42))] //~ ERROR
|
||||
#[doc(auto_cfg(hide(true)))] //~ ERROR
|
||||
#[doc(auto_cfg(hide(42)))] //~ ERROR
|
||||
#[doc(auto_cfg(hide("a")))] //~ ERROR
|
||||
#[doc(auto_cfg(hide(foo::bar)))] //~ ERROR
|
||||
#[doc(auto_cfg = 42)] //~ ERROR
|
||||
#[doc(auto_cfg = "a")] //~ ERROR
|
||||
// Shouldn't lint
|
||||
#[doc(auto_cfg(hide(windows)))]
|
||||
#[doc(auto_cfg(hide(feature = "windows")))]
|
||||
#[doc(auto_cfg(hide(foo)))]
|
||||
pub fn foo() {}
|
||||
|
|
|
|||
|
|
@ -1,90 +1,119 @@
|
|||
error: only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`
|
||||
--> $DIR/doc-cfg.rs:11:7
|
||||
|
|
||||
LL | #[doc(auto_cfg(42))]
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[deny(invalid_doc_attributes)]` on by default
|
||||
|
||||
error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value items
|
||||
--> $DIR/doc-cfg.rs:12:21
|
||||
|
|
||||
LL | #[doc(auto_cfg(hide(true)))]
|
||||
| ^^^^
|
||||
|
||||
error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value items
|
||||
--> $DIR/doc-cfg.rs:13:21
|
||||
|
|
||||
LL | #[doc(auto_cfg(hide(42)))]
|
||||
| ^^
|
||||
|
||||
error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value items
|
||||
--> $DIR/doc-cfg.rs:14:21
|
||||
|
|
||||
LL | #[doc(auto_cfg(hide("a")))]
|
||||
| ^^^
|
||||
|
||||
error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value items
|
||||
--> $DIR/doc-cfg.rs:15:21
|
||||
|
|
||||
LL | #[doc(auto_cfg(hide(foo::bar)))]
|
||||
| ^^^^^^^^
|
||||
|
||||
error: expected boolean for `#[doc(auto_cfg = ...)]`
|
||||
--> $DIR/doc-cfg.rs:16:7
|
||||
|
|
||||
LL | #[doc(auto_cfg = 42)]
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: expected boolean for `#[doc(auto_cfg = ...)]`
|
||||
--> $DIR/doc-cfg.rs:17:7
|
||||
|
|
||||
LL | #[doc(auto_cfg = "a")]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
warning: unexpected `cfg` condition name: `foo`
|
||||
--> $DIR/doc-cfg.rs:6:11
|
||||
|
|
||||
LL | #[doc(cfg(foo), cfg(bar))]
|
||||
| ^^^
|
||||
|
|
||||
= help: expected names are: `FALSE` and `test` and 31 more
|
||||
= help: to expect this configuration use `--check-cfg=cfg(foo)`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
||||
warning: unexpected `cfg` condition name: `bar`
|
||||
--> $DIR/doc-cfg.rs:6:21
|
||||
|
|
||||
LL | #[doc(cfg(foo), cfg(bar))]
|
||||
| ^^^
|
||||
|
|
||||
= help: to expect this configuration use `--check-cfg=cfg(bar)`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
error: `cfg` predicate is not specified
|
||||
--> $DIR/doc-cfg.rs:3:7
|
||||
error[E0805]: malformed `doc` attribute input
|
||||
--> $DIR/doc-cfg.rs:3:1
|
||||
|
|
||||
LL | #[doc(cfg(), cfg(foo, bar))]
|
||||
| ^^^^^ help: expected syntax is: `cfg(/* predicate */)`
|
||||
| ^^^^^^^^^--^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| expected a single argument here
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[doc(cfg(), cfg(foo, bar))]
|
||||
LL + #[doc = "string"]
|
||||
|
|
||||
LL - #[doc(cfg(), cfg(foo, bar))]
|
||||
LL + #[doc(hidden)]
|
||||
|
|
||||
LL - #[doc(cfg(), cfg(foo, bar))]
|
||||
LL + #[doc(inline)]
|
||||
|
|
||||
LL - #[doc(cfg(), cfg(foo, bar))]
|
||||
LL + #[doc(test)]
|
||||
|
|
||||
|
||||
error: multiple `cfg` predicates are specified
|
||||
--> $DIR/doc-cfg.rs:3:23
|
||||
error[E0805]: malformed `doc` attribute input
|
||||
--> $DIR/doc-cfg.rs:3:1
|
||||
|
|
||||
LL | #[doc(cfg(), cfg(foo, bar))]
|
||||
| ^^^
|
||||
| ^^^^^^^^^^^^^^^^----------^^
|
||||
| |
|
||||
| expected a single argument here
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[doc(cfg(), cfg(foo, bar))]
|
||||
LL + #[doc = "string"]
|
||||
|
|
||||
LL - #[doc(cfg(), cfg(foo, bar))]
|
||||
LL + #[doc(hidden)]
|
||||
|
|
||||
LL - #[doc(cfg(), cfg(foo, bar))]
|
||||
LL + #[doc(inline)]
|
||||
|
|
||||
LL - #[doc(cfg(), cfg(foo, bar))]
|
||||
LL + #[doc(test)]
|
||||
|
|
||||
|
||||
error: `cfg` predicate is not specified
|
||||
--> $DIR/doc-cfg.rs:9:7
|
||||
error[E0805]: malformed `doc` attribute input
|
||||
--> $DIR/doc-cfg.rs:6:1
|
||||
|
|
||||
LL | #[doc(cfg())]
|
||||
| ^^^^^ help: expected syntax is: `cfg(/* predicate */)`
|
||||
| ^^^^^^^^^--^^
|
||||
| |
|
||||
| expected a single argument here
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[doc(cfg())]
|
||||
LL + #[doc = "string"]
|
||||
|
|
||||
LL - #[doc(cfg())]
|
||||
LL + #[doc(hidden)]
|
||||
|
|
||||
LL - #[doc(cfg())]
|
||||
LL + #[doc(inline)]
|
||||
|
|
||||
LL - #[doc(cfg())]
|
||||
LL + #[doc(test)]
|
||||
|
|
||||
|
||||
error: multiple `cfg` predicates are specified
|
||||
--> $DIR/doc-cfg.rs:10:16
|
||||
error[E0805]: malformed `doc` attribute input
|
||||
--> $DIR/doc-cfg.rs:7:1
|
||||
|
|
||||
LL | #[doc(cfg(foo, bar))]
|
||||
| ^^^
|
||||
| ^^^^^^^^^----------^^
|
||||
| |
|
||||
| expected a single argument here
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[doc(cfg(foo, bar))]
|
||||
LL + #[doc = "string"]
|
||||
|
|
||||
LL - #[doc(cfg(foo, bar))]
|
||||
LL + #[doc(hidden)]
|
||||
|
|
||||
LL - #[doc(cfg(foo, bar))]
|
||||
LL + #[doc(inline)]
|
||||
|
|
||||
LL - #[doc(cfg(foo, bar))]
|
||||
LL + #[doc(test)]
|
||||
|
|
||||
|
||||
error: aborting due to 11 previous errors; 2 warnings emitted
|
||||
error[E0539]: malformed `doc` attribute input
|
||||
--> $DIR/doc-cfg.rs:8:1
|
||||
|
|
||||
LL | #[doc(auto_cfg(hide(foo::bar)))]
|
||||
| ^^^^^^^^^^^^^^^^^^^^--------^^^^
|
||||
| |
|
||||
| expected a valid identifier here
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[doc(auto_cfg(hide(foo::bar)))]
|
||||
LL + #[doc = "string"]
|
||||
|
|
||||
LL - #[doc(auto_cfg(hide(foo::bar)))]
|
||||
LL + #[doc(hidden)]
|
||||
|
|
||||
LL - #[doc(auto_cfg(hide(foo::bar)))]
|
||||
LL + #[doc(inline)]
|
||||
|
|
||||
LL - #[doc(auto_cfg(hide(foo::bar)))]
|
||||
LL + #[doc(test)]
|
||||
|
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0539, E0805.
|
||||
For more information about an error, try `rustc --explain E0539`.
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ LL | #![doc(test)]
|
|||
= note: `#[deny(invalid_doc_attributes)]` on by default
|
||||
|
||||
error: `#[doc(test(...)]` takes a list of attributes
|
||||
--> $DIR/doc-test-attr.rs:5:8
|
||||
--> $DIR/doc-test-attr.rs:5:13
|
||||
|
|
||||
LL | #![doc(test = "hello")]
|
||||
| ^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: unknown `doc(test)` attribute `a`
|
||||
--> $DIR/doc-test-attr.rs:7:13
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
#![feature(doc_cfg)]
|
||||
#[doc(cfg = "x")] //~ ERROR not followed by parentheses
|
||||
#[doc(cfg(x, y))] //~ ERROR multiple `cfg` predicates
|
||||
#[doc(cfg = "x")] //~ ERROR malformed `doc` attribute input
|
||||
#[doc(cfg(x, y))] //~ ERROR malformed `doc` attribute input
|
||||
pub struct S {}
|
||||
|
||||
// We check it also fails on private items.
|
||||
#[doc(cfg = "x")] //~ ERROR not followed by parentheses
|
||||
#[doc(cfg(x, y))] //~ ERROR multiple `cfg` predicates
|
||||
#[doc(cfg = "x")] //~ ERROR malformed `doc` attribute input
|
||||
#[doc(cfg(x, y))] //~ ERROR malformed `doc` attribute input
|
||||
struct X {}
|
||||
|
||||
// We check it also fails on hidden items.
|
||||
#[doc(cfg = "x")] //~ ERROR not followed by parentheses
|
||||
#[doc(cfg(x, y))] //~ ERROR multiple `cfg` predicates
|
||||
#[doc(cfg = "x")] //~ ERROR malformed `doc` attribute input
|
||||
#[doc(cfg(x, y))] //~ ERROR malformed `doc` attribute input
|
||||
#[doc(hidden)]
|
||||
pub struct Y {}
|
||||
|
||||
// We check it also fails on hidden AND private items.
|
||||
#[doc(cfg = "x")] //~ ERROR not followed by parentheses
|
||||
#[doc(cfg(x, y))] //~ ERROR multiple `cfg` predicates
|
||||
#[doc(cfg = "x")] //~ ERROR malformed `doc` attribute input
|
||||
#[doc(cfg(x, y))] //~ ERROR malformed `doc` attribute input
|
||||
#[doc(hidden)]
|
||||
struct Z {}
|
||||
|
|
|
|||
|
|
@ -1,50 +1,180 @@
|
|||
error: `cfg` is not followed by parentheses
|
||||
--> $DIR/invalid-cfg.rs:2:7
|
||||
error[E0539]: malformed `doc` attribute input
|
||||
--> $DIR/invalid-cfg.rs:2:1
|
||||
|
|
||||
LL | #[doc(cfg = "x")]
|
||||
| ^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)`
|
||||
| ^^^^^^^^^^^^^^^^^ expected this to be a list
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[doc(cfg = "x")]
|
||||
LL + #[doc = "string"]
|
||||
|
|
||||
LL - #[doc(cfg = "x")]
|
||||
LL + #[doc(hidden)]
|
||||
|
|
||||
LL - #[doc(cfg = "x")]
|
||||
LL + #[doc(inline)]
|
||||
|
|
||||
LL - #[doc(cfg = "x")]
|
||||
LL + #[doc(test)]
|
||||
|
|
||||
|
||||
error: multiple `cfg` predicates are specified
|
||||
--> $DIR/invalid-cfg.rs:3:14
|
||||
error[E0805]: malformed `doc` attribute input
|
||||
--> $DIR/invalid-cfg.rs:3:1
|
||||
|
|
||||
LL | #[doc(cfg(x, y))]
|
||||
| ^
|
||||
| ^^^^^^^^^------^^
|
||||
| |
|
||||
| expected a single argument here
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[doc(cfg(x, y))]
|
||||
LL + #[doc = "string"]
|
||||
|
|
||||
LL - #[doc(cfg(x, y))]
|
||||
LL + #[doc(hidden)]
|
||||
|
|
||||
LL - #[doc(cfg(x, y))]
|
||||
LL + #[doc(inline)]
|
||||
|
|
||||
LL - #[doc(cfg(x, y))]
|
||||
LL + #[doc(test)]
|
||||
|
|
||||
|
||||
error: `cfg` is not followed by parentheses
|
||||
--> $DIR/invalid-cfg.rs:7:7
|
||||
error[E0539]: malformed `doc` attribute input
|
||||
--> $DIR/invalid-cfg.rs:7:1
|
||||
|
|
||||
LL | #[doc(cfg = "x")]
|
||||
| ^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)`
|
||||
| ^^^^^^^^^^^^^^^^^ expected this to be a list
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[doc(cfg = "x")]
|
||||
LL + #[doc = "string"]
|
||||
|
|
||||
LL - #[doc(cfg = "x")]
|
||||
LL + #[doc(hidden)]
|
||||
|
|
||||
LL - #[doc(cfg = "x")]
|
||||
LL + #[doc(inline)]
|
||||
|
|
||||
LL - #[doc(cfg = "x")]
|
||||
LL + #[doc(test)]
|
||||
|
|
||||
|
||||
error: multiple `cfg` predicates are specified
|
||||
--> $DIR/invalid-cfg.rs:8:14
|
||||
error[E0805]: malformed `doc` attribute input
|
||||
--> $DIR/invalid-cfg.rs:8:1
|
||||
|
|
||||
LL | #[doc(cfg(x, y))]
|
||||
| ^
|
||||
| ^^^^^^^^^------^^
|
||||
| |
|
||||
| expected a single argument here
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[doc(cfg(x, y))]
|
||||
LL + #[doc = "string"]
|
||||
|
|
||||
LL - #[doc(cfg(x, y))]
|
||||
LL + #[doc(hidden)]
|
||||
|
|
||||
LL - #[doc(cfg(x, y))]
|
||||
LL + #[doc(inline)]
|
||||
|
|
||||
LL - #[doc(cfg(x, y))]
|
||||
LL + #[doc(test)]
|
||||
|
|
||||
|
||||
error: `cfg` is not followed by parentheses
|
||||
--> $DIR/invalid-cfg.rs:12:7
|
||||
error[E0539]: malformed `doc` attribute input
|
||||
--> $DIR/invalid-cfg.rs:12:1
|
||||
|
|
||||
LL | #[doc(cfg = "x")]
|
||||
| ^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)`
|
||||
| ^^^^^^^^^^^^^^^^^ expected this to be a list
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[doc(cfg = "x")]
|
||||
LL + #[doc = "string"]
|
||||
|
|
||||
LL - #[doc(cfg = "x")]
|
||||
LL + #[doc(hidden)]
|
||||
|
|
||||
LL - #[doc(cfg = "x")]
|
||||
LL + #[doc(inline)]
|
||||
|
|
||||
LL - #[doc(cfg = "x")]
|
||||
LL + #[doc(test)]
|
||||
|
|
||||
|
||||
error: multiple `cfg` predicates are specified
|
||||
--> $DIR/invalid-cfg.rs:13:14
|
||||
error[E0805]: malformed `doc` attribute input
|
||||
--> $DIR/invalid-cfg.rs:13:1
|
||||
|
|
||||
LL | #[doc(cfg(x, y))]
|
||||
| ^
|
||||
| ^^^^^^^^^------^^
|
||||
| |
|
||||
| expected a single argument here
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[doc(cfg(x, y))]
|
||||
LL + #[doc = "string"]
|
||||
|
|
||||
LL - #[doc(cfg(x, y))]
|
||||
LL + #[doc(hidden)]
|
||||
|
|
||||
LL - #[doc(cfg(x, y))]
|
||||
LL + #[doc(inline)]
|
||||
|
|
||||
LL - #[doc(cfg(x, y))]
|
||||
LL + #[doc(test)]
|
||||
|
|
||||
|
||||
error: `cfg` is not followed by parentheses
|
||||
--> $DIR/invalid-cfg.rs:18:7
|
||||
error[E0539]: malformed `doc` attribute input
|
||||
--> $DIR/invalid-cfg.rs:18:1
|
||||
|
|
||||
LL | #[doc(cfg = "x")]
|
||||
| ^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)`
|
||||
| ^^^^^^^^^^^^^^^^^ expected this to be a list
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[doc(cfg = "x")]
|
||||
LL + #[doc = "string"]
|
||||
|
|
||||
LL - #[doc(cfg = "x")]
|
||||
LL + #[doc(hidden)]
|
||||
|
|
||||
LL - #[doc(cfg = "x")]
|
||||
LL + #[doc(inline)]
|
||||
|
|
||||
LL - #[doc(cfg = "x")]
|
||||
LL + #[doc(test)]
|
||||
|
|
||||
|
||||
error: multiple `cfg` predicates are specified
|
||||
--> $DIR/invalid-cfg.rs:19:14
|
||||
error[E0805]: malformed `doc` attribute input
|
||||
--> $DIR/invalid-cfg.rs:19:1
|
||||
|
|
||||
LL | #[doc(cfg(x, y))]
|
||||
| ^
|
||||
| ^^^^^^^^^------^^
|
||||
| |
|
||||
| expected a single argument here
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[doc(cfg(x, y))]
|
||||
LL + #[doc = "string"]
|
||||
|
|
||||
LL - #[doc(cfg(x, y))]
|
||||
LL + #[doc(hidden)]
|
||||
|
|
||||
LL - #[doc(cfg(x, y))]
|
||||
LL + #[doc(inline)]
|
||||
|
|
||||
LL - #[doc(cfg(x, y))]
|
||||
LL + #[doc(test)]
|
||||
|
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0539, E0805.
|
||||
For more information about an error, try `rustc --explain E0539`.
|
||||
|
|
|
|||
11
tests/rustdoc-ui/lints/doc-attr-2.rs
Normal file
11
tests/rustdoc-ui/lints/doc-attr-2.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#![doc(as_ptr)]
|
||||
//~^ ERROR unknown `doc` attribute `as_ptr`
|
||||
|
||||
#[doc(as_ptr)]
|
||||
//~^ ERROR unknown `doc` attribute `as_ptr`
|
||||
pub fn foo() {}
|
||||
|
||||
#[doc(foo::bar, crate::bar::baz = "bye")]
|
||||
//~^ ERROR unknown `doc` attribute `foo::bar`
|
||||
//~| ERROR unknown `doc` attribute `crate::bar::baz`
|
||||
fn bar() {}
|
||||
28
tests/rustdoc-ui/lints/doc-attr-2.stderr
Normal file
28
tests/rustdoc-ui/lints/doc-attr-2.stderr
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
error: unknown `doc` attribute `as_ptr`
|
||||
--> $DIR/doc-attr-2.rs:4:7
|
||||
|
|
||||
LL | #[doc(as_ptr)]
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `#[deny(invalid_doc_attributes)]` on by default
|
||||
|
||||
error: unknown `doc` attribute `foo::bar`
|
||||
--> $DIR/doc-attr-2.rs:8:7
|
||||
|
|
||||
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unknown `doc` attribute `crate::bar::baz`
|
||||
--> $DIR/doc-attr-2.rs:8:17
|
||||
|
|
||||
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: unknown `doc` attribute `as_ptr`
|
||||
--> $DIR/doc-attr-2.rs:1:8
|
||||
|
|
||||
LL | #![doc(as_ptr)]
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
@ -1,17 +1,8 @@
|
|||
#![crate_type = "lib"]
|
||||
#![doc(as_ptr)]
|
||||
//~^ ERROR unknown `doc` attribute
|
||||
|
||||
#[doc(as_ptr)]
|
||||
//~^ ERROR unknown `doc` attribute
|
||||
pub fn foo() {}
|
||||
|
||||
#[doc(123)]
|
||||
//~^ ERROR invalid `doc` attribute
|
||||
//~^ ERROR malformed `doc` attribute
|
||||
#[doc("hello", "bar")]
|
||||
//~^ ERROR invalid `doc` attribute
|
||||
//~| ERROR invalid `doc` attribute
|
||||
#[doc(foo::bar, crate::bar::baz = "bye")]
|
||||
//~^ ERROR unknown `doc` attribute
|
||||
//~| ERROR unknown `doc` attribute
|
||||
//~^ ERROR malformed `doc` attribute
|
||||
//~| ERROR malformed `doc` attribute
|
||||
fn bar() {}
|
||||
|
|
|
|||
|
|
@ -1,46 +1,72 @@
|
|||
error: unknown `doc` attribute `as_ptr`
|
||||
--> $DIR/doc-attr.rs:5:7
|
||||
|
|
||||
LL | #[doc(as_ptr)]
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: `#[deny(invalid_doc_attributes)]` on by default
|
||||
|
||||
error: invalid `doc` attribute
|
||||
--> $DIR/doc-attr.rs:9:7
|
||||
error[E0539]: malformed `doc` attribute input
|
||||
--> $DIR/doc-attr.rs:3:1
|
||||
|
|
||||
LL | #[doc(123)]
|
||||
| ^^^
|
||||
| ^^^^^^---^^
|
||||
| |
|
||||
| expected this to be of the form `... = "..."`
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[doc(123)]
|
||||
LL + #[doc = "string"]
|
||||
|
|
||||
LL - #[doc(123)]
|
||||
LL + #[doc(hidden)]
|
||||
|
|
||||
LL - #[doc(123)]
|
||||
LL + #[doc(inline)]
|
||||
|
|
||||
LL - #[doc(123)]
|
||||
LL + #[doc(test)]
|
||||
|
|
||||
|
||||
error: invalid `doc` attribute
|
||||
--> $DIR/doc-attr.rs:11:7
|
||||
error[E0539]: malformed `doc` attribute input
|
||||
--> $DIR/doc-attr.rs:5:1
|
||||
|
|
||||
LL | #[doc("hello", "bar")]
|
||||
| ^^^^^^^
|
||||
| ^^^^^^-------^^^^^^^^^
|
||||
| |
|
||||
| expected this to be of the form `... = "..."`
|
||||
|
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL - #[doc("hello", "bar")]
|
||||
LL + #[doc = "string"]
|
||||
|
|
||||
LL - #[doc("hello", "bar")]
|
||||
LL + #[doc(hidden)]
|
||||
|
|
||||
LL - #[doc("hello", "bar")]
|
||||
LL + #[doc(inline)]
|
||||
|
|
||||
LL - #[doc("hello", "bar")]
|
||||
LL + #[doc(test)]
|
||||
|
|
||||
|
||||
error: invalid `doc` attribute
|
||||
--> $DIR/doc-attr.rs:11:16
|
||||
error[E0539]: malformed `doc` attribute input
|
||||
--> $DIR/doc-attr.rs:5:1
|
||||
|
|
||||
LL | #[doc("hello", "bar")]
|
||||
| ^^^^^
|
||||
|
||||
error: unknown `doc` attribute `foo::bar`
|
||||
--> $DIR/doc-attr.rs:14:7
|
||||
| ^^^^^^^^^^^^^^^-----^^
|
||||
| |
|
||||
| expected this to be of the form `... = "..."`
|
||||
|
|
||||
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
|
||||
| ^^^^^^^^
|
||||
|
||||
error: unknown `doc` attribute `crate::bar::baz`
|
||||
--> $DIR/doc-attr.rs:14:17
|
||||
help: try changing it to one of the following valid forms of the attribute
|
||||
|
|
||||
LL | #[doc(foo::bar, crate::bar::baz = "bye")]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unknown `doc` attribute `as_ptr`
|
||||
--> $DIR/doc-attr.rs:2:8
|
||||
LL - #[doc("hello", "bar")]
|
||||
LL + #[doc = "string"]
|
||||
|
|
||||
LL - #[doc("hello", "bar")]
|
||||
LL + #[doc(hidden)]
|
||||
|
|
||||
LL - #[doc("hello", "bar")]
|
||||
LL + #[doc(inline)]
|
||||
|
|
||||
LL - #[doc("hello", "bar")]
|
||||
LL + #[doc(test)]
|
||||
|
|
||||
LL | #![doc(as_ptr)]
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0539`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue