Commit Graph

55459 Commits

Author SHA1 Message Date
Guillaume Gomez
1ef7bdc0c7 Improve boxed docs 2016-07-11 17:25:10 +02:00
Guillaume Gomez
76dd02025c Add missing examples for std::cell types 2016-07-11 17:13:36 +02:00
Jonas Schievink
fd2b65ee70 Register reads on the corrent HIR item 2016-07-11 17:11:51 +02:00
Aaron Gallagher
fbec232df1 Set unwind_safe_lock_refs stability to 1.12.0.
This is the first (and presumably only) use of this feature.
2016-07-11 07:34:20 -07:00
bors
3ab8054ac1 Auto merge of #34725 - GuillaumeGomez:doc_slice, r=steveklabnik
Improve slice docs

Fixes  #29337.

r? @steveklabnik
2016-07-11 07:13:50 -07:00
Jonas Schievink
37d5c06a0d Don't register reads for external items
Presumably, this ICEs when translating an inlined item from another
crate. There shouldn't be a need to track dependencies in that case.
2016-07-11 01:49:38 +02:00
Jonas Schievink
dd0505cefc Calculate the 2 largest variants using iterators
No need to store all sizes in a vector
2016-07-11 01:43:55 +02:00
Jonas Schievink
66fb62baf7 Get rid of node_levels and node_lint_levels 2016-07-11 01:21:12 +02:00
Martin Pool
bba33ecd86 Derive Debug on FileType.
Partially fixes #32054
2016-07-10 15:37:41 -07:00
Aaron Gallagher
c11540587f Mutex and RwLock need RefUnwindSafe too. 2016-07-10 15:22:15 -07:00
ubsan
c0bee60adb Make it nicer from @alexandermerritt 2016-07-10 23:17:02 +02:00
Guillaume Gomez
e634d21ba9 Add examples for std::Error module 2016-07-10 22:29:19 +02:00
Jonas Schievink
f5d29a3b59 Move variant_size_differences out of trans
Also enhances the error message a bit, fixes #30505 on the way, and adds
a test (which was missing).

Closes #34018
2016-07-10 22:12:31 +02:00
bors
47b3a98340 Auto merge of #34753 - sfackler:demangle-curly-braces, r=alexcrichton
Demangle curly braces

They show up in things like
fn(&std..panic..PanicInfo<'_>) $u7b$hook$u7d$::fn_pointer_shim.8352::h01f889b2277c719d

r? @alexcrichton
2016-07-10 12:30:00 -07:00
Guillaume Gomez
4c3cff6c65 Improve std::any module doc 2016-07-10 19:41:50 +02:00
Steven Fackler
8511b6faf4 Demangle curly braces
They show up in things like
fn(&std..panic..PanicInfo<'_>) $u7b$hook$u7d$::fn_pointer_shim.8352::h01f889b2277c719d
2016-07-10 10:04:20 -07:00
bors
6871b3f240 Auto merge of #34657 - oli-obk:no_needless_const_eval, r=eddyb
don't const eval constants during MIR creation

this didn't work very well anyway, because const_eval can't eval all kinds of constants.
2016-07-10 06:43:47 -07:00
bors
46e7f4b8c5 Auto merge of #34731 - GGist:fix_sync_try_recv, r=alexcrichton
Check for data in Receiver::try_recv before reporting disconnect

Fixes #34711

r? @alexcrichton
2016-07-10 00:22:33 -07:00
bors
c73bb9b7d9 Auto merge of #34745 - alexandermerritt:slice-doc, r=brson
make docs for clone_from_slice consistent with copy_from_slice

What 'this slice' refers to is not intuitive, given this method can appear in other places, e.g. in docs for Vec.
2016-07-09 21:16:20 -07:00
ubsan
97003e5699 Switch around Examples and Alternatives 2016-07-10 06:13:34 +02:00
Alexander Merritt
6a4016933e make clone_from_slice consistent with copy_from_slice
What 'this slice' refers to is not intuitive (we're in the docs for Vec).
2016-07-09 21:50:25 -04:00
bors
4d50e47ce5 Auto merge of #34723 - GuillaumeGomez:slice_doc, r=apasel422
Remove useless doc comment for slice

r? @steveklabnik

This doc comment isn't useful so I removed it. It also "fixes" the weird rustdoc output.

Before:

![screenshot from 2016-07-08 02-04-59](https://cloud.githubusercontent.com/assets/3050060/16688164/fbb321d6-451c-11e6-8d98-53346bc6eb1e.png)

After:

![screenshot from 2016-07-08 02-05-31](https://cloud.githubusercontent.com/assets/3050060/16688166/00b174e4-451d-11e6-83dd-93ab2509f647.png)
2016-07-09 18:16:48 -07:00
bors
f93aaf84cb Auto merge of #34365 - petrochenkov:deferr, r=eddyb
Some more pattern cleanup and bugfixing

The next part of https://github.com/rust-lang/rust/pull/34095

The most significant fixed mistake is definitions for partially resolved associated types not being updated after full resolution.
```
fn f<T: Fn()>(arg: T::Output) { .... } // <- the definition of T::Output was not updated in def_map
```
For this reason unstable associated types of stable traits, like `FnOnce::Output`, could be used in stable code when written in unqualified form. Now they are properly checked, this is a **[breaking-change]** (pretty minor one, but a crater run would be nice). The fix is not to use unstable library features in stable code, alternatively `FnOnce::Output` can be stabilized.

Besides that, paths in struct patterns and expressions `S::A { .. }` are now fully resolved as associated types. Such types cannot be identified as structs at the moment, i.e. the change doesn't make previously invalid code valid, but it improves error diagnostics.

Other changes: `Def::Err` is supported better (less chances for ICEs for erroneous code), some incorrect error messages are corrected, some duplicated error messages are not reported, ADT definitions are now available through constructor IDs, everything else is cleanup and code audit.

Fixes https://github.com/rust-lang/rust/issues/34209
Closes https://github.com/rust-lang/rust/issues/22933 (adds tests)

r? @eddyb
2016-07-09 15:16:21 -07:00
abhi
f396cb42ee Update on struct expressions (check #32769) 2016-07-10 02:10:57 +05:30
bors
d40c593f42 Auto merge of #34717 - frewsxcv:sink, r=apasel422
Remove unnecessarily mutable reference in doc example.

None
2016-07-09 12:16:57 -07:00
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
Guillaume Gomez
50483d5fa3 Improve slice docs 2016-07-09 11:54:58 +02: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
Alex Burka
b4ff6b028e document DoubleEndedIterator::next_back
fixes #34726
2016-07-08 23:14:32 -04:00
Andrew
2af340c0ec Check for data in Receiver::try_recv before reporting disconnect 2016-07-08 19:09:51 -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