]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoRollup merge of #33534 - dns2utf8:atomic_docs, r=GuillaumeGomez
Manish Goregaokar [Sun, 15 May 2016 14:43:41 +0000 (20:13 +0530)]
Rollup merge of #33534 - dns2utf8:atomic_docs, r=GuillaumeGomez

Simplify text

This way it should be clear: Any number of other threads have this guaranty not just one other thread.

8 years agoRollup merge of #33533 - GuillaumeGomez:add_E0500, r=steveklabnik
Manish Goregaokar [Sun, 15 May 2016 14:43:41 +0000 (20:13 +0530)]
Rollup merge of #33533 - GuillaumeGomez:add_E0500, r=steveklabnik

Add E0500 error explanation

r? @Manishearth

Part of #32777.

8 years agoRollup merge of #33517 - sanxiyn:tight-span, r=nagisa
Manish Goregaokar [Sun, 15 May 2016 14:43:40 +0000 (20:13 +0530)]
Rollup merge of #33517 - sanxiyn:tight-span, r=nagisa

Tighten span for E0063

8 years agoRollup merge of #33475 - billyevans:master, r=guillaumegomez
Manish Goregaokar [Sun, 15 May 2016 14:43:40 +0000 (20:13 +0530)]
Rollup merge of #33475 - billyevans:master, r=guillaumegomez

Add detailed error explanation for E0505

Part of #32777

8 years agoRollup merge of #33415 - dfockler:master, r=steveklabnik
Manish Goregaokar [Sun, 15 May 2016 14:43:40 +0000 (20:13 +0530)]
Rollup merge of #33415 - dfockler:master, r=steveklabnik

Add error explanations for E0374, E0375, E0376 on issue #32777

8 years agoRollup merge of #33393 - cristianoliveira:docs-error-explanation, r=steveklabnik
Manish Goregaokar [Sun, 15 May 2016 14:43:40 +0000 (20:13 +0530)]
Rollup merge of #33393 - cristianoliveira:docs-error-explanation, r=steveklabnik

Add error description for E0455

r? @GuillaumeGomez.

About this error there is no much thing to explain. The short description says enough to understand. Feel free to review.

8 years agoRollup merge of #33342 - birkenfeld:issue-26472, r=jseyfried
Manish Goregaokar [Sun, 15 May 2016 14:43:39 +0000 (20:13 +0530)]
Rollup merge of #33342 - birkenfeld:issue-26472, r=jseyfried

typeck: if a private field exists, also check for a public method

For example, `Vec::len` is both a field and a method, and usually encountering `vec.len` just means that the parens were forgotten.

Fixes: #26472
NOTE: I added the parameter `allow_private` to `method::exists` since I don't want to suggest inaccessible methods. For the second case, where only the method exists, I think it would make sense to set it to `false` as well, but I wanted to preserve compatibility for this case.

8 years agoAuto merge of #33607 - jonas-schievink:prettier-mir, r=eddyb
bors [Sun, 15 May 2016 08:14:10 +0000 (01:14 -0700)]
Auto merge of #33607 - jonas-schievink:prettier-mir, r=eddyb

Some simple improvements to MIR pretty printing

In short, this PR changes the MIR printer so that it:

* places an empty line between the MIR for each item
* does *not* write an empty line before the first BB when there are no
  var decls
* aligns the "// Scope" comments 50 chars in (makes the output more
  readable)
* prints the scope comments as "// scope N at ..." instead of "//
  Scope(N) at ..."
* prints a prettier scope tree:
 * no more unbalanced delimiters!
 * no more "Parent" entry (these convey no useful information)
 * drop the "Scope()" and just print scope IDs
 * no braces when the scope is empty

In action: https://gist.github.com/jonas-schievink/1c11226cbb112892a9470ce0f9870b65

8 years agoAuto merge of #33593 - dotdash:smart_derive, r=brson
bors [Sun, 15 May 2016 05:04:58 +0000 (22:04 -0700)]
Auto merge of #33593 - dotdash:smart_derive, r=brson

Improve derived implementations for enums with lots of fieldless variants

A number of trait methods like PartialEq::eq or Hash::hash don't
actually need a distinct arm for each variant, because the code within
the arm only depends on the number and types of the fields in the
variants. We can easily exploit this fact to create less and better
code for enums with multiple variants that have no fields at all, the
extreme case being C-like enums.

For nickel.rs and its by now infamous 800 variant enum, this reduces
optimized compile times by 25% and non-optimized compile times by 40%.
Also peak memory usage is down by almost 40% (310MB down to 190MB).

To be fair, most other crates don't benefit nearly as much, because
they don't have as huge enums. The crates in the Rust distribution that
I measured saw basically no change in compile times (I only tried
optimized builds) and only 1-2% reduction in peak memory usage.

8 years agoAuto merge of #33600 - ollie27:rustdoc_impl_params, r=alexcrichton
bors [Sun, 15 May 2016 02:46:01 +0000 (19:46 -0700)]
Auto merge of #33600 - ollie27:rustdoc_impl_params, r=alexcrichton

rustdoc: Fix missing type parameters on impls

They were broken by #32558.

