]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoAuto merge of #27296 - jroesch:type-macros, r=huonw
bors [Thu, 6 Aug 2015 19:11:17 +0000 (19:11 +0000)]
Auto merge of #27296 - jroesch:type-macros, r=huonw

This pull request implements the functionality for [RFC 873](https://github.com/rust-lang/rfcs/blob/master/text/0873-type-macros.md). This is currently just an update of @freebroccolo's branch from January, the corresponding commits are linked in each commit message.

@nikomatsakis and I had talked about updating the macro language to support a lifetime fragment specifier, and it is possible to do that work on this branch as well. If so we can (collectively) talk about it next week during the pre-RustCamp work week.

8 years agoAuto merge of #27556 - taliesinb:tarpl-clarity-2, r=Gankro
bors [Thu, 6 Aug 2015 17:36:21 +0000 (17:36 +0000)]
Auto merge of #27556 - taliesinb:tarpl-clarity-2, r=Gankro

* Some clarifying rephrasing.
* Rename B.x back to B.a.
* Make null pointer optimization section bit more concrete.

r? @Gankro

8 years agoAuto merge of #27434 - jeehoonkang:master, r=Gankro
bors [Thu, 6 Aug 2015 15:01:35 +0000 (15:01 +0000)]
Auto merge of #27434 - jeehoonkang:master, r=Gankro

In Section 3.2, TARPL says that "standard allocators (including jemalloc, the one used by default in Rust) generally consider passing in 0 for the size of an allocation as Undefined Behaviour."
However, the C standard and jemalloc manual says allocating zero bytes
should succeed:

- C11 7.22.3 paragraph 1: "If the size of the space requested is zero, the behavior is implementation-defined: either a null pointer is returned, or the behavior is as if the size were some nonzero value, except that the returned pointer shall not be used to access an object."
- [jemalloc manual](http://www.freebsd.org/cgi/man.cgi?query=jemalloc&sektion=3): "The malloc and calloc functions return a pointer to the allocated memory if successful; otherwise a NULL pointer is returned and errno is set to ENOMEM."
    + Note that the description for `allocm` says "Behavior is undefined if size is 0," but it is an experimental API.

r? @Gankro

8 years agoAuto merge of #27555 - dotdash:drop_flag_ty, r=pnkfelix
bors [Thu, 6 Aug 2015 10:46:26 +0000 (10:46 +0000)]
Auto merge of #27555 - dotdash:drop_flag_ty, r=pnkfelix

The drop flags are Lvalue (and thus ByRef) datums that hold a u8 value,
so their value type should be u8, not a pointer to u8.

8 years agoFix expected parse error
Jared Roesch [Wed, 5 Aug 2015 21:18:29 +0000 (14:18 -0700)]
Fix expected parse error

8 years agoAuto merge of #27557 - Manishearth:rollup, r=Manishearth
bors [Thu, 6 Aug 2015 06:59:19 +0000 (06:59 +0000)]
Auto merge of #27557 - Manishearth:rollup, r=Manishearth

- Successful merges: #27546, #27550
- Failed merges:

8 years agoRevise TARPL's description for allocating 0 bytes
Jeehoon Kang [Fri, 31 Jul 2015 14:55:01 +0000 (23:55 +0900)]
Revise TARPL's description for allocating 0 bytes

In Section 3.2, TARPL says that "standard allocators (including jemalloc, the one used by default in Rust) generally consider passing in 0 for the size of an allocation as Undefined Behaviour."
However, the C standard and jemalloc manual says allocating zero bytes
should succeed:

- C11 7.22.3 paragraph 1: "If the size of the space requested is zero, the behavior is implementation-defined: either a null pointer is returned, or the behavior is as if the size were some nonzero value, except that the returned pointer shall not be used to access an object."
- [jemalloc manual](http://www.freebsd.org/cgi/man.cgi?query=jemalloc&sektion=3): "The malloc and calloc functions return a pointer to the allocated memory if successful; otherwise a NULL pointer is returned and errno is set to ENOMEM."
    + Note that the description for `allocm` says "Behavior is undefined if size is 0," but it is an experimental API.

8 years agoRollup merge of #27550 - tshepang:missing-info, r=brson
Manish Goregaokar [Thu, 6 Aug 2015 06:12:57 +0000 (11:42 +0530)]
Rollup merge of #27550 - tshepang:missing-info, r=brson

8 years agoRollup merge of #27546 - steveklabnik:gh26115, r=brson
Manish Goregaokar [Thu, 6 Aug 2015 06:12:56 +0000 (11:42 +0530)]
Rollup merge of #27546 - steveklabnik:gh26115, r=brson

Fixes #26115

8 years agoSome rerp-rust improvements.
Taliesin Beynon [Thu, 6 Aug 2015 06:04:11 +0000 (02:04 -0400)]
Some rerp-rust improvements.

* Some clarifying rephrasing.
* Rename B.x back to B.a.
* Make null pointer optimization section bit more concrete.

8 years agoUse the right type for drop flag datums
Björn Steinbrink [Thu, 6 Aug 2015 05:43:46 +0000 (07:43 +0200)]
Use the right type for drop flag datums

The drop flags are Lvalue (and thus ByRef) datums that hold a u8 value,
so their value type should be u8, not a pointer to u8.

8 years agoAuto merge of #27548 - tamird:opaque-ctypes, r=alexcrichton
bors [Thu, 6 Aug 2015 05:19:16 +0000 (05:19 +0000)]
Auto merge of #27548 - tamird:opaque-ctypes, r=alexcrichton

r? @alexcrichton

8 years agoAuto merge of #27545 - apasel422:btree-range, r=Gankro
bors [Thu, 6 Aug 2015 03:40:42 +0000 (03:40 +0000)]
Auto merge of #27545 - apasel422:btree-range, r=Gankro

This permits collections with `String` keys to be ranged over with
`&str` bounds. The `K` defaults for `Min` and `Max` permit the default
type parameter fallback to work with things like

```rust
use std::collections::{BTreeSet, Bound};
let set = BTreeSet::<String>::new();
set.range(Bound::Included("a"), Bound::Unbounded);
```

Without the defaults, the type of the maximum bound would be
unconstrained.

r? @Gankro

8 years agoAuto merge of #27505 - steveklabnik:exterminate_exterminate, r=brson
bors [Wed, 5 Aug 2015 23:53:48 +0000 (23:53 +0000)]
Auto merge of #27505 - steveklabnik:exterminate_exterminate, r=brson

These are for syntaxes that haven't existed for a long time.

8 years agodoc: add info about the u64 wrapped in Result
Tshepang Lekhonkhobe [Wed, 5 Aug 2015 22:48:57 +0000 (00:48 +0200)]
doc: add info about the u64 wrapped in Result

8 years agoBetter FFI discipline
Tamir Duberstein [Wed, 5 Aug 2015 21:50:18 +0000 (17:50 -0400)]
Better FFI discipline

8 years agoAuto merge of #27544 - steveklabnik:rollup, r=steveklabnik
bors [Wed, 5 Aug 2015 21:34:19 +0000 (21:34 +0000)]
Auto merge of #27544 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #27285, #27524, #27533, #27535, #27538, #27539
- Failed merges:

8 years agoFully generalize `BTree{Map, Set}` range iterators
Andrew Paseltiner [Wed, 5 Aug 2015 19:12:10 +0000 (15:12 -0400)]
Fully generalize `BTree{Map, Set}` range iterators

This permits collections with `String` keys to be ranged over with
`&str` bounds. The `K` defaults for `Min` and `Max` permit the default
type parameter fallback to work with things like

```rust
use std::collections::{BTreeSet, Bound};
let set = BTreeSet::<String>::new();
set.range(Bound::Included("a"), Bound::Unbounded);
```

Without the defaults, the type of the maximum bound would be
unconstrained.

8 years agoAdd an example to Trait section of reference
Steve Klabnik [Wed, 5 Aug 2015 19:31:19 +0000 (15:31 -0400)]
Add an example to Trait section of reference

Fixes #26115

8 years agoRollup merge of #27539 - steveklabnik:gh26746, r=brson
Steve Klabnik [Wed, 5 Aug 2015 19:09:50 +0000 (15:09 -0400)]
Rollup merge of #27539 - steveklabnik:gh26746, r=brson

1. mention them in the function chapter
2. mention their coercion to closures in the closures chapter

Fixes #26746

8 years agoRollup merge of #27538 - steveklabnik:gh26917, r=Gankro
Steve Klabnik [Wed, 5 Aug 2015 19:09:50 +0000 (15:09 -0400)]
Rollup merge of #27538 - steveklabnik:gh26917, r=Gankro

We haven't discussed this syntax yet, so provide a basic explanation
and link up to later chapters.

Fixes #26917

8 years agoRollup merge of #27535 - steveklabnik:for_jhun, r=alexcrichton
Steve Klabnik [Wed, 5 Aug 2015 19:09:50 +0000 (15:09 -0400)]
Rollup merge of #27535 - steveklabnik:for_jhun, r=alexcrichton

'work' can refer to the game itself, ie, 'this compiles but the game isn't finished,'
so 'compile' is a more clear way to describe the problem.

Thanks jhun on irc

8 years agoRollup merge of #27533 - steveklabnik:gh27109, r=Gankro
Steve Klabnik [Wed, 5 Aug 2015 19:09:49 +0000 (15:09 -0400)]
Rollup merge of #27533 - steveklabnik:gh27109, r=Gankro

This should be a bit more prominent.

Fixes #27109

8 years agoRollup merge of #27524 - steveklabnik:gh27523, r=gankro
Steve Klabnik [Wed, 5 Aug 2015 19:09:49 +0000 (15:09 -0400)]
Rollup merge of #27524 - steveklabnik:gh27523, r=gankro

This wording was too strong.

Fixes #27523

8 years agoRollup merge of #27285 - lastorset:trait-operator-impl, r=steveklabnik
Steve Klabnik [Wed, 5 Aug 2015 19:09:49 +0000 (15:09 -0400)]
Rollup merge of #27285 - lastorset:trait-operator-impl, r=steveklabnik

I also included some smaller trait-related changes.

Fixes #26991.

r? @shepmaster
r? @steveklabnik

8 years agoAuto merge of #27534 - alexcrichton:revert-adding-gdb-pp-tests, r=michaelwoerister
bors [Wed, 5 Aug 2015 18:48:53 +0000 (18:48 +0000)]
Auto merge of #27534 - alexcrichton:revert-adding-gdb-pp-tests, r=michaelwoerister

… are not actually broken."

This reverts commit 354cf4b56b8e2af67cc68965eb816deec0e79e4b.

Unfortunately these [tests are failing](http://buildbot.rust-lang.org/builders/nightly-dist-rustc-linux/builds/224/steps/distcheck/logs/stdio) on the snapshot/nightly bots with the [same message](https://gist.github.com/alexcrichton/611705ded07b0d73ded9) found in #27514

8 years agoAdd more infor about function pointers to TRPL
Steve Klabnik [Wed, 5 Aug 2015 17:44:54 +0000 (13:44 -0400)]
Add more infor about function pointers to TRPL

1. mention them in the function chapter
2. mention their coercion to closures in the closures chapter

Fixes #26746

8 years agoClarify claims about PhantomData<T>.
Steve Klabnik [Tue, 4 Aug 2015 20:43:45 +0000 (16:43 -0400)]
Clarify claims about PhantomData<T>.

This wording was too strong.

Fixes #27523

8 years agoExpand further on <> syntax in TRPL.
Steve Klabnik [Wed, 5 Aug 2015 17:23:22 +0000 (13:23 -0400)]
Expand further on <> syntax in TRPL.

We haven't discussed this syntax yet, so provide a basic explanation
and link up to later chapters.

Fixes #26917

8 years agoMake note of Hash in Borrow's docs
Steve Klabnik [Wed, 5 Aug 2015 16:16:37 +0000 (12:16 -0400)]
Make note of Hash in Borrow's docs

This should be a bit more prominent.

Fixes #27109

8 years agowork -> compile in Guessing Game
Steve Klabnik [Wed, 5 Aug 2015 16:30:00 +0000 (12:30 -0400)]
work -> compile in Guessing Game

'work' can refer to the game itself, ie, 'this compiles but the game isn't finished,'
so 'compile' is a more clear way to describe the problem.

Thanks jhun on irc

8 years agoRevert "debuginfo: Bring back some GDB pretty printing autotests that are not actuall...
Alex Crichton [Wed, 5 Aug 2015 16:20:28 +0000 (09:20 -0700)]
Revert "debuginfo: Bring back some GDB pretty printing autotests that are not actually broken."

This reverts commit 354cf4b56b8e2af67cc68965eb816deec0e79e4b.

8 years agoAuto merge of #27529 - dotdash:c_u8, r=eddyb
bors [Wed, 5 Aug 2015 12:08:17 +0000 (12:08 +0000)]
Auto merge of #27529 - dotdash:c_u8, r=eddyb

8 years agoAuto merge of #27458 - mitaa:local_cpath, r=nikomatsakis
bors [Wed, 5 Aug 2015 10:30:41 +0000 (10:30 +0000)]
Auto merge of #27458 - mitaa:local_cpath, r=nikomatsakis

This changes the current behaviour for two cases (that I know of)
```rust
mod foo {
    extern crate bar;
}
// `bar::` changes to `foo::bar::`
```

```rust
extern crate bar as quux;
// `bar::` changes to `quux::`
```
For example:
```rust
mod foo {
    extern crate core;
}

fn assert_clone<T>() where T : Clone { }

fn main() {
    assert_clone::<foo::core::atomic::AtomicBool>();
    // error: the trait `core::clone::Clone` is not implemented for the type `core::atomic::AtomicBool` [E0277]
    // changes to
    // error: the trait `foo::core::clone::Clone` is not implemented for the type `foo::core::atomic::AtomicBool` [E0277]
}
```

Notably the following test case broke:
```rust
 #[bench]
 fn bar(x: isize) { }
 //~^ ERROR mismatched types
 //~| expected `fn(&mut test::Bencher)`
 // changed to
 //~| expected `fn(&mut __test::test::Bencher)`
```
If a crate is linked multiple times the path with the least segments is stored.
Partially addresses #1920. (this doesn't solve the issue raised about re-exports)

r? @nikomatsakis

8 years agoAuto merge of #27530 - Manishearth:rollup, r=Manishearth
bors [Wed, 5 Aug 2015 08:52:06 +0000 (08:52 +0000)]
Auto merge of #27530 - Manishearth:rollup, r=Manishearth

- Successful merges: #27519, #27521, #27525, #27527, #27528
- Failed merges:

8 years agoRollup merge of #27528 - friedm:doc_meta_designator, r=huonw
Manish Goregaokar [Wed, 5 Aug 2015 08:15:39 +0000 (13:45 +0530)]
Rollup merge of #27528 - friedm:doc_meta_designator, r=huonw

For #27471

8 years agoRollup merge of #27527 - aij:tarpl, r=Gankro
Manish Goregaokar [Wed, 5 Aug 2015 08:15:38 +0000 (13:45 +0530)]
Rollup merge of #27527 - aij:tarpl, r=Gankro

Just some grammar fixes and an assumed missing word.

r? @Gankro

8 years agoRollup merge of #27525 - Gankro:nomvar, r=aturon
Manish Goregaokar [Wed, 5 Aug 2015 08:15:38 +0000 (13:45 +0530)]
Rollup merge of #27525 - Gankro:nomvar, r=aturon

I thought this was actually a huge error and I'd have to rewrite a bunch but
it looks like everything else was correct.

Closes #27457

r? @aturon

8 years agoRollup merge of #27521 - steveklabnik:doc_std_mem_forget, r=gankro
Manish Goregaokar [Wed, 5 Aug 2015 08:15:38 +0000 (13:45 +0530)]
Rollup merge of #27521 - steveklabnik:doc_std_mem_forget, r=gankro

We were burying the reason to use this function below a bunch of caveats about
its usage. That's backwards. Why a function should be used belongs at the top of
the docs, not the bottom.

Also, add some extra links to related functions mentioned in the body.

/cc @abhijeetbhagat who  pointed this out on IRC

8 years agoRollup merge of #27519 - JanLikar:rearrange-patterns, r=steveklabnik
Manish Goregaokar [Wed, 5 Aug 2015 08:15:38 +0000 (13:45 +0530)]
Rollup merge of #27519 - JanLikar:rearrange-patterns, r=steveklabnik

  - Move "Destructuring" after "Multiple patterns", because some of
    later sections include examples which make use of destructuring.

  - Move "Ignoring bindings" after "Destructoring", because the former
    features Result<T,E> destructuring. Some of examples in later
    sections use "_" and "..", so "Ignoring bindings" must be
    positioned before them.

  - Fix #27347 by moving "Ref and mut ref" before "Ranges" and
    "Bindings", because "Bindings" section includes a somewhat
    difficult example, which also makes use of "ref" and "mut ref"
    operators.

8 years agoMake C_u8 take a u8 instead of a usize value
Björn Steinbrink [Wed, 5 Aug 2015 07:46:59 +0000 (09:46 +0200)]
Make C_u8 take a u8 instead of a usize value

8 years agoAuto merge of #27503 - c-nixon:master, r=steveklabnik
bors [Wed, 5 Aug 2015 07:14:47 +0000 (07:14 +0000)]
Auto merge of #27503 - c-nixon:master, r=steveklabnik

I was reading through the docs and came across a section that felt awkward.

I've tried to improve the flow by splitting up and reversing the explanations of
Arc and Mutex with some example code in between.

The "This would have have happened" bit is unfortunate but I couldn't see any
other way to illustrate it. The compiler errors didn't really help tell the
story in this particular instance so it still feels a bit forced. However I do think it's
an a small improvement...

Does anyone have any other ideas that might flow better?

8 years agoAuto merge of #27520 - brson:bump, r=alexcrichton
bors [Wed, 5 Aug 2015 05:37:47 +0000 (05:37 +0000)]
Auto merge of #27520 - brson:bump, r=alexcrichton

This probably wants to go in tomorrow. If it lands today then there will be one day where nightly is on 1.4 and stable is still on 1.1. Not a big deal either way.

8 years agoAuto merge of #27439 - vberger:more_perseverant_resolve, r=nrc
bors [Wed, 5 Aug 2015 03:52:39 +0000 (03:52 +0000)]
Auto merge of #27439 - vberger:more_perseverant_resolve, r=nrc

(This is a second try at #26242. This time I think things should be ok.)

The current algorithm handling import resolutions works sequentially, handling imports in the order they appear in the source file, and blocking/bailing on the first one generating an error/being unresolved.

This can lead to situations where the order of the `use` statements can make the difference between "this code compiles" and "this code fails on an unresolved import" (see #18083 for example). This is especially true when considering glob imports.

This PR changes the behaviour of the algorithm to instead try to resolve all imports in a module. If one fails, it is recorded and the next one is tried (instead of directly giving up). Also, all errors generated are stored (and not reported directly).

The main loop of the algorithms guaranties that the algorithm will always finish: if a round of resolution does not resolve anything new, we are stuck and give up. At this point, the new version of the algorithm will display all errors generated by the last round of resolve. This way we are sure to not silence relevant errors or help messages, but also to not give up too early.

**As a consequence, the import resolution becomes independent of the order in which the `use` statements are written in the source files.** I personally don't see any situations where this could be a problem, but this might need some thought.

I passed `rpass` and `cfail` tests on my computer, and now am compiling a full stage2 compiler to ensure the crates reporting errors in my previous attempts still build correctly. I guess once I have checked it, this will need a crater run?

Fixes #18083.

r? @alexcrichton , cc @nrc @brson

8 years agoAuto merge of #27393 - alexcrichton:no-std-changes, r=brson
bors [Wed, 5 Aug 2015 02:00:46 +0000 (02:00 +0000)]
Auto merge of #27393 - alexcrichton:no-std-changes, r=brson

This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of
the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The
`#![no_std]` attribute now injects `extern crate core` at the top of the crate
as well as the libcore prelude into all modules (in the same manner as the
standard library's prelude). The `#![no_core]` attribute disables both std and
core injection.

[rfc]: https://github.com/rust-lang/rfcs/pull/1184

Closes #27394

8 years agoadd `meta` designator to macro reference
Matt Friedman [Wed, 5 Aug 2015 01:00:59 +0000 (20:00 -0500)]
add `meta` designator to macro reference

8 years agoFix some grammar in The Advanced Rust Programming Language
Ivan Jager [Tue, 4 Aug 2015 22:09:44 +0000 (17:09 -0500)]
Fix some grammar in The Advanced Rust Programming Language

8 years agoFix last nits
Jared Roesch [Tue, 4 Aug 2015 23:04:26 +0000 (16:04 -0700)]
Fix last nits

8 years agoAddress final nits
Jared Roesch [Tue, 4 Aug 2015 03:32:02 +0000 (20:32 -0700)]
Address final nits

8 years agoActually commit tests
Jared Roesch [Mon, 3 Aug 2015 20:51:23 +0000 (13:51 -0700)]
Actually commit tests

8 years agoAddress nits
Jared Roesch [Sat, 1 Aug 2015 21:35:46 +0000 (14:35 -0700)]
Address nits

8 years agoAdd feature gate
Jared Roesch [Tue, 28 Jul 2015 16:00:32 +0000 (09:00 -0700)]
Add feature gate

8 years agoTidy test case
Jared Roesch [Sun, 26 Jul 2015 06:53:23 +0000 (23:53 -0700)]
Tidy test case

8 years agoUpdate and add test case
Jared Roesch [Sun, 26 Jul 2015 05:17:43 +0000 (22:17 -0700)]
Update and add test case

Test case from here: https://github.com/freebroccolo/rust/commit/9e93fef3c0e61836a8b56f727eb7a2e94bb4ca09

8 years agoExtend macro machinery to expand macros in types
Jared Roesch [Sun, 26 Jul 2015 04:54:19 +0000 (21:54 -0700)]
Extend macro machinery to expand macros in types

Reapplied the changes from https://github.com/freebroccolo/rust/commit/7aafe24139abc2d1f302bbb166bcaa006f12cf4d
to a clean branch of master

8 years agoMake parser recognize macro invocations in types
Jared Roesch [Sun, 26 Jul 2015 04:40:57 +0000 (21:40 -0700)]
Make parser recognize macro invocations in types

Reapplied the changes from https://github.com/freebroccolo/rust/commit/8b07abaa6e8ab42d37656dfad89de0eb5810c3b3
to a clean branch of master

8 years agoAdd a macro invocation to the type AST
Jared Roesch [Sun, 26 Jul 2015 04:30:35 +0000 (21:30 -0700)]
Add a macro invocation to the type AST

Reapplied the changes from https://github.com/freebroccolo/rust/commit/dc64b731d7f66c2b43d5e5e8c721be7bd3b59540
to a clean branch of master

8 years agoAuto merge of #27351 - pnkfelix:dst-size-and-align-issue-27023, r=nikomatsakis
bors [Tue, 4 Aug 2015 22:55:31 +0000 (22:55 +0000)]
Auto merge of #27351 - pnkfelix:dst-size-and-align-issue-27023, r=nikomatsakis

Change the behavior of the glue code emitted for `size_and_align_of_dst`.

This thus changes the behavior of `std::mem::size_of_val` and `std::mem::align_of_val`.  It tries to move us towards a world where the following property holds:

Given type `T` implements `Trait` and a value `b: Box<T>`, where `std::mem::size_of::<T>()` returns `k`, then:

 * `std::mem::size_of_val(b)` returns `k`
 * `std::mem::size_of_val(b as Box<Trait>)` returns `k`

Note that one might legitimately question whether the above property *should* hold.  The property certainly does not hold today, as illustrated by #27023.

(A follow-up task is to make various tests that check that the above property holds for a wide variety of types ... I chose not to invest effort in writing such a test before we actually determine that the above property is desirable.)

nmatsakis and pnkfelix agree that this PR does not require an RFC.  cc @rust-lang/lang (since others may disagree).

(It also *might* break code, though it is hard for me to imagine that it could break code that wasn't already going to assert-fail when run in e.g. debug builds...)

Fix issue #27023

Also, this (or something like it) is a prerequisite for *fixing`make check` on `--enable-optimize --enable-debug` builds*

8 years agoFix variance ordering
Alexis Beingessner [Tue, 4 Aug 2015 22:09:47 +0000 (15:09 -0700)]
Fix variance ordering

I thought this was actually a huge error and I'd have to rewrite a bunch but
it looks like everything else was correct.

Closes #27457

8 years agoAuto merge of #26470 - l0kod:process-session-leader, r=alexcrichton
bors [Tue, 4 Aug 2015 21:15:54 +0000 (21:15 +0000)]
Auto merge of #26470 - l0kod:process-session-leader, r=alexcrichton

Add a new method `CommandExt::session_leader(&mut self, on: bool)` to create a new session (cf. `setsid(2)`) for the child process. This means that the child is the leader of a new process group. The parent process remains the child reaper of the new process.

This is not enough to create a daemon process. The *init* process should be the child reaper of a daemon. This can be achieved if the parent process exit. Moreover, a daemon should not have a controlling terminal. To acheive this, a session leader (the child) must spawn another process (the daemon) in the same session.

cc rust-lang/rfcs#941
cc #17176

8 years agosyntax: Don't assume `std` exists for tests
Alex Crichton [Thu, 30 Jul 2015 15:53:22 +0000 (08:53 -0700)]
syntax: Don't assume `std` exists for tests

This commit removes the injection of `std::env::args()` from `--test` expanded
code, relying on the test runner itself to call this funciton. This is more
hygienic because we can't assume that `std` exists at the top layer all the
time, and it meaks the injected test module entirely self contained.

8 years agoImprove docs for mem::forget()
Steve Klabnik [Tue, 4 Aug 2015 19:57:54 +0000 (15:57 -0400)]
Improve docs for mem::forget()

We were burying the reason to use this function below a bunch of caveats about
its usage. That's backwards. Why a function should be used belongs at the top of
the docs, not the bottom.

Also, add some extra links to related functions mentioned in the body.

8 years agoBump to 1.4
Brian Anderson [Tue, 4 Aug 2015 19:47:00 +0000 (12:47 -0700)]
Bump to 1.4

8 years agoAuto merge of #27515 - Eljay:rustdoc-search, r=alexcrichton
bors [Tue, 4 Aug 2015 19:37:50 +0000 (19:37 +0000)]
Auto merge of #27515 - Eljay:rustdoc-search, r=alexcrichton

Some small changes to (hopefully) make search more useful:

* Less strict filtering, e.g:
    * searching for "fn: foo" now matches methods and trait functions as well.
    * searching for types also matches primitive types.
    * searching for const will also match associated constants (but there aren't any in std yet)
* Changed searching for types to use the actual keyword "type" instead of the strange C-like "typedef".
* Added const and macro to allowed keywords.

8 years agoTweaked concurrency.md
Chris Nixon [Mon, 3 Aug 2015 17:10:49 +0000 (18:10 +0100)]
Tweaked concurrency.md

8 years agoRearrange sections in "Patterns"
Jan Likar [Tue, 4 Aug 2015 18:22:42 +0000 (20:22 +0200)]
Rearrange sections in "Patterns"

  - Move "Destructuring" after "Multiple patterns", because some of
    later sections include examples which make use of destructuring.

  - Move "Ignoring bindings" after "Destructoring", because the former
    features Result<T,E> destructuring. Some of examples in later
    sections use "_" and "..", so "Ignoring bindings" must be
    positioned before them.

  - Fix #27347 by moving "Ref and mut ref" before "Ranges" and
    "Bindings", because "Bindings" section includes a somewhat
    difficult example, which also makes use of "ref" and "mut ref"
    operators.

8 years agoAuto merge of #27508 - friedm:remove_integer_suffixes, r=alexcrichton
bors [Tue, 4 Aug 2015 16:31:16 +0000 (16:31 +0000)]
Auto merge of #27508 - friedm:remove_integer_suffixes, r=alexcrichton

For #27501

r? @steveklabnik

8 years agoImprove rustdoc search type filtering.
Eljay [Tue, 4 Aug 2015 15:40:23 +0000 (16:40 +0100)]
Improve rustdoc search type filtering.

8 years agoAuto merge of #27512 - Manishearth:rollup, r=Manishearth
bors [Tue, 4 Aug 2015 12:31:32 +0000 (12:31 +0000)]
Auto merge of #27512 - Manishearth:rollup, r=Manishearth

- Successful merges: #27397, #27398, #27460, #27470, #27491, #27498, #27502
- Failed merges:

8 years agoRollup merge of #27502 - rust-lang:grammer, r=brson
Manish Goregaokar [Tue, 4 Aug 2015 12:30:53 +0000 (18:00 +0530)]
Rollup merge of #27502 - rust-lang:grammer, r=brson

this grammar isn't correct

this should also get backported to beta

/cc @brson

8 years agoRollup merge of #27498 - nagisa:eeeeeeh, r=Gankro
Manish Goregaokar [Tue, 4 Aug 2015 12:30:53 +0000 (18:00 +0530)]
Rollup merge of #27498 - nagisa:eeeeeeh, r=Gankro

r? @Gankro

8 years agoRollup merge of #27491 - GuillaumeGomez:patch-4, r=Manishearth
Manish Goregaokar [Tue, 4 Aug 2015 12:30:53 +0000 (18:00 +0530)]
Rollup merge of #27491 - GuillaumeGomez:patch-4, r=Manishearth

8 years agoRollup merge of #27470 - cactorium:e0074toe0077, r=alexcrichton
Manish Goregaokar [Tue, 4 Aug 2015 12:30:52 +0000 (18:00 +0530)]
Rollup merge of #27470 - cactorium:e0074toe0077, r=alexcrichton

For https://github.com/rust-lang/rust/issues/24407

8 years agoRollup merge of #27460 - JanLikar:master, r=steveklabnik
Manish Goregaokar [Tue, 4 Aug 2015 12:30:52 +0000 (18:00 +0530)]
Rollup merge of #27460 - JanLikar:master, r=steveklabnik

  - Fix #26968 by noting the difference between ".." and "_" more explicitly

  - Change one of the examples to show the match-all behaviour of ".."

  - Merge "Ignoring variants" and "Ignoring bindings" sections into the latter

r? @steveklabnik

8 years agoRollup merge of #27398 - tshepang:patch-5, r=steveklabnik
Manish Goregaokar [Tue, 4 Aug 2015 12:30:52 +0000 (18:00 +0530)]
Rollup merge of #27398 - tshepang:patch-5, r=steveklabnik

8 years agoRollup merge of #27397 - Dangthrimble:master, r=steveklabnik
Manish Goregaokar [Tue, 4 Aug 2015 12:30:52 +0000 (18:00 +0530)]
Rollup merge of #27397 - Dangthrimble:master, r=steveklabnik

Clarifications for those new to Rust and Cargo:
* It's a good idea to get rid of the original `main.exe` in project root
* Slight clarification on the use of `main.rs` vs `lib.rs`
* Clarify that the TOML file needs to be in project root

8 years agoAuto merge of #27507 - eefriedman:link-section, r=alexcrichton
bors [Tue, 4 Aug 2015 09:02:43 +0000 (09:02 +0000)]
Auto merge of #27507 - eefriedman:link-section, r=alexcrichton

Fixes #27467.

8 years agoAuto merge of #27444 - Gankro:nomicon, r=brson
bors [Tue, 4 Aug 2015 06:27:22 +0000 (06:27 +0000)]
Auto merge of #27444 - Gankro:nomicon, r=brson

Closes #27412

r? @brson

8 years agoAddressing nits & tests explanations.
Victor Berger [Tue, 4 Aug 2015 06:14:32 +0000 (08:14 +0200)]
Addressing nits & tests explanations.

8 years agoAuto merge of #27500 - michaelwoerister:bring-gdb-pp-tests-back, r=alexcrichton
bors [Tue, 4 Aug 2015 03:51:32 +0000 (03:51 +0000)]
Auto merge of #27500 - michaelwoerister:bring-gdb-pp-tests-back, r=alexcrichton

This test case has been removed a while ago because it allegedly was broken. But I don't think it is (at least I couldn't reproduce any failure on Linux). Let's give it another chance `:)`

8 years agoremove unneeded integer suffixes from concurrency chapter
Matt Friedman [Tue, 4 Aug 2015 00:48:14 +0000 (19:48 -0500)]
remove unneeded integer suffixes from concurrency chapter

8 years agoFix link_section regression.
Eli Friedman [Mon, 3 Aug 2015 22:38:06 +0000 (15:38 -0700)]
Fix link_section regression.

Fixes #27467.

8 years agosyntax: Implement #![no_core]
Alex Crichton [Thu, 30 Jul 2015 00:01:14 +0000 (17:01 -0700)]
syntax: Implement #![no_core]

This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of
the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The
`#![no_std]` attribute now injects `extern crate core` at the top of the crate
as well as the libcore prelude into all modules (in the same manner as the
standard library's prelude). The `#![no_core]` attribute disables both std and
core injection.

[rfc]: https://github.com/rust-lang/rfcs/pull/1184

8 years agoAuto merge of #26783 - eddyb:methrec, r=huonw
bors [Mon, 3 Aug 2015 23:47:02 +0000 (23:47 +0000)]
Auto merge of #26783 - eddyb:methrec, r=huonw

After #26694, the overloaded operator and "impl not known at method lookup time" cases started triggering the lint.
I've also added checks for overloaded autoderef and method calls via paths (i.e. `T::method()`).
All new 8 test cases did not trigger the lint before #26694.
r? @huonw

8 years agorustc_lint: handle more method calls in unconditional_recursion.
Eduard Burtescu [Mon, 3 Aug 2015 22:17:56 +0000 (01:17 +0300)]
rustc_lint: handle more method calls in unconditional_recursion.

8 years agorustc: replace def::MethodProvenance with ty::ImplOrTraitItemContainer.
Eduard Burtescu [Mon, 3 Aug 2015 22:16:53 +0000 (01:16 +0300)]
rustc: replace def::MethodProvenance with ty::ImplOrTraitItemContainer.

8 years agoAuto merge of #27210 - vadimcn:win64-eh-pers, r=alexcrichton
bors [Mon, 3 Aug 2015 22:12:46 +0000 (22:12 +0000)]
Auto merge of #27210 - vadimcn:win64-eh-pers, r=alexcrichton

After this change, the only remaining symbol we are pulling from libgcc on Win64 is `__chkstk_ms` - the stack probing routine.

8 years agodelete some old tests
Steve Klabnik [Mon, 3 Aug 2015 21:25:56 +0000 (17:25 -0400)]
delete some old tests

These are for syntaxes that haven't existed for a long time.

8 years agorequired -> used; you -> we
Jonathan Hansford [Mon, 3 Aug 2015 20:37:15 +0000 (21:37 +0100)]
required -> used; you -> we

8 years agoAuto merge of #27134 - fhartwig:derive, r=huonw
bors [Mon, 3 Aug 2015 20:29:21 +0000 (20:29 +0000)]
Auto merge of #27134 - fhartwig:derive, r=huonw

Fixes #25022

This adapts the deriving mechanism to not repeat bounds for the same type parameter. To give an example: for the following code:

```rust
#[derive(Clone)]
pub struct FlatMap<I, U: IntoIterator, F> {
    iter: I,
    f: F,
    frontiter: Option<U::IntoIter>,
    backiter: Option<U::IntoIter>,
}
```
the latest nightly generates the following impl signature:

```rust
impl <I: ::std::clone::Clone,
      U: ::std::clone::Clone + IntoIterator,
      F: ::std::clone::Clone>
::std::clone::Clone for FlatMap<I, U, F> where
    I: ::std::clone::Clone,
    F: ::std::clone::Clone,
    U::IntoIter: ::std::clone::Clone,
    U::IntoIter: ::std::clone::Clone
```

With these changes, the signature changes to this:
```rust
impl <I, U: IntoIterator, F> ::std::clone::Clone for FlatMap<I, U, F> where
    I: ::std::clone::Clone,
    F: ::std::clone::Clone,
    U::IntoIter: ::std::clone::Clone
```
(Nothing in the body of the impl changes)
Note that the second impl is more permissive, as it doesn't have a `Clone` bound on `U` at all. There was a compile-fail test that failed due to this. I don't understand why we would want the old behaviour (and nobody on IRC could tell me either), so please tell me if there is a good reason that I missed.

8 years agosmall fix in RELEASES
Steve Klabnik [Mon, 3 Aug 2015 20:19:21 +0000 (16:19 -0400)]
small fix in RELEASES

this grammar isn't correct

8 years agodebuginfo: Bring back some GDB pretty printing autotests that are not actually broken.
Michael Woerister [Mon, 3 Aug 2015 19:47:53 +0000 (21:47 +0200)]
debuginfo: Bring back some GDB pretty printing autotests that are not actually broken.

8 years agoPost merge changes to #27488
Simonas Kazlauskas [Mon, 3 Aug 2015 18:52:20 +0000 (21:52 +0300)]
Post merge changes to #27488

8 years agorename TARPL to The Rustinomicon
Alexis Beingessner [Fri, 31 Jul 2015 21:13:59 +0000 (14:13 -0700)]
rename TARPL to The Rustinomicon

8 years agoAuto merge of #27495 - tshepang:patch-6, r=Gankro
bors [Mon, 3 Aug 2015 16:51:28 +0000 (16:51 +0000)]
Auto merge of #27495 - tshepang:patch-6, r=Gankro

8 years agoUpdate error comment
Guillaume Gomez [Mon, 3 Aug 2015 14:50:18 +0000 (16:50 +0200)]
Update error comment

8 years agoAuto merge of #27488 - Gankro:uninit-docs, r=bluss
bors [Mon, 3 Aug 2015 14:16:52 +0000 (14:16 +0000)]
Auto merge of #27488 - Gankro:uninit-docs, r=bluss

Inspired by https://github.com/rust-lang/rust/issues/27484

8 years agoreference: follow idiom in this tiny snippet
Tshepang Lekhonkhobe [Mon, 3 Aug 2015 14:07:36 +0000 (16:07 +0200)]
reference: follow idiom in this tiny snippet

8 years agovastly expand on the mem::uninitialized docs
Alexis Beingessner [Mon, 3 Aug 2015 05:04:32 +0000 (22:04 -0700)]
vastly expand on the mem::uninitialized docs

8 years agoUpdated in response to review
Jonathan Hansford [Mon, 3 Aug 2015 09:22:03 +0000 (10:22 +0100)]
Updated in response to review