]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoRollup merge of #23607 - mahkoh:cursor, r=alexcrichton
Steve Klabnik [Mon, 23 Mar 2015 21:05:44 +0000 (17:05 -0400)]
Rollup merge of #23607 - mahkoh:cursor, r=alexcrichton

Closes #23599

r? @alexcrichton

9 years agoRollup merge of #23590 - FuGangqiang:attr, r=alexcrichton
Steve Klabnik [Mon, 23 Mar 2015 21:05:44 +0000 (17:05 -0400)]
Rollup merge of #23590 - FuGangqiang:attr, r=alexcrichton

9 years agoRollup merge of #23561 - steveklabnik:gh23422, r=alexcrichton
Steve Klabnik [Mon, 23 Mar 2015 21:05:44 +0000 (17:05 -0400)]
Rollup merge of #23561 - steveklabnik:gh23422, r=alexcrichton

Fixes #23422

9 years agoRollup merge of #23509 - aturon:stab-entry, r=Gankro
Steve Klabnik [Mon, 23 Mar 2015 21:05:44 +0000 (17:05 -0400)]
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

9 years agoRollup merge of #23119 - nikomatsakis:issue-23116-ref-mut, r=pnkfelix
Steve Klabnik [Mon, 23 Mar 2015 21:05:43 +0000 (17:05 -0400)]
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

9 years agoRollup merge of #22954 - ches:docs, r=steveklabnik
Steve Klabnik [Mon, 23 Mar 2015 21:05:43 +0000 (17:05 -0400)]
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 :smile:

### 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 :grin: 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]: https://github.com/rust-lang/rust/blob/157614249594f187f421cd97f928e64c5ab5c1fa/src/doc/trpl/traits.md#our-inverse-example
[2]: https://github.com/rust-lang/rust/blob/157614249594f187f421cd97f928e64c5ab5c1fa/src/doc/trpl/static-and-dynamic-dispatch.md#why-pointers
[3]: https://github.com/rust-lang/rust/blob/157614249594f187f421cd97f928e64c5ab5c1fa/src/doc/trpl/documentation.md#creating-documentation
[4]: http://doc.rust-lang.org/reference.html#linkage
[5]: https://github.com/rust-lang/rust/blob/157614249594f187f421cd97f928e64c5ab5c1fa/src/doc/trpl/hello-world.md
[6]: https://github.com/rust-lang/rust/blob/157614249594f187f421cd97f928e64c5ab5c1fa/src/doc/trpl/compound-data-types.md#enums

9 years agoderive missing trait implementations for cursor
Julian Orth [Sun, 22 Mar 2015 15:16:04 +0000 (16:16 +0100)]
derive missing trait implementations for cursor

9 years agoAdd note about pointer state after the call.
Steve Klabnik [Fri, 20 Mar 2015 19:22:57 +0000 (15:22 -0400)]
Add note about pointer state after the call.

Fixes #23422

9 years agoWhen matching against a pattern (either via `match` or `let`) that
Niko Matsakis [Fri, 6 Mar 2015 15:14:12 +0000 (10:14 -0500)]
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.

9 years agoAuto merge of #23593 - Manishearth:rollup, r=Manishearth
bors [Mon, 23 Mar 2015 00:37:35 +0000 (00:37 +0000)]
Auto merge of #23593 - Manishearth:rollup, r=Manishearth

(yay, no Saturday)

9 years agoRollup merge of #23590 - FuGangqiang:attr, r=alexcrichton
Manish Goregaokar [Sat, 21 Mar 2015 20:06:41 +0000 (01:36 +0530)]
Rollup merge of #23590 - FuGangqiang:attr, r=alexcrichton

9 years agoRollup merge of #23576 - barosl:mutex-doc, r=alexcrichton
Manish Goregaokar [Sat, 21 Mar 2015 20:06:33 +0000 (01:36 +0530)]
Rollup merge of #23576 - barosl:mutex-doc, r=alexcrichton

9 years agoadd lifetime for `while` and `for` expression
FuGangqiang [Sat, 21 Mar 2015 15:59:30 +0000 (23:59 +0800)]
add lifetime for `while` and `for` expression

9 years agoRollup merge of #23562 - steveklabnik:fix_book_numbers, r=alexcrichton
Manish Goregaokar [Sat, 21 Mar 2015 20:06:25 +0000 (01:36 +0530)]
Rollup merge of #23562 - steveklabnik:fix_book_numbers, r=alexcrichton

 Rustbook already does this.