Fixes: #33592
8 years agoAuto merge of #33579 - Amanieu:atomic_bool2, r=alexcrichton
bors [Sat, 14 May 2016 18:56:58 +0000 (11:56 -0700)]
Auto merge of #33579 - Amanieu:atomic_bool2, r=alexcrichton

Make AtomicBool the same size as bool

Reopening #32365

This allows `AtomicBool` to be transmuted to a `bool`, which makes it more consistent with the other atomic types. Note that this now guarantees that the atomic type will always contain a valid `bool` value, which wasn't the case before (due to `fetch_nand`).

r? @alexcrichton

8 years agoAuto merge of #33568 - nrc:save-json-2, r=pnkfelix
bors [Sat, 14 May 2016 16:36:52 +0000 (09:36 -0700)]
Auto merge of #33568 - nrc:save-json-2, r=pnkfelix

save-analysis: JSON mk2

cc @aochagavia

r? @pnkfelix

8 years agoAuto merge of #33563 - Amanieu:oncestate, r=alexcrichton
bors [Sat, 14 May 2016 14:15:45 +0000 (07:15 -0700)]
Auto merge of #33563 - Amanieu:oncestate, r=alexcrichton

Export OnceState from libstd

This type is used in the signature of `call_once_force` but isn't exported from libstd.

r? @alexcrichton

8 years agoAuto merge of #33632 - Manishearth:rollup, r=Manishearth
bors [Sat, 14 May 2016 11:24:33 +0000 (04:24 -0700)]
Auto merge of #33632 - Manishearth:rollup, r=Manishearth

Rollup of 9 pull requests

- Successful merges: #33544, #33552, #33554, #33555, #33560, #33566, #33572, #33574, #33576
- Failed merges:

8 years agoRollup merge of #33576 - soltanmm:vtable, r=nikomatsakis
Manish Goregaokar [Sat, 14 May 2016 09:57:49 +0000 (11:57 +0200)]
Rollup merge of #33576 - soltanmm:vtable, r=nikomatsakis

Plumb inference obligations through selection, take 2

Using a `SnapshotVec` and dumping inferred obligations into `Vtable` variants.

r? @nikomatsakis

8 years agoRollup merge of #33574 - michaelwoerister:collector-cleanup, r=nikomatsakis
Manish Goregaokar [Sat, 14 May 2016 09:57:49 +0000 (11:57 +0200)]
Rollup merge of #33574 - michaelwoerister:collector-cleanup, r=nikomatsakis

trans-collector: Assorted fixes and refactorings needed for making trans collector-driven.

As the title says. The messages on the individual commits should do a good job of explaining what they are about.

r? @nikomatsakis

8 years agoRollup merge of #33572 - nagisa:assoc-const-types, r=eddyb
Manish Goregaokar [Sat, 14 May 2016 09:57:48 +0000 (11:57 +0200)]
Rollup merge of #33572 - nagisa:assoc-const-types, r=eddyb

Support references to outer type params for assoc consts

Fixes #28809

r? @eddyb

8 years agoRollup merge of #33566 - dotdash:biased_switch, r=nagisa
Manish Goregaokar [Sat, 14 May 2016 09:57:48 +0000 (11:57 +0200)]
Rollup merge of #33566 - dotdash:biased_switch, r=nagisa

[MIR trans] Optimize trans for biased switches

Currently, all switches in MIR are exhausitive, meaning that we can have
a lot of arms that all go to the same basic block, the extreme case
being an if-let expression which results in just 2 possible cases, be
might end up with hundreds of arms for large enums.

To improve this situation and give LLVM less code to chew on, we can
detect whether there's a pre-dominant target basic block in a switch
and then promote this to be the default target, not translating the
corresponding arms at all.

In combination with #33544 this makes unoptimized MIR trans of
nickel.rs as fast as using old trans and greatly improves the times for
optimized builds, which are only 30-40% slower instead of ~300%.

cc #33111

8 years agoRollup merge of #33560 - eddyb:symtidy, r=alexcrichton
Manish Goregaokar [Sat, 14 May 2016 09:57:48 +0000 (11:57 +0200)]
Rollup merge of #33560 - eddyb:symtidy, r=alexcrichton

Use symlink_metadata in tidy to avoid panicking on broken symlinks.

r? @alexcrichton

8 years agoRollup merge of #33555 - soltanmm:ambiguous-nixon, r=nikomatsakis
Manish Goregaokar [Sat, 14 May 2016 09:57:48 +0000 (11:57 +0200)]
Rollup merge of #33555 - soltanmm:ambiguous-nixon, r=nikomatsakis

Remove unification despite ambiguity in projection

Turns out that closures aren't explicitly considered in `project.rs`, so the ambiguity handling w.r.t. closures can just be removed as the change done in `select.rs` covers it.

r? @nikomatsakis

8 years agoRollup merge of #33554 - sfackler:no-current-exe, r=alexcrichton
Manish Goregaokar [Sat, 14 May 2016 09:57:47 +0000 (11:57 +0200)]
Rollup merge of #33554 - sfackler:no-current-exe, r=alexcrichton

Don't use env::current_exe with libbacktrace

