Commit Graph

2666 Commits

Author SHA1 Message Date
Guillaume Gomez
cbfc8fe3eb Force backline on all where in docs 2017-01-21 15:34:11 +01:00
Alex Crichton
e1129b75f8 Rollup merge of #39142 - nikomatsakis:issue-38973, r=brson
run rustdoc tests in the same sort of thread rustc runs in

Not sure yet if this is the problem in #38973 but seems like an improvement regardless.

r? @brson
2017-01-20 08:35:48 -08:00
Alex Crichton
17294d98b9 Rollup merge of #39118 - jseyfried:token_tree_based_parser, r=nrc
Refactor the parser to consume token trees

This is groundwork for efficiently parsing attribute proc macro invocations, bang macro invocations, and `TokenStream`-based attributes and fragment matchers.

This improves parsing performance by 8-15% and expansion performance by 0-5% on a sampling of the compiler's crates.

r? @nrc
2017-01-20 08:35:47 -08:00
bors
f0b4207598 Auto merge of #39136 - keeperofdakeys:proc-macro-doc-test, r=alexcrichton
Stop warning when doc testing proc macro crates

Fixes #39064

Add the test option to the session struct that is passed
to phase_2_configure_and_expand function inside the
rustdoc test module.

This prevents the warning code from triggering when
parsing proc_macro_derive attributes, just like when
`--test` is normally invoked.

This change makes the warning disappear, but I'm not sure what else it might change. So this early PR is mainly to run the test suite, and to get feedback.
2017-01-19 21:15:12 +00:00
Josh
c759aea5b3 Stop warning when doc testing proc macro crates
Add the actually_rustdoc option to the session that
is passed  to phase_2_configure_and_expand function
inside the rustdoc test module.

This prevents the warning code from triggering when
parsing proc_macro_derive attributes, just like when
`--test` is normally invoked.
2017-01-19 08:31:29 +11:00
Niko Matsakis
d25f066c07 run rustdoc tests in the same sort of thread rustc runs in 2017-01-17 18:15:08 -05:00
Jeffrey Seyfried
0b9e26f390 Fix fallout in rustdoc. 2017-01-17 21:06:45 +00:00
Vadim Petrochenkov
66ef5f2bb5 Rename ObjectSum into TraitObject in AST/HIR 2017-01-17 10:41:44 +03:00
Vadim Petrochenkov
2efe865d22 AST/HIR: Merge ObjectSum and PolyTraitRef 2017-01-17 01:52:47 +03:00
bors
47410b23aa Auto merge of #39076 - ollie27:rustdoc_stab_prim, r=GuillaumeGomez
rustdoc: Give primitive types stability attributes

This is especially important for i128/u128 to make it clear they are
unstable in the docs.
2017-01-16 13:22:29 +00:00
Guillaume Gomez
b7678808af Fix missing blank space issue 2017-01-15 18:38:00 +01:00
Oliver Middleton
f48f3d7584 rustdoc: Give primitive types stability attributes
This is especially important for i128/u128 to make it clear they are
unstable in the docs.
2017-01-15 09:08:29 +00:00
bors
27b9e6d450 Auto merge of #38569 - chris-morgan:rustdoc-highlight-kw-2, r=steveklabnik
Fix rustdoc highlighting of `&` and `*`

Whitespace tokens were included, so the span check used with `&` was incorrect, and it was never highlighted as kw-2 (RefKeyword).

The `*` in `*foo` and `*const T` should also be highlighted kw-2, so I added them. Note that this *will* cause mishighlighting of code like `1*2`, but that should have been written `1 * 2`. Same deal with `1&2`.
2017-01-12 18:32:28 +00:00
Manish Goregaokar
0a1c9ae022 Improved rustdoc rendering for unstable features 2017-01-09 21:50:00 -08:00
bors
9749df52b7 Auto merge of #38244 - estebank:escape-reason-docs, r=ollie27
rustdoc: escape the deprecated and unstable reason text