9 years agofix the attributes sytax
FuGangqiang [Sat, 21 Mar 2015 14:56:05 +0000 (22:56 +0800)]
fix the attributes sytax

9 years agoRollup merge of #23555 - steveklabnik:environment, r=sanxiyn
Manish Goregaokar [Sat, 21 Mar 2015 20:06:18 +0000 (01:36 +0530)]
Rollup merge of #23555 - steveklabnik:environment, r=sanxiyn

 As @sanxiyn says,
https://github.com/rust-lang/rust/pull/23527#issuecomment-83835448

9 years agoRollup merge of #23554 - Ms2ger:readme-rustc, r=steveklabnik
Manish Goregaokar [Sat, 21 Mar 2015 20:06:09 +0000 (01:36 +0530)]
Rollup merge of #23554 - Ms2ger:readme-rustc, r=steveklabnik

9 years agoRollup merge of #23578 - fhahn:issue-22820-feature-gate-tests1, r=alexcrichton
Manish Goregaokar [Sat, 21 Mar 2015 20:06:01 +0000 (01:36 +0530)]
Rollup merge of #23578 - fhahn:issue-22820-feature-gate-tests1, r=alexcrichton

 ...ures.

Namely:

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

cc #22820

9 years agoRollup merge of #23570 - dotdash:issue23550, r=eddyb
Manish Goregaokar [Sat, 21 Mar 2015 20:05:49 +0000 (01:35 +0530)]
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

9 years agoRollup merge of #23559 - aturon:future-proof-map-index, r=Gankro
Manish Goregaokar [Sat, 21 Mar 2015 20:05:39 +0000 (01:35 +0530)]
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

9 years agoAuto merge of #23361 - petrochenkov:refdst, r=jakub-
bors [Sun, 22 Mar 2015 15:52:30 +0000 (15:52 +0000)]
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.

9 years agoadd lifetime for `while` and `for` expression
FuGangqiang [Sat, 21 Mar 2015 15:59:30 +0000 (23:59 +0800)]
add lifetime for `while` and `for` expression

9 years agofix the attributes sytax
FuGangqiang [Sat, 21 Mar 2015 14:56:05 +0000 (22:56 +0800)]
fix the attributes sytax

9 years agoFix volatile / atomic ops on bools and small aggregates
Björn Steinbrink [Fri, 20 Mar 2015 23:21:38 +0000 (00:21 +0100)]
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

9 years ago Add tests checking that a number of feature gates are gating their features.
Florian Hahn [Fri, 20 Mar 2015 23:23:39 +0000 (00:23 +0100)]
 Add tests checking that a number of feature gates are gating their features.

Namely:

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

 cc #22820

9 years agoFix documentation for std::sync::mutex: into_guard -> into_inner
Barosl Lee [Sat, 21 Mar 2015 05:38:23 +0000 (14:38 +0900)]
Fix documentation for std::sync::mutex: into_guard -> into_inner

9 years agoAuto merge of #23470 - alexcrichton:less-prelude, r=aturon
bors [Sat, 21 Mar 2015 05:25:21 +0000 (05:25 +0000)]
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

9 years agostd: Remove old_io/old_path from the prelude
Alex Crichton [Tue, 17 Mar 2015 20:33:26 +0000 (13:33 -0700)]
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

9 years agoAuto merge of #23512 - oli-obk:result_ok_unwrap, r=alexcrichton
bors [Fri, 20 Mar 2015 23:16:47 +0000 (23:16 +0000)]
Auto merge of #23512 - oli-obk:result_ok_unwrap, r=alexcrichton

because then the call to `unwrap()` will not print the error object.

9 years agoguide: Improvements to language covering enums
Ches Martin [Mon, 2 Mar 2015 04:54:37 +0000 (23:54 -0500)]
guide: Improvements to language covering enums

9 years agoguide: minor copy edits
Ches Martin [Mon, 2 Mar 2015 04:45:53 +0000 (23:45 -0500)]
guide: minor copy edits

9 years agoAuto merge of #23267 - alexcrichton:issue-20012, r=aturon
bors [Fri, 20 Mar 2015 20:19:42 +0000 (20:19 +0000)]
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.

9 years agoRemove manual numbers from TRPL
Steve Klabnik [Fri, 20 Mar 2015 19:26:26 +0000 (15:26 -0400)]
Remove manual numbers from TRPL

