]> git.lizzy.rs Git - rust.git/log
rust.git
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 agobook: reword timer bit
Darin Morrison [Tue, 31 Mar 2015 20:14:04 +0000 (14:14 -0600)]
book: reword timer bit

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.

9 years agomem_categorization.rs removed `pub` from method called only from this mod.
Felix S. Klock II [Mon, 30 Mar 2015 12:05:12 +0000 (14:05 +0200)]
mem_categorization.rs removed `pub` from method called only from this mod.

9 years agoexpr_use_visitor: Added comment explaining meaning of boolean return value.
Felix S. Klock II [Mon, 30 Mar 2015 12:03:18 +0000 (14:03 +0200)]
expr_use_visitor: Added comment explaining meaning of boolean return value.

9 years agoMucho debug instrumentation.
Felix S. Klock II [Sat, 28 Mar 2015 08:52:47 +0000 (09:52 +0100)]
Mucho debug instrumentation.

9 years agoAuto merge of #23848 - cmr:no-compiler-docs, r=huonw
bors [Mon, 30 Mar 2015 11:35:52 +0000 (11:35 +0000)]
Auto merge of #23848 - cmr:no-compiler-docs, r=huonw

This saves a bunch of a time and will make distributions smaller, as well as
avoiding filling the implementors page with internal garbage. Turn it back on
with `--enable-compiler-docs` if you want them.

(Crates behind the facade are not documented at all)

[breaking-change]

9 years agoFallout where types must be specified.
Niko Matsakis [Tue, 24 Mar 2015 19:45:11 +0000 (15:45 -0400)]
Fallout where types must be specified.

This is due to a [breaking-change] to operators. The primary affected
code is uses of the `Rng` trait where we used to (incorrectly) infer the
right-hand-side type from the left-hand-side, in the case that the LHS
type was a scalar like `i32`. The fix is to add a type annotation like
`x + rng.gen::<i32>()`.

9 years agoDriveby cleanup of the impl for negation, which had some kind of
Niko Matsakis [Tue, 24 Mar 2015 19:36:59 +0000 (15:36 -0400)]
Driveby cleanup of the impl for negation, which had some kind of
surprising casts. This version more obviously corresponds to the builtin
semantics.

9 years agoImplement new type-checking strategy for binary operators. Basically,
Niko Matsakis [Tue, 24 Mar 2015 19:34:59 +0000 (15:34 -0400)]
Implement new type-checking strategy for binary operators. Basically,
the plan is to treat all binary operators as if they were overloaded,
relying on the fact that we have impls for all the builtin scalar
operations (and no more). But then during writeback we clear the
overload if the types correspond to a builtin op.

This strategy allows us to avoid having to know the types of the
operands ahead of time. It also avoids us overspecializing as we did in
the past.

9 years agoAuto merge of #23843 - apasel422:thrads, r=steveklabnik
bors [Mon, 30 Mar 2015 08:49:18 +0000 (08:49 +0000)]
Auto merge of #23843 - apasel422:thrads, r=steveklabnik

9 years agobook: improve a bit of grammar in Method Syntax chapeter
Tshepang Lekhonkhobe [Mon, 30 Mar 2015 05:10:09 +0000 (07:10 +0200)]
book: improve a bit of grammar in Method Syntax chapeter

9 years agoAuto merge of #23838 - kgv:master, r=steveklabnik
bors [Mon, 30 Mar 2015 04:22:38 +0000 (04:22 +0000)]
Auto merge of #23838 - kgv:master, r=steveklabnik

Remove the last sentence about standard io chapter.

Additional Fixes #23760

9 years agoAuto merge of #23837 - wesleywiser:patch-1, r=alexcrichton
bors [Mon, 30 Mar 2015 01:31:34 +0000 (01:31 +0000)]
Auto merge of #23837 - wesleywiser:patch-1, r=alexcrichton

Fixes #23397

