Display correct filename with --test option
Fixes#39592.
With the current files:
```rust
pub mod foo;
/// This is a Foo;
///
/// ```
/// println!("baaaaaar");
/// ```
pub struct Foo;
/// This is a Bar;
///
/// ```
/// println!("fooooo");
/// ```
pub struct Bar;
```
```rust
// note the whitespaces
/// ```
/// println!("foo");
/// ```
pub fn foo() {}
```
It displays:
```
./build/x86_64-apple-darwin/stage1/bin/rustdoc --test test.rs
running 3 tests
test test.rs - line 13 ... ok
test test.rs - line 5 ... ok
test foo.rs - line 2 ... ok
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured
```
```
` ``
println!("lol");
` ``
asdjnfasd
asd
```
It displays:
```
./build/x86_64-apple-darwin/stage1/bin/rustdoc --test foo.md
running 1 test
test <input> - line 3 ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
```
r? @alexcrichton
Most of the Rust community agrees that the vec! macro is clearer when
called using square brackets [] instead of regular brackets (). Most of
these ocurrences are from before macros allowed using different types of
brackets.
There is one left unchanged in a pretty-print test, as the pretty
printer still wants it to have regular brackets.
Adding these "known" values to the table of used ids is only required
when embedding markdown into a rustdoc html page and may yield
unexpected results when rendering a standalone `*.md` file.
For summary descriptions we need the first paragraph (adjacent lines
until a blank line) - but the rendered markdown of a code block did not
leave a blank line in the html and was thus included in the summary line.
r? @brson
cc @alexcrichton
I still need to add error code explanation test with this, but I can't figure out a way to generate the `.md` files in order to test example source codes.
Will fix#27328.
Have all Cargo-built crates pass `--cfg cargobuild` and then add appropriate
`#[cfg]` definitions to all crates to avoid linking anything if this is passed.
This should help allow libstd to compile with both the makefiles and with Cargo.
An automated script was run against the `.rs` and `.md` files,
subsituting every occurrence of `task` with `thread`. In the `.rs`
files, only the texts in the comment blocks were affected.
For now, words() is left in (but deprecated), and Words is a type alias for
struct SplitWhitespace.
Also cleaned up references to s.words() throughout codebase.
Closes#15628
This adds support in rustdoc to blanket apply crate attributes to all doc tests
for a crate at once. The syntax for doing this is:
#![doc(test(attr(...)))]
Each meta item in `...` will be applied to each doctest as a crate attribute.
cc #18199
Because the current style for `code` in rustdoc is to prewrap
whitespace, code spans that are hard wrapped in the source
documentation are prematurely wrapped when rendered in HTML.
CommonMark 0.18 [[1]] specifies "interior spaces and line endings are
collapsed into single spaces" for code spans, which would actually
prevent this issue, but hoedown does not currently conform to the
CommonMark spec.
The added span-level callback attempts to adhere to how whitespace is
handled as described by CommonMark, fixing the issue of early,
unintentional wrapping of code spans in rendered HTML.
[1]: http://spec.commonmark.org/0.18/