Commit Graph

36273 Commits

Author SHA1 Message Date
Alex Crichton
faf53559c6 rollup merge of #20382: alexcrichton/isuse-20376 2015-01-02 09:16:47 -08:00
Alex Crichton
074996d6f9 rollup merge of #20377: alexcrichton/issue-20352 2015-01-02 09:16:26 -08:00
Alex Crichton
8b7d032014 rollup merge of #20273: alexcrichton/second-pass-comm
Conflicts:
	src/doc/guide.md
	src/libcollections/bit.rs
	src/libcollections/btree/node.rs
	src/libcollections/slice.rs
	src/libcore/ops.rs
	src/libcore/prelude.rs
	src/librand/rand_impls.rs
	src/librustc/middle/check_match.rs
	src/librustc/middle/infer/region_inference/mod.rs
	src/librustc_driver/lib.rs
	src/librustdoc/test.rs
	src/libstd/bitflags.rs
	src/libstd/io/comm_adapters.rs
	src/libstd/io/mem.rs
	src/libstd/io/mod.rs
	src/libstd/io/net/pipe.rs
	src/libstd/io/net/tcp.rs
	src/libstd/io/net/udp.rs
	src/libstd/io/pipe.rs
	src/libstd/io/process.rs
	src/libstd/io/stdio.rs
	src/libstd/io/timer.rs
	src/libstd/io/util.rs
	src/libstd/macros.rs
	src/libstd/os.rs
	src/libstd/path/posix.rs
	src/libstd/path/windows.rs
	src/libstd/prelude/v1.rs
	src/libstd/rand/mod.rs
	src/libstd/rand/os.rs
	src/libstd/sync/barrier.rs
	src/libstd/sync/condvar.rs
	src/libstd/sync/future.rs
	src/libstd/sync/mpsc/mod.rs
	src/libstd/sync/mpsc/mpsc_queue.rs
	src/libstd/sync/mpsc/select.rs
	src/libstd/sync/mpsc/spsc_queue.rs
	src/libstd/sync/mutex.rs
	src/libstd/sync/once.rs
	src/libstd/sync/rwlock.rs
	src/libstd/sync/semaphore.rs
	src/libstd/sync/task_pool.rs
	src/libstd/sys/common/helper_thread.rs
	src/libstd/sys/unix/process.rs
	src/libstd/sys/unix/timer.rs
	src/libstd/sys/windows/c.rs
	src/libstd/sys/windows/timer.rs
	src/libstd/sys/windows/tty.rs
	src/libstd/thread.rs
	src/libstd/thread_local/mod.rs
	src/libstd/thread_local/scoped.rs
	src/libtest/lib.rs
	src/test/auxiliary/cci_capture_clause.rs
	src/test/bench/shootout-reverse-complement.rs
	src/test/bench/shootout-spectralnorm.rs
	src/test/compile-fail/array-old-syntax-2.rs
	src/test/compile-fail/bind-by-move-no-guards.rs
	src/test/compile-fail/builtin-superkinds-self-type.rs
	src/test/compile-fail/comm-not-freeze-receiver.rs
	src/test/compile-fail/comm-not-freeze.rs
	src/test/compile-fail/issue-12041.rs
	src/test/compile-fail/unsendable-class.rs
	src/test/run-pass/builtin-superkinds-capabilities-transitive.rs
	src/test/run-pass/builtin-superkinds-capabilities-xc.rs
	src/test/run-pass/builtin-superkinds-capabilities.rs
	src/test/run-pass/builtin-superkinds-self-type.rs
	src/test/run-pass/capturing-logging.rs
	src/test/run-pass/closure-bounds-can-capture-chan.rs
	src/test/run-pass/comm.rs
	src/test/run-pass/core-run-destroy.rs
	src/test/run-pass/drop-trait-enum.rs
	src/test/run-pass/hashmap-memory.rs
	src/test/run-pass/issue-13494.rs
	src/test/run-pass/issue-3609.rs
	src/test/run-pass/issue-4446.rs
	src/test/run-pass/issue-4448.rs
	src/test/run-pass/issue-8827.rs
	src/test/run-pass/issue-9396.rs
	src/test/run-pass/ivec-tag.rs
	src/test/run-pass/rust-log-filter.rs
	src/test/run-pass/send-resource.rs
	src/test/run-pass/send-type-inference.rs
	src/test/run-pass/sendable-class.rs
	src/test/run-pass/spawn-types.rs
	src/test/run-pass/task-comm-0.rs
	src/test/run-pass/task-comm-10.rs
	src/test/run-pass/task-comm-11.rs
	src/test/run-pass/task-comm-13.rs
	src/test/run-pass/task-comm-14.rs
	src/test/run-pass/task-comm-15.rs
	src/test/run-pass/task-comm-16.rs
	src/test/run-pass/task-comm-3.rs
	src/test/run-pass/task-comm-4.rs
	src/test/run-pass/task-comm-5.rs
	src/test/run-pass/task-comm-6.rs
	src/test/run-pass/task-comm-7.rs
	src/test/run-pass/task-comm-9.rs
	src/test/run-pass/task-comm-chan-nil.rs
	src/test/run-pass/task-spawn-move-and-copy.rs
	src/test/run-pass/task-stderr.rs
	src/test/run-pass/tcp-accept-stress.rs
	src/test/run-pass/tcp-connect-timeouts.rs
	src/test/run-pass/tempfile.rs
	src/test/run-pass/trait-bounds-in-arc.rs
	src/test/run-pass/trivial-message.rs
	src/test/run-pass/unique-send-2.rs
	src/test/run-pass/unique-send.rs
	src/test/run-pass/unwind-resource.rs
