]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoAuto merge of #30692 - michaelwoerister:mir-overloaded-fn-calls, r=nikomatsakis
bors [Wed, 6 Jan 2016 09:00:57 +0000 (09:00 +0000)]
Auto merge of #30692 - michaelwoerister:mir-overloaded-fn-calls, r=nikomatsakis

So far, calls going through `Fn::call`, `FnMut::call_mut`, or `FnOnce::call_once` have not been translated properly into MIR:
The call `f(a, b, c)` where `f: Fn(T1, T2, T3)` would end up in MIR as:
```
call `f` with arguments  `a`, `b`, `c`
```
What we really want is:
```
call `Fn::call` with arguments  `f`, `a`, `b`, `c`
```
This PR transforms these kinds of overloaded calls during `HIR -> HAIR` translation.

What's still a bit funky is that the `Fn` traits expect arguments to be tupled but due to special handling type-checking and trans, we do not actually tuple arguments and everything still checks out fine. So, after this PR we end up with MIR containing calls where function signature and arguments seemingly don't match:
```
call Fn::call(&self, args: (T1, T2, T3)) with arguments `f`, `a`, `b`, `c`
```
instead of
```
call Fn::call(&self, args: (T1, T2, T3)) with arguments `f`, (`a`, `b`, `c`)  //  <- args tupled!
```
It would be nice if the call traits could go without special handling in MIR and later on.

8 years agoAuto merge of #30492 - wesleywiser:fix_extra_drops, r=pnkfelix
bors [Wed, 6 Jan 2016 01:55:45 +0000 (01:55 +0000)]
Auto merge of #30492 - wesleywiser:fix_extra_drops, r=pnkfelix

Fixes #28159

8 years ago[MIR] Add test case for translation of closure calls.
Michael Woerister [Tue, 5 Jan 2016 17:32:49 +0000 (12:32 -0500)]
[MIR] Add test case for translation of closure calls.

8 years ago[MIR] Implement calling of closures and add missing monomorphization when translating...
Michael Woerister [Tue, 5 Jan 2016 17:29:50 +0000 (12:29 -0500)]
[MIR] Implement calling of closures and add missing monomorphization when translating function references.

8 years ago[MIR] Handle overloaded call expressions during HIR -> HAIR translation.
Michael Woerister [Mon, 4 Jan 2016 11:08:11 +0000 (06:08 -0500)]
[MIR] Handle overloaded call expressions during HIR -> HAIR translation.

8 years agoAuto merge of #30665 - zachpanz88:new-year, r=nrc
bors [Tue, 5 Jan 2016 13:54:30 +0000 (13:54 +0000)]
Auto merge of #30665 - zachpanz88:new-year, r=nrc

New copyright date

Happy new year!

8 years agoAuto merge of #30702 - tshepang:derives-not-needed, r=steveklabnik
bors [Tue, 5 Jan 2016 10:24:37 +0000 (10:24 +0000)]
Auto merge of #30702 - tshepang:derives-not-needed, r=steveklabnik

Also sneak in a missing trailing comma

8 years agoAuto merge of #30680 - wesleywiser:rustdoc_image_max_width, r=steveklabnik
bors [Tue, 5 Jan 2016 08:37:06 +0000 (08:37 +0000)]
Auto merge of #30680 - wesleywiser:rustdoc_image_max_width, r=steveklabnik

Fixes #24861

8 years agoAuto merge of #30708 - GuillaumeGomez:malformed_macro, r=sanxiyn
bors [Tue, 5 Jan 2016 05:20:27 +0000 (05:20 +0000)]
Auto merge of #30708 - GuillaumeGomez:malformed_macro, r=sanxiyn

Part of #30669

8 years agoAuto merge of #30595 - steveklabnik:remove_learn_rust, r=gankro
bors [Tue, 5 Jan 2016 03:32:12 +0000 (03:32 +0000)]
Auto merge of #30595 - steveklabnik:remove_learn_rust, r=gankro

Some history:

While getting Rust to 1.0, it was a struggle to keep the book in a
working state. I had always wanted a certain kind of TOC, but couldn't
quite get it there.

At the 11th hour, I wrote up "Rust inside other langauges" and "Dining
Philosophers" in an attempt to get the book in the direction I wanted to
go. They were fine, but not my best work. I wanted to further expand
this section, but it's just never going to end up happening. We're doing
the second draft of the book now, and these sections are basically gone
already.

Here's the issues with these two sections, and removing them just fixes
it all:

// Philosophers

There was always controversy over which ones were chosen, and why. This
is kind of a perpetual bikeshed, but it comes up every once in a while.

The implementation was originally supposed to show off channels, but
never did, due to time constraints. Months later, I still haven't
re-written it to use them.

People get different results and assume that means they're wrong, rather
than the non-determinism inherent in concurrency. Platform differences
aggrivate this, as does the exact amount of sleeping and printing.

// Rust Inside Other Languages

This section is wonderful, and shows off a strength of Rust. However,
it's not clear what qualifies a language to be in this section. And I'm
not sure how tracking a ton of other languages is gonna work, into the
future; we can't test _anything_ in this section, so it's prone to
bitrot.

