]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #14653 : alexcrichton/rust/travis-opt, r=cmr
bors [Fri, 6 Jun 2014 01:36:56 +0000 (18:36 -0700)]
auto merge of #14653 : alexcrichton/rust/travis-opt, r=cmr

The most frequent failure for our travis builds is running into the timeout
limits when building the compiler itself. Building librustc takes a very long
amount of time, often hitting the 10 minutes with no output threshold that
travis imposes on us.

This commit switches the relevant `make` step to being wrapped in the
`travis_wait` command [1]. This command will print something once a minute so as
to not time out a build.

This will hopefully enable us to have fewer flaky builds on travis!

[1]: http://docs.travis-ci.com/user/build-timeouts/

10 years agoauto merge of #14641 : darnuria/rust/add_documentation_to_std_os, r=alexcrichton
bors [Thu, 5 Jun 2014 23:41:53 +0000 (16:41 -0700)]
auto merge of #14641 : darnuria/rust/add_documentation_to_std_os, r=alexcrichton

Just opening a pull request for adding code examples and documentation to std::os.

More to come soon.

10 years agoauto merge of #14538 : alexcrichton/rust/libcollections, r=brson
bors [Thu, 5 Jun 2014 22:01:54 +0000 (15:01 -0700)]
auto merge of #14538 : alexcrichton/rust/libcollections, r=brson

As with the previous commit with `librand`, this commit shuffles around some
`collections` code. The new state of the world is similar to that of librand:

* The libcollections crate now only depends on libcore and liballoc.
* The standard library has a new module, `std::collections`. All functionality
  of libcollections is reexported through this module.

I would like to stress that this change is purely cosmetic. There are very few
alterations to these primitives.

There are a number of notable points about the new organization:

* std::{str, slice, string, vec} all moved to libcollections. There is no reason
  that these primitives shouldn't be necessarily usable in a freestanding
  context that has allocation. These are all reexported in their usual places in
  the standard library.

* The `hashmap`, and transitively the `lru_cache`, modules no longer reside in
  `libcollections`, but rather in libstd. The reason for this is because the
  `HashMap::new` contructor requires access to the OSRng for initially seeding
  the hash map. Beyond this requirement, there is no reason that the hashmap
  could not move to libcollections.

  I do, however, have a plan to move the hash map to the collections module. The
  `HashMap::new` function could be altered to require that the `H` hasher
  parameter ascribe to the `Default` trait, allowing the entire `hashmap` module
  to live in libcollections. The key idea would be that the default hasher would
  be different in libstd. Something along the lines of:

      // src/libstd/collections/mod.rs

      pub type HashMap<K, V, H = RandomizedSipHasher> =
            core_collections::HashMap<K, V, H>;

  This is not possible today because you cannot invoke static methods through
  type aliases. If we modified the compiler, however, to allow invocation of
  static methods through type aliases, then this type definition would
  essentially be switching the default hasher from `SipHasher` in libcollections
  to a libstd-defined `RandomizedSipHasher` type. This type's `Default`
  implementation would randomly seed the `SipHasher` instance, and otherwise
  perform the same as `SipHasher`.

  This future state doesn't seem incredibly far off, but until that time comes,
  the hashmap module will live in libstd to not compromise on functionality.

* In preparation for the hashmap moving to libcollections, the `hash` module has
  moved from libstd to libcollections. A previously snapshotted commit enables a
  distinct `Writer` trait to live in the `hash` module which `Hash`
  implementations are now parameterized over.

  Due to using a custom trait, the `SipHasher` implementation has lost its
  specialized methods for writing integers. These can be re-added
  backwards-compatibly in the future via default methods if necessary, but the
  FNV hashing should satisfy much of the need for speedier hashing.

A list of breaking changes:

* HashMap::{get, get_mut} no longer fails with the key formatted into the error
  message with `{:?}`, instead, a generic message is printed. With backtraces,
  it should still be not-too-hard to track down errors.

* The HashMap, HashSet, and LruCache types are now available through
  std::collections instead of the collections crate.

* Manual implementations of hash should be parameterized over `hash::Writer`
  instead of just `Writer`.

[breaking-change]

