File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change 1+ // This test ensures that patterns also get a link generated.
2+
3+ //@ compile-flags: -Zunstable-options --generate-link-to-definition
4+
5+ #![ crate_name = "foo" ]
6+
7+ //@ has 'src/foo/jump-to-def-pats.rs.html'
8+
9+ use std:: fmt;
10+
11+ pub enum MyEnum < T , E > {
12+ Ok ( T ) ,
13+ Err ( E ) ,
14+ Some ( T ) ,
15+ None ,
16+ }
17+
18+ pub enum X {
19+ A ,
20+ }
21+
22+ pub fn foo ( ) -> Result < ( ) , ( ) > {
23+ // FIXME: would be nice to be able to check both the class and the href at the same time so
24+ // we could check the text as well...
25+ //@ has - '//a[@class="prelude-val"]/@href' '{{channel}}/core/result/enum.Result.html#variant.Ok'
26+ //@ has - '//a[@href="{{channel}}/core/result/enum.Result.html#variant.Ok"]' 'Ok'
27+ Ok ( ( ) )
28+ }
29+
30+ impl < T , E > fmt:: Display for MyEnum < T , E > {
31+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
32+ match self {
33+ //@ has - '//a[@href="#12"]' 'Self::Ok'
34+ Self :: Ok ( _) => f. write_str ( "MyEnum::Ok" ) ,
35+ //@ has - '//a[@href="#13"]' 'MyEnum::Err'
36+ MyEnum :: Err ( _) => f. write_str ( "MyEnum::Err" ) ,
37+ //@ has - '//a[@href="#14"]' 'Self::Some'
38+ Self :: Some ( _) => f. write_str ( "MyEnum::Some" ) ,
39+ //@ has - '//a[@href="#15"]' 'Self::None'
40+ Self :: None => f. write_str ( "MyEnum::None" ) ,
41+ }
42+ }
43+ }
44+
45+ impl X {
46+ fn p ( & self ) -> & str {
47+ match self {
48+ //@ has - '//a[@href="#19"]' 'Self::A'
49+ Self :: A => "X::A" ,
50+ }
51+ }
52+ }
You can’t perform that action at this time.
0 commit comments