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