rustdoc: change error message for invalid #[doc(tuple_variadic)]
Add test case.
This commit is contained in:
parent
36fb094d25
commit
95ae4c9295
3 changed files with 24 additions and 1 deletions
|
@ -815,7 +815,7 @@ impl CheckAttrVisitor<'_> {
|
||||||
.sess
|
.sess
|
||||||
.struct_span_err(
|
.struct_span_err(
|
||||||
meta.span(),
|
meta.span(),
|
||||||
"`#[doc(tuple_variadic)]` can only be used on unary tuples",
|
"`#[doc(tuple_variadic)]` must used on the first of a set of tuple trait impls with varying arity",
|
||||||
)
|
)
|
||||||
.emit();
|
.emit();
|
||||||
return false;
|
return false;
|
||||||
|
|
15
src/test/rustdoc-ui/tuple-variadic-check.rs
Normal file
15
src/test/rustdoc-ui/tuple-variadic-check.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#![feature(rustdoc_internals)]
|
||||||
|
|
||||||
|
trait Mine {}
|
||||||
|
|
||||||
|
// This one is fine
|
||||||
|
#[doc(tuple_variadic)]
|
||||||
|
impl<T> Mine for (T,) {}
|
||||||
|
|
||||||
|
trait Mine2 {}
|
||||||
|
|
||||||
|
// This one is not
|
||||||
|
#[doc(tuple_variadic)] //~ ERROR
|
||||||
|
impl<T, U> Mine for (T,U) {}
|
||||||
|
|
||||||
|
fn main() {}
|
8
src/test/rustdoc-ui/tuple-variadic-check.stderr
Normal file
8
src/test/rustdoc-ui/tuple-variadic-check.stderr
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
error: `#[doc(tuple_variadic)]` must used on the first of a set of tuple trait impls with varying arity
|
||||||
|
--> $DIR/tuple-variadic-check.rs:12:7
|
||||||
|
|
|
||||||
|
LL | #[doc(tuple_variadic)]
|
||||||
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue