Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//@ compile-flags:--test
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ edition:2018
//@ check-pass

// Prior to setting the default edition for the doctest pre-parser,
// this doctest would fail due to a fatal parsing error.
Expand Down
6 changes: 6 additions & 0 deletions tests/rustdoc-ui/doctest/async-move-doctest.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

running 1 test
test $DIR/async-move-doctest.rs - (line 10) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//@ compile-flags:--test
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ check-pass

// comments, both doc comments and regular ones, used to trick rustdoc's doctest parser into
// thinking that everything after it was part of the regular program. combined with the librustc_ast
Expand Down
6 changes: 6 additions & 0 deletions tests/rustdoc-ui/doctest/comment-in-doctest.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

running 1 test
test $DIR/comment-in-doctest.rs - (line 12) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
// https://github.com/rust-lang/rust/issues/54478

//@ compile-flags:--test
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ check-pass

#![crate_name="foo"]

// Issue #54478: regression test showing that we can demonstrate
Expand All @@ -15,8 +20,6 @@
// decided to change `rustdoc` to behave more like the compiler's
// default setting, by leaving off `-C prefer-dynamic`.

//@ compile-flags:--test

//! This is a doc comment
//!
//! ```rust
Expand Down
6 changes: 6 additions & 0 deletions tests/rustdoc-ui/doctest/demo-allocator-54478.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

running 1 test
test $DIR/demo-allocator-54478.rs - (line 25) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//@ only-x86_64
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ normalize-stdout: "rust_out::main::.+" -> "rust_out::main::$$PATH"
//@ compile-flags:--test
//@ should-fail
//@ failure-status: 101

// #49723: rustdoc didn't add target features when extracting or running doctests

Expand Down
39 changes: 39 additions & 0 deletions tests/rustdoc-ui/doctest/doc-cfg-target-feature.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

running 1 test
test $DIR/doc-cfg-target-feature.rs - foo (line 15) ... FAILED

failures:

---- $DIR/doc-cfg-target-feature.rs - foo (line 15) stdout ----
warning: the feature `cfg_target_feature` has been stable since 1.27.0 and no longer requires an attribute to enable
--> $DIR/doc-cfg-target-feature.rs:15:12
|
LL | #![feature(cfg_target_feature)]
| ^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(stable_features)]` on by default

warning: 1 warning emitted

Test executable failed (exit status: 101).

stderr:

thread 'main' ($TID) panicked at $DIR/doc-cfg-target-feature.rs:7:1:
assertion failed: false
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::panic
3: rust_out::main::$PATH
4: rust_out::main
5: <fn() as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.



failures:
$DIR/doc-cfg-target-feature.rs - foo (line 15)

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//@ compile-flags:--test
// https://github.com/rust-lang/rust/issues/18199

//@ compile-flags:--test
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ check-pass

#![doc(test(attr(feature(staged_api))))]

/// ```
Expand Down
6 changes: 6 additions & 0 deletions tests/rustdoc-ui/doctest/doc-test-attr-18199.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

running 1 test
test $DIR/doc-test-attr-18199.rs - foo (line 9) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//@ compile-flags:--test
//@ compile-flags:--test --test-args=--test-threads=1
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ check-pass

/// ```rust,edition2018
/// #![feature(try_blocks)]
Expand Down
7 changes: 7 additions & 0 deletions tests/rustdoc-ui/doctest/edition-doctest.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

running 2 tests
test $DIR/edition-doctest.rs - foo (line 24) - compile fail ... ok
test $DIR/edition-doctest.rs - foo (line 5) ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//@ compile-flags:--test
//@ edition:2018
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ check-pass

/// ```rust
/// fn main() {
Expand Down
6 changes: 6 additions & 0 deletions tests/rustdoc-ui/doctest/edition-flag.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

running 1 test
test $DIR/edition-flag.rs - main (line 6) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
//@ only-x86_64
//@ compile-flags:--test -C target-feature=+avx
//@ should-fail
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ normalize-stdout: "rust_out::main::.+" -> "rust_out::main::$$PATH"
//@ failure-status: 101

#![feature(doc_cfg)]

/// (written on a spider's web) Some Struct
///
Expand Down
27 changes: 27 additions & 0 deletions tests/rustdoc-ui/doctest/force-target-feature.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

running 1 test
test $DIR/force-target-feature.rs - SomeStruct (line 11) ... FAILED

failures:

---- $DIR/force-target-feature.rs - SomeStruct (line 11) stdout ----
Test executable failed (exit status: 101).

stderr:

thread 'main' ($TID) panicked at $DIR/force-target-feature.rs:3:1:
oh no
stack backtrace:
0: std::panicking::begin_panic::<&str>
1: rust_out::main::$PATH
2: rust_out::main
3: <fn() as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.



failures:
$DIR/force-target-feature.rs - SomeStruct (line 11)

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
//@ compile-flags:--test
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ check-pass

// https://github.com/rust-lang/rust/issues/19181

// rustdoc should not panic when target crate has compilation errors
Expand Down
5 changes: 5 additions & 0 deletions tests/rustdoc-ui/doctest/ice-type-error-19181.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//@ compile-flags:--test
//@ should-fail
//@ failure-status: 101
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"

#![doc(test(attr(deny(warnings))))]

Expand Down
29 changes: 29 additions & 0 deletions tests/rustdoc-ui/doctest/no-run-still-checks-lints.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

running 1 test
test $DIR/no-run-still-checks-lints.rs - foo (line 7) - compile ... FAILED

failures:

---- $DIR/no-run-still-checks-lints.rs - foo (line 7) stdout ----
error: unused variable: `a`
--> $DIR/no-run-still-checks-lints.rs:8:5
|
LL | let a = 3;
| ^ help: if this is intentional, prefix it with an underscore: `_a`
|
note: the lint level is defined here
--> $DIR/no-run-still-checks-lints.rs:6:9
|
LL | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(unused_variables)]` implied by `#[deny(warnings)]`

error: aborting due to 1 previous error

Couldn't compile the test.

failures:
$DIR/no-run-still-checks-lints.rs - foo (line 7)

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//@ compile-flags:--test
//@ compile-flags:--test --test-args=--test-threads=1
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ check-pass

/// A check of using various process termination strategies
///
Expand Down
8 changes: 8 additions & 0 deletions tests/rustdoc-ui/doctest/process-termination.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

running 3 tests
test $DIR/process-termination.rs - check_process_termination (line 16) ... ok
test $DIR/process-termination.rs - check_process_termination (line 22) ... ok
test $DIR/process-termination.rs - check_process_termination (line 9) ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
//@ needs-sanitizer-support
//@ needs-sanitizer-address
//@ compile-flags: --test -Z sanitizer=address -C unsafe-allow-abi-mismatch=sanitizer
//
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ check-pass

// #43031: Verify that rustdoc passes `-Z` options to rustc. Use an extern
// function that is provided by the sanitizer runtime, if flag is not passed
// correctly, then linking will fail.
Expand Down
6 changes: 6 additions & 0 deletions tests/rustdoc-ui/doctest/sanitizer-option.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

running 1 test
test $DIR/sanitizer-option.rs - z_flag_is_passed_to_rustc (line 11) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//@ compile-flags: --test
//@ compile-flags: --test --test-args=--test-threads=1
//@ check-test-line-numbers-match
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ check-pass

#[path = "test-option-check.rs"]
pub mod bar;

/// This is a Foo;
Expand Down
8 changes: 8 additions & 0 deletions tests/rustdoc-ui/doctest/test-option-check-2.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

running 3 tests
test $DIR/test-option-check-2.rs - Bar (line 18) ... ok
test $DIR/test-option-check-2.rs - Foo (line 11) ... ok
test $DIR/test-option-check.rs - bar::foooo (line 8) ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//@ compile-flags: --test
//@ check-test-line-numbers-match
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ check-pass

/// This looks like another awesome test!
///
Expand Down
6 changes: 6 additions & 0 deletions tests/rustdoc-ui/doctest/test-option-check.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

running 1 test
test $DIR/test-option-check.rs - foooo (line 8) ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

10 changes: 0 additions & 10 deletions tests/rustdoc-ui/lints/renamed-lint-still-applies.rs

This file was deleted.

12 changes: 6 additions & 6 deletions tests/rustdoc-ui/lints/renamed-lint-still-applies.stderr
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
warning: lint `broken_intra_doc_links` has been renamed to `rustdoc::broken_intra_doc_links`
--> $DIR/renamed-lint-still-applies.rs:2:9
--> $DIR/renamed-lint-still-applies.rs:3:9
|
LL | #![deny(broken_intra_doc_links)]
| ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::broken_intra_doc_links`
|
= note: `#[warn(renamed_and_removed_lints)]` on by default

warning: lint `rustdoc::non_autolinks` has been renamed to `rustdoc::bare_urls`
--> $DIR/renamed-lint-still-applies.rs:7:9
--> $DIR/renamed-lint-still-applies.rs:8:9
|
LL | #![deny(rustdoc::non_autolinks)]
| ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::bare_urls`

error: unresolved link to `x`
--> $DIR/renamed-lint-still-applies.rs:4:6
--> $DIR/renamed-lint-still-applies.rs:5:6
|
LL | //! [x]
| ^ no item named `x` in scope
|
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
note: the lint level is defined here
--> $DIR/renamed-lint-still-applies.rs:2:9
--> $DIR/renamed-lint-still-applies.rs:3:9
|
LL | #![deny(broken_intra_doc_links)]
| ^^^^^^^^^^^^^^^^^^^^^^

error: this URL is not a hyperlink
--> $DIR/renamed-lint-still-applies.rs:9:5
--> $DIR/renamed-lint-still-applies.rs:10:5
|
LL | //! http://example.com
| ^^^^^^^^^^^^^^^^^^
|
= note: bare URLs are not automatically turned into clickable links
note: the lint level is defined here
--> $DIR/renamed-lint-still-applies.rs:7:9
--> $DIR/renamed-lint-still-applies.rs:8:9
|
LL | #![deny(rustdoc::non_autolinks)]
| ^^^^^^^^^^^^^^^^^^^^^^
Expand Down
1 change: 0 additions & 1 deletion tests/ui/lint/forbid-error-capped.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ check-pass
// compile-args: --cap-lints=warn -Fwarnings

// This checks that the forbid attribute checking is ignored when the forbidden
// lint is capped.
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/lint/forbid-error-capped.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
warning: allow(unused) incompatible with previous forbid
--> $DIR/forbid-error-capped.rs:8:10
--> $DIR/forbid-error-capped.rs:7:10
|
LL | #![forbid(warnings)]
| -------- `forbid` level set here
Expand All @@ -14,7 +14,7 @@ warning: 1 warning emitted

Future incompatibility report: Future breakage diagnostic:
warning: allow(unused) incompatible with previous forbid
--> $DIR/forbid-error-capped.rs:8:10
--> $DIR/forbid-error-capped.rs:7:10
|
LL | #![forbid(warnings)]
| -------- `forbid` level set here
Expand Down
Loading
Loading