If the path we give to libbacktrace doesn't actually correspond to the
current process, libbacktrace will segfault *at best*.

cc #21889

r? @alexcrichton
cc @semarie

8 years agoRollup merge of #33552 - dotdash:scfg, r=luqmana
Manish Goregaokar [Sat, 14 May 2016 09:57:47 +0000 (11:57 +0200)]
Rollup merge of #33552 - dotdash:scfg, r=luqmana

[MIR] Enhance the SimplifyCfg pass to merge consecutive blocks

Updated from #30238, including the changes suggested by @Aatch.

8 years agoRollup merge of #33544 - dotdash:baby_dont_break_me_no_more, r=Aatch
Manish Goregaokar [Sat, 14 May 2016 09:57:47 +0000 (11:57 +0200)]
Rollup merge of #33544 - dotdash:baby_dont_break_me_no_more, r=Aatch

Only break critical edges where actually needed

Currently, to prepare for MIR trans, we break _all_ critical edges,
although we only actually need to do this for edges originating from a
call that gets translated to an invoke instruction in LLVM.

This has the unfortunate effect of undoing a bunch of the things that
SimplifyCfg has done. A particularly bad case arises when you have a
C-like enum with N variants and a derived PartialEq implementation.

In that case, the match on the (&lhs, &rhs) tuple gets translated into
nested matches with N arms each and a basic block each, resulting in N²
basic blocks. SimplifyCfg reduces that to roughly 2*N basic blocks, but
breaking the critical edges means that we go back to N².

In nickel.rs, there is such an enum with roughly N=800. So we get about
640K basic blocks or 2.5M lines of LLVM IR. LLVM takes a while to
reduce that to the final "disr_a == disr_b".

So before this patch, we had 2.5M lines of IR with 640K basic blocks,
which took about about 3.6s in LLVM to get optimized and translated.
After this patch, we get about 650K lines with about 1.6K basic blocks
and spent a little less than 0.2s in LLVM.

cc #33111

r? @Aatch

8 years agoAuto merge of #33538 - Ms2ger:LocalCrateReader, r=arielb1
bors [Sat, 14 May 2016 06:34:52 +0000 (23:34 -0700)]
Auto merge of #33538 - Ms2ger:LocalCrateReader, r=arielb1

Refactor code around LocalCrateReader.

8 years agoAuto merge of #33532 - jseyfried:mutable_lowering_context, r=nrc
bors [Sat, 14 May 2016 01:40:08 +0000 (18:40 -0700)]
Auto merge of #33532 - jseyfried:mutable_lowering_context, r=nrc

Clean up `hir::lowering`

Clean up `hir::lowering`:
 - give lowering functions mutable access to the lowering context
 - refactor the `lower_*` functions and other functions that take a lowering context into methods
 - simplify the API that `hir::lowering` exposes to `driver`
 - other miscellaneous cleanups

r? @nrc

8 years agoAuto merge of #33508 - alexcrichton:always-lower-frem, r=nikomatsakis
bors [Fri, 13 May 2016 23:00:05 +0000 (16:00 -0700)]
Auto merge of #33508 - alexcrichton:always-lower-frem, r=nikomatsakis

trans: Always lower to `frem`

Long ago LLVM unfortunately didn't handle the 32-bit MSVC case of `frem` where
it can't be lowered to `fmodf` because that symbol doesn't exist. That was since
fixed in http://reviews.llvm.org/D12099 (landed as r246615) and was released in
what appears to be LLVM 3.8. Now that we're using that branch of LLVM let's
remove our own hacks and help LLVM optimize a little better by giving it
knowledge about what we're doing.

8 years agoIndent comments less
Jonas Schievink [Fri, 13 May 2016 21:40:06 +0000 (23:40 +0200)]
Indent comments less

40 chars is still enough indentation (most common MIR statements don't
take more than 40 chars), and fits more easily in 80-character
terminals.

8 years agoMuch smaller scope tree printing
Jonas Schievink [Fri, 13 May 2016 21:36:50 +0000 (23:36 +0200)]
Much smaller scope tree printing

8 years agosave-analysis: make DefIds prettier
Nick Cameron [Thu, 12 May 2016 23:29:07 +0000 (16:29 -0700)]
save-analysis: make DefIds prettier

8 years agoAuto merge of #33355 - luqmana:33202-repr-ice, r=nrc
bors [Fri, 13 May 2016 19:16:53 +0000 (12:16 -0700)]
Auto merge of #33355 - luqmana:33202-repr-ice, r=nrc

adt: Allow repr attribute on single variant enum.

Fixes #33202.

8 years agoMake AtomicBool the same size as bool
Amanieu d'Antras [Thu, 12 May 2016 15:12:05 +0000 (16:12 +0100)]
Make AtomicBool the same size as bool

8 years agoAllow repr attribute on single variant enum.
Luqman Aden [Fri, 13 May 2016 16:30:44 +0000 (12:30 -0400)]
Allow repr attribute on single variant enum.

8 years agoAuto merge of #33531 - antonblanchard:local_stage0_fix, r=alexcrichton
bors [Fri, 13 May 2016 15:46:16 +0000 (08:46 -0700)]
Auto merge of #33531 - antonblanchard:local_stage0_fix, r=alexcrichton

