Skip to content

Commit 9cce0bc

Browse files
Add regression test for impl blocks in const expr
1 parent cdfc505 commit 9cce0bc

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
}

0 commit comments

Comments
 (0)