Commit Graph

36709 Commits

Author SHA1 Message Date
Jorge Aparicio
97f870a1fc unignore and fix doctests in guide and reference 2015-01-05 17:22:18 -05:00
Jorge Aparicio
a55011e788 fix tests 2015-01-05 17:22:18 -05:00
Jorge Aparicio
ec11f66dbf replace f.call_mut(a, b, ..) with f(a, b, ..) 2015-01-05 17:22:18 -05:00
Niko Matsakis
c98814b124 Correctly "detuple" arguments when creating trait object shims for a trait method with rust-call ABI. 2015-01-05 17:22:18 -05:00
Niko Matsakis
f97b124a44 Fix ICE caused by forgotten bcx 2015-01-05 17:22:18 -05:00
Jorge Aparicio
79af277623 address Niko's comments 2015-01-05 17:22:17 -05:00
Jorge Aparicio
ab0c7af376 ignore boxed closure doctests in the guide/reference 2015-01-05 17:22:17 -05:00
Jorge Aparicio
a9ea4d0127 fix benchmarks 2015-01-05 17:22:17 -05:00
Jorge Aparicio
ef726591f8 fix debuginfo tests 2015-01-05 17:22:17 -05:00
Jorge Aparicio
1bbeb37582 fix pretty tests 2015-01-05 17:22:17 -05:00
Jorge Aparicio
d6a948e8f4 fix run-make test 2015-01-05 17:22:17 -05:00
Jorge Aparicio
7d5b0454e9 fix cfail tests 2015-01-05 17:22:17 -05:00
Jorge Aparicio
ca17d08126 fix rpass tests 2015-01-05 17:22:16 -05:00
Jorge Aparicio
8d0d7521d6 typeck: remove dead code 2015-01-05 17:22:16 -05:00
Jorge Aparicio
643826150b trans: remove dead code 2015-01-05 17:22:16 -05:00
Jorge Aparicio
5d6a6f5957 rustc: remove dead code 2015-01-05 17:22:16 -05:00
Jorge Aparicio
799332fa3f syntax: remove dead code 2015-01-05 17:22:16 -05:00
Jorge Aparicio
f258ee7d96 typeck: there are only unboxed closures now 2015-01-05 17:22:16 -05:00
Jorge Aparicio
58b0d7479f syntax: make the closure type f: |uint| -> bool syntax obsolete 2015-01-05 17:22:16 -05:00
Jorge Aparicio
865aabb662 trans: remove Closure 2015-01-05 17:22:15 -05:00
Jorge Aparicio
8a6d7a68b1 remove mk_closure 2015-01-05 17:22:15 -05:00
Jorge Aparicio
4e9c50e081 remove AdjustAddEnv 2015-01-05 17:22:15 -05:00
Jorge Aparicio
714a5b7f5e remove TyClosure 2015-01-05 17:22:15 -05:00
Jorge Aparicio
5f7f2c9a05 remove ty_closure 2015-01-05 17:22:15 -05:00
Jorge Aparicio
18e2026ff8 coretest: remove/ignore tests 2015-01-05 17:22:15 -05:00
Jorge Aparicio
37448506ea compiletest: remove boxed closures 2015-01-05 17:22:14 -05:00
Jorge Aparicio
b4ccc90166 driver: remove unboxed closures 2015-01-05 17:22:14 -05:00
Jorge Aparicio
bf52e262e2 trans: remove remaining boxed closures 2015-01-05 17:22:14 -05:00
Jorge Aparicio
977e151b9a typeck: remove remaining boxed closures 2015-01-05 17:22:14 -05:00
Jorge Aparicio
8570f0acc7 rustc: remove remaining boxed closures 2015-01-05 17:22:13 -05:00
Jorge Aparicio
0cb34a3609 EncodeInlinedItem: convert to "unboxed" closures 2015-01-05 17:22:13 -05:00
Jorge Aparicio
bd9eef7ac6 DecodeInlinedItem: convert to "unboxed" closures 2015-01-05 17:22:13 -05:00
Jorge Aparicio
98fda878d8 conv_did: convert to "unboxed" closure 2015-01-05 17:22:12 -05:00
Jorge Aparicio
07a8e7cfb5 syntax: remove remaining boxed closures 2015-01-05 17:22:12 -05:00
Jorge Aparicio
37f62ae1c0 std: remove remaining boxed closures 2015-01-05 17:22:12 -05:00
Jorge Aparicio
a291a80fbe register snapshot 2015-01-05 17:22:11 -05:00
Niko Matsakis
6e68fd09ed Implement new orphan rule that requires that impls of remote traits meet the following two criteria:
- the self type includes some local type; and,
- type parameters in the self type must be constrained by a local type.

A type parameter is called *constrained* if it appears in some type-parameter of a local type.

Here are some examples that are accepted. In all of these examples, I
assume that `Foo` is a trait defined in another crate. If `Foo` were
defined in the local crate, then all the examples would be legal.

- `impl Foo for LocalType`
- `impl<T> Foo<T> for LocalType` -- T does not appear in Self, so it is OK
- `impl<T> Foo<T> for LocalType<T>` -- T here is constrained by LocalType
- `impl<T> Foo<T> for (LocalType<T>, T)` -- T here is constrained by LocalType