By removing this section, and making the Guessing Game an initial
tutorial, we will move this version of the book closer to the future
version, and just eliminate all of these questions.

In addition, this also solves the 'split-brained'-ness of having two
paths, which has endlessly confused people in the past.

I'm sad to see these sections go, but I think it's for the best.

Fixes #30471
Fixes #30163
Fixes #30162
Fixes #25488
Fixes #30345
Fixes #29590
Fixes #28713
Fixes #28915

And probably others. This lengthy list alone is enough to show that
these should have been removed.

RIP.

8 years agoAuto merge of #30707 - tsion:mir-text, r=nikomatsakis
bors [Tue, 5 Jan 2016 01:43:07 +0000 (01:43 +0000)]
Auto merge of #30707 - tsion:mir-text, r=nikomatsakis

r? @nikomatsakis

Textual MIR can be dumped for a particular `fn` with `#![rustc_mir(pretty = "filename.mir")]`. Below is an example of the text output.

```rust
struct Point {
    x: i32,
    y: i32,
}

fn example() -> Point {
    let mut e = Point { x: 1, y: 2 };

    let num = 5;
    let plus_num = |x: i32| x + num;

    e.y = plus_num(e.x);
    e
}
```

```rust
fn() -> Point {
    let mut var0: Point; // e
    let var1: i32; // num
    let var2: [closure@test.rs:84:20: 84:36 num:&i32]; // plus_num
    let mut tmp0: ();
    let mut tmp1: &i32;
    let mut tmp2: ();
    let mut tmp3: i32;
    let mut tmp4: &[closure@test.rs:84:20: 84:36 num:&i32];
    let mut tmp5: i32;
    let mut tmp6: Point;

    bb0: {
        var0 = Point { x: 1, y: 2 };
        var1 = 5;
        tmp1 = &var1;
        var2 = [closure@test.rs:84:20: 84:36] { num: tmp1 };
        tmp4 = &var2;
        tmp5 = var0.0;
        tmp3 = tmp4(tmp5) -> [return: bb3, unwind: bb4];
    }

    bb1: {
        return;
    }

    bb2: {
        diverge;
    }

    bb3: {
        drop var0.1;
        var0.1 = tmp3;
        drop tmp2;
        drop var2;
        drop var0;
        tmp6 = var0;
        return = tmp6;
        drop tmp6;
        goto -> bb1;
    }

    bb4: {
        drop var2;
        goto -> bb5;
    }

    bb5: {
        drop var0;
        goto -> bb2;
    }
}
```

```rust
fn(arg0: &[closure@test.rs:84:20: 84:36 num:&i32], arg1: i32) -> i32 {
    let var0: i32; // x
    let mut tmp0: ();
    let mut tmp1: i32;
    let mut tmp2: i32;

    bb0: {
        var0 = arg1;
        tmp1 = var0;
        tmp2 = (*(*arg0).0);
        return = Add(tmp1, tmp2);
        goto -> bb1;
    }

    bb1: {
        return;
    }

    bb2: {
        diverge;
    }
}
```

8 years agoAuto merge of #30681 - Toby-S:master, r=bluss
bors [Mon, 4 Jan 2016 23:57:46 +0000 (23:57 +0000)]
Auto merge of #30681 - Toby-S:master, r=bluss

Make `".".parse::<f32>()` and `".".parse::<f64>()` return Err

This fixes #30344.

This is a [breaking-change], which the libs team have classified as a
bug fix.

8 years agoAdd 'mut' to MIR temp variable debug output.
Scott Olson [Sat, 2 Jan 2016 13:10:25 +0000 (07:10 -0600)]
Add 'mut' to MIR temp variable debug output.

8 years agoPretty-print ReturnPointer as 'return' in MIR.
Scott Olson [Sat, 2 Jan 2016 03:56:29 +0000 (21:56 -0600)]
Pretty-print ReturnPointer as 'return' in MIR.

8 years agoPretty-print static lvalues in MIR as just their path.
Scott Olson [Sat, 2 Jan 2016 03:01:17 +0000 (21:01 -0600)]
Pretty-print static lvalues in MIR as just their path.

8 years agoImprove pretty-printing of references in MIR.
Scott Olson [Fri, 1 Jan 2016 06:39:02 +0000 (00:39 -0600)]
Improve pretty-printing of references in MIR.

8 years agoPretty-print aggregates more prettily in MIR.
Scott Olson [Fri, 1 Jan 2016 03:38:44 +0000 (21:38 -0600)]
Pretty-print aggregates more prettily in MIR.

8 years agoUse fmt::Result instead of Result<(), Error>.
Scott Olson [Fri, 1 Jan 2016 02:11:25 +0000 (20:11 -0600)]
Use fmt::Result instead of Result<(), Error>.

8 years agoPrint BasicBlock names in lowercase.
Scott Olson [Wed, 30 Dec 2015 02:10:39 +0000 (20:10 -0600)]
Print BasicBlock names in lowercase.

8 years agoAdd a human-readable textual form for MIR.
Scott Olson [Wed, 30 Dec 2015 02:06:19 +0000 (20:06 -0600)]
Add a human-readable textual form for MIR.

