2021-04-13 15:03:29 -05:00
|
|
|
// compile-flags: -Zunstable-options --generate-link-to-definition
|
2021-06-12 15:08:43 -05:00
|
|
|
// aux-build:source_code.rs
|
|
|
|
// build-aux-docs
|
2021-04-13 15:03:29 -05:00
|
|
|
|
2023-03-21 10:44:06 -05:00
|
|
|
#![feature(rustc_attrs)]
|
2021-11-26 17:03:16 -06:00
|
|
|
|
2021-04-13 15:03:29 -05:00
|
|
|
#![crate_name = "foo"]
|
|
|
|
|
2021-06-12 15:08:43 -05:00
|
|
|
extern crate source_code;
|
|
|
|
|
2021-04-13 15:51:56 -05:00
|
|
|
// @has 'src/foo/check-source-code-urls-to-def.rs.html'
|
|
|
|
|
2022-10-27 13:16:30 -05:00
|
|
|
// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#1-17"]' 'bar'
|
2021-04-13 15:03:29 -05:00
|
|
|
#[path = "auxiliary/source-code-bar.rs"]
|
|
|
|
pub mod bar;
|
|
|
|
|
2022-10-27 13:16:30 -05:00
|
|
|
// @count - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#5"]' 4
|
2021-04-13 15:03:29 -05:00
|
|
|
use bar::Bar;
|
2022-10-27 13:16:30 -05:00
|
|
|
// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#13"]' 'self'
|
|
|
|
// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14"]' 'Trait'
|
2021-04-13 15:03:29 -05:00
|
|
|
use bar::sub::{self, Trait};
|
|
|
|
|
|
|
|
pub struct Foo;
|
|
|
|
|
|
|
|
impl Foo {
|
|
|
|
fn hello(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn babar() {}
|
|
|
|
|
2022-10-27 13:16:30 -05:00
|
|
|
// @has - '//pre[@class="rust"]//a/@href' '/struct.String.html'
|
|
|
|
// @has - '//pre[@class="rust"]//a/@href' '/primitive.u32.html'
|
|
|
|
// @has - '//pre[@class="rust"]//a/@href' '/primitive.str.html'
|
|
|
|
// @count - '//pre[@class="rust"]//a[@href="#23"]' 5
|
|
|
|
// @has - '//pre[@class="rust"]//a[@href="../../source_code/struct.SourceCode.html"]' 'source_code::SourceCode'
|
2021-06-12 15:08:43 -05:00
|
|
|
pub fn foo(a: u32, b: &str, c: String, d: Foo, e: bar::Bar, f: source_code::SourceCode) {
|
2021-04-13 15:03:29 -05:00
|
|
|
let x = 12;
|
|
|
|
let y: Foo = Foo;
|
|
|
|
let z: Bar = bar::Bar { field: Foo };
|
|
|
|
babar();
|
2022-10-27 13:16:30 -05:00
|
|
|
// @has - '//pre[@class="rust"]//a[@href="#26"]' 'hello'
|
2021-04-13 15:03:29 -05:00
|
|
|
y.hello();
|
|
|
|
}
|
|
|
|
|
2022-10-27 13:16:30 -05:00
|
|
|
// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14"]' 'bar::sub::Trait'
|
|
|
|
// @has - '//pre[@class="rust"]//a[@href="auxiliary/source-code-bar.rs.html#14"]' 'Trait'
|
2021-11-26 17:03:16 -06:00
|
|
|
pub fn foo2<T: bar::sub::Trait, V: Trait>(t: &T, v: &V, b: bool) {}
|
2021-08-14 13:17:43 -05:00
|
|
|
|
2022-05-02 08:07:11 -05:00
|
|
|
pub trait AnotherTrait {}
|
|
|
|
pub trait WhyNot {}
|
|
|
|
|
2022-10-27 13:16:30 -05:00
|
|
|
// @has - '//pre[@class="rust"]//a[@href="#49"]' 'AnotherTrait'
|
|
|
|
// @has - '//pre[@class="rust"]//a[@href="#50"]' 'WhyNot'
|
2022-05-02 08:07:11 -05:00
|
|
|
pub fn foo3<T, V>(t: &T, v: &V)
|
|
|
|
where
|
|
|
|
T: AnotherTrait,
|
|
|
|
V: WhyNot
|
|
|
|
{}
|
|
|
|
|
|
|
|
pub trait AnotherTrait2 {}
|
|
|
|
|
2022-10-27 13:16:30 -05:00
|
|
|
// @has - '//pre[@class="rust"]//a[@href="#60"]' 'AnotherTrait2'
|
2022-05-02 08:07:11 -05:00
|
|
|
pub fn foo4() {
|
|
|
|
let x: Vec<AnotherTrait2> = Vec::new();
|
|
|
|
}
|
|
|
|
|
2022-10-27 13:16:30 -05:00
|
|
|
// @has - '//pre[@class="rust"]//a[@href="../../foo/primitive.bool.html"]' 'bool'
|
2023-03-21 10:44:06 -05:00
|
|
|
#[rustc_doc_primitive = "bool"]
|
2021-08-14 13:17:43 -05:00
|
|
|
mod whatever {}
|