1 // compile-flags: -Zunstable-options --generate-link-to-definition
2 // aux-build:source_code.rs
3 // build-aux-docs
4 
5 #![crate_name = "foo"]
6 
7 extern crate source_code;
8 
9 // @has 'src/foo/check-source-code-urls-to-def.rs.html'
10 
11 // @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#1-17"]' 'bar'
12 #[path = "auxiliary/source-code-bar.rs"]
13 pub mod bar;
14 
15 // @count - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#5-7"]' 4
16 use bar::Bar;
17 // @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#13-17"]' 'self'
18 // @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14-16"]' 'Trait'
19 use bar::sub::{self, Trait};
20 
21 pub struct Foo;
22 
23 impl Foo {
hello(&self)24     fn hello(&self) {}
25 }
26 
babar()27 fn babar() {}
28 
29 // @has - '//a/@href' '/struct.String.html'
30 // @has - '//a/@href' '/primitive.u32.html'
31 // @has - '//a/@href' '/primitive.str.html'
32 // @count - '//a[@href="../../src/foo/check-source-code-urls-to-def.rs.html#21"]' 5
33 // @has - '//a[@href="../../source_code/struct.SourceCode.html"]' 'source_code::SourceCode'
foo(a: u32, b: &str, c: String, d: Foo, e: bar::Bar, f: source_code::SourceCode)34 pub fn foo(a: u32, b: &str, c: String, d: Foo, e: bar::Bar, f: source_code::SourceCode) {
35     let x = 12;
36     let y: Foo = Foo;
37     let z: Bar = bar::Bar { field: Foo };
38     babar();
39     // @has - '//a[@href="../../src/foo/check-source-code-urls-to-def.rs.html#24"]' 'hello'
40     y.hello();
41 }
42 
43 // @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14-16"]' 'bar::sub::Trait'
44 // @has - '//a[@href="../../src/foo/auxiliary/source-code-bar.rs.html#14-16"]' 'Trait'
foo2<T: bar::sub::Trait, V: Trait>(t: &T, v: &V, b: bool)45 pub fn foo2<T: bar::sub::Trait, V: Trait>(t: &T, v: &V, b: bool) {
46 }
47 
48 // @has - '//a[@href="../../foo/primitive.bool.html"]' 'bool'
49 #[doc(primitive = "bool")]
50 mod whatever {}
51