This can be dumped for a particular `fn` with the attribute
`#![rustc_mir(pretty = "filename.mir"]`.

8 years agoAuto merge of #30661 - michaelwoerister:trans_fn_attrs, r=nrc
bors [Mon, 4 Jan 2016 22:09:52 +0000 (22:09 +0000)]
Auto merge of #30661 - michaelwoerister:trans_fn_attrs, r=nrc

So far `librustc::trans::base::trans_fn()` and `trans_closure()` have been passed the list of attributes on the function being translated *only* if the function was local and non-generic. For generic functions, functions inlined from other crates, functions with foreign ABI and for closures, only an empty list of attributes was ever passed to `trans_fn()`.
This led to the case that generic functions marked with `#[rustc_mir]` where not actually translated via MIR but via the legacy translation path.

This PR makes function/closure attributes always be passed to `trans_fn()` and disables the one test where this makes a difference.

If there is an actual reason why attributes were not passed along in these cases, let me know.

cc @rust-lang/compiler
cc @luqmana regarding the test case

8 years agodoc: these examples do not need Copy and Clone traits
Tshepang Lekhonkhobe [Mon, 4 Jan 2016 20:37:06 +0000 (22:37 +0200)]
doc: these examples do not need Copy and Clone traits

Also sneak in a missing trailing comma

8 years agoAuto merge of #30602 - tsion:mir-graphviz-display, r=nikomatsakis
bors [Mon, 4 Jan 2016 20:24:35 +0000 (20:24 +0000)]
Auto merge of #30602 - tsion:mir-graphviz-display, r=nikomatsakis

r? @nikomatsakis

cc @eddyb @nagisa

This PR changes most of the MIR graphviz debug output, making it smaller and more consistent. Also, it changes all fonts to monospace and adds a graph label containing the type of the `fn` the MIR is for and all the values (arguments, named bindings, and compiler temporaries).

I chose to re-write the graphviz output code instead of using the existing libgraphviz API because I found it much easier to prototype usage of various graphviz features when I had full control of the text output. It also makes the code simpler, I think.

Below are a bunch of example functions and links to their output images on the current nightly vs. this PR. File names starting with numbers (e.g. `80-factorial_fold-new.png`) are for closures. There's still a bunch of low hanging fruit to make it even better, particularly around aggregates and references.

I also imagine the textual output for MIR will be able to closely match the graphviz output. The list of statements should look identical and the terminators will be the same except that the text form will have a list of target blocks (potentially using the same edge labels as the graphviz does). I can PR a simple text output right after this PR.

This is my first large change to the compiler, so if anything should be reorganized/renamed/etc, let me know! Also, feel free to bikeshed the details of the output, though any minor changes can come in future PRs.

```rust
fn empty() {}
```

http://vps.solson.me/mir-graphviz/empty-new.png
http://vps.solson.me/mir-graphviz/empty-old.png

```rust
fn constant() -> i32 {
    42
}
```

http://vps.solson.me/mir-graphviz/constant-new.png
http://vps.solson.me/mir-graphviz/constant-old.png

```rust
fn increment(x: i32) -> i32 {
    x + 1
}
```

http://vps.solson.me/mir-graphviz/increment-new.png
http://vps.solson.me/mir-graphviz/increment-old.png

```rust
fn factorial_recursive(n: usize) -> usize {
    if n == 0 {
        1
    } else {
        n * factorial_recursive(n - 1)
    }
}
```

http://vps.solson.me/mir-graphviz/factorial_recursive-new.png
http://vps.solson.me/mir-graphviz/factorial_recursive-old.png

```rust
fn factorial_iterative(n: usize) -> usize {
    let mut prod = 1;
    for x in 1..n {
        prod *= x;
    }
    prod
}
```

http://vps.solson.me/mir-graphviz/factorial_iterative-new.png
http://vps.solson.me/mir-graphviz/factorial_iterative-old.png

```rust
fn factorial_fold(n: usize) -> usize {
    (1..n).fold(1, |prod, x| prod * x)
}
```

http://vps.solson.me/mir-graphviz/factorial_fold-new.png
http://vps.solson.me/mir-graphviz/factorial_fold-old.png
http://vps.solson.me/mir-graphviz/80-factorial_fold-new.png
http://vps.solson.me/mir-graphviz/80-factorial_fold-old.png

```rust
fn collatz(mut n: usize) {
    while n != 1 {
        if n % 2 == 0 {
            n /= 2;
        } else {
            n = 3 * n + 1;
        }
    }
}
```

http://vps.solson.me/mir-graphviz/collatz-new.png
http://vps.solson.me/mir-graphviz/collatz-old.png

```rust
fn multi_switch(n: usize) -> usize {
    match n {
        5 | 10 | 15 => 3,
        20 | 30 => 2,
        _ => 1,
    }
}
```

http://vps.solson.me/mir-graphviz/multi_switch-new.png
http://vps.solson.me/mir-graphviz/multi_switch-old.png

8 years agoAuto merge of #30523 - ubsan:wrapping_op_assign, r=eddyb
bors [Mon, 4 Jan 2016 18:37:21 +0000 (18:37 +0000)]
Auto merge of #30523 - ubsan:wrapping_op_assign, r=eddyb

