]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 agoAuto merge of #23884 - Manishearth:rollup, r=Manishearth
bors [Tue, 31 Mar 2015 05:47:35 +0000 (05:47 +0000)]
Auto merge of #23884 - Manishearth:rollup, r=Manishearth

- Successful merges: #23558, #23813, #23826, #23836, #23839, #23846, #23852, #23859, #23862, #23865, #23866, #23869, #23874
- Failed merges:

9 years agoLast docs for std::env
Steve Klabnik [Tue, 31 Mar 2015 04:19:31 +0000 (00:19 -0400)]
Last docs for std::env

9 years agoRollup merge of #23874 - cmr:no-compiler-docs, r=alexcrichton
Manish Goregaokar [Tue, 31 Mar 2015 03:34:39 +0000 (09:04 +0530)]
Rollup merge of #23874 - cmr:no-compiler-docs, r=alexcrichton

r? @alexcrichton

9 years agoRollup merge of #23869 - tshepang:more-complete-builder-pattern-example, r=alexcrichton
Manish Goregaokar [Tue, 31 Mar 2015 03:34:39 +0000 (09:04 +0530)]
Rollup merge of #23869 - tshepang:more-complete-builder-pattern-example, r=alexcrichton

This makes some use of `x` and `y`, instead of setting them to the same value.

9 years agoRollup merge of #23866 - alexcrichton:switch-some-orders, r=aturon
Manish Goregaokar [Tue, 31 Mar 2015 03:34:38 +0000 (09:04 +0530)]
Rollup merge of #23866 - alexcrichton:switch-some-orders, r=aturon

This functions swaps the order of arguments to a few functions that previously
took (output, input) parameters, but now take (input, output) parameters (in
that order).

The affected functions are:

* ptr::copy
* ptr::copy_nonoverlapping
* slice::bytes::copy_memory
* intrinsics::copy
* intrinsics::copy_nonoverlapping

Closes #22890
[breaking-change]

9 years agoRollup merge of #23865 - seanmonstar:into-cow, r=alexcrichton
Manish Goregaokar [Tue, 31 Mar 2015 03:34:38 +0000 (09:04 +0530)]
Rollup merge of #23865 - seanmonstar:into-cow, r=alexcrichton

r? @aturon

9 years agoRollup merge of #23862 - jviereck:fix_23713_v2, r=steveklabnik
Manish Goregaokar [Tue, 31 Mar 2015 03:34:38 +0000 (09:04 +0530)]
Rollup merge of #23862 - jviereck:fix_23713_v2, r=steveklabnik