9 years agoAuto merge of #23830 - petrochenkov:spellcheck, r=steveklabnik
bors [Sun, 29 Mar 2015 22:39:46 +0000 (22:39 +0000)]
Auto merge of #23830 - petrochenkov:spellcheck, r=steveklabnik

With help of https://github.com/lucasdemarchi/codespell

r? @steveklabnik

9 years agoFix line spacing.
Andrew Hobden [Sun, 29 Mar 2015 22:25:06 +0000 (15:25 -0700)]
Fix line spacing.

9 years agos/THRADS/THREADS/
Andrew Paseltiner [Sun, 29 Mar 2015 21:22:21 +0000 (17:22 -0400)]
s/THRADS/THREADS/

9 years agoFixed wrong name of test module in testing.md
Germano Gabbianelli [Sun, 29 Mar 2015 20:50:51 +0000 (22:50 +0200)]
Fixed wrong name of test module in testing.md

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.

9 years agoRemove about standard io chapter from the book (from arrays-vectors-and-slices chapter)
kgv [Sun, 29 Mar 2015 20:26:31 +0000 (23:26 +0300)]
Remove about standard io chapter from the book (from arrays-vectors-and-slices chapter)

Remove the last sentence about standard io chapter.

Additional Fixes #23760

9 years agoAuto merge of #23820 - sfackler:fast_read_to_end, r=alexcrichton
bors [Sun, 29 Mar 2015 19:47:18 +0000 (19:47 +0000)]
Auto merge of #23820 - sfackler:fast_read_to_end, r=alexcrichton

with_end_to_cap is enormously expensive now that it's initializing
memory since it involves 64k allocation + memset on every call. This is
most noticable when calling read_to_end on very small readers, where the
new version if **4 orders of magnitude** faster.

BufReader also depended on with_end_to_cap so I've rewritten it in its
original form.

As a bonus, converted the buffered IO struct Debug impls to use the
debug builders.

I first came across this in sfackler/rust-postgres#106 where a user reported a 10x performance regression. A call to read_to_end turned out to be the culprit: https://github.com/sfackler/rust-postgres/commit/9cd413d42c287154d6c64cc7913666b0517f35f3.

The new version differs from the old in a couple of ways. The buffer size used is now adaptive. It starts at 32 bytes and doubles each time EOF hasn't been reached up to a limit of 64k. In addition, the buffer is only truncated when EOF or an error has been reached, rather than after every call to read as was the case for the old implementation.

I wrote up a benchmark to compare the old version and new version: https://gist.github.com/sfackler/e979711b0ee2f2063462

It tests a couple of different cases: a high bandwidth reader, a low bandwidth reader, and a low bandwidth reader that won't return more than 10k per call to `read`. The high bandwidth reader should be analagous to use cases when reading from e.g. a `BufReader` or `Vec`, and the low bandwidth readers should be analogous to reading from something like a `TcpStream`.

Of special note, reads from a high bandwith reader containing 4 bytes are now *4,495 times faster*.
```
~/foo ❯ cargo bench
   Compiling foo v0.0.1 (file:///home/sfackler/foo)
     Running target/release/foo-7498d7dd7faecf5c

running 13 tests
test test_new ... ignored
test new_delay_4      ... bench:    230768 ns/iter (+/- 14812)
test new_delay_4_cap  ... bench:    231421 ns/iter (+/- 7211)
test new_delay_5m     ... bench:  14495370 ns/iter (+/- 4008648)
test new_delay_5m_cap ... bench:  73127954 ns/iter (+/- 59908587)
test new_nodelay_4    ... bench:        83 ns/iter (+/- 2)
test new_nodelay_5m   ... bench:  12527237 ns/iter (+/- 335243)
test std_delay_4      ... bench:    373095 ns/iter (+/- 12613)
test std_delay_4_cap  ... bench:    374190 ns/iter (+/- 19611)
test std_delay_5m     ... bench:  17356012 ns/iter (+/- 15906588)
test std_delay_5m_cap ... bench: 883555035 ns/iter (+/- 205559857)
test std_nodelay_4    ... bench:    144937 ns/iter (+/- 2448)
test std_nodelay_5m   ... bench:  16095893 ns/iter (+/- 3315116)

test result: ok. 0 passed; 0 failed; 1 ignored; 12 measured
```

