mirror of https://github.com/rust-lang/rust.git
rustdoc: change error message for invalid `#[doc(tuple_variadic)]`
Add test case.
This commit is contained in:
parent
36fb094d25
commit
95ae4c9295
|
@ -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;
|
||||
|
|
|
@ -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() {}
|
|
@ -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…
Reference in New Issue