2015-01-02 09:15:54 -08:00
Niko Matsakis
704ed4c7d0 Address nits. 2015-01-02 12:09:38 -05:00
Niko Matsakis
a535f2aab1 Test that we can call unboxed closures with the sugar now. Fixes #16929. 2015-01-02 12:09:38 -05:00
Niko Matsakis
dabd7507b6 Ensure that, for every trait Foo, the predicate Foo : Foo holds. 2015-01-02 12:09:38 -05:00
Niko Matsakis
19dcecb225 Refactor object-safety into its own (cached) module so that we can
check it more easily; also extend object safety to cover sized types
as well as static methods.  This makes it sufficient so that we can
always ensure that `Foo : Foo` holds for any trait `Foo`.
2015-01-02 12:08:36 -05:00
Niko Matsakis
2c1d7a7caa Move the upcast routine into traits and use it for method selection; also
move get_method_index into traits and give it a better name (`get_vtable_index_of_object_method`).
2015-01-02 12:08:36 -05:00
Niko Matsakis
50ed6c1906 Do not automatically make Self Sized in traits. 2015-01-02 12:08:36 -05:00
Niko Matsakis
5b425c1b2f Fix fallout in tests. 2015-01-02 12:08:36 -05:00
Corey Richardson
d555772554 rustdoc: fix rendering of associated types 2015-01-02 12:07:04 -05:00
Jorge Aparicio
cc5ecaf765 merge *SliceExt traits, use assoc types in SliceExt, Raw[Mut]Ptr 2015-01-02 12:07:04 -05:00
Niko Matsakis
1b3734f8ae Fix fallout from change, adding explicit Sized annotations where necessary. 2015-01-02 12:06:59 -05:00
Alex Crichton
167683da23 Register new snapshots 2015-01-02 12:05:56 -05:00
Alex Crichton
5696ea5894 rollup merge of #20157: alexcrichton/issue-20068 2015-01-02 08:54:58 -08:00
Steve Klabnik
76e3bc2338 Properly deal with Ordering in the guide
Now that it's been removed from the prelude, we need to treat things differently.