10 years agoFallout from the libcollections movement
Alex Crichton [Fri, 30 May 2014 02:03:06 +0000 (19:03 -0700)]
Fallout from the libcollections movement

10 years agostd: Recreate a `collections` module
Alex Crichton [Fri, 30 May 2014 01:50:12 +0000 (18:50 -0700)]
std: Recreate a `collections` module

As with the previous commit with `librand`, this commit shuffles around some
`collections` code. The new state of the world is similar to that of librand:

* The libcollections crate now only depends on libcore and liballoc.
* The standard library has a new module, `std::collections`. All functionality
  of libcollections is reexported through this module.

I would like to stress that this change is purely cosmetic. There are very few
alterations to these primitives.

There are a number of notable points about the new organization:

* std::{str, slice, string, vec} all moved to libcollections. There is no reason
  that these primitives shouldn't be necessarily usable in a freestanding
  context that has allocation. These are all reexported in their usual places in
  the standard library.

* The `hashmap`, and transitively the `lru_cache`, modules no longer reside in
  `libcollections`, but rather in libstd. The reason for this is because the
  `HashMap::new` contructor requires access to the OSRng for initially seeding
  the hash map. Beyond this requirement, there is no reason that the hashmap
  could not move to libcollections.

  I do, however, have a plan to move the hash map to the collections module. The
  `HashMap::new` function could be altered to require that the `H` hasher
  parameter ascribe to the `Default` trait, allowing the entire `hashmap` module
  to live in libcollections. The key idea would be that the default hasher would
  be different in libstd. Something along the lines of:

      // src/libstd/collections/mod.rs

      pub type HashMap<K, V, H = RandomizedSipHasher> =
            core_collections::HashMap<K, V, H>;

  This is not possible today because you cannot invoke static methods through
  type aliases. If we modified the compiler, however, to allow invocation of
  static methods through type aliases, then this type definition would
  essentially be switching the default hasher from `SipHasher` in libcollections
  to a libstd-defined `RandomizedSipHasher` type. This type's `Default`
  implementation would randomly seed the `SipHasher` instance, and otherwise
  perform the same as `SipHasher`.

  This future state doesn't seem incredibly far off, but until that time comes,
  the hashmap module will live in libstd to not compromise on functionality.

* In preparation for the hashmap moving to libcollections, the `hash` module has
  moved from libstd to libcollections. A previously snapshotted commit enables a
  distinct `Writer` trait to live in the `hash` module which `Hash`
  implementations are now parameterized over.

  Due to using a custom trait, the `SipHasher` implementation has lost its
  specialized methods for writing integers. These can be re-added
  backwards-compatibly in the future via default methods if necessary, but the
  FNV hashing should satisfy much of the need for speedier hashing.

A list of breaking changes:

* HashMap::{get, get_mut} no longer fails with the key formatted into the error
  message with `{:?}`, instead, a generic message is printed. With backtraces,
  it should still be not-too-hard to track down errors.

* The HashMap, HashSet, and LruCache types are now available through
  std::collections instead of the collections crate.

* Manual implementations of hash should be parameterized over `hash::Writer`
  instead of just `Writer`.

[breaking-change]

10 years agoauto merge of #14647 : BurntSushi/rust/fix-14185, r=alexcrichton
bors [Thu, 5 Jun 2014 20:26:53 +0000 (13:26 -0700)]
auto merge of #14647 : BurntSushi/rust/fix-14185, r=alexcrichton

This fix suppresses dead_code warnings from code generated by regex! when
the result of regex! is unused. Correct behavior should be a single
unused variable warning.

Regression tests are included for both `let` and `static` bound regex!
values.

see #14185

10 years agoauto merge of #14526 : pczarn/rust/hashmap-opt, r=alexcrichton
bors [Thu, 5 Jun 2014 18:06:53 +0000 (11:06 -0700)]
auto merge of #14526 : pczarn/rust/hashmap-opt, r=alexcrichton

An interface that gives a better control over the load factor and the minimum capacity for HashMap.
The size of `HashMap<K, V>` is now 64 bytes by default on a 64-bit platform (or at least 40 bytes, that is 3 words less, with FNV and without minimum capacity)

