]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoFix BTreeMap example typo
Pavel Pravosud [Thu, 9 Jun 2016 03:32:24 +0000 (20:32 -0700)]
Fix BTreeMap example typo

The whole example is made around movies reviews, but that one line says "review some books".

8 years agoAuto merge of #34167 - eddyb:fix-pairs-for-real, r=nikomatsakis
bors [Wed, 8 Jun 2016 23:41:01 +0000 (16:41 -0700)]
Auto merge of #34167 - eddyb:fix-pairs-for-real, r=nikomatsakis

trans: don't misuse C_nil for ZSTs other than ().

`C_nil` is actually `C_null` for `()` so `TempRef::new_operand` was treating all ZSTs as `()`.
This should allow running Servo with `RUSTFLAGS=-Zorbit`, assuming there are no other bugs.

8 years agotrans: don't misuse C_nil for ZSTs other than ().
Eduard Burtescu [Wed, 8 Jun 2016 21:33:57 +0000 (00:33 +0300)]
trans: don't misuse C_nil for ZSTs other than ().

8 years agoAuto merge of #33989 - eddyb:mir-viz, r=nikomatsakis
bors [Wed, 8 Jun 2016 20:51:57 +0000 (13:51 -0700)]
Auto merge of #33989 - eddyb:mir-viz, r=nikomatsakis

[MIR] Make scopes debuginfo-specific (visibility scopes).

Fixes #32949 by having MIR (visibility) scopes mimic the lexical structure.
Unlike #33235, this PR also removes all scopes without variable bindings.

