Commit Graph

29495 Commits

Author SHA1 Message Date
bors
837013717a auto merge of #14509 : klutzy/rust/de-pub-use-glob, r=alexcrichton
This patchset removes `pub use` usage except for `test/`.
cc #11870
2014-06-02 12:46:31 -07:00
Jakub Wieczorek
774f36b5d8 Remove further code duplication 2014-06-02 20:49:44 +02:00
Jakub Wieczorek
19e10e3a81 Improve code reuse in check_match::specialize() 2014-06-02 18:41:48 +02:00
Alex Crichton
60e0f6fbb0 test: Add tests for closed issue #10764
Closes #10764
2014-06-02 09:24:03 -07:00
Alex Crichton
f02f739a82 rustdoc: Correctly inline required/provided methods
Apparently relying on provided_source in ty::Method is unreliable!

Closes #14594
2014-06-02 09:18:32 -07:00
Alex Crichton
287af7fa1a rustdoc: Deduplicate lists of implementors
Inlining caused implementors to show up multiple times.

cc #14584
2014-06-02 09:18:26 -07:00
klutzy
976c8324e1 syntax: Remove use of pub use globs
`quote_expr!` now injects two more (priv) `use` globs.
This may cause extra unused_imports warning.
2014-06-02 23:21:40 +09:00
klutzy
e38fde71b1 doc: Remove use of pub use globs 2014-06-02 23:21:35 +09:00
Florian Gilcher
20fb7c62d4 docs: Stop using notrust
Now that rustdoc understands proper language tags
as the code not being Rust, we can tag everything
properly.

This change tags examples in other languages by
their language. Plain notations are marked as `text`.
Console examples are marked as `console`.

Also fix markdown.rs to not highlight non-rust code.
2014-06-02 12:37:54 +02:00
bors
46dad765f0 auto merge of #14596 : Sawyer47/rust/encodable-fix, r=alexcrichton
Closes #14021
2014-06-02 01:06:39 -07:00
Piotr Jawniak
1dc13e4ad4 Fix deriving Encodable trait for unit structs
Closes #14021
2014-06-02 07:46:32 +02:00
bors
b981add9ee auto merge of #14569 : skade/rust/rustdoc-robust-langstring-parsing, r=alexcrichton
This changes the parsing of the language string
in code examples so that unrecognized examples
are not considered Rust code. This was, for example,
the case when a code example was marked `sh` for shell
code.

This relieves authors of having to mark those samples
as `notrust`.

Also adds recognition of the positive marker `rust`.

By default, unmarked examples are still considered rust.
2014-06-01 22:01:36 -07:00
Alex Crichton
e1e8db7e4a rustdoc: Ensure external impls are inlined once
If the type associated with the impl is `pub use`'d or referenced twice in a
downstream crate, the impl will attempt to be inlined twice.

Closes #14584
2014-06-01 21:53:43 -07:00
Alex Crichton
890754794c mk: Less noisy rustdoc invocations 2014-06-01 21:53:43 -07:00
Alex Crichton
f71f97b7c2 rustdoc: Filter private methods from inlined impls
Closes #14583
2014-06-01 21:53:43 -07:00
Alex Crichton
0dbfa5f611 rustdoc: Fix some more broken links 2014-06-01 21:53:43 -07:00
bors
2be0c5b5f5 auto merge of #14591 : klutzy/rust/issue-9205, r=thestinger
Fixes #9205.
2014-06-01 20:26:39 -07:00
klutzy
42e4464198 test: Enable #9205-related tests on windows
Fixes #9205.
2014-06-02 12:08:19 +09:00
Florian Gilcher
3fef7a74ca rustdoc: make langstring parsing more robust
This changes the parsing of the language string
in code examples so that unrecognized examples
are not considered Rust code. This was, for example,
the case when a code example was marked `sh` for shell
code.

This relieves authors of having to mark those samples
as `notrust`.

Also adds recognition of the positive marker `rust`.

By default, unmarked examples are still considered rust.

If any rust-specific tags are seen, code is considered
rust unless marked as "notrust".

Adds test cases for the detection logic.
2014-06-02 00:16:48 +02:00
bors
1527dab998 auto merge of #14579 : alexcrichton/rust/more-eq-renamings, r=thestinger
This completes the last stage of the renaming of the comparison hierarchy of
traits. This change renames TotalEq to Eq and TotalOrd to Ord.

