Commit Graph

2624 Commits

Author SHA1 Message Date
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
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
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
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
Jeffrey Seyfried
f10f50b426 Refactor how global paths are represented (for both ast and hir). 2016-12-22 06:14:35 +00:00
Alex Crichton
21f33dbf71 Rollup merge of #38418 - michaelwoerister:def_path_cleanup, r=eddyb
Cleanup refactoring around DefPath handling

This PR makes two big changes:
* All DefPaths of a crate are now stored in metadata in their own table (as opposed to `DefKey`s as part of metadata `Entry`s.
* The compiler will no longer allocate a pseudo-local DefId for inlined HIR nodes (because those are gross). Inlined HIR nodes will have a NodeId but they don't have there own DefId anymore. Turns out they were not needed anymore either. Hopefully HIR inlining will be gone completely one day but if until then we start needing to be able to map inlined NodeIds to original DefIds, we can add an additional table to metadata that allows for reconstructing this.

Overall this makes for some nice simplifications and removal of special cases.

r? @eddyb

cc @rust-lang/compiler
2016-12-20 12:59:05 -08:00
Alex Crichton
55b8660b67 Rollup merge of #38395 - tshepang:nit, r=steveklabnik
rustdoc: a formatting nit
2016-12-20 12:59:04 -08:00
QuietMisdreavus
941b6b0c0c rustdoc: properly calculate line length for impl where clauses 2016-12-20 11:33:34 -06:00
Clar Charr
17dd0e5cd9 Don't @import normalize.css. 2016-12-19 18:00:29 -05:00
Michael Woerister
3a82b0da3d Don't try get local DefId of imported macro in rustdoc. 2016-12-19 14:24:33 -05:00
Jeffrey Seyfried
e80d1a8faf Remove MacroDef's fields imported_from and allow_internal_unstable,
remove `export` argument of `resolver.add_macro()`.
2016-12-18 23:26:29 +00:00
Tshepang Lekhonkhobe
8cd3081b5a rustdoc: a formatting nit 2016-12-15 20:43:57 +02:00
Oliver Middleton
e395fd12dd rustdoc: Fix invalid HTML in stability notices
`em` tags cannot contain `p` tags so just use a `div` instead.
2016-12-13 20:59:58 +00:00
bors
b1a2ab86db Auto merge of #38179 - michael-zapata:rf/harmonise_rustdoc_errors, r=GuillaumeGomez
feat(rustdoc): harmonise error messages

Based on unix tools wording, it follows a standard format: `program_name: context: error message`, potentially prompting the user to use the `--help` option.

This is clearly meant to trigger some discussion on #38084, as messages still use `stdout` and `stderr` somewhat arbitrarily, and there are a few `error!()` calls as well.
2016-12-13 06:29:25 +00:00
Corey Farwell
e3363f2772 Rollup merge of #38264 - ollie27:rustdoc_src_macro, r=brson
rustdoc: Remove broken src links from reexported items from macros

When an item is defined in an external macro it doesn't get a real
filename so we need to filter out these when generating src links for
reexported items.
2016-12-12 14:10:33 -05:00
Corey Farwell
5e425b7b4b Rollup merge of #38164 - sourcefrog:fonts, r=GuillaumeGomez
Avoid using locally installed Source Code Pro font (fixes #24355).

In some versions of this font the ampersands are drawn badly.

A doc tree built with this change is at https://storage.googleapis.com/mbp-rust-builds/fonts/doc/std/index.html

I'm not seeing this problem locally so I'm not sure this fixes it, but based on the diagnosis in the bug it should.

I've made this a minimal change by only removing the one problematic font but maybe for consistency every font should be read from the Rust docs tree?
2016-12-12 14:10:33 -05:00
Oliver Middleton
4f15e1183c 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.
2016-12-12 18:39:36 +00:00
Michael Zapata
430d39da9d
feat(rustdoc): harmonise error messages
Based on unix tools wording, it follows a standard format:
`program_name: context: error message` on stderr, prompting the user
to use the `--help` option in case of misuse.
2016-12-12 15:26:28 +01:00
bors
b4b1e5ece2 Auto merge of #38049 - frewsxcv:libunicode, r=alexcrichton
Rename 'librustc_unicode' crate to 'libstd_unicode'.

Fixes https://github.com/rust-lang/rust/issues/26554.
2016-12-12 13:19:33 +00:00
Oliver Middleton
c6c3a2763b rustdoc: Remove broken src links from reexported items from macros
When an item is defined in an external macro it doesn't get a real
filename so we need to filter out these when generating src links for
reexported items.
2016-12-09 14:56:55 +00:00
Jeffrey Seyfried
6ffa274bb5 Fix doc-tests on exported macro_rules!. 2016-12-08 11:07:39 +00:00
bors
209308439a Auto merge of #38105 - ollie27:rustdoc_deterministic_js, r=GuillaumeGomez
rustdoc: Sort lines in search index and implementors js

This means the files are generated deterministically even with rustdoc running in parallel.

Fixes the first part of #30220.
2016-12-07 16:32:48 +00:00
Mark-Simulacrum
1eab19dba8 Refactor ty::FnSig to privatize all fields 2016-12-05 22:22:49 -07:00
Martin Pool
bee82e8837 Avoid using locally installed Source Code Pro font (fixes #24355).
In some versions of this font the ampersands are drawn badly.
2016-12-04 13:44:19 -08:00
bors
c80c31a502 Auto merge of #38053 - eddyb:lazy-9, r=nikomatsakis
[9/n] rustc: move type information out of AdtDef and TraitDef.

_This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37688) | [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>

Both `AdtDef` and `TraitDef` contained type information (field types, generics and predicates) which was required to create them, preventing their use before that type information exists, or in the case of field types, *mutation* was required, leading to a variance-magicking implementation of `ivar`s.

This PR takes that information out and the resulting cleaner setup could even eventually end up merged with HIR, because, just like `AssociatedItem` before it, there's no dependency on types anymore.
(With one exception, variant discriminants should probably be moved into their own map later.)
2016-12-02 15:06:36 +00:00
Oliver Middleton
d6ec686d37 rustdoc: Sort lines in search index and implementors js
This means the files are generated deterministically even with rustdoc
running in parallel.
2016-12-01 13:10:49 +00:00
bors
827eba4e70 Auto merge of #37911 - liigo:rustdoc-playground, r=alexcrichton
rustdoc: get back missing crate-name when --playground-url is used

follow up PR #37763
r? @alexcrichton (since you r+ed to #37763 )

----

Edit: When `#![doc(html_playground_url="")]` is used, the current crate name is saved to `PLAYGROUND`, so rustdoc may generate `extern crate NAME;` into code snips automatically. But when `--playground-url` was introduced in PR #37763, I forgot saving crate name to `PLAYGROUND`. This PR fix that.

----

Update:
- add test
- unstable `--playground-url`
2016-12-01 07:07:32 +00:00
bors
ecff71a45c Auto merge of #37800 - alexcrichton:new-bootstrap, r=eddyb
Update the bootstrap compiler

Now that we've got a beta build, let's use it!
2016-11-30 19:17:24 +00:00
Alex Crichton
2186660b51 Update the bootstrap compiler
Now that we've got a beta build, let's use it!
2016-11-30 10:38:08 -08:00
bors
3abaf43f77 Auto merge of #37954 - eddyb:rustdoc-2, r=alexcrichton
rustdoc: link to cross-crate sources directly.

Fixes #37684 by implementing proper support for getting the `Span` of definitions across crates.
In rustdoc this is used to generate direct links to the original source instead of fragile redirects.

This functionality could be expanded further for making error reporting code more uniform and seamless across crates, although at the moment there is no actual source to print, only file/line/column information.

Closes #37870 which is also "fixes" #37684 by throwing away the builtin macro docs from libcore.
After this lands, #37727 could be reverted, although it doesn't matter much either way.
2016-11-30 07:46:00 +00:00
Corey Farwell
274777a158 Rename 'librustc_unicode' crate to 'libstd_unicode'.
Fixes #26554.
2016-11-30 01:24:01 -05:00
Eduard-Mihai Burtescu
900191891f rustdoc: link to cross-crate sources directly. 2016-11-30 04:48:56 +02:00
bors
8e373b4787 Auto merge of #37965 - Mark-Simulacrum:trait-obj-to-exis-predicate, r=eddyb
Refactor TraitObject to Slice<ExistentialPredicate>

For reference, the primary types changes in this PR are shown below. They may add in the understanding of what is discussed below, though they should not be required.

We change `TraitObject` into a list of `ExistentialPredicate`s to allow for a couple of things:
 - Principal (ExistentialPredicate::Trait) is now optional.
 - Region bounds are moved out of `TraitObject` into `TyDynamic`. This permits wrapping only the `ExistentialPredicate` list in `Binder`.
 - `BuiltinBounds` and `BuiltinBound` are removed entirely from the codebase, to permit future non-constrained auto traits. These are replaced with `ExistentialPredicate::AutoTrait`, which only requires a `DefId`. For the time being, only `Send` and `Sync` are supported; this constraint can be lifted in a future pull request.
 - Binder-related logic is extracted from `ExistentialPredicate` into the parent (`Binder<Slice<EP>>`), so `PolyX`s are inside `TraitObject` are replaced with `X`.

The code requires a sorting order for `ExistentialPredicate`s in the interned `Slice`. The sort order is asserted to be correct during interning, but the slices are not sorted at that point.

1. `ExistentialPredicate::Trait` are defined as always equal; **This may be wrong; should we be comparing them and sorting them in some way?**
1. `ExistentialPredicate::Projection`: Compared by `ExistentialProjection::sort_key`.
1. `ExistentialPredicate::AutoTrait`: Compared by `TraitDef.def_path_hash`.

Construction of `ExistentialPredicate`s is conducted through `TyCtxt::mk_existential_predicates`, which interns a passed iterator as a `Slice`. There are no convenience functions to construct from a set of separate iterators; callers must pass an iterator chain. The lack of convenience functions is primarily due to few uses and the relative difficulty in defining a nice API due to optional parts and difficulty in recognizing which argument goes where. It is also true that the current situation isn't significantly better than 4 arguments to a constructor function; but the extra work is deemed unnecessary as of this time.

```rust
// before this PR
struct TraitObject<'tcx> {
    pub principal: PolyExistentialTraitRef<'tcx>,
    pub region_bound: &'tcx ty::Region,
    pub builtin_bounds: BuiltinBounds,
    pub projection_bounds: Vec<PolyExistentialProjection<'tcx>>,
}

// after
pub enum ExistentialPredicate<'tcx> {
    // e.g. Iterator
    Trait(ExistentialTraitRef<'tcx>),
    // e.g. Iterator::Item = T
    Projection(ExistentialProjection<'tcx>),
    // e.g. Send
    AutoTrait(DefId),
}
```
2016-11-29 20:41:38 -06:00
Liigo Zhuang
d5785a368e rustdoc: fix up --playground-url 2016-11-30 10:33:23 +08:00
Liigo Zhuang
943bf96300 unstable --playground-url, add test code 2016-11-30 10:33:22 +08:00
Liigo Zhuang
c1a6f17031 rustdoc: get back missing crate-name when --playground-url is used
follow up PR #37763
2016-11-30 10:33:22 +08:00
Eduard-Mihai Burtescu
07ff914be1 rustc: simplify AdtDef by removing the field types and ty::ivar. 2016-11-29 21:24:26 +02:00
Eduard-Mihai Burtescu
3f338eed99 rustc: remove type information from TraitDef. 2016-11-29 21:24:26 +02:00
Florian Diebold
593b273659 librustdoc: Fix compilation after visitor change 2016-11-29 13:18:02 +01:00
Florian Diebold
bf298aebfd Fix doc test collection 2016-11-29 13:04:27 +01:00
Mark-Simulacrum
a79c80d0b0 Adds TyCtxt::require_lang_item(LangItem) to simplify lang item requires.
Replaces instances of tcx.lang_items.require(..) with fatal unwrap with
this method.
2016-11-28 18:09:15 -07:00
Mark-Simulacrum
bb35d50cad Refactor TyTrait to contain a interned ExistentialPredicate slice.
Renames TyTrait to TyDynamic.
2016-11-28 18:09:13 -07:00