]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoauto merge of #20154 : P1start/rust/qualified-assoc-type-generics, r=nikomatsakis
bors [Sat, 3 Jan 2015 03:25:21 +0000 (03:25 +0000)]
auto merge of #20154 : P1start/rust/qualified-assoc-type-generics, r=nikomatsakis

This modifies `Parser::eat_lt` to always split up `<<`s, instead of doing so only when a lifetime name followed or the `force` parameter (now removed) was `true`. This is because `Foo<<TYPE` is now a valid start to a type, whereas previously only `Foo<<LIFETIME` was valid.

This is a [breaking-change]. Change code that looks like this:

```rust
let x = foo as bar << 13;
```

to use parentheses, like this:

```rust
let x = (foo as bar) << 13;
```

Closes #17362.

9 years agoauto merge of #19835 : pythonesque/rust/add-unordered-intrinsic, r=thestinger
bors [Sat, 3 Jan 2015 01:10:40 +0000 (01:10 +0000)]
auto merge of #19835 : pythonesque/rust/add-unordered-intrinsic, r=thestinger

This corresponds to the JMM memory model's non-volatile reads and writes to shared variables.  It provides fairly weak guarantees, but prevents UB (specifically, you will never see a value that was not written _at some point_ to the provided location).  It is not part of the C++ memory model and is only legal to provide to LLVM for loads and stores (not fences, atomicrmw, etc.).

Valid uses of this ordering are things like racy counters where you don't care about the operation actually being atomic, just want to avoid UB.  It cannot be used for synchronization without additional memory barriers since unordered loads and stores may be reordered freely by the optimizer (this is the main way it differs from relaxed).

Because it is new to Rust and it provides so few guarantees, for now only the intrinsic is provided--this patch doesn't add it to any of the higher-level atomic wrappers.

9 years agoauto merge of #20436 : alexcrichton/rust/rollup, r=alexcrichton
bors [Fri, 2 Jan 2015 21:56:13 +0000 (21:56 +0000)]
auto merge of #20436 : alexcrichton/rust/rollup, r=alexcrichton

9 years agorollup merge of #20410: japaric/assoc-types
Alex Crichton [Fri, 2 Jan 2015 20:16:41 +0000 (12:16 -0800)]
rollup merge of #20410: japaric/assoc-types

Conflicts:
src/liballoc/lib.rs
src/libcollections/lib.rs
src/libcollections/slice.rs
src/libcore/ops.rs
src/libcore/prelude.rs
src/libcore/ptr.rs
src/librustc/middle/traits/project.rs
src/libstd/c_str.rs
src/libstd/io/mem.rs
src/libstd/io/mod.rs
src/libstd/lib.rs
src/libstd/path/posix.rs
src/libstd/path/windows.rs
src/libstd/prelude.rs
src/libstd/rt/exclusive.rs
src/libsyntax/lib.rs
src/test/compile-fail/issue-18566.rs
src/test/run-pass/deref-mut-on-ref.rs
src/test/run-pass/deref-on-ref.rs
src/test/run-pass/dst-deref-mut.rs
src/test/run-pass/dst-deref.rs
src/test/run-pass/fixup-deref-mut.rs
src/test/run-pass/issue-13264.rs
src/test/run-pass/overloaded-autoderef-indexing.rs

9 years agoRebase test fixes v2
Alex Crichton [Fri, 2 Jan 2015 20:05:24 +0000 (12:05 -0800)]
Rebase test fixes v2

9 years agofix rpass test with s/Output/Target/g
Jorge Aparicio [Fri, 2 Jan 2015 19:23:46 +0000 (14:23 -0500)]
fix rpass test with s/Output/Target/g

9 years agoHandle recursive obligations without exiting the inference probe
Niko Matsakis [Fri, 2 Jan 2015 18:59:32 +0000 (13:59 -0500)]
Handle recursive obligations without exiting the inference probe

Conflicts:
src/librustc/middle/traits/select.rs

9 years agoTemporarily do not evaluate subobligations.
Niko Matsakis [Fri, 2 Jan 2015 18:22:45 +0000 (13:22 -0500)]
Temporarily do not evaluate subobligations.