Add OpAssign to Wrapping<T>, plus fix some problems in core::num::wrapping

including, but not limited to:

* Testing Wrapping<T>
* Pull out a lot of broken code that doesn't need to be there with the new stage0 compiler
* Adding Rem and RemAssign to Wrapping<T>
* Removed 3 (assumed accidental) re-exports, which is a minor [breaking-change].
* Change shl and shr to take all integer types, instead of a usize; this is a more major [breaking-change], because of values that were inferred before, but brings us in line with the integer shifts.

Fixes #30524 and #30523

8 years agoMake float parsing "." return Err
Toby Scrace [Sun, 3 Jan 2016 20:08:53 +0000 (20:08 +0000)]
Make float parsing "." return Err

This makes both of the following return Err:

    ".".parse::<f32>()
    ".".parse::<f64>()

This is a [breaking-change], which the libs team have classified as a
bug fix.

8 years agoAuto merge of #30553 - luqmana:mir-match-arm-guards, r=nikomatsakis
bors [Mon, 4 Jan 2016 16:54:11 +0000 (16:54 +0000)]
Auto merge of #30553 - luqmana:mir-match-arm-guards, r=nikomatsakis

Fixes #30527.

```Rust

fn main() {
    let _abc = match Some(101i8) {
        Some(xyz) if xyz > 100 => xyz,
        Some(_) => -1,
        None => -2
    };
}
```

