Commit Graph

40565 Commits

Author SHA1 Message Date
Alex Crichton
890f0ab10a 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]
2015-03-31 15:49:10 -07:00
Alex Crichton
1829974735 rollup merge of #23704: hirschenberger/simd-intdiv-ice
Fixes #23339
2015-03-31 15:49:10 -07:00
Aaron Turon
b9ab5fe7c2 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.
2015-03-31 15:22:21 -07:00
Alex Crichton
71982aa657 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
2015-03-31 14:46:11 -07:00
Steve Klabnik
e48c7c61eb Fix spelling 2015-03-31 17:44:45 -04:00
Alex Crichton
608fff8582 rustc: Remove old_orphan_check entirely 2015-03-31 13:41:19 -07:00
Alex Crichton
5cf126ae2f 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]
2015-03-31 13:39:14 -07:00
Steve Klabnik
d9a6e86275 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.
2015-03-31 16:19:52 -04:00
Darin Morrison
9ba7974b35 book: reword timer bit 2015-03-31 14:17:13 -06:00
Steve Klabnik
cf5616242a Fix up iterator documentation with regards to for loop sugar
Fixes #23851
2015-03-31 14:55:25 -04:00
bors
d754722a04 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.
2015-03-31 18:26:20 +00:00
Aaron Turon
9fc51efe33 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]
2015-03-31 11:24:38 -07:00
Alex Crichton
03c2f33699 rollup merge of #23669: steveklabnik/doc_std_borrow 2015-03-31 10:15:27 -07:00
Alex Crichton
5d0beb7d85 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
2015-03-31 10:15:26 -07:00
bors
80bf31dd51 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
2015-03-31 14:50:46 +00:00
Aaron Turon
232424d995 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]
2015-03-31 07:50:25 -07:00
Corey Farwell
5872ae4a7a Indicate select! is code-like 2015-03-31 10:32:53 -04:00
bors
b3317d6891 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:
2015-03-31 05:47:35 +00:00
Steve Klabnik
fe8a660407 Last docs for std::env 2015-03-31 00:19:31 -04:00
Manish Goregaokar
db76327ef6 Rollup merge of #23874 - cmr:no-compiler-docs, r=alexcrichton
r? @alexcrichton
2015-03-31 09:04:39 +05:30
Manish Goregaokar
7afc7d3e35 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.
2015-03-31 09:04:39 +05:30
Manish Goregaokar
57938041c1 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]
2015-03-31 09:04:38 +05:30
Manish Goregaokar
464c18ce9c Rollup merge of #23865 - seanmonstar:into-cow, r=alexcrichton
r? @aturon
2015-03-31 09:04:38 +05:30
Manish Goregaokar
8225a1cf90 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
2015-03-31 09:04:38 +05:30
Manish Goregaokar
b4457fb8a2 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.
2015-03-31 09:04:38 +05:30
Manish Goregaokar
2c0329cfa8 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
2015-03-31 09:04:37 +05:30
Manish Goregaokar
e76b412763 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.
2015-03-31 09:04:37 +05:30
Manish Goregaokar
a4da0d83d0 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"
2015-03-31 09:04:37 +05:30
Manish Goregaokar
4038593228 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.
2015-03-31 09:04:37 +05:30
Manish Goregaokar
8410788a67 Rollup merge of #23826 - richo:note-print-macro, r=alexcrichton
cc #23818
2015-03-31 09:04:37 +05:30
Manish Goregaokar
470996a749 Rollup merge of #23813 - steveklabnik:gh19733, r=cmr
Fixes #19733
2015-03-31 09:04:36 +05:30
Manish Goregaokar
83d3503012 Rollup merge of #23558 - steveklabnik:explain_elision, r=gankro 2015-03-31 09:04:36 +05:30
Steve Klabnik
edc096d820 Document std::borrow with examples 2015-03-30 23:12:38 -04:00
Camille Roussel
a78d3832ed Update lib.rs
Removed duplicate words
2015-03-30 18:52:08 -07:00
Huon Wilson
606f50c46d 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
2015-03-31 12:16:42 +11:00
Sean McArthur
e17f4fc1d4 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]
2015-03-30 18:08:58 -07:00
Alex Crichton
f19e763e08 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]
2015-03-30 16:44:11 -07:00
Corey Richardson
b314fedc4a mk: build and distribute facade crates unconditionally (for now) 2015-03-30 19:18:47 -04:00
Kevin Butler
2a89d695f4 libcore: Ensure min and max functions are consistent for equal inputs 2015-03-30 23:48:26 +01:00
ray glover
5dc23be5b1 rustdoc: output stderr on doc-test fail
Forward output from stderr when a test executable panics/fails.
2015-03-30 23:42:41 +01:00
Tshepang Lekhonkhobe
1026b06442 book: make Builder Pattern example more complete 2015-03-31 00:26:03 +02:00
Corey Richardson
31a5285200 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
2015-03-30 18:16:25 -04:00
Emeliov Dmitrii
df65f59fe9 replace deprecated as_slice() 2015-03-31 01:03:13 +03:00
Alex Crichton
acd48a2b3e 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]
2015-03-30 14:08:40 -07:00
Richo Healey
6e8693b297 std: Add a note about the print! macro and output buffering 2015-03-30 13:55:15 -07:00
Sean McArthur
4c1f5bd6dc convert: add Into<Cow> impls for &str and String 2015-03-30 12:07:16 -07:00
Julian Viereck
085bcfa37e Second attempt to fix #23713 based on follow-up comments in #23791. 2015-03-30 21:00:09 +02:00
Steve Klabnik
8f0c952499 Explain why 'elision' 2015-03-30 14:49:22 -04:00
bors
6cf3b0b74a Auto merge of #23861 - Manishearth:rollup, r=Manishearth
- Successful merges: #23746, #23836, #23852
- Failed merges: #23855
2015-03-30 17:16:25 +00:00
Steve Klabnik
6c0314a38a Make note of noalias in unsafe reference section
Fixes #19733
2015-03-30 12:36:10 -04:00