Copy more libraries from local Rust to stage0

When bootstrapping Rust using a previously built toolchain, I noticed
a number of libraries were not copied in. As a result the copied in
rustc fails to execute because it can't find all its dependences.

Add them into the local_stage0.sh script.

8 years agoAuto merge of #33513 - sanxiyn:tab-in-error, r=nikomatsakis
bors [Fri, 13 May 2016 13:26:15 +0000 (06:26 -0700)]
Auto merge of #33513 - sanxiyn:tab-in-error, r=nikomatsakis

Better handling of tab in error

cc #33240.

8 years agoAuto merge of #33541 - eddyb:promote-only-temps, r=arielb1
bors [Fri, 13 May 2016 10:10:46 +0000 (03:10 -0700)]
Auto merge of #33541 - eddyb:promote-only-temps, r=arielb1

mir: don't attempt to promote Unpromotable constant temps.

Fixes #33537. This was a non-problem in regular functions, but we also promote in `const fn`s.
There we always qualify temps so you can't depend on `Unpromotable` temps being `NOT_CONST`.

8 years agoAuto merge of #33596 - nikomatsakis:issue-33586-regr-assoc-type-path, r=eddyb
bors [Fri, 13 May 2016 07:29:22 +0000 (00:29 -0700)]
Auto merge of #33596 - nikomatsakis:issue-33586-regr-assoc-type-path, r=eddyb

re-introduce a cache for ast-ty-to-ty

It turns out that `ast_ty_to_ty` is supposed to be updating the `def`
after it finishes, but at some point in the past it stopped doing
so. This was never noticed because of the `ast_ty_to_ty_cache`, but that
cache was recently removed. This PR fixes the code to update the def
properly, but apparently that is not quite enough to make the operation
idempotent, so for now we reintroduce the cache too.

Fixes #33586.

r? @eddyb

8 years agoAuto merge of #33450 - SiegeLord:dep_info_no_analysis, r=nrc
bors [Fri, 13 May 2016 02:52:51 +0000 (19:52 -0700)]
Auto merge of #33450 - SiegeLord:dep_info_no_analysis, r=nrc

Make --emit dep-info work correctly with -Z no-analysis again.

Previously, it would attempt to resolve some external crates that weren't necessary for dep-info output.

Fixes #33231.

8 years ago[MIR] Enhance the SimplifyCfg pass to merge consecutive blocks
Björn Steinbrink [Sat, 14 Nov 2015 22:52:17 +0000 (23:52 +0100)]
[MIR] Enhance the SimplifyCfg pass to merge consecutive blocks

8 years agoSome simple improvements to MIR pretty printing
Jonas Schievink [Thu, 12 May 2016 22:20:59 +0000 (00:20 +0200)]
Some simple improvements to MIR pretty printing

In short, this PR changes the MIR printer so that it:

* places an empty line between the MIR for each item
* does *not* write an empty line before the first BB when there are no
  var decls
* aligns the "// Scope" comments 50 chars in (makes the output more
  readable)
* prints the scope comments as "// scope N at ..." instead of "//
  Scope(N) at ..."
* prints a prettier scope tree:
 * no more unbalanced delimiters!
 * no more "Parent" entry (these convey no useful information)
 * drop the "Scope()" and just print scope IDs
 * no braces when the scope is empty

8 years agoAuto merge of #33282 - alexcrichton:rustbuild-crate-tests, r=brson
bors [Thu, 12 May 2016 21:31:54 +0000 (14:31 -0700)]
Auto merge of #33282 - alexcrichton:rustbuild-crate-tests, r=brson

rustbuild: Add support for crate tests + doctests

This commit adds support to rustbuild to run crate unit tests (those defined by
`#[test]`) as well as documentation tests. All tests are powered by `cargo test`
under the hood.

Each step requires the `libtest` library is built for that corresponding stage.
Ideally the `test` crate would be a dev-dependency, but for now it's just easier
to ensure that we sequence everything in the right order.

Currently no filtering is implemented, so there's not actually a method of
testing *only* libstd or *only* libcore, but rather entire swaths of crates are
tested all at once.

A few points of note here are:

* The `coretest` and `collectionstest` crates are just listed as `[[test]]`
  entires for `cargo test` to naturally pick up. This mean that `cargo test -p
  core` actually runs all the tests for libcore.
* Libraries that aren't tested all mention `test = false` in their `Cargo.toml`
* Crates aren't currently allowed to have dev-dependencies due to
  rust-lang/cargo#860, but we can likely alleviate this restriction once
  workspaces are implemented.

cc #31590

8 years agoAdd error explanations for E0374, E0375, E0376 on issue #33383
Dan Fockler [Wed, 4 May 2016 22:42:56 +0000 (15:42 -0700)]
Add error explanations for E0374, E0375, E0376 on issue #33383

8 years agorustdoc: Fix missing type parameters on impls
Oliver Middleton [Thu, 12 May 2016 17:23:11 +0000 (18:23 +0100)]
rustdoc: Fix missing type parameters on impls