Rustbook already does this.

9 years agoRevert "Revert "std: Re-enable at_exit()""
Alex Crichton [Thu, 1 Jan 2015 18:19:42 +0000 (10:19 -0800)]
Revert "Revert "std: Re-enable at_exit()""

This reverts commit aec67c2ee0f673ea7b0e21c2fe7e0f26a523d823.

9 years agoFuture-proof indexing on maps: remove IndexMut
Aaron Turon [Fri, 20 Mar 2015 17:22:57 +0000 (10:22 -0700)]
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

9 years agoAuto merge of #23471 - sae-bom:aarch64-linux-android, r=alexcrichton
bors [Fri, 20 Mar 2015 17:45:15 +0000 (17:45 +0000)]
Auto merge of #23471 - sae-bom:aarch64-linux-android, r=alexcrichton

Resolved #21773. (Aarch64 test has been broken again)
r? @alexcrichton

9 years agoAuto merge of #23537 - steveklabnik:gh22551, r=alexcrichton
bors [Fri, 20 Mar 2015 15:02:55 +0000 (15:02 +0000)]
Auto merge of #23537 - steveklabnik:gh22551, r=alexcrichton

Fixes #22551

('grammar' wasn't really used in the chapter at all)

9 years agoAdd AST to the glossary
Steve Klabnik [Thu, 19 Mar 2015 23:42:35 +0000 (19:42 -0400)]
Add AST to the glossary

Fixes #22551

9 years agoenvironment variables -> environment
Steve Klabnik [Fri, 20 Mar 2015 14:53:47 +0000 (10:53 -0400)]
environment variables -> environment

As @sanxiyn says,
https://github.com/rust-lang/rust/pull/23527#issuecomment-83835448

9 years agoMake librustc's markdown README.txt claim to be markdown.
Ms2ger [Fri, 20 Mar 2015 12:28:06 +0000 (13:28 +0100)]
Make librustc's markdown README.txt claim to be markdown.

This allows github to render it with formatting.

9 years agoUpdate librustc's README.txt for some code changes and reformat it.
Ms2ger [Fri, 20 Mar 2015 11:55:07 +0000 (12:55 +0100)]
Update librustc's README.txt for some code changes and reformat it.

9 years agoAuto merge of #23522 - steveklabnik:gh22518, r=Manishearth
bors [Fri, 20 Mar 2015 11:29:12 +0000 (11:29 +0000)]
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.

9 years agodon't use Result::ok just to be able to use unwrap/unwrap_or
Oliver Schneider [Fri, 20 Mar 2015 07:19:13 +0000 (08:19 +0100)]
don't use Result::ok just to be able to use unwrap/unwrap_or

9 years agoAuto merge of #23548 - Manishearth:rollup, r=Manishearth
bors [Fri, 20 Mar 2015 07:12:39 +0000 (07:12 +0000)]
Auto merge of #23548 - Manishearth:rollup, r=Manishearth

9 years agoRollup merge of #23534 - steveklabnik:remove_sched_threads, r=alexcrichton
Manish Goregaokar [Fri, 20 Mar 2015 00:06:15 +0000 (05:36 +0530)]
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]

9 years agoRollup merge of #23532 - steveklabnik:gh22002, r=alexcrichton
Manish Goregaokar [Fri, 20 Mar 2015 00:01:39 +0000 (05:31 +0530)]
Rollup merge of #23532 - steveklabnik:gh22002, r=alexcrichton

 Fixes #22002

9 years agoRollup merge of #23527 - steveklabnik:gh16330, r=alexcrichton
Manish Goregaokar [Fri, 20 Mar 2015 00:01:30 +0000 (05:31 +0530)]
Rollup merge of #23527 - steveklabnik:gh16330, r=alexcrichton

 Fixes #16330

My troff is probably poor, so make sure that all looks okay.

9 years agoRollup merge of #23526 - mbrubeck:uppercase, r=steveklabnik
Manish Goregaokar [Fri, 20 Mar 2015 00:01:24 +0000 (05:31 +0530)]
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.

9 years agoRollup merge of #23518 - farcaller:fix_quote_method, r=eddyb
Manish Goregaokar [Fri, 20 Mar 2015 00:01:12 +0000 (05:31 +0530)]
Rollup merge of #23518 - farcaller:fix_quote_method, r=eddyb

 This fixes several use cases that were broken after #23265 landed.

