Skip to content

Commit d751314

Browse files
Add rustdonc-json regression test for #98009
1 parent 392d272 commit d751314

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// compile-flags: --document-private-items --document-hidden-items
2+
3+
// This is a regression test for #98009.
4+
5+
// @has output_generics.json
6+
// @has - "$.index[*][?(@.name=='this_compiles')]"
7+
// @has - "$.index[*][?(@.name=='this_does_not')]"
8+
// @has - "$.index[*][?(@.name=='Events')]"
9+
// @has - "$.index[*][?(@.name=='Other')]"
10+
// @has - "$.index[*][?(@.name=='Trait')]"
11+
12+
struct Events<R>(R);
13+
14+
struct Other;
15+
16+
pub trait Trait<T> {
17+
fn handle(value: T) -> Self;
18+
}
19+
20+
impl<T, U> Trait<U> for T where T: From<U> {
21+
fn handle(_: U) -> Self { unimplemented!() }
22+
}
23+
24+
impl<'a, R> Trait<&'a mut Events<R>> for Other {
25+
fn handle(_: &'a mut Events<R>) -> Self { unimplemented!() }
26+
}
27+
28+
fn this_compiles<'a, R>(value: &'a mut Events<R>) {
29+
for _ in 0..3 {
30+
Other::handle(&mut *value);
31+
}
32+
}
33+
34+
fn this_does_not<'a, R>(value: &'a mut Events<R>) {
35+
for _ in 0..3 {
36+
Other::handle(value);
37+
}
38+
}

0 commit comments

Comments
 (0)