]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoRollup merge of #23927 - frewsxcv:patch-7, r=Manishearth
Manish Goregaokar [Wed, 1 Apr 2015 19:10:40 +0000 (00:40 +0530)]
Rollup merge of #23927 - frewsxcv:patch-7, r=Manishearth

9 years agoRollup merge of #23925 - steveklabnik:gh22914, r=Gankro
Manish Goregaokar [Wed, 1 Apr 2015 19:10:39 +0000 (00:40 +0530)]
Rollup merge of #23925 - steveklabnik:gh22914, r=Gankro

Fixes #22914

Said issue was mostly fixed, as there wasn't any examples when it was initially posted. This is mostly just some re-wording of some things and some cleanup

9 years agoRollup merge of #23924 - nrc:unqual-assoc3, r=alexcrichton
Manish Goregaokar [Wed, 1 Apr 2015 19:10:39 +0000 (00:40 +0530)]
Rollup merge of #23924 - nrc:unqual-assoc3, r=alexcrichton

Basically stuff I did for unqualified assoc types which is worth landing by itself.

9 years agoRollup merge of #23895 - nikomatsakis:fn-trait-inheritance-add-impls, r=pnkfelix
Manish Goregaokar [Wed, 1 Apr 2015 19:10:39 +0000 (00:40 +0530)]
Rollup merge of #23895 - nikomatsakis:fn-trait-inheritance-add-impls, r=pnkfelix

The primary purpose of this PR is to add blanket impls for the `Fn` traits of the following (simplified) form:

    impl<F:Fn> Fn for &F
    impl<F:FnMut> FnMut for &mut F

However, this wound up requiring two changes:

