Commit Graph

29642 Commits

Author SHA1 Message Date
Niko Matsakis
0f03b5608c Move Def out of syntax crate, where it does not belong 2014-06-06 19:51:23 -04:00
Niko Matsakis
14d626a9fa Simplify MonoId not to include parameters which, given coherence, are purely derived 2014-06-06 19:46:38 -04:00
Niko Matsakis
f24a53757e Move subst data structures into subst.rs, fix capitalization 2014-06-06 19:46:38 -04:00
bors
8a414858ac auto merge of #14680 : Kimundi/rust/master, r=brson
Also updated/corrected a few other details in the tuple and struct sections.
2014-06-06 15:21:59 -07:00
Jonathan S
f2f1991c81 Make sync::raw::Sem use Unsafe to manage mutability instead of transmuting an unsafe pointer 2014-06-06 15:24:14 -05:00
bors
61d79175c0 auto merge of #14318 : zwarich/rust/check-loans-refactor, r=nikomatsakis
I tried to split up the less mechanical changes into separate commits so they are easier to review. One thing I'm not quite sure of is whether `MoveReason` should just be replaced with `move_data::MoveKind`.
2014-06-06 12:17:10 -07:00
Cameron Zwarich
f1542a6a7d Add a test for borrowck errors with multiple closure captures.
When converting check_loans to use ExprUseVisitor I encountered a few
issues where the wrong number of errors were being emitted for multiple
closure captures, but there is no existing test for this.
2014-06-06 11:59:33 -07:00
Cameron Zwarich
74eb4b4b57 Add new tests for borrowck field-sensitivity. 2014-06-06 11:59:33 -07:00
Cameron Zwarich
c53d296e12 Change check_loans to use ExprUseVisitor. 2014-06-06 11:59:33 -07:00
Cameron Zwarich
78934b03e3 Add a kind_of_move_of_path method to FlowedMoveData. 2014-06-06 11:59:33 -07:00
Cameron Zwarich
40e3fb4c0b Use the MoveReason to determine a more precise MoveKind in gather_moves. 2014-06-06 11:59:33 -07:00
Cameron Zwarich
5ccb7644be Add a move reason to the Move ConsumeMode.
Currently it is not possible to distinguish moves caused by captures
in the ExprUseVisitor interface. Since check_Loans needs to make that
distinction for generating good diagnostics, this is necessary for
check_loans to switch to ExprUseVisitor.
2014-06-06 11:59:33 -07:00
Cameron Zwarich
f63fad5d60 Add an Init mode to MutateMode.
This isn't necessary right now, but check_loans needs to be able to
distinguish between initialization and writes in the ExprUseVisitor
mutate callback.
2014-06-06 11:59:32 -07:00
Cameron Zwarich
0339b27e6d Fix mem_categorization to treat an AutoObject adjustment as an rvalue.
Currently mem_categorization categorizes an AutoObject adjustment the
same as the original expression. This can cause two moves to be
generated for the same underlying expression. Currently this isn't a
problem in practice, since check_loans doesn't rely on ExprUseVisitor.
2014-06-06 11:59:32 -07:00
Cameron Zwarich
d123188b20 Clean up check_loans.
Refactor a number of functions in check_loans to take node IDs and spans
rather than taking expressions directly. Also rename some variables to
make them less ambiguous.

This is the first step towards using ExprUseVisitor in check_loans, as
now some of the interfaces more closely match those used in
ExprUseVisitor.
2014-06-06 11:59:32 -07:00
bors
3744940706 auto merge of #14677 : alexcrichton/rust/issue-2665, r=brson
There's no need to distribute these ABI helpers for tests with the standard rust
distribution they're only needed for our tests.