Printing of scopes also changed, e.g. for:
```rust
fn foo(x: i32, y: i32) { let a = 0; let b = 0; let c = 0; }
```
Before my changes:
```rust
fn foo(arg0: i32, arg1: i32) -> () {
    let var0: i32;                       // "x" in scope 1 at <anon>:1:8: 1:9
    let var1: i32;                       // "y" in scope 1 at <anon>:1:16: 1:17
    let var2: i32;                       // "a" in scope 3 at <anon>:1:30: 1:31
    let var3: i32;                       // "b" in scope 6 at <anon>:1:41: 1:42
    let var4: i32;                       // "c" in scope 9 at <anon>:1:52: 1:53

    ...

    scope tree:
    0 1 2 3 {
        4 5
        6 {
            7 8
            9 10 11
        }
    }
}
```
After my changes:
```rust
fn foo(arg0: i32, arg1: i32) -> () {
    scope 1 {
        let var0: i32;                   // "x" in scope 1 at <anon>:1:8: 1:9
        let var1: i32;                   // "y" in scope 1 at <anon>:1:16: 1:17
        scope 2 {
            let var2: i32;               // "a" in scope 2 at <anon>:1:30: 1:31
            scope 3 {
                let var3: i32;           // "b" in scope 3 at <anon>:1:41: 1:42
                scope 4 {
                    let var4: i32;       // "c" in scope 4 at <anon>:1:52: 1:53
                }
            }
        }
    }

    ...
}

8 years agoAuto merge of #34083 - alexcrichton:dumb-hack, r=nrc
bors [Wed, 8 Jun 2016 14:43:29 +0000 (07:43 -0700)]
Auto merge of #34083 - alexcrichton:dumb-hack, r=nrc

rustc: Try to contain prepends to PATH

This commit attempts to bring our prepends to PATH on Windows when loading
plugins because we've been seeing quite a few issues with failing to spawn a
process on Windows, the leading theory of which is that PATH is too large as a
result of this. Currently this is mostly a stab in the dark as it's not
confirmed to actually fix the problem, but it's probably not a bad change to
have anyway!

cc #33844
Closes #17360

8 years agoAuto merge of #34068 - ollie27:rustdoc_redirect_const, r=brson
bors [Wed, 8 Jun 2016 11:53:34 +0000 (04:53 -0700)]
Auto merge of #34068 - ollie27:rustdoc_redirect_const, r=brson

rustdoc: Fix generating redirect pages for statics and consts

These were missing from the cache for some reason meaning the redirect pages failed to render.

8 years agoAuto merge of #34010 - jseyfried:decorate_expanded, r=nrc
bors [Wed, 8 Jun 2016 09:05:38 +0000 (02:05 -0700)]
Auto merge of #34010 - jseyfried:decorate_expanded, r=nrc

Run decorators on expanded AST

Fixes #32950.
r? @nrc

8 years agoAuto merge of #34003 - frewsxcv:13727-regressions, r=brson
bors [Wed, 8 Jun 2016 04:38:30 +0000 (21:38 -0700)]
Auto merge of #34003 - frewsxcv:13727-regressions, r=brson

Add regression tests for #13727.

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

8 years agoAuto merge of #33982 - LeoTestard:remove-check-matcher-old, r=pnkfelix
bors [Wed, 8 Jun 2016 00:56:35 +0000 (17:56 -0700)]
Auto merge of #33982 - LeoTestard:remove-check-matcher-old, r=pnkfelix

Remove the old FOLLOW checking (aka `check_matcher_old`).

It was supposed to be removed at the next release cycle but is still in the tree since like 6 months.
Potential breaking change, since some cases (such as #25658) will change from a warning to an error. But the warning stating that it will be a hard error in the next release has been there for 6 months now.
I think it's safe to break this code. ^_^

8 years agoAuto merge of #34141 - eddyb:trans-abi-memcpy, r=nikomatsakis
bors [Tue, 7 Jun 2016 21:45:39 +0000 (14:45 -0700)]
Auto merge of #34141 - eddyb:trans-abi-memcpy, r=nikomatsakis

trans: always use a memcpy for ABI argument/return casts.

When storing incoming arguments or values returned by call/invoke, always do a `memcpy` from a temporary of the cast type, if there is an ABI cast.
While Clang has gotten smarter ([store](https://godbolt.org/g/EphFuK) vs [memcpy](https://godbolt.org/g/5dikH9)), a `memcpy` will always work.
This is what @dotdash has wanted to do all along, and it fixes #32049.

8 years agotrans: always use a memcpy for ABI argument/return casts.
Eduard Burtescu [Tue, 7 Jun 2016 21:35:01 +0000 (00:35 +0300)]
trans: always use a memcpy for ABI argument/return casts.

8 years agoAuto merge of #34139 - steveklabnik:rollup, r=steveklabnik
bors [Tue, 7 Jun 2016 18:50:31 +0000 (11:50 -0700)]
Auto merge of #34139 - steveklabnik:rollup, r=steveklabnik

Rollup of 13 pull requests

- Successful merges: #33645, #33897, #33945, #34007, #34060, #34070, #34094, #34098, #34099, #34104, #34124, #34125, #34138
- Failed merges:

8 years agomir: group span + visibility scope under a new SourceInfo type.
Eduard Burtescu [Tue, 7 Jun 2016 16:21:56 +0000 (19:21 +0300)]
mir: group span + visibility scope under a new SourceInfo type.

8 years agomir: distinguish between variable visibility scopes and SEME scopes.
Eduard Burtescu [Tue, 31 May 2016 17:27:36 +0000 (20:27 +0300)]
mir: distinguish between variable visibility scopes and SEME scopes.

8 years agoRollup merge of #34138 - hoodie:bug/bool_colors, r=steveklabnik
Steve Klabnik [Tue, 7 Jun 2016 14:43:58 +0000 (10:43 -0400)]
Rollup merge of #34138 - hoodie:bug/bool_colors, r=steveklabnik

Bug/bool colors

This is actually #33661 @steveklabnik, sorry about this, github ate my homework

8 years agoRollup merge of #34125 - MichaelNecio:book_addition, r=steveklabnik
Steve Klabnik [Tue, 7 Jun 2016 14:43:58 +0000 (10:43 -0400)]
Rollup merge of #34125 - MichaelNecio:book_addition, r=steveklabnik

Noted that shadowing never destroys a value

Fixes issue #33887

r? @steveklabnik

8 years agoRollup merge of #34124 - jonas-schievink:remove-useless-optns, r=sanxiyn
Steve Klabnik [Tue, 7 Jun 2016 14:43:58 +0000 (10:43 -0400)]
Rollup merge of #34124 - jonas-schievink:remove-useless-optns, r=sanxiyn

Remove old -Z options that do nothing

Technically, this is a [breaking-change], but I'm not sure what the policy for -Z flags is (especially unused ones).

8 years agoRollup merge of #34104 - nagisa:cfg-llvm-up, r=alexcrichton
Steve Klabnik [Tue, 7 Jun 2016 14:43:57 +0000 (10:43 -0400)]
Rollup merge of #34104 - nagisa:cfg-llvm-up, r=alexcrichton

Require LLVM 3.7

We are using getMCTargetInfo which is 3.7+. I’m not sure whether 3.7 works though.

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

r? @alexcrichton

8 years agoRollup merge of #34099 - markrcote:functions-copyedit, r=steveklabnik
Steve Klabnik [Tue, 7 Jun 2016 14:43:57 +0000 (10:43 -0400)]
Rollup merge of #34099 - markrcote:functions-copyedit, r=steveklabnik

Add missing space before parenthesis.

8 years agoRollup merge of #34098 - frankmcsherry:patch-1, r=alexcrichton
Steve Klabnik [Tue, 7 Jun 2016 14:43:57 +0000 (10:43 -0400)]
Rollup merge of #34098 - frankmcsherry:patch-1, r=alexcrichton

Update rc.rs

The original description suggests that the original `Rc<T>` itself is downgraded, which doesn't seem to be what the code does. At the same time, `Rc` is one of those types that can do weird things with only a shared reference, so I thought it would be good to be clear.

8 years agoRollup merge of #34094 - abenga:doc_changes_variable_bindings, r=steveklabnik
Steve Klabnik [Tue, 7 Jun 2016 14:43:57 +0000 (10:43 -0400)]
Rollup merge of #34094 - abenga:doc_changes_variable_bindings, r=steveklabnik

Minor changes to variable bindings chapter

* In "*... name as another binding, that's currently in scope, will ...*", *"
  that's currently in scope"* is not a parenthetical element, and the commas
  can be omitted.

* Other minor changes.

8 years agoRollup merge of #34070 - chriskrycho:update-reference-deprecated-attribute, r=stevekl...
Steve Klabnik [Tue, 7 Jun 2016 14:43:57 +0000 (10:43 -0400)]
Rollup merge of #34070 - chriskrycho:update-reference-deprecated-attribute, r=steveklabnik

Update reference to indicate stabilization of `deprecated` attribute.

None

8 years agoRollup merge of #34060 - JDemler:master, r=steveklabnik
Steve Klabnik [Tue, 7 Jun 2016 14:43:56 +0000 (10:43 -0400)]
Rollup merge of #34060 - JDemler:master, r=steveklabnik

Improved documentation for tests/ directory

This ambigouity problem was already discussed in the [forums](https://users.rust-lang.org/t/problem-using-external-modules-inside-integration-test-submodule/5312/6).

8 years agoRollup merge of #34007 - flo-l:improve-hacking-docs, r=alexcrichton
Steve Klabnik [Tue, 7 Jun 2016 14:43:56 +0000 (10:43 -0400)]
Rollup merge of #34007 - flo-l:improve-hacking-docs, r=alexcrichton

add documentation on howto build just rustc without libstd to the build system

I searched for days until I found this, maybe this helps other poor souls :joy:

for reference #33990

8 years agoRollup merge of #33945 - srinivasreddy:libpanic_unwind, r=nrc
Steve Klabnik [Tue, 7 Jun 2016 14:43:56 +0000 (10:43 -0400)]
Rollup merge of #33945 - srinivasreddy:libpanic_unwind, r=nrc

run rustfmt on libpanic_unwind folder

8 years agoRollup merge of #33897 - srinivasreddy:runfail_rustfmt, r=nrc
Steve Klabnik [Tue, 7 Jun 2016 14:43:56 +0000 (10:43 -0400)]
Rollup merge of #33897 - srinivasreddy:runfail_rustfmt, r=nrc

run rustfmt on test/run-fail folder

8 years agoRollup merge of #33645 - withoutboats:woboats_trim_matches_doc, r=steveklabnik
Steve Klabnik [Tue, 7 Jun 2016 14:43:55 +0000 (10:43 -0400)]
Rollup merge of #33645 - withoutboats:woboats_trim_matches_doc, r=steveklabnik

Correct the docs on str::trim_matches

This pattern cannot be a str because str's pattern is not double-ended.

8 years agoAuto merge of #34128 - eddyb:mir-trans-fixes, r=luqmana
bors [Tue, 7 Jun 2016 13:31:32 +0000 (06:31 -0700)]
Auto merge of #34128 - eddyb:mir-trans-fixes, r=luqmana

[MIR] Fix MIR trans edge cases that showed up on crater.

These fixes cover all of the [regressions found by crater](https://gist.github.com/nikomatsakis/88ce89ed06ef7f7f19bfd1e221d7f7ec) (for #34096).

Two of them were `Pair` edge cases (ZSTs and constants) causing LLVM assertions, the other one was  causing stack overflows in debug scripts compiled in debug mode, due to the `fn_ret_cast` `alloca` ending up in a loop.

8 years agoAuto merge of #34012 - eddyb:tick-erased, r=nikomatsakis
bors [Tue, 7 Jun 2016 07:04:53 +0000 (00:04 -0700)]
Auto merge of #34012 - eddyb:tick-erased, r=nikomatsakis

rustc: add ReErased to be used by trait selection, MIR and trans.

`ReErased` replaces `ReStatic` (i.e. `'static`) for erasing regions.
Using a distinct lifetime helps prevent accidental mix-ups between the two.
It also allows cleaner type printing (see test changes), including in symbol names:
```rust
str..pattern..CharSearcher$LT$$u27$static$GT$::drop.30560::h840c2f2afc03bbea // before
str..pattern..CharSearcher::drop.30561::h6bd31d2af614377a // after
```
Not that we should be producing symbols this way, but it's still better.