9 years agoRollup merge of #23510 - lgvz:makefile, r=Manishearth
Manish Goregaokar [Fri, 20 Mar 2015 00:01:06 +0000 (05:31 +0530)]
Rollup merge of #23510 - lgvz:makefile, r=Manishearth

 The wiki doesn't seem to exist

9 years agoRollup merge of #23499 - mbrubeck:doc-edit, r=huonw
Manish Goregaokar [Fri, 20 Mar 2015 00:01:00 +0000 (05:31 +0530)]
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.

9 years agoRollup merge of #23447 - kjpgit:kjp/pointerexample, r=steveklabnik
Manish Goregaokar [Fri, 20 Mar 2015 00:00:49 +0000 (05:30 +0530)]
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 &*.

9 years agoRollup merge of #22631 - aepsil0n:issue-22098, r=aturon
Manish Goregaokar [Fri, 20 Mar 2015 00:00:44 +0000 (05:30 +0530)]
Rollup merge of #22631 - aepsil0n:issue-22098, r=aturon

 Fixes #22098.

9 years agoRollup merge of #23531 - steveklabnik:gh21709, r=alexcrichton
Manish Goregaokar [Fri, 20 Mar 2015 00:00:39 +0000 (05:30 +0530)]
Rollup merge of #23531 - steveklabnik:gh21709, r=alexcrichton

 Fixes #21709

9 years agoRollup merge of #23529 - steveklabnik:gh23426, r=alexcrichton
Manish Goregaokar [Fri, 20 Mar 2015 00:00:34 +0000 (05:30 +0530)]
Rollup merge of #23529 - steveklabnik:gh23426, r=alexcrichton

 Fixes #23426

9 years agoRollup merge of #23525 - steveklabnik:test_tasks, r=alexcrichton
Manish Goregaokar [Fri, 20 Mar 2015 00:00:28 +0000 (05:30 +0530)]
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.

9 years agoRollup merge of #23504 - alexcrichton:parse-error-not-unit, r=aturon
Manish Goregaokar [Fri, 20 Mar 2015 00:00:23 +0000 (05:30 +0530)]
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]

9 years agoAuto merge of #23504 - alexcrichton:parse-error-not-unit, r=aturon
bors [Fri, 20 Mar 2015 04:30:04 +0000 (04:30 +0000)]
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]

9 years agoAuto merge of #23254 - jbcrail:saturating-math-docs, r=steveklabnik
bors [Fri, 20 Mar 2015 01:35:54 +0000 (01:35 +0000)]
Auto merge of #23254 - jbcrail:saturating-math-docs, r=steveklabnik

This was added for #23241.

9 years agoRemove rt::default_sched_threads and RUST_THREADS.
Steve Klabnik [Thu, 19 Mar 2015 22:38:16 +0000 (18:38 -0400)]
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

9 years agoRollup merge of #23254 - jbcrail:saturating-math-docs, r=steveklabnik
Manish Goregaokar [Fri, 20 Mar 2015 00:00:12 +0000 (05:30 +0530)]
Rollup merge of #23254 - jbcrail:saturating-math-docs, r=steveklabnik

 This was added for #23241.

9 years agoRollup merge of #23489 - michaelwoerister:span-artihmetic-overflow-bug, r=alexcrichton
Manish Goregaokar [Fri, 20 Mar 2015 00:00:06 +0000 (05:30 +0530)]
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.

9 years agoDocument environment variables
Steve Klabnik [Thu, 19 Mar 2015 20:38:06 +0000 (16:38 -0400)]
Document environment variables

Fixes #16330

9 years agoAuto merge of #23489 - michaelwoerister:span-artihmetic-overflow-bug, r=alexcrichton
bors [Thu, 19 Mar 2015 22:37:02 +0000 (22:37 +0000)]
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.

9 years agoComment on when ReadDir is Err
Steve Klabnik [Thu, 19 Mar 2015 20:53:06 +0000 (16:53 -0400)]
Comment on when ReadDir is Err

Fixes #23426

9 years agoReference Drop in FFI chapter
Steve Klabnik [Thu, 19 Mar 2015 22:11:35 +0000 (18:11 -0400)]
Reference Drop in FFI chapter

Fixes #22002

9 years agoRemove incorrect statement about raw pointers.
Steve Klabnik [Thu, 19 Mar 2015 22:06:54 +0000 (18:06 -0400)]
Remove incorrect statement about raw pointers.

Fixes #21709

