File tree 1 file changed +38
-0
lines changed
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ // This test ensures that the const methods from Deref aren't shown as const.
2
+ // For more information, see https://github.com/rust-lang/rust/issues/90855.
3
+
4
+ #![ crate_name = "foo" ]
5
+
6
+ #![ feature( staged_api) ]
7
+
8
+ #![ stable( feature = "rust1" , since = "1.0.0" ) ]
9
+
10
+ // @has 'foo/struct.Bar.html'
11
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
12
+ pub struct Bar ;
13
+
14
+ impl Bar {
15
+ // @has - '//*[@id="method.len"]' 'pub const fn len(&self) -> usize'
16
+ // @has - '//*[@id="method.len"]//span[@class="since"]' '1.0.0 (const: 1.0.0)'
17
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
18
+ #[ rustc_const_stable( feature = "rust1" , since = "1.0.0" ) ]
19
+ pub const fn len ( & self ) -> usize { 0 }
20
+ }
21
+
22
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
23
+ pub struct Foo {
24
+ value : Bar ,
25
+ }
26
+
27
+ // @has 'foo/struct.Foo.html'
28
+ // @has - '//*[@id="method.len"]' 'pub fn len(&self) -> usize'
29
+ // @!has - '//*[@id="method.len"]//span[@class="since"]' '1.0.0'
30
+ // @!has - '//*[@id="method.len"]//span[@class="since"]' '(const: 1.0.0)'
31
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
32
+ impl std:: ops:: Deref for Foo {
33
+ type Target = Bar ;
34
+
35
+ fn deref ( & self ) -> & Self :: Target {
36
+ & self . value
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments