]>
Commit | Line | Data |
---|---|---|
c295e0f8 XL |
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="../../src/foo/check-source-code-urls-to-def-std.rs.html#7"]' 'babar' | |
13 | pub fn foo(a: u32, b: &str, c: String) { | |
14 | let x = 12; | |
15 | let y: bool = true; | |
16 | babar(); | |
17 | } | |
923072b8 FG |
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="../../src/foo/check-source-code-urls-to-def-std.rs.html#19"]' 'yolo!' | |
35 | yolo!(); | |
36 | // @has - '//a[@href="{{channel}}/std/macro.eprintln.html"]' 'eprintln!' | |
37 | eprintln!(); | |
38 | // @has - '//a[@href="../../src/foo/check-source-code-urls-to-def-std.rs.html#27-29"]' 'data!' | |
39 | let x = data!(4); | |
40 | // @has - '//a[@href="../../src/foo/check-source-code-urls-to-def-std.rs.html#23-25"]' 'bar!' | |
41 | bar!(x); | |
42 | } |