Unanswered questions about `ResizePolicy`

* should it control the `INITIAL_CAPACITY`?
* should it fully control the resizing behavior? Even though the capacity always changes by a factor of 2.
* is caching `grow_at` desirable?

special thanks to @eddyb and @pnkfelix

10 years agoImprove documentation on std::os::env.
Axel Viala [Thu, 5 Jun 2014 15:36:15 +0000 (17:36 +0200)]
Improve documentation on std::os::env.

10 years agoauto merge of #14644 : alexcrichton/rust/more-no-runtime-use-cases, r=brson
bors [Thu, 5 Jun 2014 15:26:51 +0000 (08:26 -0700)]
auto merge of #14644 : alexcrichton/rust/more-no-runtime-use-cases, r=brson

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.

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.

10 years agoauto merge of #14643 : jakub-/rust/infinite-loop-unreachable, r=alexcrichton
bors [Thu, 5 Jun 2014 13:46:54 +0000 (06:46 -0700)]
auto merge of #14643 : jakub-/rust/infinite-loop-unreachable, r=alexcrichton

10 years agoauto merge of #14642 : aochagavia/rust/pr, r=alexcrichton
bors [Thu, 5 Jun 2014 12:11:54 +0000 (05:11 -0700)]
auto merge of #14642 : aochagavia/rust/pr, r=alexcrichton

The contents of a `RingBuf` are shown in the same way as the contents of a `Vector`. See the tests for examples.

10 years agoauto merge of #14640 : tomjakubowski/rust/fix-14636, r=huonw
bors [Thu, 5 Jun 2014 10:36:52 +0000 (03:36 -0700)]
auto merge of #14640 : tomjakubowski/rust/fix-14636, r=huonw

Previously, documentation for an inlined trait (i.e. a trait imported
and reexported from another crate) didn't display the trait's supertraits.

Closes #14636

10 years agoAdding examples and possible failures for getcwd.
Axel Viala [Wed, 4 Jun 2014 14:33:25 +0000 (16:33 +0200)]
Adding examples and possible failures for getcwd.

For both window and unix platforms.

10 years agorustdoc: Include supertraits on inlined traits
Tom Jakubowski [Wed, 4 Jun 2014 10:51:41 +0000 (03:51 -0700)]
rustdoc: Include supertraits on inlined traits

Previously, documentation for an inlined trait (i.e. a trait imported
and reexported from another crate) didn't display the trait's
supertraits.

Closes #14636

10 years agoauto merge of #14568 : erickt/rust/slice-update, r=alexcrichton
bors [Thu, 5 Jun 2014 07:51:48 +0000 (00:51 -0700)]
auto merge of #14568 : erickt/rust/slice-update, r=alexcrichton

This PR adds two features to make it possible to transform an `Iterator<u8>` into a `Reader`. The first patch adds a method to mutable slices that allows it to be updated with an `Iterator<T>` without paying for the bounds cost. The second adds a Iterator adaptor, `IterReader`, to provide that `Reader` interface.

I had two questions. First, are these named the right things? Second, should `IterReader` instead wrap an `Iterator<Result<u8, E>>`? This would allow you to `IterReader::new(rdr.bytes())`, which could be useful if you want to apply some iterator transformations on a reader while still exporting the Reader interface, but I'd expect there'd be a lot of overhead annotating each byte with an error result.

10 years agoauto merge of #14592 : alexcrichton/rust/rustdoc-links, r=huonw
bors [Thu, 5 Jun 2014 05:21:43 +0000 (22:21 -0700)]
auto merge of #14592 : alexcrichton/rust/rustdoc-links, r=huonw

These are a few assorted fixes for some issues I found this morning (details in the commits).

10 years agoauto merge of #14610 : alexcrichton/rust/issue-14008, r=brson
bors [Thu, 5 Jun 2014 03:41:44 +0000 (20:41 -0700)]
auto merge of #14610 : alexcrichton/rust/issue-14008, r=brson

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

10 years agoauto merge of #14529 : brson/rust/ptr, r=brson
bors [Thu, 5 Jun 2014 01:56:48 +0000 (18:56 -0700)]
auto merge of #14529 : brson/rust/ptr, r=brson

