Commit Graph

57083 Commits

Author SHA1 Message Date
Vadim Petrochenkov
e05e74ac83 Replace _, _ with .. 2016-09-04 12:30:33 +03:00
Vadim Petrochenkov
6f7e51e49b Replace _, _, _ with .. 2016-09-04 12:27:01 +03:00
bors
b7d19899de Auto merge of #36034 - ahmedcharles:orbit, r=eddyb
Remove --{enable|disable}-orbit from configure.

Fixes #35956.

r? @eddyb

There are only two buildbots left, though they are both failing. Is there something to be done there other than wait?
2016-09-03 23:24:32 -07:00
Keunhong Lee
ca5dfd0c97 Allow CompilerControllers to access rustc_plugin::registry::Registry structure. 2016-09-04 03:22:56 +00:00
Jake Goldsborough
b66410043a adding a check to bootstrap script
and a check to the rust config script
2016-09-03 20:22:12 -07:00
bors
1ca1de6b26 Auto merge of #36124 - eddyb:fast-array-init, r=alexcrichton
Fix optimization regressions for operations on [x; n]-initialized arrays.

Fixes #35662 by using `!=` instead of `<` as the stop condition for `[x; n]` initialization loops.
Also included is cc2009f02d, a hack to run the GVN pass twice, another time after InstCombine.
This hack results in removal of redundant `memset` and `memcpy` calls (from loops over arrays).

cc @nrc Can we get performance numbers on this? Not sure if it regresses anything else.
2016-09-03 17:41:08 -07:00
Guillaume Gomez
1eda14e4c9 E0060 and E0061 improvement 2016-09-04 01:34:11 +02:00
ggomez
7c53eb97df Add librustc metadata error codes to global check 2016-09-04 01:32:30 +02:00
Josh Triplett
fe8438d4a2 Fix "field is never used" warning to take unions into account
Rather than saying "struct or union" or adding logic to determine the
type of the item, just change the message to "field is never used",
dropping the "struct".

Update tests accordingly.
2016-09-03 15:29:16 -07:00
bors
70598e04f9 Auto merge of #36119 - arielb1:ctp-again, r=eddyb
fix broken type parameter indexing logic in wfcheck

r? @eddyb

Fixes #36075
2016-09-03 14:31:42 -07:00
Corey Farwell
5652b62a6b Indicate where core::result::IntoIter is created. 2016-09-03 16:56:22 -04:00
bors
49e9bfdbf2 Auto merge of #36104 - KiChjang:issue-35847, r=brson
Fix illegal instruction caused by overflow in channel cloning

Fixes #35847.

r? @alexcrichton
2016-09-03 11:24:01 -07:00
Alex Crichton
4ec715becf Add back feature accidentally removed
This feature was accidentally removed in
https://github.com/rust-lang/rust/pull/35957.
2016-09-03 10:23:40 -07:00
bors
d748fa6ecc Auto merge of #36016 - petrochenkov:union, r=nikomatsakis
Implement untagged unions (RFC 1444)

cc https://github.com/rust-lang/rust/issues/32836

Notes:
- The RFC doesn't talk about `#[packed]` unions, this implementation supports them, packing changes union's alignment to 1 and removes trailing padding.
- The RFC doesn't talk about dynamically sized unions, this implementation doesn't support them and rejects them during wf-checking (similarly, dynamically sized enums are not supported as well).
- The lint for drop fields in unions can't work precisely before monomorphization, so it works pessimistically - non-`Copy` generic fields are reported, types not implementing `Drop` directly, but having non-trivial drop code are reported.

    ```
    struct S(String); // Doesn't implement `Drop`
    union U<T> {
        a: S, // Reported
        b: T, // Reported
    }
    ```

