Commit Graph

36711 Commits

Author SHA1 Message Date
bors
a3b13610c5 Auto merge of #23434 - alexcrichton:misc-stab, r=aturon
Now that we check the stability of fields, the fields of this struct should also
be stable.
2015-03-25 18:59:00 +00:00
Erick Tryzelaar
92e72ee15e Speed up reading/writing slices with #[inline]
When built with `rustc -O`:

before:

test bench_read_slice  ... bench:        68 ns/iter (+/- 56)
test bench_read_vec    ... bench:        78 ns/iter (+/- 21)
test bench_write_slice ... bench:       133 ns/iter (+/- 46)
test bench_write_vec   ... bench:       308 ns/iter (+/- 69)

after:

test bench_read_slice  ... bench:        32 ns/iter (+/- 10)
test bench_read_vec    ... bench:        32 ns/iter (+/- 8)
test bench_write_slice ... bench:        53 ns/iter (+/- 12)
test bench_write_vec   ... bench:       247 ns/iter (+/- 172)
2015-03-25 09:07:46 -07:00
Manish Goregaokar
e962a1d51e Rollup merge of #23702 - dotdash:match_reass, r=eddyb
The reassignment checker effectively only checks whether the last
assignment in a body affects the discriminant, but it should of course
check all the assignments.

Fixes #23698
2015-03-25 19:44:32 +05:30
Manish Goregaokar
2354fc9fac Rollup merge of #23693 - semarie:openbsd-pathbuf-new, r=nikomatsakis
`PathBuf::new` have been changed. Use `PathBuf::from` instead.

Apply the same change for freebsd too, while here.
2015-03-25 19:44:08 +05:30
Manish Goregaokar
4283b2ab50 Rollup merge of #23692 - yjh0502:fix/simd-overflow, r=pnkfelix
Disable overflow checking on SIMD operations, fix #23037
2015-03-25 19:44:08 +05:30
Manish Goregaokar
5a5845dc01 Rollup merge of #23684 - tamird:ios-fallout, r=alexcrichton
r? @aturon cc @alexcrichton
2015-03-25 19:44:08 +05:30
Björn Steinbrink
cc259fb6c3 Always properly copy values into bindings when mutating the match discriminant
The reassignment checker effectively only checks whether the last
assignment in a body affects the discriminant, but it should of course
check all the assignments.

Fixes #23698
2015-03-25 14:50:04 +01:00
Manish Goregaokar
5535767228 Rollup merge of #23664 - bluss:std-docs, r=steveklabnik
Main motivation was to update docs for the removal or "demotion" of certain extension traits. The update to the slice docs was larger, since the text was largely outdated.
2015-03-25 17:12:13 +05:30
Manish Goregaokar
b6783e6b46 Rollup merge of #23617 - steveklabnik:gh23564, r=Manishearth
Fixes #23564
2015-03-25 17:12:13 +05:30
Sae-bom Kim
c66a2b7393 Ignore some tests on aarch64 2015-03-25 18:17:33 +09:00
bors
928e2e2394 Auto merge of #23670 - cmr:vec-push-slowpath, r=pcwalton
Makes Vec::push considerably smaller: 25 instructions, rather than 42, on
x86_64.
2015-03-25 07:47:30 +00:00
Sébastien Marie
eefb8e2065 unbreak bitrig/openbsd build after 8389253d
`PathBuf::new` have been changed. Use `PathBuf::from` instead.

Apply the same change for freebsd too, while here.
2015-03-25 08:44:35 +01:00
Jihyun Yu
1663665be0 Fix ICE on SIMD overflow checking
Disable overflow checking on SIMD operations, fix #23037
2015-03-25 15:17:10 +09:00
Camille Roussel
053d58e180 Update pointers.md 2015-03-24 21:46:09 -07:00
Tamir Duberstein
eb5ed10330 [iOS] Fallout from 8389253 2015-03-24 18:50:38 -07:00
Alex Crichton
3021d4c564 Test fixes and rebase conflicts, round 2 2015-03-24 18:37:16 -07:00
Alex Crichton
db2c3ba0cf rollup merge of #23674: nagisa/fallout-1 2015-03-24 16:53:38 -07:00
Alex Crichton
efaef24304 Test fixes and rebase conflicts, round 1 2015-03-24 16:48:50 -07:00
Gleb Kozyrev
3577555742 Implement AsRef and AsMut for fixed-sized arrays 2015-03-25 01:37:08 +02:00
Simonas Kazlauskas
492f07bbda Fix some fallout in librustdoc 2015-03-25 00:39:29 +02:00
Alex Crichton
19cd00094c rollup merge of #23671: steveklabnik/doc_std_clone 2015-03-24 15:27:16 -07:00
Alex Crichton
3b13b9c2b4 rollup merge of #23638: pnkfelix/fsk-reject-specialized-drops
Reject specialized Drop impls.

See Issue #8142 for discussion.

This makes it illegal for a Drop impl to be more specialized than the original item.

So for example, all of the following are now rejected (when they would have been blindly accepted before):

```rust
struct S<A> { ... };
impl Drop for S<i8> { ... } // error: specialized to concrete type

struct T<'a> { ... };
impl Drop for T<'static> { ... } // error: specialized to concrete region

struct U<A> { ... };
impl<A:Clone> Drop for U<A> { ... } // error: added extra type requirement

struct V<'a,'b>;
impl<'a,'b:a> Drop for V<'a,'b> { ... } // error: added extra region requirement
```

Due to examples like the above, this is a [breaking-change].

