]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agorollup merge of #23590: FuGangqiang/attr
Alex Crichton [Mon, 23 Mar 2015 22:10:36 +0000 (15:10 -0700)]
rollup merge of #23590: FuGangqiang/attr

9 years agorollup merge of #23580: nikomatsakis/pattern-and-overflow
Alex Crichton [Mon, 23 Mar 2015 22:10:30 +0000 (15:10 -0700)]
rollup merge of #23580: nikomatsakis/pattern-and-overflow

9 years agorollup merge of #23579: Ms2ger/thread_local-unsafe
Alex Crichton [Mon, 23 Mar 2015 22:10:13 +0000 (15:10 -0700)]
rollup merge of #23579: Ms2ger/thread_local-unsafe

Conflicts:
src/libstd/thread/local.rs

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

Fixes #23422

9 years agorollup merge of #23557: aturon/rfc-909
Alex Crichton [Mon, 23 Mar 2015 22:09:09 +0000 (15:09 -0700)]
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

9 years agorollup merge of #23541: aturon/stab-error
Alex Crichton [Mon, 23 Mar 2015 22:09:08 +0000 (15:09 -0700)]
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

9 years agorollup merge of #23538: aturon/conversion
Alex Crichton [Mon, 23 Mar 2015 22:09:05 +0000 (15:09 -0700)]
rollup merge of #23538: aturon/conversion

Conflicts:
src/librustc_back/rpath.rs

9 years agorollup merge of #23536: pnkfelix/arith-oflo-shifts
Alex Crichton [Mon, 23 Mar 2015 22:08:17 +0000 (15:08 -0700)]
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))

9 years agorollup merge of #23517: vhbit/ext-socket-options
Alex Crichton [Mon, 23 Mar 2015 22:08:15 +0000 (15:08 -0700)]
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.

9 years agorollup merge of #23515: nikomatsakis/issue-14985-trait-subtyping
Alex Crichton [Mon, 23 Mar 2015 22:08:13 +0000 (15:08 -0700)]
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

9 years agorollup merge of #23466: woehr/master
Alex Crichton [Mon, 23 Mar 2015 22:08:10 +0000 (15:08 -0700)]
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.

9 years agorollup merge of #23401: tshepang/crates-and-modules-doc-nits
Alex Crichton [Mon, 23 Mar 2015 22:08:01 +0000 (15:08 -0700)]
rollup merge of #23401: tshepang/crates-and-modules-doc-nits

Conflicts:
src/doc/trpl/crates-and-modules.md