This time we're not promoting anything directly to 'stable', but instead promoting functions we're happy with to 'unstable'. They'll become stable in another pass later.

* null and mut_null are unstable. Their names may change if the unsafe
  pointer types change.
* copy_memory and copy_overlapping_memory are unstable. We think they
  aren't going to change.
* set_memory and zero_memory are experimental. Both the names and
  the semantics are under question.
* swap and replace are unstable and probably won't change.
* read is unstable, probably won't change
* read_and_zero is experimental. It's necessity is in doubt.
* mem::overwrite is now called ptr::write to match read and is
  unstable. mem::overwrite is now deprecated
* array_each, array_each_with_len, buf_len, and position are
  all deprecated because they use old style iteration and their
  utility is generally under question.

Note that `mem::overwrite`, which was just declared stable last week, is deprecated now in favor of `ptr::write`. Woo!

10 years agocore: Apply stability attributes to ptr mod
Brian Anderson [Fri, 30 May 2014 00:40:18 +0000 (17:40 -0700)]
core: Apply stability attributes to ptr mod

* null and mut_null are unstable. Their names may change if the unsafe
  pointer types change.
* copy_memory and copy_overlapping_memory are unstable. We think they
  aren't going to change.
* set_memory and zero_memory are experimental. Both the names and
  the semantics are under question.
* swap and replace are unstable and probably won't change.
* read is unstable, probably won't change
* read_and_zero is experimental. It's necessity is in doubt.
* mem::overwrite is now called ptr::write to match read and is
  unstable. mem::overwrite is now deprecated
* array_each, array_each_with_len, buf_len, and position are
  all deprecated because they use old style iteration and their
  utility is generally under question.

10 years agotravis: Prevent timeouts with travis_wait
Alex Crichton [Wed, 4 Jun 2014 19:00:42 +0000 (12:00 -0700)]
travis: Prevent timeouts with travis_wait

The most frequent failure for our travis builds is running into the timeout
limits when building the compiler itself. Building librustc takes a very long
amount of time, often hitting the 10 minutes with no output threshold that
travis imposes on us.

This commit switches the relevant `make` step to being wrapped in the
`travis_wait` command [1]. This command will print something once a minute so as
to not time out a build.

This will hopefully enable us to have fewer flaky builds on travis!

[1]: http://docs.travis-ci.com/user/build-timeouts/

10 years agoauto merge of #14633 : huonw/rust/nodylibc, r=alexcrichton
bors [Wed, 4 Jun 2014 22:26:50 +0000 (15:26 -0700)]
auto merge of #14633 : huonw/rust/nodylibc, r=alexcrichton

libc: only provide an rlib.

There's absolutely no reason for `libc` to be offered as a dynamic
library.

10 years agoFixes #14185.
Andrew Gallant [Wed, 4 Jun 2014 20:59:27 +0000 (16:59 -0400)]
Fixes #14185.

This fix suppresses dead_code warnings from code generated by regex! when
the result of regex! is unused. Correct behavior should be a single
unused variable warning.

Regression tests are included for both `let` and `static` bound regex!
values.

10 years agoauto merge of #14630 : cmr/rust/rewrite-lexer, r=alexcrichton
bors [Wed, 4 Jun 2014 20:06:47 +0000 (13:06 -0700)]
auto merge of #14630 : cmr/rust/rewrite-lexer, r=alexcrichton

These are a pain to rebase, so I'm separating this from the rest of my work.
Nothing controversial here, just some simple refactoring and removal of an
unused entry in the token table. Brings the lexer into 2012 with methods!

10 years agosyntax: use doc comments in the interner
Corey Richardson [Thu, 22 May 2014 00:20:52 +0000 (17:20 -0700)]
syntax: use doc comments in the interner

10 years agosyntax: methodify the lexer
Corey Richardson [Wed, 21 May 2014 23:57:31 +0000 (16:57 -0700)]
syntax: methodify the lexer

10 years agostd: Improve non-task-based usage
Alex Crichton [Wed, 4 Jun 2014 17:54:35 +0000 (10:54 -0700)]
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.

