Commit Graph

60261 Commits

Author SHA1 Message Date
bors
0576869085 Auto merge of #38822 - michaelwoerister:collect-fn-once-adapter, r=eddyb
trans: Fix missing closure env drop-glue in trans-item collector.

FnOnce adapters automatically generated by the compiler introduce a call to drop the closure environment. The collector didn't pick up on that because this drop call does not show up in MIR. That could lead to an assertion being triggered if the drop-glue for the environment wasn't instantiated via something else.

Fixes #38810

cc @arielb1

r? @eddyb or @nikomatsakis
2017-01-08 04:18:32 +00:00
bors
05383b2765 Auto merge of #38807 - comex:pprint-expr-attr, r=nrc
Print attributes on expressions when pretty printing.

Test case: `rustc -Z unstable-options --unpretty=hir <(echo 'fn main() { #[allow()] main() }')`
2017-01-08 02:10:26 +00:00
bors
47c8d9fdcf Auto merge of #38798 - jsgf:fix-rpath, r=nikomatsakis
rustc: use -Xlinker when specifying an rpath with ',' in it

The `-Wl` option splits its parameters on commas, so if rustc specifies
`-Wl,-rpath,<path>` when `<path>` contains commas, the path gets split up
and the linker gets a partial path and spurious extra parameters.

Gcc/clang support the more verbose `-Xlinker` option to pass options to the linker directly, so use it for comma-containing paths.

Fixes issue #38795.
2017-01-08 00:10:15 +00:00
bors
089682611f Auto merge of #38781 - SimonSapin:unishrink, r=alexcrichton
Reduce the size of static data in std_unicode::tables

`BoolTrie` works well for sets of code points spread out through most of Unicode’s range, but is uses a lot of space for sets with few, mostly low, code points.

This switches a few of its instances to a similar but simpler trie data structure.

CC @raphlinus, who wrote the original `BoolTrie`.

## Before

`size_of::<BoolTrie>()` is 1552, which is added to `table.r3.len() * 8 + t.r5.len() + t.r6.len() * 8`:

* `Cc_table`: 1632
* `White_Space_table`: 1656
* `Pattern_White_Space_table`: 1640
* Total: 4928 bytes

## After

`size_of::<SmallBoolTrie>()` is 32, which is added to `t.r1.len() + t.r2.len() * 8`:

* `Cc_table`: 51
* `White_Space_table`: 273
* `Pattern_White_Space_table`: 193
* Total: 517 bytes

## Difference

Every Rust program with `std` statically linked should be about 4 KB smaller.
2017-01-07 21:28:47 +00:00
bors
b97b605211 Auto merge of #38733 - sfackler:peek-mut-pop, r=alexcrichton
Add PeekMut::pop

A fairly common workflow is to put a bunch of stuff into a binary heap
and then mutate the top value until its empty. This both makes that a
bit more convenient (no need to save a boolean off and pop after to
avoid borrowck issues), and a bit more efficient since you only shift
once.

r? @alexcrichton

cc @rust-lang/libs
2017-01-07 19:21:49 +00:00
bors
3191886426 Auto merge of #38551 - aidanhs:aphs-vec-in-place, r=brson
Implement placement-in protocol for `Vec`

Follow-up of #32366 per comment at https://github.com/rust-lang/rust/issues/30172#issuecomment-268099009, updating to latest rust, leaving @apasel422 as author and putting myself as committer.

I've removed the implementation of `push` in terms of place to make this PR more conservative.
2017-01-07 13:02:52 +00:00
bors
e1dfe3d678 Auto merge of #38469 - tbu-:pr_writeln_no_args, r=brson
Allow `writeln!` without arguments, in symmetry with `println!`

CC #36825.
2017-01-07 10:59:46 +00:00
bors
b9637f79e2 Auto merge of #38327 - Yamakaky:into-ipaddr, r=brson
Impl From<Ipv4Addr, Ipv6Addr> for IpAddr.

Fixes https://github.com/rust-lang/rfcs/issues/1816.
2017-01-07 09:00:52 +00:00
bors
008e2393bd Auto merge of #38859 - jonathandturner:E0088_fix, r=eddyb
E0088/E0090 fix

