Commit Graph

27006 Commits

Author SHA1 Message Date
Piotr Czarnecki
b0e855a758 libstd: Update docs for slice_shift_char and {shift,pop}_{char,byte} 2014-03-10 13:55:02 +01:00
Piotr Czarnecki
262d1543db libstd: Add unit tests for slice_shift_char 2014-03-10 13:55:02 +01:00
Piotr Czarnecki
0349f2ae8a libstd: Change slice_shift_char, shift_char, pop_char, shift_byte and pop_byte to return an Option instead of failing 2014-03-10 13:55:02 +01:00
bors
62f1d68439 auto merge of #12747 : huonw/rust/rustdoc-markdown, r=alexcrichton
This gives Rustdoc the ability to render our guides, tutorial and manual and modifies the those documents (minor modifications) and makefiles to achieve this.

See commits for more details (especially the makefile rewrite).
2014-03-09 03:06:42 -07:00
Huon Wilson
b4815ad1ba mk: only build PDFs of the manual and tutorial.
This restores the old behaviour (as compared to building PDF versions of
all standalone docs), because some of the guides use unicode characters,
which seems to make pdftex unhappy.
2014-03-09 20:59:43 +11:00
Huon Wilson
bb8ac2159f docs: render rustdoc docs with rustdoc, hack around sundown code-fence
parsing limitations.

