Skip to content

Commit a1dc541

Browse files
authored
Rollup merge of #97470 - notriddle:notriddle/test-cases, r=GuillaumeGomez
rustdoc: add more test coverage #91113
2 parents 9c61f81 + 5d86305 commit a1dc541

File tree

3 files changed

+47
-2
lines changed

3 files changed

+47
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
pub mod my_trait {
2+
pub trait MyTrait {
3+
fn my_fn(&self) -> Self;
4+
}
5+
}
6+
7+
pub mod prelude {
8+
#[doc(inline)]
9+
pub use crate::my_trait::MyTrait;
10+
}
11+
12+
pub struct SomeStruct;
13+
14+
impl my_trait::MyTrait for SomeStruct {
15+
fn my_fn(&self) -> SomeStruct {
16+
SomeStruct
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// aux-build:implementors_inline.rs
2+
// build-aux-docs
3+
// ignore-cross-compile
4+
5+
extern crate implementors_inline;
6+
7+
// @!has implementors/implementors_js/trait.MyTrait.js
8+
// @has implementors/implementors_inline/my_trait/trait.MyTrait.js
9+
// @!has implementors/implementors_inline/prelude/trait.MyTrait.js
10+
// @has implementors_inline/my_trait/trait.MyTrait.html
11+
// @has - '//script/@src' '../../implementors/implementors_inline/my_trait/trait.MyTrait.js'
12+
// @has implementors_js/trait.MyTrait.html
13+
// @has - '//script/@src' '../implementors/implementors_inline/my_trait/trait.MyTrait.js'
14+
/// When re-exporting this trait, the HTML will be inlined,
15+
/// but, vitally, the JavaScript will be located only at the
16+
/// one canonical path.
17+
pub use implementors_inline::prelude::MyTrait;
18+
19+
pub struct OtherStruct;
20+
21+
impl MyTrait for OtherStruct {
22+
fn my_fn(&self) -> OtherStruct {
23+
OtherStruct
24+
}
25+
}
+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
#![allow(rustdoc::broken_intra_doc_links)]
1+
#![forbid(rustdoc::broken_intra_doc_links)]
22

33
//! Email me at <[email protected]>.
44
//! Email me at <[email protected]>.
5-
//! Email me at <hello@localhost> (this warns but will still become a link).
5+
//! Email me at <hello@localhost>.
6+
//! Email me at <prim@i32>.
67
// @has email_address/index.html '//a[@href="mailto:[email protected]"]' '[email protected]'
78
// @has email_address/index.html '//a[@href="mailto:[email protected]"]' '[email protected]'
89
// @has email_address/index.html '//a[@href="mailto:hello@localhost"]' 'hello@localhost'
10+
// @has email_address/index.html '//a[@href="mailto:prim@i32"]' 'prim@i32'

0 commit comments

Comments
 (0)