This fixes an issue reported by @eddyb (https://github.com/rust-lang/rust/pull/36208#issuecomment-2707092230) where the check for "too few lifetime parameters" was removed in one of the error message PRs.

I also removed the span shrinking from E0088, as early bound lifetimes give you a confusing underline in some cases.

r=eddyb
2017-01-07 05:59:38 +00:00
bors
b6c97c3da6 Auto merge of #38858 - ollie27:rustbuild_docs_std, r=alexcrichton
rustbuild: Stop building docs for std dependancies

Fixes: #38319

r? @alexcrichton
2017-01-07 04:02:43 +00:00
bors
25bfc8aedc Auto merge of #38855 - Mark-Simulacrum:immediate-fix, r=eddyb
Fix ICE on i686 when calling immediate() on OperandValue::Ref in return

Fixes #38727, and adds a test case.

r? @eddyb
2017-01-07 02:01:51 +00:00
bors
7e38a89a7b Auto merge of #38835 - alexcrichton:less-overlapped, r=brson
std: Don't pass overlapped handles to processes

This commit fixes a mistake introduced in #31618 where overlapped handles were
leaked to child processes on Windows. On Windows once a handle is in overlapped
mode it should always have I/O executed with an instance of `OVERLAPPED`. Most
child processes, however, are not prepared to have their stdio handles in
overlapped mode as they don't use `OVERLAPPED` on reads/writes to the handle.

Now we haven't had any odd behavior in Rust up to this point, and the original
bug was introduced almost a year ago. I believe this is because it turns out
that if you *don't* pass an `OVERLAPPED` then the system will [supply one for
you][link]. In this case everything will go awry if you concurrently operate on
the handle. In Rust, however, the stdio handles are always locked, and there's
no way to not use them unlocked in libstd. Due to that change we've always had
synchronized access to these handles, which means that Rust programs typically
"just work".

Conversely, though, this commit fixes the test case included, which exhibits
behavior that other programs Rust spawns may attempt to execute. Namely, the
stdio handles may be concurrently used and having them in overlapped mode wreaks
havoc.

[link]: https://blogs.msdn.microsoft.com/oldnewthing/20121012-00/?p=6343

Closes #38811
2017-01-06 23:49:57 +00:00
bors
373efe8794 Auto merge of #38815 - cardoe:fix-print, r=nikomatsakis
fix help for the --print option

Since 8285ab5c99, which was merged in with #38061, the help for the
--print option is missing the surrounding [ ] around the possible
options.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
2017-01-06 21:23:51 +00:00
bors
e447b73f39 Auto merge of #38792 - jseyfried:improve_macros_11_diagnostics, r=nikomatsakis
proc macros 1.1: improve diagnostics

Fixes #38586.
r? @nrc
2017-01-06 19:23:06 +00:00
bors
a28701a928 Auto merge of #38304 - sfackler:no-ipv6only, r=alexcrichton
Deprecate TcpListener::set_only_v6

This was supposed to have been removed in #33124 but snuck through :(

Should the docs be removed?

I left the accessor undeprecated since it should actually work, though that method doesn't exist on other networking types.

r? @alexcrichton
cc @rust-lang/libs
2017-01-06 16:55:06 +00:00
bors
0728b71034 Auto merge of #38833 - arielb1:constant-mir-overflow, r=eddyb
fix promotion of MIR terminators

promotion of MIR terminators used to try to promote the destination it
is trying to promote, leading to stack overflow.

Also clean up the code in `promote_temp` a bit to make it more understandable.

Fixes #37991.

cc @nikomatsakis
r? @eddyb
2017-01-06 09:43:37 +00:00
bors
e7907a9910 Auto merge of #38793 - jseyfried:fix_macro_export_duplicates, r=nrc
Fix regression with duplicate `#[macro_export] macro_rules!`

Fixes #38715.
r? @nrc
2017-01-06 06:41:31 +00:00
Steven Fackler
eb5e9ab145 Deprecate TcpListener::set_only_v6
This was supposed to have been removed in #33124 but snuck through :(
2017-01-05 21:36:27 -08:00
Steven Fackler
54dc533494 Add a tracking issue 2017-01-05 19:36:35 -08:00
bors
6f1ae663ef Auto merge of #38069 - canndrew:empty-sub-patterns-again, r=nikomatsakis
Fix handling of empty types in patterns.

Fix for #12609.
2017-01-06 00:17:41 +00:00
Jonathan Turner
33bb4715e7 Fix tidy warning 2017-01-06 10:18:11 +11:00
Jonathan Turner
069aa30445 Add in test for E0090 2017-01-06 10:05:55 +11:00
Jonathan Turner
5ead973173 Add back in previous logic and remove span shrinking 2017-01-06 10:00:07 +11:00
Oliver Middleton
6b96ece247 rustbuild: Stop building docs for std dependancies 2017-01-05 22:26:04 +00:00
bors
42bed72385 Auto merge of #38689 - pnkfelix:dont-check-stability-on-private-items, r=nikomatsakis
Dont check stability for items that are not pub to universe.

Dont check stability for items that are not pub to universe.

In other words, skip it for private and even `pub(restricted)` items, because stability checks are only relevant to things visible in other crates.