Here are some illegal examples (again, these examples assume that
`Foo` is not local to the current crate):

- `impl Foo for int` -- the Self type is not local
- `impl<T> Foo for T` -- T appears in Self unconstrained by a local type
- `impl<T> Foo for (LocalType, T)` -- T appears in Self unconstrained by a local type

This is a [breaking-change]. For the time being, you can opt out of
the new rules by placing `#[old_orphan_check]` on the trait (and
enabling the feature gate where the trait is defined). Longer term,
you should restructure your traits to avoid the problem. Usually this
means changing the order of parameters so that the "central" type
parameter is in the `Self` position.

As an example of that refactoring, consider the `BorrowFrom` trait:

```rust
pub trait BorrowFrom<Sized? Owned> for Sized? {
    fn borrow_from(owned: &Owned) -> &Self;
}
```

As defined, this trait is commonly implemented for custom pointer
types, such as `Arc`. Those impls follow the pattern:

```rust
impl<T> BorrowFrom<Arc<T>> for T {...}
```

Unfortunately, this impl is illegal because the self type `T` is not
local to the current crate. Therefore, we are going to change the order of the parameters,
so that `BorrowFrom` becomes `Borrow`:

```rust
pub trait Borrow<Sized? Borrowed> for Sized? {
    fn borrow_from(owned: &Self) -> &Borrowed;
}
```

Now the `Arc` impl is written:

```rust
impl<T> Borrow<T> for Arc<T> { ... }
```

This impl is legal because the self type (`Arc<T>`) is local.
2015-01-05 17:17:26 -05:00
Aaron Turon
cb765ce7e1 Stabilize collection modules
The earlier collections stabilization did not cover the modules
themselves. This commit marks as stable those modules whose types have
been stabilized.
2015-01-05 14:08:22 -08:00
Aaron Turon
121f6c6673 Final alpha stabilization of std::slice
Marks as `#[stable]`:

* Various iterator structs for stable methods, e.g. `Chunks` and
  `Windows`.
* The `SliceExt` trait itself.
2015-01-05 14:08:21 -08:00
Aaron Turon
e921afddd8 Stabilize core::ops
This commit marks as stable those parts of `core::ops` that are in their
final planned form: `Drop`, all of the mathematical operators (`Add`,
`Sub`, etc), `Deref`/`DerefMut`. It leaves the `Index*`, `Slice*` and
`Fn*` traits unstable, as they are still undergoing active changes.
2015-01-05 14:01:05 -08:00
Aaron Turon
64ec47c9d2 Final alpha stabilization of core::iter
This commit wraps up the adjustments to the iterator for recent language
changes.

* Moves `rposition` from `ExactSizeIterator` to `IteratorExt` using a
  `where` clause, thereby removing the `ExactSizeIterator:
  DoubleEndedIterator` constraint.

* Merges `MutableDoubleEndedIterator` into `IteratorExt`, renaming
  `reverse_` to `reverse_in_place`.

* Merges `IteratorOrdExt`, `IteratorCloneExt` and `CloneIteratorExt`
  into `IteratorExt` using `where` clauses.

Marks as `#[stable]`:

* the `iter` module itself
* `FromIterator`, `Extend`
* `Iterator`, `IteratorExt`
* `map`
* `filter`
* `filter_map`
* `skip_while`
* `take_while`
* `scan`
* `flat_map`
* `inspect`
* `collect`
* `fold`
* `all`
* `any`
* `find`
* `rposition`
* `max`, `min`
* Various adapter types related to the above methods

Because of the trait merging, this is a:

[breaking-change]
2015-01-05 14:01:05 -08:00
FakeKane
f7f5d0958b removing whitespace 2015-01-05 16:46:46 -05:00
FakeKane
8733b8b19c examples added for element access 2015-01-05 16:22:03 -05:00
Kelvin Ly
d33857208f Fixed tests 2015-01-05 15:28:19 -05:00
Jorge Aparicio
cd4205a970 tweak the obsolete syntax message 2015-01-05 15:19:38 -05:00
bors
f11f3e7bae auto merge of #20572 : nikomatsakis/rust/assoc-supertrait-stuff, r=brson
The first few commits in the PR are just general refactoring. I was intending them for some other code I didn't get around to writing yet, but might as well land them now. 

cc @japaric

Fixes #19541
2015-01-05 20:02:14 +00:00
Keegan McAllister
677b7cad3d Reformat metadata for exported macros
Instead of copy-pasting the whole macro_rules! item from the original .rs file,
we serialize a separate name, attributes list, and body, the latter as
pretty-printed TTs.  The compilation of macro_rules! macros is decoupled
somewhat from the expansion of macros in item position.

This filters out comments, and facilitates selective imports.
2015-01-05 12:00:57 -08:00
Keegan McAllister
24aa7f0e38 creader: Use a single struct 2015-01-05 12:00:57 -08:00
Keegan McAllister
5171b325bd creader: Convert free functions to Env methods 2015-01-05 12:00:57 -08:00
Keegan McAllister
5bf385be6a Rename macro_escape to macro_use
In the future we want to support

    #[macro_use(foo, bar)]
    mod macros;

but it's not an essential part of macro reform.  Reserve the syntax for now.
2015-01-05 12:00:57 -08:00