Fixes #17967
2015-01-02 08:54:06 -08:00
Alex Crichton
56290a0044 std: Stabilize the prelude module
This commit is an implementation of [RFC 503][rfc] which is a stabilization
story for the prelude. Most of the RFC was directly applied, removing reexports.
Some reexports are kept around, however:

* `range` remains until range syntax has landed to reduce churn.
* `Path` and `GenericPath` remain until path reform lands. This is done to
  prevent many imports of `GenericPath` which will soon be removed.
* All `io` traits remain until I/O reform lands so imports can be rewritten all
  at once to `std::io::prelude::*`.

This is a breaking change because many prelude reexports have been removed, and
the RFC can be consulted for the exact list of removed reexports, as well as to
find the locations of where to import them.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0503-prelude-stabilization.md
[breaking-change]

Closes #20068
2015-01-02 08:54:06 -08:00
bors
4b40bc85cb auto merge of #20365 : nick29581/rust/mod, r=huonw
Part of #20361 and #20362
2015-01-02 16:31:26 +00:00
bors
71b46b18a2 auto merge of #20356 : Gankro/rust/stab, r=aturon
This stabilizes most of libcollections, carefully avoiding sections of API which are being managed in other PRs. APIs which are not stable are marked explicitly unstable with a reason.

Deprecates:

* DList
  * rotate_forward
  * rotate_backward
  * prepend
  * insert_when
  * insert_ordered
  * merge

* VecMap
  * update
  * update_with_key

* Renames and newtypes the Bitv and BitvSet iterators to match conventions.

* Removes the Copy impl from DList's Iter.

as such this is a

[breaking-change]
2015-01-02 15:51:25 +00:00
Seo Sanghyeon
4ae7c38e7b Add a pretty-print test 2015-01-02 22:28:53 +09:00
Seo Sanghyeon
f2a06f760b Make type in ast::Local optional 2015-01-02 20:55:31 +09:00
Nick Cameron
dc53461a98 Rebasing 2015-01-02 23:20:46 +13:00
Nick Cameron
30e149231c Use derive rather than deriving in tests 2015-01-02 23:05:22 +13:00
Nick Cameron
7506fe5269 Accept derive instead of deriving
[breaking-change]

`deriving is still accepted, but gives a deprecation warning
2015-01-02 23:05:22 +13:00
Nick Cameron
f003b43823 Change tests to use self instead of mod in use items 2015-01-02 23:05:22 +13:00
Nick Cameron
74d11d26f4 Accept self in place of mod in use items
[breaking-change]

`mod` is still accepted, but gives a deprecated warning
2015-01-02 23:05:22 +13:00
Niko Matsakis
82a2e8e310 Fix an infinite loop in the stability check that was the result of
various bugs in `trait_id_of_impl`. The end result was that looking up
the "trait_id_of_impl" with a trait's def-id yielded the same trait
again, even though it ought to have yielded None.
2015-01-02 04:06:09 -05:00
Niko Matsakis
6ed3f24907 New coherence tests covering patterns we want to work (and not work). 2015-01-02 04:06:09 -05:00
Niko Matsakis
5c34781a7d Disable the JSON doctests because they don't pass the new coherence
rules and cannot be updated until the libraries are synced, nor can
they opt in to the old semantics.
2015-01-02 04:06:09 -05:00
Niko Matsakis
c61a0092bc Fix orphan checking (cc #19470). (This is not a complete fix of #19470 because of the backwards compatibility feature gate.)
This is a [breaking-change]. The new rules require that, for an impl of a trait defined
in some other crate, two conditions must hold:

1. Some type must be local.
2. Every type parameter must appear "under" some local type.

Here are some examples that are legal:

```rust
struct MyStruct<T> { ... }

// Here `T` appears "under' `MyStruct`.
impl<T> Clone for MyStruct<T> { }