10 years agoauto merge of #14623 : exscape/rust-fork/master, r=alexcrichton
bors [Wed, 4 Jun 2014 18:06:49 +0000 (11:06 -0700)]
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.

10 years agocollections: optimize `HashMap`. Add `DefaultResizePolicy`.
Piotr Czarnecki [Mon, 2 Jun 2014 08:26:02 +0000 (10:26 +0200)]
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.

10 years agoFix an ICE when a function argument is of the bottom type
Jakub Wieczorek [Wed, 4 Jun 2014 16:25:30 +0000 (18:25 +0200)]
Fix an ICE when a function argument is of the bottom type

Fixes #13352

10 years agoMark the exit of infinite loops as unreachable
Jakub Wieczorek [Wed, 4 Jun 2014 16:24:58 +0000 (18:24 +0200)]
Mark the exit of infinite loops as unreachable

10 years agoauto merge of #14616 : forticulous/rust/rc-show, r=alexcrichton
bors [Wed, 4 Jun 2014 15:11:51 +0000 (08:11 -0700)]
auto merge of #14616 : forticulous/rust/rc-show, r=alexcrichton

Show impl for Rc

10 years agoImplement Show for RingBuf
Adolfo OchagavĂ­a [Wed, 4 Jun 2014 14:15:04 +0000 (16:15 +0200)]
Implement Show for RingBuf

10 years agoAdd code example to std::os::getenv for unix.
Axel Viala [Wed, 4 Jun 2014 12:45:56 +0000 (14:45 +0200)]
Add code example to std::os::getenv for unix.

10 years agolibc: only provide an rlib.
Huon Wilson [Tue, 3 Jun 2014 23:12:11 +0000 (09:12 +1000)]
libc: only provide an rlib.

There's absolutely no reason for `libc` to be offered as a dynamic
library.

10 years agoauto merge of #14635 : BurntSushi/rust/regex-doco-touchups, r=alexcrichton
bors [Wed, 4 Jun 2014 06:51:41 +0000 (23:51 -0700)]
auto merge of #14635 : BurntSushi/rust/regex-doco-touchups, r=alexcrichton

10 years agoauto merge of #14634 : BurntSushi/rust/fix-13843, r=alexcrichton
bors [Wed, 4 Jun 2014 05:01:43 +0000 (22:01 -0700)]
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.

10 years agoAdd comments for the token table
Corey Richardson [Tue, 20 May 2014 18:59:07 +0000 (11:59 -0700)]
Add comments for the token table

10 years agosyntax: shuffle some allocation out of binop_to_str
Corey Richardson [Tue, 20 May 2014 17:37:08 +0000 (10:37 -0700)]
syntax: shuffle some allocation out of binop_to_str

10 years agoSome minor documentation touchups for libregex. Fixes #13800.
Andrew Gallant [Wed, 4 Jun 2014 03:45:54 +0000 (23:45 -0400)]
Some minor documentation touchups for libregex. Fixes #13800.

10 years agoFixes #13843.
Andrew Gallant [Wed, 4 Jun 2014 03:04:59 +0000 (23:04 -0400)]
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.

10 years agoauto merge of #14628 : luqmana/rust/fcr, r=nikomatsakis
bors [Wed, 4 Jun 2014 02:36:42 +0000 (19:36 -0700)]
auto merge of #14628 : luqmana/rust/fcr, r=nikomatsakis

#14589.

10 years agorustdoc: Put primitives in respective modules
Alex Crichton [Wed, 4 Jun 2014 00:55:30 +0000 (17:55 -0700)]
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.

10 years agoauto merge of #14632 : luqmana/rust/cu, r=huonw
bors [Wed, 4 Jun 2014 00:46:46 +0000 (17:46 -0700)]
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.

10 years agostd: Remove generics from Option::expect
Alex Crichton [Mon, 2 Jun 2014 22:49:42 +0000 (15:49 -0700)]
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

10 years agolibrustc: remove check::FnKind enum since we only ever use one variant.
Luqman Aden [Tue, 3 Jun 2014 23:04:29 +0000 (19:04 -0400)]
librustc: remove check::FnKind enum since we only ever use one variant.

