Commit Graph

54681 Commits

Author SHA1 Message Date
bors 7323ac4add Auto merge of #34728 - michaelwoerister:issue34569, r=luqmana
trans: Make sure that closures only get translated once.

Fixes #34569.
2016-07-09 09:17:35 -07:00
Michael Woerister b732cf46f8 trans: Make sure that closures only get translated once. 2016-07-09 12:15:34 -04:00
bors 459b1a4fbb Auto merge of #34709 - GuillaumeGomez:primitives, r=steveklabnik
Improve primitive integers documentation

Fixes #29335.

r? @steveklabnik
2016-07-09 06:18:55 -07:00
bors a4327d99dd Auto merge of #33987 - crlf0710:patch-1, r=steveklabnik
doc: Correct char::escape_unicode documentation.

A quick fix for documentation.
2016-07-09 02:43:56 -07:00
bors 24d51f9b21 Auto merge of #34719 - glandium:issue34674, r=alexcrichton
Update jemalloc to include a fix for startup issues on OSX 10.12

This fixes jemalloc/jemalloc#140 in the version used by the rust compiler.

Fixes #34674
2016-07-08 23:23:22 -07:00
bors fdca8c2fbd Auto merge of #34700 - inejge:ai-hints, r=alexcrichton
Use hints with getaddrinfo() in std::net::lookup_host()

As noted in #24250, `std::net::lookup_host()` repeats each IPv[46] address in the result set. The number of repetitions is OS-dependent; e.g., Linux and FreeBSD give three copies, OpenBSD gives two. Filtering the duplicates can be done by the user if `lookup_host()` is used explicitly, but not with functions like `TcpStream::connect()`. What happens with the latter is that any unsuccessful connection attempt will be repeated as many times as there are duplicates of the address.

The program:

```rust
use std::net::TcpStream;

fn main() {
    let _stream = TcpStream::connect("localhost:4444").unwrap();
}
```

results in the following capture:

[capture-before.txt](https://github.com/rust-lang/rust/files/352004/capture-before.txt)

assuming that "localhost" resolves both to ::1 and 127.0.0.1, and that the listening program opens just an IPv4 socket (e.g., `nc -l 127.0.0.1 4444`.) The reason for this behavior is explained in [this comment](https://github.com/rust-lang/rust/issues/24250#issuecomment-92240152): `getaddrinfo()` is not constrained.

Various OSS projects (I checked out Postfix, OpenLDAP, Apache HTTPD and BIND) which use `getaddrinfo()` generally constrain the result set by using a non-NULL `hints` parameter and setting at least `ai_socktype` to `SOCK_STREAM`. `SOCK_DGRAM` would also work. Other parameters are unnecessary for pure name resolution.

The patch in this PR initializes a `hints` struct and passes it to `getaddrinfo()`, which eliminates the duplicates. The same test program as above with this change produces:

[capture-after.txt](https://github.com/rust-lang/rust/files/352042/capture-after.txt)

All `libstd` tests pass with this patch.
2016-07-08 19:07:45 -07:00
bors 5e18b4bad8 Auto merge of #34690 - alexcrichton:clarify-vcvars, r=brson
Clarify rustbuild + msvc + vcvars in README

The invocation of vcvars is only needed for versions of Visual Studio that
rustbuild or cmake doesn't understand, but if older versions are installed then
there's no need to call vcvars.

Closes #34576
2016-07-08 15:00:09 -07:00
Guillaume Gomez a6bbd0c1ca Improve primitive integers documentation 2016-07-08 23:03:17 +02:00
bors d11936251a Auto merge of #33890 - michaelwoerister:collector-driven-trans, r=eddyb
Drive trans from the output of the translation item collector

This PR changes the way how translation works above the item level. Instead of walking the HIR and calling `trans_item()` on everything encountered (while instantiating monomorphizations on-demand), we now just process the list of translation items generated by the `trans::collector`. Using the collector has the benefit of being able to know the exact set of monomorphizations and symbols before actually running translation, something that is crucial for incremental compilation (but also has [other benefits](https://github.com/rust-lang/rust/pull/33602)).

The collector has existed for quite a while now, but so far it's output was only used for running some auto-tests. With this PR it becomes the only source of truth about what gets translated.

One modification we had to make, compared to the initial approach, is that closures are not represented as their own `TransItems`. Doing so, while still supporting non-MIR-based translation, would have been prohibitively complex, and not worth the trouble since legacy-trans will disappear sooner or later. Once there is solely MIR-trans, it would be a good idea to make closures `TransItems` again.

This PR removes the most obvious functions and tables that are not needed anymore, but there's definitely still more cleanup possible later on (e.g. `monomorphize::monomorphic_fn()` does very little at this point). Since there are already more than 10 commits in here, doing this in a separate PR seems to be a better idea.

These changes definitely warrant a crater run.

Thanks @Aatch, for taking on one of the more tedious tasks during the dev-sprint!
Thanks @eddyb, for doing some nice refactorings to symbol name generation and making sure these landed so I could use them!

cc @rust-lang/compiler
cc @rust-lang/tools
2016-07-08 08:34:36 -07:00
Michael Woerister 1c03bfe3b4 trans: Adjust linkage assignment so that we don't need weak linkage. 2016-07-08 10:42:48 -04:00
Michael Woerister 051d391f2d Update LLVM. 2016-07-08 10:42:48 -04:00
Michael Woerister ac80d41175 trans: Remove tracking of translation item state.
The data tracked here was meant to compare the output of the
translation item collector to the set of translation items found
by the on-demand translator.
2016-07-08 10:42:48 -04:00
Michael Woerister b149b9d19b trans: Set COMDAT section for weak symbols so that Windows can handle them. 2016-07-08 10:42:48 -04:00
Michael Woerister 4c27a3c6d5 trans: Enable falling back to on-demand instantiation for drop-glue and monomorphizations.
See issue #34151 for more information.
2016-07-08 10:42:48 -04:00
Michael Woerister a7bc0b920f trans: Add missing normalize_associated_type() call to callee::get_fn(). 2016-07-08 10:42:48 -04:00
Michael Woerister 4a3f9b8962 hir-trans: Don't generate code for unreachable operands in short-circuiting logical operations. 2016-07-08 10:42:48 -04:00
Michael Woerister b33240e2cc trans::collector: Also consider initializers of const items. 2016-07-08 10:42:48 -04:00
Michael Woerister ab80f74670 collector-driven-trans: Take care of nits. 2016-07-08 10:42:47 -04:00
Michael Woerister 00226fc0c8 Pacify make tidy. 2016-07-08 10:42:47 -04:00
Michael Woerister 3a47103f1d Fix codegen tests by make sure items are translated in AST order. 2016-07-08 10:42:47 -04:00
Michael Woerister 283c94cd49 Clean up trans::trans_crate() after making things collector driven. 2016-07-08 10:42:47 -04:00
Michael Woerister 37a10ecbe8 Make item translation order deterministic by sorting by symbol name. 2016-07-08 10:42:47 -04:00
Michael Woerister b38e0d0d44 Build SymbolMap for symbol name conflict checking and caching. 2016-07-08 10:42:47 -04:00
Michael Woerister 87c1c87dd7 Make drop-glue translation collector-driven. 2016-07-08 10:42:47 -04:00
Michael Woerister 6c8c94b848 Improve linkage assignment in trans::partitioning. 2016-07-08 10:42:47 -04:00
Michael Woerister 65e8a13441 Adapt backend to trans::partitioning dictating the codegen-unit setup. 2016-07-08 10:42:46 -04:00
Michael Woerister 2cd8cf92fc Ignore closure-related translation item collection tests. 2016-07-08 10:42:46 -04:00
Michael Woerister 5f3fefc77d trans: Get rid of the last potential on-demand creation of non-closure functions. 2016-07-08 10:42:46 -04:00
James Miller 6717106947 Drive function item translation from collector
Functions and method are declared ahead-of-time, including generic ones.

Closures are not considered trans items anymore, instead they are
translated on demands.
2016-07-08 10:42:38 -04:00
Michael Woerister 891c2a082f trans: Make translation of statics collector-driven. 2016-07-08 09:37:23 -04:00
bors e7751e436b Auto merge of #34720 - Manishearth:rollup, r=Manishearth
Rollup of 9 pull requests

- Successful merges: #34097, #34456, #34610, #34612, #34659, #34688, #34691, #34699, #34700
- Failed merges:
2016-07-08 05:24:43 -07:00
Ivan Nejgebauer 66bf1092a5 Add test for std::net::lookup_host() duplicates 2016-07-08 13:48:46 +02:00
Manish Goregaokar 5389ccc0c1 Rollup merge of #34700 - inejge:ai-hints, r=alexcrichton
Use hints with getaddrinfo() in std::net::lookup_host()

As noted in #24250, `std::net::lookup_host()` repeats each IPv[46] address in the result set. The number of repetitions is OS-dependent; e.g., Linux and FreeBSD give three copies, OpenBSD gives two. Filtering the duplicates can be done by the user if `lookup_host()` is used explicitly, but not with functions like `TcpStream::connect()`. What happens with the latter is that any unsuccessful connection attempt will be repeated as many times as there are duplicates of the address.

The program:

```rust
use std::net::TcpStream;

fn main() {
    let _stream = TcpStream::connect("localhost:4444").unwrap();
}
```

results in the following capture:

[capture-before.txt](https://github.com/rust-lang/rust/files/352004/capture-before.txt)

assuming that "localhost" resolves both to ::1 and 127.0.0.1, and that the listening program opens just an IPv4 socket (e.g., `nc -l 127.0.0.1 4444`.) The reason for this behavior is explained in [this comment](https://github.com/rust-lang/rust/issues/24250#issuecomment-92240152): `getaddrinfo()` is not constrained.

Various OSS projects (I checked out Postfix, OpenLDAP, Apache HTTPD and BIND) which use `getaddrinfo()` generally constrain the result set by using a non-NULL `hints` parameter and setting at least `ai_socktype` to `SOCK_STREAM`. `SOCK_DGRAM` would also work. Other parameters are unnecessary for pure name resolution.

The patch in this PR initializes a `hints` struct and passes it to `getaddrinfo()`, which eliminates the duplicates. The same test program as above with this change produces:

[capture-after.txt](https://github.com/rust-lang/rust/files/352042/capture-after.txt)

All `libstd` tests pass with this patch.
2016-07-08 14:47:00 +05:30
Manish Goregaokar 88350bdf52 Rollup merge of #34699 - phlogisticfugu:master, r=steveklabnik
enhancewindows documentation in getting-started

- minor pronoun fix We -> You
- PATH troubleshooting
- dir output is vertical (but did not include timestamps)
- executables not in %PATH% require .\

r? @steveklabnik
2016-07-08 14:47:00 +05:30
Manish Goregaokar 793db8fa04 Rollup merge of #34691 - jseyfried:remove_erroneous_unit_struct_checks, r=nrc
parser: Remove outdated checks for empty braced struct expressions (`S {}`)

This is a pure refactoring.
r? @nrc
2016-07-08 14:46:59 +05:30
Manish Goregaokar 4ee6a666e4 Rollup merge of #34688 - GuillaumeGomez:double_ended_iterator, r=steveklabnik
Improve DoubleEndedIterator examples

Fixes #34065.

r? @steveklabnik
2016-07-08 14:46:59 +05:30
Manish Goregaokar f4ae98ab8c Rollup merge of #34659 - GuillaumeGomez:path_file_name, r=steveklabnik
Fix `std::path::Path::file_name()` doc

Fixes #34632

r? @steveklabnik
2016-07-08 14:46:59 +05:30
Manish Goregaokar 75276f36fe Rollup merge of #34612 - frewsxcv:io-error-from_raw_os_error, r=steveklabnik
Add doc examples for `io::Error::from_raw_os_error`.

None
2016-07-08 14:46:58 +05:30
Manish Goregaokar 1b06c00ddd Rollup merge of #34610 - wuranbo:patch-2, r=steveklabnik
doc: make the conditional-compilation example work

If not, the error `does not have these features: foo` confused.
r? @steveklabnik
2016-07-08 14:46:58 +05:30
Manish Goregaokar 8242a30b9e Rollup merge of #34097 - arbitrary-cat:master, r=steveklabnik
Revise wording in Rc documentation.

The term "thread-local" has a widely accepted meaning which is not
the meaning it's used for here.
2016-07-08 13:14:19 +05:30
bors 3fa1cdf23c Auto merge of #34679 - eddyb:mir-nested-pairs, r=dotdash
Handle nested pairs in MIR trans.

Found while trying to compile the latest Servo master.

cc @shinglyu
2016-07-08 00:41:35 -07:00
Mike Hommey 3fd0387eb2 Update jemalloc to include a fix for startup issues on OSX 10.12
This fixes jemalloc/jemalloc#140 in the version used by the rust compiler.

Fixes #34674
2016-07-08 14:15:04 +09:00
bors 9b4e2a5b2d Auto merge of #34682 - CensoredUsername:clobber-docs, r=eddyb
Correct inline assembly clobber formatting.

Fixes the formatting for inline assembly clobbers used in the book.
As this causes llvm to silently ignore the clobber an error is also
added to catch cases in which the wrong formatting was used.
Additionally a test case is added to confirm that this error works.

This fixes #34458

Note: this is only one out of a few possible ways to fix the issue
depending on how the asm! macro formatting is wanted.

Additionally, it'd be nicer to have some kind of test or feedback
from llvm if the clobber constraints are valid, but I do not know
enough about llvm to say if or how this is possible.
2016-07-07 21:48:04 -07:00
bors 182bcdbea1 Auto merge of #34575 - cgswords:tstream, r=nrc
Introducing TokenStreams and TokenSlices for procedural macros

This pull request introduces TokenStreams and TokenSlices into the compiler in preparation for usage as part of RFC 1566 (procedural macros).

r? @nrc
2016-07-07 17:58:31 -07:00
Brian Anderson 2ad5ed07f8 Merge pull request #34712 from rust-lang/steveklabnik-patch-1
Fix release notes for 1.10
2016-07-08 00:12:25 +01:00
Steve Klabnik d04e34b7d4 Fix release notes for 1.10
Path was not actually given a default impl in #32990, even though the PR title said it did.

r? @brson
2016-07-07 18:17:25 -04:00
cgswords 754759688b Preliminary implementation for TokenStreams and TokenSlices, including unit tests and associated operations. 2016-07-07 11:44:04 -07:00
Alex Crichton b67f23c847 Clarify rustbuild + msvc + vcvars in README
The invocation of vcvars is only needed for versions of Visual Studio that
rustbuild or cmake doesn't understand, but if older versions are installed then
there's no need to call vcvars.

Closes #34576
2016-07-07 09:34:46 -07:00
Sam Payson 46e7c9ec74 Changed wording per aturon's comments. 2016-07-07 08:40:15 -07:00
bors 4cf97fe57e Auto merge of #34677 - alexcrichton:no-more-build-directory, r=brson
rustbuild: Remove the `build` directory

The organization in rustbuild was a little odd at the moment where the `lib.rs`
was quite small but the binary `main.rs` was much larger. Unfortunately as well
there was a `build/` directory with the implementation of the build system, but
this directory was ignored by GitHub on the file-search prompt which was a
little annoying.

This commit reorganizes rustbuild slightly where all the library files (the
build system) is located directly inside of `src/bootstrap` and all the binaries
now live in `src/bootstrap/bin` (they're small). Hopefully this should allow
GitHub to index and allow navigating all the files while maintaining a
relatively similar layout to the other libraries in `src/`.
2016-07-07 08:39:36 -07:00