// Here `T` appears "under' `MyStruct` as well. Note that it also appears
// elsewhere.
impl<T> Iterator<T> for MyStruct<T> { }
```

Here is an illegal example:

```rust
// Here `U` does not appear "under" `MyStruct` or any other local type.
// We call `U` "uncovered".
impl<T,U> Iterator<U> for MyStruct<T> { }
```

There are a couple of ways to rewrite this last example so that it is
legal:

1. In some cases, the uncovered type parameter (here, `U`) should be converted
   into an associated type. This is however a non-local change that requires access
   to the original trait. Also, associated types are not fully baked.
2. Add `U` as a type parameter of `MyStruct`:
   ```rust
   struct MyStruct<T,U> { ... }
   impl<T,U> Iterator<U> for MyStruct<T,U> { }
   ```
3. Create a newtype wrapper for `U`
   ```rust
   impl<T,U> Iterator<Wrapper<U>> for MyStruct<T,U> { }
   ```

Because associated types are not fully baked, which in the case of the
`Hash` trait makes adhering to this rule impossible, you can
temporarily disable this rule in your crate by using
`#![feature(old_orphan_check)]`. Note that the `old_orphan_check`
feature will be removed before 1.0 is released.
2015-01-02 04:06:09 -05:00
bors
1f887c8c57 auto merge of #20412 : nikomatsakis/rust/assoc-types, r=aturon
These changes fix various problems encountered getting japaric's `at-iter` branch to work. This branch converts the `Iterator` trait to use an associated type.
2015-01-02 08:11:19 +00:00
Alex Crichton
f2ccdfd891 std: Second pass stabilization for boxed
This commit performs a second pass over the `std::boxed` module, taking the
following actions:

* `boxed` is now stable
* `Box` is now stable
* `BoxAny` is removed in favor of a direct `impl Box<Any>`
* `Box::downcast` remains unstable while the name of the `downcast` family of
  methods is determined.

This is a breaking change due to the removal of the `BoxAny` trait (note that
the `downcast` method still exists), and existing consumers of `BoxAny` simply
need to remove the import in their modules.

[breaking-change]
2015-01-01 22:31:53 -08:00
Alex Crichton
e423fcf0e0 std: Enforce Unicode in fmt::Writer
This commit is an implementation of [RFC 526][rfc] which is a change to alter
the definition of the old `fmt::FormatWriter`. The new trait, renamed to
`Writer`, now only exposes one method `write_str` in order to guarantee that all
implementations of the formatting traits can only produce valid Unicode.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md

One of the primary improvements of this patch is the performance of the
`.to_string()` method by avoiding an almost-always redundant UTF-8 check. This
is a breaking change due to the renaming of the trait as well as the loss of the
`write` method, but migration paths should be relatively easy:

* All usage of `write` should move to `write_str`. If truly binary data was
  being written in an implementation of `Show`, then it will need to use a
  different trait or an altogether different code path.

* All usage of `write!` should continue to work as-is with no modifications.

* All usage of `Show` where implementations just delegate to another should
  continue to work as-is.

[breaking-change]

Closes #20352
2015-01-01 22:04:46 -08:00
Alex Crichton
f3a7ec7028 std: Second pass stabilization of sync
This pass performs a second pass of stabilization through the `std::sync`
module, avoiding modules/types that are being handled in other PRs (e.g.
mutexes, rwlocks, condvars, and channels).

The following items are now stable

* `sync::atomic`
* `sync::atomic::ATOMIC_BOOL_INIT` (was `INIT_ATOMIC_BOOL`)
* `sync::atomic::ATOMIC_INT_INIT` (was `INIT_ATOMIC_INT`)
* `sync::atomic::ATOMIC_UINT_INIT` (was `INIT_ATOMIC_UINT`)
* `sync::Once`
* `sync::ONCE_INIT`
* `sync::Once::call_once` (was `doit`)
  * C == `pthread_once(..)`
  * Boost == `call_once(..)`
  * Windows == `InitOnceExecuteOnce`
