Commit Graph

29486 Commits

Author SHA1 Message Date
Corey Richardson
181e5f3fc8 syntax: use doc comments in the interner 2014-06-04 12:10:46 -07:00
Corey Richardson
46d1af28b5 syntax: methodify the lexer 2014-06-04 12:10:46 -07:00
Alex Crichton
0c7c93b8e8 std: Improve non-task-based usage
A few notable improvements were implemented to cut down on the number of aborts
triggered by the standard library when a local task is not found.

* Primarily, the unwinding functionality was restructured to support an unsafe
  top-level function, `try`. This function invokes a closure, capturing any
  failure which occurs inside of it. The purpose of this function is to be as
  lightweight of a "try block" as possible for rust, intended for use when the
  runtime is difficult to set up.

  This function is *not* meant to be used by normal rust code, nor should it be
  consider for use with normal rust code.

* When invoking spawn(), a `fail!()` is triggered rather than an abort.

* When invoking LocalIo::borrow(), which is transitively called by all I/O
  constructors, None is returned rather than aborting to indicate that there is
  no local I/O implementation.

* Invoking get() on a TLD key will return None if no task is available

* Invoking replace() on a TLD key will fail if no task is available.

A test case was also added showing the variety of things that you can do without
a runtime or task set up now. In general, this is just a refactoring to abort
less quickly in the standard library when a local task is not found.
2014-06-04 11:13:12 -07:00
bors
7645982efc auto merge of #14623 : exscape/rust-fork/master, r=alexcrichton
Unlike ImmutableClonableVector::permutations() which returns an iterator,
cloning the entire array each iteration, these methods mutate the vector in-place.
For that reason, these methods are much faster; between 35-55 times faster,
depending on the benchmark. They also generate permutations in lexicographical order.
2014-06-04 11:06:49 -07:00
Piotr Czarnecki
2202b104d4 collections: optimize HashMap. Add DefaultResizePolicy.
Refactored the load factor and the minimum capacity out of HashMap.
The size of HashMap<K, V> is now 64 bytes by default on a 64-bit platform
(or 48 bytes, that is 2 words less, with FNV)
Added a documentation in a few places to clarify the behavior.
2014-06-04 19:04:38 +02:00
Jakub Wieczorek
b9752b68ae Fix an ICE when a function argument is of the bottom type
Fixes #13352
2014-06-04 18:38:02 +02:00
Jakub Wieczorek
6d3e89e33c Mark the exit of infinite loops as unreachable 2014-06-04 18:37:46 +02:00
bors
a6401b5226 auto merge of #14616 : forticulous/rust/rc-show, r=alexcrichton
Show impl for Rc
2014-06-04 08:11:51 -07:00
Adolfo Ochagavía
8e4e3abb1d Implement Show for RingBuf 2014-06-04 16:40:30 +02:00
Axel Viala
650909244e Add code example to std::os::getenv for unix. 2014-06-04 16:02:48 +02:00
Huon Wilson
96cc48fba2 libc: only provide an rlib.
There's absolutely no reason for `libc` to be offered as a dynamic
library.
2014-06-04 19:10:40 +10:00
bors
d130acc0d0 auto merge of #14635 : BurntSushi/rust/regex-doco-touchups, r=alexcrichton 2014-06-03 23:51:41 -07:00
bors
5a6dc40a10 auto merge of #14634 : BurntSushi/rust/fix-13843, r=alexcrichton
An empty regex is a valid regex that always matches. This behavior
is consistent with at least Go and Python.

A couple regression tests are included.

I'd just assume that an empty regex is an invalid regex and that an error should be returned (I can't think of any reason to use an empty regex?), but it's probably better to be consistent with other regex libraries.
2014-06-03 22:01:43 -07:00
Corey Richardson
5343eb7e0c Add comments for the token table 2014-06-03 21:01:53 -07:00
Corey Richardson
024df5c8a6 syntax: shuffle some allocation out of binop_to_str 2014-06-03 21:00:55 -07:00
Andrew Gallant
179fc6dbfd Some minor documentation touchups for libregex. Fixes #13800. 2014-06-03 23:45:54 -04:00
Andrew Gallant
9d39178f2f Fixes #13843.
An empty regex is a valid regex that always matches. This behavior
is consistent with at least Go and Python.

A couple regression tests are included.
2014-06-03 23:04:59 -04:00
bors
3eeaa84a50 auto merge of #14628 : luqmana/rust/fcr, r=nikomatsakis
#14589.
2014-06-03 19:36:42 -07:00
Alex Crichton
1827241840 rustdoc: Put primitives in respective modules
The logical location for the documentation of a primitive is in the module that
declared it was a module for that primitive.
2014-06-03 18:49:14 -07:00
bors
507c1a0fc9 auto merge of #14632 : luqmana/rust/cu, r=huonw
The distinction doesn't make sense any more since we don't have do blocks anymore.
2014-06-03 17:46:46 -07:00
Alex Crichton
896cfcc67f std: Remove generics from Option::expect
This commit removes the <M: Any + Send> type parameter from Option::expect in
favor of just taking a hard-coded `&str` argument. This allows this function to
move into libcore.

