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