]> git.proxmox.com Git - rustc.git/blame - src/test/rustdoc/check-source-code-urls-to-def-std.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / rustdoc / check-source-code-urls-to-def-std.rs
CommitLineData
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
7fn 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'
13pub fn foo(a: u32, b: &str, c: String) {
14 let x = 12;
15 let y: bool = true;
16 babar();
17}
923072b8
FG
18
19macro_rules! yolo { () => {}}
20
21fn bar(a: i32) {}
22
23macro_rules! bar {
24 ($a:ident) => { bar($a) }
25}
26
27macro_rules! data {
28 ($x:expr) => { $x * 2 }
29}
30
31pub 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}