10 years agoauto merge of #14627 : Indiv0/rust/fix-crateid-doc-typo, r=alexcrichton
bors [Tue, 3 Jun 2014 23:01:44 +0000 (16:01 -0700)]
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.

10 years agoauto merge of #14626 : klutzy/rust/issue-14618, r=alexcrichton
bors [Tue, 3 Jun 2014 21:06:42 +0000 (14:06 -0700)]
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

10 years agolibrustc: Try to resolve before coercions.
Luqman Aden [Tue, 3 Jun 2014 19:38:00 +0000 (15:38 -0400)]
librustc: Try to resolve before coercions.

10 years agoauto merge of #14625 : japaric/rust/slice-tojson, r=alexcrichton
bors [Tue, 3 Jun 2014 18:46:51 +0000 (11:46 -0700)]
auto merge of #14625 : japaric/rust/slice-tojson, r=alexcrichton

Let me know if the amount of tests is enough or too much.

10 years agoFix typo "gihub" in libsyntax/crateid.
Nikita Pekin [Tue, 3 Jun 2014 18:25:16 +0000 (14:25 -0400)]
Fix typo "gihub" in libsyntax/crateid.

Update licensing header for 2014.

10 years agoauto merge of #14622 : reillywatson/rust/master, r=alexcrichton
bors [Tue, 3 Jun 2014 17:01:40 +0000 (10:01 -0700)]
auto merge of #14622 : reillywatson/rust/master, r=alexcrichton

10 years agosyntax: Make quasiquoter use absolute paths
klutzy [Tue, 3 Jun 2014 16:42:11 +0000 (01:42 +0900)]
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

10 years agoImplement ToJson for &[T], and add tests. Closes #14619
Jorge Aparicio [Tue, 3 Jun 2014 15:49:26 +0000 (10:49 -0500)]
Implement ToJson for &[T], and add tests. Closes #14619

10 years agoauto merge of #14621 : Sawyer47/rust/fix-readme, r=alexcrichton
bors [Tue, 3 Jun 2014 15:11:38 +0000 (08:11 -0700)]
auto merge of #14621 : Sawyer47/rust/fix-readme, r=alexcrichton

10 years agoDoc: grammar fix in intro.md
Reilly Watson [Tue, 3 Jun 2014 14:24:54 +0000 (10:24 -0400)]
Doc: grammar fix in intro.md

10 years agoAdd next_permutation and prev_permutation onto MutableOrdVector<T>.
Thomas Backman [Tue, 3 Jun 2014 14:11:47 +0000 (16:11 +0200)]
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.

10 years agoUpdate README file for src/ directory
Piotr Jawniak [Sat, 31 May 2014 17:44:34 +0000 (19:44 +0200)]
Update README file for src/ directory

10 years agoauto merge of #14609 : aturon/rust/issue-12882, r=alexcrichton
bors [Tue, 3 Jun 2014 03:51:30 +0000 (20:51 -0700)]
auto merge of #14609 : aturon/rust/issue-12882, r=alexcrichton

10 years agostd: add `IterReader` to adapt iterators into readers
Erick Tryzelaar [Tue, 3 Jun 2014 03:42:41 +0000 (20:42 -0700)]
std: add `IterReader` to adapt iterators into readers

10 years agoauto merge of #14605 : jakub-/rust/pattern-matching-refactor, r=pcwalton
bors [Tue, 3 Jun 2014 02:01:32 +0000 (19:01 -0700)]
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.

10 years agoAdding show impl for Rc
fort [Mon, 2 Jun 2014 06:35:15 +0000 (23:35 -0700)]
Adding show impl for Rc

10 years agoauto merge of #14601 : skade/rust/remove-notrust-tags, r=alexcrichton
bors [Tue, 3 Jun 2014 00:16:31 +0000 (17:16 -0700)]
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.

10 years agoauto merge of #14598 : alexcrichton/rust/triage, r=huonw
bors [Mon, 2 Jun 2014 22:26:29 +0000 (15:26 -0700)]
auto merge of #14598 : alexcrichton/rust/triage, r=huonw

