summary refs log tree commit diff
path: root/src/librustdoc/test.rs
AgeCommit message (Collapse)AuthorLines
2018-04-19[beta] Tweak some stabilizations in libstdAlex Crichton-1/+1
This commit tweaks a few stable APIs in the `beta` branch before they hit stable. The `str::is_whitespace` and `str::is_alphanumeric` functions were deleted (added in #49381, issue at #49657). The `and_modify` APIs added in #44734 were altered to take a `FnOnce` closure rather than a `FnMut` closure. Closes #49581 Closes #49657
2018-04-01Rollup merge of #49451 - QuietMisdreavus:epoch-doctests, r=GuillaumeGomezMark Simulacrum-6/+20
rustdoc: add an --edition flag to compile docs/doctests with a certain edition To correspond with the 2018 edition, this adds a (currently unstable) `--edition` flag to rustdoc that makes it compile crates and doctests with the given edition. Once this lands, Cargo should be updated to pass this flag when the edition configuration option is given.
2018-03-28use --edition for doctests, rather than just the crateQuietMisdreavus-5/+13
2018-03-27add --edition flag to rustdocQuietMisdreavus-1/+7
2018-03-26Remove unnecessary trait import.boats-2/+0
2018-03-22Rollup merge of #49188 - memoryleak47:macro_use_doctest, r=QuietMisdreavuskennytm-0/+19
Put `#[macro_use] extern crate <crate>` before fn main() in doctests Closes #49174.
2018-03-19Put `#[macro_use] extern crate <crate>` before fn main() in doctestsmemoryleak47-0/+19
2018-03-18Add warning for invalid start of code blocks in rustdocGuillaume Gomez-2/+4
2018-03-14Remove syntax and syntax_pos thread localsJohn Kåre Alsaker-2/+3
2018-03-05Turn features() into a query.Michael Woerister-1/+1
2018-03-02Replace Rc with Lrc for shared dataJohn Kåre Alsaker-8/+8
2018-02-21Rollup merge of #48106 - QuietMisdreavus:teleporting-crates, r=GuillaumeGomezGuillaume Gomez-2/+3
rustdoc: move manual "extern crate" statements outside automatic "fn main"s in doctests Gated on https://github.com/rust-lang/rust/pull/48095 - I based the branch atop that so i could show off the change in one of its tests, the actual change in this PR is just the last commit There are a handful of unfortunate assumptions in the way rustdoc processes `extern crate` statements in doctests: 1. In the absence of an `extern crate` statement in the test, if the test also uses the local crate name, it will automatically insert an `extern crate cratename;` statement into the test. 2. If the doctest *does* include an `extern crate` statement, rustdoc will not automatically insert one, on the assumption that doing so would introduce a duplicate import. 3. If a doctest does not have the substring `fn main` outside a comment, rustdoc will wrap the whole doctest in a generated `fn main` so it can be compiled. In short, whenever you write a doctest like this... ```rust //! extern crate my_crate; //! my_crate::some_cool_thing(); ``` ...rustdoc will turn it into (something like) this: ```rust fn main() { extern crate my_crate; my_crate::some_cool_thing(); } ``` This creates issues when compiled, because now `my_crate` isn't even properly in scope! This forces people who want to have multiple crates in their doctests (or an explicit `extern crate` statement) to also manually include their own `fn main`, so rustdoc doesn't put their imports in the wrong place. This PR just taps into another processing step rustdoc does to doctests: Whenever you add an `#![inner_attribute]` to the beginning of a doctest, rustdoc will actually splice those out and put it before the generated `fn main`. Now, we can just do the same with `extern crate`s at the beginning, too, and get a much nicer experience. Now, the above example will be converted into this: ```rust extern crate my_crate; fn main() { my_crate::some_cool_thing(); } ```
2018-02-18Rollup merge of #48274 - GuillaumeGomez:remove-hoedown, r=QuietMisdreavusGuillaume Gomez-48/+4
Remove hoedown from rustdoc Finally the time has come! r? @QuietMisdreavus
2018-02-17move manual "extern crate" statements outside auto "fn main" in doctestsQuietMisdreavus-2/+3
2018-02-16Remove hoedown from rustdocGuillaume Gomez-48/+4
Is it really time? Have our months, no, *years* of suffering come to an end? Are we finally able to cast off the pall of Hoedown? The weight which has dragged us down for so long? ----- So, timeline for those who need to catch up: * Way back in December 2016, [we decided we wanted to switch out the markdown renderer](https://github.com/rust-lang/rust/issues/38400). However, this was put on hold because the build system at the time made it difficult to pull in dependencies from crates.io. * A few months later, in March 2017, [the first PR was done, to switch out the renderers entirely](https://github.com/rust-lang/rust/pull/40338). The PR itself was fraught with CI and build system issues, but eventually landed. * However, not all was well in the Rustdoc world. During the PR and shortly after, we noticed [some differences in the way the two parsers handled some things](https://github.com/rust-lang/rust/issues/40912), and some of these differences were major enough to break the docs for some crates. * A couple weeks afterward, [Hoedown was put back in](https://github.com/rust-lang/rust/pull/41290), at this point just to catch tests that Pulldown was "spuriously" running. This would at least provide some warning about spurious tests, rather than just breaking spontaneously. * However, the problems had created enough noise by this point that just a few days after that, [Hoedown was switched back to the default](https://github.com/rust-lang/rust/pull/41431) while we came up with a solution for properly warning about the differences. * That solution came a few weeks later, [as a series of warnings when the HTML emitted by the two parsers was semantically different](https://github.com/rust-lang/rust/pull/41991). But that came at a cost, as now rustdoc needed proc-macro support (the new crate needed some custom derives farther down its dependency tree), and the build system was not equipped to handle it at the time. It was worked on for three months as the issue stumped more and more people. * In that time, [bootstrap was completely reworked](https://github.com/rust-lang/rust/pull/43059) to change how it ordered compilation, and [the method by which it built rustdoc would change](https://github.com/rust-lang/rust/pull/43482), as well. This allowed it to only be built after stage1, when proc-macros would be available, allowing the "rendering differences" PR to finally land. * The warnings were not perfect, and revealed a few [spurious](https://github.com/rust-lang/rust/pull/44368) [differences](https://github.com/rust-lang/rust/pull/45421) between how we handled the renderers. * Once these were handled, [we flipped the switch to turn on the "rendering difference" warnings all the time](https://github.com/rust-lang/rust/pull/45324), in October 2017. This began the "warning cycle" for this change, and landed in stable in 1.23, on 2018-01-04. * Once those warnings hit stable, and after a couple weeks of seeing whether we would get any more reports than what we got from sitting on nightly/beta, [we switched the renderers](https://github.com/rust-lang/rust/pull/47398), making Pulldown the default but still offering the option to use Hoedown. And that brings us to the present. We haven't received more new issues from this in the meantime, and the "switch by default" is now on beta. Our reasoning is that, at this point, anyone who would have been affected by this has run into it already.
2018-02-09add tests for the doctest construction functionalityQuietMisdreavus-0/+214
2018-02-09trim the body of doctests after partitioningQuietMisdreavus-3/+3
2018-01-31Auto merge of #45752 - estebank:highlight-primary, r=nikomatsakisbors-0/+1
Highlight code on diagnostics when underlined Highlight the label's span with the respective color: <img width="692" alt="" src="https://user-images.githubusercontent.com/1606434/32411026-a1842482-c18d-11e7-9933-6510eefbad19.png"> Fix #42112.
2018-01-29Toggle span highlighting on `-Zteach`Esteban Küber-0/+1
2018-01-27rustc: Load the `rustc_trans` crate at runtimeAlex Crichton-3/+2
Building on the work of # 45684 this commit updates the compiler to unconditionally load the `rustc_trans` crate at runtime instead of linking to it at compile time. The end goal of this work is to implement # 46819 where rustc will have multiple backends available to it to load. This commit starts off by removing the `extern crate rustc_trans` from the driver. This involved moving some miscellaneous functionality into the `TransCrate` trait and also required an implementation of how to locate and load the trans backend. This ended up being a little tricky because the sysroot isn't always the right location (for example `--sysroot` arguments) so some extra code was added as well to probe a directory relative to the current dll (the rustc_driver dll). Rustbuild has been updated accordingly as well to have a separate compilation invocation for the `rustc_trans` crate and assembly it accordingly into the sysroot. Finally, the distribution logic for the `rustc` package was also updated to slurp up the trans backends folder. A number of assorted fallout changes were included here as well to ensure tests pass and such, and they should all be commented inline.
2018-01-19Allow runtime switching between trans backendsbjorn3-7/+16
2018-01-10Use correct line offsets for doctests (fixes #45868)Manish Goregaokar-6/+15
2017-12-22Rollup merge of #46814 - varkor:contrib-7, r=alexcrichtonkennytm-1/+1
Prevent rustc overwriting input files If rustc is invoked on a file that would be overwritten by the compilation, the compilation now fails, to avoid accidental loss. This resolves #13019. Kudos to @estebank, whose patch I finished off.
2017-12-22Rollup merge of #46636 - frewsxcv:frewsxcv-fn-box, r=estebankkennytm-1/+1
Replace libtest/lib.rs:FnBox with std::boxed::FnBox. Fixes https://github.com/rust-lang/rust/issues/41810.
2017-12-19Move source-output conflict checking into `compile_input`varkor-1/+1
2017-12-15Replace libtest/lib.rs:FnBox with std::boxed::FnBox.Corey Farwell-1/+1
Fixes https://github.com/rust-lang/rust/issues/41810.
2017-12-14Use PathBuf instead of String where applicableOliver Schneider-23/+22
2017-12-04rustc_back: replace tempdir with crates.io version.Irina-Gabriela Popa-1/+1
2017-12-04rustc_back: move dynamic_lib to rustc_metadata.Irina-Gabriela Popa-1/+1
2017-11-25rustbuild: Enable WebAssembly backend by defaultAlex Crichton-3/+0
This commit alters how we compile LLVM by default enabling the WebAssembly backend. This then also adds the wasm32-unknown-unknown target to get compiled on the `cross` builder and distributed through rustup. Tests are not yet enabled for this target but that should hopefully be coming soon!
2017-11-21allow loading external files in documentationQuietMisdreavus-4/+6
Partial implementation of https://github.com/rust-lang/rfcs/pull/1990 (needs error reporting work) cc #44732
2017-11-20address review commentsAlex Burka-2/+2
2017-11-20tidy 😡Alex Burka-1/+3
2017-11-19use -Z flag instead of env varAlex Burka-2/+2
2017-11-05rustdoc: add #[allow(unused)] to every doctestQuietMisdreavus-4/+12
also modify the order crate attributes are applied, to have a better order of how things can override lints, either per-crate or per-test
2017-10-20Add short message-formatGuillaume Gomez-1/+2
2017-10-15rustbuild: Support specifying archiver and linker explicitlyVadim Petrochenkov-5/+13
2017-10-14Auto merge of #44867 - kennytm:rustdoc-md-test-title, r=alexcrichtonbors-27/+47
doc-test: In Markdown tests, Use all of `<h1>` to `<h6>` as the test name This mainly simplifies debugging error index tests, as the error codes are `<h2>`s in the huge document containing all codes.
2017-10-10Auto merge of #44822 - frewsxcv:frewsxcv-eprintln, r=Kimundibors-5/+4
Migrate to eprint/eprintln macros where appropriate. None
2017-10-08doc-test: In Markdown tests, Use all of `<h1>` to `<h6>` as the test name.kennytm-27/+47
This mainly simplifies debugging error index tests, as the error codes are `<h2>`s in the huge document containing all codes.
2017-10-03Add fixme regarding remapping paths for doctestsPhilip Craig-0/+2
2017-09-28Migrate to eprint/eprintln macros where appropriate.Corey Farwell-5/+4
2017-09-26don't let rustdoc get confused by text "fn main" in a line commentZack M. Davis-1/+15
This is in the matter of #21299.
2017-09-20incr.comp.: Remove IncrementalHashesMap and calculate_svh module.Michael Woerister-1/+1
2017-09-18incr.comp.: Remove tcx from StableHashingContext.Michael Woerister-1/+1
2017-09-14rustc: Remove `Session::dep_graph`Alex Crichton-9/+10
This commit removes the `dep_graph` field from the `Session` type according to issue #44390. Most of the fallout here was relatively straightforward and the `prepare_session_directory` function was rejiggered a bit to reuse the results in the later-called `load_dep_graph` function. Closes #44390
2017-09-12Remove the `cstore` reference from Session in order to prepare encapsulating ↵Michael Woerister-2/+2
CrateStore access in tcx.
2017-09-09rustc: Remove `DepGraph` handling from rustc_metadataAlex Crichton-2/+2
This should now be entirely tracked through queries, so no need to have a `DepGraph` in the `CStore` object any more!
2017-08-30Make fields of `Span` privateVadim Petrochenkov-1/+1
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-12/+12
Like #43008 (f668999), but _much more aggressive_.