9 years agoEvaluate projection predicates during trait selection. Fixes #20296.
Niko Matsakis [Fri, 2 Jan 2015 16:39:47 +0000 (11:39 -0500)]
Evaluate projection predicates during trait selection. Fixes #20296.

9 years agorollup merge of #20341: nikomatsakis/impl-trait-for-trait-2
Alex Crichton [Fri, 2 Jan 2015 18:58:10 +0000 (10:58 -0800)]
rollup merge of #20341: nikomatsakis/impl-trait-for-trait-2

Conflicts:
src/librustc/middle/traits/mod.rs
src/libstd/io/mod.rs
src/test/run-pass/builtin-superkinds-self-type.rs

9 years agoRollup test fixes and rebase conflicts
Alex Crichton [Fri, 2 Jan 2015 17:24:56 +0000 (09:24 -0800)]
Rollup test fixes and rebase conflicts

9 years agoMerge remote-tracking branch 'origin/master' into rollup
Alex Crichton [Fri, 2 Jan 2015 18:50:07 +0000 (10:50 -0800)]
Merge remote-tracking branch 'origin/master' into rollup

Conflicts:
src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs

9 years agorollup merge of #20425: sanxiyn/opt-local-ty
Alex Crichton [Fri, 2 Jan 2015 17:23:47 +0000 (09:23 -0800)]
rollup merge of #20425: sanxiyn/opt-local-ty

This avoids having ast::Ty nodes which have no counterpart in the source.

9 years agorollup merge of #20416: nikomatsakis/coherence
Alex Crichton [Fri, 2 Jan 2015 17:23:42 +0000 (09:23 -0800)]
rollup merge of #20416: nikomatsakis/coherence

Conflicts:
src/test/run-pass/issue-15734.rs
src/test/run-pass/issue-3743.rs

9 years agorollup merge of #20407: michaelwoerister/unreachable-locals
Alex Crichton [Fri, 2 Jan 2015 17:22:50 +0000 (09:22 -0800)]
rollup merge of #20407: michaelwoerister/unreachable-locals

Fixes #20312

9 years agorollup merge of #20404: japaric/at-tests
Alex Crichton [Fri, 2 Jan 2015 17:22:47 +0000 (09:22 -0800)]
rollup merge of #20404: japaric/at-tests

Closes #17732
Closes #18819
Closes #19479
Closes #19631
Closes #19632
Closes #19850
Closes #19883
Closes #20005
Closes #20009
Closes #20389

---

cc @nikomatsakis @sfackler

9 years agorollup merge of #20392: daramos/travis
Alex Crichton [Fri, 2 Jan 2015 17:22:44 +0000 (09:22 -0800)]
rollup merge of #20392: daramos/travis

