]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoAuto merge of #21237 - erickt:derive-assoc-types, r=erickt
bors [Thu, 26 Mar 2015 13:38:41 +0000 (13:38 +0000)]
Auto merge of #21237 - erickt:derive-assoc-types, r=erickt

This PR adds support for associated types to the `#[derive(...)]` syntax extension. In order to do this, it switches over to using where predicates to apply the type constraints. So now this:

```rust
type Trait {
    type Type;
}

#[derive(Clone)]
struct Foo<A> where A: Trait {
    a: A,
    b: <A as Trait>::Type,
}
```

Gets expended into this impl:

```rust
impl<A: Clone> Clone for Foo<A> where
    A: Trait,
    <A as Trait>::Type: Clone,
{
    fn clone(&self) -> Foo<T> {
        Foo {
            a: self.a.clone(),
            b: self.b.clone(),
        }
    }
}
```

9 years agoAuto merge of #23711 - alexcrichton:ip-addr, r=aturon
bors [Thu, 26 Mar 2015 09:43:35 +0000 (09:43 +0000)]
Auto merge of #23711 - alexcrichton:ip-addr, r=aturon

This commits adds back an `IpAddr` enum matching the `SocketAddr` enum, but
without a port. The enumeration is `#[unstable]`. The `lookup_host` function and
iterator are also destabilized behind a new feature gate due to questions around
the semantics of returning `SocketAddr` values.

9 years agoAuto merge of #23691 - richo:dedup-typeorigin-mergable, r=eddyb
bors [Thu, 26 Mar 2015 05:44:26 +0000 (05:44 +0000)]
Auto merge of #23691 - richo:dedup-typeorigin-mergable, r=eddyb

I've started on refactoring the error handling code to avoid the need to reparse generated errors in `span_*`, but would rather land this incrementally as one monolithic PR (and have un-fond memories of merge conflicts from various other monoliths)

r? @eddyb

9 years agoinfer: Drop pointless format! calls
Richo Healey [Wed, 25 Mar 2015 03:59:17 +0000 (20:59 -0700)]
infer: Drop pointless format! calls

9 years agoinfer: Refactor Display impl
Richo Healey [Wed, 25 Mar 2015 03:55:02 +0000 (20:55 -0700)]
infer: Refactor Display impl

9 years agoinfer: Move TypeOrigin formatting onto it's enum
Richo Healey [Thu, 19 Mar 2015 21:49:28 +0000 (14:49 -0700)]
infer: Move TypeOrigin formatting onto it's enum

This doesn't actually solve the issue that prompted this, at:

https://github.com/rust-lang/rust/blob/master/src/librustc/session/mod.rs#L262-271

But skimming the cfg it appears that all type information has been
discarded long before that point.

9 years agoAuto merge of #23718 - alexcrichton:flaky-test, r=huonw
bors [Thu, 26 Mar 2015 02:33:36 +0000 (02:33 +0000)]
Auto merge of #23718 - alexcrichton:flaky-test, r=huonw

It's considered an error to access stdout while a process is being shut down, so
tweak this test a bit to actually wait for the child thread to exit.