9 years agorollup merge of #23283: brson/rpathfix
Alex Crichton [Mon, 23 Mar 2015 22:07:33 +0000 (15:07 -0700)]
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`.

9 years agorollup merge of #23269: shepmaster/split-not-double-ended
Alex Crichton [Mon, 23 Mar 2015 22:07:23 +0000 (15:07 -0700)]
rollup merge of #23269: shepmaster/split-not-double-ended

Closes #23262

9 years agorollup merge of #23211: FlaPer87/oibit-send-and-friends
Alex Crichton [Mon, 23 Mar 2015 22:07:21 +0000 (15:07 -0700)]
rollup merge of #23211: FlaPer87/oibit-send-and-friends

Fixes #23225

r? @nikomatsakis

9 years agorollup merge of #23119: nikomatsakis/issue-23116-ref-mut
Alex Crichton [Mon, 23 Mar 2015 22:07:19 +0000 (15:07 -0700)]
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

9 years agorollup merge of #22954: ches/docs
Alex Crichton [Mon, 23 Mar 2015 22:07:18 +0000 (15:07 -0700)]
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 :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 agoRemove auto-deref'ing Pattern impl because it conflicts with other
Niko Matsakis [Sat, 21 Mar 2015 10:02:56 +0000 (06:02 -0400)]
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.

9 years agoRefactor how we handle overflow so that it is a fatal error that aborts
Niko Matsakis [Fri, 20 Mar 2015 10:48:40 +0000 (06:48 -0400)]
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.

9 years agoAdd generic conversion traits
Aaron Turon [Wed, 18 Mar 2015 16:14:54 +0000 (09:14 -0700)]
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]

9 years agoImplement RFC 909: move thread_local into thread
Aaron Turon [Fri, 20 Mar 2015 07:46:13 +0000 (00:46 -0700)]
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

9 years agoStabilize the Error trait
Aaron Turon [Thu, 19 Mar 2015 23:37:34 +0000 (16:37 -0700)]
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]

9 years agoClarify behavior of Path::relative_from
Brian Anderson [Wed, 11 Mar 2015 17:55:31 +0000 (10:55 -0700)]
Clarify behavior of Path::relative_from

9 years agoFix regression in -C rpath that causes failures with symlinks
Brian Anderson [Tue, 10 Mar 2015 20:35:24 +0000 (13:35 -0700)]
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

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 agoFix shift-overflow in very old run-pass test.
Felix S. Klock II [Mon, 23 Mar 2015 14:04:15 +0000 (07:04 -0700)]
Fix shift-overflow in very old run-pass test.

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 agoRemove incorrect subtyping for `&mut Trait` and introduce coercion
Niko Matsakis [Thu, 19 Mar 2015 11:16:40 +0000 (07:16 -0400)]
Remove incorrect subtyping for `&mut Trait` and introduce coercion
for `&mut (Trait+'a)` to `&mut (Trait+'b)` if `'a:'b`.

Fixes #14985.

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 agoplacate check-pretty and pretty-printer bug; see also issue 23623.
Felix S. Klock II [Sun, 22 Mar 2015 22:53:06 +0000 (23:53 +0100)]
placate check-pretty and pretty-printer bug; see also issue 23623.

9 years agobook: some Crates and Modules nits
Tshepang Lekhonkhobe [Sat, 14 Mar 2015 03:55:01 +0000 (05:55 +0200)]
book: some Crates and Modules nits

9 years agoRemove an unsafe function definition in __thread_local_inner.
Ms2ger [Sat, 21 Mar 2015 09:34:15 +0000 (10:34 +0100)]
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.

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 agoworkaround bugs in pretty-printer so that we can pass check-stage2-pretty-rpass.
Felix S. Klock II [Sat, 21 Mar 2015 16:57:22 +0000 (17:57 +0100)]
workaround bugs in pretty-printer so that we can pass check-stage2-pretty-rpass.

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 agofix fallout
Flavio Percoco [Fri, 20 Mar 2015 15:45:57 +0000 (16:45 +0100)]
fix fallout

9 years agoCheck trait unsafety for defaulted traits
Flavio Percoco [Wed, 11 Mar 2015 23:53:55 +0000 (18:53 -0500)]
Check trait unsafety for defaulted traits

9 years agoFeature gate defaulted traits
Flavio Percoco [Wed, 11 Mar 2015 00:51:50 +0000 (01:51 +0100)]
Feature gate defaulted traits

9 years agoAdd default impls for Send/Sync
Flavio Percoco [Mon, 9 Mar 2015 03:02:57 +0000 (22:32 -0430)]
Add default impls for Send/Sync

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 agoTest suite for overflowing shift operators.
Felix S. Klock II [Thu, 19 Mar 2015 22:20:21 +0000 (23:20 +0100)]
Test suite for overflowing shift operators.

Note the tests have been revised to match new semantics for 8- and
16-bit values.

9 years agoAdded panic-on-overflow for rhs of left and right shift expressions.
Felix S. Klock II [Thu, 19 Mar 2015 18:52:08 +0000 (19:52 +0100)]
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.)

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 agoStrExt::splitn should not require a DoubleEndedSearcher
Jake Goulding [Sun, 15 Mar 2015 00:07:13 +0000 (20:07 -0400)]
StrExt::splitn should not require a DoubleEndedSearcher

Closes #23262

9 years agoIntroduce rsplit
Jake Goulding [Sat, 14 Mar 2015 23:34:21 +0000 (19:34 -0400)]
Introduce rsplit

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]