Travis recently launched their new infrastructure on Amazon EC2 with improved resources. The only limitation is that they don't support sudo. http://blog.travis-ci.com/2014-12-17-faster-builds-with-container-based-infrastructure/
I couldn't find anywhere where the build system uses sudo so I don't think that limitation affects rust builds.
This change drops the current `make tidy` times [slightly](https://travis-ci.org/daramos/rust/builds)(travis-test branch).

9 years agorollup merge of #20391: daramos/utf8_lossy
Alex Crichton [Fri, 2 Jan 2015 17:22:42 +0000 (09:22 -0800)]
rollup merge of #20391: daramos/utf8_lossy

Prior to 9bae6ec828fdc7f87838ee008cccef90e31b9f84 from_utf8_lossy had a minor optimization in place that avoided having to loop from the beginning of the input slice.
Recently 4908017d59da8694b9ceaf743baf1163c1e19086 implemented Utf8Error::InvalidByte which makes this possible again.

9 years agorollup merge of #20388: brson/install-tweaks
Alex Crichton [Fri, 2 Jan 2015 17:22:40 +0000 (09:22 -0800)]
rollup merge of #20388: brson/install-tweaks

r? @alexcrichton

9 years agorollup merge of #20386: frewsxcv/rm-reexports
Alex Crichton [Fri, 2 Jan 2015 17:22:37 +0000 (09:22 -0800)]
rollup merge of #20386: frewsxcv/rm-reexports

Part of #19253

[breaking-change]

9 years agorollup merge of #20385: nick29581/x-object
Alex Crichton [Fri, 2 Jan 2015 17:22:35 +0000 (09:22 -0800)]
rollup merge of #20385: nick29581/x-object

Closes #19056

9 years agorollup merge of #20380: dcrewi/fix-make-install
Alex Crichton [Fri, 2 Jan 2015 17:22:22 +0000 (09:22 -0800)]
rollup merge of #20380: dcrewi/fix-make-install

There seems to be a problem introduced by
8b3c67690c4747b9fadfef407e6261524fb03f8a that causes "make install"
to fail when the build is not configured to skip doc building.

9 years agorollup merge of #20334: nagisa/ffi-llvm
Alex Crichton [Fri, 2 Jan 2015 17:22:18 +0000 (09:22 -0800)]
rollup merge of #20334: nagisa/ffi-llvm

Fixes #20313

r? @huonw

9 years agorollup merge of #20227: FlashYoshi/patch-1
Alex Crichton [Fri, 2 Jan 2015 17:22:15 +0000 (09:22 -0800)]
rollup merge of #20227: FlashYoshi/patch-1

9 years agorollup merge of #19625: mrhota/guide_traits
Alex Crichton [Fri, 2 Jan 2015 17:22:10 +0000 (09:22 -0800)]
rollup merge of #19625: mrhota/guide_traits

Nothing major. Clarification, copy-editing, typographical and grammatical consistency

9 years agoDo not ICE when projecting out of a value with type `ty::ty_err`
Niko Matsakis [Fri, 2 Jan 2015 09:20:34 +0000 (04:20 -0500)]
Do not ICE when projecting out of a value with type `ty::ty_err`

9 years agocore: use assoc types in `Deref[Mut]`
Jorge Aparicio [Thu, 1 Jan 2015 19:53:20 +0000 (14:53 -0500)]
core: use assoc types in `Deref[Mut]`

9 years agorollup merge of #20354: alexcrichton/second-pass-thread_local
Alex Crichton [Fri, 2 Jan 2015 17:19:45 +0000 (09:19 -0800)]
rollup merge of #20354: alexcrichton/second-pass-thread_local

Conflicts:
src/libstd/sys/common/thread_info.rs

9 years agorollup merge of #20315: alexcrichton/std-sync
Alex Crichton [Fri, 2 Jan 2015 17:19:00 +0000 (09:19 -0800)]
rollup merge of #20315: alexcrichton/std-sync

Conflicts:
src/libstd/rt/exclusive.rs
src/libstd/sync/barrier.rs
src/libstd/sys/unix/pipe.rs
src/test/bench/shootout-binarytrees.rs
src/test/bench/shootout-fannkuch-redux.rs

9 years agorollup merge of #20420: alexcrichton/second-pass-boxed
Alex Crichton [Fri, 2 Jan 2015 17:17:08 +0000 (09:17 -0800)]
rollup merge of #20420: alexcrichton/second-pass-boxed

9 years agorollup merge of #20382: alexcrichton/isuse-20376
Alex Crichton [Fri, 2 Jan 2015 17:16:47 +0000 (09:16 -0800)]
rollup merge of #20382: alexcrichton/isuse-20376

9 years agorollup merge of #20377: alexcrichton/issue-20352
Alex Crichton [Fri, 2 Jan 2015 17:16:26 +0000 (09:16 -0800)]
rollup merge of #20377: alexcrichton/issue-20352

9 years agorollup merge of #20273: alexcrichton/second-pass-comm
Alex Crichton [Fri, 2 Jan 2015 17:15:54 +0000 (09:15 -0800)]
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

9 years agoAddress nits.
Niko Matsakis [Fri, 2 Jan 2015 10:34:49 +0000 (05:34 -0500)]
Address nits.

9 years agoTest that we can call unboxed closures with the sugar now. Fixes #16929.
Niko Matsakis [Sun, 28 Dec 2014 21:45:56 +0000 (16:45 -0500)]
Test that we can call unboxed closures with the sugar now. Fixes #16929.

9 years agoEnsure that, for every trait `Foo`, the predicate `Foo : Foo` holds.
Niko Matsakis [Tue, 23 Dec 2014 10:26:34 +0000 (05:26 -0500)]
Ensure that, for every trait `Foo`, the predicate `Foo : Foo` holds.

9 years agoRefactor object-safety into its own (cached) module so that we can
Niko Matsakis [Tue, 16 Dec 2014 02:11:09 +0000 (21:11 -0500)]
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`.

9 years agoMove the `upcast` routine into traits and use it for method selection; also
Niko Matsakis [Sat, 20 Dec 2014 14:15:52 +0000 (09:15 -0500)]
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`).