- https://github.com/rust-lang/rust/pull/35764 was indeed helpful and landed timely, I didn't have to implement internal drop flags for unions.
- Unions are not permitted in constant patterns, because matching on union fields is unsafe, I didn't want unsafety checker to dig into all constants to uncover this possible unsafety.
- The RFC doesn't talk about `#[derive]`, generally trait impls cannot be derived for unions, but some of them can. I implemented only `#[derive(Copy)]` so far. In theory shallow `#[derive(Clone)]` can be derived as well if all union fields are `Copy`, I left it for later though, it requires changing how `Clone` impls are generated.
- Moving union fields is implemented as per https://github.com/rust-lang/rust/issues/32836#issuecomment-242511491.
- Testing strategy: union specific behavior is tested, sometimes very basically (e.g. debuginfo), behavior common for all ADTs (e.g. something like coherence
checks) is not generally tested.

r? @eddyb
2016-09-03 07:48:06 -07:00
Guillaume Gomez
216cf9c124 Add missing urls 2016-09-03 16:15:22 +02:00
Joseph Dunne
72da8b82c1 Add rustc version info (git hash + date) to dist tarball
fixes #32444
2016-09-03 13:34:21 +01:00
Sébastien Marie
92aa7e4252 Use libraries from local-rust-root directory in configure when using --enable-local-rebuild
When using --enable-local-rebuild configure options, the configure
script will test rustc version. But when running it, it will not use the
libraries in the local-rust-root directory.

So use `LD_LIBRARY_PATH` environment variable to correct it.
2016-09-03 14:10:41 +02:00
bors
01b35d82e5 Auto merge of #36072 - arthurprs:binary_heap_opt, r=Aatch
Optimize BinaryHeap bounds checking

I was experimenting with d-ary binary heaps during the weekend (dead end) and I found that we could get some good improvements by removing bounds checking. Specially due to the panic-safe additional code, llvm can't really optimize them out.

```
 name                         d_ary_heap:: ns/iter  std___heap:: ns/iter  diff ns/iter  diff %
 bench_build_insert           148,610               236,960                     88,350  59.45%
 bench_from_vec               243,846               299,719                     55,873  22.91%
 bench_insert_2000_empty      4,512                 7,517                        3,005  66.60%
 bench_insert_2000_prefilled  28,665                32,605                       3,940  13.74%
 bench_pop_2000               111,515               128,005                     16,490  14.79%
 bench_pop_all                2,759,945             3,317,626                  557,681  20.21%
 peek_mut                     23,186                23,635                         449   1.94%
 pop_modify_push              41,573                43,822                       2,249   5.41%

test d_ary_heap::bench_build_insert          ... bench:     148,610 ns/iter (+/- 10,687)
test d_ary_heap::bench_from_vec              ... bench:     243,846 ns/iter (+/- 16,500)
test d_ary_heap::bench_insert_2000_empty     ... bench:       4,512 ns/iter (+/- 136)
test d_ary_heap::bench_insert_2000_prefilled ... bench:      28,665 ns/iter (+/- 1,347)
test d_ary_heap::bench_pop_2000              ... bench:     111,515 ns/iter (+/- 104,677)
test d_ary_heap::bench_pop_all               ... bench:   2,759,945 ns/iter (+/- 173,838)
test d_ary_heap::peek_mut                    ... bench:      23,186 ns/iter (+/- 106,254)
test d_ary_heap::pop_modify_push             ... bench:      41,573 ns/iter (+/- 3,313)
test std___heap::bench_build_insert          ... bench:     236,960 ns/iter (+/- 16,955)
test std___heap::bench_from_vec              ... bench:     299,719 ns/iter (+/- 6,354)
test std___heap::bench_insert_2000_empty     ... bench:       7,517 ns/iter (+/- 372)
test std___heap::bench_insert_2000_prefilled ... bench:      32,605 ns/iter (+/- 2,433)
test std___heap::bench_pop_2000              ... bench:     128,005 ns/iter (+/- 11,787)
test std___heap::bench_pop_all               ... bench:   3,317,626 ns/iter (+/- 238,968)
test std___heap::peek_mut                    ... bench:      23,635 ns/iter (+/- 1,420)
test std___heap::pop_modify_push             ... bench:      43,822 ns/iter (+/- 3,788)
```

