summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2016-07-04Auto merge of #34638 - zackmdavis:if_let_over_none_empty_block_arm, r=jseyfriedbors-36/+25
prefer `if let` to match with `None => {}` arm in some places This is a spiritual succesor to #34268 / 8531d581, in which we replaced a number of matches of None to the unit value with `if let` conditionals where it was judged that this made for clearer/simpler code (as would be recommended by Manishearth/rust-clippy's `single_match` lint). The same rationale applies to matches of None to the empty block. ---- r? @jseyfried
2016-07-03Auto merge of #34480 - jseyfried:remove_entry_points, r=nrcbors-6/+6
Remove redundant `CompileController` entry points Remove the `after_expand` and `after_write_deps` `CompileController` entry points. The only things that separate these entry points from `after_hir_lowering` are dep-info generation and HIR map construction, neither of which is computationally intensive or has the potential to error. r? @nrc
2016-07-03prefer `if let` to match with `None => {}` arm in some placesZack M. Davis-36/+25
This is a spiritual succesor to #34268/8531d581, in which we replaced a number of matches of None to the unit value with `if let` conditionals where it was judged that this made for clearer/simpler code (as would be recommended by Manishearth/rust-clippy's `single_match` lint). The same rationale applies to matches of None to the empty block.
2016-07-01Add the `after_expand` entry point between import resolution and the rest of ↵Jeffrey Seyfried-6/+6
name resolution
2016-06-30Auto merge of #34541 - jseyfried:rollup, r=jseyfriedbors-23/+1
Rollup of 5 pull requests - Successful merges: #34105, #34305, #34512, ~~#34531,~~ #34547
2016-06-30Rollup merge of #34547 - sanxiyn:pretty-lifetime, r=pnkfelixJeffrey Seyfried-2/+2
Fix pretty-printing of lifetime bound Fix #34527.
2016-06-29Rollup merge of #34536 - ollie27:rustdoc_module_impls, r=alexcrichtonManish Goregaokar-0/+3
rustdoc: Fix empty Implementations section on some module pages These are caused by `DefaultImpl`s. For example [`core::marker`](https://doc.rust-lang.org/nightly/core/marker/#impls).
2016-06-29Rollup merge of #34513 - ollie27:rustdoc_stripped, r=alexcrichtonManish Goregaokar-18/+40
rustdoc: Fix a few stripping issues We need to recurse into stripped modules to strip things like impl methods but when doing so we must not add any items to the `retained` set. For example this removes [`core::num::ParseFloatError::__description`](https://doc.rust-lang.org/nightly/core/num/struct.ParseFloatError.html#method.__description) and [`impl Clone for ThreadRng`](https://doc.rust-lang.org/nightly/std/clone/trait.Clone.html).
2016-06-29Rollup merge of #34105 - ollie27:rustdoc_derived, r=alexcrichtonJeffrey Seyfried-23/+1
rustdoc: Remove Derived Implementations title As far as I know whether a trait was derived or not does not change the public API so there is no need to include this information in the docs. This title currently just adds an extra divide in the list of trait implementations which I don't think needs to be there.
2016-06-28rustdoc: Fix empty Implementations section on some module pagesOliver Middleton-0/+3
These are caused by `DefaultImpl`s.
2016-06-28Rollup merge of #34479 - ollie27:rustdoc_renamed_reexport_list, r=GuillaumeGomezGuillaume Gomez-2/+2
rustdoc: Fix inlined renamed reexports in import lists Fixes #34473
2016-06-27Auto merge of #34424 - jseyfried:breaking_batch, r=Manishearthbors-18/+24
Batch up libsyntax breaking changes Batch of the following syntax-[breaking-change] changes: - #34213: Add a variant `Macro` to `TraitItemKind` - #34368: Merge the variant `QPath` of `PatKind` into the variant `PatKind::Path` - #34385: Move `syntax::ast::TokenTree` into a new module `syntax::tokenstream` - #33943: - Remove the type parameter from `visit::Visitor` - Remove `attr::WithAttrs` -- use `attr::HasAttrs` instead. - Change `fold_tt`/`fold_tts` to take token trees by value and avoid wrapping token trees in `Rc`. - Remove the field `ctxt` of `ast::Mac_` - Remove inherent method `attrs()` of types -- use the method `attrs` of `HasAttrs` instead. - #34316: - Remove `ast::Decl`/`ast::DeclKind` and add variants `Local` and `Item` to `StmtKind`. - Move the node id for statements from the `StmtKind` variants to a field of `Stmt` (making `Stmt` a struct instead of an alias for `Spanned<StmtKind>`) - Rename `ast::ExprKind::Again` to `Continue`. - #34339: Generalize and abstract `ThinAttributes` to `ThinVec<Attribute>` - Use `.into()` in convert between `Vec<Attribute>` and `ThinVec<Attribute>` - Use autoderef instead of `.as_attr_slice()` - #34436: Remove the optional expression from `ast::Block` and instead use a `StmtKind::Expr` at the end of the statement list. - #34403: Move errors into a separate crate (unlikely to cause breakage)
2016-06-27rustdoc: Fix a few stripping issuesOliver Middleton-18/+40
We need to recurse into stripped modules to strip things like impl methods but when doing so we must not add any items to the `retained` set.
2016-06-26rustdoc: Fix inlined renamed reexports in import listsOliver Middleton-2/+2
2016-06-25Rollup merge of #34403 - jonathandturner:move_liberror, r=alexcrichtonJeffrey Seyfried-18/+24
This PR refactors the 'errors' part of libsyntax into its own crate (librustc_errors). This is the first part of a few refactorings to simplify error reporting and potentially support more output formats (like a standardized JSON output and possibly an --explain mode that can work with the user's code), though this PR stands on its own and doesn't assume further changes. As part of separating out the errors crate, I have also refactored the code position portion of codemap into its own crate (libsyntax_pos). While it's helpful to have the common code positions in a separate crate for the new errors crate, this may also enable further simplifications in the future.
2016-06-25rustdoc: Fix search result layout for enum variants and struct fieldsOliver Middleton-1/+1
2016-06-24Auto merge of #34439 - ollie27:rustdoc_panic_fix, r=alexcrichtonbors-10/+13
rustdoc: Fix panic caused by doc(hidden) trait methods Fixes: #34423 r? @alexcrichton
2016-06-23rustdoc: Fix panic caused by doc(hidden) trait methodsOliver Middleton-10/+13
2016-06-23Updating test I missed for old school refactorJonathan Turner-2/+3
2016-06-23Auto merge of #34372 - ollie27:rustdoc_sidebar, r=steveklabnikbors-1/+5
rustdoc: Add more types to the sidebar They're displayed in the same order as they are on modules pages. You can test [here](https://ollie27.github.io/rust_doc_test/std/). For example: [before](https://doc.rust-lang.org/nightly/std/char/constant.MAX.html) [after](https://ollie27.github.io/rust_doc_test/std/char/constant.MAX.html) [before](https://doc.rust-lang.org/nightly/std/os/raw/type.c_char.html) [after](https://ollie27.github.io/rust_doc_test/std/os/raw/type.c_char.html)
2016-06-23Address comments and fix travis warningJonathan Turner-3/+1
2016-06-23Move errors from libsyntax to its own crateJonathan Turner-14/+21
2016-06-22Rollup merge of #34387 - ollie27:rustdoc_src_links, r=alexcrichtonManish Goregaokar-8/+17
rustdoc: Fix a couple of issues with src links to external crates - src links/redirects to extern fn from another crate had an extra '/'. - src links to `pub use` of a crate module had an extra '/'. - src links to renamed reexports from another crate used the new name for the link but should use the original name. Fixes: #34274
2016-06-20Auto merge of #34186 - GuillaumeGomez:err-code-check, r=alexcrichtonbors-23/+58
Implementation of #34168 r? @brson cc @alexcrichton cc @steveklabnik cc @jonathandturner I only updated `librustc_privacy/diagnostics.rs`, and I already found a case where the code doesn't throw the expected error code (E0448). Fixes #34168.
2016-06-20rustdoc: Fix a couple of issues with src links to external cratesOliver Middleton-8/+17
- src links/redirects to extern fn from another crate had an extra '/'. - src links to `pub use` of a crate module had an extra '/'. - src links to renamed reexports from another crate used the new name for the link but should use the original name.
2016-06-20Add error code flagGuillaume Gomez-13/+16
2016-06-19rustdoc: Add more types to the sidebarOliver Middleton-1/+5
They're displayed in the same order as they are on modules pages.
2016-06-17Auto merge of #34292 - ollie27:rustdoc_depr_impl, r=GuillaumeGomezbors-17/+30
rustdoc: Add stability notices to impl items Also fixes missing stability notices on methods with no docs. For example [`f64::is_positive`](https://doc.rust-lang.org/nightly/std/primitive.f64.html#method.is_positive) is missing its deprecation message.
2016-06-16Add an abs_path member to FileMap, use it when writing debug info.Ted Mielczarek-2/+2
When items are inlined from extern crates, the filename in the debug info is taken from the FileMap that's serialized in the rlib metadata. Currently this is just FileMap.name, which is whatever path is passed to rustc. Since libcore and libstd are built by invoking rustc with relative paths, they wind up with relative paths in the rlib, and when linked into a binary the debug info uses relative paths for the names, but since the compilation directory for the final binary, tools trying to read source filenames will wind up with bad paths. We noticed this in Firefox with source filenames from libcore/libstd having bad paths. This change stores an absolute path in FileMap.abs_path, and uses that if available for writing debug info. This is not going to magically make debuggers able to find the source, but it will at least provide sensible paths.
2016-06-15rustdoc: Add stability notices to impl itemsOliver Middleton-17/+30
Also fixes missing stability notices on methods with no docs.
2016-06-14Auto merge of #34245 - ollie27:rustdoc_redirect_rename, r=alexcrichtonbors-12/+10
rustdoc: Fix redirect pages for renamed reexports We need to use the name of the target not the name of the current item when creating the link. An example in `std` is [`std::sys::ext`](https://doc.rust-lang.org/nightly/std/sys/ext/index.html).
2016-06-14Auto merge of #34234 - GuillaumeGomez:bad_inlining, r=steveklabnikbors-2/+6
Fix invalid inlining r? @steveklabnik So to put a context. @nox found an issue on the generated doc: ![screenshot from 2016-06-11 19-53-38](https://cloud.githubusercontent.com/assets/3050060/15987898/f7341de0-303b-11e6-9cd7-f2a6df423ee7.png) So as you can see, the two variants are on the same where they shouldn't. I found out that the issue is also on structs: ![screenshot from 2016-06-11 19-53-31](https://cloud.githubusercontent.com/assets/3050060/15987900/0f66c5de-303c-11e6-90fc-5e49d11b6903.png) And so such is the result of the PR: ![screenshot from 2016-06-12 01-15-21](https://cloud.githubusercontent.com/assets/3050060/15987904/19d9183c-303c-11e6-91c1-7c3f1163fbb0.png) ![screenshot from 2016-06-12 01-15-24](https://cloud.githubusercontent.com/assets/3050060/15987905/1b5d2db0-303c-11e6-8f43-9a8ad2371007.png)
2016-06-14rustdoc: Fix redirect pages for renamed reexportsOliver Middleton-12/+10
We need to use the name of the target not the name of the current item when creating the link.
2016-06-14Auto merge of #34232 - ollie27:rustdoc_inline, r=alexcrichtonbors-2/+6
rustdoc: Don't inline #[doc(hidden)] pub use Currently if a `#[doc(hidden)] pub use` item is inlined the `hidden` attribute is ignored so the item can appear in the docs. By never inlining such imports, they can be stripped. An example in `std` is [`__OsLocalKeyInner`](https://doc.rust-lang.org/nightly/std/thread/struct.__OsLocalKeyInner.html) which clearly should not be documented.
2016-06-12Add error codes block code flagGuillaume Gomez-11/+43
2016-06-12Auto merge of #34045 - ollie27:rustdoc_stripped, r=brsonbors-17/+24
rustdoc: Don't generate empty files for stripped items We need to traverse stripped modules to generate redirect pages, but we shouldn't generate anything else for them. This now renders the file contents to a Vec before writing it to a file in one go. I think that's probably a better strategy anyway. Fixes: #34025
2016-06-12Fix invalid inliningGuillaume Gomez-2/+6
2016-06-11rustdoc: Don't inline #[doc(hidden)] pub useOliver Middleton-2/+6
Currently if a `#[doc(hidden)] pub use` item is inlined the `hidden` attribute is ignored so the item can appear in the docs. By never inlining such imports, they can be stripped.
2016-06-10Introduce TyCtxt::expect_def/expect_resolution helpers and use them where ↵Vadim Petrochenkov-7/+7
possible
2016-06-09Auto merge of #34108 - jseyfried:refactor_prelude_injection, r=nrcbors-1/+4
Refactor away the prelude injection fold Instead, just inject `#[prelude_import] use [core|std]::prelude::v1::*;` at the crate root while injecting `extern crate [core|std];` and process `#[no_implicit_prelude]` attributes in `resolve`. r? @nrc
2016-06-08Auto merge of #32202 - arielb1:slice-patterns, r=nikomatsakisbors-7/+9
Implement RFC495 semantics for slice patterns non-MIR translation is still not supported for these and will happily ICE. This is a [breaking-change] for many uses of slice_patterns. [RFC 495 text](https://github.com/rust-lang/rfcs/blob/master/text/0495-array-pattern-changes.md)
2016-06-09fix damage in librustcAriel Ben-Yehuda-7/+9
2016-06-08Auto merge of #34068 - ollie27:rustdoc_redirect_const, r=brsonbors-1/+3
rustdoc: Fix generating redirect pages for statics and consts These were missing from the cache for some reason meaning the redirect pages failed to render.
2016-06-07Rollup merge of #34138 - hoodie:bug/bool_colors, r=steveklabnikSteve Klabnik-2/+2
Bug/bool colors This is actually #33661 @steveklabnik, sorry about this, github ate my homework
2016-06-07Auto merge of #34012 - eddyb:tick-erased, r=nikomatsakisbors-1/+2
rustc: add ReErased to be used by trait selection, MIR and trans. `ReErased` replaces `ReStatic` (i.e. `'static`) for erasing regions. Using a distinct lifetime helps prevent accidental mix-ups between the two. It also allows cleaner type printing (see test changes), including in symbol names: ```rust str..pattern..CharSearcher$LT$$u27$static$GT$::drop.30560::h840c2f2afc03bbea // before str..pattern..CharSearcher::drop.30561::h6bd31d2af614377a // after ``` Not that we should be producing symbols this way, but it's still better.
2016-06-07Fix bug in `librustdoc` in which an unmatched "</table>" is emitted.Jeffrey Seyfried-1/+4
2016-06-05rustdoc: Remove Derived Implementations titleOliver Middleton-23/+1
As far as I know whether a trait was derived or not does not change the public API so there is no need to include this information in the docs. This title currently just adds an extra divide in the list of trait implementations which I don't think needs to be there.
2016-06-05rustc: add ReErased to be used by trait selection, MIR and trans.Eduard Burtescu-1/+2
2016-06-04rustdoc: Fix a few missing colors in the CSSOliver Middleton-5/+6
This adds color to some of the search results and sidebar items which were missing.
2016-06-04Auto merge of #33816 - nikomatsakis:projection-cache-2, r=arielb1bors-1/+1
Projection cache and better warnings for #32330 This PR does three things: - it lays the groundwork for the more precise subtyping rules discussed in #32330, but does not enable them; - it issues warnings when the result of a leak-check or subtyping check relies on a late-bound region which will late become early-bound when #32330 is fixed; - it introduces a cache for projection in the inference context. I'm not 100% happy with the approach taken by the cache here, but it seems like a step in the right direction. It results in big wins on some test cases, but not as big as previous versions -- I think because it is caching the `Vec<Obligation>` (whereas before I just returned the normalized type with an empty vector). However, that change was needed to fix an ICE in @alexcrichton's future-rs module (I haven't fully tracked the cause of that ICE yet). Also, because trans/the collector use a fresh inference context for every call to `fulfill_obligation`, they don't profit nearly as much from this cache as they ought to. Still, here are the results from the future-rs `retry.rs`: ``` 06:26 <nmatsakis> time: 6.246; rss: 44MB item-bodies checking 06:26 <nmatsakis> time: 54.783; rss: 63MB translation item collection 06:26 <nmatsakis> time: 140.086; rss: 86MB translation 06:26 <nmatsakis> time: 0.361; rss: 46MB item-bodies checking 06:26 <nmatsakis> time: 5.299; rss: 63MB translation item collection 06:26 <nmatsakis> time: 12.140; rss: 86MB translation ``` ~~Another example is the example from #31849. For that, I get 34s to run item-bodies without any cache. The version of the cache included here takes 2s to run item-bodies type-checking. An alternative version which doesn't track nested obligations takes 0.2s, but that version ICEs on @alexcrichton's future-rs (and may well be incorrect, I've not fully convinced myself of that). So, a definite win, but I think there's definitely room for further progress.~~ Pushed a modified version which improves performance of the case from #31849: ``` lunch-box. time rustc --stage0 ~/tmp/issue-31849.rs -Z no-trans real 0m33.539s user 0m32.932s sys 0m0.570s lunch-box. time rustc --stage2 ~/tmp/issue-31849.rs -Z no-trans real 0m0.195s user 0m0.154s sys 0m0.042s ``` Some sort of cache is also needed for unblocking further work on lazy normalization, since that will lean even more heavily on the cache, and will also require cycle detection. r? @arielb1