]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoAuto merge of #34364 - cynicaldevil:develop, r=GuillaumeGomez
bors [Thu, 23 Jun 2016 11:43:40 +0000 (04:43 -0700)]
Auto merge of #34364 - cynicaldevil:develop, r=GuillaumeGomez

Modified E0220 to show error messages for more general cases

This PR extends `E0220`'s description to explain more cases.
Refer to [#34342](https://github.com/rust-lang/rust/pull/34342) for more.
r? @GuillaumeGomez

8 years agoAuto merge of #34253 - jseyfried:improve_multi_modifiers, r=nrc
bors [Thu, 23 Jun 2016 08:04:47 +0000 (01:04 -0700)]
Auto merge of #34253 - jseyfried:improve_multi_modifiers, r=nrc

Allow `MultiItemModifier`s to expand into zero or many items

Fixes #34223.
r? @nrc

8 years agoAuto merge of #34374 - jseyfried:fix_hygiene_bug, r=nrc
bors [Thu, 23 Jun 2016 04:11:27 +0000 (21:11 -0700)]
Auto merge of #34374 - jseyfried:fix_hygiene_bug, r=nrc

Fix macro hygiene regression

The regression was caused by #32923, which is currently in beta.

The following is an example of regressed code:
```rust
fn main() {
    let x = 0;
    macro_rules! foo { () => {
        println!("{}", x); // prints `0` on stable and after this PR, prints `1` on beta and nightly
    } }

    let x = 1;
    foo!();
}
```

For code to regress, the following is necessary (but not sufficient):
 - There must be a local variable before a macro in a block, and the macro must use the variable.
 - There must be a second local variable with the same name after the macro.
 - The macro must be invoked in a statement position after the second local variable.

For example, if the `let x = 0;` from the breaking example were commented out, it would (correctly) not compile on beta/nightly. If the semicolon were removed from `foo!();`, it would (correctly) print `0` on beta and nightly.

r? @nrc

8 years agoMore hygiene tests
Jeffrey Seyfried [Wed, 22 Jun 2016 22:42:26 +0000 (22:42 +0000)]
More hygiene tests

8 years agoAuto merge of #33748 - emilio:mpsc-recv-timeout, r=alexcrichton
bors [Wed, 22 Jun 2016 20:35:12 +0000 (13:35 -0700)]
Auto merge of #33748 - emilio:mpsc-recv-timeout, r=alexcrichton

std: sync: Implement recv_timeout()

This is an attempt to implement https://github.com/rust-lang/rfcs/issues/962.

I'm not sure about if a change like this would require an rfc or something like
that, and this surely needs a lot more testing, but I wanted to take some eyes
on it before following.

cc @metajack @asajeffrey https://github.com/servo/servo/pull/11279 https://github.com/servo/servo/pull/11283

r? @aturon

8 years agostd: sync: Implement recv_timeout()
Emilio Cobos Álvarez [Fri, 20 May 2016 00:43:18 +0000 (02:43 +0200)]
std: sync: Implement recv_timeout()

8 years agoAuto merge of #34408 - Manishearth:rollup, r=Manishearth
bors [Wed, 22 Jun 2016 11:21:59 +0000 (04:21 -0700)]
Auto merge of #34408 - Manishearth:rollup, r=Manishearth

Rollup of 7 pull requests

- Successful merges: #34190, #34363, #34367, #34383, #34387, #34394, #34404
- Failed merges:

8 years agoRollup merge of #34404 - ollie27:concat_idents, r=alexcrichton
Manish Goregaokar [Wed, 22 Jun 2016 08:51:09 +0000 (09:51 +0100)]
Rollup merge of #34404 - ollie27:concat_idents, r=alexcrichton

Mark concat_idents! unstable

This is mostly just a documentation fix as I don't think stability
attributes have any effect on macros.

[before](https://doc.rust-lang.org/nightly/std/macro.concat_idents!.html) [after](https://ollie27.github.io/rust_doc_test/std/macro.concat_idents!.html)

8 years agoRollup merge of #34394 - oli-obk:const_cast_false_positive, r=eddyb
Manish Goregaokar [Wed, 22 Jun 2016 08:51:08 +0000 (09:51 +0100)]
Rollup merge of #34394 - oli-obk:const_cast_false_positive, r=eddyb

don't warn on casting byte strs to slices

r? @durka

8 years agoRollup merge of #34387 - ollie27:rustdoc_src_links, r=alexcrichton
Manish Goregaokar [Wed, 22 Jun 2016 08:51:08 +0000 (09:51 +0100)]
Rollup merge of #34387 - ollie27:rustdoc_src_links, r=alexcrichton

rustdoc: Fix a couple of issues with src links to external crates

- src links/redirects to extern fn from another crate had an extra '/'.
- src links to `pub use` of a crate module had an extra '/'.
- src links to renamed reexports from another crate used the new name
  for the link but should use the original name.

Fixes: #34274
8 years agoRollup merge of #34383 - alexcrichton:less-compiler-checks, r=brson
Manish Goregaokar [Wed, 22 Jun 2016 08:51:08 +0000 (09:51 +0100)]
Rollup merge of #34383 - alexcrichton:less-compiler-checks, r=brson

configure: Remove clang version checks

We no C++ and an incredibly small amount of C code as part of the build, so
there's not really much need for us to strictly check the version of compilers
as we're not really stressing anything. LLVM is a pretty huge chunk of C++ but
it should be the responsibility of LLVM to ensure that it can build with a
particular clang/gcc version, not ours (as this logic changes over time).

These version checks seem to basically just by us a regular stream of PRs every
six weeks or so when a new version is releases, so they're not really buying us
much. As a result, remove them and we can add then back piecemeal perhaps as a
blacklist if we really need to.

8 years agoRollup merge of #34367 - Stebalien:issue-23281, r=sfackler
Manish Goregaokar [Wed, 22 Jun 2016 08:51:07 +0000 (09:51 +0100)]
Rollup merge of #34367 - Stebalien:issue-23281, r=sfackler

Add regression test for #23281

Closes #23281

8 years agoRollup merge of #34363 - GuillaumeGomez:sleep, r=alexcrichton
Manish Goregaokar [Wed, 22 Jun 2016 08:51:07 +0000 (09:51 +0100)]
Rollup merge of #34363 - GuillaumeGomez:sleep, r=alexcrichton

Fix overflow error in thread::sleep

Fixes #34330

I added a test to have a more clear error inside the function. Since `time_t` is `i64` and we expect `u64`, maybe we should changed the awaited type?

8 years agoRollup merge of #34190 - ollie27:wrapping_fmt, r=alexcrichton
Manish Goregaokar [Wed, 22 Jun 2016 08:51:06 +0000 (09:51 +0100)]
Rollup merge of #34190 - ollie27:wrapping_fmt, r=alexcrichton

Implement Binary, Octal, LowerHex and UpperHex for Wrapping<T>

Fixes: #33659
8 years agoAuto merge of #33976 - komamitsu:assert_eq_with_msg, r=alexcrichton
bors [Wed, 22 Jun 2016 08:05:56 +0000 (01:05 -0700)]
Auto merge of #33976 - komamitsu:assert_eq_with_msg, r=alexcrichton

Add custom message parameter to `assert_eq!`

`assert!` macro accepts a custom message parameter and it's sometimes useful. But `assert_eq!` doesn't have it and users need to use `assert!` instead of `assert_eq!` when they want to output a custom message even if the assertion just compares two values. This pull request will resolve those cases.

8 years agoAuto merge of #33830 - moosingin3space:feature/mutable-high-priority-binaryheap,...
bors [Wed, 22 Jun 2016 03:52:23 +0000 (20:52 -0700)]
Auto merge of #33830 - moosingin3space:feature/mutable-high-priority-binaryheap, r=alexcrichton

Mutable access to the top element of a BinaryHeap

An implementation of the library change discussed here: https://github.com/rust-lang/rfcs/issues/1626

8 years agoAuto merge of #34402 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Tue, 21 Jun 2016 23:14:38 +0000 (16:14 -0700)]
Auto merge of #34402 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 7 pull requests

- Successful merges: #34356, #34360, #34369, #34371, #34378, #34380, #34391
- Failed merges:

8 years agoMark concat_idents! unstable
Oliver Middleton [Tue, 21 Jun 2016 22:30:15 +0000 (23:30 +0100)]
Mark concat_idents! unstable

This is mostly just a documentation fix as I don't think stability
attributes have any effect on macros.

8 years agoRollup merge of #34391 - pyjarrett:master, r=jseyfried
Guillaume Gomez [Tue, 21 Jun 2016 21:54:29 +0000 (23:54 +0200)]
Rollup merge of #34391 - pyjarrett:master, r=jseyfried

Improves organization of driver includes.

Minor reordering of use's in librustc_driver/driver.rs

- puts her::lower::lower_create with it's siblings
- groups link and write of rustc_trans::back

8 years agoRollup merge of #34380 - sanxiyn:travis-gdb, r=alexcrichton
Guillaume Gomez [Tue, 21 Jun 2016 21:54:29 +0000 (23:54 +0200)]
Rollup merge of #34380 - sanxiyn:travis-gdb, r=alexcrichton

Run debuginfo tests on Travis

8 years agoRollup merge of #34378 - liigo:patch-10, r=Manishearth
Guillaume Gomez [Tue, 21 Jun 2016 21:54:29 +0000 (23:54 +0200)]
Rollup merge of #34378 - liigo:patch-10, r=Manishearth

diagnostics comes from different places now

8 years agoRollup merge of #34371 - frewsxcv:thread-name, r=steveklabnik
Guillaume Gomez [Tue, 21 Jun 2016 21:54:28 +0000 (23:54 +0200)]
Rollup merge of #34371 - frewsxcv:thread-name, r=steveklabnik

Add examples for `std::thread::Thread::name`.

None

8 years agoRollup merge of #34369 - astocko:fix_doc_urls, r=steveklabnik
Guillaume Gomez [Tue, 21 Jun 2016 21:54:28 +0000 (23:54 +0200)]
Rollup merge of #34369 - astocko:fix_doc_urls, r=steveklabnik

book: Fixed links in book/compiler-plugins.md

Updated the links referring to roman_numerals.rs and lint_plugin_test.rs. Went from src/test/auxiliary/ to src/test/run-pass-fulldeps/auxiliary/.

8 years agoRollup merge of #34360 - dsprenkels:ops-doc, r=apasel422
Guillaume Gomez [Tue, 21 Jun 2016 21:54:28 +0000 (23:54 +0200)]
Rollup merge of #34360 - dsprenkels:ops-doc, r=apasel422

Markdown formatting fix

This pull request fixes some bad markdown formatting in the[ `std::ops::RangeTo` documentation](https://doc.rust-lang.org/std/ops/struct.RangeTo.html):

![screenshot from 2016-06-19 14 29 21](https://cloud.githubusercontent.com/assets/439973/16177354/5439a9bc-362a-11e6-97e5-374fd0bcf5a2.png)

8 years agoRollup merge of #34356 - matklad:cstr-docs, r=GuillaumeGomez
Guillaume Gomez [Tue, 21 Jun 2016 21:54:28 +0000 (23:54 +0200)]
Rollup merge of #34356 - matklad:cstr-docs, r=GuillaumeGomez

Document `CStr::as_ptr` dangers.

r? @steveklabnik

Hi! I've tried to document `CString::new("hello").unwrap().as_ptr()` footgun. Related [RFC] and the original [discussion].

[RFC]: https://github.com/rust-lang/rfcs/pull/1642
[discussion]: https://users.rust-lang.org/t/you-should-stop-telling-people-that-safe-rust-is-always-safe/6094

8 years agoimplemented peek_mut and unit tests
Nathan Moos [Mon, 23 May 2016 23:59:11 +0000 (16:59 -0700)]
implemented peek_mut and unit tests

8 years agoModified E0220 to show error messages for more general cases
Nikhil Shagrithaya [Sun, 19 Jun 2016 14:03:47 +0000 (19:33 +0530)]
Modified E0220 to show error messages for more general cases

8 years agoFix overflow error in thread::sleep
Guillaume Gomez [Sun, 19 Jun 2016 13:58:40 +0000 (15:58 +0200)]
Fix overflow error in thread::sleep

8 years agoAuto merge of #34155 - ollie27:unzip, r=alexcrichton
bors [Tue, 21 Jun 2016 09:18:42 +0000 (02:18 -0700)]
Auto merge of #34155 - ollie27:unzip, r=alexcrichton

Remove unzip() SizeHint hack

This was using an invalid iterator so is likely to end with buggy
behaviour.

It also doesn't even benefit many type in std including Vec so removing it
shouldn't cause any problems.

Fixes: #33468
8 years agodon't warn on casting byte strs to slices
Oliver Schneider [Tue, 21 Jun 2016 08:08:31 +0000 (10:08 +0200)]
don't warn on casting byte strs to slices

8 years agoAdd message argument to `assert_eq` macro
Mitsunori Komatsu [Mon, 30 May 2016 16:53:14 +0000 (01:53 +0900)]
Add message argument to `assert_eq` macro

8 years agoAuto merge of #34189 - eddyb:mir-trans-imm, r=nagisa
bors [Tue, 21 Jun 2016 04:04:48 +0000 (21:04 -0700)]
Auto merge of #34189 - eddyb:mir-trans-imm, r=nagisa

trans: generalize immediate temporaries to all MIR locals.

Added `Mir::local_index` which gives you an unified index for `Arg`, `Var`, `Temp` and `ReturnPointer`.
Also available is `Mir::count_locals` which returns the total number of the above locals.
This simplifies a lot of the code which can treat all of the local lvalues in the same manner.
If we had `-> impl Iterator`, I could have added a bunch of useful `Ty` or `Lvalue` iterators for all locals.
We could of course manually write such iterators as they are needed.

The only place which currently takes advantage of unified locals is trans' alloca elision.
Currently it's not as good as it could be, due to our usage of `llvm.dbg.declare` in debug mode.
But passing some arguments and variables as immediates has some effect on release-mode `libsyntax`:

Old trans:
```
time: 11.500; rss: 710MB        translation
time: 0.002; rss: 710MB assert dep graph
time: 0.000; rss: 710MB serialize dep graph
  time: 4.410; rss: 628MB       llvm function passes [0]
  time: 84.485; rss: 633MB      llvm module passes [0]
  time: 23.898; rss: 634MB      codegen passes [0]
  time: 0.002; rss: 634MB       codegen passes [0]
time: 113.408; rss: 634MB       LLVM passes
```
`-Z orbit`, previously:
```
time: 12.588; rss: 723MB        translation
time: 0.002; rss: 723MB assert dep graph
time: 0.000; rss: 723MB serialize dep graph
  time: 4.597; rss: 642MB       llvm function passes [0]
  time: 77.347; rss: 646MB      llvm module passes [0]
  time: 24.703; rss: 648MB      codegen passes [0]
  time: 0.002; rss: 615MB       codegen passes [0]
time: 107.233; rss: 615MB       LLVM passes
```
`-Z orbit`, after this PR:
```
time: 13.820; rss: 672MB        translation
time: 0.002; rss: 672MB assert dep graph
time: 0.000; rss: 672MB serialize dep graph
  time: 3.969; rss: 591MB       llvm function passes [0]
  time: 72.294; rss: 595MB      llvm module passes [0]
  time: 24.610; rss: 597MB      codegen passes [0]
  time: 0.002; rss: 597MB       codegen passes [0]
time: 101.439; rss: 597MB       LLVM passes
```

8 years agoImproves organization of driver includes.
Paul Jarrett [Tue, 21 Jun 2016 02:11:45 +0000 (22:11 -0400)]
Improves organization of driver includes.

8 years agoAuto merge of #34186 - GuillaumeGomez:err-code-check, r=alexcrichton
bors [Mon, 20 Jun 2016 22:54:17 +0000 (15:54 -0700)]
Auto merge of #34186 - GuillaumeGomez:err-code-check, r=alexcrichton

Implementation of #34168

r? @brson

cc @alexcrichton
cc @steveklabnik
cc @jonathandturner

I only updated `librustc_privacy/diagnostics.rs`, and I already found a case where the code doesn't throw the expected error code (E0448).

Fixes #34168.

8 years agorustdoc: Fix a couple of issues with src links to external crates
Oliver Middleton [Sat, 18 Jun 2016 17:41:13 +0000 (18:41 +0100)]
rustdoc: Fix a couple of issues with src links to external crates

- src links/redirects to extern fn from another crate had an extra '/'.
- src links to `pub use` of a crate module had an extra '/'.
- src links to renamed reexports from another crate used the new name
  for the link but should use the original name.

8 years agotrans: generalize immediate temporaries to all MIR locals.
Eduard Burtescu [Mon, 20 Jun 2016 20:55:14 +0000 (23:55 +0300)]
trans: generalize immediate temporaries to all MIR locals.

8 years agotrans: noop drops don't need their lvalue in an alloca.
Eduard Burtescu [Thu, 9 Jun 2016 15:15:15 +0000 (18:15 +0300)]
trans: noop drops don't need their lvalue in an alloca.

8 years agotrans: derefs don't need the pointer in an alloca.
Eduard Burtescu [Thu, 9 Jun 2016 15:14:47 +0000 (18:14 +0300)]
trans: derefs don't need the pointer in an alloca.

8 years agotrans: split trans_consume off from trans_operand.
Eduard Burtescu [Thu, 9 Jun 2016 15:13:16 +0000 (18:13 +0300)]
trans: split trans_consume off from trans_operand.

8 years agoAdd regression test for #23281
Steven Allen [Sun, 19 Jun 2016 17:50:37 +0000 (13:50 -0400)]
Add regression test for #23281

Closes #23281

8 years agoAdd error code flag
Guillaume Gomez [Thu, 9 Jun 2016 22:34:46 +0000 (00:34 +0200)]
Add error code flag

8 years agoconfigure: Remove clang version checks
Alex Crichton [Mon, 20 Jun 2016 17:02:48 +0000 (10:02 -0700)]
configure: Remove clang version checks

We no C++ and an incredibly small amount of C code as part of the build, so
there's not really much need for us to strictly check the version of compilers
as we're not really stressing anything. LLVM is a pretty huge chunk of C++ but
it should be the responsibility of LLVM to ensure that it can build with a
particular clang/gcc version, not ours (as this logic changes over time).

These version checks seem to basically just by us a regular stream of PRs every
six weeks or so when a new version is releases, so they're not really buying us
much. As a result, remove them and we can add then back piecemeal perhaps as a
blacklist if we really need to.

8 years agoAdd more hygiene tests
Jeffrey Seyfried [Mon, 20 Jun 2016 12:13:05 +0000 (12:13 +0000)]
Add more hygiene tests

8 years agoAdd regression test
Jeffrey Seyfried [Mon, 20 Jun 2016 10:57:34 +0000 (10:57 +0000)]
Add regression test

8 years agoRemove unit tests
Jeffrey Seyfried [Mon, 20 Jun 2016 10:51:48 +0000 (10:51 +0000)]
Remove unit tests

8 years agoFix hygiene regression
Jeffrey Seyfried [Mon, 20 Jun 2016 10:28:32 +0000 (10:28 +0000)]
Fix hygiene regression

8 years agoRun debuginfo tests on Travis
Seo Sanghyeon [Mon, 20 Jun 2016 10:31:07 +0000 (19:31 +0900)]
Run debuginfo tests on Travis

8 years agoAuto merge of #33950 - srinivasreddy:rtstartup_rustfmt, r=Manishearth
bors [Mon, 20 Jun 2016 09:32:07 +0000 (02:32 -0700)]
Auto merge of #33950 - srinivasreddy:rtstartup_rustfmt, r=Manishearth

run rustfmt on rtstartup folder

8 years agodiagnostics comes from different places now
Liigo Zhuang [Mon, 20 Jun 2016 08:05:30 +0000 (16:05 +0800)]
diagnostics comes from different places now

8 years agoAuto merge of #34348 - dsprenkels:issue-34194-test, r=alexcrichton
bors [Mon, 20 Jun 2016 05:18:52 +0000 (22:18 -0700)]
Auto merge of #34348 - dsprenkels:issue-34194-test, r=alexcrichton

Add regression test for #34194

This pull request adds a regression test for #34194.

Closes #34194.

8 years agoAuto merge of #34340 - marudor:master, r=japaric
bors [Mon, 20 Jun 2016 00:22:54 +0000 (17:22 -0700)]
Auto merge of #34340 - marudor:master, r=japaric

fix build for clang 8.0

With 10.12 and XCode 8-beta we got clang 8.
Simple addition as clang 8 will build as well.

8 years agoAdd examples for `std::thread::Thread::name`.
Corey Farwell [Sun, 19 Jun 2016 21:51:35 +0000 (17:51 -0400)]
Add examples for `std::thread::Thread::name`.

8 years agoFixed links in book/compiler-plugins.md
Alexander Stocko [Sun, 19 Jun 2016 20:11:43 +0000 (16:11 -0400)]
Fixed links in book/compiler-plugins.md

8 years agoAuto merge of #34335 - ollie27:docs_collections_mods, r=GuillaumeGomez
bors [Sun, 19 Jun 2016 19:56:13 +0000 (12:56 -0700)]
Auto merge of #34335 - ollie27:docs_collections_mods, r=GuillaumeGomez

Add short summaries to btree modules

Also improve hash_map and hash_set module short summaries.

These are missing from [here](https://doc.rust-lang.org/nightly/std/collections/#modules).

r? @steveklabnik

8 years agodoc: std::ops md formatting fix
Daan Sprenkels [Sun, 19 Jun 2016 12:23:30 +0000 (14:23 +0200)]
doc: std::ops md formatting fix

8 years agoDocument `CStr::as_ptr` dangers.
Aleksey Kladov [Sun, 19 Jun 2016 08:55:34 +0000 (11:55 +0300)]
Document `CStr::as_ptr` dangers.

8 years agoAuto merge of #34313 - frewsxcv:panicking-example, r=steveklabnik
bors [Sun, 19 Jun 2016 09:24:15 +0000 (02:24 -0700)]
Auto merge of #34313 - frewsxcv:panicking-example, r=steveklabnik

Add example in docs for `std::thread::panicking`.

None

8 years agoAuto merge of #34351 - Stebalien:issue-22434, r=sfackler
bors [Sun, 19 Jun 2016 06:18:14 +0000 (23:18 -0700)]
Auto merge of #34351 - Stebalien:issue-22434, r=sfackler

Add test case for #22434

Closes #22434

8 years agoAuto merge of #34295 - jseyfried:cfg_decoration, r=eddyb
bors [Sun, 19 Jun 2016 03:12:09 +0000 (20:12 -0700)]
Auto merge of #34295 - jseyfried:cfg_decoration, r=eddyb

Perform `cfg` attribute processing on decorator-generated items

Fixes https://users.rust-lang.org/t/unused-attribute-warning-for-custom-derive-attribute/6180.
r? @nrc

8 years agoAuto merge of #34350 - Stebalien:test-30276, r=eddyb
bors [Sun, 19 Jun 2016 00:07:15 +0000 (17:07 -0700)]
Auto merge of #34350 - Stebalien:test-30276, r=eddyb

Add test case for #30276

Make sure that treating a DST tuple constructor as a function doesn't ICE.

Closes #30276

8 years agoAdd test case for #22434
Steven Allen [Sat, 18 Jun 2016 22:43:44 +0000 (18:43 -0400)]
Add test case for #22434

Closes #22434

8 years agoAdd test case for #30276
Steven Allen [Sat, 18 Jun 2016 22:29:52 +0000 (18:29 -0400)]
Add test case for #30276

Make sure that treating a DST tuple constructor as a function doesn't ICE.

Closes #30276

8 years agoAuto merge of #34310 - erickt:tuple-struct-attrs, r=nrc
bors [Sat, 18 Jun 2016 21:02:32 +0000 (14:02 -0700)]
Auto merge of #34310 - erickt:tuple-struct-attrs, r=nrc

Pretty-print attributes on tuple structs and add tests

This adds support to the pretty printer to print attributes added to tuple struct elements.  Furthermore, it adds a test that makes sure we will print attributes on all variant data types.

8 years agoAdd regression test for #34194
Daan Sprenkels [Sat, 18 Jun 2016 18:05:44 +0000 (20:05 +0200)]
Add regression test for #34194

8 years agoAuto merge of #34342 - GuillaumeGomez:E0406, r=eddyb
bors [Sat, 18 Jun 2016 17:58:25 +0000 (10:58 -0700)]
Auto merge of #34342 - GuillaumeGomez:E0406, r=eddyb

Removed unused E0406 and unused functions

Fixes #34301.

It removes the unused E0406 and also unused functions.

cc @eddyb

8 years agoRemove unused functions calls and unused E0406
Guillaume Gomez [Fri, 17 Jun 2016 10:33:55 +0000 (12:33 +0200)]
Remove unused functions calls and unused E0406

8 years agoAuto merge of #34336 - petrochenkov:icemctuple, r=arielb1
bors [Sat, 18 Jun 2016 14:20:12 +0000 (07:20 -0700)]
Auto merge of #34336 - petrochenkov:icemctuple, r=arielb1

Fix ICE in memory categorization of tuple patterns

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

It seems to be ok for `pat_ty` to return `Err` even if type checking is done, because it uses `infcx.node_ty` which is supposed to return `Err` for all kinds of erroneous types so its callers could quickly bail out with `?`.

r? @arielb1

8 years agoAuto merge of #34314 - tshepang:misnamed, r=steveklabnik
bors [Sat, 18 Jun 2016 08:58:28 +0000 (01:58 -0700)]
Auto merge of #34314 - tshepang:misnamed, r=steveklabnik

doc: fix mis-named binding & remove not needed `mut`

8 years agofix build for clang 8.0
marudor [Sat, 18 Jun 2016 08:38:11 +0000 (10:38 +0200)]
fix build for clang 8.0

8 years agoFix ICE in memory categorization of tuple patterns
Vadim Petrochenkov [Fri, 17 Jun 2016 23:49:44 +0000 (02:49 +0300)]
Fix ICE in memory categorization of tuple patterns

8 years agoAdd short summaries to btree modules
Oliver Middleton [Fri, 17 Jun 2016 22:48:30 +0000 (23:48 +0100)]
Add short summaries to btree modules

Also improve hash_map and hash_set module short summaries.

8 years agoAuto merge of #34323 - GuillaumeGomez:unreachable_not_unreachable, r=pnkfelix
bors [Fri, 17 Jun 2016 22:33:00 +0000 (15:33 -0700)]
Auto merge of #34323 - GuillaumeGomez:unreachable_not_unreachable, r=pnkfelix

Fix panic when using debug in rustc

When I was using `println!("{:?}")` [here](https://github.com/rust-lang/rust/blob/master/src/librustc_resolve/lib.rs#L1610) and [here](https://github.com/rust-lang/rust/blob/master/src/librustc_typeck/collect.rs#L836), I was able to get into this `unreachache`.

8 years agoAdd example in docs for `std::thread::panicking`.
Corey Farwell [Thu, 16 Jun 2016 21:11:17 +0000 (23:11 +0200)]
Add example in docs for `std::thread::panicking`.

8 years agoAuto merge of #34292 - ollie27:rustdoc_depr_impl, r=GuillaumeGomez
bors [Fri, 17 Jun 2016 18:12:00 +0000 (11:12 -0700)]
Auto merge of #34292 - ollie27:rustdoc_depr_impl, r=GuillaumeGomez

rustdoc: Add stability notices to impl items

Also fixes missing stability notices on methods with no docs.

For example [`f64::is_positive`](https://doc.rust-lang.org/nightly/std/primitive.f64.html#method.is_positive) is missing its deprecation message.

8 years agoAuto merge of #34322 - pnkfelix:fix-rustc-ctags, r=alexcrichton
bors [Fri, 17 Jun 2016 14:58:33 +0000 (07:58 -0700)]
Auto merge of #34322 - pnkfelix:fix-rustc-ctags, r=alexcrichton

Fixed the `TAGS.rustc.emacs` and `TAGS.rustc.vi` make targets.

(They were added to `ctags.mk` in PR #33256, but I guess I must have
 only tested running `make TAGS.emacs TAGS.rustc.emacs` and not `make
 TAGS.rustc.emacs` on its own.)

8 years agoAuto merge of #33090 - bluss:special-zip-2, r=aturon
bors [Fri, 17 Jun 2016 10:36:32 +0000 (03:36 -0700)]
Auto merge of #33090 - bluss:special-zip-2, r=aturon

Specialize .zip() for efficient slice and slice iteration

The idea is to introduce a private trait TrustedRandomAccess and specialize .zip() for random access iterators into a counted loop.

The implementation in the PR is internal and has no visible effect in the API

Why a counted loop? To have each slice iterator compile to just a pointer, and both pointers are indexed with the same loop counter value in the generated code. When this succeeds, copying loops are readily recognized and replaced with memcpy and addition loops autovectorize well.

The TrustedRandomAccess approach works very well on the surface. Microbenchmarks optimize well, following the ideas above, and that is a dramatic improvement of .zip()'s codegen.

```rust
// old zip before this PR: bad, byte-for-byte loop
// with specialized zip: memcpy
pub fn copy_zip(xs: &[u8], ys: &mut [u8]) {
    for (a, b) in ys.iter_mut().zip(xs) {
        *a = *b;
    }
}

// old zip before this PR: single addition per iteration
// with specialized zip: vectorized
pub fn add_zip(xs: &[f32], ys: &mut [f32]) {
    for (a, b) in ys.iter_mut().zip(xs) { *a += *b; }
}

// old zip before this PR: single addition per iteration
// with specialized zip: vectorized (!!)
pub fn add_zip3(xs: &[f32], ys: &[f32], zs: &mut [f32]) {
    for ((a, b), c) in zs.iter_mut().zip(xs).zip(ys) { *a += *b * *c; }
}
```

Yet in more complex situations, the .zip() loop can still fall back to its old behavior where phantom null checks throw in fake premature end of the loop conditionals. Remember that a NULL inside
Option<(&T, &T)> makes it a `None` value and a premature (in this case)
end of the loop.

So even if we have 1) an explicit `Some` in the code and 2) the types of the pointers are `&T` or `&mut T` which are nonnull, we can still get a phantom null check at that point.

One example that illustrates the difference is `copy_zip` with slice versus Vec arguments. The involved iterator types are exactly the same, but the Vec version doesn't compile down to memcpy. Investigating into this, the function argument metadata emitted to llvm plays the biggest role. As eddyb summarized, we need nonnull for the loop to autovectorize and noalias for it to replace with memcpy.

There was an experiment to use `assume` to add a non-null assumption on each of the two elements in the specialized zip iterator, but this only helped in some of the test cases and regressed others. Instead I think the nonnull/noalias metadata issue is something we need to solve separately anyway.

These have conditionally implemented TrustedRandomAccess

- Enumerate
- Zip

These have not implemented it

- Map is sideeffectful. The forward case would be workable, but the double ended case is complicated.
- Chain, exact length semantics unclear
- Filter, FilterMap, FlatMap and many others don't offer random access and/or exact length

8 years agoFix panic when using debug
Guillaume Gomez [Fri, 17 Jun 2016 10:33:55 +0000 (12:33 +0200)]
Fix panic when using debug

8 years agoFixed the `TAGS.rustc.emacs` and `TAGS.rustc.vi` make targets.
Felix S. Klock II [Fri, 17 Jun 2016 10:07:48 +0000 (12:07 +0200)]
Fixed the `TAGS.rustc.emacs` and `TAGS.rustc.vi` make targets.

(They were added to `ctags.mk` in PR #33256, but I guess I must have
 only tested running `make TAGS.emacs TAGS.rustc.emacs` and not `make
 TAGS.rustc.emacs` on its own.)

8 years agoPretty-print attributes on tuple structs and add tests
Erick Tryzelaar [Fri, 17 Jun 2016 09:05:19 +0000 (10:05 +0100)]
Pretty-print attributes on tuple structs and add tests

This adds support to the pretty printer to print attributes
added to tuple struct elements.  Furthermore, it adds a test
that makes sure we will print attributes on all variant data
types.

8 years agoAuto merge of #34306 - arielb1:mir-dump-fixes, r=eddyb
bors [Fri, 17 Jun 2016 04:57:06 +0000 (21:57 -0700)]
Auto merge of #34306 - arielb1:mir-dump-fixes, r=eddyb

Fixes for `-Z dump-mir`

Do not overwrite the parent MIR when dumping promoted MIR.

r? @eddyb

8 years agoAuto merge of #34315 - Manishearth:rollup, r=Manishearth
bors [Fri, 17 Jun 2016 02:07:41 +0000 (19:07 -0700)]
Auto merge of #34315 - Manishearth:rollup, r=Manishearth

Rollup of 4 pull requests

- Successful merges: #34298, #34302, #34307, #34312
- Failed merges:

8 years agoRollup merge of #34312 - erickt:add-try, r=nikomatsakis
Manish Goregaokar [Thu, 16 Jun 2016 23:12:04 +0000 (00:12 +0100)]
Rollup merge of #34312 - erickt:add-try, r=nikomatsakis

Revert using ? for try! in the libsyntax pretty printer

The use of ...?instead of try!(...) in libsyntax makes extracting libsyntax into syntex quite painful since it's not stable yet. This makes backports take a much longer time and causes a lot of problems for the syntex dependencies. Even if it was, it'd take a few release cycles until syntex would be able to use it. Since it's not stable and that this feature is just syntax sugar, it would be most helpful if we could remove it.

cc #34311

8 years agoRollup merge of #34307 - nagisa:more-cache, r=arielb1
Manish Goregaokar [Thu, 16 Jun 2016 23:12:04 +0000 (00:12 +0100)]
Rollup merge of #34307 - nagisa:more-cache, r=arielb1

[MIR] Cache drops for early scope exits

Previously we would rebuild all drops on every early exit from a scope, which for code like:

```rust
match x {
    A => return 1,
    B => return 2,
    ...
    C => return 27
}
```

would produce 27 exactly same chains of drops for each return, basically a `O(n*m)` explosion. [This](https://cloud.githubusercontent.com/assets/679122/16125192/3355e32c-33fb-11e6-8564-c37cab2477a0.png) is such a case for a match on 80-variant enum with 3 droppable variables in scope.

For [`::core::iter::Iterator::partial_cmp`](https://github.com/rust-lang/rust/blob/6edea2cfda2818f0a76f4bac2d18a30feb54c137/src/libcore/iter/iterator.rs#L1909) the CFG looked like [this](https://cloud.githubusercontent.com/assets/679122/16122708/ce0024d8-33f0-11e6-93c2-e1c44b910db2.png) (after initial SimplifyCfg). With this patch the CFG looks like [this](https://cloud.githubusercontent.com/assets/679122/16122806/294fb16e-33f1-11e6-95f6-16c5438231af.png) instead.

Some numbers (overall very small wins, however neither of the crates have many cases which abuse this corner case):

|                         | old time | old rss | new time | new rss  |
|-------------------------|----------|---------|----------|----------|
| core dump               | 0.879        |   224MB     |   0.871  |  223MB   |
| core MIR passes         | 0.759        | 224MB       | 0.718    | 223MB    |
| core MIR codegen passes | 1.762        | 230MB       | 1.442    | 228MB    |
| core trans              | 3.263        | 279MB       | 3.116    | 278MB    |
| core llvm passes        | 5.611        | 263MB       | 5.565    | 263MB    |
| std dump                | 0.487        |   190MB     |   0.475  |  192MB   |
| std MIR passes          | 0.311       | 190MB       | 0.288    | 192MB    |
| std MIR codegen passes  | 0.753        | 195MB       | 0.720    | 197MB    |
| std trans               | 2.589        | 287MB       | 2.523    | 287MB    |
| std llvm passes         | 7.268        | 245MB       | 7.447    | 246MB    |

8 years agoRollup merge of #34302 - retep998:🐇-sanity-is-overrated-🐇, r=alexcrichton
Manish Goregaokar [Thu, 16 Jun 2016 23:12:04 +0000 (00:12 +0100)]
Rollup merge of #34302 - retep998:🐇-sanity-is-overrated-🐇, r=alexcrichton

Fix issue where rustbuild expected msvc to have ar

I made `cc2ar` return an `Option`.

r? @alexcrichton

8 years agoRollup merge of #34298 - nrc:save-parent, r=eddyb
Manish Goregaokar [Thu, 16 Jun 2016 23:12:04 +0000 (00:12 +0100)]
Rollup merge of #34298 - nrc:save-parent, r=eddyb

save-analysis: some tweaks

8 years agoAuto merge of #34272 - jseyfried:simplify_gated_cfg_checking, r=nrc
bors [Thu, 16 Jun 2016 23:09:45 +0000 (16:09 -0700)]
Auto merge of #34272 - jseyfried:simplify_gated_cfg_checking, r=nrc

Simplify gated cfg checking

r? @nrc

8 years agodoc: fix mis-named binding & remove not needed `mut`
Tshepang Lekhonkhobe [Thu, 16 Jun 2016 21:20:22 +0000 (23:20 +0200)]
doc: fix mis-named binding & remove not needed `mut`

8 years agoCache drops for early scope exits
Simonas Kazlauskas [Thu, 16 Jun 2016 15:28:30 +0000 (18:28 +0300)]
Cache drops for early scope exits

Previously we would rebuild all drops on every early exit from a scope, which for code like:

```rust
match x {
    a => return 1,
    b => return 2,
    ...
    z => return 27
}
```

would produce 27 exactly same chains of drops for each return, a O(n*m) explosion in drops.

8 years agoRevert using ? for try! in the libsyntax pretty printer
Erick Tryzelaar [Thu, 16 Jun 2016 20:16:55 +0000 (21:16 +0100)]
Revert using ? for try! in the libsyntax pretty printer

The use of ...?instead of try!(...) in libsyntax makes
extracting libsyntax into syntex quite painful since it's
not stable yet. This makes backports take a much longer time
and causes a lot of problems for the syntex dependencies. Even
if it was, it'd take a few release cycles until syntex would
be able to use it. Since it's not stable and that this feature
is just syntax sugar, it would be most helpful if we could remove
it.

cc #34311

8 years agoSimplify gated cfg checking
Jeffrey Seyfried [Sat, 11 Jun 2016 01:37:24 +0000 (01:37 +0000)]
Simplify gated cfg checking

8 years agoAuto merge of #34187 - luser:extern-crate-abspaths, r=michaelwoerister
bors [Thu, 16 Jun 2016 19:13:25 +0000 (12:13 -0700)]
Auto merge of #34187 - luser:extern-crate-abspaths, r=michaelwoerister

Add an abs_path member to FileMap, use it when writing debug info.

Fixes #34179.

When items are inlined from extern crates, the filename in the debug info
is taken from the FileMap that's serialized in the rlib metadata.
Currently this is just FileMap.name, which is whatever path is passed to rustc.
Since libcore and libstd are built by invoking rustc with relative paths,
they wind up with relative paths in the rlib, and when linked into a binary
the debug info uses relative paths for the names, but since the compilation
directory for the final binary, tools trying to read source filenames
will wind up with bad paths. We noticed this in Firefox with source
filenames from libcore/libstd having bad paths.

This change stores an absolute path in FileMap.abs_path, and uses that
if available for writing debug info. This is not going to magically make
debuggers able to find the source, but it will at least provide sensible
paths.

8 years agoAdd an abs_path member to FileMap, use it when writing debug info.
Ted Mielczarek [Thu, 9 Jun 2016 20:36:20 +0000 (16:36 -0400)]
Add an abs_path member to FileMap, use it when writing debug info.

When items are inlined from extern crates, the filename in the debug info
is taken from the FileMap that's serialized in the rlib metadata.
Currently this is just FileMap.name, which is whatever path is passed to rustc.
Since libcore and libstd are built by invoking rustc with relative paths,
they wind up with relative paths in the rlib, and when linked into a binary
the debug info uses relative paths for the names, but since the compilation
directory for the final binary, tools trying to read source filenames
will wind up with bad paths. We noticed this in Firefox with source
filenames from libcore/libstd having bad paths.

This change stores an absolute path in FileMap.abs_path, and uses that
if available for writing debug info. This is not going to magically make
debuggers able to find the source, but it will at least provide sensible
paths.

8 years agoAuto merge of #34296 - dsprenkels:issue-23122-tests, r=alexcrichton
bors [Thu, 16 Jun 2016 16:26:36 +0000 (09:26 -0700)]
Auto merge of #34296 - dsprenkels:issue-23122-tests, r=alexcrichton

Add regression tests for #23122

This PR adds two regression tests for #23122.

Closes #23122.

8 years agofix MirSource::Promoted handling
Ariel Ben-Yehuda [Thu, 16 Jun 2016 14:30:09 +0000 (17:30 +0300)]
fix MirSource::Promoted handling

8 years agostop having `'static` in dump-mir names
Ariel Ben-Yehuda [Thu, 16 Jun 2016 13:52:37 +0000 (16:52 +0300)]
stop having `'static` in dump-mir names

8 years agouse a different filename for original and promoted MIRs
Ariel Ben-Yehuda [Thu, 16 Jun 2016 13:52:20 +0000 (16:52 +0300)]
use a different filename for original and promoted MIRs

8 years agoAuto merge of #34239 - jseyfried:fix_macro_use_scope_regression, r=nrc
bors [Thu, 16 Jun 2016 13:37:18 +0000 (06:37 -0700)]
Auto merge of #34239 - jseyfried:fix_macro_use_scope_regression, r=nrc

Revert a change in the scope of macros imported from crates to fix a regression

Fixes #34212.
The regression was caused by #34032, which changed the scope of macros imported from extern crates to match the scope of macros imported from modules.
r? @nrc

8 years agoFix issue where rustbuild expected msvc to have ar
Peter Atashian [Thu, 16 Jun 2016 12:38:06 +0000 (08:38 -0400)]
Fix issue where rustbuild expected msvc to have ar

Signed-off-by: Peter Atashian <retep998@gmail.com>
8 years agoAuto merge of #34216 - jseyfried:nested_cfg_attr, r=nrc
bors [Thu, 16 Jun 2016 10:49:55 +0000 (03:49 -0700)]
Auto merge of #34216 - jseyfried:nested_cfg_attr, r=nrc

Support nested `cfg_attr` attributes

Support arbitrarily deeply nested `cfg_attr` attributes (e.g. `#[cfg_attr(foo, cfg_attr(bar, baz))]`).
This makes configuration idempotent.

Currently, the nighties do not support any `cfg_attr` nesting. Stable and beta support just one level of `cfg_attr` nesting (expect for attributes on macro-expanded nodes, where no nesting is supported).

This is a [breaking-change]. For example, the following would break:
```rust
macro_rules! m { () => {
    #[cfg_attr(all(), cfg_attr(all(), cfg(foo)))]
    fn f() {}
} }
m!();

fn main() { f() } //~ ERROR unresolved name `f`
```
r? @nrc

8 years agosave-analysis: add a decl_id for methods
Nick Cameron [Thu, 16 Jun 2016 10:28:39 +0000 (11:28 +0100)]
save-analysis: add a decl_id for methods

This is non-null if the method is in a (non-inherent) impl and in that case will be the id for the method declaration in the implemented trait.