Commit Graph

54669 Commits

Author SHA1 Message Date
bors
4960f2f907 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
2016-06-22 21:11:27 -07:00
Jeffrey Seyfried
f6fe5b6a3e Cleanup comments 2016-06-23 01:05:32 +00:00
Eduard Burtescu
096ae80b33 Don't translate vtable methods with Self: Sized bounds. 2016-06-23 03:30:01 +03:00
Alex Burka
fc28ee256a upgrade thread_local! invocation syntax
Allows declaring multiple statics in one macro invocation, and supports attaching attributes to the generated items.
2016-06-22 20:29:37 -04:00
Jeffrey Seyfried
eef8485f5f More hygiene tests 2016-06-22 22:42:26 +00:00
Oliver Middleton
f1531254af Use the correct types in float examples 2016-06-22 23:33:07 +01:00
bors
6dcc2c1dee 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
2016-06-22 13:35:12 -07:00
Alfie John
eb17527039 Switched tense to clarify what is happening in the example 2016-06-23 06:20:29 +10:00
Emilio Cobos Álvarez
b94b15852c
std: sync: Implement recv_timeout() 2016-06-22 20:48:55 +02:00
gnzlbg
483bec790b Add target_features for the bit manipulation instruction sets: BMI 1.0, BMI 2.0, and TBM. 2016-06-22 17:11:17 +02:00
gnzlbg
10cbc37cdd Add intrinsics for x86 bit manipulation instruction sets: BMI 1.0, BMI 2.0, and TBM. 2016-06-22 16:34:10 +02:00
gnzlbg
152055451c Allow different instruction set prefixes within the same architecture 2016-06-22 16:30:55 +02:00
Fabian Vogt
03f9dd21d6 Fix typo in bootstrap README
"boostrap" instead of "bootstrap"
2016-06-22 15:09:11 +02:00
Corey Farwell
64137c485a Parameters in doc comment should be formatted code-like. 2016-06-22 08:24:16 -04:00
gnzlbg
cb4f54dc04 Add usage examples to the documentation of etc/platform-intrinsics/generator.py 2016-06-22 14:20:37 +02:00
bors
e41cdabc3e Auto merge of #34408 - Manishearth:rollup, r=Manishearth
Rollup of 7 pull requests

- Successful merges: #34190, #34363, #34367, #34383, #34387, #34394, #34404
- Failed merges:
2016-06-22 04:21:59 -07:00
Manish Goregaokar
c749a3e4b5 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)
2016-06-22 09:51:09 +01:00
Manish Goregaokar
c295a1c7c2 Rollup merge of #34394 - oli-obk:const_cast_false_positive, r=eddyb
don't warn on casting byte strs to slices

r? @durka
2016-06-22 09:51:08 +01:00
Manish Goregaokar
0c94e90233 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
2016-06-22 09:51:08 +01:00
Manish Goregaokar
094032f5fc 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.
2016-06-22 09:51:08 +01:00
Manish Goregaokar
f753689115 Rollup merge of #34367 - Stebalien:issue-23281, r=sfackler
Add regression test for #23281

Closes #23281
2016-06-22 09:51:07 +01:00
Manish Goregaokar
2aaf6a0e5c 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?
2016-06-22 09:51:07 +01:00
Manish Goregaokar
e4ff7f0107 Rollup merge of #34190 - ollie27:wrapping_fmt, r=alexcrichton
Implement Binary, Octal, LowerHex and UpperHex for Wrapping<T>

Fixes: #33659
2016-06-22 09:51:06 +01:00
bors
3ee3267af3 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.
2016-06-22 01:05:56 -07:00
bors
66b82beb60 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
2016-06-21 20:52:23 -07:00
Brian Anderson
59db95b499 Convert makefiles to build LLVM/compiler-rt with CMake 2016-06-21 19:54:28 -07:00
bors
b8deebe3d6 Auto merge of #34402 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 7 pull requests

- Successful merges: #34356, #34360, #34369, #34371, #34378, #34380, #34391
- Failed merges:
2016-06-21 16:14:38 -07:00
Oliver Middleton
1cc54d0327 Mark concat_idents! unstable
This is mostly just a documentation fix as I don't think stability
attributes have any effect on macros.
2016-06-21 23:30:15 +01:00
Guillaume Gomez
0db65750bc 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
2016-06-21 23:54:29 +02:00
Guillaume Gomez
e20f49b528 Rollup merge of #34380 - sanxiyn:travis-gdb, r=alexcrichton
Run debuginfo tests on Travis
2016-06-21 23:54:29 +02:00
Guillaume Gomez
f39c4930b3 Rollup merge of #34378 - liigo:patch-10, r=Manishearth
diagnostics comes from different places now
2016-06-21 23:54:29 +02:00
Guillaume Gomez
592c314baf Rollup merge of #34371 - frewsxcv:thread-name, r=steveklabnik
Add examples for `std:🧵:Thread::name`.

None
2016-06-21 23:54:28 +02:00
Guillaume Gomez
0b566f6bec 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/.
2016-06-21 23:54:28 +02:00
Guillaume Gomez
469d17c2a8 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)
2016-06-21 23:54:28 +02:00
Guillaume Gomez
3f43b01681 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
2016-06-21 23:54:28 +02:00
Guillaume Gomez
8f987ab3f2 Add error code flags 2016-06-21 23:52:30 +02:00
Nathan Moos
2a34a7b839 implemented peek_mut and unit tests 2016-06-21 12:10:38 -07:00
Nikhil Shagrithaya
09ffe475e7 Modified E0220 to show error messages for more general cases 2016-06-21 23:52:18 +05:30
cgswords
d59accfb06 Refactored tokentrees into their own files in preparation for tokenstreams. Modified tests to point to the new file now. 2016-06-21 11:12:36 -07:00
Guillaume Gomez
c02414e9bd Fix overflow error in thread::sleep 2016-06-21 15:50:27 +02:00
bors
fe96928d7d 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
2016-06-21 02:18:42 -07:00
Oliver Schneider
0de72bba36
don't warn on casting byte strs to slices 2016-06-21 10:08:31 +02:00
Mitsunori Komatsu
45a63d3ff6 Add message argument to assert_eq macro 2016-06-21 15:14:15 +09:00
bors
45cde975cb 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
```
2016-06-20 21:04:48 -07:00
Paul Jarrett
bd477503e2 Improves organization of driver includes. 2016-06-20 22:11:45 -04:00
bors
4ba60aba38 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.
2016-06-20 15:54:17 -07:00
Oliver Middleton
ebfdd110c3 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.
2016-06-20 22:22:17 +01:00
Eduard Burtescu
7279af86c8 trans: generalize immediate temporaries to all MIR locals. 2016-06-20 23:55:14 +03:00
Vadim Petrochenkov
f903c97959 Merge PatKind::QPath into PatKind::Path in AST 2016-06-20 23:39:02 +03:00
Eduard Burtescu
bec32eb4ff trans: noop drops don't need their lvalue in an alloca. 2016-06-20 23:18:21 +03:00