(The fix is to either remove the specialization from the `Drop` impl, or to transcribe the requirements into the struct/enum definition; examples of both are shown in the PR's fixed to `libstd`.)

----

This is likely to be the last thing blocking the removal of the `#[unsafe_destructor]` attribute.

Fix #8142
Fix #23584
2015-03-24 15:27:14 -07:00
Alex Crichton
91b633aa03 rollup merge of #23546: alexcrichton/hyphens
The compiler will now issue a warning for crates that have syntax of the form
`extern crate "foo" as bar`, but it will still continue to accept this syntax.
Additionally, the string `foo-bar` will match the crate name `foo_bar` to assist
in the transition period as well.

This patch will land hopefully in tandem with a Cargo patch that will start
translating all crate names to have underscores instead of hyphens.

cc #23533
2015-03-24 14:56:00 -07:00
Alex Crichton
eb2f1d925f rustc: Add support for extern crate foo as bar
The compiler will now issue a warning for crates that have syntax of the form
`extern crate "foo" as bar`, but it will still continue to accept this syntax.
Additionally, the string `foo-bar` will match the crate name `foo_bar` to assist
in the transition period as well.

This patch will land hopefully in tandem with a Cargo patch that will start
translating all crate names to have underscores instead of hyphens.

cc #23533
2015-03-24 14:55:15 -07:00
Alex Crichton
4c2ddb33ad std: Reexport std::rt::unwind::try in std::thread
This commit provides a safe, but unstable interface for the `try` functionality
of running a closure and determining whether it panicked or not.

There are two primary reasons that this function was previously marked `unsafe`:

1. A vanilla version of this function exposes the problem of exception safety by
   allowing a bare try/catch in the language. It is not clear whether this
   concern should be directly tied to `unsafe` in Rust at the API level. At this
   time, however, the bounds on `ffi::try` require the closure to be both
   `'static` and `Send` (mirroring those of `thread::spawn`). It may be possible
   to relax the bounds in the future, but for now it's the level of safety that
   we're willing to commit to.

2. Panicking while panicking will leak resources by not running destructors.
   Because panicking is still controlled by the standard library, safeguards
   remain in place to prevent this from happening.

The new API is now called `catch_panic` and is marked as `#[unstable]` for now.
2015-03-24 14:53:10 -07:00
Alex Crichton
5ed8733ea3 rollup merge of #23668: alexcrichton/io-zero
This commit alters the behavior of the `Read::read_to_end()` method to zero all
memory instead of passing an uninitialized buffer to `read`. This change is
motivated by the [discussion on the internals forum][discuss] where the
conclusion has been that the standard library will not expose uninitialized
memory.

[discuss]: http://internals.rust-lang.org/t/uninitialized-memory/1652

Closes #20314
2015-03-24 14:50:48 -07:00
Alex Crichton
020efc78f1 rollup merge of #23662: steveklabnik/gh23421
I assume since both shifts say the same thing, I should fix both of them, but then I realized I don't strictly know about left shift.

Fixes #23421

r? @pnkfelix
2015-03-24 14:50:48 -07:00
Alex Crichton
8a0bb42813 rollup merge of #23661: steveklabnik/any_docs
http://www.reddit.com/r/rust/comments/304q00/type_information_in_rust/cpp43lu
2015-03-24 14:50:48 -07:00
Alex Crichton
5c74ed912b rollup merge of #23659: GBGamer/master
For other permissions beside USR permissions, we need these constants.

fixes #23658
2015-03-24 14:50:47 -07:00
Alex Crichton
37d57e76fc rollup merge of #23646: steveklabnik/doc_file
This is pretty basic, but it's nice to have something.

r? @alexcrichton
2015-03-24 14:50:47 -07:00
Alex Crichton
a1d2e62c1f rollup merge of #23630: nrc/coerce-tidy
See notes on the first commit

Closes #18601

r? @nikomatsakis

cc @eddyb
2015-03-24 14:50:46 -07:00
Alex Crichton
6da0b9dedb rollup merge of #23629: liammonahan/master
Found a small typo on the Rust book "ownership" page.

Best,
Liam

r? @steveklabnik
2015-03-24 14:50:45 -07:00
Alex Crichton
61063459bb rollup merge of #23592: alexcrichton/tweak-at-exit
There have been some recent panics on the bots and this commit is an attempt to
appease them. Previously it was considered invalid to run `rt::at_exit` after
the handlers had already started running. Due to the multithreaded nature of
applications, however, it is not always possible to guarantee this. For example
[this program][ex] will show off the abort.

[ex]: https://gist.github.com/alexcrichton/56300b87af6fa554e52d

The semantics of the `rt::at_exit` function have been modified as such:

* It is now legal to call `rt::at_exit` at any time. The return value now
  indicates whether the closure was successfully registered or not. Callers must
  now decide what to do with this information.
* The `rt::at_exit` handlers will now be run for a fixed number of iterations.
  Common cases (such as the example shown) may end up registering a new handler
  while others are running perhaps once or twice, so this common condition is
  covered by re-running the handlers a fixed number of times, after which new
  registrations are forbidden.

Some usage of `rt::at_exit` was updated to handle these new semantics, but
deprecated or unstable libraries calling `rt::at_exit` were not updated.
2015-03-24 14:50:45 -07:00
Alex Crichton
f5b65c5c22 rollup merge of #23573: steveklabnik/doc_associated_types 2015-03-24 14:50:44 -07:00
Alex Crichton
8f6c879d2a rollup merge of #23282: nikomatsakis/fn-trait-inheritance
The primary motivation here is to sidestep #19032 -- for a time, I thought that we should improve coherence or otherwise extend the language, but I now think that any such changes will require more time to bake. In the meantime, inheritance amongst the fn traits is both logically correct *and* a simple solution to that obstacle. This change introduces inheritance and modifies the compiler so that it can properly generate impls for closures and fns.

Things enabled by this PR (but not included in this PR):

1. An impl of `FnMut` for `&mut F` where `F : FnMut` (https://github.com/rust-lang/rust/issues/23015).
2. A better version of `Thunk` I've been calling `FnBox`.

I did not include either of these in the PR because:

1. Adding the impls in 1 currently induces a coherence conflict with the pattern trait. This is interesting and merits some discussion.
2. `FnBox` deserves to be a PR of its own.

The main downside to this design is (a) the need to write impls by hand; (b) the possibility of implementing `FnMut` with different semantics from `Fn`, etc. Point (a) is minor -- in particular, it does not affect normal closure usage -- and could be addressed in the future in many ways (better defaults; convenient macros; specialization; etc). Point (b) is unfortunate but "just a bug" from my POV, and certainly not unique to these traits (c.f. Copy/Clone, PartialEq/Eq, etc). (Until we lift the feature-gate on implementing the Fn traits, in any case, there is room to correct both of these if we find a nice way.)

Note that I believe this change is reversible in the future if we decide on another course of action, due to the feature gate on implementing the `Fn` traits, though I do not (currently) think we should reverse it.

Fixes #18835.

r? @nrc
2015-03-24 14:50:44 -07:00
Erick Tryzelaar
9cabe273d3 syntax: Update #[derive(...)] to work with phantom and associated types
Closes #7671, #19839
2015-03-24 14:43:26 -07:00
Nick Cameron
7e3ee02006 Bug fixes 2015-03-25 10:37:03 +13:00
Felix S. Klock II
1955e05267 Unit tests for Issue 8142, collected into one file. 2015-03-24 22:27:24 +01:00
Felix S. Klock II
5b2e8693e4 Reject specialized Drop impls.
See Issue 8142 for discussion.

This makes it illegal for a Drop impl to be more specialized than the
original item.

So for example, all of the following are now rejected (when they would
have been blindly accepted before):

```rust
struct S<A> { ... };
impl Drop for S<i8> { ... } // error: specialized to concrete type

struct T<'a> { ... };
impl Drop for T<'static> { ... } // error: specialized to concrete region

struct U<A> { ... };
impl<A:Clone> Drop for U<A> { ... } // error: added extra type requirement

struct V<'a,'b>;
impl<'a,'b:a> Drop for V<'a,'b> { ... } // error: added extra region requirement
```

Due to examples like the above, this is a [breaking-change].

(The fix is to either remove the specialization from the `Drop` impl,
or to transcribe the requirements into the struct/enum definition;
examples of both are shown in the PR's fixed to `libstd`.)

----

This is likely to be the last thing blocking the removal of the
`#[unsafe_destructor]` attribute.

Includes two new error codes for the new dropck check.

Update run-pass tests to accommodate new dropck pass.

Update tests and docs to reflect new destructor restriction.

----

Implementation notes:

We identify Drop impl specialization by not being as parametric as the
struct/enum definition via unification.

More specifically:

 1. Attempt unification of a skolemized instance of the struct/enum
    with an instance of the Drop impl's type expression where all of
    the impl's generics (i.e. the free variables of the type
    expression) have been replaced with unification variables.

 2. If unification fails, then reject Drop impl as specialized.

 3. If unification succeeds, check if any of the skolemized
    variables "leaked" into the constraint set for the inference
    context; if so, then reject Drop impl as specialized.

 4. Otherwise, unification succeeded without leaking skolemized
    variables: accept the Drop impl.

We identify whether a Drop impl is injecting new predicates by simply
looking whether the predicate, after an appropriate substitution,
appears on the struct/enum definition.
2015-03-24 22:27:23 +01:00
Felix S. Klock II
290c8de0a6 Added T:Send bound to JoinGuard<T> to avoid specialized Drop impl. 2015-03-24 22:27:23 +01:00
Felix S. Klock II
5f57fd591d Added T:Send bound to Queue<T> to avoid specialized Drop impl. 2015-03-24 22:27:23 +01:00
Felix S. Klock II
123b5c124e Added T:Send bound to Packet<T> to avoid specialized Drop impl. 2015-03-24 22:27:23 +01:00
Felix S. Klock II
018eeb76f0 added T:Send bound to Mutex<T> to avoid specialized Drop impl. 2015-03-24 22:27:23 +01:00
Felix S. Klock II
1e71d2e71c Added W: Writer bound to BufferedWriter<W> to avoid specialized Drop impl. 2015-03-24 22:27:23 +01:00
Felix S. Klock II
1249e60891 Added T:Send bound to Queue<T> to avoid specialized Drop impl. 2015-03-24 22:27:23 +01:00
Felix S. Klock II
26a79e3c20 Added Write bounds to avoid a specialized Drop impl for BufWriter. 2015-03-24 22:27:22 +01:00
Felix S. Klock II
0adab507bb Added T:Send bound to sync::mpsc::Receiver and sync::mpsc::Sender.
This was necessary to avoid specialized `Drop` impls for the two structs.
2015-03-24 22:27:22 +01:00
Felix S. Klock II
5fa4b4c4af Remove unnecessary bounds from Drop impl for Arc and arc::Weak and
one of the helper method impls.
2015-03-24 22:27:22 +01:00
Erick Tryzelaar
d4701bd4fb test: silence a warning 2015-03-24 14:26:58 -07:00
Ulrik Sverdrup
547a48e193 collections: Update docs for slice since SliceExt was removed
A lot has changed since this doc text was last touched up, and this is
just a minor edit. I remove the trait section entirely since we don't
use extension traits that much anymore, so there are no significant
trait hilights for this module.
2015-03-24 22:23:13 +01:00
Ulrik Sverdrup
00e14f1622 core: Update docs for StrExt demotion in libstd
Main access point of .split() and other similar methods are not using
the StrExt trait anymore, so update the libcore docs to reflect this
(because these docs are visible in libstd API documentation).
2015-03-24 22:21:38 +01:00
Ulrik Sverdrup
227d30414c std: Update docs for removal of ReadExt, WriteExt 2015-03-24 22:20:35 +01:00
Erick Tryzelaar
a17f5563b8 syntax: Allow quotes to insert path 2015-03-24 14:18:39 -07:00
Erick Tryzelaar
4ec07ed29a syntax: Allow where strings to be parsed independent from generics
This allows quasiquoting to insert where clauses.
2015-03-24 14:18:39 -07:00
Erick Tryzelaar
c3f4fba9cc syntax: add {trait_item,impl_item,where_clause}_to_string 2015-03-24 14:18:39 -07:00
Corey Richardson
0e838f749f libcollections: move Vec::push slow path out
Makes Vec::push considerably smaller: 25 instructions, rather than 42, on
x86_64.
2015-03-24 17:12:58 -04:00
Nick Cameron
e7122a5a09 Change lint names to plurals 2015-03-25 10:06:13 +13:00
Nick Cameron
dc206a91c8 Add tests 2015-03-25 10:06:13 +13:00
Nick Cameron
088cd566ea Remove the UnusedCasts lint 2015-03-25 10:06:13 +13:00
Nick Cameron
9374c216f6 Minor refactoring in coercion.rs 2015-03-25 10:06:13 +13:00
Nick Cameron
95602a759d Add trivial cast lints.
This permits all coercions to be performed in casts, but adds lints to warn in those cases.

Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference.

[breaking change]

* Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed.
* The unused casts lint has gone.
* Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are:
- You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_`
- Casts do not influence inference of integer types. E.g., the following used to type check:

```
let x = 42;
let y = &x as *const u32;
```

Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information:

```
let x: u32 = 42;
let y = &x as *const u32;
```
2015-03-25 10:03:57 +13:00
Steve Klabnik
406524682b An example for clone 2015-03-24 16:58:08 -04:00
Alex Crichton
4ccf374b4a std: Zero memory when calling read_to_end()
This commit alters the behavior of the `Read::read_to_end()` method to zero all
memory instead of passing an uninitialized buffer to `read`. This change is
motivated by the [discussion on the internals forum][discuss] where the
conclusion has been that the standard library will not expose uninitialized
memory.

[discuss]: http://internals.rust-lang.org/t/uninitialized-memory/1652

Closes #20314
2015-03-24 13:42:19 -07:00
Steve Klabnik
528a5e2bae Add examples for std::ascii
Also tweaked a few things.
2015-03-24 15:47:47 -04:00
Alex Crichton
d252d0ad54 Test fixes and rebase conflicts, round 4 2015-03-24 10:23:47 -07:00
Steve Klabnik
f2e0810cb8 correct reference wrt shifts
Fixes #23421
2015-03-24 12:58:50 -04:00
Steve Klabnik
0031d57a21 Clean up Any's title line
http://www.reddit.com/r/rust/comments/304q00/type_information_in_rust/cpp43lu
2015-03-24 12:15:49 -04:00
Steve Klabnik
f2996c0c0e Add basic information about associated types 2015-03-24 12:10:01 -04:00
Steve Klabnik
a34e87f3ab Add Examples for File
This is pretty basic, but it's nice to have something.
2015-03-24 10:52:46 -04:00
Nicholas Mazzuca
a9b31969dc Add the other S_I(RWX)(GRP/OTH) for posix creat 2015-03-24 03:25:48 -07:00
Alex Crichton
c5c3de0cf4 Test fixes and rebase conflicts, round 3 2015-03-23 22:52:21 -07:00
Liam Monahan
37dc801fe6 Improve the wording of the example section description on the ownership page
to make it more clear.
2015-03-23 21:19:54 -04:00
Alex Crichton
253992eb38 rollup merge of #23653: dhuseby/bitrig-stage0-c64d671
@alexcrichton this adds the latest Bitrig snapshot.  Please upload the corresponding snapshot: https://github.com/dhuseby/rust-cross-bitrig/blob/master/snapshots/rust-stage0-2015-03-17-c64d671-bitrig-x86_64-41de2c7a69a1ac648d3fa3b65e96a29bdc122163.tar.bz2
2015-03-23 17:13:39 -07:00
Alex Crichton
1588caca61 rollup merge of #23652: alexcrichton/stabilize-hasher-finish
This commit enables writing a stable implementation of the `Hasher` trait as
well as actually calculating the hash of a vlaue in a stable fashion. The
signature is stabilized as-is.
2015-03-23 17:13:38 -07:00
Alex Crichton
7380b6ffc8 rollup merge of #23645: steveklabnik/gh23642
Fixes #23642
2015-03-23 17:13:38 -07:00
Alex Crichton
6a44f24b9e rollup merge of #23644: mbrubeck/doc-edit
PR #23104 moved `is_null` and `offset` to an inherent impl on the raw pointer type.

I'm not sure whether or how it's possible to link to docs for that impl.

r? @steveklabnik
2015-03-23 17:13:37 -07:00
Alex Crichton
29b54387b8 Test fixes and rebase conflicts, round 2 2015-03-23 17:10:19 -07:00
Niko Matsakis
9330bae4bd Fallout from changing fn traits to use inheritance rather than bridge
impls. This is a [breaking-change] (for gated code) in that when you
implement `Fn` (`FnMut`) you must also implement `FnOnce`. This commit
demonstrates how to fix it.
2015-03-23 19:57:30 -04:00
Dave Huseby
3a0c15f3cf adding lastest Bitrig snapshot by hand 2015-03-23 15:58:44 -07:00
Matt Brubeck
3f52d719dc Update docs for ptr module.
PR #23104 moved `is_null` and `offset` to an inherent impl on the raw pointer
type.
2015-03-23 15:57:20 -07:00
bors
28a0b25f42 Auto merge of #23536 - pnkfelix:arith-oflo-shifts, r=nikomatsakis
overflow-checking for rhs of shift operators

Subtask of #22020 ([RFC 560](https://github.com/rust-lang/rfcs/blob/master/text/0560-integer-overflow.md))
2015-03-23 22:43:39 +00:00
Alex Crichton
3112716f12 rollup merge of #23506: alexcrichton/remove-some-deprecated-things
Conflicts:
	src/test/run-pass/deprecated-no-split-stack.rs
2015-03-23 15:27:06 -07:00
Alex Crichton
aea822626f rollup merge of #23503: alexcrichton/fix-ptr-docs
The method with which backwards compatibility was retained ended up leading to
documentation that rustdoc didn't handle well and largely ended up confusing.
2015-03-23 15:26:24 -07:00
Alex Crichton
6e0f1d3984 rollup merge of #23484: alexcrichton/marker-trait-stable
This trait has proven quite useful when defining marker traits to avoid the
semi-confusing `PhantomFn` trait and it looks like it will continue to be a
useful tool for defining these traits.
2015-03-23 15:26:24 -07:00
Alex Crichton
04e667a6b1 Test fixes and rebase conflicts, round 1 2015-03-23 15:18:40 -07:00
Alex Crichton
7d07f70ccb rollup merge of #23383: alexcrichton/fs-create-dir-all
Conflicts:
	src/libstd/fs/mod.rs
2015-03-23 15:18:24 -07:00
Alex Crichton
c608084ff5 rollup merge of #23598: brson/gate
Conflicts:
	src/compiletest/compiletest.rs
	src/libcollections/lib.rs
	src/librustc_back/lib.rs
	src/libserialize/lib.rs
	src/libstd/lib.rs
	src/libtest/lib.rs
	src/test/run-make/rustdoc-default-impl/foo.rs
	src/test/run-pass/env-home-dir.rs
2015-03-23 15:13:15 -07:00
Alex Crichton
7101ff4513 rollup merge of #23648: steveklabnik/rollup
- Successful merges: #22954, #23119, #23509, #23561, #23590, #23607, #23608, #23618, #23622, #23639, #23641
- Failed merges: #23401
2015-03-23 15:11:15 -07:00
Alex Crichton
fcf2ba794e rollup merge of #23641: steveklabnik/gh23632
Fixes #23632
2015-03-23 15:11:13 -07:00
Alex Crichton
8a15868206 rollup merge of #23640: nagisa/thread-less-weak
This is more portable as far as linux is concerned.
2015-03-23 15:11:12 -07:00
Alex Crichton
5e06ebbfc0 rollup merge of #23639: steveklabnik/gh21305
Fixes #21305

Not sure if we should include more than this here, but it should be good to have at least this.
2015-03-23 15:11:10 -07:00
Alex Crichton
ca7f7cf3d3 rollup merge of #23637: apasel422/iter 2015-03-23 15:11:09 -07:00
Alex Crichton
c7509bb8d8 rollup merge of #23634: WiSaGaN/bugfix/fix_dead_link 2015-03-23 15:11:07 -07:00
Alex Crichton
19510ac70b rollup merge of #23633: tomjakubowski/rustdoc-array-prim
Previously, impls for `[T; n]` were collected in the same place as impls for `[T]` and `&[T]`. This splits them out into their own primitive page in both core and std.
2015-03-23 15:11:06 -07:00
Alex Crichton
28fcdc0df7 rollup merge of #23631: andersk/minstack-dlsym
Linking `__pthread_get_minstack`, even weakly, was causing Debian’s `dpkg-shlibdeps` to detect an unnecessarily strict versioned dependency on libc6.

Closes #23628.
2015-03-23 15:11:05 -07:00
Alex Crichton
ef07e0797f rollup merge of #23622: steveklabnik/gh23196
Fixes #23196
2015-03-23 15:11:03 -07:00
Alex Crichton
b03939bfab rollup merge of #23619: steveklabnik/gh23220
Fixes #23571

I _think_ this is better, but other suggestions welcome too.
2015-03-23 15:11:02 -07:00
Alex Crichton
a78eb53074 rollup merge of #23618: steveklabnik/gh23571
Fixes #23571
2015-03-23 15:11:00 -07:00
Alex Crichton
5a6a90508d rollup merge of #23615: steveklabnik/gh23540
Closes #23540
2015-03-23 15:10:58 -07:00
Alex Crichton
010895e4f2 rollup merge of #23612: dotdash/closure_bloat
For the rust-call ABI, the last function argument is a tuple that gets
untupled for the actual call. For bare functions using this ABI, the
code has access to the tuple, so we need to tuple the arguments again.
But closures can't actually access the tuple. Their arguments map to the
elements in the tuple. So what we currently do is to tuple the arguments
and then immediately untuple them again, which is pretty useless and we
can just omit it.
2015-03-23 15:10:57 -07:00
Alex Crichton
c99970783a rollup merge of #23608: nagisa/refine-cursor-docstring
r? @steveklabnik
2015-03-23 15:10:55 -07:00
Alex Crichton
71c705db02 rollup merge of #23607: mahkoh/cursor
Closes #23599

r? @alexcrichton
2015-03-23 15:10:53 -07:00
Alex Crichton
68fb3acd85 rollup merge of #23604: apasel422/btree
`btree_map::IntoIter` (and `btree_set::IntoIter`) remains, but it is a bit trickier.
2015-03-23 15:10:51 -07:00
Alex Crichton
753efb5042 rollup merge of #23601: nikomatsakis/by-value-index
This is a [breaking-change]. When indexing a generic map (hashmap, etc) using the `[]` operator, it is now necessary to borrow explicitly, so change `map[key]` to `map[&key]` (consistent with the `get` routine). However, indexing of string-valued maps with constant strings can now be written `map["abc"]`.

r? @japaric
cc @aturon @Gankro
2015-03-23 15:10:50 -07:00
Alex Crichton
bed77408df rollup merge of #23580: nikomatsakis/pattern-and-overflow 2015-03-23 15:10:30 -07:00
Alex Crichton
9e347b39f1 rollup merge of #23579: Ms2ger/thread_local-unsafe
Conflicts:
	src/libstd/thread/local.rs
2015-03-23 15:10:13 -07:00
Alex Crichton
88ae218578 rollup merge of #23561: steveklabnik/gh23422
Fixes #23422
2015-03-23 15:09:10 -07:00
Alex Crichton
2153c581ef rollup merge of #23557: aturon/rfc-909
This commit implements [RFC 909](https://github.com/rust-lang/rfcs/pull/909):

The `std::thread_local` module is now deprecated, and its contents are
available directly in `std::thread` as `LocalKey`, `LocalKeyState`, and
`ScopedKey`.

The macros remain exactly as they were, which means little if any code
should break. Nevertheless, this is technically a:

[breaking-change]

Closes #23547
2015-03-23 15:09:09 -07:00
Alex Crichton
b97e1cc28e rollup merge of #23541: aturon/stab-error
This small commit stabilizes the `Error` trait as-is, except that `Send`
and `Debug` are added as constraints. The `Send` constraint is because
most uses of `Error` will be for trait objects, and by default we would
like these objects to be transferrable between threads. The `Debug`
constraint is to ensure that e.g. `Box<Error>` is `Debug`, and because
types that implement `Display` should certainly implement `Debug` in any case.

In the near future we expect to add `Any`-like downcasting features to
`Error`, but this is waiting on some additional
mechanisms (`Reflect`). It will be added before 1.0 via default methods.

[breaking-change]

r? @alexcrichton

Closes #21790
2015-03-23 15:09:08 -07:00
Alex Crichton
fd13400627 rollup merge of #23538: aturon/conversion
Conflicts:
	src/librustc_back/rpath.rs
2015-03-23 15:09:05 -07:00
Alex Crichton
c77af69a37 rollup merge of #23536: pnkfelix/arith-oflo-shifts
overflow-checking for rhs of shift operators

Subtask of #22020 ([RFC 560](https://github.com/rust-lang/rfcs/blob/master/text/0560-integer-overflow.md))
2015-03-23 15:08:17 -07:00
Alex Crichton
68cf9e09c2 rollup merge of #23517: vhbit/ext-socket-options
Continuation of #23380 - added corresponding constants for Windows, Linux, *BSDs

r? @alexcrichton

Alex, can you also cc to a person who can check correctness for Windows as I'm not that confident in header file I've downloaded.
2015-03-23 15:08:15 -07:00
Alex Crichton
0678f0b10c rollup merge of #23515: nikomatsakis/issue-14985-trait-subtyping
Remove incorrect subtyping for `&mut Trait` and introduce coercion for `&mut (Trait+'a)` to `&mut (Trait+'b)` if `'a:'b`.

Fixes #14985.

r? @nrc
2015-03-23 15:08:13 -07:00
Alex Crichton
4f7437647f rollup merge of #23466: woehr/master
This fixes a bug in LLVM IR generation for in-line assembly where Rust would always use the host clobbers instead of target clobbers.

I also took this opportunity to clean/simplify the ```trans_inline_asm``` function.

This is my first Rust pull request; please let me know if I'm missing anything.
2015-03-23 15:08:10 -07:00
Alex Crichton
d3fbc149b3 rollup merge of #23401: tshepang/crates-and-modules-doc-nits
Conflicts:
	src/doc/trpl/crates-and-modules.md
2015-03-23 15:08:01 -07:00
Alex Crichton
e98d4d9589 rollup merge of #23283: brson/rpathfix
Fix regression in -C rpath that causes failures with symlinks

The new `relative_from` method no longer supports the case on unix
where both paths are absolute, which `-C rpath` depended on. This
version fixes the problem by copying the old path_relative_from
function into the rpath module.

Fixes #23140

After experimenting with the new `relative_from` function on `Path` I'm not sure what it's use case is. It no longer even figures out that the relative path from `/foo/bar` to `/foo/baz/qux` is `../baz/qux`.
2015-03-23 15:07:33 -07:00
Alex Crichton
67e516c5c2 rollup merge of #23269: shepmaster/split-not-double-ended
Closes #23262
2015-03-23 15:07:23 -07:00
Alex Crichton
ec1a85a85c rollup merge of #23211: FlaPer87/oibit-send-and-friends
Fixes #23225

r? @nikomatsakis
2015-03-23 15:07:21 -07:00
Alex Crichton
ad41e7cd7a rollup merge of #23119: nikomatsakis/issue-23116-ref-mut
Don't allow upcasting to a supertype in the type of the match discriminant. Fixes #23116.

This is a [breaking-change] in that it closes a type hole that previously existed.

r? @pnkfelix
2015-03-23 15:07:19 -07:00
Alex Crichton
d6054e4771 rollup merge of #22954: ches/docs
Greetings Rustaceans!

I've just been getting acquainted with Rust through the guide. First let me say that it's already in great shape, chapters are kept a good length to be digestible and paced to move the reader along fluidly, so my compliments to contributors!

Along the way I noticed a few minor copy errors, and also a few areas that I thought more subjectively could stand to be improved. My commits here are divided so that minor edits unlikely to be very contentious could be cherry-picked, and then topically on parts that might generate more discussion.

I also have some comments and questions that aren't directly associated with any changes on this branch yet. I'm not sure how you like to triage this sort of thing but I'll present them below and if it's appropriate they could be moved to separate issues or I might be able to help work some of them out within the scope of this PR. Sorry that these are a lot to take in, pretty much everything below here can be digested independently of the current changes in this PR so you could read the rest later 😄

### Questions and Comments

I'll give stable links to doc revisions as of this writing.

1. The [example using `PartialEq` in the Traits chapter][1] is poor—we have no idea how `PartialEq` works at this point in the text (or at any point, AFAICT), so it isn't clear why it won't work as a trait bound in this situation and `Float` almost magically does, with the aid of existing tailor-made identity functions that seem unlikely to be so conveniently available when we encounter a scenario like this in our real-world code.

   This section just seems glossed over, or perhaps content has moved around over time or there's an assumption that implementing equality with `PartialEq` should be covered in the guide eventually so this example will be less foreign. As it stands the text is hard to follow and not very meaningful.
2. I found treatment of the relationship of trait objects to pointers in the *Static and Dynamic Dispatch* chapter unclear. [The "Why Pointers?" section][2] opens with this line:

   > The use of language like "fat pointer" implies that a trait object is always a pointer of some form, but why?

   But the phrase "fat pointer" hasn't been used anywhere before. This is some of the more complex material in the guide, but this section nevertheless feels displaced, not clearly connecting preceding subject matter. Earlier we've covered the internal representation of trait objects and significance of pointers they contain, but it hasn't been spelled out (other than what `&Foo` syntax suggests) that trait objects are references (and why). That's what the "Why Pointers?" section is aiming to do I gather, but it seems out of place, I think it'd make more sense to cover this before the gory details of their internals.
3. Suggestion: move the *Error Handling* chapter much earlier in the Intermediate section of the guide, or even into the Basics section. I know the Intermediate section isn't intended to be read in order per se, but plenty of people like me are just going to read it straight through anyway 😁 These are pretty fundamental concepts to understand and `Option`, `Result`, and idioms like `unwrap()` and `.ok().expect()` are referenced numerous times throughout the rest of the guide. They feature pretty prominently as early as *Standard Input* and *Guessing Game* chapters in Basics, in fact. I happen to have a good understanding of these already through encountering their analogs in typed functional languages, but if I didn't I believe I really would have appreciated reading *Error Handling* much earlier.
4. In the `rustdoc` chapter, a [comment at the beginning of the first source example][3] refers to a "link" crate attribute being needed. There seems to be no such attribute present in the source. I believe this refers to `crate_type` [according to the reference][4], but it'd be nice if this example were updated/clarified (I think `crate_id` is deprecated/obsolete too).

   This brings me to a related comment also: after encountering crate attributes in the reference and also docs on Cargo configuration like `crate-type = ["dylib"]`, I'm uncertain about the relationship/redundancy between these. I'm sure this is the kind of thing where docs are simply struggling to keep pace with rapid changes in Rust and Cargo, just wanted to flag that this distinction ought to be clearly covered in the docs for one or the other at some point, it's presently hard to track down.
5. Minor: link to sample editor configurations in [the introductory chapter][5] is broken, probably the generator automatically translates `.md` links to `.html`. Perhaps it shouldn't do that for absolute URLs.
6. Following from my changes to the enums coverage in [*Compound Data Types*][6] in this PR: sum types are an important topic and I tried to make some improvements, but I think the motivating example of `Character` with `Digit(i32)` and `Other` variants is a pretty weak one, and a better example could greatly improve cohesion with the `Ordering` coverage later in the section and how that ties into pattern matching in the subsequent chapter. I just haven't thought of a better example to suggest yet.

   In particular, the text states:

   > This may seem rather limiting, but it's a limitation which we can overcome.

   This is referring to `Character`, and actually to more than one limitation: the preceding admonition that its variants aren't comparable/don't have ordering, and don't support binary operators like `*` and `+`. Overcoming these limitations actually never gets explained—we next cover how `Ordering` works as an enum itself for plain `i32`s, but never get around to showing how this might be applied to our `Digit` variant type.

   Since the coverage of enums already segues into pattern matching and this could be even tighter with a stronger example, it might be nice if our example enum were somehow connected to the final example program for the Basics section too, where `Ordering` reappears. I don't see how it would fit with the current guessing game example, but food for thought.
7. `#[derive]` seems conspicuously missing from the guide. It would probably make sense to introduce after showing simple examples of implementing equality and/or ordering traits by hand, which have been mentioned as possibilities above. Perhaps it's too much to breach this as early as the Basic section though without traits being introduced. `#[derive]` itself and the derivable traits can certainly be saved for Intermediate and referenced as covered later, in any case.

r? @steveklabnik for docs.

[1]: 1576142495/src/doc/trpl/traits.md (our-inverse-example)
[2]: 1576142495/src/doc/trpl/static-and-dynamic-dispatch.md (why-pointers)
[3]: 1576142495/src/doc/trpl/documentation.md (creating-documentation)
[4]: http://doc.rust-lang.org/reference.html#linkage
[5]: 1576142495/src/doc/trpl/hello-world.md
[6]: 1576142495/src/doc/trpl/compound-data-types.md (enums)
2015-03-23 15:07:18 -07:00
Niko Matsakis
76ead08108 Remove auto-deref'ing Pattern impl because it conflicts with other
possible blanket impls and also triggers internal overflow. Add some
special cases for common uses (&&str, &String) for now; bounds-targeting
deref coercions are probably the right longer term answer.
2015-03-23 18:05:20 -04:00
Niko Matsakis
8bd8466e81 Refactor how we handle overflow so that it is a fatal error that aborts
compilation: this removes all the ungainly code that special cases
overflow so that we can ensure it propagates.
2015-03-23 18:05:20 -04:00
Alex Crichton
d97d53891d std: Stabilize the Hasher::finish method
This commit enables writing a stable implementation of the `Hasher` trait as
well as actually calculating the hash of a vlaue in a stable fashion. The
signature is stabilized as-is.
2015-03-23 15:03:07 -07:00
Aaron Turon
8389253df0 Add generic conversion traits
This commit:

* Introduces `std::convert`, providing an implementation of
RFC 529.

* Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all
in favor of the corresponding generic conversion traits.

  Consequently, various IO APIs now take `AsRef<Path>` rather than
`AsPath`, and so on. Since the types provided by `std` implement both
traits, this should cause relatively little breakage.

* Deprecates many `from_foo` constructors in favor of `from`.

* Changes `PathBuf::new` to take no argument (creating an empty buffer,
  as per convention). The previous behavior is now available as
  `PathBuf::from`.

* De-stabilizes `IntoCow`. It's not clear whether we need this separate trait.

Closes #22751
Closes #14433

[breaking-change]
2015-03-23 15:01:45 -07:00
Brian Anderson
8c93a79e38 rustdoc: Replace no-pretty-expanded with pretty-expanded
Now that features must be declared expanded source often does not compile.
This adds 'pretty-expanded' to a bunch of test cases that still work.
2015-03-23 14:40:26 -07:00
Brian Anderson
e9019101a8 Add #![feature] attributes to doctests 2015-03-23 14:40:26 -07:00
Brian Anderson
df290f127e Require feature attributes, and add them where necessary 2015-03-23 14:40:26 -07:00
Brian Anderson
7770ea706b rustdoc: Add #[doc(test(no_inject_crate))] attribute
So that collections doctests don't automatically fail themselves
by injecting `extern crate collections` when they are mostly
using the std facade.
2015-03-23 14:40:25 -07:00
Brian Anderson
3d365f6a01 rustdoc: interpret all leading feature attributes in examples as crate attributes
This makes it possible to write `#![feature(foo)]` in doc tests.
2015-03-23 14:40:25 -07:00
Steve Klabnik
6a5b1e9f8e Rollup merge of #23641 - steveklabnik:gh23632, r=alexcrichton
Fixes #23632
2015-03-23 17:05:46 -04:00
Steve Klabnik
68af512123 Rollup merge of #23639 - steveklabnik:gh21305, r=alexcrichton
Fixes #21305

Not sure if we should include more than this here, but it should be good to have at least this.
2015-03-23 17:05:45 -04:00
Steve Klabnik
1c25aecf67 Rollup merge of #23622 - steveklabnik:gh23196, r=alexcrichton
Fixes #23196
2015-03-23 17:05:45 -04:00
Steve Klabnik
71b9ba1e5b Rollup merge of #23618 - steveklabnik:gh23571, r=alexcrichton
Fixes #23571
2015-03-23 17:05:45 -04:00
Steve Klabnik
8b6c0fd410 Rollup merge of #23608 - nagisa:refine-cursor-docstring, r=steveklabnik
r? @steveklabnik
2015-03-23 17:05:45 -04:00
Steve Klabnik
9299446030 Rollup merge of #23607 - mahkoh:cursor, r=alexcrichton
Closes #23599

r? @alexcrichton
2015-03-23 17:05:44 -04:00
Steve Klabnik
61e690405a Rollup merge of #23561 - steveklabnik:gh23422, r=alexcrichton
Fixes #23422
2015-03-23 17:05:44 -04:00
Steve Klabnik
84f760b50a Rollup merge of #23509 - aturon:stab-entry, r=Gankro
This commit marks as `#[stable]` the `Entry` types for the maps provided
by `std`. The main reason these had been left unstable previously was
uncertainty about an eventual trait design, but several plausible
designs have been proposed that all work fine with the current type definitions.

r? @Gankro
2015-03-23 17:05:44 -04:00
Steve Klabnik
f788159797 Rollup merge of #23119 - nikomatsakis:issue-23116-ref-mut, r=pnkfelix
Don't allow upcasting to a supertype in the type of the match discriminant. Fixes #23116.

This is a [breaking-change] in that it closes a type hole that previously existed.

r? @pnkfelix
2015-03-23 17:05:43 -04:00
Steve Klabnik
4a81e66b44 Rollup merge of #22954 - ches:docs, r=steveklabnik
Greetings Rustaceans!

I've just been getting acquainted with Rust through the guide. First let me say that it's already in great shape, chapters are kept a good length to be digestible and paced to move the reader along fluidly, so my compliments to contributors!

Along the way I noticed a few minor copy errors, and also a few areas that I thought more subjectively could stand to be improved. My commits here are divided so that minor edits unlikely to be very contentious could be cherry-picked, and then topically on parts that might generate more discussion.

I also have some comments and questions that aren't directly associated with any changes on this branch yet. I'm not sure how you like to triage this sort of thing but I'll present them below and if it's appropriate they could be moved to separate issues or I might be able to help work some of them out within the scope of this PR. Sorry that these are a lot to take in, pretty much everything below here can be digested independently of the current changes in this PR so you could read the rest later 😄

### Questions and Comments

I'll give stable links to doc revisions as of this writing.

1. The [example using `PartialEq` in the Traits chapter][1] is poor—we have no idea how `PartialEq` works at this point in the text (or at any point, AFAICT), so it isn't clear why it won't work as a trait bound in this situation and `Float` almost magically does, with the aid of existing tailor-made identity functions that seem unlikely to be so conveniently available when we encounter a scenario like this in our real-world code.

   This section just seems glossed over, or perhaps content has moved around over time or there's an assumption that implementing equality with `PartialEq` should be covered in the guide eventually so this example will be less foreign. As it stands the text is hard to follow and not very meaningful.
2. I found treatment of the relationship of trait objects to pointers in the *Static and Dynamic Dispatch* chapter unclear. [The "Why Pointers?" section][2] opens with this line:

   > The use of language like "fat pointer" implies that a trait object is always a pointer of some form, but why?

   But the phrase "fat pointer" hasn't been used anywhere before. This is some of the more complex material in the guide, but this section nevertheless feels displaced, not clearly connecting preceding subject matter. Earlier we've covered the internal representation of trait objects and significance of pointers they contain, but it hasn't been spelled out (other than what `&Foo` syntax suggests) that trait objects are references (and why). That's what the "Why Pointers?" section is aiming to do I gather, but it seems out of place, I think it'd make more sense to cover this before the gory details of their internals.
3. Suggestion: move the *Error Handling* chapter much earlier in the Intermediate section of the guide, or even into the Basics section. I know the Intermediate section isn't intended to be read in order per se, but plenty of people like me are just going to read it straight through anyway 😁 These are pretty fundamental concepts to understand and `Option`, `Result`, and idioms like `unwrap()` and `.ok().expect()` are referenced numerous times throughout the rest of the guide. They feature pretty prominently as early as *Standard Input* and *Guessing Game* chapters in Basics, in fact. I happen to have a good understanding of these already through encountering their analogs in typed functional languages, but if I didn't I believe I really would have appreciated reading *Error Handling* much earlier.
4. In the `rustdoc` chapter, a [comment at the beginning of the first source example][3] refers to a "link" crate attribute being needed. There seems to be no such attribute present in the source. I believe this refers to `crate_type` [according to the reference][4], but it'd be nice if this example were updated/clarified (I think `crate_id` is deprecated/obsolete too).

   This brings me to a related comment also: after encountering crate attributes in the reference and also docs on Cargo configuration like `crate-type = ["dylib"]`, I'm uncertain about the relationship/redundancy between these. I'm sure this is the kind of thing where docs are simply struggling to keep pace with rapid changes in Rust and Cargo, just wanted to flag that this distinction ought to be clearly covered in the docs for one or the other at some point, it's presently hard to track down.
5. Minor: link to sample editor configurations in [the introductory chapter][5] is broken, probably the generator automatically translates `.md` links to `.html`. Perhaps it shouldn't do that for absolute URLs.
6. Following from my changes to the enums coverage in [*Compound Data Types*][6] in this PR: sum types are an important topic and I tried to make some improvements, but I think the motivating example of `Character` with `Digit(i32)` and `Other` variants is a pretty weak one, and a better example could greatly improve cohesion with the `Ordering` coverage later in the section and how that ties into pattern matching in the subsequent chapter. I just haven't thought of a better example to suggest yet.

   In particular, the text states:

   > This may seem rather limiting, but it's a limitation which we can overcome.

   This is referring to `Character`, and actually to more than one limitation: the preceding admonition that its variants aren't comparable/don't have ordering, and don't support binary operators like `*` and `+`. Overcoming these limitations actually never gets explained—we next cover how `Ordering` works as an enum itself for plain `i32`s, but never get around to showing how this might be applied to our `Digit` variant type.

   Since the coverage of enums already segues into pattern matching and this could be even tighter with a stronger example, it might be nice if our example enum were somehow connected to the final example program for the Basics section too, where `Ordering` reappears. I don't see how it would fit with the current guessing game example, but food for thought.
7. `#[derive]` seems conspicuously missing from the guide. It would probably make sense to introduce after showing simple examples of implementing equality and/or ordering traits by hand, which have been mentioned as possibilities above. Perhaps it's too much to breach this as early as the Basic section though without traits being introduced. `#[derive]` itself and the derivable traits can certainly be saved for Intermediate and referenced as covered later, in any case.

r? @steveklabnik for docs.

[1]: 1576142495/src/doc/trpl/traits.md (our-inverse-example)
[2]: 1576142495/src/doc/trpl/static-and-dynamic-dispatch.md (why-pointers)
[3]: 1576142495/src/doc/trpl/documentation.md (creating-documentation)
[4]: http://doc.rust-lang.org/reference.html#linkage
[5]: 1576142495/src/doc/trpl/hello-world.md
[6]: 1576142495/src/doc/trpl/compound-data-types.md (enums)
2015-03-23 17:05:43 -04:00
Tom Jakubowski
2df8830642 rustdoc: Support for "array" primitive
Impls on `clean::Type::FixedVector` are now collected in the array
primitive page instead of the slice primitive page.

Also add a primitive docs for arrays to `std`.
2015-03-23 14:02:34 -07:00
Niko Matsakis
57cf2decf7 Update borrowck tests to test that index is by-move now 2015-03-23 16:55:45 -04:00
Niko Matsakis
8e58af4004 Fallout in stdlib, rustdoc, rustc, etc. For most maps, converted uses of
`[]` on maps to `get` in rustc, since stage0 and stage1+ disagree about
how to use `[]`.
2015-03-23 16:55:45 -04:00
Niko Matsakis
b4d4daf007 Adjust Index/IndexMut impls. For generic collections, we take
references. For collections whose keys are integers, we take both
references and by-value.
2015-03-23 16:55:43 -04:00
Niko Matsakis
bc1dde468c Compiler and trait changes to make indexing by value. 2015-03-23 16:54:28 -04:00
Niko Matsakis
37601131a0 Make the Fn traits inherit from one another and remove the bridging
impls.

This requires:

1. modifying trait selection a bit so that when we synthesize impls for
   fn pointers and closures;
2. adding code to trans so that we can synthesize a `FnMut`/`FnOnce`
   impl for a `Fn` closure and so forth.
2015-03-23 16:46:02 -04:00
Steve Klabnik
1be8fcb4a9 Make note of str in 'more strings' chapter
Fixes #21035
2015-03-23 14:57:52 -04:00
Steve Klabnik
05c9728c69 Don't conflate regions and affine types
Fixes #23642
2015-03-23 14:47:14 -04:00
Aaron Turon
6bd3ab0d81 Implement RFC 909: move thread_local into thread
This commit implements [RFC
909](https://github.com/rust-lang/rfcs/pull/909):

The `std::thread_local` module is now deprecated, and its contents are
available directly in `std::thread` as `LocalKey`, `LocalKeyState`, and
`ScopedKey`.

The macros remain exactly as they were, which means little if any code
should break. Nevertheless, this is technically a:

[breaking-change]

Closes #23547
2015-03-23 11:28:54 -07:00
Aaron Turon
9231ceb6dd Stabilize the Error trait
This small commit stabilizes the `Error` trait as-is, except that `Send`
and `Debug` are added as constraints. The `Send` constraint is because
most uses of `Error` will be for trait objects, and by default we would
like these objects to be transferrable between threads. The `Debug`
constraint is to ensure that e.g. `Box<Error>` is `Debug`, and because
types that implement `Display` should certainly implement `Debug` in any case.

In the near future we expect to add `Any`-like downcasting features to
`Error`, but this is waiting on some additional
mechanisms (`Reflect`). It will be added before 1.0 via default methods.

[breaking-change]
2015-03-23 11:27:19 -07:00
Simonas Kazlauskas
d29d5545b6 prctl instead of pthread on linux for name setup
This is more portable as far as linux is concerned.
2015-03-23 20:08:12 +02:00
Steve Klabnik
d52c36246a Clarify that slices don't just point to arrays
Fixes #23632
2015-03-23 13:59:04 -04:00
Steve Klabnik
a5e1cbe191 Beef up BufRead::consume documentation.
Fixes #23196
2015-03-23 13:42:39 -04:00
Brian Anderson
9ec9bc68fb Clarify behavior of Path::relative_from 2015-03-23 10:22:17 -07:00
Brian Anderson
2625bf9ae4 Fix regression in -C rpath that causes failures with symlinks
The new `relative_from` method no longer supports the case on unix
where both paths are absolute, which `-C rpath` depended on. This
version fixes the problem by copying the old path_relative_from
function into the rpath module.

Fixes #23140
2015-03-23 10:21:54 -07:00
Julian Orth
d6fb7e9da8 derive missing trait implementations for cursor 2015-03-23 17:48:13 +01:00
Steve Klabnik
2750e3c83e Add note about pointer state after the call.
Fixes #23422
2015-03-23 12:21:53 -04:00
Felix S. Klock II
bb9d210c99 Fix shift-overflow in very old run-pass test. 2015-03-23 07:04:15 -07:00
Andrew Paseltiner
88edf9774c document iteration order for vec_deque::IntoIter 2015-03-23 08:51:29 -04:00
Andrew Paseltiner
7934d524b5 implement ExactSizeIterator for linked_list::IntoIter 2015-03-23 08:51:13 -04:00
Andrew Paseltiner
64532f7f00 implement Clone for various iterators 2015-03-23 08:50:47 -04:00
Wangshan Lu
d944689cf6 Fix dead link for std::sync::mpsc. 2015-03-23 19:11:03 +08:00
Niko Matsakis
45fae88256 When matching against a pattern (either via match or let) that
contains ref-bindings, do not permit any upcasting from the type of
the value being matched. Similarly, do not permit coercion in a `let`.

This is a [breaking-change] in that it closes a type hole that
previously existed, and in that coercion is not performed. You should
be able to work around the latter by converting:

```rust
let ref mut x: T = expr;
```

into

```rust
let x: T = expr;
let ref mut x = x;
```

Restricting coercion not to apply in the case of `let ref` or `let ref mut` is sort
of unexciting to me, but seems the best solution:

1. Mixing coercion and `let ref` or `let ref mut` is a bit odd, because you are taking
   the address of a (coerced) temporary, but only sometimes. It's not syntactically evident,
   in other words, what's going on. When you're doing a coercion, you're kind of

2. Put another way, I would like to preserve the relationship that
   `equality <= subtyping <= coercion <= as-coercion`, where this is
   an indication of the number of `(T1,T2)` pairs that are accepted by
   the various relations. Trying to mix `let ref mut` and coercion
   would create another kind of relation that is like coercion, but
   acts differently in the case where a precise match is needed.

3. In any case, this is strictly more conservative than what we had
   before and we can undo it in the future if we find a way to make
   coercion mix with type equality.

The change to match I feel ok about but similarly unthrilled. There is
some subtle text already concerning whether to use eqtype or subtype
for identifier bindings. The best fix I think would be to always have
match use strict equality but use subtyping on identifier bindings,
but the comment `(*)` explains why that's not working at the moment.
As above, I think we can change this as we clean up the code there.
2015-03-23 05:30:43 -04:00
Niko Matsakis
50ea6f6886 Remove incorrect subtyping for &mut Trait and introduce coercion
for `&mut (Trait+'a)` to `&mut (Trait+'b)` if `'a:'b`.

Fixes #14985.
2015-03-23 04:52:33 -04:00
Anders Kaseorg
737bb30f0a min_stack_size: clarify both reasons to use dlsym
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-03-23 04:02:02 -04:00
Anders Kaseorg
b6641c1595 min_stack_size: update non-Linux implementation comment
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-03-23 03:48:06 -04:00
Anders Kaseorg
0090e01f08 Get __pthread_get_minstack at runtime with dlsym
Linking __pthread_get_minstack, even weakly, was causing Debian’s
dpkg-shlibdeps to detect an unnecessarily strict versioned dependency
on libc6.

Closes #23628.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-03-23 01:05:05 -04:00
Liam Monahan
558c427cd3 Fix a typo in the Rust Book ownership page. 2015-03-23 00:00:00 -04:00
Manish Goregaokar
b4e9106a8a Rollup merge of #23590 - FuGangqiang:attr, r=alexcrichton 2015-03-23 04:54:27 +05:30
Manish Goregaokar
5b9e87b571 Rollup merge of #23576 - barosl:mutex-doc, r=alexcrichton 2015-03-23 04:54:27 +05:30
FuGangqiang
7ec80fa31c add lifetime for while and for expression 2015-03-23 04:54:27 +05:30
Manish Goregaokar
f5782faa06 Rollup merge of #23562 - steveklabnik:fix_book_numbers, r=alexcrichton
Rustbook already does this.
2015-03-23 04:54:27 +05:30
FuGangqiang
5836efdfe7 fix the attributes sytax 2015-03-23 04:54:27 +05:30
Manish Goregaokar
420bf9dd44 Rollup merge of #23554 - Ms2ger:readme-rustc, r=steveklabnik 2015-03-23 04:54:26 +05:30
Manish Goregaokar
718fe3d9c5 Rollup merge of #23578 - fhahn:issue-22820-feature-gate-tests1, r=alexcrichton
...ures.

Namely:

 * `box_syntax`
 * `box_patterns`
 * `simd_ffi`
 * `macro_reexport`

cc #22820
2015-03-23 04:54:26 +05:30
Manish Goregaokar
d8baa010ab Rollup merge of #23570 - dotdash:issue23550, r=eddyb
Boolean values and small aggregates have a different type in args/allocas than
in SSA values but the intrinsics for volatile and atomic ops were
missing the necessary casts to handle that.

Fixes #23550
2015-03-23 04:54:26 +05:30
Manish Goregaokar
a91eece96b Rollup merge of #23559 - aturon:future-proof-map-index, r=Gankro
This commit removes the `IndexMut` impls on `HashMap` and `BTreeMap`, in
order to future-proof the API against the eventual inclusion of an
`IndexSet` trait.

Ideally, we would eventually be able to support:

```rust
map[owned_key] = val;
map[borrowed_key].mutating_method(arguments);
&mut map[borrowed_key];
```

but to keep the design space as unconstrained as possible, we do not
currently want to support `IndexMut`, in case some other strategy will
eventually be needed.

Code currently using mutating index notation can use `get_mut` instead.

[breaking-change]

Closes #23448

r? @Gankro
2015-03-23 04:54:26 +05:30
Felix S. Klock II
4dfec6cab5 placate check-pretty and pretty-printer bug; see also issue 23623. 2015-03-22 23:53:06 +01:00
Tshepang Lekhonkhobe
8a500dea0e book: some Crates and Modules nits 2015-03-22 23:38:36 +02:00
Steve Klabnik
81801f2171 Re-word explanation on closures in intro
Fixes #23571
2015-03-22 15:40:46 -04:00
Ms2ger
29aca83eb4 Remove an unsafe function definition in __thread_local_inner.
This fixes a build error when using thread_local!() in a deny(unsafe_code)
scope in Servo for Android.
2015-03-22 20:27:00 +01:00
Steve Klabnik
fbc823d1e3 Document how to document macros
Fixes #23571
2015-03-22 15:26:23 -04:00
Steve Klabnik
3d04cb3688 Note order of BinaryHeap::drain
Fixes #23564
2015-03-22 15:21:32 -04:00
Steve Klabnik
5321d22afa Remove bad reference to std::io
Closes #23540
2015-03-22 15:04:58 -04:00
Björn Steinbrink
cfe7a8db06 Reduce code bloat in closure
For the rust-call ABI, the last function argument is a tuple that gets
untupled for the actual call. For bare functions using this ABI, the
code has access to the tuple, so we need to tuple the arguments again.
But closures can't actually access the tuple. Their arguments map to the
elements in the tuple. So what we currently do is to tuple the arguments
and then immediately untuple them again, which is pretty useless and we
can just omit it.
2015-03-22 19:18:07 +01:00
Simonas Kazlauskas
90c8592889 Refine Cursor docstring 2015-03-22 19:36:17 +02:00
bors
b0aad7dd4f Auto merge of #23361 - petrochenkov:refdst, r=jakub-
After this patch code like `let ref a = *"abcdef"` doesn't cause ICE anymore.
Required for #23121

There are still places in rustc_trans where pointers are always assumed to be thin. In particular, #19064 is not resolved by this patch.
2015-03-22 15:52:30 +00:00
Andrew Paseltiner
1381249265 implement Clone for btree iterators 2015-03-21 22:55:52 -04:00
Alex Crichton
1ec9adcfc0 std: Tweak rt::at_exit behavior
There have been some recent panics on the bots and this commit is an attempt to
appease them. Previously it was considered invalid to run `rt::at_exit` after
the handlers had already started running. Due to the multithreaded nature of
applications, however, it is not always possible to guarantee this. For example
[this program][ex] will show off the abort.

[ex]: https://gist.github.com/alexcrichton/56300b87af6fa554e52d

The semantics of the `rt::at_exit` function have been modified as such:

* It is now legal to call `rt::at_exit` at any time. The return value now
  indicates whether the closure was successfully registered or not. Callers must
  now decide what to do with this information.
* The `rt::at_exit` handlers will now be run for a fixed number of iterations.
  Common cases (such as the example shown) may end up registering a new handler
  while others are running perhaps once or twice, so this common condition is
  covered by re-running the handlers a fixed number of times, after which new
  registrations are forbidden.

Some usage of `rt::at_exit` was updated to handle these new semantics, but
deprecated or unstable libraries calling `rt::at_exit` were not updated.
2015-03-21 11:14:58 -07:00
Alex Crichton
e24fe5b8cf std: Remove deprecated ptr functions
The method with which backwards compatibility was retained ended up leading to
documentation that rustdoc didn't handle well and largely ended up confusing.
2015-03-21 10:16:01 -07:00
Felix S. Klock II
5e47c6655b workaround bugs in pretty-printer so that we can pass check-stage2-pretty-rpass. 2015-03-21 17:57:22 +01:00
Björn Steinbrink
d4ca1cffce Fix volatile / atomic ops on bools and small aggregates
Boolean values and small aggregates have a different type in
args/allocas than in SSA values but the intrinsics for volatile and
atomic ops were missing the necessary casts to handle that.

Fixes #23550
2015-03-21 10:46:52 +01:00
Florian Hahn
c48bb85702 Add tests checking that a number of feature gates are gating their features.
Namely:

 * `box_syntax`
 * `box_patterns`
 * `simd_ffi`
 * `macro_reexport`

 cc #22820
2015-03-21 10:18:28 +01:00
Barosl Lee
84b14c5dc9 Fix documentation for std::sync::mutex: into_guard -> into_inner 2015-03-21 14:38:23 +09:00
bors
ecf8c64e1b Auto merge of #23470 - alexcrichton:less-prelude, r=aturon
This commit removes the reexports of `old_io` traits as well as `old_path` types
and traits from the prelude. This functionality is now all deprecated and needs
to be removed to make way for other functionality like `Seek` in the `std::io`
module (currently reexported as `NewSeek` in the io prelude).

Closes #23377
Closes #23378
2015-03-21 05:25:21 +00:00
Alex Crichton
212e03181e std: Remove old_io/old_path from the prelude
This commit removes the reexports of `old_io` traits as well as `old_path` types
and traits from the prelude. This functionality is now all deprecated and needs
to be removed to make way for other functionality like `Seek` in the `std::io`
module (currently reexported as `NewSeek` in the io prelude).

Closes #23377
Closes #23378
2015-03-20 20:07:19 -07:00
bors
e2fa53e593 Auto merge of #23512 - oli-obk:result_ok_unwrap, r=alexcrichton
because then the call to `unwrap()` will not print the error object.
2015-03-20 23:16:47 +00:00
Ches Martin
92294e7aed guide: Improvements to language covering enums 2015-03-21 05:32:26 +07:00
Ches Martin
0c040b07f0 guide: minor copy edits 2015-03-21 05:32:07 +07:00
bors
68d6941563 Auto merge of #23267 - alexcrichton:issue-20012, r=aturon
This reverts commit aec67c2.

Closes #20012

This is temporarily rebased on #23245 as it would otherwise conflict, the last commit is the only one relevant to this PR though.
2015-03-20 20:19:42 +00:00
Steve Klabnik
9acdcba3d5 Remove manual numbers from TRPL
Rustbook already does this.
2015-03-20 15:27:55 -04:00
Alex Crichton
1cc9718fde Revert "Revert "std: Re-enable at_exit()""
This reverts commit aec67c2ee0.
2015-03-20 10:56:27 -07:00
Aaron Turon
5fe0bb743a Future-proof indexing on maps: remove IndexMut
This commit removes the `IndexMut` impls on `HashMap` and `BTreeMap`, in
order to future-proof the API against the eventual inclusion of an
`IndexSet` trait.

Ideally, we would eventually be able to support:

```rust
map[owned_key] = val;
map[borrowed_key].mutating_method(arguments);
&mut map[borrowed_key];
```

but to keep the design space as unconstrained as possible, we do not
currently want to support `IndexMut`, in case some other strategy will
eventually be needed.

Code currently using mutating index notation can use `get_mut` instead.

[breaking-change]

Closes #23448
2015-03-20 10:46:31 -07:00
bors
3900c089a1 Auto merge of #23471 - sae-bom:aarch64-linux-android, r=alexcrichton
Resolved #21773. (Aarch64 test has been broken again)
r? @alexcrichton
2015-03-20 17:45:15 +00:00
Flavio Percoco
04d57729fc fix fallout 2015-03-20 16:48:15 +01:00
Flavio Percoco
38dbcb2e37 Check trait unsafety for defaulted traits 2015-03-20 16:43:11 +01:00
Flavio Percoco
01d24297eb Feature gate defaulted traits 2015-03-20 16:43:11 +01:00
Flavio Percoco
9ae144f055 Add default impls for Send/Sync 2015-03-20 16:43:11 +01:00
bors
ecdf792d1d Auto merge of #23537 - steveklabnik:gh22551, r=alexcrichton
Fixes #22551

('grammar' wasn't really used in the chapter at all)
2015-03-20 15:02:55 +00:00
Steve Klabnik
af09763cc1 Add AST to the glossary
Fixes #22551
2015-03-20 10:55:51 -04:00
Ms2ger
3bdb5c3078 Make librustc's markdown README.txt claim to be markdown.
This allows github to render it with formatting.
2015-03-20 13:29:13 +01:00
Ms2ger
41a7177d6a Update librustc's README.txt for some code changes and reformat it. 2015-03-20 13:29:01 +01:00
bors
cbc660bd1c Auto merge of #23522 - steveklabnik:gh22518, r=Manishearth
When investigating #22518, this chapter is really the only part that has `rand`, and the rest still works without it. We should have some examples like this, but for now, it's more important to be right than perfect.
2015-03-20 11:29:12 +00:00
Felix S. Klock II
61ff823c63 Test suite for overflowing shift operators.
Note the tests have been revised to match new semantics for 8- and
16-bit values.
2015-03-20 11:26:09 +01:00
Felix S. Klock II
19fef72a8c Added panic-on-overflow for rhs of left and right shift expressions.
This includes a slight refactoring of the `cast_shift_rhs` and related
functions in `trans::base`, so that I can call them from much later in
the compiler's control flow (so that we can clearly dilineate where
automatic conversions of the RHS occur, versus where we check it).

The rhs-checking and fallback-masking is generalized to 8- and 16-bit
values, and the fallback-masking is turned on unconditionally.

Fix #10183.

Is this a [breaking-change]?  I would argue it is not; it only adds a
strict definition to what was previously undefined behavior; however,
there might be code that was e.g. assuming that `1_i8 << 17` yields 0.
(This happens in certain contexts and at certain optimization levels.)
2015-03-20 11:25:20 +01:00
Oliver Schneider
b4a1e59146 don't use Result::ok just to be able to use unwrap/unwrap_or 2015-03-20 08:19:13 +01:00
Manish Goregaokar
6107e4c0b8 Rollup merge of #23534 - steveklabnik:remove_sched_threads, r=alexcrichton
As @alexcrichton says, this was really a libgreen thing, and isn't
relevant now.

As this removes a technically-public function, this is a

[breaking-change]
2015-03-20 12:43:15 +05:30
Manish Goregaokar
0711006694 Rollup merge of #23532 - steveklabnik:gh22002, r=alexcrichton
Fixes #22002
2015-03-20 12:43:14 +05:30
Manish Goregaokar
17f3f3e3e6 Rollup merge of #23526 - mbrubeck:uppercase, r=steveklabnik
`uppercase` and `lowercase` are currently named `to_uppercase` and `to_lowercase`. Also adds a link to the `char` type documentation which has much more detail on these iterators.
2015-03-20 12:43:14 +05:30
Manish Goregaokar
2ac03bceb4 Rollup merge of #23518 - farcaller:fix_quote_method, r=eddyb
This fixes several use cases that were broken after #23265 landed.
2015-03-20 12:43:13 +05:30
Manish Goregaokar
90e7f472f7 Rollup merge of #23499 - mbrubeck:doc-edit, r=huonw
Multiple people have been suprised by this aspect of read_line's behavior, which is not obvious from the docs.
2015-03-20 12:43:13 +05:30
Manish Goregaokar
dbe084b5bf Rollup merge of #23447 - kjpgit:kjp/pointerexample, r=steveklabnik
These two borrowing examples were confusing/misleading.  This changes it
to more clearly show how you _can_ borrow a box, and also uses & instead
of &*.
2015-03-20 12:43:12 +05:30
Manish Goregaokar
1ceb26b48c Rollup merge of #22631 - aepsil0n:issue-22098, r=aturon
Fixes #22098.
2015-03-20 12:43:12 +05:30
Manish Goregaokar
baf6b3a35d Rollup merge of #23531 - steveklabnik:gh21709, r=alexcrichton
Fixes #21709
2015-03-20 12:43:12 +05:30
Manish Goregaokar
17c1a46a7d Rollup merge of #23529 - steveklabnik:gh23426, r=alexcrichton
Fixes #23426
2015-03-20 12:43:11 +05:30
Manish Goregaokar
e2d32b74ec Rollup merge of #23525 - steveklabnik:test_tasks, r=alexcrichton
We don't use 'task' anymore, these are now threads.

Because this changes the name of a compiler option, this is

[breaking-change]

I think this is small enough to not need an RFC, nor a period of accepting both. If we want to take both for a while, I can change the patch.
2015-03-20 12:43:11 +05:30
Manish Goregaokar
3e433738fb Rollup merge of #23504 - alexcrichton:parse-error-not-unit, r=aturon
The IP and socket address types all had `FromStr` implemented but the
implementations were not marked stable, nor was the error type returned ready to
be properly stabilized.

This commit marks the implementations of `FromStr` as stable and also renamed
the `ParseError` structure to `AddrParseError`. The error is now also an opaque
structure that cannot be constructed outside the standard library.

cc #22949
[breaking-change]
2015-03-20 12:43:11 +05:30
bors
fda8673531 Auto merge of #23504 - alexcrichton:parse-error-not-unit, r=aturon
The IP and socket address types all had `FromStr` implemented but the
implementations were not marked stable, nor was the error type returned ready to
be properly stabilized.

This commit marks the implementations of `FromStr` as stable and also renamed
the `ParseError` structure to `AddrParseError`. The error is now also an opaque
structure that cannot be constructed outside the standard library.

cc #22949
[breaking-change]
2015-03-20 04:30:04 +00:00
bors
e98e391337 Auto merge of #23254 - jbcrail:saturating-math-docs, r=steveklabnik
This was added for #23241.
2015-03-20 01:35:54 +00:00
Steve Klabnik
71321ff33f Remove rt::default_sched_threads and RUST_THREADS.
As @alexcrichton says, this was really a libgreen thing, and isn't
relevant now.

As this removes a technically-public function, this is a

[breaking-change]

Conflicts:
	src/libtest/lib.rs
2015-03-20 05:36:07 +05:30
Manish Goregaokar
4294327886 Rollup merge of #23254 - jbcrail:saturating-math-docs, r=steveklabnik
This was added for #23241.
2015-03-20 05:30:12 +05:30
Manish Goregaokar
97f03e7ad9 Rollup merge of #23489 - michaelwoerister:span-artihmetic-overflow-bug, r=alexcrichton
This should solve issues #23115, #23469, and #23407.

As the title says, this is just a workaround. The underlying problem is that macro expansion can produce invalid spans. I've opened issue #23480 so we don't forget about that.
2015-03-20 05:30:06 +05:30
Jake Goulding
c6ca2205ea StrExt::splitn should not require a DoubleEndedSearcher
Closes #23262
2015-03-19 19:25:22 -04:00
Jake Goulding
6a5148bda1 Introduce rsplit 2015-03-19 19:25:22 -04:00
bors
f4e0ce66a3 Auto merge of #23489 - michaelwoerister:span-artihmetic-overflow-bug, r=alexcrichton
This should solve issues #23115, #23469, and #23407.

As the title says, this is just a workaround. The underlying problem is that macro expansion can produce invalid spans. I've opened issue #23480 so we don't forget about that.
2015-03-19 22:37:02 +00:00
Steve Klabnik
3e3408de0f Comment on when ReadDir is Err
Fixes #23426
2015-03-19 18:21:39 -04:00
Steve Klabnik
d081b241ff Reference Drop in FFI chapter
Fixes #22002
2015-03-19 18:11:35 -04:00
Steve Klabnik
109803f6d5 Remove incorrect statement about raw pointers.
Fixes #21709
2015-03-19 18:06:54 -04:00
Matt Brubeck
973b788f40 Update docs for ToUppercase/ToLowercase structs
`uppercase` and `lowercase` are currently named `to_uppercase` and `to_lowercase`.
Also adds a link to the `char` type documentation which has much more detail
on these iterators.
2015-03-19 13:34:18 -07:00
Steve Klabnik
7cbc42849f RUST_TEST_TASKS -> RUST_TEST_THREADS
We don't use 'task' anymore, these are now threads.

Because this changes the name of a compiler option, this is

[breaking-change]
2015-03-19 15:42:56 -04:00
Steve Klabnik
0249603c20 Remove the Guessing Game from the book
Fixes #22518
2015-03-19 15:19:20 -04:00
bors
7f53b943f9 Auto merge of #23430 - alexcrichton:io-error, r=aturon
This commit stabilizes the `ErrorKind` enumeration which is consumed by and
generated by the `io::Error` type. The purpose of this type is to serve as a
cross-platform namespace to categorize errors into. Two specific issues are
addressed as part of this stablization:

* The naming of each variant was scrutinized and some were tweaked. An example
  is how `FileNotFound` was renamed to simply `NotFound`. These names should not
  show either a Unix or Windows bias and the set of names is intended to grow
  over time. For now the names will likely largely consist of those errors
  generated by the I/O APIs in the standard library.

* The mapping of OS error codes onto kinds has been altered. Coalescing no
  longer occurs (multiple error codes become one kind). It is intended that each
  OS error code, if bound, corresponds to only one `ErrorKind`. The current set
  of error kinds was expanded slightly to include some networking errors.

This commit also adds a `raw_os_error` function which returns an `Option<i32>`
to extract the underlying raw error code from the `Error`.

Closes #16666

[breaking-change]
2015-03-19 19:15:22 +00:00
Michael Woerister
1ea971ff87 Add test case for stable import of invalid span information. 2015-03-19 18:52:30 +01:00
Vladimir Pouzanov
bd1f562e19 Added missing impl_to_source! and impl_to_tokens! for TraitItem. 2015-03-19 17:04:03 +00:00
Vladimir Pouzanov
e3cde9783b Added missing impl_to_source! and impl_to_tokens! for ImplItem.
This fixes several use cases that were broken after #23265 landed.
2015-03-19 17:01:15 +00:00
Alex Crichton
dedac5eb3c std: Stablize io::ErrorKind
This commit stabilizes the `ErrorKind` enumeration which is consumed by and
generated by the `io::Error` type. The purpose of this type is to serve as a
cross-platform namespace to categorize errors into. Two specific issues are
addressed as part of this stablization:

* The naming of each variant was scrutinized and some were tweaked. An example
  is how `FileNotFound` was renamed to simply `NotFound`. These names should not
  show either a Unix or Windows bias and the set of names is intended to grow
  over time. For now the names will likely largely consist of those errors
  generated by the I/O APIs in the standard library.

* The mapping of OS error codes onto kinds has been altered. Coalescing no
  longer occurs (multiple error codes become one kind). It is intended that each
  OS error code, if bound, corresponds to only one `ErrorKind`. The current set
  of error kinds was expanded slightly to include some networking errors.

This commit also adds a `raw_os_error` function which returns an `Option<i32>`
to extract the underlying raw error code from the `Error`.
2015-03-19 09:59:21 -07:00
bors
81e2396c76 Auto merge of #23213 - ipetkov:rustdoc-src-fix, r=huonw
* rustdoc was doubly appending the file name to the path of where to
  generate the source files, meanwhile, the [src] hyperlinks were not
* Added a flag to rustdoc::html::render::clean_srcpath to ignore the
  last path component, i.e. the file name itself to prevent the issue
* This also avoids creating directories with the same name as source
  files, and it makes sure the link to `main.css` is correct as well.

Fixes #23192
2015-03-19 16:42:16 +00:00
Valerii Hiora
6f09dfc23a Socket options constants for *BSD/Linux/Windows 2015-03-19 16:58:08 +02:00
Drew Crawford
a848ce4d38 Adding sys/socket.h constants for iOS/Mac, particularly for SO_SOCKET options.
This is probably more broadly applicable than these two platforms
(since it's part of the bsd4.4 standard) but that's outside my problem domain today.
If this goes well, I may submit Linux/64 support in a separate PR.

Reviewers should take a look at http://www.opensource.apple.com/source/xnu/xnu-792.17.14/bsd/sys/socket.h?txt
which defines constants for OSX.  iOS uses the same header.

I release this patch under the MIT license.
2015-03-19 16:04:01 +02:00
bors
08dd30d9eb Auto merge of #23498 - pcwalton:inline-police, r=cmr
r? @cmr
2015-03-19 13:10:37 +00:00
Eduard Bopp
5bfb5bab9a Allow Float::ldexp to be called as a method
Fixes #22098.
2015-03-19 14:00:00 +01:00