In the future the new Eq/Ord will be filled out with their appropriate methods,
but for now this change is purely a renaming change.

This continues the work of #12517, continuing the work in #14534. This patch accomplishes the final rename of `TotalEq` to `TotalOrd`. I wanted to get this patch landed ASAP so we don't have to deal much with "where did `Eq` and `Ord` go?"

I have yet to do another pruning pass over the compiler to change all usage of `PartialEq` to `Eq` where appropriate. I will do this soon as well.
2014-06-01 10:36:39 -07:00
Alex Crichton
bba701c59d std: Drop Total from Total{Eq,Ord}
This completes the last stage of the renaming of the comparison hierarchy of
traits. This change renames TotalEq to Eq and TotalOrd to Ord.

In the future the new Eq/Ord will be filled out with their appropriate methods,
but for now this change is purely a renaming change.

[breaking-change]
2014-06-01 10:31:27 -07:00
bors
c605c2b57b auto merge of #14580 : utkarshkukreti/rust/fix-docs-for-result-map, r=alexcrichton
`reader.read_line()` includes trailing newline char, which makes
`from_str` always return `None`.
2014-06-01 04:36:38 -07:00
bors
dfaea70963 auto merge of #14578 : huonw/rust/as_slice-cheatsheet, r=sfackler
doc: add an `.as_slice` example to the cheatsheet.

A lot of questions about this on IRC and stackoverflow.
2014-06-01 02:36:39 -07:00
bors
064dbb9200 auto merge of #14571 : bnoordhuis/rust/libtest-check-isatty, r=alexcrichton
Fixes #14570.
2014-06-01 00:56:42 -07:00
Utkarsh Kukreti
cf4864a7a5 Fix docs for core::result::Result::map.
`reader.read_line()` includes trailing newline char, which makes
`from_str` always return `None`.
2014-06-01 12:18:39 +05:30
bors
4e0b936900 auto merge of #14513 : alexcrichton/rust/rustdoc-primitives, r=huonw
This is currently rebased on top of #14478, but that's just to preemptively avoid rebase conflicts and to provide a better preview. This can land independently of that PR.

This change crates a dedicated page in rustdoc for primitive types to outline everything you can do with them (at least in a basic way).

* Preview - http://people.mozilla.org/~acrichton/doc/
* Exhibit A - http://people.mozilla.org/~acrichton/doc/std/#primitives
* Exhibit B - http://people.mozilla.org/~acrichton/doc/std/primitive.str.html
* Exhibit C - http://people.mozilla.org/~acrichton/doc/std/primitive.slice.html

Please don't hesitate to be nitpickity, it's easy to overlook a thing here or there!
2014-05-31 23:16:42 -07:00
Alex Crichton
d58f27a82f syntax: Fix an accidental hyperlink in a comment 2014-05-31 22:00:26 -07:00
Alex Crichton
31f5de610f rustdoc: Don't inline tuple struct constructors
These don't actually point to anything, so there's no need to inline them.
2014-05-31 21:59:50 -07:00
Alex Crichton
7ec6df5f45 rustdoc: Fix cross-crate links to reexported items
Cross crate links can target items which are not rendered in the documentation.
If the item is reexported at a higher level, the destination of the link (a
concatenation of the fully qualified name) may actually lead to nowhere. This
fixes this problem by altering rustdoc to emit pages which redirect to the local
copy of the reexported structure.

cc #14515
Closes #14137
2014-05-31 21:59:50 -07:00
Alex Crichton
c5830a954e doc: Fix a number of broken links
cc #14515
2014-05-31 21:59:50 -07:00
Alex Crichton
8c669d7f74 rustdoc: Suck in all impls from external crates
There is currently no way to query all impls for a type from an external crate,
and with primitive types in play this is also quite difficult. Instead of
filtering, just suck in all impls from upstream crates into the local AST, and
have them get stripped later.

This will allow population of all implementations of traits for primitive types,
as well as filling in some corner cases with inlining documentation in other
cases.
2014-05-31 21:59:50 -07:00
Alex Crichton
c2564b8fd4 rustdoc: Filter inlining private external items
This prevents structures like RcBox from showing up in the documentation
2014-05-31 21:59:50 -07:00
Alex Crichton
c2e3aa37da rustdoc: Create anchor pages for primitive types
This commit adds support in rustdoc to recognize the `#[doc(primitive = "foo")]`
attribute. This attribute indicates that the current module is the "owner" of
the primitive type `foo`. For rustdoc, this means that the doc-comment for the
module is the doc-comment for the primitive type, plus a signal to all
downstream crates that hyperlinks for primitive types will be directed at the
crate containing the `#[doc]` directive.