Closes #10764

10 years agoDocument failure cases for `char_at` and friends.
Aaron Turon [Mon, 2 Jun 2014 22:22:17 +0000 (15:22 -0700)]
Document failure cases for `char_at` and friends.

10 years agoauto merge of #14509 : klutzy/rust/de-pub-use-glob, r=alexcrichton
bors [Mon, 2 Jun 2014 19:46:31 +0000 (12:46 -0700)]
auto merge of #14509 : klutzy/rust/de-pub-use-glob, r=alexcrichton

This patchset removes `pub use` usage except for `test/`.
cc #11870

10 years agoRemove further code duplication
Jakub Wieczorek [Mon, 2 Jun 2014 18:49:44 +0000 (20:49 +0200)]
Remove further code duplication

10 years agoImprove code reuse in check_match::specialize()
Jakub Wieczorek [Mon, 2 Jun 2014 15:18:23 +0000 (17:18 +0200)]
Improve code reuse in check_match::specialize()

10 years agotest: Add tests for closed issue #10764
Alex Crichton [Mon, 2 Jun 2014 08:03:30 +0000 (01:03 -0700)]
test: Add tests for closed issue #10764

Closes #10764

10 years agorustdoc: Correctly inline required/provided methods
Alex Crichton [Mon, 2 Jun 2014 07:09:44 +0000 (00:09 -0700)]
rustdoc: Correctly inline required/provided methods

Apparently relying on provided_source in ty::Method is unreliable!

Closes #14594

10 years agorustdoc: Deduplicate lists of implementors
Alex Crichton [Sun, 1 Jun 2014 18:30:53 +0000 (11:30 -0700)]
rustdoc: Deduplicate lists of implementors

Inlining caused implementors to show up multiple times.

cc #14584

10 years agosyntax: Remove use of `pub use` globs
klutzy [Thu, 29 May 2014 03:19:05 +0000 (12:19 +0900)]
syntax: Remove use of `pub use` globs

`quote_expr!` now injects two more (priv) `use` globs.
This may cause extra unused_imports warning.

10 years agodoc: Remove use of `pub use` globs
klutzy [Thu, 29 May 2014 06:17:00 +0000 (15:17 +0900)]
doc: Remove use of `pub use` globs

10 years agodocs: Stop using `notrust`
Florian Gilcher [Mon, 2 Jun 2014 10:37:54 +0000 (12:37 +0200)]
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.

10 years agoauto merge of #14596 : Sawyer47/rust/encodable-fix, r=alexcrichton
bors [Mon, 2 Jun 2014 08:06:39 +0000 (01:06 -0700)]
auto merge of #14596 : Sawyer47/rust/encodable-fix, r=alexcrichton

Closes #14021

10 years agoFix deriving Encodable trait for unit structs
Piotr Jawniak [Sun, 1 Jun 2014 12:16:11 +0000 (14:16 +0200)]
Fix deriving Encodable trait for unit structs

Closes #14021

10 years agoauto merge of #14569 : skade/rust/rustdoc-robust-langstring-parsing, r=alexcrichton
bors [Mon, 2 Jun 2014 05:01:36 +0000 (22:01 -0700)]
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.

10 years agorustdoc: Ensure external impls are inlined once
Alex Crichton [Sun, 1 Jun 2014 18:16:18 +0000 (11:16 -0700)]
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

10 years agomk: Less noisy rustdoc invocations
Alex Crichton [Sun, 1 Jun 2014 18:09:30 +0000 (11:09 -0700)]
mk: Less noisy rustdoc invocations

10 years agorustdoc: Filter private methods from inlined impls
Alex Crichton [Sun, 1 Jun 2014 18:06:47 +0000 (11:06 -0700)]
rustdoc: Filter private methods from inlined impls

Closes #14583

10 years agorustdoc: Fix some more broken links
Alex Crichton [Sun, 1 Jun 2014 17:17:30 +0000 (10:17 -0700)]
rustdoc: Fix some more broken links

10 years agoauto merge of #14591 : klutzy/rust/issue-9205, r=thestinger
bors [Mon, 2 Jun 2014 03:26:39 +0000 (20:26 -0700)]
auto merge of #14591 : klutzy/rust/issue-9205, r=thestinger