8 years agotrans: don't create allocas anywhere other than the entry block.
Eduard Burtescu [Tue, 7 Jun 2016 07:04:31 +0000 (10:04 +0300)]
trans: don't create allocas anywhere other than the entry block.

8 years agoMinor changes to variable bindings chapter
Horace Abenga [Sun, 5 Jun 2016 10:16:59 +0000 (13:16 +0300)]
Minor changes to variable bindings chapter

* In "... name as another binding, that's currently in scope, will ...", ",
  that's currently in scope, " is not a parenthetical element, and the commas
  can be omitted.

* Other minor changes.

8 years agoAdd regression tests for #13727.
Corey Farwell [Wed, 1 Jun 2016 04:01:03 +0000 (00:01 -0400)]
Add regression tests for #13727.

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

8 years agotrans: don't forget to cast Pair constants of the wrong type.
Eduard Burtescu [Mon, 6 Jun 2016 23:21:58 +0000 (02:21 +0300)]
trans: don't forget to cast Pair constants of the wrong type.

8 years agoNoted that shadowing never destroys a value
Michael Necio [Mon, 6 Jun 2016 22:13:20 +0000 (18:13 -0400)]
Noted that shadowing never destroys a value

8 years agoRemove old -Z options that do nothing
Jonas Schievink [Mon, 6 Jun 2016 21:43:44 +0000 (23:43 +0200)]
Remove old -Z options that do nothing

