]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc/impl-in-const-block.rs
Fix problem noticed in PR106859 with char -> u8 suggestion
[rust.git] / tests / rustdoc / impl-in-const-block.rs
1 // Regression test for #83026.
2 // The goal of this test is to ensure that impl blocks inside
3 // const expressions are documented as well.
4
5 #![crate_name = "foo"]
6
7 // @has 'foo/struct.A.html'
8 // @has - '//*[@id="method.new"]/*[@class="code-header"]' 'pub fn new() -> A'
9 // @has - '//*[@id="method.bar"]/*[@class="code-header"]' 'pub fn bar(&self)'
10 // @has - '//*[@id="method.woo"]/*[@class="code-header"]' 'pub fn woo(&self)'
11 // @has - '//*[@id="method.yoo"]/*[@class="code-header"]' 'pub fn yoo()'
12 // @has - '//*[@id="method.yuu"]/*[@class="code-header"]' 'pub fn yuu()'
13 pub struct A;
14
15 const _: () = {
16     impl A {
17         const FOO: () = {
18             impl A {
19                 pub fn woo(&self) {}
20             }
21         };
22
23         pub fn new() -> A {
24             A
25         }
26     }
27 };
28 pub const X: () = {
29     impl A {
30         pub fn bar(&self) {}
31     }
32 };
33
34 fn foo() {
35     impl A {
36         pub fn yoo() {}
37     }
38     const _: () = {
39         impl A {
40             pub fn yuu() {}
41         }
42     };
43 }