8 years agoImprove derived implementations for enums with lots of fieldless variants
Björn Steinbrink [Thu, 12 May 2016 15:54:05 +0000 (17:54 +0200)]
Improve derived implementations for enums with lots of fieldless variants

A number of trait methods like PartialEq::eq or Hash::hash don't
actually need a distinct arm for each variant, because the code within
the arm only depends on the number and types of the fields in the
variants. We can easily exploit this fact to create less and better
code for enums with multiple variants that have no fields at all, the
extreme case being C-like enums.

For nickel.rs and its by now infamous 800 variant enum, this reduces
optimized compile times by 25% and non-optimized compile times by 40%.
Also peak memory usage is down by almost 40% (310MB down to 190MB).

To be fair, most other crates don't benefit nearly as much, because
they don't have as huge enums. The crates in the Rust distribution that
I measured saw basically no change in compile times (I only tried
optimized builds) and only 1-2% reduction in peak memory usage.

8 years agore-introduce a cache for ast-ty-to-ty
Niko Matsakis [Thu, 12 May 2016 18:19:26 +0000 (14:19 -0400)]
re-introduce a cache for ast-ty-to-ty

It turns out that `ast_ty_to_ty` is supposed to be updating the `def`
after it finishes, but at some point in the past it stopped doing
so. This was never noticed because of the `ast_ty_to_ty_cache`, but that
cache was recently removed. This PR fixes the code to update the def
properly, but apparently that is not quite enough to make the operation
idempotent, so for now we reintroduce the cache too.

Fixes #33425.

8 years agoFix the sed invocation to also work with BSD sed.
Pavel Sountsov [Thu, 12 May 2016 16:32:17 +0000 (09:32 -0700)]
Fix the sed invocation to also work with BSD sed.

8 years agoDon't use env::current_exe with libbacktrace
Steven Fackler [Sun, 8 May 2016 19:07:50 +0000 (12:07 -0700)]
Don't use env::current_exe with libbacktrace

If the path we give to libbacktrace doesn't actually correspond to the
current process, libbacktrace will segfault *at best*.

cc #21889

8 years agorustbuild: Add support for crate tests + doctests
Alex Crichton [Fri, 29 Apr 2016 21:23:15 +0000 (14:23 -0700)]
rustbuild: Add support for crate tests + doctests

This commit adds support to rustbuild to run crate unit tests (those defined by
`#[test]`) as well as documentation tests. All tests are powered by `cargo test`
under the hood.

Each step requires the `libtest` library is built for that corresponding stage.
Ideally the `test` crate would be a dev-dependency, but for now it's just easier
to ensure that we sequence everything in the right order.

Currently no filtering is implemented, so there's not actually a method of
testing *only* libstd or *only* libcore, but rather entire swaths of crates are
tested all at once.

A few points of note here are:

* The `coretest` and `collectionstest` crates are just listed as `[[test]]`
  entires for `cargo test` to naturally pick up. This mean that `cargo test -p
  core` actually runs all the tests for libcore.
* Libraries that aren't tested all mention `test = false` in their `Cargo.toml`
* Crates aren't currently allowed to have dev-dependencies due to
  rust-lang/cargo#860, but we can likely alleviate this restriction once
  workspaces are implemented.

cc #31590

8 years agoAuto merge of #33338 - birkenfeld:issue-25356, r=jseyfried
bors [Thu, 12 May 2016 11:01:55 +0000 (04:01 -0700)]
Auto merge of #33338 - birkenfeld:issue-25356, r=jseyfried

typeck: limit number of candidates shown for a single error

No idea if 10/11 is a good limit. Are there any other such limits in rustc currently?

Fixes: #25356
8 years agoBetter handling of tab in error
Seo Sanghyeon [Mon, 9 May 2016 14:09:25 +0000 (23:09 +0900)]
Better handling of tab in error

8 years agoAuto merge of #33306 - vadixidav:master, r=alexcrichton
bors [Thu, 12 May 2016 07:18:15 +0000 (00:18 -0700)]
Auto merge of #33306 - vadixidav:master, r=alexcrichton

add implementation of Ord for Cell<T> and RefCell<T> where T: Ord

Raised this in issue #33305.

8 years agotypeck: if a private field exists, also check for a public method
Georg Brandl [Mon, 2 May 2016 12:52:48 +0000 (14:52 +0200)]
typeck: if a private field exists, also check for a public method

For example, `Vec::len` is both a field and a method, and usually
encountering `vec.len` just means that the parens were forgotten.

Fixes: #26472
8 years agotypeck: limit number of candidates shown for a single error
Georg Brandl [Mon, 2 May 2016 08:37:28 +0000 (10:37 +0200)]
typeck: limit number of candidates shown for a single error

Limit of 4 taken consistent with limit for "similar impl candidates"
in rustc::traits::error_reporting.

Fixes: #25356
8 years agoTighten span for E0063
Seo Sanghyeon [Thu, 12 May 2016 04:42:57 +0000 (13:42 +0900)]
Tighten span for E0063

8 years agoAuto merge of #33169 - swgillespie:issue32829, r=eddyb
bors [Thu, 12 May 2016 02:48:54 +0000 (19:48 -0700)]
Auto merge of #33169 - swgillespie:issue32829, r=eddyb

