summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2016-12-13Auto merge of #38179 - michael-zapata:rf/harmonise_rustdoc_errors, ↵bors-13/+29
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-12Rollup merge of #38264 - ollie27:rustdoc_src_macro, r=brsonCorey Farwell-0/+7
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-12Rollup merge of #38164 - sourcefrog:fonts, r=GuillaumeGomezCorey Farwell-2/+4
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-12feat(rustdoc): harmonise error messagesMichael Zapata-13/+29
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-12Auto merge of #38049 - frewsxcv:libunicode, r=alexcrichtonbors-2/+2
Rename 'librustc_unicode' crate to 'libstd_unicode'. Fixes https://github.com/rust-lang/rust/issues/26554.
2016-12-09rustdoc: Remove broken src links from reexported items from macrosOliver Middleton-0/+7
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-08Fix doc-tests on exported `macro_rules!`.Jeffrey Seyfried-0/+4
2016-12-07Auto merge of #38105 - ollie27:rustdoc_deterministic_js, r=GuillaumeGomezbors-24/+26
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-05Refactor ty::FnSig to privatize all fieldsMark-Simulacrum-3/+3
2016-12-04Avoid using locally installed Source Code Pro font (fixes #24355).Martin Pool-2/+4
In some versions of this font the ampersands are drawn badly.
2016-12-02Auto merge of #38053 - eddyb:lazy-9, r=nikomatsakisbors-10/+8
[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-01rustdoc: Sort lines in search index and implementors jsOliver Middleton-24/+26
This means the files are generated deterministically even with rustdoc running in parallel.
2016-12-01Auto merge of #37911 - liigo:rustdoc-playground, r=alexcrichtonbors-10/+16
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-11-30Auto merge of #37800 - alexcrichton:new-bootstrap, r=eddybbors-2/+0
Update the bootstrap compiler Now that we've got a beta build, let's use it!
2016-11-30Update the bootstrap compilerAlex Crichton-2/+0
Now that we've got a beta build, let's use it!
2016-11-30Auto merge of #37954 - eddyb:rustdoc-2, r=alexcrichtonbors-215/+169
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-30Rename 'librustc_unicode' crate to 'libstd_unicode'.Corey Farwell-2/+2
Fixes #26554.
2016-11-30rustdoc: link to cross-crate sources directly.Eduard-Mihai Burtescu-215/+169
2016-11-29Auto merge of #37965 - Mark-Simulacrum:trait-obj-to-exis-predicate, r=eddybbors-60/+55
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-30rustdoc: fix up --playground-urlLiigo Zhuang-11/+9
2016-11-30unstable --playground-url, add test codeLiigo Zhuang-4/+4
2016-11-30rustdoc: get back missing crate-name when --playground-url is usedLiigo Zhuang-0/+8
follow up PR #37763
2016-11-29rustc: simplify AdtDef by removing the field types and ty::ivar.Eduard-Mihai Burtescu-5/+5
2016-11-29rustc: remove type information from TraitDef.Eduard-Mihai Burtescu-5/+3
2016-11-29librustdoc: Fix compilation after visitor changeFlorian Diebold-6/+2
2016-11-29Fix doc test collectionFlorian Diebold-0/+4
2016-11-28Adds TyCtxt::require_lang_item(LangItem) to simplify lang item requires.Mark-Simulacrum-2/+1
Replaces instances of tcx.lang_items.require(..) with fatal unwrap with this method.
2016-11-28Refactor TyTrait to contain a interned ExistentialPredicate slice.Mark-Simulacrum-17/+10
Renames TyTrait to TyDynamic.
2016-11-28Remove BuiltinBound and BuiltinBounds.Mark-Simulacrum-39/+18
2016-11-28Refactor BuiltinBounds to Vec<DefId> on TraitObject.Mark-Simulacrum-2/+22
2016-11-28Privatize TraitObject.principal and add a method accessor, returning Option.Mark-Simulacrum-22/+26
2016-11-28rustc_typeck: save the type cache for rustdoc and save-analysis.Eduard Burtescu-7/+14
2016-11-28rustc: embed path resolutions into the HIR instead of keeping DefMap.Eduard-Mihai Burtescu-35/+51
2016-11-28rustc: desugar `use a::{b,c};` into `use a::b; use a::c;` in HIR.Eduard-Mihai Burtescu-134/+28
2016-11-28rustc: desugar UFCS as much as possible during HIR lowering.Eduard Burtescu-11/+30
2016-11-24rustdoc: we can now assume DocContext always has a TyCtxt.Eduard-Mihai Burtescu-328/+220
2016-11-24rustdoc: sidestep the main pipeline for test collection.Eduard-Mihai Burtescu-80/+93
2016-11-24rustdoc: use libsyntax ast::Attribute instead of "cleaning" them.Eduard-Mihai Burtescu-262/+266
2016-11-21Auto merge of #37824 - jseyfried:symbols, r=eddybbors-3/+3
Clean up `ast::Attribute`, `ast::CrateConfig`, and string interning This PR - removes `ast::Attribute_` (changing `Attribute` from `Spanned<Attribute_>` to a struct), - moves a `MetaItem`'s name from the `MetaItemKind` variants to a field of `MetaItem`, - avoids needlessly wrapping `ast::MetaItem` with `P`, - moves string interning into `syntax::symbol` (`ast::Name` is a reexport of `symbol::Symbol` for now), - replaces `InternedString` with `Symbol` in the AST, HIR, and various other places, and - refactors `ast::CrateConfig` from a `Vec` to a `HashSet`. r? @eddyb
2016-11-21Fix fallout in `rustdoc` and tests.Jeffrey Seyfried-3/+3
2016-11-20Rollup merge of #37881 - ollie27:rustdoc_stab_enum_macro, r=alexcrichtonGuillaume Gomez-2/+0
rustdoc: Remove unnecessary stability versions For some reason only on enum and macro pages, the stability version is rendered after the summary unlike all other pages. As it is already displayed at the top of the page for all items, this removes it for consistency and to prevent it from overlapping the summary text. Fixes #36093
2016-11-19rustdoc: Remove unnecessary stability versionsOliver Middleton-2/+0
For some reason only on enum and macro pages, the stability version is rendered after the summary unlike all other pages. As it is already displayed at the top of the page for all items, this removes it for consistency and to prevent it from overlapping the summary text.
2016-11-18Auto merge of #37763 - liigo:rustdoc-playground, r=alexcrichtonbors-4/+10
rustdoc: add cli argument `--playground-url` Add a new cli argument `--playground-url` for rustdoc: `rustdoc lib.rs --playground-url="https://play.rust-lang.org/"` `rustdoc book.md --playground-url="https://play.rust-lang.org/"` This makes it possible for tools like https://docs.rs to generate crate docs that can submit samples code to run at https://play.rust-lang.org, even if the crate's author *forgot* putting `#![doc(html_playground_url = "https://play.rust-lang.org/")]` to crate root. By the way, I'd like to say, many crate authors are not aware of existing of `#![doc(html_playground_url = "https://play.rust-lang.org/")]`. `--playground-url` may be reset by `--markdown-playground-url` or `#![doc(html_playground_url=...)]`, so it's backward compatible. @alexcrichton since you implemented playground-url related features.
2016-11-17Auto merge of #37660 - nikomatsakis:incremental-36349, r=eddybbors-6/+10
Separate impl items from the parent impl This change separates impl item bodies out of the impl itself. This gives incremental more resolution. In so doing, it refactors how the visitors work, and cleans up a bit of the collect/check logic (mostly by moving things out of collect that didn't really belong there, because they were just checking conditions). However, this is not as effective as I expected, for a kind of frustrating reason. In particular, when invoking `foo.bar()` you still wind up with dependencies on private items. The problem is that the method resolution code scans that list for methods with the name `bar` -- and this winds up touching *all* the methods, even private ones. I can imagine two obvious ways to fix this: - separating fn bodies from fn sigs (#35078, currently being pursued by @flodiebold) - a more aggressive model of incremental that @michaelwoerister has been advocating, in which we hash the intermediate results (e.g., the outputs of collect) so that we can see that the intermediate result hasn't changed, even if a particular impl item has changed. So all in all I'm not quite sure whether to land this or not. =) It still seems like it has to be a win in some cases, but not with the test cases we have just now. I can try to gin up some test cases, but I'm not sure if they will be totally realistic. On the other hand, some of the early refactorings to the visitor trait seem worthwhile to me regardless. cc #36349 -- well, this is basically a fix for that issue, I guess r? @michaelwoerister NB: Based atop of @eddyb's PR https://github.com/rust-lang/rust/pull/37402; don't land until that lands.
2016-11-17hash the contents of impl-item-ref by adding them to visitorNiko Matsakis-4/+5
Also simplify some of the `ty::AssociatedItem` representation, in particular by folding `has_value` into `hir::Defaultness`
2016-11-17when creating an AssociatedItem, read data from impl, not impl itemNiko Matsakis-2/+2
Before, when we created an AssociatedItem for impl item X, we would read the impl item itself. Now we instead load up the impl I that contains X and read the data from the `ImplItemRef` for X; actually, we do it for all impl items in I pre-emptively. This kills the last source of edges between a method X and a call to a method Y defined in the same impl. Fixes #37121
2016-11-17doc: nits and typos on commentsTshepang Lekhonkhobe-17/+17
2016-11-16fallout from separating impl-items from implsNiko Matsakis-1/+4
Basically adding `visit_impl_item` in various places and so forth.
2016-11-16Auto merge of #37773 - ollie27:rustdoc_inline_glob, r=brsonbors-69/+71
rustdoc: Fix some local inlining issues * Only inline public items when inlining glob imports. * Never inline while in a private module or a child of a private module. * Never inline impls. This allowed the removal of a workaround in the rendering code.
2016-11-14rustdoc: Fix some local inlining issuesOliver Middleton-69/+71
* Only inline public items when inlining glob imports. * Never inline while in a private module or a child of a private module. * Never inline impls. This allowed the removal of a workaround in the rendering code.