Commit Graph

129 Commits

Author SHA1 Message Date
Nick Cameron f7ff37e4c5 Replace full slice notation with index calls 2015-01-07 10:46:33 +13:00
Alex Crichton 4b359e3aee More test fixes! 2015-01-05 22:58:37 -08:00
Alex Crichton 7975fd9cee rollup merge of #20482: kmcallister/macro-reform
Conflicts:
	src/libflate/lib.rs
	src/libstd/lib.rs
	src/libstd/macros.rs
	src/libsyntax/feature_gate.rs
	src/libsyntax/parse/parser.rs
	src/libsyntax/show_span.rs
	src/test/auxiliary/macro_crate_test.rs
	src/test/compile-fail/lint-stability.rs
	src/test/run-pass/intrinsics-math.rs
	src/test/run-pass/tcp-connect-timeouts.rs
2015-01-05 19:01:17 -08:00
Alex Crichton 384e218789 Merge remote-tracking branch 'nrc/sized-2' into rollup
Conflicts:
	src/liballoc/boxed.rs
	src/libcollections/btree/map.rs
	src/libcollections/slice.rs
	src/libcore/borrow.rs
	src/libcore/cmp.rs
	src/libcore/ops.rs
	src/libstd/c_str.rs
	src/libstd/collections/hash/map.rs
	src/libsyntax/parse/obsolete.rs
	src/test/compile-fail/unboxed-closure-sugar-default.rs
	src/test/compile-fail/unboxed-closure-sugar-equiv.rs
	src/test/compile-fail/unboxed-closure-sugar-lifetime-elision.rs
	src/test/compile-fail/unboxed-closure-sugar-region.rs
	src/test/compile-fail/unsized3.rs
	src/test/run-pass/associated-types-conditional-dispatch.rs
2015-01-05 18:55:41 -08:00
Keegan McAllister c2e26972e3 Un-gate macro_rules 2015-01-05 18:21:14 -08:00
Keegan McAllister 416137eb31 Modernize macro_rules! invocations
macro_rules! is like an item that defines a macro.  Other items don't have a
trailing semicolon, or use a paren-delimited body.

If there's an argument for matching the invocation syntax, e.g. parentheses for
an expr macro, then I think that applies more strongly to the *inner*
delimiters on the LHS, wrapping the individual argument patterns.
2015-01-05 18:21:14 -08:00
Nick Cameron e0684e8769 Fallout 2015-01-06 14:20:48 +13:00
Jorge Aparicio 18e2026ff8 coretest: remove/ignore tests 2015-01-05 17:22:15 -05: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
Keegan McAllister fc58479323 Stop using macro_escape as an inner attribute
In preparation for the rename.
2015-01-05 12:00:57 -08:00
Alex Crichton 7d8d06f86b Remove deprecated functionality
This removes a large array of deprecated functionality, regardless of how
recently it was deprecated. The purpose of this commit is to clean out the
standard libraries and compiler for the upcoming alpha release.

Some notable compiler changes were to enable warnings for all now-deprecated
command line arguments (previously the deprecated versions were silently
accepted) as well as removing deriving(Zero) entirely (the trait was removed).

The distribution no longer contains the libtime or libregex_macros crates. Both
of these have been deprecated for some time and are available externally.
2015-01-03 23:43:57 -08:00
Jorge Aparicio 351409a622 sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rs 2015-01-03 22:54:18 -05:00
bors c6c786671d auto merge of #20490 : japaric/rust/assoc-types, r=aturon
closes #20486 
closes #20474 
closes #20441

[breaking-change]

The `Index[Mut]` traits now have one less input parameter, as the return type of the indexing operation is an associated type. This breaks all existing implementations.

---

binop traits (`Add`, `Sub`, etc) now have an associated type for their return type. Also, the RHS input parameter now defaults to `Self` (except for the `Shl` and `Shr` traits). For example, the `Add` trait now looks like this:

``` rust
trait Add<Rhs=Self> {
    type Output;

    fn add(self, Rhs) -> Self::Output;
}
```

The `Neg` and `Not` traits now also have an associated type for their return type.

This breaks all existing implementations of these traits.

---
Affected traits:

- `Iterator { type Item }`
- `IteratorExt` no input/output types, uses `<Self as Iterator>::Item` in its methods
- `DoubleEndedIterator` no input/output types, uses `<Self as Iterator>::Item` in its methods
- `DoubleEndedIteratorExt` no input/output types, uses `<Self as Iterator>::Item` in its methods
- `RandomAccessIterator` no input/output types
- `ExactSizeIterator` no input/output types, uses `<Self as Iterator>::Item` in its methods