Test code: https://github.com/arthurprs/heap-experiments
2016-09-03 04:40:38 -07:00
Cobrand
9d9c029a66 doc: Contributing.md: mention of make tidy 2016-09-03 12:51:16 +02:00
Vadim Petrochenkov
436cfe5653 Fix type encoding/decoding for unions
Fix union debuginfo test on lldb
2016-09-03 13:39:35 +03:00
Vadim Petrochenkov
93067ca089 Address comments and add requested tests 2016-09-03 13:39:35 +03:00
Vadim Petrochenkov
e67c2282af Fix rebase, fix some tests 2016-09-03 13:39:35 +03:00
Vadim Petrochenkov
5f975e969b Support unions in borrow checker
Add some more tests
2016-09-03 13:39:35 +03:00
Vadim Petrochenkov
59ccb7b6db Support deriving some traits for unions 2016-09-03 13:39:35 +03:00
Vadim Petrochenkov
079c390d50 Generate debuginfo for unions 2016-09-03 13:39:35 +03:00
Vadim Petrochenkov
d9b332bd69 Translate union constants
Fix alignment for packed unions
Add some missing privacy test
Get rid of `unimplemented_unions` macro
2016-09-03 13:39:35 +03:00
Vadim Petrochenkov
2dc2fc5fc5 Fix rebase 2016-09-03 13:39:35 +03:00
Vadim Petrochenkov
0cb19389b0 Fix buggy field access translation 2016-09-03 13:39:34 +03:00
Vadim Petrochenkov
bea0b15935 Implement drop translation and add lint for unions with drop fields
Fix some typeck bugs blocking drop tests
2016-09-03 13:39:34 +03:00
Vadim Petrochenkov
e88d4ca0e1 Make accesses to union fields unsafe 2016-09-03 13:39:34 +03:00
Vadim Petrochenkov
f3b41c18a8 Check fields in union patters/expressions
Make parsing of union items backward compatible
Add some tests
2016-09-03 13:39:34 +03:00
Vadim Petrochenkov
957971b63a Implement layout calculation and add more trans stubs 2016-09-03 13:39:34 +03:00
Vadim Petrochenkov
c2ca1530db Fix rebase + address comments 2016-09-03 13:39:34 +03:00
Vadim Petrochenkov
5f9ef3c8b2 Implement encoding/decoding unions in metadata
Add well-formedness check
Implement some more missing code
2016-09-03 13:39:34 +03:00
Vadim Petrochenkov
6792bd99fe Support unions in rustdoc 2016-09-03 13:39:34 +03:00
Vadim Petrochenkov
641d8e9e4c Some better support for unions through the compiler 2016-09-03 13:39:34 +03:00
Vadim Petrochenkov
a014323e45 Lower unions from AST to HIR and from HIR to types
Parse union items and add a feature for them
2016-09-03 13:39:33 +03:00
Vadim Petrochenkov
cbd912baba Add union types 2016-09-03 13:37:25 +03:00
Vadim Petrochenkov
35d52a003b Add unions to definition map 2016-09-03 13:37:25 +03:00
Vadim Petrochenkov
4001c039de Add unions to HIR 2016-09-03 13:37:25 +03:00
Vadim Petrochenkov
1db878fd38 Add unions to AST 2016-09-03 13:37:25 +03:00
bors
a029ea343f Auto merge of #35957 - alexcrichton:macros-1.1, r=nrc
rustc: Implement custom derive (macros 1.1)

This commit is an implementation of [RFC 1681] which adds support to the
compiler for first-class user-define custom `#[derive]` modes with a far more
stable API than plugins have today.

[RFC 1681]: https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md

The main features added by this commit are:

