Commit Graph

386 Commits

Author SHA1 Message Date
Donato Sciarra 062bfbf39b mv codemap source_map 2018-08-19 23:01:01 +02:00
Donato Sciarra 82607d2cf3 mv (mod) codemap source_map 2018-08-19 23:01:00 +02:00
Donato Sciarra c655473378 mv CodeMap SourceMap 2018-08-19 23:00:59 +02:00
QuietMisdreavus 0511b01506 set the syntax edition in the driver's phase 1 2018-08-09 11:46:39 -05:00
Mark Rousskov 5fcef251d3 Move basic_options to impl of Default 2018-08-04 06:54:36 -06:00
Mark Rousskov 2a9344206b Normalize variants of CrateType to standard style
This is a clippy-breaking change.
2018-08-04 06:53:15 -06:00
Mark Rousskov 01d95558e6 Further extract error code switch
Removes dependency on UnstableFeatures from markdown rendering
2018-07-31 11:39:02 -06:00
Mark Rousskov 03e34f8f81 Remove dependency on error handling from find_testable_code 2018-07-31 11:37:21 -06:00
Mark Rousskov de5cebdba5 Provide test configuration through struct
This is far more sound than passing many different arguments of the same
type.
2018-07-31 11:37:21 -06:00
Mark Rousskov ad40e4517f Provide warnings for invalid code blocks in markdown files
Previously we would only warn on Rust code but we can also do so when
testing markdown (the diag::Handler is available).
2018-07-31 11:37:21 -06:00
Tatsuyuki Ishi 66c4dc9769 Add missing dyn 2018-07-25 10:24:31 +09:00
QuietMisdreavus 76e33b4eb4 force the doctest rustc thread to share the name of the test 2018-07-24 10:35:55 -05:00
QuietMisdreavus 41e7ac16c4 report doctest compile failures correctly 2018-07-20 10:13:38 -05:00
QuietMisdreavus d17a378b16 rustdoc: set panic output before starting compiler thread pool 2018-07-20 10:13:37 -05:00
kennytm c0db1aafea
Rollup merge of #52385 - GuillaumeGomez:pass-edition-to-parser, r=QuietMisdreavus
Pass edition flags to compiler from rustdoc as expected

Fixes #52357.
2018-07-17 19:24:57 +08:00
csmoe 5b0cf56f32 ItemKind 2018-07-16 15:09:17 +02:00
Guillaume Gomez 65e6b2b4a8 Pass edition flags to compiler from rustdoc as expected 2018-07-14 20:45:44 +02:00
Vadim Petrochenkov f0622dfe5d Use `Ident`s for associated item definitions in HIR
Remove emulation of hygiene with gensyms
2018-06-28 11:04:50 +03:00
Bastien Orivel c863049225 Fix tidy 2018-06-20 19:28:27 +02:00
Bastien Orivel ae9a27185e Replace tempdir by tempfile in librustdoc 2018-06-20 19:28:27 +02:00
Vadim Petrochenkov 189c0a1297 Use `Ident`s for fields in HIR 2018-05-26 14:41:58 +03:00
Irina Popa b63d7e2b1c Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
John Kåre Alsaker 022dff47e3 Add a Rayon thread pool 2018-05-13 01:28:20 +02:00
bors 9af69fe232 Auto merge of #50080 - klnusbaum:edition_49591, r=Manishearth
add --edition option

This adds an official `edition` flag to the rust compiler
2018-04-21 05:28:21 +00:00
Kurtis Nusbaum c1d8aa829c fix some small compile errors 2018-04-20 14:47:23 -07:00
Alex Crichton ca79ba300a Tweak some stabilizations in libstd
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-19 16:53:12 -07:00
QuietMisdreavus 1a0d7a8207 add -C parameter to rustdoc 2018-04-13 16:07:12 -05:00
QuietMisdreavus 43301e55a1 add target features when extracting and running doctests 2018-04-10 19:22:11 -05:00
QuietMisdreavus 8145a77a28 suppress the default allow(unused) under --display-warnings 2018-04-02 14:37:16 -05:00
Mark Simulacrum 5d3916d566
Rollup merge of #49451 - QuietMisdreavus:epoch-doctests, r=GuillaumeGomez
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-04-01 18:04:54 +02:00
QuietMisdreavus d9bf37a5ae use --edition for doctests, rather than just the crate 2018-03-28 13:54:05 +02:00
QuietMisdreavus 7f548bc8c6 add --edition flag to rustdoc 2018-03-27 16:31:19 +02:00
boats 5fc7e0a2ba
Remove unnecessary trait import. 2018-03-26 07:41:45 -07:00
kennytm 95967c7c72
Rollup merge of #49188 - memoryleak47:macro_use_doctest, r=QuietMisdreavus
Put `#[macro_use] extern crate <crate>` before fn main() in doctests

Closes #49174.
2018-03-22 22:43:41 +08:00
memoryleak47 25c8210c01 Put `#[macro_use] extern crate <crate>` before fn main() in doctests 2018-03-19 23:48:02 +01:00
Guillaume Gomez 7786f70437 Add warning for invalid start of code blocks in rustdoc 2018-03-18 20:34:49 +01:00
John Kåre Alsaker cbdf4ec03e Remove syntax and syntax_pos thread locals 2018-03-14 11:56:01 +01:00
Michael Woerister 542bc75dea Turn features() into a query. 2018-03-05 11:05:01 +01:00
John Kåre Alsaker b74e97cf42 Replace Rc with Lrc for shared data 2018-03-02 10:48:52 +01:00
Guillaume Gomez f0343cbd1f
Rollup merge of #48106 - QuietMisdreavus:teleporting-crates, r=GuillaumeGomez
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-21 16:29:47 +01:00
Guillaume Gomez b7791b0c7e
Rollup merge of #48274 - GuillaumeGomez:remove-hoedown, r=QuietMisdreavus
Remove hoedown from rustdoc

Finally the time has come!

r? @QuietMisdreavus
2018-02-18 13:20:59 +01:00
QuietMisdreavus b3d6597855 move manual "extern crate" statements outside auto "fn main" in doctests 2018-02-17 16:51:39 -06:00
Guillaume Gomez 5bd5bc3f21 Remove hoedown from rustdoc
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-16 23:17:15 +01:00
QuietMisdreavus 70b5c458e6 add tests for the doctest construction functionality 2018-02-09 10:40:27 -06:00
QuietMisdreavus a58d1b5346 trim the body of doctests after partitioning 2018-02-09 09:24:23 -06:00
bors 560a2f4faf Auto merge of #45752 - estebank:highlight-primary, r=nikomatsakis
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-31 07:53:57 +00:00
Esteban Küber 08287c1e26 Toggle span highlighting on `-Zteach` 2018-01-29 08:59:15 -08:00
Alex Crichton 884715c654 rustc: Load the `rustc_trans` crate at runtime
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-27 19:16:21 -08:00
bjorn3 74c92c5562 Allow runtime switching between trans backends 2018-01-19 20:27:10 +01:00
Manish Goregaokar 730679685e Use correct line offsets for doctests (fixes #45868) 2018-01-10 10:10:34 +05:30