Additionally, rustdoc will favor crates closest to the one being documented
which "implements the primitive type". For example, documentation of libcore
links to libcore for primitive types, but documentation for libstd and beyond
all links to libstd for primitive types.

This change involves no compiler modifications, it is purely a rustdoc change.
The landing pages for the primitive types primarily serve to show a list of
implemented traits for the primitive type itself.

The primitive types documented includes both strings and slices in a semi-ad-hoc
way, but in a way that should provide at least somewhat meaningful
documentation.

Closes #14474
2014-05-31 21:59:50 -07:00
Alex Crichton
ba9be0a72b rustdoc: Fill in external type parameters correctly
Type parameters were filled in for some areas, but not all. This commit unifies
the two code paths to fill in type parameters everywhere.

Closes #14508
2014-05-31 21:59:50 -07:00
Alex Crichton
19fe4aad68 rustdoc: Stringify more named lifetimes
cc #14462
2014-05-31 21:59:50 -07:00
Alex Crichton
658924068e rustdoc: Show all implementors of traits
When inlining documentation across crates, primitive implementors of traits were
not shown. This commit tweaks the infrastructure to treat primitive and
Path-like impls the same way, displaying all implementors everywhere.

cc #14462
2014-05-31 21:59:50 -07:00
Alex Crichton
0777ce86e1 rustdoc: Freeze the cache ASAP
The cache is going to be used earlier in the HTML generation process, which
means that it needs to get into TLS as soon as possible.
2014-05-31 21:59:50 -07:00
Alex Crichton
356423d8f1 rustdoc: Refactor structure of html::run
Instead of one giant function, this breaks it up into several smaller functions
which have explicit dependencies among one another.

There are no code changes as a result of this commit.
2014-05-31 21:59:50 -07:00
bors
5527c5dc06 auto merge of #14561 : jakub-/rust/issue-11319, r=alexcrichton
Fixes #11319
2014-05-31 21:41:46 -07:00
Huon Wilson
aec7f46902 doc: add an .as_slice example to the cheatsheet.
A lot of questions about this on IRC and stackoverflow.
2014-06-01 14:13:10 +10:00
bors
ee97698f85 auto merge of #14567 : cburgdorf/rust/patch-2, r=brson
This rewrites the example to also be more aligned with
the same example given in the main tutorial.
2014-05-31 20:01:45 -07:00
bors
3712551bc4 auto merge of #14566 : cburgdorf/rust/patch-1, r=cmr
Renamed `owned_box` to `on_the_heap` to use a consistent
naming across the tutorial and the life time guide.
Also it makes the example easier to grasp.
2014-05-31 17:51:44 -07:00
Christoph Burgdorf
ade5a9d2fe Fix example in lifetime guide
This rewrites the example to also be more aligned with
the same example given in the main tutorial.
2014-05-31 23:41:50 +02:00
Christoph Burgdorf
b657af8946 Rename variable in tutorial
Renamed `owned_box` to `on_the_heap` to use a consistent
naming across the tutorial and the life time guide.
Also it makes the example easier to grasp.
2014-05-31 23:33:03 +02:00
Ben Noordhuis
87ecd4f75b libtest: Only colorize output if stdout is a tty
Fixes #14570.
2014-05-31 21:55:18 +02:00
Jakub Wieczorek
b64046a5b0 Make the match arm type mismatch message point to the arm's span
Fixes #11319
2014-05-31 21:10:02 +02:00
bors
60b4a97de7 auto merge of #14562 : jakub-/rust/issue-14541, r=alexcrichton
Fixes #14541
2014-05-31 11:21:38 -07:00
bors
b38712071e auto merge of #14565 : fhartwig/rust/master, r=sfackler 2014-05-31 09:36:39 -07:00
Florian Hartwig
096f80e770 Fix broken markup in query_to_str documentation 2014-05-31 17:46:35 +02:00
bors
2f221c766b auto merge of #14563 : dotdash/rust/clone_kill, r=huonw
By dropping the intermediate vector that holds the relevant candidates
including duplicates and directly building the vector that has the
duplicates removed we can eliminate quite a few allocations. This
reduces the times for type checking by 5-10% (measured with libstd,
libsyntax and librustc).
2014-05-31 07:56:39 -07:00