Fix #38220.
Instead of the [current output](https://doc.rust-lang.org/std/boxed/trait.FnBox.html):

<img width="967" alt="incorrect unescaped unstable reason in docs" src="https://cloud.githubusercontent.com/assets/1606434/21021898/73121d42-bd2f-11e6-8076-8a5127dbc010.png">

display:

<img width="979" alt="escaped unstable reason in docs" src="https://cloud.githubusercontent.com/assets/1606434/21021876/52eb0f88-bd2f-11e6-9088-58bdc7d92328.png">
2017-01-09 19:38:50 +00:00
bors
cbf88730e7 Auto merge of #38813 - eddyb:lazy-11, r=nikomatsakis
[11/n] Separate ty::Tables into one per each body.

_This is part of a series ([prev](https://github.com/rust-lang/rust/pull/38449) | [next]()) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments._

<hr>

In order to track the results of type-checking and inference for incremental recompilation, they must be stored separately for each function or constant value, instead of lumped together.

These side-`Tables` also have to be tracked by various passes, as they visit through bodies (all of which have `Tables`, even if closures share the ones from their parent functions). This is usually done by switching a `tables` field in an override of `visit_nested_body` before recursing through `visit_body`, to the relevant one and then restoring it - however, in many cases the nesting is unnecessary and creating the visitor for each body in the crate and then visiting that body, would be a much cleaner solution.

To simplify handling of inlined HIR & its side-tables, their `NodeId` remapping and entries HIR map were fully stripped out, which means that `NodeId`s from inlined HIR must not be used where a local `NodeId` is expected. It might be possible to make the nodes (`Expr`, `Block`, `Pat`, etc.) that only show up within a `Body` have IDs that are scoped to that `Body`, which would also allow `Tables` to use `Vec`s.

That last part also fixes #38790 which was accidentally introduced in a previous refactor.
2017-01-08 11:36:52 +00:00
bors
7ac9d337dc Auto merge of #38679 - alexcrichton:always-deny-warnings, r=nrc
Remove not(stage0) from deny(warnings)

Historically this was done to accommodate bugs in lints, but there hasn't been a
bug in a lint since this feature was added which the warnings affected. Let's
completely purge warnings from all our stages by denying warnings in all stages.
This will also assist in tracking down `stage0` code to be removed whenever
we're updating the bootstrap compiler.
2017-01-08 08:22:06 +00:00
Eduard-Mihai Burtescu
85a4a192c7 rustc: keep track of tables everywhere as if they were per-body. 2017-01-06 22:23:29 +02:00
bors
05f4a75eba Auto merge of #38414 - estebank:doc-dissambiguate, r=steveklabnik
Rustdoc: disambiguate Implementors when the type name is not unique

Presentation [goes from](https://doc.rust-lang.org/stable/std/iter/trait.ExactSizeIterator.html#implementors):

<img width="492" alt="" src="https://cloud.githubusercontent.com/assets/1606434/21276752/b2b50474-c387-11e6-96e1-9766851da269.png">

to:

<img width="787" alt="" src="https://cloud.githubusercontent.com/assets/1606434/21276763/bb37f6b0-c387-11e6-8596-9163cb254674.png">

on cases where there're multiple implementors with the same name.

Fixes #37762.
2017-01-04 17:11:02 +00:00
Seo Sanghyeon
631955888e Avoid rustdoc ICE when an unstable feature is used 2017-01-02 20:32:58 +09:00
bors
08babdb412 Auto merge of #38653 - Mark-Simulacrum:dropless-arena, r=eddyb
Add a DroplessArena and utilize it as a more efficient arena when possible

I will collect performance (probably just `-Ztime-passes`, and more if that shows significant differences, perhaps).

6feba98 also fixes a potential infinite loop if inplace reallocation failed for `TypedArena` (and `DroplessArena` via copied code).

r? @eddyb
2017-01-01 02:39:40 +00:00
Mark Simulacrum
0e43b378c1 Split CtxtArenas into GlobalArenas and CtxtInterners.
CtxtInterners contains a single DroplessArena, while GlobalArenas
contains the TypedArenas still required for the remaining
Drop-containing types.
2016-12-31 11:48:48 -07:00
est31
85ec09187c Make rustdoc aware of the primitive i128 type
Many thanks to ollie27 for spotting all the places.
2016-12-30 15:17:27 +01:00
est31
9e99213831 Compilation fixes 2016-12-30 15:17:27 +01:00
Simonas Kazlauskas
9aad2d551e Add a way to retrieve constant value in 128 bits
Fixes rebase fallout, makes code correct in presence of 128-bit constants.

This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-30 15:17:26 +01:00
Simonas Kazlauskas
b0e55a83a8 Such large. Very 128. Much bits.
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which
understands and supports 128-bit integers throughout.

The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to
iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported,
this strategy is good enough to get past the first bootstrap stages to end up with a fully working
128-bit capable compiler.

In order for this strategy to work, number of locations had to be changed to use associated
max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?)
had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works
(former not necessarily producing the right results in stage1).

This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-30 15:15:44 +01:00
Alex Crichton
9b0b5b45db Remove not(stage0) from deny(warnings)
Historically this was done to accommodate bugs in lints, but there hasn't been a
bug in a lint since this feature was added which the warnings affected. Let's
completely purge warnings from all our stages by denying warnings in all stages.
This will also assist in tracking down `stage0` code to be removed whenever
we're updating the bootstrap compiler.
2016-12-29 21:07:20 -08:00
Alex Crichton
1b4acae381 Rollup merge of #38671 - ollie27:rustdoc_stab_em_div_fix, r=frewsxcv
rustdoc: Fix broken CSS for trait items

The `stab` class shouldn't have any effect here so can be removed as currently it adds an outline.

This was accidentally caused by #38329.

[before](https://doc.rust-lang.org/nightly/std/iter/trait.ExactSizeIterator.html) [after](https://ollie27.github.io/rust_doc_test/std/iter/trait.ExactSizeIterator.html)
2016-12-29 17:26:36 -08:00
Oliver Middleton
b9038c8e9f rustdoc: Fix broken CSS for trait items 2016-12-29 02:23:49 +00:00
bors
4ecc85beb3 Auto merge of #38449 - eddyb:lazy-10, r=nikomatsakis
[10/n] Split constants and functions' arguments into disjoint bodies.

_This is part of a series ([prev](https://github.com/rust-lang/rust/pull/38053) | [next]()) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments._

<hr>

Finishes the signature-body split started in #37918, namely:
* `trait` items are separated just like `impl` items were, for uniformity, closing #37712
* `static`s, `const`s (including associated ones), `enum` discriminants and array lengths get bodies
  * even the count in "repeat expressions", i.e. `n` in `[x; n]`, which fixes #24414
* arguments' patterns are moved to the bodies, with the types staying in `FnDecl`
  * `&self` now desugars to `self: &Self` instead of `self: &_` (similarly for other `self` forms)
  * `astconv`'s and metadata's (for rustdoc) informative uses are explicitly ignored for the purposes of the dep graph. this could be fixed in the future by hashing the exact information being extracted about the arguments as opposed to generating a dependency on *the whole body*
2016-12-28 20:19:39 +00:00
Eduard-Mihai Burtescu
ee0ea95343 rustdoc: pretty-print nested bodies in inlined constants. 2016-12-28 11:29:21 +02:00
Eduard-Mihai Burtescu
4aae835803 rustc: always print nested nodes where a HIR map is available. 2016-12-28 11:29:20 +02:00
Eduard-Mihai Burtescu
f64e73b6ec rustc: simplify constant cross-crate loading and rustc_passes::consts. 2016-12-28 11:29:19 +02:00
Eduard-Mihai Burtescu
f89856be6c rustc: move function arguments into hir::Body. 2016-12-28 11:29:19 +02:00
Eduard-Mihai Burtescu
e64f64a2fc rustc: separate bodies for static/(associated)const and embedded constants. 2016-12-28 11:27:57 +02:00
Eduard-Mihai Burtescu
864928297d rustc: separate TraitItem from their parent Item, just like ImplItem. 2016-12-28 11:21:45 +02:00
Eduard-Mihai Burtescu
6ebb6fdbee hir: lower ImplicitSelf to resolved Self TyQPath's. 2016-12-28 11:21:45 +02:00
bors
17f1fba353 Auto merge of #38589 - aidanhs:aphs-stage0-rustdoc-test, r=alexcrichton
Teach `rustdoc --test` about `--sysroot`, pass it when testing rust

This permits rustdoc tests to work in stage0.

Logical continuation of #36586.

Snippet from https://github.com/rust-lang/rust/issues/38575#issuecomment-269090724:

> it should actually be possible to run all the libstd tests immediately after creating std of stage0-out - there's no reason to build librustc at all if you've just made a change to (for example) libcollections, `./x.py test src/libcollections --stage 0 -v --incremental` should just work

This PR makes it so (or appears to in my testing).

r? @alexcrichton
2016-12-28 07:05:07 +00:00
Esteban Küber
e766c465d2 Merge branch 'master' into escape-reason-docs 2016-12-27 17:02:52 -08:00
bors
314c28b729 Auto merge of #38329 - ollie27:rustdoc_stab_em_div, r=steveklabnik
rustdoc: Fix invalid HTML in stability notices

`em` tags cannot contain `p` tags so use `div`s instead of `em`s as the Markdown will create `p` tags.
2016-12-27 21:10:31 +00:00
Esteban Küber
96c52d4fd8 Add unittest 2016-12-25 13:02:35 -08:00
Steve Klabnik
10b6097c55 Rollup merge of #38497 - QuietMisdreavus:rustdoc-where-again, r=steveklabnik
rustdoc: properly calculate line length for where clauses

Apparently, while I was cleaning up #37190, I regressed the formatting for long where clauses, where it wouldn't take the "prefix" length into account when deciding whether to break the line up. This patch fixes that.
2016-12-24 14:29:23 -05:00
Steve Klabnik
80d745a132 Rollup merge of #38480 - clarcharr:import_css, r=steveklabnik
Don't @import normalize.css.

This lets the browser load both files in parallel instead of waiting for `rustdoc.css` to load first.
2016-12-24 14:29:22 -05:00
Aidan Hobson Sayers
babb7daf35 Teach rustdoc --test about --sysroot, pass it when testing rust
This permits rustdoc tests to work in stage0
2016-12-24 17:15:07 +00:00
Esteban Küber
346a442110 use same param name across methods 2016-12-22 23:20:22 -08:00
Chris Morgan
c9a6e874ca Fix rustdoc highlighting of & and *.
Whitespace tokens were included, so the span check used with `&` was
incorrect, and it was never highlighted as kw-2.

The `*` in `*foo` and `*const T` should also be highlighted kw-2, so I
added them. Note that this *will* cause mishighlighting of code like
`1*2`, but that should have been written `1 * 2`. Same deal with `1&2`.
2016-12-23 12:23:50 +05:30
bors
82611a0224 Auto merge of #38232 - jseyfried:refactor_global_paths, r=nrc
Refactor global paths

This PR removes the field `global: bool` from `ast::Path` and `hir::Path`, instead representing a global path `::foo::bar` as `{{root}}::foo::bar`, where `{{root}}` is a virtual keyword `keywords::CrateRoot`.

Also, fixes #38016.

r? @nrc
2016-12-23 06:22:45 +00:00
bors
a173778d1d Auto merge of #38330 - ollie27:rustdoc_short_summaries, r=steveklabnik
rustdoc: Fix short summaries in search results

They should be run through a Markdown renderer in rustdoc to remove
links.

This also fixes the mouse over text for the Crates list on the sidebar.

[before](https://doc.rust-lang.org/nightly/std/index.html?search=ord) [after](https://ollie27.github.io/rust_doc_test/std/index.html?search=ord)
2016-12-22 22:28:41 +00:00
Esteban Küber
de69a3b7e5 fix String to &str cast 2016-12-21 23:13:11 -08:00
Jeffrey Seyfried
f10f50b426 Refactor how global paths are represented (for both ast and hir). 2016-12-22 06:14:35 +00:00