Fix #38412.
2017-01-05 21:58:45 +00:00
Mark Simulacrum
97c008c398 Fix ICE on i686 when calling immediate() on OperandValue::Ref in return 2017-01-05 12:59:50 -07:00
bors
ea2d41e31f Auto merge of #38817 - jseyfried:improve_unused_qualification_lint, r=petrochenkov
resolve: don't `unused_qualifications`-check global paths

We started `unused_qualifications`-checking global paths in #38014, causing #38682.
Fixes #38682.
r? @nrc
2017-01-05 19:56:31 +00:00
Andrew Cann
275c19d5b6 fix doc test for E0001 2017-01-06 01:00:03 +08:00
Andrew Cann
291c84aad4 Un-remove E0001, put a notice on it instead 2017-01-05 23:48:02 +08:00
bors
74e5b7d96a Auto merge of #38152 - arielb1:special-copy, r=nikomatsakis
Fix associated types in copy implementations

Fixes an ICE and an error in checking copy implementations.

r? @nikomatsakis
2017-01-05 13:05:30 +00:00
bors
2f56207b12 Auto merge of #38776 - eddyb:unsigned-means-unsigned, r=pnkfelix
Properly ban the negation of unsigned integers in type-checking.

Lint-time banning of unsigned negation appears to be vestigial from a time it was feature-gated.
But now it always errors and we do have the ability to deref the checking of e.g. `-0`, through the trait obligation fulfillment context, which will only succeed/error when the `0` gets inferred to a specific type.

The two removed tests are the main reason for finally cleaning this up, they need changing all the time when refactoring the HIR-based `rustc_const_eval` and/or `rustc_passes::consts`, as warnings pile up.
2017-01-05 11:06:10 +00:00
bors
26e2ee00f9 Auto merge of #38767 - est31:master, r=eddyb
Some i128 tests

* Add some FFI tests for i128 on architectures where we have sort of working "C" FFI support. On all other architectures we ignore the test.
* enhance the u128 overflow tests
2017-01-05 09:02:40 +00:00
bors
5dd07b66ff Auto merge of #38756 - Mark-Simulacrum:2nd-trans-cleanup, r=eddyb
Additional cleanup to rustc_trans

Removes `BlockAndBuilder`, `FunctionContext`, and `MaybeSizedValue`.

`LvalueRef` is used instead of `MaybeSizedValue`, which has the added benefit of making functions operating on `Lvalue`s be able to take just that (since it encodes the type with an `LvalueTy`, which can carry discriminant information) instead of a `MaybeSizedValue` and a discriminant.

r? @eddyb
2017-01-05 06:01:24 +00:00
bors
80745e2a23 Auto merge of #38731 - alexcrichton:supafast-cross-dist, r=brson
rustbuild: Quickly `dist` cross-host compilers

This commit optimizes the compile time for creating tarballs of cross-host
compilers and as a proof of concept adds two to the standard Travis matrix. Much
of this commit is further refactoring and refining of the `step.rs` definitions
along with the interpretation of `--target` and `--host` flags. This has gotten
confusing enough that I've also added a small test suite to
`src/bootstrap/step.rs` to ensure what we're doing works and doesn't regress.

After this commit when you execute:

    ./x.py dist --host $MY_HOST --target $MY_HOST

the build system will compile two compilers. The first is for the build platform
and the second is for the host platform. This second compiler is then packaged
up and placed into `build/dist` and is ready to go. With a fully cached LLVM and
docker image I was able to create a cross-host compiler in around 20 minutes
locally.

Eventually we plan to add a whole litany of cross-host entries to the Travis
matrix, but for now we're just adding a few before we eat up all the extra
capacity.

cc #38531
2017-01-05 04:01:35 +00:00
bors
5d994d8b7e Auto merge of #38770 - steveklabnik:doc-custom-derive, r=alexcrichton
Document custom derive.

These are some bare-bones documentation for custom derive, needed
to stabilize "macros 1.1",
https://github.com/rust-lang/rust/issues/35900

The book chapter is based off of a blog post by @cbreeden,
https://cbreeden.github.io/Macros11/

Normally, we have a policy of not mentioning external crates in
documentation. However, given that syn/quote are basically neccesary
for properly using macros 1.1, I feel that not including them here
would make the documentation very bad. So the rules should be bent
in this instance.

So far, this PR includes only docs; @alexcrichton said in https://github.com/rust-lang/rust/issues/35900 that he'd be okay with landing them before stabilization; I don't mind either way.
2017-01-05 00:11:37 +00:00
Alex Crichton
5148918db6 std: Don't pass overlapped handles to processes
This commit fixes a mistake introduced in #31618 where overlapped handles were
leaked to child processes on Windows. On Windows once a handle is in overlapped
mode it should always have I/O executed with an instance of `OVERLAPPED`. Most
child processes, however, are not prepared to have their stdio handles in
overlapped mode as they don't use `OVERLAPPED` on reads/writes to the handle.