Technically, this is a [breaking-change], but I'm not sure what the
policy for -Z flags is (especially unused ones).

8 years agotrans: use Pair for ignored nil pairs instead of Immediate.
Eduard Burtescu [Mon, 6 Jun 2016 21:24:21 +0000 (00:24 +0300)]
trans: use Pair for ignored nil pairs instead of Immediate.

8 years agoAuto merge of #34006 - eddyb:mir-const-fixes, r=nikomatsakis
bors [Mon, 6 Jun 2016 12:08:50 +0000 (05:08 -0700)]
Auto merge of #34006 - eddyb:mir-const-fixes, r=nikomatsakis

 [MIR] Fix double-rounding of float constants and ignore NaN sign in tests.

Fixes #32805 by handling f32 and f64 separately in rustc_const_eval.

Also removes `#[rustc_no_mir]` from a couple libstd tests by ignoring NaN sign.
Turns out that runtime evaluation of `0.0 / 0.0` produces a NaN with the sign bit set,
whereas LLVM constant folds it to a NaN with the sign bit unset, which we were testing for.

8 years agoRemove the old FOLLOW checking (aka `check_matcher_old`).
Leo Testard [Tue, 31 May 2016 14:51:52 +0000 (16:51 +0200)]
Remove the old FOLLOW checking (aka `check_matcher_old`).

8 years agoAuto merge of #33920 - cristianoliveira:error-E0174-explanation, r=GuillaumeGomez
bors [Mon, 6 Jun 2016 08:02:22 +0000 (01:02 -0700)]
Auto merge of #33920 - cristianoliveira:error-E0174-explanation, r=GuillaumeGomez

Add error description for E0174

Reference for issue: #32777

r? @GuillaumeGomez

Hey Guillaume, sorry for taking too long to do it. I got some unexpected work during the week.

Waiting for your review :)

8 years agoMerge pull request #34102 from eddyb/rollup
Eduard-Mihai Burtescu [Mon, 6 Jun 2016 08:02:19 +0000 (11:02 +0300)]
Merge pull request #34102 from eddyb/rollup

Rollup of 12 pull requests

8 years agoAdd error description for E0174
Cristian Oliveira [Sat, 28 May 2016 01:38:09 +0000 (22:38 -0300)]
Add error description for E0174

8 years agoRollup merge of #34090 - srinivasreddy:rustfmt_unicode, r=nagisa
Eduard-Mihai Burtescu [Mon, 6 Jun 2016 03:48:33 +0000 (06:48 +0300)]
Rollup merge of #34090 - srinivasreddy:rustfmt_unicode, r=nagisa

run rustfmt on librustc_unicode

8 years agoRollup merge of #34085 - srinivasreddy:rustfmt_libtest, r=eddyb
Eduard-Mihai Burtescu [Mon, 6 Jun 2016 03:48:33 +0000 (06:48 +0300)]
Rollup merge of #34085 - srinivasreddy:rustfmt_libtest, r=eddyb

run rustfmt on libtest folder

8 years agoRollup merge of #34082 - ollie27:rustdoc_css, r=alexcrichton
Eduard-Mihai Burtescu [Mon, 6 Jun 2016 03:48:33 +0000 (06:48 +0300)]
Rollup merge of #34082 - ollie27:rustdoc_css, r=alexcrichton

rustdoc: Fix a few missing colors in the CSS

This adds color to some of the search results and sidebar items which were missing.

8 years agoRollup merge of #34081 - RustOS-Fork-Holding-Ground:no-core-build-script, r=alexcrichton
Eduard-Mihai Burtescu [Mon, 6 Jun 2016 03:48:33 +0000 (06:48 +0300)]
Rollup merge of #34081 - RustOS-Fork-Holding-Ground:no-core-build-script, r=alexcrichton

No build.rs for libcore

I did a grep and there are no longer any mention of "rustbuild" in core, in `cfg`s or otherwise.

8 years agoRollup merge of #34062 - sanxiyn:no-wget, r=nagisa
Eduard-Mihai Burtescu [Mon, 6 Jun 2016 03:48:33 +0000 (06:48 +0300)]
Rollup merge of #34062 - sanxiyn:no-wget, r=nagisa

Unsupport wget

wget support was removed in #32942 (search for wget in diff), but configure wasn't updated. wget support was introduced in #7498 for Windows, but we now use PowerShell on Windows.

8 years agoRollup merge of #34059 - reeze:patch-2, r=GuillaumeGomez
Eduard-Mihai Burtescu [Mon, 6 Jun 2016 03:48:33 +0000 (06:48 +0300)]
Rollup merge of #34059 - reeze:patch-2, r=GuillaumeGomez

Update comment

The path has changed

8 years agoRollup merge of #34052 - jonas-schievink:issue-32829, r=brson
Eduard-Mihai Burtescu [Mon, 6 Jun 2016 03:48:32 +0000 (06:48 +0300)]
Rollup merge of #34052 - jonas-schievink:issue-32829, r=brson