9 years agoDo not automatically make `Self` `Sized` in traits.
Niko Matsakis [Thu, 18 Dec 2014 20:28:00 +0000 (15:28 -0500)]
Do not automatically make `Self` `Sized` in traits.

9 years agoFix fallout in tests.
Niko Matsakis [Fri, 19 Dec 2014 11:54:09 +0000 (06:54 -0500)]
Fix fallout in tests.

9 years agorustdoc: fix rendering of associated types
Corey Richardson [Fri, 2 Jan 2015 13:26:55 +0000 (08:26 -0500)]
rustdoc: fix rendering of associated types

9 years agomerge `*SliceExt` traits, use assoc types in `SliceExt`, `Raw[Mut]Ptr`
Jorge Aparicio [Fri, 2 Jan 2015 14:12:27 +0000 (09:12 -0500)]
merge `*SliceExt` traits, use assoc types in `SliceExt`, `Raw[Mut]Ptr`

9 years agoFix fallout from change, adding explicit `Sized` annotations where necessary.
Niko Matsakis [Thu, 18 Dec 2014 20:27:41 +0000 (15:27 -0500)]
Fix fallout from change, adding explicit `Sized` annotations where necessary.

9 years agoRegister new snapshots
Alex Crichton [Thu, 1 Jan 2015 20:16:49 +0000 (12:16 -0800)]
Register new snapshots

9 years agorollup merge of #20157: alexcrichton/issue-20068
Alex Crichton [Fri, 2 Jan 2015 16:54:58 +0000 (08:54 -0800)]
rollup merge of #20157: alexcrichton/issue-20068

9 years agoProperly deal with Ordering in the guide
Steve Klabnik [Tue, 23 Dec 2014 18:31:43 +0000 (13:31 -0500)]
Properly deal with Ordering in the guide

Now that it's been removed from the prelude, we need to treat things differently.

Fixes #17967

9 years agostd: Stabilize the prelude module
Alex Crichton [Mon, 22 Dec 2014 17:04:23 +0000 (09:04 -0800)]
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

9 years agoauto merge of #20365 : nick29581/rust/mod, r=huonw
bors [Fri, 2 Jan 2015 16:31:26 +0000 (16:31 +0000)]
auto merge of #20365 : nick29581/rust/mod, r=huonw

Part of #20361 and #20362

9 years agoauto merge of #20356 : Gankro/rust/stab, r=aturon
bors [Fri, 2 Jan 2015 15:51:25 +0000 (15:51 +0000)]
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]

9 years agoAdd a pretty-print test
Seo Sanghyeon [Fri, 2 Jan 2015 13:28:53 +0000 (22:28 +0900)]
Add a pretty-print test

9 years agoMake type in ast::Local optional
Seo Sanghyeon [Fri, 2 Jan 2015 11:55:31 +0000 (20:55 +0900)]
Make type in ast::Local optional

9 years agoRebasing
Nick Cameron [Fri, 2 Jan 2015 10:20:46 +0000 (23:20 +1300)]
Rebasing

9 years agoUse `derive` rather than `deriving` in tests
Nick Cameron [Wed, 31 Dec 2014 04:32:49 +0000 (17:32 +1300)]
Use `derive` rather than `deriving` in tests

9 years agoAccept `derive` instead of `deriving`
Nick Cameron [Wed, 31 Dec 2014 04:25:18 +0000 (17:25 +1300)]
Accept `derive` instead of `deriving`

[breaking-change]