Now we haven't had any odd behavior in Rust up to this point, and the original
bug was introduced almost a year ago. I believe this is because it turns out
that if you *don't* pass an `OVERLAPPED` then the system will [supply one for
you][link]. In this case everything will go awry if you concurrently operate on
the handle. In Rust, however, the stdio handles are always locked, and there's
no way to not use them unlocked in libstd. Due to that change we've always had
synchronized access to these handles, which means that Rust programs typically
"just work".

Conversely, though, this commit fixes the test case included, which exhibits
behavior that other programs Rust spawns may attempt to execute. Namely, the
stdio handles may be concurrently used and having them in overlapped mode wreaks
havoc.

[link]: https://blogs.msdn.microsoft.com/oldnewthing/20121012-00/?p=6343

Closes #38811
2017-01-04 15:37:12 -08:00
Ariel Ben-Yehuda
99aa48de29 fix promotion of MIR terminators
promotion of MIR terminators used to try to promote the destination it
is trying to promote, leading to stack overflow.

Fixes #37991.
2017-01-05 01:19:54 +02:00
Steve Klabnik
3075c1f65e Document custom derive.
These are some bare-bones documentation for custom derive, needed
to stabilize "macros 1.1",
https://github.com/rust-lang/rust/issues/35900

The book chapter is based off of a blog post by @cbreeden,
https://cbreeden.github.io/Macros11/

Normally, we have a policy of not mentioning external crates in
documentation. However, given that syn/quote are basically neccesary
for properly using macros 1.1, I feel that not including them here
would make the documentation very bad. So the rules should be bent
in this instance.
2017-01-04 17:34:30 -05:00
Michael Woerister
8b94267a8c trans: Make the trans-item collector see through VTableFnPointer. 2017-01-04 16:54:37 -05:00
bors
95b14a3b50 Auto merge of #38783 - alexcrichton:stabilize-proc-macro, r=nikomatsakis
rustc: Stabilize the `proc_macro` feature

This commit stabilizes the `proc_macro` and `proc_macro_lib` features in the
compiler to stabilize the "Macros 1.1" feature of the language. Many more
details can be found on the tracking issue, #35900.

Closes #35900
2017-01-04 20:06:21 +00:00
Alex Crichton
1a040b36cb rustbuild: Quickly dist cross-host compilers
This commit optimizes the compile time for creating tarballs of cross-host
compilers and as a proof of concept adds two to the standard Travis matrix. Much
of this commit is further refactoring and refining of the `step.rs` definitions
along with the interpretation of `--target` and `--host` flags. This has gotten
confusing enough that I've also added a small test suite to
`src/bootstrap/step.rs` to ensure what we're doing works and doesn't regress.

After this commit when you execute:

    ./x.py dist --host $MY_HOST --target $MY_HOST

the build system will compile two compilers. The first is for the build platform
and the second is for the host platform. This second compiler is then packaged
up and placed into `build/dist` and is ready to go. With a fully cached LLVM and
docker image I was able to create a cross-host compiler in around 20 minutes
locally.

Eventually we plan to add a whole litany of cross-host entries to the Travis
matrix, but for now we're just adding a few before we eat up all the extra
capacity.

cc #38531
2017-01-04 11:41:16 -08:00
Mark Simulacrum
b01b6e1d56 Fix errors introduced during rebase 2017-01-04 11:47:43 -07:00
Mark Simulacrum
21f86ba1bc Simplify handling of dropping structs. 2017-01-04 11:38:11 -07:00
Mark Simulacrum
7dadd14d6c Pull out downcasting into caller of iter_variant
Renames iter_variant to iter_variant_fields to more clearly communicate
the purpose of the function.
2017-01-04 11:38:11 -07:00
Mark Simulacrum
d25fc9ec5f Remove extraneous setting of builder positions. 2017-01-04 11:38:11 -07:00
Mark Simulacrum
ca328e1bb4 Simplify code further 2017-01-04 11:38:11 -07:00
Mark Simulacrum
c3fe2590f5 Inline and remove Builder::entry_block 2017-01-04 11:38:10 -07:00
Mark Simulacrum
ba37c91831 Fix style nit 2017-01-04 11:38:10 -07:00
Mark Simulacrum
901984e1d1 Builder.build_new_block -> Builder.build_sibling_block 2017-01-04 11:38:10 -07:00
Mark Simulacrum
81e8137b0d Inline trans_switch to simplify code 2017-01-04 11:38:10 -07:00