Closes #2665
2014-06-06 10:36:55 -07:00
bors
124e997f36 auto merge of #14676 : brson/rust/double-rainbow, r=alexcrichton 2014-06-06 08:07:07 -07:00
bors
071e22ed89 auto merge of #14673 : sylvestre/rust/master, r=alexcrichton
Remove a warning (./configure: 1140: [: unexpected operator) when built with --disable-manage-submodules
2014-06-06 06:27:00 -07:00
bors
566b7b93c6 auto merge of #14671 : aochagavia/rust/patch-1, r=alexcrichton 2014-06-06 04:41:53 -07:00
bors
76baa5f086 auto merge of #14668 : aochagavia/rust/pr3, r=alexcrichton
Closes https://github.com/mozilla/rust/issues/14577
Closes https://github.com/mozilla/rust/issues/14639
2014-06-06 03:01:57 -07:00
bors
732e057815 auto merge of #14667 : aochagavia/rust/pr2, r=huonw 2014-06-06 01:21:54 -07:00
Adolfo Ochagavía
501b904bb7 Change to_str().to_string() to just to_str() 2014-06-06 09:56:59 +02:00
Adolfo Ochagavía
75891274c4 Document BigInt's new and from_slice methods
Fixes https://github.com/mozilla/rust/issues/14639
2014-06-06 09:09:59 +02:00
Adolfo Ochagavía
7d07a1e74b Fix documentation for slice()
Fixes https://github.com/mozilla/rust/issues/14577
2014-06-06 09:09:58 +02:00
bors
100ff4cf30 auto merge of #14669 : TeXitoi/rust/relicense-shootout-meteor, r=brson
part of #14248, fix #14420

Removed @richo's contribution (outdated comment)

Quoting @brson: let's move forward with this one. The only
statement I'm missing is @richo's and it sounds like his was a
minor patch.
2014-06-05 23:36:56 -07:00
bors
ae9577052d auto merge of #14664 : reem/rust/lifetimes-guide-grammar, r=brson
Removed strange fragment-like thing in the intro.
2014-06-05 20:16:53 -07:00
bors
e14bc6698a 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/
2014-06-05 18:36:56 -07:00
Alex Crichton
5cdc36517e mk: Move rust_test_helpers out of libstd
There's no need to distribute these ABI helpers for tests with the standard rust
distribution they're only needed for our tests.

Closes #2665
2014-06-05 17:55:41 -07:00
bors
5ec49c7924 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.
2014-06-05 16:41:53 -07:00
bors
ba3ba002d5 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]
2014-06-05 15:01:54 -07:00
Alex Crichton
760b93adc0 Fallout from the libcollections movement 2014-06-05 13:55:11 -07:00
Alex Crichton
6a585375a0 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]
2014-06-05 13:55:10 -07:00
bors
3ec321f535 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
2014-06-05 13:26:53 -07:00
Marvin Löbel
792fae35f7 Purged "record" from the manual.
Also updated/corrected a few other details in the tuple and struct sections.
2014-06-05 21:31:57 +02:00
bors
d70a9b93d0 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
2014-06-05 11:06:53 -07:00
Brian Anderson
b45553f075 How about a less cringe-worthy double-failure message? 2014-06-05 10:21:35 -07:00
Axel Viala
85adc09b19 Improve documentation on std::os::env. 2014-06-05 17:36:15 +02:00
bors
57e7147f3e 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.
2014-06-05 08:26:51 -07:00
bors
bb57e417ea auto merge of #14643 : jakub-/rust/infinite-loop-unreachable, r=alexcrichton 2014-06-05 06:46:54 -07:00
Sylvestre Ledru
fec04d387b Remove a warning (./configure: 1140: [: unexpected operator) when built with --disable-manage-submodules 2014-06-05 15:18:11 +02:00
bors
a7ac6a4eb7 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.
2014-06-05 05:11:54 -07:00
bors
f2821f2c29 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
2014-06-05 03:36:52 -07:00
Axel Viala
f377dfe5ac Adding examples and possible failures for getcwd.
For both window and unix platforms.
2014-06-05 11:39:01 +02:00
Adolfo Ochagavía
95b2cce81f Update AUTHORS.txt 2014-06-05 10:43:47 +02:00
Tom Jakubowski
2382bf42df 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
2014-06-05 01:43:30 -07:00
Guillaume Pinot
ec8ef0d24d relicense shootout-meteor.rs
part of #14248, fix #14420

Removed @richo's contribution (outdated comment)

Quoting @brson: let's move forward with this one. The only
statement I'm missing is @richo's and it sounds like his was a
minor patch.
2014-06-05 10:39:09 +02:00
bors
0c74911f87 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.
2014-06-05 00:51:48 -07:00
Jonathan Reem
7e0cc34d62 Fixed weird grammar in lifetimes guide. 2014-06-04 22:27:21 -07:00
bors
073c8f10fc 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).
2014-06-04 22:21:43 -07:00
bors
422d54bed2 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
2014-06-04 20:41:44 -07:00