const_fn: Check the terminating expression of a block for blocks in a const initializer

In a const or static initializer, the `CheckBlock` check ensures that blocks in the initializer expression are only in tail positions or in items. In this case, it didn't check the terminating expression of a block, which resulted in an ICE later in the compiler pipeline if the trailing expression was itself a block. This change fixes the ICE and ensures that the proper error is emitted. This fixes the ICE in #32829 .

8 years agoPlumb inference obligations through selection
Masood Malekghassemi [Thu, 12 May 2016 00:22:13 +0000 (17:22 -0700)]
Plumb inference obligations through selection

8 years agoAuto merge of #33562 - GuillaumeGomez:rollup, r=steveklabnik
bors [Wed, 11 May 2016 23:34:54 +0000 (16:34 -0700)]
Auto merge of #33562 - GuillaumeGomez:rollup, r=steveklabnik

Rollup of 3 pull requests

- Successful merges: #33401, #33489, #33558
- Failed merges: #33342, #33475, #33517

8 years agoCheck the constants’ parameter environment
Simonas Kazlauskas [Wed, 11 May 2016 21:48:47 +0000 (00:48 +0300)]
Check the constants’ parameter environment

8 years agoDon't mutate the inference context when assembling
Masood Malekghassemi [Wed, 11 May 2016 21:56:52 +0000 (14:56 -0700)]
Don't mutate the inference context when assembling

8 years agoAdd inferred obligation storage to all Vtable variants and SelectionContext
Masood Malekghassemi [Wed, 11 May 2016 21:40:24 +0000 (14:40 -0700)]
Add inferred obligation storage to all Vtable variants and SelectionContext

8 years agoGen right parameter envirnoment for assoc consts
Simonas Kazlauskas [Wed, 11 May 2016 21:30:08 +0000 (00:30 +0300)]
Gen right parameter envirnoment for assoc consts

8 years agoDo not use const Rib for associated constants
Simonas Kazlauskas [Wed, 11 May 2016 19:45:49 +0000 (22:45 +0300)]
Do not use const Rib for associated constants

8 years agotrans: Use CrateContext::empty_substs_for_def_id() instead of Substs::empty() where...
Michael Woerister [Wed, 11 May 2016 21:11:20 +0000 (17:11 -0400)]
trans: Use CrateContext::empty_substs_for_def_id() instead of Substs::empty() where appropriate.

8 years agosave-analysis: give better text info in value fields
Nick Cameron [Wed, 11 May 2016 20:46:39 +0000 (13:46 -0700)]
save-analysis: give better text info in value fields

8 years agosave-analysis: attempt number 2 at a JSON version
Nick Cameron [Wed, 11 May 2016 16:59:35 +0000 (09:59 -0700)]
save-analysis: attempt number 2 at a JSON version

8 years ago[MIR trans] Optimize trans for biased switches
Björn Steinbrink [Wed, 11 May 2016 19:31:19 +0000 (21:31 +0200)]
[MIR trans] Optimize trans for biased switches

Currently, all switches in MIR are exhausitive, meaning that we can have
a lot of arms that all go to the same basic block, the extreme case
being an if-let expression which results in just 2 possible cases, be
might end up with hundreds of arms for large enums.

To improve this situation and give LLVM less code to chew on, we can
detect whether there's a pre-dominant target basic block in a switch
and then promote this to be the default target, not translating the
corresponding arms at all.

In combination with #33544 this makes unoptimized MIR trans of
nickel.rs as fast as using old trans and greatly improves the times for
optimized builds, which are only 30-40% slower instead of ~300%.

cc #33111

8 years agoAdd detailed error explanation for E0505
billyevans [Fri, 6 May 2016 23:27:32 +0000 (00:27 +0100)]
Add detailed error explanation for E0505

Part of #32777

8 years agoExport OnceState from libstd
Amanieu d'Antras [Wed, 11 May 2016 19:30:20 +0000 (20:30 +0100)]
Export OnceState from libstd

8 years agoRollup merge of #33558 - bnewbold:trivial-book-tweaks, r=steveklabnik
Guillaume Gomez [Wed, 11 May 2016 19:30:20 +0000 (21:30 +0200)]
Rollup merge of #33558 - bnewbold:trivial-book-tweaks, r=steveklabnik

trivial tweaks to documentation (book)

These are small things I found while reading through The Book. The `<hash>` and `panic!` lines are simply to improve readability, while I believe the proceeding/following distinction is a bug (but might be a English dialect distinction?).

I've read `rust/CONTRIBUTING`, i'm not sure if there is anything I need to do other than submit this PR.

r? @steveklabnik

8 years agoRollup merge of #33489 - GuillaumeGomez:howto, r=alexcrichton
Guillaume Gomez [Wed, 11 May 2016 19:30:19 +0000 (21:30 +0200)]
Rollup merge of #33489 - GuillaumeGomez:howto, r=alexcrichton

Improve help for make command

r? @steveklabnik

8 years agoRollup merge of #33401 - GuillaumeGomez:index_indication, r=pnkfelix
Guillaume Gomez [Wed, 11 May 2016 19:30:19 +0000 (21:30 +0200)]
Rollup merge of #33401 - GuillaumeGomez:index_indication, r=pnkfelix