9 years agoUpdate docs for ToUppercase/ToLowercase structs
Matt Brubeck [Thu, 19 Mar 2015 20:34:18 +0000 (13:34 -0700)]
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.

9 years agoRUST_TEST_TASKS -> RUST_TEST_THREADS
Steve Klabnik [Thu, 19 Mar 2015 19:42:53 +0000 (15:42 -0400)]
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]

9 years agoRemove the Guessing Game from the book
Steve Klabnik [Thu, 19 Mar 2015 19:19:20 +0000 (15:19 -0400)]
Remove the Guessing Game from the book

Fixes #22518

9 years agoAuto merge of #23430 - alexcrichton:io-error, r=aturon
bors [Thu, 19 Mar 2015 19:15:22 +0000 (19:15 +0000)]
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]

9 years agoAdd test case for stable import of invalid span information.
Michael Woerister [Wed, 18 Mar 2015 21:05:24 +0000 (22:05 +0100)]
Add test case for stable import of invalid span information.

9 years agoAdded missing impl_to_source! and impl_to_tokens! for TraitItem.
Vladimir Pouzanov [Thu, 19 Mar 2015 17:01:46 +0000 (17:01 +0000)]
Added missing impl_to_source! and impl_to_tokens! for TraitItem.

9 years agoAdded missing impl_to_source! and impl_to_tokens! for ImplItem.
Vladimir Pouzanov [Thu, 19 Mar 2015 17:01:15 +0000 (17:01 +0000)]
Added missing impl_to_source! and impl_to_tokens! for ImplItem.

This fixes several use cases that were broken after #23265 landed.