This breaks all the implementations of these traits.
2015-01-04 00:50:59 +00:00
Jorge Aparicio 99017f82b6 use assoc types in binop traits 2015-01-03 16:29:19 -05:00
Akos Kiss 6e5fb8bd1b Initial version of AArch64 support.
Adds AArch64 knowledge to:
* configure,
* make files,
* sources,
* tests, and
* documentation.
2015-01-03 15:16:10 +00:00
Jorge Aparicio 91eeb641cd coretest: fix fallout 2015-01-03 09:34:05 -05:00
Alex Crichton 9ca8076cb7 rollup merge of #20386: frewsxcv/rm-reexports
Part of #19253

[breaking-change]
2015-01-02 09:22:37 -08:00
Alex Crichton 009ec5d2b0 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
2015-01-02 09:19:00 -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
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
Nick Cameron 7e2b9ea235 Fallout - change array syntax to use `;` 2015-01-02 10:28:19 +13:00
Corey Farwell f9ce6f5ba4 Remove core::iter::MinMaxResult::* public reexport
Part of #19253

[breaking-change]
2014-12-31 19:28:01 -08:00
Alex Crichton 582cba183f Test fixes and rebase conflicts 2014-12-31 08:33:13 -08:00
Aaron Turon 6abfac083f Fallout from stabilization 2014-12-30 17:06:08 -08:00
Nick Cameron 3bf405682d Fallout from mut slices 2014-12-30 13:06:25 +13:00
Nick Cameron ed8f503911 Add hypothetical support for ranges with only an upper bound
Note that this doesn't add the surface syntax.
2014-12-30 13:06:24 +13:00
Luqman Aden 0e039ada55 libcoretest: Add tests for NonZero. 2014-12-28 19:40:48 -05:00
Nick Cameron e82215d4e2 Review changes 2014-12-24 09:24:59 +13:00
Nick Cameron 21ea66f47a Add structs for ranges to core::ops. 2014-12-24 09:12:45 +13:00
Alex Crichton 082bfde412 Fallout of std::str stabilization 2014-12-21 23:31:42 -08:00
Aaron Turon a27fbac868 Revise std::thread API to join by default
This commit is part of a series that introduces a `std::thread` API to
replace `std::task`.

In the new API, `spawn` returns a `JoinGuard`, which by default will
join the spawned thread when dropped. It can also be used to join
explicitly at any time, returning the thread's result. Alternatively,
the spawned thread can be explicitly detached (so no join takes place).

As part of this change, Rust processes now terminate when the main
thread exits, even if other detached threads are still running, moving
Rust closer to standard threading models. This new behavior may break code
that was relying on the previously implicit join-all.

In addition to the above, the new thread API also offers some built-in
support for building blocking abstractions in user space; see the module
doc for details.

Closes #18000

[breaking-change]
2014-12-18 23:31:52 -08:00
Patrick Walton ddb2466f6a librustc: Always parse `macro!()`/`macro![]` as expressions if not
followed by a semicolon.

This allows code like `vec![1i, 2, 3].len();` to work.

This breaks code that uses macros as statements without putting
semicolons after them, such as:

    fn main() {
        ...
        assert!(a == b)
        assert!(c == d)
        println(...);
    }

It also breaks code that uses macros as items without semicolons:

    local_data_key!(foo)

    fn main() {
        println("hello world")
    }

Add semicolons to fix this code. Those two examples can be fixed as
follows:

    fn main() {
        ...
        assert!(a == b);
        assert!(c == d);
        println(...);
    }

    local_data_key!(foo);

    fn main() {
        println("hello world")
    }

RFC #378.

Closes #18635.

[breaking-change]
2014-12-18 12:09:07 -05:00
Alex Crichton 1b929090ac rollup merge of #19911: mdinger/tuple_tests2
Fixes some tuple indexing deprecation warnings. Didn't test. Don't see how it could fail unless I need to modify a makefile somewhere...

r? @alexcrichton
2014-12-17 11:50:30 -08:00
Alex Crichton 31e21613ee rollup merge of #19885: alexcrichton/char-escape
This changes the `escape_unicode` method on a `char` to use the new style of
unicode escapes in the language.

Closes #19811
Closes #19879
2014-12-17 11:50:28 -08:00
Alex Crichton df5404cfa8 std: Change escape_unicode to use new escapes
This changes the `escape_unicode` method on a `char` to use the new style of
unicode escapes in the language.