Add rustc_on_unimplemented for Index implementation on slice

Reopening of #31071.

It also extends the possibility of `#[rustc_on_unimplemented]` by providing a small type filter in order to find the ones which corresponds the most.

r? @pnkfelix

8 years agoAuto merge of #33561 - alexcrichton:fix-nightiles, r=brson
bors [Wed, 11 May 2016 19:07:06 +0000 (12:07 -0700)]
Auto merge of #33561 - alexcrichton:fix-nightiles, r=brson

mk: Fix dependencies of unwind crate on musl

The libunwind.a library was accidentally only being included for the standard
library, not the new unwind crate which implements an unwinder.

8 years agoRemove unification despite ambiguity in projection
Masood Malekghassemi [Wed, 11 May 2016 06:25:34 +0000 (23:25 -0700)]
Remove unification despite ambiguity in projection

8 years agotrans: Make collector handle the drop_in_place() intrinsic.
Michael Woerister [Tue, 10 May 2016 21:24:44 +0000 (17:24 -0400)]
trans: Make collector handle the drop_in_place() intrinsic.

8 years agoAdd test for collecting items in statics
James Miller [Mon, 9 May 2016 22:14:41 +0000 (10:14 +1200)]
Add test for collecting items in statics

8 years agoInspect MIR for statics in item collection
James Miller [Mon, 9 May 2016 21:00:31 +0000 (09:00 +1200)]
Inspect MIR for statics in item collection

8 years agotrans: Don't try to place declarations during codegen unit partitioning.
Michael Woerister [Mon, 9 May 2016 18:26:15 +0000 (14:26 -0400)]
trans: Don't try to place declarations during codegen unit partitioning.

8 years agotrans: Move TransItem to its own module.
Michael Woerister [Mon, 9 May 2016 17:37:14 +0000 (13:37 -0400)]
trans: Move TransItem to its own module.

8 years agomk: Fix dependencies of unwind crate on musl
Alex Crichton [Wed, 11 May 2016 17:47:56 +0000 (10:47 -0700)]
mk: Fix dependencies of unwind crate on musl

The libunwind.a library was accidentally only being included for the standard
library, not the new unwind crate which implements an unwinder.

8 years agoUse symlink_metadata in tidy to avoid panicking on broken symlinks.
Eduard Burtescu [Wed, 11 May 2016 17:09:50 +0000 (20:09 +0300)]
Use symlink_metadata in tidy to avoid panicking on broken symlinks.

8 years agoOnly break critical edges where actually needed
Björn Steinbrink [Tue, 10 May 2016 19:03:47 +0000 (21:03 +0200)]
Only break critical edges where actually needed

Currently, to prepare for MIR trans, we break _all_ critical edges,
although we only actually need to do this for edges originating from a
call that gets translated to an invoke instruction in LLVM.

This has the unfortunate effect of undoing a bunch of the things that
SimplifyCfg has done. A particularly bad case arises when you have a
C-like enum with N variants and a derived PartialEq implementation.

In that case, the match on the (&lhs, &rhs) tuple gets translated into
nested matches with N arms each and a basic block each, resulting in N²
basic blocks. SimplifyCfg reduces that to roughly 2*N basic blocks, but
breaking the critical edges means that we go back to N².

In nickel.rs, there is such an enum with roughly N=800. So we get about
640K basic blocks or 2.5M lines of LLVM IR. LLVM takes a while to
reduce that to the final "disr_a == disr_b".

So before this patch, we had 2.5M lines of IR with 640K basic blocks,
which took about about 3.6s in LLVM to get optimized and translated.
After this patch, we get about 650K lines with about 1.6K basic blocks
and spent a little less than 0.2s in LLVM.

cc #33111

8 years agotrivial fixes to documentation (book)
bnewbold [Wed, 11 May 2016 15:53:07 +0000 (11:53 -0400)]
trivial fixes to documentation (book)

8 years agoUpdate to eddyb's PR
ggomez [Wed, 11 May 2016 12:33:14 +0000 (14:33 +0200)]
Update to eddyb's PR

8 years agoAuto merge of #33556 - steveklabnik:rollup, r=steveklabnik
bors [Wed, 11 May 2016 14:03:12 +0000 (07:03 -0700)]
Auto merge of #33556 - steveklabnik:rollup, r=steveklabnik

Rollup of 9 pull requests

- Successful merges: #33129, #33260, #33345, #33386, #33522, #33524, #33528, #33539, #33542
- Failed merges: #33342, #33475, #33517

8 years agoRollup merge of #33542 - GuillaumeGomez:move_since, r=steveklabnik
Steve Klabnik [Wed, 11 May 2016 13:27:44 +0000 (09:27 -0400)]
Rollup merge of #33542 - GuillaumeGomez:move_since, r=steveklabnik

Improve "since" tag placement

Continuation of #33431.

r? @steveklabnik

8 years agoRollup merge of #33539 - nikomatsakis:static-error, r=pnkfelix
Steve Klabnik [Wed, 11 May 2016 13:27:44 +0000 (09:27 -0400)]
Rollup merge of #33539 - nikomatsakis:static-error, r=pnkfelix