`deriving is still accepted, but gives a deprecation warning

9 years agoChange tests to use `self` instead of `mod` in use items
Nick Cameron [Wed, 31 Dec 2014 04:29:22 +0000 (17:29 +1300)]
Change tests to use `self` instead of `mod` in use items

9 years agoAccept `self` in place of `mod` in use items
Nick Cameron [Wed, 31 Dec 2014 04:24:42 +0000 (17:24 +1300)]
Accept `self` in place of `mod` in use items

[breaking-change]

`mod` is still accepted, but gives a deprecated warning

9 years agoFix an infinite loop in the stability check that was the result of
Niko Matsakis [Fri, 2 Jan 2015 02:41:44 +0000 (21:41 -0500)]
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.

9 years agoNew coherence tests covering patterns we want to work (and not work).
Niko Matsakis [Thu, 1 Jan 2015 21:45:59 +0000 (16:45 -0500)]
New coherence tests covering patterns we want to work (and not work).

9 years agoDisable the JSON doctests because they don't pass the new coherence
Niko Matsakis [Thu, 1 Jan 2015 21:45:22 +0000 (16:45 -0500)]
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.

9 years agoFix orphan checking (cc #19470). (This is not a complete fix of #19470 because of...
Niko Matsakis [Fri, 26 Dec 2014 08:30:51 +0000 (03:30 -0500)]
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.

9 years agoauto merge of #20412 : nikomatsakis/rust/assoc-types, r=aturon
bors [Fri, 2 Jan 2015 08:11:19 +0000 (08:11 +0000)]
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.

9 years agostd: Second pass stabilization for `boxed`
Alex Crichton [Fri, 2 Jan 2015 06:24:06 +0000 (22:24 -0800)]
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]

9 years agostd: Enforce Unicode in fmt::Writer
Alex Crichton [Fri, 12 Dec 2014 18:59:41 +0000 (10:59 -0800)]
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

9 years agostd: Second pass stabilization of sync
Alex Crichton [Mon, 29 Dec 2014 23:03:01 +0000 (15:03 -0800)]
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]

9 years agoauto merge of #20189 : cmr/rust/i32-fallback, r=nikomatsakis
bors [Fri, 2 Jan 2015 04:46:53 +0000 (04:46 +0000)]
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

9 years agoauto merge of #20387 : nick29581/rust/arrays-2, r=alexcrichton
bors [Fri, 2 Jan 2015 02:31:12 +0000 (02:31 +0000)]
auto merge of #20387 : nick29581/rust/arrays-2, r=alexcrichton

Closes #19999

9 years agoReplace the TODO with a FIXME.
Niko Matsakis [Fri, 2 Jan 2015 01:00:03 +0000 (20:00 -0500)]
Replace the TODO with a FIXME.

9 years agoNormalize the associated types in closure and closure upvar types.
Niko Matsakis [Thu, 1 Jan 2015 22:58:57 +0000 (17:58 -0500)]
Normalize the associated types in closure and closure upvar types.

9 years agoRefactor the Typer interface to separate out UnboxedClosureTyper methods, which are
Niko Matsakis [Thu, 1 Jan 2015 21:04:51 +0000 (16:04 -0500)]
Refactor the Typer interface to separate out UnboxedClosureTyper methods, which are
the only things that trait selection needs.

9 years agoNormalize predicates found on the impl
Niko Matsakis [Thu, 1 Jan 2015 18:15:14 +0000 (13:15 -0500)]
Normalize predicates found on the impl

9 years agomk: Put the version number somewhere discoverable in the installer
Brian Anderson [Thu, 1 Jan 2015 05:01:02 +0000 (21:01 -0800)]
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.

9 years agoImplement numeric fallback
Corey Richardson [Mon, 15 Dec 2014 14:45:28 +0000 (09:45 -0500)]
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

9 years agoImplement an iterator for walking types rather than the old callback code.
Niko Matsakis [Fri, 26 Dec 2014 08:20:01 +0000 (03:20 -0500)]
Implement an iterator for walking types rather than the old callback code.

9 years agoMore fallout
Nick Cameron [Thu, 1 Jan 2015 04:40:24 +0000 (17:40 +1300)]
More fallout

9 years agoAdd tests
Nick Cameron [Tue, 30 Dec 2014 09:24:05 +0000 (22:24 +1300)]
Add tests

9 years agoFallout - change array syntax to use `;`
Nick Cameron [Tue, 30 Dec 2014 08:19:41 +0000 (21:19 +1300)]
Fallout - change array syntax to use `;`

9 years agoAccept ranges with only a maximum value: `..expr`
Nick Cameron [Tue, 30 Dec 2014 07:07:25 +0000 (20:07 +1300)]
Accept ranges with only a maximum value: `..expr`

9 years agoDisallow [_, ..n] syntax for fixed length arrays and repeating array constructors
Nick Cameron [Tue, 30 Dec 2014 06:55:06 +0000 (19:55 +1300)]
Disallow [_, ..n] syntax for fixed length arrays and repeating array constructors

Closes #19999

[breaking-change]

Use [_; n] instead.

9 years agodebuginfo: Fix an ICE related to local variables in unreachable code.
Michael Woerister [Thu, 1 Jan 2015 17:43:48 +0000 (18:43 +0100)]
debuginfo: Fix an ICE related to local variables in unreachable code.

9 years agoAdd tests for assoc type issues that have been fixed
Jorge Aparicio [Thu, 1 Jan 2015 16:16:44 +0000 (11:16 -0500)]
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

9 years agoauto merge of #20190 : cmr/rust/gate-macro-args, r=alexcrichton
bors [Thu, 1 Jan 2015 15:51:08 +0000 (15:51 +0000)]
auto merge of #20190 : cmr/rust/gate-macro-args, r=alexcrichton

Uses the same approach as https://github.com/rust-lang/rust/pull/17286 (and
subsequent changes making it more correct), where the visitor will skip any
pieces of the AST that are from "foreign code", where the spans don't line up,
indicating that that piece of code is due to a macro expansion.

If this breaks your code, read the error message to determine which feature
gate you should add to your crate.

Closes #18102

[breaking-change]

9 years agoFeature gate macro arguments
Corey Richardson [Wed, 24 Dec 2014 05:44:13 +0000 (00:44 -0500)]
Feature gate macro arguments

Uses the same approach as https://github.com/rust-lang/rust/pull/17286 (and
subsequent changes making it more correct), where the visitor will skip any
pieces of the AST that are from "foreign code", where the spans don't line up,
indicating that that piece of code is due to a macro expansion.

If this breaks your code, read the error message to determine which feature
gate you should add to your crate, and bask in the knowledge that your code
won't mysteriously break should you try to use the 1.0 release.

Closes #18102

[breaking-change]

9 years agoAllow travis to use newer-faster infrastructure for building. http://blog.travis...
dan@daramos.com [Thu, 1 Jan 2015 07:00:29 +0000 (02:00 -0500)]
Allow travis to use newer-faster infrastructure for building. http://blog.travis-ci.com/2014-12-17-faster-builds-with-container-based-infrastructure/

9 years agoauto merge of #19388 : nick29581/rust/rc-show, r=alexcrichto
bors [Thu, 1 Jan 2015 06:36:24 +0000 (06:36 +0000)]
auto merge of #19388 : nick29581/rust/rc-show, r=alexcrichto

r? @huonw or @alexcrichton

Apparently, we have previously rejected an RFC like this. However, since then we removed `{:?}` and so without this debugging gets really difficult as soon as there is a RefCell anywhere, so I believe there is more benefit to adding these impls than there was before. By using "try_borrow" we can avoid panicing in `Show` (I think).

@ huon in response to a comment in #19254: I noticed that `drop()` checks for the ptr being null, so I checked here too. Now I am checking for both, if you're confident I can change to only checking `strong()`.

9 years agoReimplement a minor optimization in String::from_utf8_lossy that avoids having to...
dan@daramos.com [Thu, 1 Jan 2015 06:22:43 +0000 (01:22 -0500)]
Reimplement a minor optimization in String::from_utf8_lossy that avoids having to loop the slice from the begining.

9 years agoReviewer change
Nick Cameron [Thu, 1 Jan 2015 05:00:32 +0000 (18:00 +1300)]
Reviewer change

9 years agomk: The doc directory is no longer included in the main package
Brian Anderson [Thu, 1 Jan 2015 04:57:48 +0000 (20:57 -0800)]
mk: The doc directory is no longer included in the main package

9 years agoAdd some impls of Show (RefCell, Weak, some resolve types)
Nick Cameron [Fri, 28 Nov 2014 02:41:16 +0000 (15:41 +1300)]
Add some impls of Show (RefCell, Weak, some resolve types)

9 years agoauto merge of #20363 : japaric/rust/moar-uc, r=nmatsakis
bors [Thu, 1 Jan 2015 04:01:02 +0000 (04:01 +0000)]
auto merge of #20363 : japaric/rust/moar-uc, r=nmatsakis

The the last argument of the `ItemDecorator::expand` method has changed to `Box<FnMut>`. Syntax extensions will break.

[breaking-change]

---

This PR removes pretty much all the remaining uses of boxed closures from the libraries. There are still boxed closures under the `test` directory, but I think those should be removed or replaced with unboxed closures at the same time we remove boxed closures from the language.

In a few places I had to do some contortions (see the first commit for an example) to work around issue #19596. I have marked those workarounds with FIXMEs. In the future when `&mut F where F: FnMut` implements the `FnMut` trait, we should be able to remove those workarounds. I've take care to avoid placing the workaround functions in the public API.

Since `let f = || {}` always gets type checked as a boxed closure, I have explictly annotated those closures (with e.g. `|&:| {}`) to force the compiler to type check them as unboxed closures.

Instead of removing the type aliases (like `GetCrateDataCb`), I could have replaced them with newtypes. But this seemed like overcomplicating things for little to no gain.

I think we should be able to remove the boxed closures from the languge after this PR lands. (I'm being optimistic here)

r? @alexcrichton or @aturon
cc @nikomatsakis

9 years agorustc_trans: replace `EnterPatterns` alias with an unboxed closure
Jorge Aparicio [Wed, 31 Dec 2014 03:51:00 +0000 (22:51 -0500)]
rustc_trans: replace `EnterPatterns` alias with an unboxed closure

9 years agorustc: replace `pick` alias with an unboxed closure
Jorge Aparicio [Wed, 31 Dec 2014 03:49:26 +0000 (22:49 -0500)]
rustc: replace `pick` alias with an unboxed closure

9 years agorustc: replace `GetCrateDataCb` alias with an unboxed closure
Jorge Aparicio [Wed, 31 Dec 2014 03:48:22 +0000 (22:48 -0500)]
rustc: replace `GetCrateDataCb` alias with an unboxed closure

9 years agotime: unbox closures used in let bindings
Jorge Aparicio [Wed, 31 Dec 2014 02:03:26 +0000 (21:03 -0500)]
time: unbox closures used in let bindings

9 years agosyntax: unbox closures used in let bindings
Jorge Aparicio [Wed, 31 Dec 2014 02:02:53 +0000 (21:02 -0500)]
syntax: unbox closures used in let bindings

9 years agostd: unbox closures used in let bindings
Jorge Aparicio [Wed, 31 Dec 2014 02:01:00 +0000 (21:01 -0500)]
std: unbox closures used in let bindings

9 years agorustdoc: unbox closures used in let bindings
Jorge Aparicio [Wed, 31 Dec 2014 01:59:47 +0000 (20:59 -0500)]
rustdoc: unbox closures used in let bindings

9 years agorustc_typeck: unbox closures used in let bindings
Jorge Aparicio [Wed, 31 Dec 2014 01:59:12 +0000 (20:59 -0500)]
rustc_typeck: unbox closures used in let bindings

9 years agorustc_trans: unbox closures used in let bindings
Jorge Aparicio [Wed, 31 Dec 2014 01:58:47 +0000 (20:58 -0500)]
rustc_trans: unbox closures used in let bindings

9 years agorustc_resolve: unbox closures used in let bindings
Jorge Aparicio [Wed, 31 Dec 2014 01:56:41 +0000 (20:56 -0500)]
rustc_resolve: unbox closures used in let bindings

9 years agorustc_driver: unbox closures used in let bindings
Jorge Aparicio [Wed, 31 Dec 2014 01:56:05 +0000 (20:56 -0500)]
rustc_driver: unbox closures used in let bindings