File tree Expand file tree Collapse file tree 5 files changed +156
-0
lines changed Expand file tree Collapse file tree 5 files changed +156
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ cat > out.rs << 'EOF '
4
+
5
+
6
+ #![crate_name = "foo"]
7
+
8
+ #![feature(rustdoc_internals)]
9
+
10
+ // @has foo/index.html '//h2[@id="keywords"]' 'Keywords'
11
+ // @has foo/index.html '//a[@href="keyword.match.html"]' 'match'
12
+ // @has foo/index.html '//div[@class="sidebar-elems"]//li/a' 'Keywords'
13
+ // @has foo/index.html '//div[@class="sidebar-elems"]//li/a/@href' '#keywords'
14
+ // @has foo/keyword.match.html '//a[@class="keyword"]' 'match'
15
+ // @has foo/keyword.match.html '//span[@class="in-band"]' 'Keyword match'
16
+ // @has foo/keyword.match.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
17
+ // @has foo/index.html '//a/@href' '../foo/index.html'
18
+ // @!has foo/foo/index.html
19
+ // @!has-dir foo/foo
20
+ // @!has foo/index.html '//span' '🔒'
21
+ #[doc(keyword = "match")]
22
+ /// this is a test!
23
+ mod foo{}
24
+
25
+ // @has foo/keyword.foo.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello'
26
+ #[doc(keyword = "foo")]
27
+ /// hello
28
+ mod bar {}
29
+
30
+
31
+ EOF
32
+
33
+ rustdoc --edition=2021 -Zunstable-options --output-format json out.rs
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ cat > out.rs << 'EOF '
4
+
5
+
6
+ mod m1 {
7
+ pub fn f() {}
8
+ }
9
+ mod m2 {
10
+ pub fn f(_: u8) {}
11
+ }
12
+
13
+ pub use m1::*;
14
+ pub use m2::*;
15
+
16
+ pub mod glob {
17
+ pub use *;
18
+ }
19
+
20
+
21
+ EOF
22
+
23
+ rustdoc --edition=2015 -Zunstable-options --output-format json out.rs
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ cat > out.rs << 'EOF '
4
+
5
+
6
+ #![feature(no_core)]
7
+ #![no_core]
8
+
9
+ #[doc(primitive = "usize")]
10
+ /// This is the built-in type `usize`.
11
+ mod usize {
12
+ }
13
+
14
+ EOF
15
+
16
+ rustdoc -Zunstable-options --output-format json --document-private-items out.rs
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ cat > out.rs << 'EOF '
4
+
5
+
6
+ #![crate_name = "foo"]
7
+
8
+ // This test ensures that there is no "infinite redirection" file generated (a
9
+ // file which redirects to itself).
10
+
11
+ // We check it's not a redirection file.
12
+ // @has 'foo/builders/struct.ActionRowBuilder.html'
13
+ // @has - '//*[@id="synthetic-implementations"]' 'Auto Trait Implementations'
14
+
15
+ // And that the link in the module is targetting it.
16
+ // @has 'foo/builders/index.html'
17
+ // @has - '//a[@href="struct.ActionRowBuilder.html"]' 'ActionRowBuilder'
18
+
19
+ mod auto {
20
+ mod action_row {
21
+ pub struct ActionRowBuilder;
22
+ }
23
+
24
+ #[doc(hidden)]
25
+ pub mod builders {
26
+ pub use super::action_row::ActionRowBuilder;
27
+ }
28
+ }
29
+
30
+ pub use auto::*;
31
+
32
+ pub mod builders {
33
+ pub use crate::auto::builders::*;
34
+ }
35
+
36
+
37
+ EOF
38
+
39
+ rustdoc -Zunstable-options --output-format json --cap-lints warn --document-private-items --document-hidden-items out.rs
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ cat > out.rs << 'EOF '
4
+
5
+
6
+ // run-rustfix
7
+ #![allow(dead_code)]
8
+
9
+ struct Events<R>(R);
10
+
11
+ struct Other;
12
+
13
+ pub trait Trait<T> {
14
+ fn handle(value: T) -> Self;
15
+ }
16
+
17
+ // Blanket impl. (If you comment this out, compiler figures out that it
18
+ // is passing an `&mut` to a method that must be expecting an `&mut`,
19
+ // and injects an auto-reborrow.)
20
+ impl<T, U> Trait<U> for T where T: From<U> {
21
+ fn handle(_: U) -> Self { unimplemented!() }
22
+ }
23
+
24
+ impl<'a, R> Trait<&'a mut Events<R>> for Other {
25
+ fn handle(_: &'a mut Events<R>) -> Self { unimplemented!() }
26
+ }
27
+
28
+ fn this_compiles<'a, R>(value: &'a mut Events<R>) {
29
+ for _ in 0..3 {
30
+ Other::handle(&mut *value);
31
+ }
32
+ }
33
+
34
+ fn this_does_not<'a, R>(value: &'a mut Events<R>) {
35
+ for _ in 0..3 {
36
+ Other::handle(value); //~ ERROR use of moved value: `value`
37
+ }
38
+ }
39
+
40
+ fn main() {}
41
+
42
+
43
+ EOF
44
+
45
+ rustdoc -Zunstable-options --output-format json --cap-lints warn --document-private-items --document-hidden-items out.rs
You can’t perform that action at this time.
0 commit comments