fix DFS for region error reporting

This was causing terrible error reports, because the algorithm was incorrectly identifying the constraints.

r? @eddyb

8 years agoRollup merge of #33528 - cramertj:E0061typeo, r=jseyfried
Steve Klabnik [Wed, 11 May 2016 13:27:44 +0000 (09:27 -0400)]
Rollup merge of #33528 - cramertj:E0061typeo, r=jseyfried

E0061 typo fix

Fixed silly typo.

8 years agoRollup merge of #33524 - briangreenery:briangreenery-fast-and-loose, r=steveklabnik
Steve Klabnik [Wed, 11 May 2016 13:27:44 +0000 (09:27 -0400)]
Rollup merge of #33524 - briangreenery:briangreenery-fast-and-loose, r=steveklabnik

doc: Fix tiny typo in vec-alloc.md

Change `fast an loose` to `fast and loose`.

8 years agoRollup merge of #33522 - mbrubeck:inline-rawvec-cap, r=nagisa
Steve Klabnik [Wed, 11 May 2016 13:27:43 +0000 (09:27 -0400)]
Rollup merge of #33522 - mbrubeck:inline-rawvec-cap, r=nagisa

Inline RawVec::cap

This was showing up in a Servo profile.

8 years agoRollup merge of #33386 - cramertj:E0504, r=steveklabnik
Steve Klabnik [Wed, 11 May 2016 13:27:43 +0000 (09:27 -0400)]
Rollup merge of #33386 - cramertj:E0504, r=steveklabnik

Add detailed error explanation for E0504

Part of #32777

8 years agoRollup merge of #33345 - birkenfeld:issue-31754, r=pnkfelix
Steve Klabnik [Wed, 11 May 2016 13:27:43 +0000 (09:27 -0400)]
Rollup merge of #33345 - birkenfeld:issue-31754, r=pnkfelix

middle: reset loop labels while visiting closure

This should fix #31754 and follow-up #25343.  Before the latter, the closure was visited twice in the context of the enclosing fn, which made even a single closure with a loop label emit a warning.

With this change, the closure is still visited within the context of the main fn (which is intended, since it is not a separate item) but resets the found loop labels while being visited.

Fixes: #31754
Note: I amended the test file from #25343, but I don't know if the original or amended test are effective, since as far as I could see, compiletest's run-pass tests do not check for zero warnings emitted?

/cc @Manishearth

8 years agoRollup merge of #33260 - mrmiywj:help-on-pattern-guard, r=guillaumegomez
Steve Klabnik [Wed, 11 May 2016 13:27:42 +0000 (09:27 -0400)]
Rollup merge of #33260 - mrmiywj:help-on-pattern-guard, r=guillaumegomez

add help on pattern guard

8 years agoRollup merge of #33129 - GuillaumeGomez:fmt_doc, r=steveklabnik
Steve Klabnik [Wed, 11 May 2016 13:27:42 +0000 (09:27 -0400)]
Rollup merge of #33129 - GuillaumeGomez:fmt_doc, r=steveklabnik

Doc improvement on std::fmt module

Part of #29355.

r? @steveklabnik

8 years agoCreate Weight enum
Guillaume Gomez [Tue, 10 May 2016 20:53:51 +0000 (22:53 +0200)]
Create Weight enum
Add more comments for the global understanding

8 years agoImprove weight algorithm and tests
ggomez [Tue, 3 May 2016 15:03:00 +0000 (17:03 +0200)]
Improve weight algorithm and tests

8 years agoImprove error message for Index trait on slices
Guillaume Gomez [Sat, 23 Jan 2016 05:44:38 +0000 (06:44 +0100)]
Improve error message for Index trait on slices

8 years agoExtend rustc_on_unimplemented flag: if a message is available at an impl, this messag...
ggomez [Thu, 21 Jan 2016 09:57:21 +0000 (10:57 +0100)]
Extend rustc_on_unimplemented flag: if a message is available at an impl, this message will be displayed instead

8 years agoAuto merge of #33239 - eddyb:mir-temp-drops, r=arielb1
bors [Wed, 11 May 2016 10:15:05 +0000 (03:15 -0700)]
Auto merge of #33239 - eddyb:mir-temp-drops, r=arielb1

mir: drop temps outside-in by scheduling the drops inside-out.

It was backwards all along, but only noticeable with multiple drops in one rvalue scope. Fixes #32433.

8 years agomir: drop temps outside-in by scheduling the drops inside-out.
Eduard Burtescu [Wed, 11 May 2016 07:46:36 +0000 (10:46 +0300)]
mir: drop temps outside-in by scheduling the drops inside-out.

8 years agoMake LocalCrateReader private to creader.
Ms2ger [Tue, 10 May 2016 13:52:33 +0000 (15:52 +0200)]
Make LocalCrateReader private to creader.

8 years agoHand ownership of the Definitions to map_crate.
Ms2ger [Tue, 10 May 2016 13:43:51 +0000 (15:43 +0200)]
Hand ownership of the Definitions to map_crate.