* A new `rustc-macro` crate-type. This crate type represents one which will
  provide custom `derive` implementations and perhaps eventually flower into the
  implementation of macros 2.0 as well.

* A new `rustc_macro` crate in the standard distribution. This crate will
  provide the runtime interface between macro crates and the compiler. The API
  here is particularly conservative right now but has quite a bit of room to
  expand into any manner of APIs required by macro authors.

* The ability to load new derive modes through the `#[macro_use]` annotations on
  other crates.

All support added here is gated behind the `rustc_macro` feature gate, both for
the library support (the `rustc_macro` crate) as well as the language features.

There are a few minor differences from the implementation outlined in the RFC,
such as the `rustc_macro` crate being available as a dylib and all symbols are
`dlsym`'d directly instead of having a shim compiled. These should only affect
the implementation, however, not the public interface.

This commit also ended up touching a lot of code related to `#[derive]`, making
a few notable changes:

* Recognized derive attributes are no longer desugared to `derive_Foo`. Wasn't
  sure how to keep this behavior and *not* expose it to custom derive.

* Derive attributes no longer have access to unstable features by default, they
  have to opt in on a granular level.

* The `derive(Copy,Clone)` optimization is now done through another "obscure
  attribute" which is just intended to ferry along in the compiler that such an
  optimization is possible. The `derive(PartialEq,Eq)` optimization was also
  updated to do something similar.

---

One part of this PR which needs to be improved before stabilizing are the errors
and exact interfaces here. The error messages are relatively poor quality and
there are surprising spects of this such as `#[derive(PartialEq, Eq, MyTrait)]`
not working by default. The custom attributes added by the compiler end up
becoming unstable again when going through a custom impl.

Hopefully though this is enough to start allowing experimentation on crates.io!
2016-09-03 00:11:18 -07:00
Alex Burka
0efc4bf387 rustbuild: add config.toml option to disable codegen tests 2016-09-03 06:04:03 +00:00
Alex Burka
a34485ff19 change wording 2016-09-03 02:02:03 -04:00
bors
d128e6bc74 Auto merge of #35856 - phimuemue:master, r=brson
Introduce max_by/min_by on iterators

See https://github.com/rust-lang/rfcs/issues/1722 for reference.

It seems that there is `min`, `max` (simple computation of min/max), `min_by_key`, `max_by_key` (min/max by comparing mapped values) but no `min_by` and `max_by` (min/max according to comparison function). However, e.g. on vectors or slices there is `sort`, `sort_by_key` and `sort_by`.
2016-09-02 21:02:41 -07:00
bors
100b309fd1 Auto merge of #36227 - jonathandturner:rollup, r=jonathandturner
Rollup of 12 pull requests

- Successful merges: #35754, #35793, #36099, #36160, #36171, #36178, #36180, #36190, #36198, #36205, #36210, #36223
- Failed merges:
2016-09-02 17:44:38 -07:00
Alex Burka
63520c1089 indicate where to copy config.toml.example 2016-09-02 19:54:02 -04:00
Jonathan Turner
c70149004a Rollup merge of #36223 - abhiQmar:e0558-formatting, r=jonathandturner
Update compiler error E0558 to use new error format

Fixes #36196 part of #35233

r? @jonathandturner
2016-09-02 15:28:52 -07:00
Jonathan Turner
5284bee03a Rollup merge of #36210 - EugeneGonzalez:E0529, r=jonathandturner
Fixed E0529's label and unit test

Fixes #36195 part of #35233.

This is ready for review, but will likely fail Travis due to #36138. I changed the wording of the label, so feedback on that would be appreciated.

r? @jonathandturner
2016-09-02 15:28:52 -07:00
Jonathan Turner
6736bad424 Rollup merge of #36205 - EugeneGonzalez:E0528, r=jonathandturner
Fixed E0528 label and unit test

Fixes #36194 part of #35233.

r? @jonathandturner
2016-09-02 15:28:52 -07:00