rustdoc: change error message for invalid `#[doc(tuple_variadic)]`

Add test case.
This commit is contained in:
Michael Howell 2022-06-12 13:49:42 -07:00
parent 36fb094d25
commit 95ae4c9295
3 changed files with 24 additions and 1 deletions

View File

@ -815,7 +815,7 @@ impl CheckAttrVisitor<'_> {
.sess
.struct_span_err(
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();
return false;

View 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() {}

View 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