about summary refs log tree commit diff
path: root/src/librustdoc/test.rs
AgeCommit message (Collapse)AuthorLines
2019-09-12Auto merge of #64328 - Mark-Simulacrum:rustdoc-find-rustc, r=GuillaumeGomezbors-1/+4
rustdoc: change doctests locating rustc binary We previously used the "naive" approach of replacing the `current_exe()`'s file name with rustc, but now load from the sysroot by default (`$sysroot/bin/rustc`). The functionality of locating the sysroot overlaps/is the same as the functionality used by codegen backend loading; this ensures that any failure cases we've introduced are not exceeding those, and that improvements to finding the sysroot for loading codegen backends likewise enhance rustdoc. The second commit adds an unstable `--test-builder` flag to rustdoc, and is largely separate (I can split into separate PR, but it's a simple and related change). This is largely intended for "advanced" users at this point (I'm not sure if we'll ever stabilize it); it permits use of a different rustc binary for rustdoc compilation of doctests than the rustdoc binary used when loading. Note, that this may not be what you want as the parsers and such differ (and rustdoc uses its own libsyntax, etc.). However, I've been told that running doctests in miri may be assisted by this change, so I've implemented it; I'll file a tracking issue for it if there's interest in it (and we land this PR).
2019-09-12Auto merge of #64303 - nnethercote:avoid-more-Symbol-to-string-operations, ↵bors-1/+1
r=petrochenkov Avoid more `Symbol`-to-string operations These commits avoid various `Symbol`-to-string conversions, by doing more operations directly on `Symbol`s. This requires adding a few more static `Symbol`s to the binary. r? @petrochenkov
2019-09-10Add unstable --test-builder to rustdocMark Rousskov-1/+4
This allows overriding the rustc binary used to build tests; it should not generally be necessary as we fallback to the sysroot.
2019-09-10Locate rustc binary similarly to codegen backend loadingMark Rousskov-1/+1
This ensures that the failure cases for finding the codegen backend and for finding the rustc binary are essentially the same, and since we almost always will load the codegen backend, this is essentially meaning that the rustc change is not a regression.
2019-09-10Auto merge of #60387 - Goirad:test-expansion, r=ollie27bors-6/+41
Allow cross-compiling doctests This PR allows doctest to receive a --runtool argument, as well as possibly many --runtool-arg arguments, which are then used to run cross compiled doctests. Also, functionality has been added to rustdoc to allow it to skip testing doctests on a per-target basis, in the same way that compiletest does it. For example, tagging the doctest with "ignore-sgx" disables testing on any targets that contain "sgx". A plain "ignore" still skips testing on all targets. See [here](https://github.com/rust-lang/cargo/pull/6892) for the companion PR in the cargo project that extends functionality in Cargo so that it passes the appropriate parameters to rustdoc when cross compiling and testing doctests. Part of [#6460](https://github.com/rust-lang/cargo/issues/6460)
2019-09-09Use `sym::{all,any,main,not}` more.Nicholas Nethercote-1/+1
2019-09-04address rebase changesDario Gonzalez-9/+11
2019-09-04flatten rustc_lexer::character_properties moduleAleksey Kladov-3/+2
On the call site, `rustc_lexer::is_whitespace` reads much better than `character_properties::is_whitespace`.
2019-09-04remove XID and Pattern_White_Space unicode tables from libcoreAleksey Kladov-2/+3
They are only used by rustc_lexer, and are not needed elsewhere. So we move the relevant definitions into rustc_lexer (while the actual unicode data comes from the unicode-xid crate) and make the rest of the compiler use it.
2019-09-03added rustdoc book documentation, improved behavior when unstable flag not ↵Dario Gonzalez-0/+2
present
2019-09-03changed target from option to plain target, populated with host triple at ↵Dario Gonzalez-5/+3
argument parsing time if no --target arguments
2019-09-03added feature gate enable-per-target-ignoresDario Gonzalez-2/+5
updated and augmented tests in html/markdown.rs
2019-09-03Added ability to crosscompile doctestsDario Gonzalez-6/+36
2019-09-02Auto merge of #63834 - andjo403:rustdoc-linker-remove, r=Mark-Simulacrumbors-3/+0
remove the unstable rustdoc parameter --linker use the code generation parameter -Clinker (same parameter as rustc) to control what linker to use for building the rustdoc test executables. closes: #63816
2019-09-01remove the unstable rustdoc parameter --linkerAndreas Jonson-3/+0
use the code generation parameter -Clinker (same parameter as rustc) to control what linker to use for building the rustdoc test executables. closes: #63816
2019-08-30rustdoc use -Ccodegen-units=1 by default for test compileAndreas Jonson-0/+1
as the test is small we do not want split up in multiple codegen units and also as there is multiple test running at the same time this will reduce the number of concurrent threads
2019-08-30Auto merge of #63827 - andjo403:out-of-process-rustc-in-rustdoc, ↵bors-146/+68
r=Mark-Simulacrum Run doctests via out-of-process rustc closes #63638
2019-08-30Auto merge of #63402 - estebank:strip-margin, r=oli-obkbors-1/+1
Strip code to the left and right in diagnostics for long lines Fix #62999.
2019-08-29Run doctests via out-of-process rustcAndreas Jonson-146/+68
2019-08-29Auto merge of #62855 - Aaron1011:feature/rustdoc-reexport-final, r=petrochenkovbors-1/+7
Improve Rustdoc's handling of procedural macros Fixes #58700 Fixes #58696 Fixes #49553 Fixes #52210 This commit removes the special rustdoc handling for proc macros, as we can now retrieve their span and attributes just like any other item. A new command-line option is added to rustdoc: `--crate-type`. This takes the same options as rustc's `--crate-type` option. However, all values other than `proc-macro` are treated the same. This allows Rustdoc to enable 'proc macro mode' when handling a proc macro crate. In compiletest, a new 'rustdoc-flags' option is added. This allows us to pass in the '--proc-macro-crate' flag in the absence of Cargo. I've opened [an additional PR to Cargo](https://github.com/rust-lang/cargo/pull/7159) to support passing in this flag. These two PRS can be merged in any order - the Cargo changes will not take effect until the 'cargo' submodule is updated in this repository.
2019-08-27Rollup merge of #62600 - emmericp:libtest-add-show-output, r=gnzlbgMazdak Farrokhzad-1/+1
libtest: add --show-output flag to print stdout of successful tests This pull request adds a new flag `--show-output` for tests to show the output of successful tests. For most formatters this was already supported just not exposed via the CLI (apparently only used by `librustdoc`). I've also added support for this option in the JSON formatter. This kind of fixes https://github.com/rust-lang/rust/issues/54669 which wants `--format json` to work with `--nocapture`, which is... well, impossible. What this issue really calls for is `--show-output` as implemented here.
2019-08-24Improve Rustdoc's handling of procedural macrosAaron Hill-1/+7
Fixes #58700 Fixes #58696 Fixes #49553 Fixes #52210 This commit removes the special rustdoc handling for proc macros, as we can now retrieve their span and attributes just like any other item. A new command-line option is added to rustdoc: `--crate-type`. This takes the same options as rustc's `--crate-type` option. However, all values other than `proc-macro` are treated the same. This allows Rustdoc to enable 'proc macro mode' when handling a proc macro crate. In compiletest, a new 'rustdoc-flags' option is added. This allows us to pass in the '--proc-macro-crate' flag in the absence of Cargo. I've opened [an additional PR to Cargo](https://github.com/rust-lang/cargo/pull/7159) to support passing in this flag. These two PRS can be merged in any order - the Cargo changes will not take effect until the 'cargo' submodule is updated in this repository.
2019-08-21Add terminal_width debugging flagEsteban Küber-1/+1
2019-08-14Merge Variant and Variant_Caio-1/+1
2019-07-23Normalize use of backticks in compiler messages for docSamy Kacimi-1/+1
https://github.com/rust-lang/rust/issues/60532
2019-07-11libtest: add --show-output optionPaul Emmerich-1/+1
this new flag enables printing the captured stdout of successful tests utilizing the already existing display_output test runner option
2019-07-01Revert "implicit `Option`-returning doctests"Guillaume Gomez-6/+1
This reverts commit 6bb6c001be34d0932a014df981ee18f165c43374.
2019-06-30Auto merge of #61459 - GuillaumeGomez:fix-rustdoc-sysroot-panic, ↵bors-4/+2
r=ollie27,bjorn3,QuietMisdreavus Prevent panic when sysroot cannot be computed Fixes #61377. cc @rotty @rust-lang/rustdoc r? @Manishearth
2019-06-18rustc: remove 'x: 'y bounds (except from comments/strings).Eduard-Mihai Burtescu-1/+1
2019-06-16Separate librustcdoc modulechansuke-301/+1
2019-06-15Remove unnecessary `.clone()`Shotaro Yamada-1/+1
2019-06-10Prevent panic when sysroot cannot be computedGuillaume Gomez-4/+2
2019-05-30Rollup merge of #61279 - llogiq:implicit-option-main-doctests, r=GuillaumeGomezMazdak Farrokhzad-1/+6
implicit `Option`-returning doctests This distinguishes `Option` and `Result`-returning doctests with implicit `main` method, where the former tests must end with `Some(())`. Open question: Does this need a feature gate? r? @GuillaumeGomez
2019-05-28implicit `Option`-returning doctestsAndre Bogus-1/+6
This distinguishes `Option` and `Result`-returning doctests with implicit `main` method, where the former tests must end with `Some(())`.
2019-05-22do not print panic message on doctest failuresAndy Russell-25/+114
2019-05-21Move `edition` outside the hygiene lock and avoid accessing itJohn Kåre Alsaker-3/+2
2019-05-19Auto merge of #60065 - QuietMisdreavus:async-move-doctests, r=ollie27bors-19/+24
rustdoc: set the default edition when pre-parsing a doctest Fixes https://github.com/rust-lang/rust/issues/59313 (possibly more? i think we've had issues with parsing edition-specific syntax in doctests at some point) When handling a doctest, rustdoc needs to parse it beforehand, so that it can see whether it declares a `fn main` or `extern crate my_crate` explicitly. However, while doing this, rustdoc doesn't set the "default edition" used by the parser like the regular compilation runs do. This caused a problem when parsing a doctest with an `async move` block in it, since it was expecting the `move` keyword to start a closure, not a block. This PR changes the `rustdoc::test::make_test` function to set the parser's default edition while looking for a main function and `extern crate` statement. However, to do this, `make_test` needs to know what edition to set. Since this is also used during the HTML rendering process (to make playground URLs), now the HTML renderer needs to know about the default edition. Upshot: rendering standalone markdown files can now accept a "default edition" for their doctests with the `--edition` flag! (I'm pretty sure i waffled around how to set that a long time ago when we first added the `--edition` flag... `>_>`) I'm posting this before i stop for the night so that i can write this description while it's still in my head, but before this merges i want to make sure that (1) the `rustdoc-ui/failed-doctest-output` test still works (i expect it doesn't), and (2) i add a test with the sample from the linked issue.
2019-05-13Pass a `Symbol` to `check_name`, `emit_feature_err`, and related functions.Nicholas Nethercote-8/+8
2019-05-06update rustdoc unit testsQuietMisdreavus-17/+18
2019-05-06set the default edition when pre-parsing a doctestQuietMisdreavus-2/+6
2019-05-03Rollup merge of #60220 - euclio:rustdoc-test-fatal-parsing-errors, ↵Mazdak Farrokhzad-4/+19
r=QuietMisdreavus report fatal errors during doctest parsing Fixes #59557.
2019-04-24report fatal errors during doctest parsingAndy Russell-4/+19
2019-04-22upgrade rustdoc's pulldown-cmark to 0.4.1Andy Russell-5/+1
2019-04-02Update rustdocOliver Scherer-1/+1
2019-03-30Remove redundant importFabian Drinck-2/+1
2019-03-10Make the rustc driver and interface demand drivenJohn Kåre Alsaker-172/+122
2019-03-07Keep current behavior while accepting error countEsteban Küber-1/+1
2019-03-07fix bad use of with_emitterEsteban Küber-2/+2
2019-02-28Introduce rustc_interface and move some methods thereJohn Kåre Alsaker-7/+8
2019-02-24hir: remove NodeId from Lifetime and Tyljedrz-1/+1