Closes #19811
Closes #19879
2014-12-16 08:09:37 -08:00
mdinger 3a073e3127 Tuple test no longer needed. Is already in run-pass tests 2014-12-16 02:42:25 -05:00
Steven Fackler 24a8ef63ff Move hash module from collections to core 2014-12-15 22:48:54 -08:00
bors 0669a432a2 auto merge of #19448 : japaric/rust/binops-by-value, r=nikomatsakis
- The following operator traits now take their arguments by value: `Add`, `Sub`, `Mul`, `Div`, `Rem`, `BitAnd`, `BitOr`, `BitXor`, `Shl`, `Shr`. This breaks all existing implementations of these traits.

- The binary operation `a OP b` now "desugars" to `OpTrait::op_method(a, b)` and consumes both arguments.

- `String` and `Vec` addition have been changed to reuse the LHS owned value, and to avoid internal cloning. Only the following asymmetric operations are available: `String + &str` and `Vec<T> + &[T]`, which are now a short-hand for the "append" operation.

[breaking-change]

---

This passes `make check` locally. I haven't touch the unary operators in this PR, but converting them to by value should be very similar to this PR. I can work on them after this gets the thumbs up.

@nikomatsakis r? the compiler changes
@aturon r? the library changes. I think the only controversial bit is the semantic change of the `Vec`/`String` `Add` implementation.
cc #19148
2014-12-15 22:11:44 +00:00
Jorge Aparicio 1ec5650ad3 libcoretest: fix unit tests 2014-12-13 20:15:39 -05:00
Jorge Aparicio 778be74cbb libcoretest: use tuple indexing 2014-12-13 20:04:41 -05:00
Jorge Aparicio 8df27d26bd libcoretest: fix fallout 2014-12-13 17:03:45 -05:00
Jorge Aparicio 47acce498a libcoretest: fix fallout in unit tests 2014-12-13 17:03:45 -05:00
Jorge Aparicio a50c587242 libcoretest: fix fallout 2014-12-13 17:03:45 -05:00
bors 83a44c7fa6 auto merge of #19378 : japaric/rust/no-as-slice, r=alexcrichton
Now that we have an overloaded comparison (`==`) operator, and that `Vec`/`String` deref to `[T]`/`str` on method calls, many `as_slice()`/`as_mut_slice()`/`to_string()` calls have become redundant. This patch removes them. These were the most common patterns:

- `assert_eq(test_output.as_slice(), "ground truth")` -> `assert_eq(test_output, "ground truth")`
- `assert_eq(test_output, "ground truth".to_string())` -> `assert_eq(test_output, "ground truth")`
- `vec.as_mut_slice().sort()` -> `vec.sort()`
- `vec.as_slice().slice(from, to)` -> `vec.slice(from_to)`

---

Note that e.g. `a_string.push_str(b_string.as_slice())` has been left untouched in this PR, since we first need to settle down whether we want to favor the `&*b_string` or the `b_string[]` notation.

This is rebased on top of #19167

cc @alexcrichton @aturon
2014-12-08 02:32:31 +00:00
Jorge Aparicio 5257a5b284 libcoretest: remove unnecessary `as_slice()` calls 2014-12-06 19:05:58 -05:00
Corey Farwell 4ef16741e3 Utilize fewer reexports
In regards to:

https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729

This commit:

* Changes the #deriving code so that it generates code that utilizes fewer
  reexports (in particur Option::* and Result::*), which is necessary to
  remove those reexports in the future
* Changes other areas of the codebase so that fewer reexports are utilized
2014-12-05 18:13:04 -05:00
Jorge Aparicio 09707d70a4 Fix fallout 2014-12-03 10:41:48 -05:00
Alex Crichton 60541cdc1e Test fixes and rebase conflicts 2014-11-26 16:50:13 -08:00
bors 0c1d853fba auto merge of #18966 : huonw/rust/iter2slice, r=aturon
A slice iterator is isomorphic to a slice, just with a slightly
different form: storing start and end pointers rather than start pointer
and length. This patch reflects this by making converting between them
as easy as `iter.as_slice()` (or even `iter[]` if the shorter lifetime
is ok). That is, `slice.iter().as_slice() == slice`.

r? @aturon
2014-11-25 06:51:38 +00:00
Huon Wilson b86a7808c7 Add methods to go from a slice iterators to a slice.
A slice iterator is isomorphic to a slice, just with a slightly
different form: storing start and end pointers rather than start pointer
and length. This patch reflects this by making converting between them
as easy as `iter.as_slice()` (or even `iter[]` if the shorter lifetime
is ok). That is, `slice.iter().as_slice() == slice`.
2014-11-25 17:10:32 +11:00