Based on the comment from @apasel422  in https://github.com/rust-lang/rust/pull/23791#issuecomment-87095298.
Where @apasel422 proposed
```
Moves the value out of the option if it is `Some`, or panics if it is `None`.
```
I include in this PR the version
```
Moves the value `v` out of the `Option` if it is `Some(v)`, or panics if it is `None`.
```
which
- is a little bit more precise about what value is actually returned
- uses `Option` over just "option" in the part `out of the [Option]

r? @steveklabnik, @apasel422

9 years agoRollup merge of #23859 - pnkfelix:fsk-lesser-box, r=nikomatsakis
Manish Goregaokar [Tue, 31 Mar 2015 03:34:38 +0000 (09:04 +0530)]
Rollup merge of #23859 - pnkfelix:fsk-lesser-box, r=nikomatsakis

Disallow writing through mutable pointers stored in non-mut Box.

Fix #14270

The fix works by making `cmt::freely_aliasable` result more fine-grained.

Instead of encoding the aliasability (i.e. whether the cmt is uniquely writable or not) as an option, now pass back an enum indicating either: 1. freely-aliasable (thus not uniquely-writable), 2. non-aliasable (thus uniquely writable), or 3. unique but immutable (and thus not uniquely writable, according to proposal from issue #14270.)

This is all of course a giant hack that will hopefully go away with an eventually removal of special treatment of `Box<T>` (aka `ty_unique`) from the compiler.

9 years agoRollup merge of #23852 - cmr:missing_doc, r=Manishearth
Manish Goregaokar [Tue, 31 Mar 2015 03:34:37 +0000 (09:04 +0530)]
Rollup merge of #23852 - cmr:missing_doc, r=Manishearth

Due to a long-standing conservative approach to trait exports, all traits are
considered exported. However, the missing_docs lint uses the export map to
determine if something is public and ought to have documentation. This commit
modifies the lint to check if traits are private before emitting the warning.

Closes #11592

9 years agoRollup merge of #23846 - rayglover:patch-rustdoc-stderr, r=alexcrichton
Manish Goregaokar [Tue, 31 Mar 2015 03:34:37 +0000 (09:04 +0530)]
Rollup merge of #23846 - rayglover:patch-rustdoc-stderr, r=alexcrichton

Currently if a rustdoc test panics then the fatal error message is not forwarded to the user. This change will have the test runner prefer forwarding anything on the stderr of the test process.

9 years agoRollup merge of #23839 - tyrion:patch-1, r=alexcrichton
Manish Goregaokar [Tue, 31 Mar 2015 03:34:37 +0000 (09:04 +0530)]
Rollup merge of #23839 - tyrion:patch-1, r=alexcrichton

The documentation says that 'The current convention is to use the `test` module
to hold your "unit-style"' but then defines the module as "tests" instead.

Also in the output of the command we can see:
```
test test::it_works ... ok
```
So I think the name of the module was meant to be "test"

9 years agoRollup merge of #23836 - Hoverbear:patch-1, r=steveklabnik
Manish Goregaokar [Tue, 31 Mar 2015 03:34:37 +0000 (09:04 +0530)]
Rollup merge of #23836 - Hoverbear:patch-1, r=steveklabnik

To not use `old_io` and `os`, which are deprecated. Since there is no more `MemoryMap` used byte parsing instead to generate the second potential error.

You can see the code working fine [here](http://is.gd/4g0wwp) on the PlayPen.

9 years agoRollup merge of #23826 - richo:note-print-macro, r=alexcrichton
Manish Goregaokar [Tue, 31 Mar 2015 03:34:37 +0000 (09:04 +0530)]
Rollup merge of #23826 - richo:note-print-macro, r=alexcrichton

cc #23818

9 years agoRollup merge of #23813 - steveklabnik:gh19733, r=cmr
Manish Goregaokar [Tue, 31 Mar 2015 03:34:36 +0000 (09:04 +0530)]
Rollup merge of #23813 - steveklabnik:gh19733, r=cmr

Fixes #19733

9 years agoRollup merge of #23558 - steveklabnik:explain_elision, r=gankro
Manish Goregaokar [Tue, 31 Mar 2015 03:34:36 +0000 (09:04 +0530)]
Rollup merge of #23558 - steveklabnik:explain_elision, r=gankro

9 years agoDocument std::borrow with examples
Steve Klabnik [Tue, 24 Mar 2015 20:48:57 +0000 (16:48 -0400)]
Document std::borrow with examples

9 years agoUpdate lib.rs
Camille Roussel [Tue, 31 Mar 2015 01:52:08 +0000 (18:52 -0700)]
Update lib.rs

Removed duplicate words

9 years agoLex binary and octal literals more eagerly.
Huon Wilson [Mon, 30 Mar 2015 13:27:13 +0000 (00:27 +1100)]
Lex binary and octal literals more eagerly.

Previously 0b12 was considered two tokens, 0b1 and 2, as 2 isn't a valid
base 2 digit. This patch changes that to collapse them into one (and
makes `0b12` etc. an error: 2 isn't a valid base 2 digit).

This may break some macro invocations of macros with `tt` (or syntax
extensions) that rely on adjacent digits being separate tokens and hence
is a

[breaking-change]

The fix is to separate the tokens, e.g. `0b12` -> `0b1 2`.

cc https://github.com/rust-lang/rfcs/pull/879

9 years agoconvert: remove FromError, use From<E> instead
Sean McArthur [Tue, 31 Mar 2015 00:56:48 +0000 (17:56 -0700)]
convert: remove FromError, use From<E> instead

This removes the FromError trait, since it can now be expressed using
the new convert::Into trait. All implementations of FromError<E> where
changed to From<E>, and `try!` was changed to use From::from instead.

Because this removes FromError, it is a breaking change, but fixing it
simply requires changing the words `FromError` to `From`, and
`from_error` to `from`.

[breaking-change]

9 years agostd: Stabilize the rest of Any/BoxAny
Alex Crichton [Mon, 30 Mar 2015 23:43:04 +0000 (16:43 -0700)]
std: Stabilize the rest of Any/BoxAny

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 agomk: build and distribute facade crates unconditionally (for now)
Corey Richardson [Mon, 30 Mar 2015 23:18:47 +0000 (19:18 -0400)]
mk: build and distribute facade crates unconditionally (for now)

9 years agolibcore: Ensure min and max functions are consistent for equal inputs
Kevin Butler [Mon, 30 Mar 2015 22:47:01 +0000 (23:47 +0100)]
libcore: Ensure min and max functions are consistent for equal inputs

9 years agorustdoc: output stderr on doc-test fail
ray glover [Mon, 30 Mar 2015 16:59:28 +0000 (17:59 +0100)]
rustdoc: output stderr on doc-test fail

Forward output from stderr when a test executable panics/fails.

9 years agobook: make Builder Pattern example more complete
Tshepang Lekhonkhobe [Thu, 26 Mar 2015 23:30:09 +0000 (01:30 +0200)]
book: make Builder Pattern example more complete

9 years agolint: handle private traits better
Corey Richardson [Mon, 30 Mar 2015 03:41:54 +0000 (23:41 -0400)]
lint: handle private traits better

Due to a long-standing conservative approach to trait exports, all traits are
considered exported. However, the missing_docs lint uses the export map to
determine if something is public and ought to have documentation. This commit
modifies the lint to check if traits are private before emitting the warning.

Closes #11592

9 years agoreplace deprecated as_slice()
Emeliov Dmitrii [Mon, 30 Mar 2015 16:22:46 +0000 (19:22 +0300)]
replace deprecated as_slice()

9 years agostd: Standardize (input, output) param orderings
Alex Crichton [Fri, 27 Mar 2015 18:12:28 +0000 (11:12 -0700)]
std: Standardize (input, output) param orderings

This functions swaps the order of arguments to a few functions that previously
took (output, input) parameters, but now take (input, output) parameters (in
that order).

The affected functions are:

* ptr::copy
* ptr::copy_nonoverlapping
* slice::bytes::copy_memory
* intrinsics::copy
* intrinsics::copy_nonoverlapping

Closes #22890
[breaking-change]

9 years agostd: Add a note about the print! macro and output buffering
Richo Healey [Sun, 29 Mar 2015 06:50:02 +0000 (23:50 -0700)]
std: Add a note about the print! macro and output buffering

9 years agoconvert: add Into<Cow> impls for &str and String
Sean McArthur [Mon, 30 Mar 2015 19:07:16 +0000 (12:07 -0700)]
convert: add Into<Cow> impls for &str and String

9 years agoSecond attempt to fix #23713 based on follow-up comments in #23791.
Julian Viereck [Mon, 30 Mar 2015 16:52:36 +0000 (18:52 +0200)]
Second attempt to fix #23713 based on follow-up comments in #23791.

9 years agoExplain why 'elision'
Steve Klabnik [Fri, 20 Mar 2015 16:31:05 +0000 (12:31 -0400)]
Explain why 'elision'

9 years agoAuto merge of #23861 - Manishearth:rollup, r=Manishearth
bors [Mon, 30 Mar 2015 17:16:25 +0000 (17:16 +0000)]
Auto merge of #23861 - Manishearth:rollup, r=Manishearth

- Successful merges: #23746, #23836, #23852
- Failed merges: #23855

9 years agoMake note of noalias in unsafe reference section
Steve Klabnik [Sat, 28 Mar 2015 19:42:56 +0000 (15:42 -0400)]
Make note of noalias in unsafe reference section

Fixes #19733

9 years agoRollup merge of #23855 - tshepang:doc-nit, r=Manishearth
Manish Goregaokar [Mon, 30 Mar 2015 14:48:16 +0000 (20:18 +0530)]
Rollup merge of #23855 - tshepang:doc-nit, r=Manishearth

9 years agoAuto merge of #23673 - nikomatsakis:issue-23319-binops-ng-5, r=pnkfelix
bors [Mon, 30 Mar 2015 14:25:48 +0000 (14:25 +0000)]
Auto merge of #23673 - nikomatsakis:issue-23319-binops-ng-5, r=pnkfelix

The current binary operator code assumed that if the LHS was a scalar (`i32` etc), then the RHS had to match. This is not true with multidispatch. This PR generalizes the existing code to (primarily) use the traits -- this also allows us to defer the precise type-checking when the types aren't fully known. The one caveat is the unstable SIMD types, which don't fit in with the current traits -- in that case, the LHS type must be known to be SIMD ahead of time.

There is one semi-hacky bit in that during writeback, for builtin operators, if the types resolve to scalars (i32 etc) then we clear the method override. This is because we know what the semantics are and it is more efficient to generate the code directly. It also ensures that we can use these overloaded operators in constants and so forth.

cc @japaric
cc @aturon

Fixes #23319 (and others).

9 years agoAdd test case for #22743.
Niko Matsakis [Tue, 24 Mar 2015 21:28:28 +0000 (17:28 -0400)]
Add test case for #22743.

Fixes #22743.
Fixes #19035.
Fixes #22099.

(Those all seem to be exactly the same scenario.)

9 years agoFallout in tests: largely changes to error messages.
Niko Matsakis [Mon, 30 Mar 2015 08:56:24 +0000 (04:56 -0400)]
Fallout in tests: largely changes to error messages.

9 years agoFallout to test.
Felix S. Klock II [Mon, 30 Mar 2015 09:47:27 +0000 (11:47 +0200)]
Fallout to test.

9 years agoAddress Issue 14270 by making `cmt::freely_aliasable` result more fine-grained.
Felix S. Klock II [Sun, 29 Mar 2015 23:11:11 +0000 (01:11 +0200)]
Address Issue 14270 by making `cmt::freely_aliasable` result more fine-grained.

Instead of encoding the aliasability (i.e. whether the cmt is uniquely
writable or not) as an option, now pass back an enum indicating
either: 1. freely-aliasable (thus not uniquely-writable),
2. non-aliasble (thus uniquely writable), or 3. unique but immutable
(and thus not uniquely writable, according to proposal from issue
14270.)

This is all of course a giant hack that will hopefully go away with an
eventually removal of special treatment of `Box<T>` (aka `ty_unique`)
from the compiler.