]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc/check-source-code-urls-to-def-std.rs
Rollup merge of #107580 - lenko-d:default_value_for_a_lifetime_generic_parameter_prod...
[rust.git] / tests / rustdoc / check-source-code-urls-to-def-std.rs
1 // compile-flags: -Zunstable-options --generate-link-to-definition
2
3 #![crate_name = "foo"]
4
5 // @has 'src/foo/check-source-code-urls-to-def-std.rs.html'
6
7 fn babar() {}
8
9 // @has - '//a[@href="{{channel}}/std/primitive.u32.html"]' 'u32'
10 // @has - '//a[@href="{{channel}}/std/primitive.str.html"]' 'str'
11 // @has - '//a[@href="{{channel}}/std/primitive.bool.html"]' 'bool'
12 // @has - '//a[@href="#7"]' 'babar'
13 pub fn foo(a: u32, b: &str, c: String) {
14     let x = 12;
15     let y: bool = true;
16     babar();
17 }
18
19 macro_rules! yolo { () => {}}
20
21 fn bar(a: i32) {}
22
23 macro_rules! bar {
24     ($a:ident) => { bar($a) }
25 }
26
27 macro_rules! data {
28     ($x:expr) => { $x * 2 }
29 }
30
31 pub fn another_foo() {
32     // This is known limitation: if the macro doesn't generate anything, the visitor
33     // can't find any item or anything that could tell us that it comes from expansion.
34     // @!has - '//a[@href="#19"]' 'yolo!'
35     yolo!();
36     // @has - '//a[@href="{{channel}}/std/macro.eprintln.html"]' 'eprintln!'
37     eprintln!();
38     // @has - '//a[@href="#27-29"]' 'data!'
39     let x = data!(4);
40     // @has - '//a[@href="#23-25"]' 'bar!'
41     bar!(x);
42 }