9 years agostd: Stablize io::ErrorKind
Alex Crichton [Tue, 17 Mar 2015 01:08:57 +0000 (18:08 -0700)]
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`.

9 years agoAuto merge of #23213 - ipetkov:rustdoc-src-fix, r=huonw
bors [Thu, 19 Mar 2015 16:42:16 +0000 (16:42 +0000)]
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

9 years agoAuto merge of #23498 - pcwalton:inline-police, r=cmr
bors [Thu, 19 Mar 2015 13:10:37 +0000 (13:10 +0000)]
Auto merge of #23498 - pcwalton:inline-police, r=cmr

r? @cmr

9 years agoAllow Float::ldexp to be called as a method
Eduard Bopp [Sat, 21 Feb 2015 14:05:34 +0000 (15:05 +0100)]
Allow Float::ldexp to be called as a method

Fixes #22098.

9 years agoAuto merge of #23507 - jbcrail:fix-comment-spelling, r=alexcrichton
bors [Thu, 19 Mar 2015 09:50:13 +0000 (09:50 +0000)]
Auto merge of #23507 - jbcrail:fix-comment-spelling, r=alexcrichton

I corrected misspelled comments in several crates.

9 years agoRemove dead link to wiki in Makefile comments
Tero Hänninen [Thu, 19 Mar 2015 06:51:52 +0000 (08:51 +0200)]
Remove dead link to wiki in Makefile comments

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 agoIgnore some tests on aarch64 to pass the run-pass test on aarch64-linux-android
Sae-bom Kim [Wed, 18 Mar 2015 07:57:29 +0000 (16:57 +0900)]
Ignore some tests on aarch64 to pass the run-pass test on aarch64-linux-android

9 years agolibunicode: Partially inline the fast paths in character class checking.
Patrick Walton [Thu, 19 Mar 2015 00:36:34 +0000 (17:36 -0700)]
libunicode: Partially inline the fast paths in character class checking.

9 years agoliballoc: Partially inline the refcount manipulation in the Arc
Patrick Walton [Thu, 19 Mar 2015 00:35:11 +0000 (17:35 -0700)]
liballoc: Partially inline the refcount manipulation in the Arc
destructor.

9 years agoFix spelling errors in comments.
Joseph Crail [Thu, 19 Mar 2015 04:48:08 +0000 (00:48 -0400)]
Fix spelling errors in comments.

I corrected misspelled comments in several crates.

9 years agoAuto merge of #23502 - Manishearth:rollup, r=Manishearth
bors [Thu, 19 Mar 2015 03:19:08 +0000 (03:19 +0000)]
Auto merge of #23502 - Manishearth:rollup, r=Manishearth

9 years agoRm unused feature
Manish Goregaokar [Thu, 19 Mar 2015 01:54:13 +0000 (07:24 +0530)]
Rm unused feature

9 years agoRollup merge of #23428 - Manishearth:ast-doc, r=steveklabnik
Manish Goregaokar [Thu, 19 Mar 2015 01:31:50 +0000 (07:01 +0530)]
Rollup merge of #23428 - Manishearth:ast-doc, r=steveklabnik

 I often have to run `ast-json` or look into the pretty-printer source to figure out what the fields of an AST enum mean. I've tried to document most of what I know (and some semi-obvious stuff).

r? @steveklabnik

f? @eddyb

9 years agoRollup merge of #23497 - steveklabnik:gh21589, r=alexcrichton
Manish Goregaokar [Thu, 19 Mar 2015 00:40:02 +0000 (06:10 +0530)]
Rollup merge of #23497 - steveklabnik:gh21589, r=alexcrichton

 Fixes #21589

9 years agoRollup merge of #23496 - steveklabnik:gh22309, r=nikomatsakis
Manish Goregaokar [Thu, 19 Mar 2015 00:39:56 +0000 (06:09 +0530)]
Rollup merge of #23496 - steveklabnik:gh22309, r=nikomatsakis

 Fixes #22309

I am pretty sure that this is the right way to do this, given the other macros, but I'm not 100% sure.

9 years agoRollup merge of #23495 - pcwalton:inline-cell, r=cmr
Manish Goregaokar [Thu, 19 Mar 2015 00:39:49 +0000 (06:09 +0530)]
Rollup merge of #23495 - pcwalton:inline-cell, r=cmr

 This is a significant performance problem in Servo.

r? @brson

9 years agoRollup merge of #23494 - mdinger:patch-1, r=steveklabnik
Manish Goregaokar [Thu, 19 Mar 2015 00:39:43 +0000 (06:09 +0530)]
Rollup merge of #23494 - mdinger:patch-1, r=steveklabnik

 Typo

9 years agoRollup merge of #23493 - steveklabnik:gh22927, r=alexcrichton
Manish Goregaokar [Thu, 19 Mar 2015 00:39:37 +0000 (06:09 +0530)]
Rollup merge of #23493 - steveklabnik:gh22927, r=alexcrichton

 And do some formatting while I'm here.

9 years agoRollup merge of #23490 - jooert:master, r=steveklabnik
Manish Goregaokar [Thu, 19 Mar 2015 00:39:31 +0000 (06:09 +0530)]
Rollup merge of #23490 - jooert:master, r=steveklabnik

 Update documentation to reflect #21824.

r? @steveklabnik

9 years agoRollup merge of #23483 - semarie:openbsd-threads, r=alexcrichton
Manish Goregaokar [Thu, 19 Mar 2015 00:39:25 +0000 (06:09 +0530)]
Rollup merge of #23483 - semarie:openbsd-threads, r=alexcrichton

 unbreak openbsd/bitrig build
- remove `pub` from `struct` (error: visibility has no effect inside functions)
- move `pthread_main_np` into function

r? @alexcrichton

9 years agoRollup merge of #23474 - nagisa:patch-1, r=steveklabnik
Manish Goregaokar [Thu, 19 Mar 2015 00:39:20 +0000 (06:09 +0530)]
Rollup merge of #23474 - nagisa:patch-1, r=steveklabnik

 r? @steveklabnik

9 years agoRollup merge of #23479 - tamird:fix-ios-build, r=aturon
Manish Goregaokar [Thu, 19 Mar 2015 00:39:02 +0000 (06:09 +0530)]
Rollup merge of #23479 - tamird:fix-ios-build, r=aturon

 r? @aturon

9 years agoRollup merge of #23475 - nikomatsakis:closure-ret-syntax, r=acrichto
Manish Goregaokar [Thu, 19 Mar 2015 00:38:56 +0000 (06:08 +0530)]
Rollup merge of #23475 - nikomatsakis:closure-ret-syntax, r=acrichto

 Require braces when a closure has an explicit return type. This is a [breaking-change]: instead of a closure like `|| -> i32 22`, prefer `|| -> i32 { 22 }`.

Fixes #23420.

9 years agostd: Stabilize FromStr implementations in std::net
Alex Crichton [Thu, 19 Mar 2015 03:08:15 +0000 (20:08 -0700)]
std: Stabilize FromStr implementations in std::net

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]

9 years agoSpace and punctuation fixes
Manish Goregaokar [Wed, 18 Mar 2015 19:26:37 +0000 (00:56 +0530)]
Space and punctuation fixes