r? @alexcrichton

9 years agoFix extremely small stability bars on docs page
Wesley Wiser [Sun, 29 Mar 2015 19:14:02 +0000 (15:14 -0400)]
Fix extremely small stability bars on docs page

Fixes #23397

9 years agoFix trailing whitespace. Whoops!
Andrew Hobden [Sun, 29 Mar 2015 18:06:38 +0000 (11:06 -0700)]
Fix trailing whitespace. Whoops!

9 years agoUpdate `std::error` example
Andrew Hobden [Sun, 29 Mar 2015 17:03:49 +0000 (10:03 -0700)]
Update `std::error` example

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.

9 years agoAuto merge of #23816 - frewsxcv:fromiterator-example, r=Manishearth
bors [Sun, 29 Mar 2015 16:54:40 +0000 (16:54 +0000)]
Auto merge of #23816 - frewsxcv:fromiterator-example, r=Manishearth

9 years agoAdd an example for FromIterator::from_iter
Corey Farwell [Sat, 28 Mar 2015 21:28:58 +0000 (17:28 -0400)]
Add an example for FromIterator::from_iter

9 years agoAuto merge of #23831 - Manishearth:rollup, r=Manishearth
bors [Sun, 29 Mar 2015 14:02:28 +0000 (14:02 +0000)]
Auto merge of #23831 - Manishearth:rollup, r=Manishearth

- Successful merges: #23811, #23814, #23817, #23821, #23829
- Failed merges:

9 years agoRollup merge of #23829 - huachaohuang:master, r=Manishearth
Manish Goregaokar [Sun, 29 Mar 2015 12:52:16 +0000 (18:22 +0530)]
Rollup merge of #23829 - huachaohuang:master, r=Manishearth

9 years agoRollup merge of #23821 - nicholasbishop:bishop-slice-iter-typo-fix, r=alexcrichton
Manish Goregaokar [Sun, 29 Mar 2015 12:52:16 +0000 (18:22 +0530)]
Rollup merge of #23821 - nicholasbishop:bishop-slice-iter-typo-fix, r=alexcrichton

9 years agoRollup merge of #23817 - phildawes:master, r=alexcrichton
Manish Goregaokar [Sun, 29 Mar 2015 12:52:16 +0000 (18:22 +0530)]
Rollup merge of #23817 - phildawes:master, r=alexcrichton

Hello! I noticed that the email address in AUTHORS.txt doesn't point to my home email. Could somebody merge this patch to correct it please?

Thanks very much!

9 years agoRollup merge of #23814 - steveklabnik:gh23320, r=alexcrichton
Manish Goregaokar [Sun, 29 Mar 2015 12:52:15 +0000 (18:22 +0530)]
Rollup merge of #23814 - steveklabnik:gh23320, r=alexcrichton

Fixes #23320

9 years agoRollup merge of #23811 - alexcrichton:libc-stable, r=Manishearth
Manish Goregaokar [Sun, 29 Mar 2015 12:52:15 +0000 (18:22 +0530)]
Rollup merge of #23811 - alexcrichton:libc-stable, r=Manishearth

Right now the `std::isize::BYTES` typedef is `#[unstable]`, but liblibc is using
this, preventing it from compiling on stable Rust.

9 years agoAuto merge of #23809 - cmr:issue-21310, r=Manishearth
bors [Sun, 29 Mar 2015 11:12:26 +0000 (11:12 +0000)]
Auto merge of #23809 - cmr:issue-21310, r=Manishearth

