Commit Graph

56752 Commits

Author SHA1 Message Date
Andrew Cann
7c8f5457d2 Undo unnecessary bookkeeping from last commit 2016-09-05 12:28:52 +08:00
Andrew Cann
180534f398 Remove use of expr_ty from coercions code 2016-09-05 12:28:52 +08:00
Andrew Cann
bd661481e7 Move write_ty to the bottom of check_pat 2016-09-05 12:28:52 +08:00
Andrew Cann
1749fda9c0 Factor write_ty out of more pattern-checking functions 2016-09-05 12:28:52 +08:00
Andrew Cann
c5ff28cd14 Factor write_ty out of pattern-matching functions 2016-09-05 12:26:41 +08:00
Andrew Cann
8c6086a0a3 check_block_with_expected returns the checked type 2016-09-05 12:26:41 +08:00
Andrew Cann
f54c47d34b Move check_expr match block into its own method 2016-09-05 12:26:41 +08:00
Andrew Cann
f120c71775 Tidy. Rename variables. 2016-09-05 12:26:41 +08:00
Andrew Cann
1c3e8b0a1c Tidy 2016-09-05 12:26:41 +08:00
Andrew Cann
adb19ff277 Add AdjustNeverToAny in check_expr 2016-09-05 12:26:41 +08:00
Andrew Cann
9cd8d7a24f Factor write_ty out of function checking functions 2016-09-05 12:26:41 +08:00
Andrew Cann
21720641dc Factor write_ty out of check_expr_closure 2016-09-05 12:26:41 +08:00
Andrew Cann
144b8cf5db Factor write_ty out of check_struct_expr 2016-09-05 12:26:41 +08:00
Andrew Cann
f22dd2e2d9 Factor write_ty out of field/indexing methods 2016-09-05 12:26:41 +08:00
Andrew Cann
91b39b5e65 Factor write_ty out of more checking functions 2016-09-05 12:19:07 +08:00
Andrew Cann
06ad8fe261 Factor write_ty out of check_binop* 2016-09-05 12:19:07 +08:00
Andrew Cann
c7ea3e8d13 Remove redundant error checking around ExprMethodCall 2016-09-05 12:19:07 +08:00
Andrew Cann
b93435fd79 Remove most uses of expr_ty 2016-09-05 12:19:07 +08:00
Andrew Cann
0ddf060b6d Make write_ty and friends return adjusted type 2016-09-05 12:19:07 +08:00
Andrew Paseltiner
e4784fc313
Remove mention of unsafe_no_drop_flag from Reference and Nomicon 2016-09-04 22:57:27 -04:00
bors
86995dc8c5 Auto merge of #36240 - leeopop:master, r=jseyfried
Allow CompilerControllers to access rustc_plugin::registry::Registry

fixes #36064

I chose to put ructc_plugin::registry::Registry structure
into CompilerState structure, instead of Session structure.
This will preserve dependencies among librustc, libructc_driver, and libructc_plugin.

@jseyfried @sanxiyn
2016-09-04 18:36:42 -07:00
Matt Ickstadt
b9a8c1a063 Fix incorrect LLVM Linkage enum
The `Linkage` enum in librustc_llvm got out of sync with the version in LLVM and it caused two variants of the #[linkage=""] attribute to break.

This adds the functions `LLVMRustGetLinkage` and `LLVMRustSetLinkage` which convert between the Rust Linkage enum and the LLVM one, which should stop this from breaking every time LLVM changes it.

Fixes #33992
2016-09-04 16:12:01 -05:00
bors
91f057de35 Auto merge of #36203 - petrochenkov:uvsdot, r=nrc
Replace `_, _` with `..` in patterns

This is how https://github.com/rust-lang/rust/issues/33627 looks in action.

Looks especially nice in leftmost/rightmost positions `(first, ..)`/`(.., last)`.
I haven't touched libsyntax intentionally because the feature is still unstable.
2016-09-04 14:03:01 -07:00
Cobrand
1aa777b51f Updated E0559 to new format
Refactored a method that printed one suggested field name,
into a method that returns an `Option` of a suggestion

Updated test cases accordingly
2016-09-04 22:21:32 +02:00
bors
9cc430d2cf Auto merge of #36144 - japaric:rustbuild-musl, r=alexcrichton
rustbuild: fix building std for musl targets

closes #36143

r? @alexcrichton
2016-09-04 10:22:26 -07:00
Andrew Paseltiner
8d3fd03855
Clean up thread-local storage docs
`std` no longer contains an implementation of scoped TLS.
2016-09-04 10:16:25 -04:00
bors
987b47549e Auto merge of #36255 - Manishearth:rollup, r=Manishearth
Rollup of 7 pull requests

- Successful merges: #36070, #36132, #36200, #36212, #36225, #36231, #36234
- Failed merges:
2016-09-04 06:06:37 -07:00
Manish Goregaokar
55893f0da7 Rollup merge of #36234 - durka:disable-codegen-config, r=alexcrichton
rustbuild: add config.toml option to disable codegen tests

Fixes #36232.

I think it worked? Here's a build log where I tried to bootstrap, it crashed, then I added the setting to config.toml and it continued: https://gist.github.com/durka/cbf97cf04b8e065f1a2cfda4c1b6bf95

r? @alexcrichton
2016-09-04 21:01:00 +08:00
Manish Goregaokar
8ee0b6b6c1 Rollup merge of #36231 - durka:patch-29, r=alexcrichton
indicate where to copy config.toml.example

r? @alexcrichton
2016-09-04 21:01:00 +08:00
Manish Goregaokar
eac0ebe35a Rollup merge of #36225 - johnthagen:fix-nightly-docs, r=steveklabnik
Update nightly docs supported Windows versions to match Getting Started page

https://doc.rust-lang.org/book/getting-started.html#tier-1 shows that Windows 7+ is officially supported (implying, for example Windows 10), but the nightly page only listed 7, 8, and Server 2008 R2).
2016-09-04 21:01:00 +08:00
Manish Goregaokar
43440a4a6e Rollup merge of #36212 - razielgn:updated-e0493-to-new-format, r=jonathandturner
Updated e0493 to new format (+ bonus).

Part of #35233.
Fixes #35999.

r? @jonathandturner

I'm not satisfied with the bonus part, there has to be an easier way to reach into the `Drop`'s span implementation. I'm all ears. :)
2016-09-04 21:00:59 +08:00
Manish Goregaokar
8d64649982 Rollup merge of #36132 - nrc:save-std, r=@eddyb
Add --Zsave-analysis-api

This is a save-analysis variation which can be used with libraries distributed without their source (e.g., libstd). It will allow IDEs and other tools to get info about types and create URLs to docs and source, without the unnecessary clutter of internal-only save-analysis info. I'm sure we'll iterate somewhat on the design, but this is a first draft.
2016-09-04 18:02:53 +08:00
Manish Goregaokar
4b889154e1 Rollup merge of #36070 - gavinb:master, r=jonathandturner
Update error format for E0458, E0459

Fixes #35933, #35932
Part of #35233

r? @jonathandturner
2016-09-04 18:02:53 +08:00
bors
e77d86c142 Auto merge of #36132 - nrc:save-std, r=@eddyb
Add --Zsave-analysis-api

This is a save-analysis variation which can be used with libraries distributed without their source (e.g., libstd). It will allow IDEs and other tools to get info about types and create URLs to docs and source, without the unnecessary clutter of internal-only save-analysis info. I'm sure we'll iterate somewhat on the design, but this is a first draft.
2016-09-04 02:40:31 -07:00
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
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
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
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