This was discovered with a recent [snap-mac3 failure](http://buildbot.rust-lang.org/builders/snap3-mac/builds/164/steps/test/logs/stdio)

9 years agostd: Add net::IpAddr, destabilize lookup_host
Alex Crichton [Wed, 25 Mar 2015 19:30:49 +0000 (12:30 -0700)]
std: Add net::IpAddr, destabilize lookup_host

This commits adds back an `IpAddr` enum matching the `SocketAddr` enum, but
without a port. The enumeration is `#[unstable]`. The `lookup_host` function and
iterator are also destabilized behind a new feature gate due to questions around
the semantics of returning `SocketAddr` values.

9 years agotest: Make a test less flaky
Alex Crichton [Wed, 25 Mar 2015 22:26:39 +0000 (15:26 -0700)]
test: Make a test less flaky

It's considered an error to access stdout while a process is being shut down, so
tweak this test a bit to actually wait for the child thread to exit.

9 years agoAuto merge of #23695 - sae-bom:mac-android-debuginfo, r=alexcrichton
bors [Wed, 25 Mar 2015 21:29:50 +0000 (21:29 +0000)]
Auto merge of #23695 - sae-bom:mac-android-debuginfo, r=alexcrichton

1. when mac-android cross compile and make-check , make it use gdb instead of lldb so as to it passes debuginfo tests.
2. ignore some tests on aarch64

9 years agoAuto merge of #23434 - alexcrichton:misc-stab, r=aturon
bors [Wed, 25 Mar 2015 18:59:00 +0000 (18:59 +0000)]
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.

9 years agoAuto merge of #23697 - Manishearth:rollup, r=Manishearth
bors [Wed, 25 Mar 2015 14:14:04 +0000 (14:14 +0000)]
Auto merge of #23697 - Manishearth:rollup, r=Manishearth

- Successful merges: #23617, #23664, #23680, #23684, #23692, #23693
- Failed merges:

9 years agoRollup merge of #23702 - dotdash:match_reass, r=eddyb
Manish Goregaokar [Wed, 25 Mar 2015 14:14:32 +0000 (19:44 +0530)]
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

9 years agoRollup merge of #23693 - semarie:openbsd-pathbuf-new, r=nikomatsakis
Manish Goregaokar [Wed, 25 Mar 2015 11:42:14 +0000 (17:12 +0530)]
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.

9 years agoRollup merge of #23692 - yjh0502:fix/simd-overflow, r=pnkfelix
Manish Goregaokar [Wed, 25 Mar 2015 11:42:14 +0000 (17:12 +0530)]
Rollup merge of #23692 - yjh0502:fix/simd-overflow, r=pnkfelix

Disable overflow checking on SIMD operations, fix #23037

9 years agoRollup merge of #23684 - tamird:ios-fallout, r=alexcrichton
Manish Goregaokar [Wed, 25 Mar 2015 11:42:13 +0000 (17:12 +0530)]
Rollup merge of #23684 - tamird:ios-fallout, r=alexcrichton

r? @aturon cc @alexcrichton

9 years agoAlways properly copy values into bindings when mutating the match discriminant
Björn Steinbrink [Wed, 25 Mar 2015 13:50:04 +0000 (14:50 +0100)]
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

9 years agoRollup merge of #23664 - bluss:std-docs, r=steveklabnik
Manish Goregaokar [Wed, 25 Mar 2015 11:42:13 +0000 (17:12 +0530)]
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.

9 years agoRollup merge of #23617 - steveklabnik:gh23564, r=Manishearth
Manish Goregaokar [Wed, 25 Mar 2015 11:42:13 +0000 (17:12 +0530)]
Rollup merge of #23617 - steveklabnik:gh23564, r=Manishearth

Fixes #23564

9 years agoIgnore some tests on aarch64
Sae-bom Kim [Wed, 25 Mar 2015 09:17:33 +0000 (18:17 +0900)]
Ignore some tests on aarch64

9 years agomake it use gdb instead of lldb when mac-android cross compile
Sae-bom Kim [Wed, 25 Mar 2015 09:12:35 +0000 (18:12 +0900)]
make it use gdb instead of lldb when mac-android cross compile

9 years agoAuto merge of #23670 - cmr:vec-push-slowpath, r=pcwalton
bors [Wed, 25 Mar 2015 07:47:30 +0000 (07:47 +0000)]
Auto merge of #23670 - cmr:vec-push-slowpath, r=pcwalton

Makes Vec::push considerably smaller: 25 instructions, rather than 42, on
x86_64.

9 years agounbreak bitrig/openbsd build after 8389253d
Sébastien Marie [Wed, 25 Mar 2015 07:42:15 +0000 (08:42 +0100)]
unbreak bitrig/openbsd build after 8389253d

`PathBuf::new` have been changed. Use `PathBuf::from` instead.

Apply the same change for freebsd too, while here.

9 years agoFix ICE on SIMD overflow checking
Jihyun Yu [Wed, 25 Mar 2015 06:17:10 +0000 (15:17 +0900)]
Fix ICE on SIMD overflow checking

Disable overflow checking on SIMD operations, fix #23037

9 years ago[iOS] Fallout from 8389253
Tamir Duberstein [Wed, 25 Mar 2015 01:48:14 +0000 (18:48 -0700)]
[iOS] Fallout from 8389253

9 years agoAuto merge of #23681 - alexcrichton:rollup, r=alexcrichton
bors [Wed, 25 Mar 2015 01:42:42 +0000 (01:42 +0000)]
Auto merge of #23681 - alexcrichton:rollup, r=alexcrichton

9 years agoTest fixes and rebase conflicts, round 2
Alex Crichton [Tue, 24 Mar 2015 23:55:35 +0000 (16:55 -0700)]
Test fixes and rebase conflicts, round 2

9 years agorollup merge of #23674: nagisa/fallout-1
Alex Crichton [Tue, 24 Mar 2015 23:53:38 +0000 (16:53 -0700)]
rollup merge of #23674: nagisa/fallout-1

9 years agoTest fixes and rebase conflicts, round 1
Alex Crichton [Tue, 24 Mar 2015 23:48:50 +0000 (16:48 -0700)]
Test fixes and rebase conflicts, round 1

9 years agoAuto merge of #23546 - alexcrichton:hyphens, r=brson
bors [Tue, 24 Mar 2015 22:44:33 +0000 (22:44 +0000)]
Auto merge of #23546 - alexcrichton:hyphens, r=brson

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

9 years agoFix some fallout in librustdoc
Simonas Kazlauskas [Tue, 24 Mar 2015 22:39:29 +0000 (00:39 +0200)]
Fix some fallout in librustdoc

9 years agorollup merge of #23671: steveklabnik/doc_std_clone
Alex Crichton [Tue, 24 Mar 2015 22:27:16 +0000 (15:27 -0700)]
rollup merge of #23671: steveklabnik/doc_std_clone

9 years agorollup merge of #23638: pnkfelix/fsk-reject-specialized-drops
Alex Crichton [Tue, 24 Mar 2015 22:27:14 +0000 (15:27 -0700)]
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

9 years agorollup merge of #23546: alexcrichton/hyphens
Alex Crichton [Tue, 24 Mar 2015 21:56:00 +0000 (14:56 -0700)]
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

9 years agorustc: Add support for `extern crate foo as bar`
Alex Crichton [Thu, 19 Mar 2015 22:39:03 +0000 (15:39 -0700)]
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

9 years agorollup merge of #23668: alexcrichton/io-zero
Alex Crichton [Tue, 24 Mar 2015 21:50:48 +0000 (14:50 -0700)]
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

9 years agorollup merge of #23662: steveklabnik/gh23421
Alex Crichton [Tue, 24 Mar 2015 21:50:48 +0000 (14:50 -0700)]
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

9 years agorollup merge of #23661: steveklabnik/any_docs
Alex Crichton [Tue, 24 Mar 2015 21:50:48 +0000 (14:50 -0700)]
rollup merge of #23661: steveklabnik/any_docs

http://www.reddit.com/r/rust/comments/304q00/type_information_in_rust/cpp43lu

9 years agorollup merge of #23659: GBGamer/master
Alex Crichton [Tue, 24 Mar 2015 21:50:47 +0000 (14:50 -0700)]
rollup merge of #23659: GBGamer/master

For other permissions beside USR permissions, we need these constants.

fixes #23658

9 years agorollup merge of #23646: steveklabnik/doc_file
Alex Crichton [Tue, 24 Mar 2015 21:50:47 +0000 (14:50 -0700)]
rollup merge of #23646: steveklabnik/doc_file

This is pretty basic, but it's nice to have something.

r? @alexcrichton

9 years agorollup merge of #23630: nrc/coerce-tidy
Alex Crichton [Tue, 24 Mar 2015 21:50:46 +0000 (14:50 -0700)]
rollup merge of #23630: nrc/coerce-tidy

See notes on the first commit

Closes #18601

r? @nikomatsakis

cc @eddyb

9 years agorollup merge of #23629: liammonahan/master
Alex Crichton [Tue, 24 Mar 2015 21:50:45 +0000 (14:50 -0700)]
rollup merge of #23629: liammonahan/master

Found a small typo on the Rust book "ownership" page.

Best,
Liam

r? @steveklabnik

9 years agorollup merge of #23592: alexcrichton/tweak-at-exit
Alex Crichton [Tue, 24 Mar 2015 21:50:45 +0000 (14:50 -0700)]
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.

9 years agorollup merge of #23573: steveklabnik/doc_associated_types
Alex Crichton [Tue, 24 Mar 2015 21:50:44 +0000 (14:50 -0700)]
rollup merge of #23573: steveklabnik/doc_associated_types

9 years agorollup merge of #23282: nikomatsakis/fn-trait-inheritance
Alex Crichton [Tue, 24 Mar 2015 21:50:44 +0000 (14:50 -0700)]
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

9 years agosyntax: Update #[derive(...)] to work with phantom and associated types
Erick Tryzelaar [Tue, 24 Mar 2015 21:43:26 +0000 (14:43 -0700)]
syntax: Update #[derive(...)] to work with phantom and associated types

Closes #7671, #19839

9 years agoBug fixes
Nick Cameron [Tue, 24 Mar 2015 00:50:14 +0000 (13:50 +1300)]
Bug fixes

9 years agoUnit tests for Issue 8142, collected into one file.
Felix S. Klock II [Tue, 24 Mar 2015 09:46:40 +0000 (10:46 +0100)]
Unit tests for Issue 8142, collected into one file.

9 years agoReject specialized Drop impls.
Felix S. Klock II [Sat, 21 Mar 2015 12:12:08 +0000 (13:12 +0100)]
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.

9 years agoAdded `T:Send` bound to `JoinGuard<T>` to avoid specialized `Drop` impl.
Felix S. Klock II [Sat, 21 Mar 2015 12:34:33 +0000 (13:34 +0100)]
Added `T:Send` bound to `JoinGuard<T>` to avoid specialized `Drop` impl.

9 years agoAdded `T:Send` bound to `Queue<T>` to avoid specialized `Drop` impl.
Felix S. Klock II [Sat, 21 Mar 2015 12:33:12 +0000 (13:33 +0100)]
Added `T:Send` bound to `Queue<T>` to avoid specialized `Drop` impl.

9 years agoAdded `T:Send` bound to `Packet<T>` to avoid specialized `Drop` impl.
Felix S. Klock II [Sat, 21 Mar 2015 12:31:58 +0000 (13:31 +0100)]
Added `T:Send` bound to `Packet<T>` to avoid specialized `Drop` impl.

9 years agoadded `T:Send` bound to `Mutex<T>` to avoid specialized Drop impl.
Felix S. Klock II [Sat, 21 Mar 2015 12:30:26 +0000 (13:30 +0100)]
added `T:Send` bound to `Mutex<T>` to avoid specialized Drop impl.

9 years agoAdded `W: Writer` bound to `BufferedWriter<W>` to avoid specialized `Drop` impl.
Felix S. Klock II [Sat, 21 Mar 2015 12:28:20 +0000 (13:28 +0100)]
Added `W: Writer` bound to `BufferedWriter<W>` to avoid specialized `Drop` impl.

9 years agoAdded `T:Send` bound to `Queue<T>` to avoid specialized Drop impl.
Felix S. Klock II [Sat, 21 Mar 2015 12:22:21 +0000 (13:22 +0100)]
Added `T:Send` bound to `Queue<T>` to avoid specialized Drop impl.

9 years agoAdded `Write` bounds to avoid a specialized Drop impl for `BufWriter`.
Felix S. Klock II [Sat, 21 Mar 2015 12:20:12 +0000 (13:20 +0100)]
Added `Write` bounds to avoid a specialized Drop impl for `BufWriter`.

9 years agoAdded `T:Send` bound to `sync::mpsc::Receiver` and `sync::mpsc::Sender`.
Felix S. Klock II [Sat, 21 Mar 2015 12:14:28 +0000 (13:14 +0100)]
Added `T:Send` bound to `sync::mpsc::Receiver` and `sync::mpsc::Sender`.

This was necessary to avoid specialized `Drop` impls for the two structs.

9 years agoRemove unnecessary bounds from Drop impl for `Arc` and `arc::Weak` and
Felix S. Klock II [Sat, 21 Mar 2015 12:13:07 +0000 (13:13 +0100)]
Remove unnecessary bounds from Drop impl for `Arc` and `arc::Weak` and
one of the helper method impls.

9 years agotest: silence a warning
Erick Tryzelaar [Wed, 14 Jan 2015 16:16:35 +0000 (08:16 -0800)]
test: silence a warning

9 years agocollections: Update docs for slice since SliceExt was removed
Ulrik Sverdrup [Tue, 24 Mar 2015 18:47:00 +0000 (19:47 +0100)]
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.

9 years agocore: Update docs for StrExt demotion in libstd
Ulrik Sverdrup [Tue, 24 Mar 2015 18:57:49 +0000 (19:57 +0100)]
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).