This isn't really possible to test in an automatic way, since the only traits
you can negative impl are `Send` and `Sync`, and the implementors page for
those only exists in libstd.

Closes #21310

9 years agoFix typo
Huachao Huang [Sun, 29 Mar 2015 10:22:01 +0000 (18:22 +0800)]
Fix typo

9 years agomk: don't build docs for internal or behind-the-facade crates in beta/stable
Corey Richardson [Sat, 28 Mar 2015 03:01:19 +0000 (23:01 -0400)]
mk: don't build docs for internal or behind-the-facade crates in beta/stable

This saves a bunch of a time and will make distributions smaller, as well as
avoiding filling the implementors page with internal garbage. Turn it back on
with `--enable-compiler-docs` if you want compiler docs during development.

Crates behind the facade are only documented on nightly/dev builds (where they
can be used).

[breaking-change]

Closes #23772
Closes #21297

9 years agoAuto merge of #23787 - steveklabnik:gh23760, r=alexcrichton
bors [Sun, 29 Mar 2015 08:14:30 +0000 (08:14 +0000)]
Auto merge of #23787 - steveklabnik:gh23760, r=alexcrichton

This was originally used to set up the guessing game, but that no longer
exists. This version uses `old_io`, and updating it involves talking
about `&mut` and such, which we haven't covered yet. So, for now, let's
just remove it.

Fixes #23760

9 years agoFix massive performance issue in read_to_end
Steven Fackler [Sun, 29 Mar 2015 01:47:29 +0000 (18:47 -0700)]
Fix massive performance issue in read_to_end

with_end_to_cap is enormously expensive now that it's initializing
memory since it involves 64k allocation + memset on every call. This is
most noticable when calling read_to_end on very small readers, where the
new version if **4 orders of magnitude** faster.

BufReader also depended on with_end_to_cap so I've rewritten it in its
original form.

As a bonus, converted the buffered IO struct Debug impls to use the
debug builders.

Fixes #23815

9 years agoAuto merge of #23810 - sfackler:debug-collections, r=alexcrichton
bors [Sun, 29 Mar 2015 05:21:29 +0000 (05:21 +0000)]
Auto merge of #23810 - sfackler:debug-collections, r=alexcrichton

The collections debug helpers no longer prefix output with the
collection name, in line with the current conventions for Debug
implementations. Implementations that want to preserve the current
behavior can simply add a `try!(write!(fmt, "TypeName "));` at the
beginning of the `fmt` method.

[breaking-change]

9 years agoOops fix output examples
Steven Fackler [Sat, 28 Mar 2015 22:55:02 +0000 (15:55 -0700)]
Oops fix output examples

9 years agoAuto merge of #23819 - pnkfelix:kill-unsafe-dtor, r=pnkfelix
bors [Sun, 29 Mar 2015 02:33:27 +0000 (02:33 +0000)]
Auto merge of #23819 - pnkfelix:kill-unsafe-dtor, r=pnkfelix

Port of pcwalton removal of `#[unsafe_destructor]` check.

Earlier commits impose rules on lifetimes that make generic destructors safe; thus we no longer need the `#[unsafe_destructor]` attribute nor its associated check.

----

So remove the check for the unsafe_destructor attribute.

And remove outdated compile-fail tests from when lifetime-parameteric dtors were disallowed/unsafe.

In addition, when one uses the attribute without the associated feature, report that the attribute is deprecated.

However, I do not think this is a breaking-change, because the attribute and feature are still currently accepted by the compiler. (After the next snapshot that has this commit, we can remove the feature itself and the attribute as well.)

----

I consider this to:

Fix #22196

(technically there is still the post snapshot work of removing the last remnants of the feature and the attribute, but the ticket can still be closed in my opinion).

9 years agoFix typo in docstring for slice
Nicholas Bishop [Sun, 29 Mar 2015 02:06:42 +0000 (22:06 -0400)]
Fix typo in docstring for slice