Sundown parses

    ```
    ~~~

as a valid codeblock (i.e. mismatching delimiters), which made using
rustdoc on its own documentation impossible (since it used nested
codeblocks to demonstrate how testable codesnippets worked).

This modifies those snippets so that they're delimited by indentation,
but this then means they're tested by `rustdoc --test` & rendered as
Rust code (because there's no way to add `notrust` to
indentation-delimited code blocks). A comment is added to stop the
compiler reading the text too closely, but this unfortunately has to be
visible in the final docs, since that's the text on which the
highlighting happens.
2014-03-09 20:59:43 +11:00
Huon Wilson
6d6e2880d2 tutorial: hack a code snippet to make it compile.
This is meant to be compiling a crate, but the crate_id attribute seems
to be upsetting it if the attribute is actually on the crate. I.e. this
makes this test compile by putting the crate_id attribute on a function
and so it's ignored. Such a hack. :(
2014-03-09 19:34:40 +11:00
Huon Wilson
3c4ff1b872 mk: rename check-...-doc-<crate> to check-...-doc-crate-<crate>.
E.g. this stops check-...-doc rules for `rustdoc.md` and `librustdoc`
from stamping on each other, so that they are correctly built and
tested. (Previously only the rustdoc crate was tested.)
2014-03-09 19:34:40 +11:00
Huon Wilson
f7833215b0 mk: rewrite the documentation handling.
This converts it to be very similar to crates.mk, with a single list of
the documentation items creating all the necessary bits and pieces.

Changes include:
- rustdoc is used to render HTML & test standalone docs
- documentation building now obeys NO_REBUILD=1
- testing standalone docs now obeys NO_REBUILD=1
- L10N is slightly less broken (in particular, it shares dependencies
  and code with the rest of the code)
- PDFs can be built for all documentation items, not just tutorial and
  manual
- removes the obsolete & unused extract-tests.py script
- adjust the CSS for standalone docs to use the rustdoc syntax
  highlighting
2014-03-09 19:34:40 +11:00
Huon Wilson
2d7d7e59f9 docs: adjust code blocks to pass with rustdoc.
The changes are basically just because rustdoc runs tests/rendering on
more snippets by default (i.e. everything without a `notrust` tag), and
not anything significant.
2014-03-09 19:34:40 +11:00
Huon Wilson
8e90412048 rustdoc: adding some common feature gates when testing a markdown file.
The manual, tutorial and guides need the feature gates quite often,
unfortunately, so this is the low-cost path to migrating to use
rustdoc. This is only activated for pure-Markdown files.

Preferably this would be avoided: #12773
2014-03-09 19:34:40 +11:00
Huon Wilson
7a70ec1ba6 rustdoc: hardcode each header as a link.
This avoids having to include JS in the guide/tutorial/manual pages just
to get the headers being links. The on-hover behaviour showing the
little section marker § is preserved, because that gives a useful hint
that the heading is a link.
2014-03-09 19:29:49 +11:00
Huon Wilson
f22c96cc88 rustdoc: add table-of-contents recording & rendering, use it with plain
markdown files.

This means that

    # Foo
    ## Bar
    # Baz
    ### Qux
    ## Quz

Gets a TOC like

    1 Foo
       1.1 Bar
    2 Baz
       2.0.1 Qux
       2.1 Quz

This functionality is only used when rendering a single markdown file,
never on an individual module, although it could very feasibly be
extended to allow modules to opt-in to a table of contents (std::fmt
comes to mind).
2014-03-09 19:29:49 +11:00
Huon Wilson
69b8ef806b rustdoc: run on plain Markdown files.
This theoretically gives rustdoc the ability to render our guides,
tutorial and manual (not in practice, since the files themselves need to
be adjusted slightly to use Sundown-compatible functionality).

Fixes #11392.
2014-03-09 19:29:49 +11:00
bors
e959c8794b auto merge of #12777 : sfackler/rust/no_run, r=alexcrichton
This is useful for code that would be expensive to run or has some kind
of external dependency (e.g. a database or server).
2014-03-08 22:41:45 -08:00
bors
5d1d285623 auto merge of #12758 : rgawdzik/rust/master, r=alexcrichton
Refactored get_metadata_section to return a Result<MetadataBlob,~str> instead of a Option<MetadataBlob>. This provides more clarity to the user through the debug output when using --ls.

This is kind of a continuation of my original closed pull request 2 months ago (#11544), but I think the time-span constitutes a new pull request.
2014-03-08 20:51:48 -08:00
Steven Fackler
71cab0410f Add an option to not run rustdoc blocks
This is useful for code that would be expensive to run or has some kind
of external dependency (e.g. a database or server).
2014-03-08 19:57:00 -08:00
bors
5f64adc44b auto merge of #12706 : pongad/rust/issue_12698, r=brson
Fixes #12698
2014-03-08 19:06:48 -08:00
Robert Gawdzik
3bf724e44b Refactored get_metadata_section to return a Result<T,~str>, added error messages. Closes #6615. 2014-03-08 20:46:18 -05:00
bors
e1681df892 auto merge of #12759 : lucab/rust/char-doc, r=alexcrichton
This is mostly a reaction to #12730. If we are going to keep calling them `char`, at least make it clear that they aren't characters but codepoint/scalar.
2014-03-08 17:31:57 -08:00
bors
0017056105 auto merge of #12768 : pnkfelix/rust/fsk-devecing, r=pnkfelix
Change `~[T]` to Vec<T> in librustc.  Rebased and amended version of PR #12716.

Original author (or perhaps I should say meta-author) was @pcwalton, as is reflected in the commits.

I clean up!  :)
2014-03-08 13:01:55 -08:00
Felix S. Klock II
f978c772ba Incorporated review feedback atop pcwalton's original patches.
(Original PR was #12716; feedback was provided by thestinger and me.)
2014-03-08 21:47:12 +01:00
Patrick Walton
15d9acc46c librustdoc: Fix librustdoc for the Vec<T> change. 2014-03-08 21:41:42 +01:00
Felix S. Klock II
43c07244b3 librustc: Fix up fallout from the automatic conversion. 2014-03-08 21:41:32 +01:00
Patrick Walton
3b6e9d4a7a librustc: Automatically change uses of ~[T] to Vec<T> in rustc. 2014-03-08 21:24:27 +01:00
Michael Darakananda
438893b36f Removed DeepClone. Issue #12698. 2014-03-08 15:09:00 -05:00
Patrick Walton
f690cc2c63 libstd: Add some more functionality to Vec<T> 2014-03-08 21:08:59 +01:00
Luca Bruno
331f9077a0 doc: add two missing char methods doc-strings
XID_* property are defined in UAX #31, just reference it here.

Signed-off-by: Luca Bruno <lucab@debian.org>
2014-03-08 09:10:12 +01:00
Luca Bruno
9b3c63bdd5 doc: uniform std::char doc-strings
Uniform and beautify doc-string for current rustdoc output.

Signed-off-by: Luca Bruno <lucab@debian.org>
2014-03-08 09:10:12 +01:00
Luca Bruno
af7c313047 doc: don't refer to 'char' as characters
This seems to be causing some confusion among users. Rust's char are
not 8bit characters, but 32bit UCS-4 codepoint without surrogates
(Unicode Scalar Values as per Unicode glossary).
Make the doc more explicit about it.

Signed-off-by: Luca Bruno <lucab@debian.org>
2014-03-08 09:10:12 +01:00
bors
96e8c00e95 auto merge of #12520 : thestinger/rust/cmp, r=brson
* `Ord` inherits from `Eq`
* `TotalOrd` inherits from `TotalEq`
* `TotalOrd` inherits from `Ord`
* `TotalEq` inherits from `Eq`

This is a partial implementation of #12517.
2014-03-07 20:36:42 -08:00
Daniel Micay
4d7d101a76 create a sensible comparison trait hierarchy
* `Ord` inherits from `Eq`
* `TotalOrd` inherits from `TotalEq`
* `TotalOrd` inherits from `Ord`
* `TotalEq` inherits from `Eq`

This is a partial implementation of #12517.
2014-03-07 22:45:22 -05:00
bors
4c90a7f018 auto merge of #12748 : liigo/rust/rust-birthday, r=brson
Rust v0.1 was released on January 20, 2012:
https://mail.mozilla.org/pipermail/rust-dev/2012-January/001256.html
2014-03-07 19:21:51 -08:00
bors
3ade32145b auto merge of #12752 : edwardw/rust/rdoc, r=alexcrichton
A structure's definition and implementation may be cross-module. If the
implementing module is parsed before defining module, the fully
qualified name of the structure won't be present for the implementation
to use when being indexed. So caches such 'orphan' implementation and
indexes it at the end of crate parsing.

Closes #10284.
2014-03-07 17:16:52 -08:00
Edward Wang
a337592db6 Index cross-mod type definition and implementation properly in rustdoc
A structure's definition and implementation may be cross-module. If the
implementing module is parsed before defining module, the fully
qualified name of the structure won't be present for the implementation
to use when being indexed. So caches such 'orphan' implementation and
indexes it at the end of crate parsing.

Closes #10284.
2014-03-08 03:09:12 +08:00
bors
33768c46ec auto merge of #12753 : huonw/rust/vec-macro, r=cmr
If no arguments are given to `vec!` then no pushes are emitted and
so the compiler (rightly) complains that the mutability of `temp` is
never used.

This behaviour is rather annoying for users.
2014-03-07 02:51:39 -08:00
bors
b1d104c644 auto merge of #12750 : liigo/rust/De-extern-mod, r=alexcrichton
rename ast::ViewItemExternMod to ast::ViewItemExternCrate
rename rustdoc::clean::ExternMod to rustdoc::clean::ExternCrate
because `extern mod` is out.
2014-03-07 01:01:40 -08:00
Liigo Zhuang
2271860af1 rename ast::ViewItemExternMod to ast::ViewItemExternCrate, and clean::ExternMod to clean::ExternCrate 2014-03-07 15:57:45 +08:00
bors
85ab68eed0 auto merge of #12749 : tedhorst/rust/master, r=huonw
Minor change to the FVN hashing function based on recommendation on: http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash

cc @alexcrichton
2014-03-06 23:46:40 -08:00
Ted Horst
0bdd31cc61 change FVN hash function to the FVN-1a variant 2014-03-07 01:25:25 -06:00
Liigo Zhuang
1c86179dba Explicitly write down 0.1 release date in RELEASES.txt, to confirm Rust's birthday. 2014-03-07 15:08:42 +08:00
Huon Wilson
ba05ca6962 std: stop vec!() warning about unused mutability.
If no arguments are given to `vec!` then no pushes are emitted and
so the compiler (rightly) complains that the mutability of `temp` is
never used.

This behaviour is rather annoying for users.
2014-03-07 18:07:25 +11:00
bors
28e7631d8b auto merge of #12746 : alexcrichton/rust/issue-12743, r=brson
The arguments were accidentally swapped in the wrong order.

Closes #12743
2014-03-06 19:31:37 -08:00
bors
5862c0c28b auto merge of #12635 : alexcrichton/rust/speedy-hash, r=brson
This leverages the new hashing framework and hashmap implementation to provide a
much speedier hashing algorithm for node ids and def ids. The hash algorithm
used is currentl FNV hashing, but it's quite easy to swap out.

I originally implemented hashing as the identity function, but this actually
ended up in slowing down rustc compiling libstd from 8s to 13s. I would suspect
that this is a result of a large number of collisions.

With FNV hashing, we get these timings (compiling with --no-trans, in seconds):

|           |  before  |  after  |
|-----------|---------:|--------:|
| libstd    |   8.324  |  6.703  |
| stdtest   |  47.674  | 46.857  |
| libsyntax |   9.918  |  8.400  |
2014-03-06 18:16:39 -08:00
Alex Crichton
0a84132928 syntax: Conditionally deriving(Hash) with Writers
If #[feature(default_type_parameters)] is enabled for a crate, then
deriving(Hash) will expand with Hash<W: Writer> instead of Hash<SipState> so
more hash algorithms can be used.
2014-03-06 18:11:02 -08:00
Alex Crichton
42389b7069 collections: Correct with_capacity_and_hasher
The arguments were accidentally swapped in the wrong order.

Closes #12743
2014-03-06 18:07:52 -08:00
Alex Crichton
bec7b766fb rustc: Move to FNV hashing for node/def ids
This leverages the new hashing framework and hashmap implementation to provide a
much speedier hashing algorithm for node ids and def ids. The hash algorithm
used is currentl FNV hashing, but it's quite easy to swap out.

I originally implemented hashing as the identity function, but this actually
ended up in slowing down rustc compiling libstd from 8s to 13s. I would suspect
that this is a result of a large number of collisions.

With FNV hashing, we get these timings (compiling with --no-trans, in seconds):

|           |  before  |  after  |
|-----------|---------:|--------:|
| libstd    |   8.324  |  6.703  |
| stdtest   |  47.674  | 46.857  |
| libsyntax |   9.918  |  8.400  |
2014-03-06 17:45:48 -08:00
bors
0e95b086db auto merge of #12738 : alexcrichton/rust/needstest, r=brson,just
Closes #6738
Closes #7061
Closes #7899
Closes #9719
Closes #10028
Closes #10228
Closes #10401
Closes #11192
Closes #11508
Closes #11529
Closes #11873
Closes #11925
2014-03-06 15:11:42 -08:00
bors
bd47f679fa auto merge of #12737 : alexcrichton/rust/issue-12736, r=brson
Turns out sundown has already escaped this content for us, so there's no need
for us to escape it again.

Closes #12736
2014-03-06 13:56:41 -08:00
bors
987de29865 auto merge of #12732 : klutzy/rust/this-is-windows, r=alexcrichton
On Windows, `LLVMRustGetLastError()` may return non-utf8 mojibake string
if system uses non-English locale. It caused ICE when llvm fails.
This patch doesn't fix the real problem, but just make rustc not die.
2014-03-06 12:37:01 -08:00