Add regression test for issue #32829

Closes #32829

8 years agoRollup merge of #34048 - shepmaster:corrected-issue-number, r=steveklabnik
Eduard-Mihai Burtescu [Mon, 6 Jun 2016 03:48:32 +0000 (06:48 +0300)]
Rollup merge of #34048 - shepmaster:corrected-issue-number, r=steveklabnik

Correct issue number in test

8 years agoRollup merge of #33955 - zackmdavis:explain_E0429, r=GuillaumeGomez
Eduard-Mihai Burtescu [Mon, 6 Jun 2016 03:48:32 +0000 (06:48 +0300)]
Rollup merge of #33955 - zackmdavis:explain_E0429, r=GuillaumeGomez

add explanation for E0429 (`self` use declaration must use brace syntax)

This is an item under #32777.

r? @GuillaumeGomez

8 years agoRollup merge of #33786 - birkenfeld:make-fix, r=jseyfried
Eduard-Mihai Burtescu [Mon, 6 Jun 2016 03:48:32 +0000 (06:48 +0300)]
Rollup merge of #33786 - birkenfeld:make-fix, r=jseyfried

Makefile.in: dont use unnecessary escapes in echo

I don't know if `echo` allows escapes without `-e` on other systems, but on a GNU userland this outputs literal `\n` on the terminal. In this case there's an easy way to write this without escapes anyway.

r? @GuillaumeGomez

8 years agoAuto merge of #33786 - birkenfeld:make-fix, r=jseyfried
bors [Mon, 6 Jun 2016 01:24:22 +0000 (18:24 -0700)]
Auto merge of #33786 - birkenfeld:make-fix, r=jseyfried

Makefile.in: dont use unnecessary escapes in echo

I don't know if `echo` allows escapes without `-e` on other systems, but on a GNU userland this outputs literal `\n` on the terminal. In this case there's an easy way to write this without escapes anyway.

r? @GuillaumeGomez

8 years agoRequire LLVM 3.7
Simonas Kazlauskas [Sun, 5 Jun 2016 22:25:11 +0000 (01:25 +0300)]
Require LLVM 3.7

We are using getMCTargetInfo which is 3.7+

8 years agomir: remove unused float support from zero_literal.
Eduard Burtescu [Sun, 5 Jun 2016 19:32:11 +0000 (22:32 +0300)]
mir: remove unused float support from zero_literal.

8 years agoadd documentation on howto build just rustc without libstd to the build system
flo-l [Thu, 2 Jun 2016 20:19:20 +0000 (22:19 +0200)]
add documentation on howto build just rustc without libstd to the build system

8 years agorun rustfmt on test/run-fail folder
Srinivas Reddy Thatiparthy [Fri, 27 May 2016 02:39:36 +0000 (08:09 +0530)]
run rustfmt on test/run-fail folder

8 years agoAdd missing space before parenthesis.
Mark Côté [Sun, 5 Jun 2016 18:41:42 +0000 (14:41 -0400)]
Add missing space before parenthesis.

8 years agoUpdate rc.rs
Frank McSherry [Sun, 5 Jun 2016 18:26:24 +0000 (20:26 +0200)]
Update rc.rs

The original description suggests that the original `Rc<T>` itself is downgraded, which doesn't seem to be what the code does. At the same time, `Rc` is one of those types that can do weird things with only a shared reference, so I thought it would be good to be clear.

8 years agorun rustfmt on libpanic_unwind folder
Srinivas Reddy Thatiparthy [Sun, 29 May 2016 10:36:29 +0000 (16:06 +0530)]
run rustfmt on libpanic_unwind folder

8 years agorun rustfmt on librustc_unicode
Srinivas Reddy Thatiparthy [Sun, 5 Jun 2016 07:23:08 +0000 (12:53 +0530)]
run rustfmt on librustc_unicode

8 years agorustc_const_eval: work around double rounding.
Eduard Burtescu [Wed, 1 Jun 2016 09:22:07 +0000 (12:22 +0300)]
rustc_const_eval: work around double rounding.

8 years agotest: don't assume anything about the sign of NAN.
Eduard Burtescu [Wed, 1 Jun 2016 06:00:46 +0000 (09:00 +0300)]
test: don't assume anything about the sign of NAN.

8 years agoAuto merge of #34039 - ollie27:linkchecker_dirs, r=alexcrichton
bors [Sun, 5 Jun 2016 16:07:38 +0000 (09:07 -0700)]
Auto merge of #34039 - ollie27:linkchecker_dirs, r=alexcrichton

linkchecker: Treat directory links as errors

Directory links don't work well offline so they should be treated as errors.

All examples of this I know of are fixed in #34021.

8 years agoUpdate reference to indicate stabilization of `deprecated` attribute.
Chris Krycho [Sat, 4 Jun 2016 02:42:59 +0000 (22:42 -0400)]
Update reference to indicate stabilization of `deprecated` attribute.

8 years agoAuto merge of #33905 - eddyb:mir-overflow, r=nikomatsakis
bors [Sun, 5 Jun 2016 13:08:37 +0000 (06:08 -0700)]
Auto merge of #33905 - eddyb:mir-overflow, r=nikomatsakis

