]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-json/output_generics.rs
Rollup merge of #99192 - Amanieu:fix-asm-srcloc, r=petrochenkov
[rust.git] / src / test / 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 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 }