Resulting MIR now includes the `Some(xyz)` arm, guard and all:
![match.dot](https://cloud.githubusercontent.com/assets/287063/11999413/066f7610-aa8b-11e5-927b-24215af57fc4.png)

~~Not quite sure how to write a test for this.~~ Thinking too hard, just tested the end result.

r? @nikomatsakis

8 years agoAuto merge of #30690 - LawrenceWoodman:patch-2, r=steveklabnik
bors [Mon, 4 Jan 2016 14:09:15 +0000 (14:09 +0000)]
Auto merge of #30690 - LawrenceWoodman:patch-2, r=steveklabnik

`fs::File` was being referenced without either calling via `std::fs::File` or by using `File` after having used `std::fs::File`.  Also `Path` was being referenced without first having used `std::path::Path`.

8 years agoAdd missing use statements
Lawrence Woodman [Mon, 4 Jan 2016 07:21:48 +0000 (07:21 +0000)]
Add missing use statements

fs::File was being referenced without either calling via std::fs::File or by using File after having used fs::File.  Also Path was being referenced without first having used std::path::Path.

8 years agoAuto merge of #30651 - nagisa:mir-fix-equality-checks, r=eddyb
bors [Mon, 4 Jan 2016 03:07:59 +0000 (03:07 +0000)]
Auto merge of #30651 - nagisa:mir-fix-equality-checks, r=eddyb

This is not a fix to checks themselves per se (though we still use `Eq` MIR test instead of calling `PartialEq::eq`), but rather how we handle items we encounter in pattern position.

Previously we would just call `PartialEq` with the constant and the matchee, but now we essentially inline the constant instead. E.g. these two snippets are functionally equivalent at MIR level:

```
match val { Some(42) => true, _ => false }
```
and
```
const SECRET: Option<u8> = Some(42);
match val { SECRET => true, _ => false }
```

This approach also allows for more optimizations of matches. I.e. It can now exploit `SwitchInt` to switch on number inside a `Some` regardless of whether the value being an item or not.

This is based on @tsion’s already approved PR so I could reuse the file for more tests.

r? @eddyb
cc @nikomatsakis @tsion

8 years agoAuto merge of #29732 - nathansizemore:master, r=steveklabnik
bors [Mon, 4 Jan 2016 00:27:40 +0000 (00:27 +0000)]
Auto merge of #29732 - nathansizemore:master, r=steveklabnik

8 years agoAdd test for "malformed macro lhs" and change back span_bug to span_fatal
Guillaume Gomez [Mon, 4 Jan 2016 00:11:54 +0000 (01:11 +0100)]
Add test for "malformed macro lhs" and change back span_bug to span_fatal

8 years agoAuto merge of #30677 - diwic:master, r=bluss
bors [Sun, 3 Jan 2016 21:00:46 +0000 (21:00 +0000)]
Auto merge of #30677 - diwic:master, r=bluss

Obviously we can't remove the character one past the end of the String. And we can't today either - we'll just panic at char_at() instead - but if we're going to keep that assertion, we should at least have a correct assertion.

8 years agoAuto merge of #29949 - fhahn:issue-21659-show-relevant-trait-impls, r=arielb1
bors [Sun, 3 Jan 2016 19:14:20 +0000 (19:14 +0000)]
Auto merge of #29949 - fhahn:issue-21659-show-relevant-trait-impls, r=arielb1

This PR for #21659 uses `DefId.for_each_relevant_impl()` to show other possible implementations in the "trait not implemented" message.

8 years agoRustdoc - Specify max-image size
Wesley Wiser [Sun, 3 Jan 2016 02:38:36 +0000 (21:38 -0500)]
Rustdoc - Specify max-image size

Fixes #24861

8 years agoTake out Op<T>/OpAssign<T> for Wrapping<T>
Nicholas Mazzuca [Sat, 2 Jan 2016 23:34:55 +0000 (15:34 -0800)]
Take out Op<T>/OpAssign<T> for Wrapping<T>

8 years agoRefactor candidate selection
Florian Hahn [Sat, 2 Jan 2016 23:11:48 +0000 (00:11 +0100)]
Refactor candidate selection

8 years agoFinish test implementation
Nicholas Mazzuca [Sat, 2 Jan 2016 22:36:28 +0000 (14:36 -0800)]
Finish test implementation

8 years agoFix off-by-one in String::remove
diwic [Sat, 2 Jan 2016 21:36:50 +0000 (22:36 +0100)]
Fix off-by-one in String::remove

Obviously we can't remove the character one past the end of the String. And we can't today either - we'll just panic at char_at() instead - but if we're going to keep that assertion, we should at least have a correct assertion.

8 years agoUse for_each_impl
Florian Hahn [Mon, 28 Dec 2015 22:50:18 +0000 (23:50 +0100)]
Use for_each_impl

8 years agoManually check trait implementations
Florian Hahn [Thu, 17 Dec 2015 22:58:56 +0000 (23:58 +0100)]
Manually check trait implementations

8 years agoAdd more tests
Florian Hahn [Sat, 28 Nov 2015 10:42:25 +0000 (11:42 +0100)]
Add more tests

8 years agoLimit displaying relevant trait impls to 4
Florian Hahn [Sat, 28 Nov 2015 10:41:52 +0000 (11:41 +0100)]
Limit displaying relevant trait impls to 4

8 years agoAuto merge of #30264 - GuillaumeGomez:patch-5, r=Manishearth
bors [Sat, 2 Jan 2016 16:56:15 +0000 (16:56 +0000)]
Auto merge of #30264 - GuillaumeGomez:patch-5, r=Manishearth

r? @Manishearth

Also: should I merged both commits? Not sure if it's really useful to keep the first one.

8 years agoAuto merge of #30675 - jimmantooth:master, r=apasel422
bors [Sat, 2 Jan 2016 13:58:57 +0000 (13:58 +0000)]
Auto merge of #30675 - jimmantooth:master, r=apasel422

8 years agoAdd 'mut' to temporary vars in MIR graphviz output.
Scott Olson [Sat, 2 Jan 2016 13:12:20 +0000 (07:12 -0600)]
Add 'mut' to temporary vars in MIR graphviz output.

8 years agoGrammar fixes
James Mantooth [Sat, 2 Jan 2016 07:26:22 +0000 (01:26 -0600)]
Grammar fixes

8 years agoAdjusted heading and created dedicated section in std::io docs
Nathan [Tue, 1 Dec 2015 02:23:19 +0000 (21:23 -0500)]
Adjusted heading and created dedicated section in std::io docs

8 years agoLinks and punctionaction fixes.
Nathan [Tue, 10 Nov 2015 01:13:10 +0000 (20:13 -0500)]
Links and punctionaction fixes.

8 years agoAdded platform notes to std::fs public functions.
Nathan [Tue, 10 Nov 2015 00:43:12 +0000 (19:43 -0500)]
Added platform notes to std::fs public functions.

8 years agoAdd E0463 error explanation
Guillaume Gomez [Tue, 8 Dec 2015 14:30:35 +0000 (15:30 +0100)]
Add E0463 error explanation

8 years agoAuto merge of #30672 - nagisa:to-degrad-stab, r=sfackler
bors [Fri, 1 Jan 2016 22:42:04 +0000 (22:42 +0000)]
Auto merge of #30672 - nagisa:to-degrad-stab, r=sfackler

f64 methods have been stable since rust 1.0, but f32 never got stabilised.

I suggest backporting this to beta as well (needs changing stablilisation version then).

r? @aturon

Fixes https://github.com/rust-lang/rfcs/issues/1438

8 years agoStabilise f32::to_{degrees,radians} to match f64
Simonas Kazlauskas [Fri, 1 Jan 2016 12:32:21 +0000 (14:32 +0200)]
Stabilise f32::to_{degrees,radians} to match f64

f64 methods have been stable since rust 1.0, but f32 never got stabilised.

8 years agoShow similar trait implementations if no matching impl is found
Florian Hahn [Fri, 20 Nov 2015 10:11:08 +0000 (11:11 +0100)]
Show similar trait implementations if no matching impl is found

closes #21659

8 years agoAuto merge of #30670 - emoon:fs-copy-comment, r=steveklabnik
bors [Fri, 1 Jan 2016 16:38:40 +0000 (16:38 +0000)]
Auto merge of #30670 - emoon:fs-copy-comment, r=steveklabnik

When looking in the documentation I often scan the examples the first thing I do. In these 3 cases it's not obvious which direction the operation happens by adding this comment it makes it more obvious.

r? @steveklabnik

8 years agoAuto merge of #30663 - apasel422:ll, r=bluss
bors [Fri, 1 Jan 2016 13:51:38 +0000 (13:51 +0000)]
Auto merge of #30663 - apasel422:ll, r=bluss

CC #30642

r? @Gankro

8 years agoFix equality checks in matches
Simonas Kazlauskas [Wed, 30 Dec 2015 20:21:13 +0000 (22:21 +0200)]
Fix equality checks in matches

8 years agoIn the middle of the implementation
Nicholas Mazzuca [Fri, 1 Jan 2016 12:28:26 +0000 (04:28 -0800)]
In the middle of the implementation

8 years agoAdded comment in which direction operation happens
Daniel Collin [Fri, 1 Jan 2016 09:09:24 +0000 (10:09 +0100)]
Added comment in which direction operation happens

8 years agoAuto merge of #30648 - tshepang:missing-graves, r=steveklabnik
bors [Fri, 1 Jan 2016 00:38:43 +0000 (00:38 +0000)]
Auto merge of #30648 - tshepang:missing-graves, r=steveklabnik

8 years agoUpdate copyright date
Zach Panzarino [Fri, 1 Jan 2016 00:32:31 +0000 (00:32 +0000)]
Update copyright date

8 years agoAuto merge of #30645 - tshepang:grammar, r=steveklabnik
bors [Thu, 31 Dec 2015 22:44:02 +0000 (22:44 +0000)]
Auto merge of #30645 - tshepang:grammar, r=steveklabnik

8 years agoAvoid adding drops for types w/ no dtor in MIR construction
Wesley Wiser [Thu, 31 Dec 2015 21:56:40 +0000 (16:56 -0500)]
Avoid adding drops for types w/ no dtor in MIR construction

Fixes #28159

8 years agoAuto merge of #30616 - arcnmx:cstr-asref, r=aturon
bors [Thu, 31 Dec 2015 20:52:17 +0000 (20:52 +0000)]
Auto merge of #30616 - arcnmx:cstr-asref, r=aturon

Are trait impls still insta-stable? Considering that this design has been around for a long time on `String` and `OsString` it probably doesn't matter much...

The `From` impl is a bit strange to me. It's stolen from `OsString` but I'm not really sure about it... `String` just impls `From<&str>` instead, would that make more sense?

8 years agoMake `LinkedList` and its read-only iterators covariant
Andrew Paseltiner [Thu, 31 Dec 2015 20:17:50 +0000 (15:17 -0500)]
Make `LinkedList` and its read-only iterators covariant

CC #30642

8 years agoCStr impl stability
arcnmx [Thu, 31 Dec 2015 19:21:40 +0000 (14:21 -0500)]
CStr impl stability

8 years agoimpl From<&CStr> for CString
arcnmx [Thu, 31 Dec 2015 18:56:21 +0000 (13:56 -0500)]
impl From<&CStr> for CString

8 years agoAuto merge of #28469 - DenisKolodin:master, r=steveklabnik
bors [Thu, 31 Dec 2015 18:57:27 +0000 (18:57 +0000)]
Auto merge of #28469 - DenisKolodin:master, r=steveklabnik

8 years agoAuto merge of #30660 - nagisa:rollup, r=steveklabnik
bors [Thu, 31 Dec 2015 17:05:34 +0000 (17:05 +0000)]
Auto merge of #30660 - nagisa:rollup, r=steveklabnik

- Successful merges: #30365, #30565, #30590, #30630
- Failed merges:

8 years agoRollup merge of #30630 - tsion:mir-closure-args, r=nagisa
Simonas Kazlauskas [Thu, 31 Dec 2015 15:28:57 +0000 (17:28 +0200)]
Rollup merge of #30630 - tsion:mir-closure-args, r=nagisa

Previously, all references to closure arguments went to the argument before the one they should (e.g. to `arg1` when it was supposed to go to `arg2`). This was because the MIR builder did not account for the implicit arguments that come before the explicit arguments, and closures have one implicit argument - the struct containing the captures.

This is my test code and a diff of the MIR generated for the closure:

```rust
let a = 2i32;
let _f = |b: i32| -> i32 { a + b }:
```

```diff
--- old 2015-12-29 23:16:32.027926372 -0600
+++ new 2015-12-29 23:16:42.975400757 -0600
@@ -1,22 +1,22 @@
 fn(arg0: &[closure@closure-args.rs:8:14: 8:39 a:&i32], arg1: i32) -> i32 {
     let var0: i32; // b
     let tmp0: ();
     let tmp1: i32;
     let tmp2: i32;

     bb0: {
-        var0 = arg0;
+        var0 = arg1;
         tmp1 = (*(*arg0).0);
         tmp2 = var0;
         ReturnPointer = Add(tmp1, tmp2);
         goto -> bb1;
     }

     bb1: {
         return;
     }

     bb2: {
         diverge;
     }
 }
```

(If you're wondering where this text MIR output comes from, it's from another branch of mine waiting on https://github.com/rust-lang/rust/pull/30602 to get merged.)

8 years agoRollup merge of #30590 - nagisa:mir-constval-function, r=luqmana
Simonas Kazlauskas [Thu, 31 Dec 2015 15:28:57 +0000 (17:28 +0200)]
Rollup merge of #30590 - nagisa:mir-constval-function, r=luqmana

This moves back (essentially reverts #30265) into MIR-specific translation code, but keeps the
funcition split out, since it is expected to eventually become recursive.

Fixes https://github.com/rust-lang/rust/issues/29572

cc @oli-obk

8 years agoRollup merge of #30565 - michaelwoerister:opaque_encoder, r=brson
Simonas Kazlauskas [Thu, 31 Dec 2015 15:28:57 +0000 (17:28 +0200)]
Rollup merge of #30565 - michaelwoerister:opaque_encoder, r=brson

This PR changes the `emit_opaque` and `read_opaque` methods in the RBML library to use a space-efficient binary encoder that does not emit any tags and uses the LEB128 variable-length integer format for all numbers it emits.

The space savings are nice, albeit a bit underwhelming, especially for dynamic libraries where metadata is already compressed.

| RLIBs        |  NEW   |   OLD     |
|--------------|--------|-----------|
|libstd        | 8.8 MB |  10.5 MB  |
|libcore       |15.6 MB |   19.7 MB |
|libcollections| 3.7 MB |    4.8 MB |
|librustc      |34.0 MB |   37.8 MB |
|libsyntax     |28.3 MB |   32.1 MB |

| SOs           |     NEW   |    OLD |
|---------------|-----------|--------|
| libstd        |  4.8 MB   | 5.1 MB |
| librustc      |  8.6 MB   | 9.2 MB |
| libsyntax     |  7.8 MB   | 8.4 MB |

At least this should make up for the size increase caused recently by also storing MIR in crate metadata.

Can this be a breaking change for anyone?
cc @rust-lang/compiler

8 years agoRollup merge of #30365 - tamird:update-valgrind, r=pnkfelix
Simonas Kazlauskas [Thu, 31 Dec 2015 15:28:56 +0000 (17:28 +0200)]
Rollup merge of #30365 - tamird:update-valgrind, r=pnkfelix

Since `darwin` is really `apple-darwin`, the valgrind-rpass tests were not actually being run with valgrind on mac before. Also, the `HOST` check was completely wrong.

r? @alexcrichton

8 years agoDeactivate one test in mir_trans_calls.rs since it fails now that it is correctly...
Michael Woerister [Thu, 31 Dec 2015 16:00:54 +0000 (11:00 -0500)]
Deactivate one test in mir_trans_calls.rs since it fails now that it is correctly executed.

8 years agoAuto merge of #30644 - tshepang:typo, r=steveklabnik
bors [Thu, 31 Dec 2015 15:12:07 +0000 (15:12 +0000)]
Auto merge of #30644 - tshepang:typo, r=steveklabnik

8 years agoForward attributes of translated function/closure to trans_fn/trans_closure.
Michael Woerister [Thu, 31 Dec 2015 13:06:23 +0000 (08:06 -0500)]
Forward attributes of translated function/closure to trans_fn/trans_closure.

8 years agoAuto merge of #30593 - steveklabnik:small_rc_refactoring, r=Gankro
bors [Thu, 31 Dec 2015 11:42:16 +0000 (11:42 +0000)]
Auto merge of #30593 - steveklabnik:small_rc_refactoring, r=Gankro

This hairy conditional doesn't need to be so. It _does_ need to be a
thin pointer, otherwise, it will fail to compile, so let's pull that out
into a temporary for future readers of the source.

/cc @nrc @SimonSapin @Gankro @durka , who brought this up on IRC

8 years agoAuto merge of #30641 - tsion:match-range, r=eddyb
bors [Thu, 31 Dec 2015 09:40:02 +0000 (09:40 +0000)]
Auto merge of #30641 - tsion:match-range, r=eddyb

The previous version using `PartialOrd::le` was broken since it passed `T` arguments where `&T` was expected.

It makes sense to use primitive comparisons since range patterns can only be used with chars and numeric types.

r? @eddyb

8 years agoAuto merge of #30598 - est31:macro_export_help_note, r=Manishearth
bors [Thu, 31 Dec 2015 06:16:12 +0000 (06:16 +0000)]
Auto merge of #30598 - est31:macro_export_help_note, r=Manishearth

The current help message is too much about "normal" macros to be used
as general message. Keep it for normal macros, and add custom help and
error messages for macro definitions.

8 years agoAuto merge of #30586 - nagisa:mir-cast, r=arielb1
bors [Thu, 31 Dec 2015 03:01:00 +0000 (03:01 +0000)]
Auto merge of #30586 - nagisa:mir-cast, r=arielb1

I think that should pretty much conclude all of https://github.com/rust-lang/rust/issues/29576.

8 years agoAuto merge of #30585 - Ms2ger:ExplicitSelfCategory, r=brson
bors [Thu, 31 Dec 2015 01:12:38 +0000 (01:12 +0000)]
Auto merge of #30585 - Ms2ger:ExplicitSelfCategory, r=brson

8 years agoAuto merge of #30375 - aaronkeen:issue_28777, r=eddyb
bors [Wed, 30 Dec 2015 23:20:12 +0000 (23:20 +0000)]
Auto merge of #30375 - aaronkeen:issue_28777, r=eddyb

RESTRICTION_STMT_EXPR restriction to allow subsequent expressions to
contain braces.

https://github.com/rust-lang/rust/issues/28777

8 years agoMerge pull request #30643 from dhuseby/snaps_2015-12-18-3391630
Dave Huseby [Wed, 30 Dec 2015 22:33:33 +0000 (14:33 -0800)]
Merge pull request #30643 from dhuseby/snaps_2015-12-18-3391630

Fixes #30521 and #30627 by adding new snapshots
edunham uploaded the snapshots.

8 years agoAuto merge of #30467 - shahn:master, r=brson
bors [Wed, 30 Dec 2015 19:37:53 +0000 (19:37 +0000)]
Auto merge of #30467 - shahn:master, r=brson

This adds a constructor for a Weak that can never be upgraded. These are
mostly useless, but for example are required when deserializing.

8 years agodoc: missed these in a4da9ac
Tshepang Lekhonkhobe [Wed, 30 Dec 2015 19:01:42 +0000 (21:01 +0200)]
doc: missed these in a4da9ac

8 years agodoc: fix grammar
Tshepang Lekhonkhobe [Wed, 30 Dec 2015 17:54:06 +0000 (19:54 +0200)]
doc: fix grammar

8 years agodoc: fix typo
Tshepang Lekhonkhobe [Wed, 30 Dec 2015 17:31:28 +0000 (19:31 +0200)]
doc: fix typo

8 years agoSmall refactoring to make this code more clear
Steve Klabnik [Mon, 28 Dec 2015 20:28:46 +0000 (15:28 -0500)]
Small refactoring to make this code more clear

This hairy conditional doesn't need to be so. It _does_ need to be a
thin pointer, otherwise, it will fail to compile, so let's pull that out
into a temporary for future readers of the source.

Also, after a discussion with @pnkfelix and @gankro, we don't need these
null checks anymore, as zero-on-drop has been gone for a while now.

8 years agoFixes #30521 and #30627 by adding new snapshots
Dave Huseby [Wed, 30 Dec 2015 17:02:02 +0000 (09:02 -0800)]
Fixes #30521 and #30627 by adding new snapshots

8 years agoAdd test for MIR range matching.
Scott Olson [Wed, 30 Dec 2015 16:28:45 +0000 (10:28 -0600)]
Add test for MIR range matching.

8 years agoUse built-in comparisons for range matching in MIR.
Scott Olson [Wed, 30 Dec 2015 16:25:35 +0000 (10:25 -0600)]
Use built-in comparisons for range matching in MIR.

The previous version using `PartialOrd::le` was broken since it passed `T`
arguments where `&T` was expected.

It makes sense to use primitive comparisons since range patterns can only be
used with chars and numeric types.

8 years agoAuto merge of #30640 - steveklabnik:rollup, r=steveklabnik
bors [Wed, 30 Dec 2015 16:07:08 +0000 (16:07 +0000)]
Auto merge of #30640 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #30373, #30502, #30511, #30546, #30556, #30620
- Failed merges:

8 years agoLimit line length to below 100 chars
est31 [Wed, 30 Dec 2015 15:27:55 +0000 (16:27 +0100)]
Limit line length to below 100 chars

8 years agoMove pub-{item,methd}-macro.rs to the parse-fail subdir as well
est31 [Tue, 29 Dec 2015 13:19:08 +0000 (14:19 +0100)]
Move pub-{item,methd}-macro.rs to the parse-fail subdir as well

8 years agoMove pub-macro-rules.rs test to parse-fail directory
est31 [Tue, 29 Dec 2015 13:00:38 +0000 (14:00 +0100)]
Move pub-macro-rules.rs test to parse-fail directory

8 years agowhitespace after colon, not before
est31 [Tue, 29 Dec 2015 12:59:19 +0000 (13:59 +0100)]
whitespace after colon, not before

8 years agoCustom help message for people trying to make macro public
est31 [Mon, 28 Dec 2015 04:31:11 +0000 (05:31 +0100)]
Custom help message for people trying to make macro public

The current help message is too much about "normal" macros to be used
as general message. Keep it for normal macros, and add custom help and
error messages for macro definitions.

8 years agoRollup merge of #30620 - salty-horse:an_mut, r=brson
Steve Klabnik [Wed, 30 Dec 2015 14:24:24 +0000 (09:24 -0500)]
Rollup merge of #30620 - salty-horse:an_mut, r=brson

As discussed in issue #30568.

8 years agoRollup merge of #30556 - nodakai:patch-1, r=brson
Steve Klabnik [Wed, 30 Dec 2015 14:24:24 +0000 (09:24 -0500)]
Rollup merge of #30556 - nodakai:patch-1, r=brson

Use proper URLs as given by Github.

So far we relied on redirect by Github which is not guaranteed to work.

8 years agoRollup merge of #30546 - tshepang:add-links, r=steveklabnik
Steve Klabnik [Wed, 30 Dec 2015 14:24:24 +0000 (09:24 -0500)]
Rollup merge of #30546 - tshepang:add-links, r=steveklabnik

8 years agoRollup merge of #30511 - defyrlt:issue_30507, r=steveklabnik
Steve Klabnik [Wed, 30 Dec 2015 14:24:24 +0000 (09:24 -0500)]
Rollup merge of #30511 - defyrlt:issue_30507, r=steveklabnik

Resolves #30507

r? @steveklabnik