[MIR] Implement overflow checking

The initial set of changes is from @Aatch's #33255 PR, rebased on master, plus:

Added an `Assert` terminator to MIR, to simplify working with overflow and bounds checks.
With this terminator, error cases can be accounted for directly, instead of looking for lang item calls.
It also keeps the MIR slimmer, with no extra explicit blocks for the actual panic calls.

Warnings can be produced when the `Assert` is known to always panic at runtime, e.g.:
```rust
warning: index out of bounds: the len is 1 but the index is 3
 --> <anon>:1:14
1 |> fn main() { &[std::io::stdout()][3]; }
  |>              ^^^^^^^^^^^^^^^^^^^^^^
```

Generalized the `OperandValue::FatPtr` optimization to any aggregate pair of immediates.
This allows us to generate the same IR for overflow checks as old trans, not something worse.
For example, addition on `i16` calls `llvm.sadd.with.overflow.i16`, which returns `{i16, i1}`.
However, the Rust type `(i16, bool)`, has to be `{i16, i8}`, only an immediate `bool` is `i1`.
But if we split the pair into an `i16` and an `i1`, we can pass them around as such for free.

The latest addition is a rebase of #34054, updated to work for pairs too. Closes #34054, fixes #33873.

Last but not least, the `#[rustc_inherit_overflow_checks]` attribute was introduced to control the
overflow checking behavior of generic or `#[inline]` functions, when translated in another crate.

It is **not** intended to be used by crates other than `libcore`, which is in the unusual position of
being distributed as only an optimized build with no checks, even when used from debug mode.
Before MIR-based translation, this worked out fine, as the decision for overflow was made at
translation time, in the crate being compiled, but MIR stored in `rlib` has to contain the checks.