Fixes #9205.

10 years agotest: Enable #9205-related tests on windows
klutzy [Mon, 2 Jun 2014 03:08:19 +0000 (12:08 +0900)]
test: Enable #9205-related tests on windows

Fixes #9205.

10 years agorustdoc: make langstring parsing more robust
Florian Gilcher [Sat, 31 May 2014 22:33:32 +0000 (00:33 +0200)]
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.

10 years agoauto merge of #14579 : alexcrichton/rust/more-eq-renamings, r=thestinger
bors [Sun, 1 Jun 2014 17:36:39 +0000 (10:36 -0700)]
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.

10 years agostd: Drop Total from Total{Eq,Ord}
Alex Crichton [Sat, 31 May 2014 17:43:52 +0000 (10:43 -0700)]
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]

10 years agoauto merge of #14580 : utkarshkukreti/rust/fix-docs-for-result-map, r=alexcrichton
bors [Sun, 1 Jun 2014 11:36:38 +0000 (04:36 -0700)]
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`.

10 years agoauto merge of #14578 : huonw/rust/as_slice-cheatsheet, r=sfackler
bors [Sun, 1 Jun 2014 09:36:39 +0000 (02:36 -0700)]
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.

10 years agoauto merge of #14571 : bnoordhuis/rust/libtest-check-isatty, r=alexcrichton
bors [Sun, 1 Jun 2014 07:56:42 +0000 (00:56 -0700)]
auto merge of #14571 : bnoordhuis/rust/libtest-check-isatty, r=alexcrichton

Fixes #14570.

10 years agoFix docs for `core::result::Result::map`.
Utkarsh Kukreti [Sat, 31 May 2014 19:50:52 +0000 (01:20 +0530)]
Fix docs for `core::result::Result::map`.

`reader.read_line()` includes trailing newline char, which makes
`from_str` always return `None`.

10 years agoauto merge of #14513 : alexcrichton/rust/rustdoc-primitives, r=huonw
bors [Sun, 1 Jun 2014 06:16:42 +0000 (23:16 -0700)]
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!

10 years agosyntax: Fix an accidental hyperlink in a comment
Alex Crichton [Thu, 29 May 2014 22:52:23 +0000 (15:52 -0700)]
syntax: Fix an accidental hyperlink in a comment

10 years agorustdoc: Don't inline tuple struct constructors
Alex Crichton [Thu, 29 May 2014 22:52:03 +0000 (15:52 -0700)]
rustdoc: Don't inline tuple struct constructors

These don't actually point to anything, so there's no need to inline them.

10 years agorustdoc: Fix cross-crate links to reexported items
Alex Crichton [Thu, 29 May 2014 20:50:47 +0000 (13:50 -0700)]
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

10 years agodoc: Fix a number of broken links
Alex Crichton [Thu, 29 May 2014 16:58:09 +0000 (09:58 -0700)]
doc: Fix a number of broken links

cc #14515

10 years agorustdoc: Suck in all impls from external crates
Alex Crichton [Thu, 29 May 2014 08:35:44 +0000 (01:35 -0700)]
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.

10 years agorustdoc: Filter inlining private external items
Alex Crichton [Thu, 29 May 2014 07:26:17 +0000 (00:26 -0700)]
rustdoc: Filter inlining private external items

This prevents structures like RcBox from showing up in the documentation

10 years agorustdoc: Create anchor pages for primitive types
Alex Crichton [Thu, 29 May 2014 02:53:37 +0000 (19:53 -0700)]
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

10 years agorustdoc: Fill in external type parameters correctly
Alex Crichton [Thu, 29 May 2014 06:14:08 +0000 (23:14 -0700)]
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

10 years agorustdoc: Stringify more named lifetimes
Alex Crichton [Wed, 28 May 2014 01:07:08 +0000 (18:07 -0700)]
rustdoc: Stringify more named lifetimes

cc #14462

10 years agorustdoc: Show all implementors of traits
Alex Crichton [Wed, 28 May 2014 00:52:40 +0000 (17:52 -0700)]
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