Previous code using strings with `expect` will continue to work, but code using
this implicitly to transmit task failure will need to unwrap manually with a
`match` statement.

[breaking-change]
Closes #14008
2014-06-03 17:19:56 -07:00
Luqman Aden
559ff5e64b librustc: remove check::FnKind enum since we only ever use one variant. 2014-06-03 19:04:29 -04:00
bors
f5ead0dd66 auto merge of #14627 : Indiv0/rust/fix-crateid-doc-typo, r=alexcrichton
Example URL in CrateId documentation is:

    `gihub.com/mozilla/rust`

Instead of:

    `github.com/mozilla/rust`

Also update libsyntax/crateid.rs licensing header for 2014.
2014-06-03 16:01:44 -07:00
bors
2ec3eeaba8 auto merge of #14626 : klutzy/rust/issue-14618, r=alexcrichton
As part of removing `pub use` glob, two extra import globs were
injected to make `quote_expr!` work. However the globs caused
`unused_import` warning in some places.

Quasiquoter needed the globs since it generated idents (e.g. `TyU`)
rather than absolute paths (`::syntax::ast::TyU`).
This patch removes the extra globs and makes quasiquoter use absolute
paths.

Fixes #14618

cc @sfackler
2014-06-03 14:06:42 -07:00
Luqman Aden
0a9eafaa1c librustc: Try to resolve before coercions. 2014-06-03 15:38:04 -04:00
bors
8d8a291e1c auto merge of #14625 : japaric/rust/slice-tojson, r=alexcrichton
Let me know if the amount of tests is enough or too much.
2014-06-03 11:46:51 -07:00
Nikita Pekin
296102ec86 Fix typo "gihub" in libsyntax/crateid.
Update licensing header for 2014.
2014-06-03 14:30:59 -04:00
bors
7fa5baa7ca auto merge of #14622 : reillywatson/rust/master, r=alexcrichton 2014-06-03 10:01:40 -07:00
klutzy
1ec6de3ecf syntax: Make quasiquoter use absolute paths
As part of removing `pub use` glob, two extra import globs were
injected to make `quote_expr!` work. However the globs caused
`unused_import` warning in some places.

Quasiquoter needed the globs since it generated idents (e.g. `TyU`)
rather than absolute paths (`::syntax::ast::TyU`).
This patch removes the extra globs and makes quasiquoter use absolute
paths.

Fixes #14618
2014-06-04 02:00:03 +09:00
Jorge Aparicio
a413d005a7 Implement ToJson for &[T], and add tests. Closes #14619 2014-06-03 10:52:54 -05:00
bors
df821dc1aa auto merge of #14621 : Sawyer47/rust/fix-readme, r=alexcrichton 2014-06-03 08:11:38 -07:00
Reilly Watson
5b80172f10 Doc: grammar fix in intro.md 2014-06-03 10:24:54 -04:00
Thomas Backman
3b5d6fd254 Add next_permutation and prev_permutation onto MutableOrdVector<T>.
Unlike ImmutableClonableVector::permutations() which returns an iterator,
cloning the entire array each iteration, these methods mutate the vector in-place.
For that reason, these methods are much faster; between 35-55 times faster,
depending on the benchmark. They also generate permutations in lexicographical order.
2014-06-03 16:11:47 +02:00
Piotr Jawniak
468cabf8d9 Update README file for src/ directory 2014-06-03 14:06:54 +02:00
bors
918dbfea60 auto merge of #14609 : aturon/rust/issue-12882, r=alexcrichton 2014-06-02 20:51:30 -07:00
Erick Tryzelaar
30a8bcbe3d std: add IterReader to adapt iterators into readers 2014-06-02 20:42:41 -07:00
bors
eb1664600c auto merge of #14605 : jakub-/rust/pattern-matching-refactor, r=pcwalton
I've been working around these parts of code and it seems like it could use a bit of a refactor. This is the first step.
2014-06-02 19:01:32 -07:00
fort
c6f10f8831 Adding show impl for Rc 2014-06-02 18:53:08 -07:00
bors
63e9b8f105 auto merge of #14601 : skade/rust/remove-notrust-tags, r=alexcrichton
Now that rustdoc understands proper language tags
as the code not being Rust, we can tag everything
properly. `norust` as a negative statement is a bad
tag.

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.

Amends the documentation to reflect the new
behaviour.
2014-06-02 17:16:31 -07:00
bors
455f574470 auto merge of #14598 : alexcrichton/rust/triage, r=huonw
Closes #10764
2014-06-02 15:26:29 -07:00
Aaron Turon
7526a80ede Document failure cases for char_at and friends. 2014-06-02 15:22:17 -07:00
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