* `sync::Barrier`
* `sync::Barrier::new`
* `sync::Barrier::wait` (now returns a `bool`)
* `sync::Semaphore::new`
* `sync::Semaphore::acquire`
* `sync::Semaphore::release`

The following items remain unstable

* `sync::SemaphoreGuard`
* `sync::Semaphore::access` - it's unclear how this relates to the poisoning
                              story of mutexes.
* `sync::TaskPool` - the semantics of a failing task and whether a thread is
                     re-attached to a thread pool are somewhat unclear, and the
                     utility of this type in `sync` is question with respect to
                     the jobs of other primitives. This type will likely become
                     stable or move out of the standard library over time.
* `sync::Future` - futures as-is have yet to be deeply re-evaluated with the
                   recent core changes to Rust's synchronization story, and will
                   likely become stable in the future but are unstable until
                   that time comes.

[breaking-change]
2015-01-01 22:02:59 -08:00
bors
ee3c5957ea auto merge of #20189 : cmr/rust/i32-fallback, r=nikomatsakis
Doesn't yet converge on a fixed point, but generally works. A better algorithm
will come with the implementation of default type parameter fallback.

If inference fails to determine an exact integral or floating point type, it
will set the type to i32 or f64, respectively.

Closes #16968
2015-01-02 04:46:53 +00:00
bors
cd614164e6 auto merge of #20387 : nick29581/rust/arrays-2, r=alexcrichton
Closes #19999
2015-01-02 02:31:12 +00:00
Niko Matsakis
345e38cc05 Replace the TODO with a FIXME. 2015-01-01 20:00:03 -05:00
Niko Matsakis
1e3214ba33 Normalize the associated types in closure and closure upvar types. 2015-01-01 18:48:26 -05:00
Niko Matsakis
78f848cde5 Refactor the Typer interface to separate out UnboxedClosureTyper methods, which are
the only things that trait selection needs.
2015-01-01 18:48:26 -05:00
Niko Matsakis
7092af7ee3 Normalize predicates found on the impl 2015-01-01 18:48:26 -05:00
Brian Anderson
d53914961c mk: Put the version number somewhere discoverable in the installer
The binaries for some release channels to not contain the version number,
which makes it hard for scripts to determine the version number.
2015-01-01 15:08:03 -08:00
Corey Richardson
53ece71585 Implement numeric fallback
Doesn't yet converge on a fixed point, but generally works. A better algorithm
will come with the implementation of default type parameter fallback.

If inference fails to determine an exact integral or floating point type, it
will set the type to i32 or f64, respectively.

Closes #16968
2015-01-01 17:12:15 -05:00
Niko Matsakis
77723d24a8 Implement an iterator for walking types rather than the old callback code. 2015-01-01 16:47:55 -05:00
Nick Cameron
2c92ddeda7 More fallout 2015-01-02 10:28:19 +13:00
Nick Cameron
13392d19ca Add tests 2015-01-02 10:28:19 +13:00
Nick Cameron
7e2b9ea235 Fallout - change array syntax to use ; 2015-01-02 10:28:19 +13:00
Nick Cameron
57a74eda88 Accept ranges with only a maximum value: ..expr 2015-01-02 10:28:19 +13:00
Nick Cameron
d45b5d2ed9 Disallow [_, ..n] syntax for fixed length arrays and repeating array constructors
Closes #19999

[breaking-change]

Use [_; n] instead.
2015-01-02 10:28:19 +13:00
Michael Woerister
7a11b9aac4 debuginfo: Fix an ICE related to local variables in unreachable code. 2015-01-01 18:43:48 +01:00
Jorge Aparicio
182db6e7f8 Add tests for assoc type issues that have been fixed
Closes #17732
Closes #18819
Closes #19479
Closes #19631
Closes #19632
Closes #19850
Closes #19883
Closes #20005
Closes #20009
Closes #20389
2015-01-01 11:51:45 -05:00