9 years agostd: Update docs for removal of ReadExt, WriteExt
Ulrik Sverdrup [Tue, 24 Mar 2015 18:37:52 +0000 (19:37 +0100)]
std: Update docs for removal of ReadExt, WriteExt

9 years agolibcollections: move Vec::push slow path out
Corey Richardson [Tue, 24 Mar 2015 20:17:15 +0000 (16:17 -0400)]
libcollections: move Vec::push slow path out

Makes Vec::push considerably smaller: 25 instructions, rather than 42, on
x86_64.

9 years agoChange lint names to plurals
Nick Cameron [Mon, 23 Mar 2015 22:23:34 +0000 (11:23 +1300)]
Change lint names to plurals

9 years agoAdd tests
Nick Cameron [Mon, 23 Mar 2015 04:28:57 +0000 (17:28 +1300)]
Add tests

9 years agoRemove the UnusedCasts lint
Nick Cameron [Mon, 23 Mar 2015 02:50:32 +0000 (15:50 +1300)]
Remove the UnusedCasts lint

9 years agoMinor refactoring in coercion.rs
Nick Cameron [Mon, 23 Mar 2015 02:26:51 +0000 (15:26 +1300)]
Minor refactoring in coercion.rs

9 years agoAdd trivial cast lints.
Nick Cameron [Fri, 20 Mar 2015 04:15:27 +0000 (17:15 +1300)]
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;
```

9 years agoAn example for clone
Steve Klabnik [Tue, 24 Mar 2015 20:58:08 +0000 (16:58 -0400)]
An example for clone

9 years agostd: Zero memory when calling `read_to_end()`
Alex Crichton [Tue, 24 Mar 2015 18:14:35 +0000 (11:14 -0700)]
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

9 years agoAuto merge of #23654 - alexcrichton:rollup, r=alexcrichton
bors [Tue, 24 Mar 2015 17:38:09 +0000 (17:38 +0000)]
Auto merge of #23654 - alexcrichton:rollup, r=alexcrichton

9 years agoTest fixes and rebase conflicts, round 4
Alex Crichton [Tue, 24 Mar 2015 17:23:47 +0000 (10:23 -0700)]
Test fixes and rebase conflicts, round 4

9 years agocorrect reference wrt shifts
Steve Klabnik [Tue, 24 Mar 2015 16:41:22 +0000 (12:41 -0400)]
correct reference wrt shifts

Fixes #23421

9 years agoClean up Any's title line
Steve Klabnik [Tue, 24 Mar 2015 16:15:49 +0000 (12:15 -0400)]
Clean up Any's title line

http://www.reddit.com/r/rust/comments/304q00/type_information_in_rust/cpp43lu

9 years agoAdd basic information about associated types
Steve Klabnik [Sat, 21 Mar 2015 02:09:57 +0000 (22:09 -0400)]
Add basic information about associated types

9 years agoMerge remote-tracking branch 'origin/master' into rollup
Alex Crichton [Tue, 24 Mar 2015 15:03:25 +0000 (08:03 -0700)]
Merge remote-tracking branch 'origin/master' into rollup

9 years agoAdd Examples for File
Steve Klabnik [Mon, 23 Mar 2015 19:40:43 +0000 (15:40 -0400)]
Add Examples for File

This is pretty basic, but it's nice to have something.

9 years agoAdd the other S_I(RWX)(GRP/OTH) for posix `creat`
Nicholas Mazzuca [Tue, 24 Mar 2015 10:25:48 +0000 (03:25 -0700)]
Add the other S_I(RWX)(GRP/OTH) for posix `creat`

9 years agoTest fixes and rebase conflicts, round 3
Alex Crichton [Tue, 24 Mar 2015 00:29:51 +0000 (17:29 -0700)]
Test fixes and rebase conflicts, round 3

9 years agoImprove the wording of the example section description on the ownership page
Liam Monahan [Tue, 24 Mar 2015 01:19:54 +0000 (21:19 -0400)]
Improve the wording of the example section description on the ownership page
to make it more clear.

9 years agorollup merge of #23653: dhuseby/bitrig-stage0-c64d671
Alex Crichton [Tue, 24 Mar 2015 00:13:39 +0000 (17:13 -0700)]
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

9 years agorollup merge of #23652: alexcrichton/stabilize-hasher-finish
Alex Crichton [Tue, 24 Mar 2015 00:13:38 +0000 (17:13 -0700)]
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.

9 years agorollup merge of #23645: steveklabnik/gh23642
Alex Crichton [Tue, 24 Mar 2015 00:13:38 +0000 (17:13 -0700)]
rollup merge of #23645: steveklabnik/gh23642

Fixes #23642

9 years agorollup merge of #23644: mbrubeck/doc-edit
Alex Crichton [Tue, 24 Mar 2015 00:13:37 +0000 (17:13 -0700)]
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

9 years agorollup merge of #23509: aturon/stab-entry
Alex Crichton [Tue, 24 Mar 2015 00:13:27 +0000 (17:13 -0700)]
rollup merge of #23509: aturon/stab-entry

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

9 years agoTest fixes and rebase conflicts, round 2
Alex Crichton [Mon, 23 Mar 2015 22:54:39 +0000 (15:54 -0700)]
Test fixes and rebase conflicts, round 2

9 years agoFallout from changing fn traits to use inheritance rather than bridge
Niko Matsakis [Wed, 11 Mar 2015 14:08:33 +0000 (10:08 -0400)]
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.

9 years agoadding lastest Bitrig snapshot by hand
Dave Huseby [Mon, 23 Mar 2015 22:58:44 +0000 (15:58 -0700)]
adding lastest Bitrig snapshot by hand

9 years agoUpdate docs for ptr module.
Matt Brubeck [Mon, 23 Mar 2015 18:11:12 +0000 (11:11 -0700)]
Update docs for ptr module.

PR #23104 moved `is_null` and `offset` to an inherent impl on the raw pointer
type.

9 years agoStabilize Entry types
Aaron Turon [Thu, 19 Mar 2015 06:36:19 +0000 (23:36 -0700)]
Stabilize Entry types

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.

9 years agoAuto merge of #23536 - pnkfelix:arith-oflo-shifts, r=nikomatsakis
bors [Mon, 23 Mar 2015 22:43:39 +0000 (22:43 +0000)]
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))

9 years agorollup merge of #23506: alexcrichton/remove-some-deprecated-things
Alex Crichton [Mon, 23 Mar 2015 22:27:06 +0000 (15:27 -0700)]
rollup merge of #23506: alexcrichton/remove-some-deprecated-things

Conflicts:
src/test/run-pass/deprecated-no-split-stack.rs

9 years agorollup merge of #23503: alexcrichton/fix-ptr-docs
Alex Crichton [Mon, 23 Mar 2015 22:26:24 +0000 (15:26 -0700)]
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.

9 years agorollup merge of #23484: alexcrichton/marker-trait-stable
Alex Crichton [Mon, 23 Mar 2015 22:26:24 +0000 (15:26 -0700)]
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.

9 years agoTest fixes and rebase conflicts, round 1
Alex Crichton [Mon, 23 Mar 2015 22:18:40 +0000 (15:18 -0700)]
Test fixes and rebase conflicts, round 1

9 years agorollup merge of #23383: alexcrichton/fs-create-dir-all
Alex Crichton [Mon, 23 Mar 2015 22:18:24 +0000 (15:18 -0700)]
rollup merge of #23383: alexcrichton/fs-create-dir-all

Conflicts:
src/libstd/fs/mod.rs

9 years agorollup merge of #23598: brson/gate
Alex Crichton [Mon, 23 Mar 2015 22:13:15 +0000 (15:13 -0700)]
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

9 years agorollup merge of #23650: brson/32-bit-userspace
Alex Crichton [Mon, 23 Mar 2015 22:11:18 +0000 (15:11 -0700)]
rollup merge of #23650: brson/32-bit-userspace

The variable '$SHELL' is not actually defined by 'sh'.

This makes Rust build correctly in popular Docker images.

9 years agorollup merge of #23648: steveklabnik/rollup
Alex Crichton [Mon, 23 Mar 2015 22:11:15 +0000 (15:11 -0700)]
rollup merge of #23648: steveklabnik/rollup

- Successful merges: #22954, #23119, #23509, #23561, #23590, #23607, #23608, #23618, #23622, #23639, #23641
- Failed merges: #23401

9 years agorollup merge of #23641: steveklabnik/gh23632
Alex Crichton [Mon, 23 Mar 2015 22:11:13 +0000 (15:11 -0700)]
rollup merge of #23641: steveklabnik/gh23632

Fixes #23632