1. A slight hack so that `x()` where `x: &mut F` is translated to `FnMut::call_mut(&mut *x, ())` vs `FnMut::call_mut(&mut x, ())`. This is achieved by just autoderef'ing one time when calling something whose type is `&F` or `&mut F`.
2. Making the infinite recursion test in trait matching a bit more tailored. This involves adding a notion of "matching" types that looks to see if types are potentially unifiable (it's an approximation).

The PR also includes various small refactorings to the inference code that are aimed at moving the unification and other code into a library (I've got that particular change in a branch, these changes just lead the way there by removing unnecessary dependencies between the compiler and the more general unification code).

Note that per rust-lang/rfcs#1023, adding impls like these would be a breaking change in the future.

cc @japaric
cc @alexcrichton
cc @aturon

Fixes #23015.

9 years agoRollup merge of #23867 - nikomatsakis:issue-23086-take-3, r=pnkfelix
Manish Goregaokar [Wed, 1 Apr 2015 19:10:38 +0000 (00:40 +0530)]
Rollup merge of #23867 - nikomatsakis:issue-23086-take-3, r=pnkfelix

This PR implements rust-lang/rfcs#1023. In the process it fixes #23086 and #23516. A few impls in libcore had to be updated, but the impact is generally pretty minimal. Most of the fallout is in the tests that probed the limits of today's coherence.

I tested and we were able to build the most popular crates along with iron (modulo errors around errors being sendable).

Fixes #23918.

9 years agoRollup merge of #23847 - bcoopers:read_clarification, r=sfackler
Manish Goregaokar [Wed, 1 Apr 2015 19:10:38 +0000 (00:40 +0530)]
Rollup merge of #23847 - bcoopers:read_clarification, r=sfackler

This introduces no functional changes except for reducing a few unnecessary operations and variables.  Vec has the behavior that, if you request space past the capacity with reserve(), it will round up to the nearest power of 2.  What that effectively means is that after the first call to reserve(16), we are doubling our capacity every time.  So using the DEFAULT_BUF_SIZE and doubling cap_size() here is meaningless and has no effect on the call to reserve().

Note that with #23842 implemented this will hopefully have a clearer API and less of a need for commenting.  If #23842 is not implemented then the most clear implementation would be to call reserve_exact(buf.capacity()) at every step (and making sure that buf.capacity() is not zero at the beginning of the function of course).

Edit- functional change now introduced.  We will now zero 16 bytes of the vector first, then double to 32, then 64, etc. until we read 64kB.  This stops us from zeroing the entire vector when we double it, some of which may be wasted work.  Reallocation still follows the doubling strategy, but the responsibility has been moved to vec.extend(), which calls reserve() and push_back().

9 years agoRollup merge of #23844 - kvark:try_unique, r=alexcrichton
Manish Goregaokar [Wed, 1 Apr 2015 19:10:38 +0000 (00:40 +0530)]
Rollup merge of #23844 - kvark:try_unique, r=alexcrichton

While trying to implement parallel ECS processing, I stumbled upon the need to mutate `Arc` contents. The only existed method that allowed that was `make_unique`, but it has issues:
  - it may clone the data as if nothing happened, where the program may just need to crash
  - it forces `Clone` bound, which I don't have

The new `try_unique` allows accessing the contents mutably without `Clone` bound and error out if the pointer is not unique.

9 years agoRollup merge of #23066 - michaelwoerister:unreachable-if, r=pnkfelix
Manish Goregaokar [Wed, 1 Apr 2015 19:10:38 +0000 (00:40 +0530)]
Rollup merge of #23066 - michaelwoerister:unreachable-if, r=pnkfelix

This PR solves #21559 by making sure that unreachable if-expressions are not further translated.

Could someone who knows their way around `trans` take a look at the changes in `controlflow.rs`? I'm not sure if any other code relies on any side-effects of translating unreachable things.

cc @nikomatsakis @nrc @eddyb

9 years agoFallout in libsyntax/librustc: use newtype'd options for linked lists,
Niko Matsakis [Mon, 30 Mar 2015 21:51:26 +0000 (17:51 -0400)]
Fallout in libsyntax/librustc: use newtype'd options for linked lists,
since `Option` is not fundamental and hence the old impls run afoul of
the orphan rules.

9 years agoFallout in libstd: remove impls now considered to conflict.
Niko Matsakis [Mon, 30 Mar 2015 21:50:31 +0000 (17:50 -0400)]
Fallout in libstd: remove impls now considered to conflict.

9 years agoUpdate tests for new coherence rules, and add a swatch of new tests
Niko Matsakis [Mon, 30 Mar 2015 21:49:30 +0000 (17:49 -0400)]
Update tests for new coherence rules, and add a swatch of new tests
probing the specifics of `Fundamental`.

Fixes #23086.
Fixes #23516.

9 years agoAdd `#[fundamental]` annotations into libcore so that `Sized` and the
Niko Matsakis [Mon, 30 Mar 2015 21:52:00 +0000 (17:52 -0400)]
Add `#[fundamental]` annotations into libcore so that `Sized` and the
`Fn` traits are considered fundamental, along with `Box` (though that is
mostly for show; the real type is `~T` in the compiler).

9 years agoImplement the changes to coherence such that we consider a type to be
Niko Matsakis [Mon, 30 Mar 2015 21:46:34 +0000 (17:46 -0400)]
Implement the changes to coherence such that we consider a type to be
local only if matches `FUNDAMENTAL(LocalType)`, where `FUNDAMENTAL`
includes `&T` and types marked as fundamental (which includes `Box`).
Also apply these tests to negative reasoning.

9 years agoSimplify `match` branches in iter.rs example
Corey Farwell [Wed, 1 Apr 2015 01:22:17 +0000 (21:22 -0400)]
Simplify `match` branches in iter.rs example

9 years agoAuto merge of #23109 - nikomatsakis:closure-region-hierarchy, r=pnkfelix
bors [Wed, 1 Apr 2015 14:42:16 +0000 (14:42 +0000)]
Auto merge of #23109 - nikomatsakis:closure-region-hierarchy, r=pnkfelix

Adjust internal treatment of the region hierarchy around closures. Work towards #3696.

r? @pnkfelix

9 years agoUpdate comments
Niko Matsakis [Wed, 1 Apr 2015 12:40:32 +0000 (08:40 -0400)]
Update comments

9 years agoRemove the `Option<>` since when computing LUB since I believe that the
Niko Matsakis [Fri, 6 Mar 2015 02:31:42 +0000 (21:31 -0500)]
Remove the `Option<>` since when computing LUB since I believe that the
case where `None` was returned should never happen in practice; it
amounts to comparing regions from two unrelated hierarchies. (I was also
not able to make it happen.)

9 years agoImplement the new region hierarchy rules, in which regions from distinct
Niko Matsakis [Thu, 5 Mar 2015 11:24:22 +0000 (06:24 -0500)]
Implement the new region hierarchy rules, in which regions from distinct
hierarchies are judged based on the lexical relationship of their
respective fn bodies.

9 years agoAdd a meta-hierarchy of trees -- in future, each fn body will inhabit
Niko Matsakis [Wed, 4 Mar 2015 15:52:39 +0000 (10:52 -0500)]
Add a meta-hierarchy of trees -- in future, each fn body will inhabit
its own disjoint region tree, and the new table encodes the lexical
relationships between those trees.

9 years agoAuto merge of #23936 - pnkfelix:rollup, r=pnkfelix
bors [Wed, 1 Apr 2015 10:02:37 +0000 (10:02 +0000)]
Auto merge of #23936 - pnkfelix:rollup, r=pnkfelix

This is an attempt to fix #23922

9 years agoUpdate android tests to reflect API switch from `os::env` to `env::vars`.
Felix S. Klock II [Wed, 1 Apr 2015 09:59:51 +0000 (11:59 +0200)]
Update android tests to reflect API switch from `os::env` to `env::vars`.

9 years agoTest fixes and rebase conflicts
Alex Crichton [Wed, 1 Apr 2015 01:59:36 +0000 (18:59 -0700)]
Test fixes and rebase conflicts

9 years agoAdded Arc::try_unique
Dzmitry Malyshau [Sun, 29 Mar 2015 21:38:05 +0000 (17:38 -0400)]
Added Arc::try_unique

9 years agoTidying up and reformatting
Nick Cameron [Sun, 29 Mar 2015 23:21:20 +0000 (12:21 +1300)]
Tidying up and reformatting

9 years agorollup merge of #23923: steveklabnik/gh23688
Alex Crichton [Wed, 1 Apr 2015 01:06:42 +0000 (18:06 -0700)]
rollup merge of #23923: steveklabnik/gh23688

Fixes #23688

r? @alexcrichton

9 years agorollup merge of #23921: aturon/issue-17746
Alex Crichton [Wed, 1 Apr 2015 01:06:41 +0000 (18:06 -0700)]
rollup merge of #23921: aturon/issue-17746

Closes #17746

9 years agorollup merge of #23863: pnkfelix/arith-oflo-const-eval
Alex Crichton [Wed, 1 Apr 2015 01:06:35 +0000 (18:06 -0700)]
rollup merge of #23863: pnkfelix/arith-oflo-const-eval

const_eval : add overflow-checking for {`+`, `-`, `*`, `/`, `<<`, `>>`}.

One tricky detail here: There is some duplication of labor between `rustc::middle::const_eval` and `rustc_trans::trans::consts`. It might be good to explore ways to try to factor out the common structure to the two passes (by abstracting over the particular value-representation used in the compile-time interpreter).

----

Update: Rebased atop #23841

Fix #22531

Fix #23030

Fix #23221

Fix #23235

9 years agodealing with fallout to the tests, in particular diffs between 32- vs 64-bit targets.
Felix S. Klock II [Wed, 1 Apr 2015 00:51:45 +0000 (02:51 +0200)]
dealing with fallout to the tests, in particular diffs between 32- vs 64-bit targets.

See also #23926.

9 years agoUnify handling of checking repeat-count validity.
Felix S. Klock II [Wed, 1 Apr 2015 00:40:56 +0000 (02:40 +0200)]
Unify handling of checking repeat-count validity.

9 years agoFixes to compile-fail error messages post-rebase.
Felix S. Klock II [Tue, 31 Mar 2015 22:15:09 +0000 (00:15 +0200)]
Fixes to compile-fail error messages post-rebase.

9 years agoInclude feature `core` to get access to `wrapping_add`.
Felix S. Klock II [Tue, 31 Mar 2015 19:53:12 +0000 (21:53 +0200)]
Include feature `core` to get access to `wrapping_add`.

9 years agoTest cases for checking arithmetic overflow during const eval.
Felix S. Klock II [Mon, 30 Mar 2015 11:26:02 +0000 (13:26 +0200)]
Test cases for checking arithmetic overflow during const eval.

9 years agoFallout from changes for overflow-checking during constant evaluation.
Felix S. Klock II [Sun, 29 Mar 2015 23:23:15 +0000 (01:23 +0200)]
Fallout from changes for overflow-checking during constant evaluation.

9 years agorustc_trans::trans::consts add overflow checking
Felix S. Klock II [Fri, 27 Mar 2015 13:25:48 +0000 (14:25 +0100)]
rustc_trans::trans::consts add overflow checking

9 years agorustc::middle::const_eval : add overflow-checking for {+, -, *}.
Felix S. Klock II [Wed, 25 Mar 2015 10:10:09 +0000 (11:10 +0100)]
rustc::middle::const_eval : add overflow-checking for {+, -, *}.

The overflow-checking attempts to accommodate early evaluation where
we do not have type information yet.

Also, add fixme note about something that has been bothering me.

9 years agorust_llvm: Add way to reflectively ask if a ValueRef is a known constant int.
Felix S. Klock II [Fri, 27 Mar 2015 00:37:10 +0000 (01:37 +0100)]
rust_llvm: Add way to reflectively ask if a ValueRef is a known constant int.

Add option-returning variants to `const_to_int`/`const_to_uint` that
never assert fail. (These will be used for overflow checking from
rustc_trans::trans::consts.)

9 years agoty.rs improve error feedback when const-eval errs during repeat count eval.
Felix S. Klock II [Sat, 28 Mar 2015 17:47:08 +0000 (18:47 +0100)]
ty.rs improve error feedback when const-eval errs during repeat count eval.

9 years agoRefactored ty::ctxt so node_types mutations must go through ty methods.
Felix S. Klock II [Thu, 26 Mar 2015 09:57:42 +0000 (10:57 +0100)]
Refactored ty::ctxt so node_types mutations must go through ty methods.

9 years agoAdded overflowing_{div,rem,shl,shr} method implementations to WrappingOps.
Felix S. Klock II [Fri, 27 Mar 2015 13:17:10 +0000 (14:17 +0100)]
Added overflowing_{div,rem,shl,shr} method implementations to WrappingOps.

9 years agoFix #23890: const-eval `_ as usize`, `_ as isize` must dispatch to target type.
Felix S. Klock II [Tue, 31 Mar 2015 15:55:28 +0000 (17:55 +0200)]
Fix #23890: const-eval `_ as usize`, `_ as isize` must dispatch to target type.

9 years agofix post rebase.
Felix S. Klock II [Mon, 30 Mar 2015 18:20:35 +0000 (20:20 +0200)]
fix post rebase.

9 years agoAdded tests for discriminant overflows.
Felix S. Klock II [Sat, 28 Mar 2015 10:14:06 +0000 (11:14 +0100)]
Added tests for discriminant overflows.

9 years agoAdded type-specific overflow checks when computing enum discriminant values.
Felix S. Klock II [Fri, 27 Mar 2015 00:43:14 +0000 (01:43 +0100)]
Added type-specific overflow checks when computing enum discriminant values.

Moved such overflow checking into one place (in `rustc::middle::ty`,
since it needs to be run on-demand during `const_eval` in some
scenarios), and revised `rustc_typeck` accordingly.

(Note that we only check for overflow if program did not provide a
discriminant value explicitly.)

Fix #23030

Fix #23221

Fix #23235

9 years agoTest fixes and rebase conflicts, round 3
Alex Crichton [Tue, 31 Mar 2015 23:20:09 +0000 (16:20 -0700)]
Test fixes and rebase conflicts, round 3

9 years agoImprovements to PhantomData<T>'s docs 👻
Steve Klabnik [Wed, 1 Apr 2015 00:18:32 +0000 (20:18 -0400)]
Improvements to PhantomData<T>'s docs ðŸ‘»

Fixes #22914

9 years agoAdd description of + for multiple trait bounds
Steve Klabnik [Tue, 31 Mar 2015 23:45:09 +0000 (19:45 -0400)]
Add description of + for multiple trait bounds

Fixes #23688

9 years agoPretty print ids for assoc items
Nick Cameron [Tue, 24 Mar 2015 01:52:55 +0000 (14:52 +1300)]
Pretty print ids for assoc items

9 years agoAdd test for #17746
Aaron Turon [Tue, 31 Mar 2015 23:22:23 +0000 (16:22 -0700)]
Add test for #17746

Closes #17746

9 years agorollup merge of #23919: alexcrichton/stabilize-io-error
Alex Crichton [Tue, 31 Mar 2015 23:18:55 +0000 (16:18 -0700)]
rollup merge of #23919: alexcrichton/stabilize-io-error

Conflicts:
src/libstd/fs/tempdir.rs
src/libstd/io/error.rs

9 years agorollup merge of #23899: steveklabnik/gh23851
Alex Crichton [Tue, 31 Mar 2015 23:18:27 +0000 (16:18 -0700)]
rollup merge of #23899: steveklabnik/gh23851

Conflicts:
src/libcore/iter.rs

9 years agostd: Stabilize last bits of io::Error
Alex Crichton [Tue, 31 Mar 2015 23:01:03 +0000 (16:01 -0700)]
std: Stabilize last bits of io::Error

This commit stabilizes a few remaining bits of the `io::Error` type:

* The `Error::new` method is now stable. The last `detail` parameter was removed
  and the second `desc` parameter was generalized to `E: Into<Box<Error>>` to
  allow creating an I/O error from any form of error. Currently there is no form
  of downcasting, but this will be added in time.

* An implementation of `From<&str> for Box<Error>` was added to liballoc to
  allow construction of errors from raw strings.

* The `Error::raw_os_error` method was stabilized as-is.

* Trait impls for `Clone`, `Eq`, and `PartialEq` were removed from `Error` as it
  is not possible to use them with trait objects.

This is a breaking change due to the modification of the `new` method as well as
the removal of the trait implementations for the `Error` type.

[breaking-change]

9 years agorollup merge of #23920: steveklabnik/gh23881
Alex Crichton [Tue, 31 Mar 2015 23:12:38 +0000 (16:12 -0700)]
rollup merge of #23920: steveklabnik/gh23881

Fixes #23881

9 years agorollup merge of #23901: steveklabnik/fix_links_str
Alex Crichton [Tue, 31 Mar 2015 23:12:36 +0000 (16:12 -0700)]
rollup merge of #23901: steveklabnik/fix_links_str

Remove broken links that should just point to the current page, and while we're at it, re-wrap to 100 chars.

9 years agoMove benchmark tests to unstable section
Steve Klabnik [Tue, 31 Mar 2015 23:02:32 +0000 (19:02 -0400)]
Move benchmark tests to unstable section

Fixes #23881

9 years agorollup merge of #23288: alexcrichton/issue-19470
Alex Crichton [Tue, 31 Mar 2015 22:59:35 +0000 (15:59 -0700)]
rollup merge of #23288: alexcrichton/issue-19470

This is a deprecated attribute that is slated for removal, and it also affects
all implementors of the trait. This commit removes the attribute and fixes up
implementors accordingly. The primary implementation which was lost was the
ability to compare `&[T]` and `Vec<T>` (in that order).

This change also modifies the `assert_eq!` macro to not consider both directions
of equality, only the one given in the left/right forms to the macro. This
modification is motivated due to the fact that `&[T] == Vec<T>` no longer
compiles, causing hundreds of errors in unit tests in the standard library (and
likely throughout the community as well).

Closes #19470
[breaking-change]

9 years agorollup merge of #23908: aturon/stab-more-stragglers
Alex Crichton [Tue, 31 Mar 2015 22:58:58 +0000 (15:58 -0700)]
rollup merge of #23908: aturon/stab-more-stragglers

* The `io::Seek` trait.
* The `Iterator::{partition, unsip}` methods.
* The `Vec::into_boxed_slice` method.
* The `LinkedList::append` method.
* The `{or_insert, or_insert_with` methods in the `Entry` APIs.

r? @alexcrichton

9 years agorollup merge of #23907: alexcrichton/impl-exit
Alex Crichton [Tue, 31 Mar 2015 22:58:57 +0000 (15:58 -0700)]
rollup merge of #23907: alexcrichton/impl-exit

This commit is an implementation of [RFC #1011][rfc] which adds an `exit`
function to the standard library for immediately terminating the current process
with a specified exit code.

[rfc]: https://github.com/rust-lang/rfcs/pull/1011

Closes #23914

9 years agorollup merge of #23906: steveklabnik/spellin
Alex Crichton [Tue, 31 Mar 2015 22:58:57 +0000 (15:58 -0700)]
rollup merge of #23906: steveklabnik/spellin

9 years agorollup merge of #23902: freebroccolo/master
Alex Crichton [Tue, 31 Mar 2015 22:58:57 +0000 (15:58 -0700)]
rollup merge of #23902: freebroccolo/master

9 years agoTest fixes and rebase conflicts, round 2
Alex Crichton [Tue, 31 Mar 2015 18:41:18 +0000 (11:41 -0700)]
Test fixes and rebase conflicts, round 2

9 years agorollup merge of #23873: alexcrichton/remove-deprecated
Alex Crichton [Tue, 31 Mar 2015 18:34:17 +0000 (11:34 -0700)]
rollup merge of #23873: alexcrichton/remove-deprecated

Conflicts:
src/libcollectionstest/fmt.rs
src/libcollectionstest/lib.rs
src/libcollectionstest/str.rs
src/libcore/error.rs
src/libstd/fs.rs
src/libstd/io/cursor.rs
src/libstd/os.rs
src/libstd/process.rs
src/libtest/lib.rs
src/test/run-pass-fulldeps/compiler-calls.rs

9 years agorollup merge of #23879: seanmonstar/del-from-error
Alex Crichton [Tue, 31 Mar 2015 18:27:21 +0000 (11:27 -0700)]
rollup merge of #23879: seanmonstar/del-from-error

Conflicts:
src/libcore/error.rs

9 years agorollup merge of #23875: aturon/revise-convert-2
Alex Crichton [Tue, 31 Mar 2015 18:26:10 +0000 (11:26 -0700)]
rollup merge of #23875: aturon/revise-convert-2

* Marks `#[stable]` the contents of the `std::convert` module.

* Added methods `PathBuf::as_path`, `OsString::as_os_str`,
  `String::as_str`, `Vec::{as_slice, as_mut_slice}`.

* Deprecates `OsStr::from_str` in favor of a new, stable, and more
  general `OsStr::new`.

* Adds unstable methods `OsString::from_bytes` and `OsStr::{to_bytes,
  to_cstring}` for ergonomic FFI usage.

[breaking-change]

r? @alexcrichton

9 years agoTest fixes and rebase conflicts, round 1
Alex Crichton [Tue, 31 Mar 2015 17:26:25 +0000 (10:26 -0700)]
Test fixes and rebase conflicts, round 1

9 years agorollup merge of #23872: huonw/eager-lexing
Alex Crichton [Tue, 31 Mar 2015 17:16:54 +0000 (10:16 -0700)]
rollup merge of #23872: huonw/eager-lexing

Conflicts:
src/libsyntax/parse/lexer/mod.rs

9 years agostd: Clean out #[deprecated] APIs
Alex Crichton [Mon, 30 Mar 2015 18:00:05 +0000 (11:00 -0700)]
std: Clean out #[deprecated] APIs

This commit cleans out a large amount of deprecated APIs from the standard
library and some of the facade crates as well, updating all users in the
compiler and in tests as it goes along.

9 years agorollup merge of #23893: frewsxcv/patch-6
Alex Crichton [Tue, 31 Mar 2015 17:15:35 +0000 (10:15 -0700)]
rollup merge of #23893: frewsxcv/patch-6

9 years agorollup merge of #23886: demelev/remove_as_slice_usage
Alex Crichton [Tue, 31 Mar 2015 17:15:35 +0000 (10:15 -0700)]
rollup merge of #23886: demelev/remove_as_slice_usage

9 years agorollup merge of #23885: steveklabnik/doc_std_env
Alex Crichton [Tue, 31 Mar 2015 17:15:33 +0000 (10:15 -0700)]
rollup merge of #23885: steveklabnik/doc_std_env

Just one or two things to finish this module off

9 years agorollup merge of #23882: wettowelreactor/patch-2
Alex Crichton [Tue, 31 Mar 2015 17:15:33 +0000 (10:15 -0700)]
rollup merge of #23882: wettowelreactor/patch-2

Removed duplicate words

9 years agorollup merge of #23878: Ryman/stable_extremes
Alex Crichton [Tue, 31 Mar 2015 17:15:32 +0000 (10:15 -0700)]
rollup merge of #23878: Ryman/stable_extremes

`min`-like functions now return the leftmost element/input for equal elements.
`max`-like return the rightmost.

Closes #23687.

cc @HeroesGrave, @aturon, @alexcrichton

9 years agorollup merge of #23876: alexcrichton/stabilize-any
Alex Crichton [Tue, 31 Mar 2015 17:15:32 +0000 (10:15 -0700)]
rollup merge of #23876: alexcrichton/stabilize-any

This commit stabilizes the following APIs:

* `TypeId::of` - now that it has an `Any` bound it's ready to be stable.
* `Box<Any>::downcast` - now that an inherent impl on `Box<Any>` as well as
  `Box<Any+Send>` is allowed the `BoxAny` trait is removed in favor of these
  inherent methods.

This is a breaking change due to the removal of the `BoxAny` trait, but
consumers can simply remove imports to fix crates.

[breaking-change]

9 years agorollup merge of #23766: alexcrichton/stabilize-raw-fd
Alex Crichton [Tue, 31 Mar 2015 17:15:29 +0000 (10:15 -0700)]
rollup merge of #23766: alexcrichton/stabilize-raw-fd

This commit stabilizes the platform-specific `io` modules, specifically around
the traits having to do with the raw representation of each object on each
platform.

Specifically, the following material was stabilized:

* `AsRaw{Fd,Socket,Handle}`
* `RawFd` (renamed from `Fd`)
* `RawHandle` (renamed from `Handle`)
* `RawSocket` (renamed from `Socket`)
* `AsRaw{Fd,Socket,Handle}` implementations
* `std::os::{unix, windows}::io`

The following material was added as `#[unstable]`:

* `FromRaw{Fd,Socket,Handle}`
* Implementations for various primitives

There are a number of future improvements that are possible to make to this
module, but this should cover a good bit of functionality desired from these
modules for now. Some specific future additions may include:

* `IntoRawXXX` traits to consume the raw representation and cancel the
  auto-destructor.
* `Fd`, `Socket`, and `Handle` abstractions that behave like Rust objects and
  have nice methods for various syscalls.

At this time though, these are considered backwards-compatible extensions and
will not be stabilized at this time.

This commit is a breaking change due to the addition of `Raw` in from of the
type aliases in each of the platform-specific modules.

[breaking-change]

9 years agorollup merge of #23704: hirschenberger/simd-intdiv-ice
Alex Crichton [Tue, 31 Mar 2015 17:15:28 +0000 (10:15 -0700)]
rollup merge of #23704: hirschenberger/simd-intdiv-ice

Fixes #23339

9 years agoStabilize a few remaining stragglers
Aaron Turon [Tue, 31 Mar 2015 20:47:57 +0000 (13:47 -0700)]
Stabilize a few remaining stragglers

* The `io::Seek` trait, and `SeekFrom` enum.
* The `Iterator::{partition, unsip}` methods.
* The `Vec::into_boxed_slice` method.
* The `LinkedList::append` method.
* The `{or_insert, or_insert_with` methods in the `Entry` APIs.

9 years agostd: Add a process::exit function
Alex Crichton [Tue, 31 Mar 2015 21:41:59 +0000 (14:41 -0700)]
std: Add a process::exit function

This commit is an implementation of [RFC #1011][rfc] which adds an `exit`
function to the standard library for immediately terminating the current process
with a specified exit code.

[rfc]: https://github.com/rust-lang/rfcs/pull/1011

9 years agoFix spelling
Steve Klabnik [Tue, 31 Mar 2015 21:44:45 +0000 (17:44 -0400)]
Fix spelling

9 years agorustc: Remove old_orphan_check entirely
Alex Crichton [Tue, 31 Mar 2015 20:40:39 +0000 (13:40 -0700)]
rustc: Remove old_orphan_check entirely

9 years agostd: Remove #[old_orphan_check] from PartialEq
Alex Crichton [Wed, 11 Mar 2015 00:59:23 +0000 (17:59 -0700)]
std: Remove #[old_orphan_check] from PartialEq

This is a deprecated attribute that is slated for removal, and it also affects
all implementors of the trait. This commit removes the attribute and fixes up
implementors accordingly. The primary implementation which was lost was the
ability to compare `&[T]` and `Vec<T>` (in that order).

This change also modifies the `assert_eq!` macro to not consider both directions
of equality, only the one given in the left/right forms to the macro. This
modification is motivated due to the fact that `&[T] == Vec<T>` no longer
compiles, causing hundreds of errors in unit tests in the standard library (and
likely throughout the community as well).

cc #19470
[breaking-change]

9 years agoFixup primitive.str docs
Steve Klabnik [Tue, 31 Mar 2015 20:19:52 +0000 (16:19 -0400)]
Fixup primitive.str docs

Remove broken links that should just point to the current page, and while we're at it, re-wrap to 100 chars.

9 years agobook: reword timer bit
Darin Morrison [Tue, 31 Mar 2015 20:14:04 +0000 (14:14 -0600)]
book: reword timer bit

9 years agoFix up iterator documentation with regards to for loop sugar
Steve Klabnik [Tue, 31 Mar 2015 18:55:25 +0000 (14:55 -0400)]
Fix up iterator documentation with regards to for loop sugar

Fixes #23851

9 years agoAuto merge of #23678 - richo:check-flightcheck, r=alexcrichton
bors [Tue, 31 Mar 2015 18:26:20 +0000 (18:26 +0000)]
Auto merge of #23678 - richo:check-flightcheck, r=alexcrichton

Rationale for this, is that I lurked `ulimit -c unlimited` into my .profile to debug an unrelated crash, that I kept forgetting to set before hand. I then ran the test suite and discovered that I had 150 gigs of core dumps in `/cores`.

Very open to another approach, or to setting the limit to something higher than 0, but I think it would be nice if the build system tried to save you from yourself here.

9 years agoStabilize `std::convert` and related code
Aaron Turon [Mon, 30 Mar 2015 22:15:27 +0000 (15:15 -0700)]
Stabilize `std::convert` and related code

* Marks `#[stable]` the contents of the `std::convert` module.

* Added methods `PathBuf::as_path`, `OsString::as_os_str`,
  `String::as_str`, `Vec::{as_slice, as_mut_slice}`.

* Deprecates `OsStr::from_str` in favor of a new, stable, and more
  general `OsStr::new`.

* Adds unstable methods `OsString::from_bytes` and `OsStr::{to_bytes,
  to_cstring}` for ergonomic FFI usage.

[breaking-change]

9 years agorollup merge of #23669: steveklabnik/doc_std_borrow
Alex Crichton [Tue, 31 Mar 2015 17:15:27 +0000 (10:15 -0700)]
rollup merge of #23669: steveklabnik/doc_std_borrow

9 years agorollup merge of #23549: aturon/stab-num
Alex Crichton [Tue, 31 Mar 2015 17:15:26 +0000 (10:15 -0700)]
rollup merge of #23549: aturon/stab-num

This commit stabilizes the `std::num` module:

* The `Int` and `Float` traits are deprecated in favor of (1) the
  newly-added inherent methods and (2) the generic traits available in
  rust-lang/num.

* The `Zero` and `One` traits are reintroduced in `std::num`, which
  together with various other traits allow you to recover the most
  common forms of generic programming.

* The `FromStrRadix` trait, and associated free function, is deprecated
  in favor of inherent implementations.

* A wide range of methods and constants for both integers and floating
  point numbers are now `#[stable]`, having been adjusted for integer
  guidelines.

* `is_positive` and `is_negative` are renamed to `is_sign_positive` and
  `is_sign_negative`, in order to address #22985

* The `Wrapping` type is moved to `std::num` and stabilized;
  `WrappingOps` is deprecated in favor of inherent methods on the
  integer types, and direct implementation of operations on
  `Wrapping<X>` for each concrete integer type `X`.

Closes #22985
Closes #21069

[breaking-change]

r? @alexcrichton

9 years agoAdd tests for blanket impls.
Niko Matsakis [Tue, 31 Mar 2015 16:09:24 +0000 (12:09 -0400)]
Add tests for blanket impls.

9 years agoAuto merge of #23549 - aturon:stab-num, r=alexcrichton
bors [Tue, 31 Mar 2015 14:50:46 +0000 (14:50 +0000)]
Auto merge of #23549 - aturon:stab-num, r=alexcrichton

This commit stabilizes the `std::num` module:

* The `Int` and `Float` traits are deprecated in favor of (1) the
  newly-added inherent methods and (2) the generic traits available in
  rust-lang/num.

* The `Zero` and `One` traits are reintroduced in `std::num`, which
  together with various other traits allow you to recover the most
  common forms of generic programming.

* The `FromStrRadix` trait, and associated free function, is deprecated
  in favor of inherent implementations.

* A wide range of methods and constants for both integers and floating
  point numbers are now `#[stable]`, having been adjusted for integer
  guidelines.

* `is_positive` and `is_negative` are renamed to `is_sign_positive` and
  `is_sign_negative`, in order to address #22985

* The `Wrapping` type is moved to `std::num` and stabilized;
  `WrappingOps` is deprecated in favor of inherent methods on the
  integer types, and direct implementation of operations on
  `Wrapping<X>` for each concrete integer type `X`.

Closes #22985
Closes #21069

[breaking-change]

r? @alexcrichton

9 years agoStabilize std::num
Aaron Turon [Fri, 20 Mar 2015 06:42:18 +0000 (23:42 -0700)]
Stabilize std::num

This commit stabilizes the `std::num` module:

* The `Int` and `Float` traits are deprecated in favor of (1) the
  newly-added inherent methods and (2) the generic traits available in
  rust-lang/num.

* The `Zero` and `One` traits are reintroduced in `std::num`, which
  together with various other traits allow you to recover the most
  common forms of generic programming.

* The `FromStrRadix` trait, and associated free function, is deprecated
  in favor of inherent implementations.

* A wide range of methods and constants for both integers and floating
  point numbers are now `#[stable]`, having been adjusted for integer
  guidelines.

* `is_positive` and `is_negative` are renamed to `is_sign_positive` and
  `is_sign_negative`, in order to address #22985

* The `Wrapping` type is moved to `std::num` and stabilized;
  `WrappingOps` is deprecated in favor of inherent methods on the
  integer types, and direct implementation of operations on
  `Wrapping<X>` for each concrete integer type `X`.

Closes #22985
Closes #21069

[breaking-change]

9 years agoIndicate select! is code-like
Corey Farwell [Tue, 31 Mar 2015 14:32:53 +0000 (10:32 -0400)]
Indicate select! is code-like

9 years agoAdd blanket impls for references to the `Fn` traits.
Niko Matsakis [Fri, 20 Mar 2015 12:18:04 +0000 (08:18 -0400)]
Add blanket impls for references to the `Fn` traits.

9 years agoA very simple hack to force an autoderef if the callee has type `&mut
Niko Matsakis [Tue, 31 Mar 2015 08:38:43 +0000 (04:38 -0400)]
A very simple hack to force an autoderef if the callee has type `&mut
F`, so that if we have `x: &mut FnMut()`, then `x()` is translated to
`FnMut::call_mut(&mut *x, ())` rather than `&mut x`. The latter would
require `mut x: &mut FnMut()`, which is really a lot of mut. (Actually,
the `mut` is normally required except for the special case of a `&mut F`
reference, because that's the one case where we distinguish a unique
path like `x` from a mutable path.)

9 years agoAdd a "match" relation that can be used to make recursion check during
Niko Matsakis [Fri, 20 Mar 2015 12:17:09 +0000 (08:17 -0400)]
Add a "match" relation that can be used to make recursion check during
trait matching more tailored. We now detect recursion where the
obligations "match" -- meaning basically that they are the same for some
substitution of any unbound type variables.

9 years agoPort over type inference to using the new type relation stuff
Niko Matsakis [Sun, 22 Mar 2015 19:11:56 +0000 (15:11 -0400)]
Port over type inference to using the new type relation stuff

9 years agoRemove unused import
Niko Matsakis [Wed, 18 Mar 2015 11:54:41 +0000 (07:54 -0400)]
Remove unused import

9 years agoSwitch to FnvHashMap
Niko Matsakis [Wed, 18 Mar 2015 11:54:31 +0000 (07:54 -0400)]
Switch to FnvHashMap

9 years agoExtract more `ty` and `infer` dependencies from the unification engine
Niko Matsakis [Tue, 10 Mar 2015 19:32:25 +0000 (15:32 -0400)]
Extract more `ty` and `infer` dependencies from the unification engine
so that it is closer to standalone.

9 years agoMake union-find helper fns private, change to u32.
Niko Matsakis [Mon, 16 Feb 2015 10:07:22 +0000 (05:07 -0500)]
Make union-find helper fns private, change to u32.

9 years agoRefactor unification interface by moving the methods off of inferctxt and onto the
Niko Matsakis [Sun, 15 Feb 2015 20:16:45 +0000 (15:16 -0500)]
Refactor unification interface by moving the methods off of inferctxt and onto the
`UnificationTable`, and renaming/collapsing some methods.

9 years agoCombine `try` and `commit_if_ok` and make some details of inference
Niko Matsakis [Tue, 10 Mar 2015 11:02:27 +0000 (07:02 -0400)]
Combine `try` and `commit_if_ok` and make some details of inference
context private.