Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 95ae4c9

Browse files
committed
rustdoc: change error message for invalid #[doc(tuple_variadic)]
Add test case.
1 parent 36fb094 commit 95ae4c9

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

compiler/rustc_passes/src/check_attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ impl CheckAttrVisitor<'_> {
815815
.sess
816816
.struct_span_err(
817817
meta.span(),
818-
"`#[doc(tuple_variadic)]` can only be used on unary tuples",
818+
"`#[doc(tuple_variadic)]` must used on the first of a set of tuple trait impls with varying arity",
819819
)
820820
.emit();
821821
return false;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![feature(rustdoc_internals)]
2+
3+
trait Mine {}
4+
5+
// This one is fine
6+
#[doc(tuple_variadic)]
7+
impl<T> Mine for (T,) {}
8+
9+
trait Mine2 {}
10+
11+
// This one is not
12+
#[doc(tuple_variadic)] //~ ERROR
13+
impl<T, U> Mine for (T,U) {}
14+
15+
fn main() {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: `#[doc(tuple_variadic)]` must used on the first of a set of tuple trait impls with varying arity
2+
--> $DIR/tuple-variadic-check.rs:12:7
3+
|
4+
LL | #[doc(tuple_variadic)]
5+
| ^^^^^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)