1
Fork 0

rustdoc: clean up tuple <-> primitive conversion docs

This adds a minor missing feature to `fake_variadic`,
so that it can render `impl From<(T,)> for [T; 1]` correctly.
This commit is contained in:
Michael Howell 2024-08-24 13:56:56 -07:00
parent f167efad2f
commit 6df0ccf49e
4 changed files with 122 additions and 55 deletions

View file

@ -951,6 +951,16 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
bare_fn_ty.decl.inputs.len() == 1
} else {
false
}
|| if let Some(&[hir::GenericArg::Type(ty)]) = i
.of_trait
.as_ref()
.and_then(|trait_ref| trait_ref.path.segments.last())
.map(|last_segment| last_segment.args().args)
{
matches!(&ty.kind, hir::TyKind::Tup([_]))
} else {
false
};
if !is_valid {
self.dcx().emit_err(errors::DocFakeVariadicNotValid { span: meta.span() });