Skip to content

Commit 770a7ec

Browse files
authored
Rollup merge of rust-lang#94550 - GuillaumeGomez:HKF-macros, r=notriddle
rustdoc: Add test for higher kinded functions generated by macros Fixes rust-lang#75564. The problem has been solved apparently so adding a test to prevent a regression. r? ``@notriddle``
2 parents c1cac49 + e3f04de commit 770a7ec

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#![crate_name = "foo"]
2+
3+
pub struct TyCtxt<'tcx>(&'tcx u8);
4+
5+
macro_rules! gen {
6+
($(($name:ident, $tcx:lifetime, [$k:ty], [$r:ty]))*) => {
7+
pub struct Providers {
8+
$(pub $name: for<$tcx> fn(TyCtxt<$tcx>, $k) -> $r,)*
9+
}
10+
}
11+
}
12+
13+
// @has 'foo/struct.Providers.html'
14+
// @has - '//*[@class="docblock item-decl"]//code' "pub a: for<'tcx> fn(_: TyCtxt<'tcx>, _: u8) -> i8,"
15+
// @has - '//*[@class="docblock item-decl"]//code' "pub b: for<'tcx> fn(_: TyCtxt<'tcx>, _: u16) -> i16,"
16+
// @has - '//*[@id="structfield.a"]/code' "a: for<'tcx> fn(_: TyCtxt<'tcx>, _: u8) -> i8"
17+
// @has - '//*[@id="structfield.b"]/code' "b: for<'tcx> fn(_: TyCtxt<'tcx>, _: u16) -> i16"
18+
gen! {
19+
(a, 'tcx, [u8], [i8])
20+
(b, 'tcx, [u16], [i16])
21+
}

0 commit comments

Comments
 (0)