To avoid always generating the checks and slowing everything down, a decision was made to
use an attribute in the few spots of `libcore` that need it (see #33255 for previous discussion):
* `core::ops::{Add, Sub, Mul, Neg, Shl, Shr}` implementations for integers, which have `#[inline]` methods and can be used in generic abstractions from other crates
* `core::ops::{Add, Sub, Mul, Neg, Shl, Shr}Assign` same as above, for augmented assignment
* `pow` and `abs` methods on integers, which intentionally piggy-back on built-in multiplication and negation, respectively, to get overflow checks
* `core::iter::{Iterator, Chain, Peek}::count` and `core::iter::Enumerate::{next, nth}`, also documented as panicking on overflow, from addition, counting elements of an iterator in an `usize`

8 years agotrans: update Luqmana's patch for generalized pair handling.
Eduard Burtescu [Sun, 5 Jun 2016 12:34:13 +0000 (15:34 +0300)]
trans: update Luqmana's patch for generalized pair handling.

8 years ago[MIR] Handle call return values that need to be casted properly.
Luqman Aden [Fri, 3 Jun 2016 01:32:07 +0000 (21:32 -0400)]
[MIR] Handle call return values that need to be casted properly.

8 years agotrans: report as many errors as possible for constants.
Eduard Burtescu [Sun, 5 Jun 2016 11:38:29 +0000 (14:38 +0300)]
trans: report as many errors as possible for constants.

8 years agotrans: implement CheckedBinaryOp in mir::constant.
Eduard Burtescu [Fri, 27 May 2016 11:40:05 +0000 (14:40 +0300)]
trans: implement CheckedBinaryOp in mir::constant.

8 years agotrans: use the same messages for both MIR and old arithmetic checks.
Eduard Burtescu [Thu, 26 May 2016 19:53:27 +0000 (22:53 +0300)]
trans: use the same messages for both MIR and old arithmetic checks.

8 years agorustc_const_eval: track the length and index in IndexOutOfBounds.
Eduard Burtescu [Thu, 26 May 2016 19:09:48 +0000 (22:09 +0300)]
rustc_const_eval: track the length and index in IndexOutOfBounds.

8 years agorustc_const_eval: strings are not indexable in Rust 1.x.
Eduard Burtescu [Thu, 26 May 2016 17:19:45 +0000 (20:19 +0300)]
rustc_const_eval: strings are not indexable in Rust 1.x.

8 years agorustc_const_eval: remove unused arithmetic ErrKind variants.
Eduard Burtescu [Thu, 26 May 2016 17:19:12 +0000 (20:19 +0300)]
rustc_const_eval: remove unused arithmetic ErrKind variants.

8 years agoRespect #[rustc_inherit_overflow_checks] in mir::build and trans.
Eduard Burtescu [Thu, 26 May 2016 17:02:56 +0000 (20:02 +0300)]
Respect #[rustc_inherit_overflow_checks] in mir::build and trans.

8 years agocore: mark relevant functions with #[rustc_inherit_overflow_checks].
Eduard Burtescu [Thu, 26 May 2016 16:02:26 +0000 (19:02 +0300)]
core: mark relevant functions with #[rustc_inherit_overflow_checks].

8 years agomir: report when overflow checks would be missing cross-crate.
Eduard Burtescu [Thu, 26 May 2016 12:42:29 +0000 (15:42 +0300)]
mir: report when overflow checks would be missing cross-crate.

8 years agotrans: support uses of projections of immediate pairs.
Eduard Burtescu [Wed, 25 May 2016 08:58:08 +0000 (11:58 +0300)]
trans: support uses of projections of immediate pairs.

8 years agotrans: generalize OperandValue::FatPtr to all pairs of immediates.
Eduard Burtescu [Wed, 25 May 2016 08:55:44 +0000 (11:55 +0300)]
trans: generalize OperandValue::FatPtr to all pairs of immediates.

8 years agoAdd a new Assert terminator to MIR for bounds & arithmetic checks.
Eduard Burtescu [Wed, 25 May 2016 05:39:32 +0000 (08:39 +0300)]
Add a new Assert terminator to MIR for bounds & arithmetic checks.

8 years agoChange `with_cond` to `build_cond_br`
James Miller [Fri, 29 Apr 2016 02:10:56 +0000 (14:10 +1200)]
Change `with_cond` to `build_cond_br`

This is simpler to work with than `with_cond`.

8 years agoEnable the overflow-related tests for MIR
James Miller [Thu, 28 Apr 2016 12:08:01 +0000 (00:08 +1200)]
Enable the overflow-related tests for MIR

8 years agoAdd a `with_cond` method
James Miller [Thu, 28 Apr 2016 12:04:45 +0000 (00:04 +1200)]
Add a `with_cond` method

Factors out the common pattern across the several places that do
arithmetic checks

8 years agoCheck arithmetic in the MIR
James Miller [Thu, 31 Mar 2016 05:50:07 +0000 (18:50 +1300)]
Check arithmetic in the MIR

Add, Sub, Mul, Shl, and Shr are checked using a new Rvalue:
CheckedBinaryOp, while Div, Rem and Neg are handled with explicit checks
in the MIR.

8 years agorustc: add ReErased to be used by trait selection, MIR and trans.
Eduard Burtescu [Wed, 1 Jun 2016 12:10:44 +0000 (15:10 +0300)]
rustc: add ReErased to be used by trait selection, MIR and trans.

8 years agoAuto merge of #33999 - scottcarr:master, r=nikomatsakis
bors [Sun, 5 Jun 2016 10:12:38 +0000 (03:12 -0700)]
Auto merge of #33999 - scottcarr:master, r=nikomatsakis

generate fewer basic blocks for variant switches

CC #33567
Adds a new field to TestKind::Switch that tracks the variants that are actually matched against.  The other candidates target a common "otherwise" block.

8 years agorustc: Try to contain prepends to PATH
Alex Crichton [Sun, 5 Jun 2016 05:30:17 +0000 (22:30 -0700)]
rustc: Try to contain prepends to PATH

This commit attempts to bring our prepends to PATH on Windows when loading
plugins because we've been seeing quite a few issues with failing to spawn a
process on Windows, the leading theory of which is that PATH is too large as a
result of this. Currently this is mostly a stab in the dark as it's not
confirmed to actually fix the problem, but it's probably not a bad change to
have anyway!

cc #33844
Closes #17360

8 years agorun rustfmt on libtest folder
Srinivas Reddy Thatiparthy [Sun, 5 Jun 2016 06:49:37 +0000 (12:19 +0530)]
run rustfmt on libtest folder

8 years agoAuto merge of #33622 - arielb1:elaborate-drops, r=nikomatsakis
bors [Sun, 5 Jun 2016 06:49:29 +0000 (23:49 -0700)]
Auto merge of #33622 - arielb1:elaborate-drops, r=nikomatsakis

[MIR] non-zeroing drop

This enables non-zeroing drop through stack flags for MIR.

Fixes #30380.
Fixes #5016.

8 years agoUpdate LLVM
Ariel Ben-Yehuda [Sun, 5 Jun 2016 06:45:47 +0000 (09:45 +0300)]
Update LLVM

Picks up the fix for PR28005

8 years agobreak critical edges only when needed
Ariel Ben-Yehuda [Sun, 5 Jun 2016 06:00:17 +0000 (09:00 +0300)]
break critical edges only when needed

the *only* place where critical edges need to be broken is on Call
instructions, so only break them there.

8 years agoAuto merge of #34031 - jseyfried:fix_cfg_bug, r=eddyb
bors [Sat, 4 Jun 2016 23:48:29 +0000 (16:48 -0700)]
Auto merge of #34031 - jseyfried:fix_cfg_bug, r=eddyb

Fix a regression in the configuration folder

This fixes #34028, a regression caused by #33706 in which unconfigured impl items generated by a macro in an impl item position are not removed.
r? @nrc

8 years agorustdoc: Fix a few missing colors in the CSS
Oliver Middleton [Sat, 4 Jun 2016 22:43:24 +0000 (23:43 +0100)]
rustdoc: Fix a few missing colors in the CSS

This adds color to some of the search results and sidebar items which were missing.

8 years agoNo build.rs for libcore
John Ericson [Sat, 4 Jun 2016 21:19:46 +0000 (14:19 -0700)]
No build.rs for libcore

8 years agoAuto merge of #33816 - nikomatsakis:projection-cache-2, r=arielb1
bors [Sat, 4 Jun 2016 17:47:55 +0000 (10:47 -0700)]
Auto merge of #33816 - nikomatsakis:projection-cache-2, r=arielb1

Projection cache and better warnings for #32330

This PR does three things:

- it lays the groundwork for the more precise subtyping rules discussed in #32330, but does not enable them;
- it issues warnings when the result of a leak-check or subtyping check relies on a late-bound region which will late become early-bound when #32330 is fixed;
- it introduces a cache for projection in the inference context.

I'm not 100% happy with the approach taken by the cache here, but it seems like a step in the right direction. It results in big wins on some test cases, but not as big as previous versions -- I think because it is caching the `Vec<Obligation>` (whereas before I just returned the normalized type with an empty vector). However, that change was needed to fix an ICE in @alexcrichton's future-rs module (I haven't fully tracked the cause of that ICE yet). Also, because trans/the collector use a fresh inference context for every call to `fulfill_obligation`, they don't profit nearly as much from this cache as they ought to.

Still, here are the results from the future-rs `retry.rs`:

```
06:26 <nmatsakis> time: 6.246; rss: 44MB  item-bodies checking
06:26 <nmatsakis> time: 54.783; rss: 63MB   translation item collection
06:26 <nmatsakis> time: 140.086; rss: 86MB    translation

06:26 <nmatsakis> time: 0.361; rss: 46MB  item-bodies checking
06:26 <nmatsakis> time: 5.299; rss: 63MB    translation item collection
06:26 <nmatsakis> time: 12.140; rss: 86MB translation
```

~~Another example is the example from #31849. For that, I get 34s to run item-bodies without any cache. The version of the cache included here takes 2s to run item-bodies type-checking. An alternative version which doesn't track nested obligations takes 0.2s, but that version ICEs on @alexcrichton's future-rs (and may well be incorrect, I've not fully convinced myself of that). So, a definite win, but I think there's definitely room for further progress.~~

Pushed a modified version which improves performance of the case from #31849:

```
lunch-box. time rustc --stage0 ~/tmp/issue-31849.rs  -Z no-trans
real    0m33.539s
user    0m32.932s
sys     0m0.570s
lunch-box. time rustc --stage2 ~/tmp/issue-31849.rs  -Z no-trans
real    0m0.195s
user    0m0.154s
sys     0m0.042s
```

Some sort of cache is also needed for unblocking further work on lazy normalization, since that will lean even more heavily on the cache, and will also require cycle detection.

r? @arielb1

8 years agoAuto merge of #33998 - nikomatsakis:incr-comp-dep-node-trait, r=mw
bors [Sat, 4 Jun 2016 13:14:57 +0000 (06:14 -0700)]
Auto merge of #33998 - nikomatsakis:incr-comp-dep-node-trait, r=mw

Incr. comp. dep-node for traits, tests

Introduce new tests and also make dep-node for trait selection a bit more selective.

Fixes #33850

r? @michaelwoerister

8 years agofix fallout in tests
Ariel Ben-Yehuda [Sun, 29 May 2016 20:53:20 +0000 (23:53 +0300)]
fix fallout in tests

8 years agofix translation of terminators in MSVC cleanup blocks
Ariel Ben-Yehuda [Sun, 29 May 2016 19:01:06 +0000 (22:01 +0300)]
fix translation of terminators in MSVC cleanup blocks

MSVC requires unwinding code to be split to a tree of *funclets*, where each funclet
can only branch to itself or to to its parent.

Luckily, the code we generates matches this pattern. Recover that structure in
an analyze pass and translate according to that.

8 years agojump to the cleanup block in the unwind path for open_drop_for_box
Ariel Ben-Yehuda [Fri, 3 Jun 2016 22:49:34 +0000 (01:49 +0300)]
jump to the cleanup block in the unwind path for open_drop_for_box

silly bug. Hopefully the last one.

8 years agoAuto merge of #33991 - alexcrichton:rustbuild-more-clean, r=aturon
bors [Sat, 4 Jun 2016 08:23:02 +0000 (01:23 -0700)]
Auto merge of #33991 - alexcrichton:rustbuild-more-clean, r=aturon

rustbuild: Clean more on `make clean`

Be sure to not use the old build cache for the bootstrap build system nor the
old caches of the compiler/cargo extractions (in case something went wrong).

Closes #33986

8 years agoAuto merge of #33460 - shepmaster:16-bit-pointers, r=Aatch
bors [Sat, 4 Jun 2016 05:32:15 +0000 (22:32 -0700)]
Auto merge of #33460 - shepmaster:16-bit-pointers, r=Aatch

Support 16-bit pointers as well as i/usize

I'm opening this pull request to get some feedback from the community.

Although Rust doesn't support any platforms with a native 16-bit pointer at the moment, the [AVR-Rust][ar] fork is working towards that goal. Keeping this forked logic up-to-date with the changes in master has been onerous so I'd like to merge these changes so that they get carried along when refactoring happens. I do not believe this should increase the maintenance burden.

This is based on the original work of Dylan McKay (@dylanmckay).

[ar]: https://github.com/avr-rust/rust