Commit Graph

68180 Commits

Author SHA1 Message Date
Felix S. Klock II
66a31c7dc1 Make -Z borrowck-mir imply that EndRegion's should be emitted. 2017-09-20 15:25:44 +02:00
bors
4cdb36262b Auto merge of #44407 - mattico:print-native-cpu, r=arielb1
Add 'native' to -C target-cpu=help

Fixes #44393
2017-09-20 12:24:49 +00:00
bors
183329cf73 Auto merge of #44707 - GuillaumeGomez:rollup, r=arielb1
Rollup of 5 pull requests

- Successful merges: #44513, #44626, #44689, #44693, #44703
- Failed merges:
2017-09-20 10:04:31 +00:00
Michael Woerister
9798a88e9e incr.comp.: Add some comments. 2017-09-20 11:34:28 +02:00
Michael Woerister
47d14ccd51 incr.comp.: Remove IncrementalHashesMap and calculate_svh module. 2017-09-20 11:21:25 +02:00
Michael Woerister
c4d1651266 incr.comp.: Store result fingerprints in DepGraph. 2017-09-20 11:21:25 +02:00
Michael Woerister
25bc69ec20 incr.comp.: Allow for marking DepKinds as inputs. 2017-09-20 11:21:25 +02:00
Michael Woerister
3b75a3dfea incr.comp.: Make sure traits_in_scope results are hashed in a stable way. 2017-09-20 11:21:25 +02:00
bors
94a82adbb4 Auto merge of #44355 - Xaeroxe:optimize_drain_filter, r=alexcrichton
Optimize drain_filter

This PR cuts out two copies from each iteration of `drain_filter` by exchanging the swap operation for a copy_nonoverlapping function call instead.  Since the data being swapped is not needed anymore we can just overwrite it instead.
2017-09-20 06:29:42 +00:00
Jack O'Connor
c9099ff11b fix an incorrect assertion in the doc example for std::io::copy 2017-09-20 01:25:47 -04:00
bors
54996837a3 Auto merge of #44350 - GuillaumeGomez:id-false-positive, r=QuietMisdreavus
Improve how rustdoc warnings are displayed

cc @rust-lang/dev-tools
r? @nrc
2017-09-20 02:46:25 +00:00
Samuel Holland
314c2b1447 Adjust dependency-resolution errors to be more consistent 2017-09-19 21:37:19 -05:00
bors
f60bc3ac0c Auto merge of #44505 - nikomatsakis:lotsa-comments, r=steveklabnik
rework the README.md for rustc and add other readmes

OK, so, long ago I committed to the idea of trying to write some high-level documentation for rustc. This has proved to be much harder for me to get done than I thought it would! This PR is far from as complete as I had hoped, but I wanted to open it so that people can give me feedback on the conventions that it establishes. If this seems like a good way forward, we can land it and I will open an issue with a good check-list of things to write (and try to take down some of them myself).

Here are the conventions I established on which I would like feedback.

**Use README.md files**. First off, I'm aiming to keep most of the high-level docs in `README.md` files, rather than entries on forge. My thought is that such files are (a) more discoverable than forge and (b) closer to the code, and hence can be edited in a single PR. However, since they are not *in the code*, they will naturally get out of date, so the intention is to focus on the highest-level details, which are least likely to bitrot. I've included a few examples of common functions and so forth, but never tried to (e.g.) exhaustively list the names of functions and so forth.
    - I would like to use the tidy scripts to try and check that these do not go out of date. Future work.

**librustc/README.md as the main entrypoint.** This seems like the most natural place people will look first. It lays out how the crates are structured and **is intended** to give pointers to the main data structures of the compiler (I didn't update that yet; the existing material is terribly dated).

**A glossary listing abbreviations and things.** It's much harder to read code if you don't know what some obscure set of letters like `infcx` stands for.

**Major modules each have their own README.md that documents the high-level idea.** For example, I wrote some stuff about `hir` and `ty`. Both of them have many missing topics, but I think that is roughly the level of depth that would be good. The idea is to give people a "feeling" for what the code does.

What is missing primarily here is lots of content. =) Here are some things I'd like to see:

- A description of what a QUERY is and how to define one
    - Some comments for `librustc/ty/maps.rs`
- An overview of how compilation proceeds now (i.e., the hybrid demand-driven and forward model) and how we would like to see it going in the future (all demand-driven)
- Some coverage of how incremental will work under red-green
- An updated list of the major IRs in use of the compiler (AST, HIR, TypeckTables, MIR) and major bits of interesting code (typeck, borrowck, etc)
- More advice on how to use `x.py`, or at least pointers to that
- Good choice for `config.toml`
- How to use `RUST_LOG` and other debugging flags (e.g., `-Zverbose`, `-Ztreat-err-as-bug`)
- Helpful conventions for `debug!` statement formatting

cc @rust-lang/compiler @mgattozzi
2017-09-19 22:43:58 +00:00
Guillaume Gomez
7aa5367236 Improve how warnings are displayed 2017-09-19 23:21:28 +02:00
Guillaume Gomez
bfed2dcb2f Rollup merge of #44703 - GuillaumeGomez:missing-io-links, r=QuietMisdreavus
Add some missing links in io docs

r? @rust-lang/docs
2017-09-19 21:50:25 +02:00
Guillaume Gomez
bb206922d1 Rollup merge of #44693 - mssun:native-static-libs-patch, r=alexcrichton
Fix a typo in rustc help menu

Change from native-static-deps to native-static-libs.

Fix a typo introduced by this merged pull request: https://github.com/rust-lang/rust/pull/43067
2017-09-19 21:50:25 +02:00
Guillaume Gomez
23b4020156 Rollup merge of #44689 - behnam:unicode, r=sfackler
[libstd_unicode] Expose UnicodeVersion type

In <https://github.com/rust-lang/rust/pull/42998>, we added an
uninstantiable type for the internal `UNICODE_VERSION` value,
`UnicodeVersion`, but it was not made public to the outside of the
crate, resulting in the value becoming less useful. Here we make the
type accessible from the outside.

Also add a run-pass test to make sure the type and value can be accessed
as intended.
2017-09-19 21:50:23 +02:00
Guillaume Gomez
64fa14e977 Rollup merge of #44626 - MaulingMonkey:lld-link-natvis-regression-fix, r=michaelwoerister
Skip passing /natvis to lld-link until supported.

### Overview

Teaching rustc about MSVC's undocumented linker flag, /NATVIS, broke rustc's compatability with LLVM's `lld-link` frontend, as it does not recognize the flag.  This pull request works around the problem by excluding `lld-link` by name.  @retep998 discovered this regression.

### Possible Issues

- Other linkers that try to be compatible with the MSVC linker flavor may also be broken and in need of workarounds.
- Warning about the workaround may be overkill for a minor reduction in debug functionality.
- Depending on how long this workaround sticks around, it may eventually be preferred to version check `lld-link` instead of assuming all versions are incompatible.

### Relevant issues
* Broke in https://github.com/rust-lang/rust/pull/43221 Embed MSVC .natvis files into .pdbs and mangle debuginfo for &str, *T, and [T].
* LLVM patched in 27b9c42853 to ignore the flag instead of erroring.

r? @michaelwoerister
2017-09-19 21:50:22 +02:00
Guillaume Gomez
6e6a474357 Rollup merge of #44513 - redox-os:master, r=alexcrichton
[Redox] Sync with upstream syscall library

This syncs the vendored syscalls with their upstream versions.
2017-09-19 21:50:21 +02:00
Ulrik Sverdrup
41a42263df core: Assign tracking issue for iter_rfold 2017-09-19 21:24:21 +02:00
Guillaume Gomez
203d71f507 Add pub visibility for methods as well 2017-09-19 21:17:53 +02:00
Niko Matsakis
638958bd13 incorporate suggestions from arielb1 2017-09-19 12:36:32 -04:00
Guillaume Gomez
ff457f012a Add some missing links in io docs 2017-09-19 18:10:38 +02:00
Niko Matsakis
38813cf40d start writing some typeck docs (incomplete) 2017-09-19 10:39:00 -04:00
Niko Matsakis
032fdef3be define span 2017-09-19 10:39:00 -04:00
Niko Matsakis
f130e7d9db revamp the Compiler Process section to be more up to date 2017-09-19 10:39:00 -04:00
Niko Matsakis
70db841aa0 split maps into submodules, document 2017-09-19 10:39:00 -04:00
Oliver Schneider
7d7e7d4b97 Disable clippy building 2017-09-19 16:08:19 +02:00
bors
325ba23d55 Auto merge of #44620 - zackmdavis:rfc_1940_housekeeping, r=nikomatsakis
RFC 1940 housekeeping

* move test to own directory, as requested in https://github.com/rust-lang/rust/issues/43302#issuecomment-329579185
* exercise trait methods in test
* unstable book section

r? @nikomatsakis
2017-09-19 13:06:31 +00:00
Niko Matsakis
76eac36e36 promote maps into its own directory 2017-09-19 09:00:59 -04:00
Niko Matsakis
73a4e8db75 apply various nits 2017-09-19 09:00:59 -04:00
Niko Matsakis
44e45d9fea rework the README.md for rustc and add other readmes
This takes way longer than I thought it would. =)
2017-09-19 09:00:59 -04:00
bors
5d5dcae7f1 Auto merge of #44601 - alexcrichton:lower-attributes-in-hir, r=nrc
rustc: Forbid interpolated tokens in the HIR

Right now the HIR contains raw `syntax::ast::Attribute` structure but nowadays
these can contain arbitrary tokens. One variant of the `Token` enum is an
"interpolated" token which basically means to shove all the tokens for a
nonterminal in this position. A "nonterminal" in this case is roughly analagous
to a macro argument:

    macro_rules! foo {
        ($a:expr) => {
            // $a is a nonterminal as an expression
        }
    }

Currently nonterminals contain namely items and expressions, and this poses a
problem for incremental compilation! With incremental we want a stable hash of
all HIR items, but this means we may transitively need a stable hash *of the
entire AST*, which is certainly not stable w/ node ids and whatnot. Hence today
there's a "bug" where the "stable hash" of an AST is just the raw hash value of
the AST, and this only arises with interpolated nonterminals. The downside of
this approach, however, is that a bunch of errors get spewed out during
compilation about how this isn't a great idea.

This PR is focused at fixing these warnings, basically deleting them from the
compiler. The implementation here is to alter attributes as they're lowered from
the AST to HIR, expanding all nonterminals in-place as we see them. This code
for expanding a nonterminal to a token stream already exists for the
`proc_macro` crate, so we basically just reuse the same implementation there.

After this PR it's considered a bug to have an `Interpolated` token and hence
the stable hash implementation simply uses `bug!` in this location.

Closes #40946
2017-09-19 08:19:45 +00:00
Oliver Schneider
d64a067423
Add clippy to toolstate.toml 2017-09-19 09:20:35 +02:00
Bob Sun
0c5311edeb Fix a typo in rustc help menu
Change from native-static-deps to native-static-libs.
2017-09-19 00:12:37 -07:00
Jimmy Cuadra
5f6de3d402 Derive additional traits for Infallible. 2017-09-18 22:19:00 -07:00
bors
9a00f3cc30 Auto merge of #44026 - QuietMisdreavus:trimmed-std, r=steveklabnik
hide internal types/traits from std docs via new #[doc(masked)] attribute

Fixes #43701 (hopefully for good this time)

This PR introduces a new parameter to the `#[doc]` attribute that rustdoc looks for on `extern crate` statements. When it sees `#[doc(masked)]` on such a statement, it hides traits and types from that crate from appearing in either the "Trait Implementations" section of many type pages, or the "Implementors" section of trait pages. This is then applied to the `libc`/`rand`/`compiler_builtins` imports in libstd to prevent those crates from creating broken links in the std docs.

Like in #43348, this also introduces a feature gate, `doc_masked`, that controls the use of this parameter.

To view the std docs generated with this change, head to https://tonberry.quietmisdreavus.net/std-43701/std/index.html.
2017-09-19 04:20:56 +00:00
Behnam Esfahbod
86a79c9710 [libstd_unicode] Expose UnicodeVersion type
In <https://github.com/rust-lang/rust/pull/42998>, we added an
uninstantiable type for the internal `UNICODE_VERSION` value,
`UnicodeVersion`, but it was not made public to the outside of the
crate, resulting in the value becoming less useful. Here we make the
type accessible from the outside.

Also add a run-pass test to make sure the type and value can be accessed
as intended.
2017-09-18 20:39:17 -07:00
Samuel Holland
779041cd5a Require rlibs for dependent crates when linking static executables
This handles the case for `CrateTypeExecutable` and `+crt_static`. I
reworked the match block to avoid duplicating the `attempt_static` and
error checking code again (this case would have been a copy of the
`CrateTypeCdylib`/`CrateTypeStaticlib` case).

On `linux-musl` targets where `std` was built with `crt_static = false`
in `config.toml`, this change brings the test suite from entirely
failing to mostly passing.

This change should not affect behavior for other crate types, or for
targets which do not respect `+crt_static`.
2017-09-18 22:31:57 -05:00
Alex Crichton
0694e4fde4 rustc: Forbid interpolated tokens in the HIR
Right now the HIR contains raw `syntax::ast::Attribute` structure but nowadays
these can contain arbitrary tokens. One variant of the `Token` enum is an
"interpolated" token which basically means to shove all the tokens for a
nonterminal in this position. A "nonterminal" in this case is roughly analagous
to a macro argument:

    macro_rules! foo {
        ($a:expr) => {
            // $a is a nonterminal as an expression
        }
    }

Currently nonterminals contain namely items and expressions, and this poses a
problem for incremental compilation! With incremental we want a stable hash of
all HIR items, but this means we may transitively need a stable hash *of the
entire AST*, which is certainly not stable w/ node ids and whatnot. Hence today
there's a "bug" where the "stable hash" of an AST is just the raw hash value of
the AST, and this only arises with interpolated nonterminals. The downside of
this approach, however, is that a bunch of errors get spewed out during
compilation about how this isn't a great idea.

This PR is focused at fixing these warnings, basically deleting them from the
compiler. The implementation here is to alter attributes as they're lowered from
the AST to HIR, expanding all nonterminals in-place as we see them. This code
for expanding a nonterminal to a token stream already exists for the
`proc_macro` crate, so we basically just reuse the same implementation there.

After this PR it's considered a bug to have an `Interpolated` token and hence
the stable hash implementation simply uses `bug!` in this location.

Closes #40946
2017-09-18 17:20:12 -07:00
bors
06bb0e01be Auto merge of #44680 - infinity0:master, r=Mark-Simulacrum
rustbuild: with --no-fail-fast, report the specific commands that failed

I'm not sure this is the most elegant way of doing it, I'm still a bit of a rust noob. I tried `Vec<Command>` and keeping `Cell` instead of `RefCell` but couldn't fight my way past the borrow errors, this was the first arrangement that I could make work.
2017-09-18 23:46:15 +00:00
Ulrik Sverdrup
7e81cee934 core: Add feature gate to rfold example code 2017-09-18 23:09:00 +02:00
Ulrik Sverdrup
84c90f3022 alloc: Implement rfold for VecDeque iterators 2017-09-18 21:56:59 +02:00
Ulrik Sverdrup
a59a25d8e6 core: Implement rfold for Map, Cloned, Chain 2017-09-18 21:56:59 +02:00
Ulrik Sverdrup
31cf26a953 core: Implement fold / rfold for Rev
With both in place, we can cross them over in rev, and we give rfold
behaviour to .rev().fold() and so on.
2017-09-18 21:56:58 +02:00
Ulrik Sverdrup
91318c8cab core: Add DoubleEndedIterator::rfold
rfold is the reverse version of fold.

Fold allows iterators to implement a different (non-resumable) internal
iteration when it is more efficient than the external iteration
implemented through the next method. (Common examples are VecDeque and
.chain()).

Introduce rfold() so that the same customization is available for
reverse iteration. This is achieved by both adding the method, and by
having the Rev<I> adaptor connect Rev::rfold -> I::fold, Rev::fold -> I::rfold.
2017-09-18 21:55:38 +02:00
Ulrik Sverdrup
ffd171e47f core: Small fix in fold docs
Adaptors are things that take iterators and adapt them into other
iterators. With this definition, fold is just a usual method, because it
doesn't normally make an iterator.
2017-09-18 21:45:23 +02:00
Ximin Luo
8f25497d78 rustbuild: with --no-fail-fast, report the specific commands that failed 2017-09-18 21:21:24 +02:00
bors
0701b37d97 Auto merge of #44678 - alexcrichton:rollup, r=alexcrichton
Rollup of 11 pull requests

- Successful merges: #44364, #44466, #44537, #44548, #44640, #44651, #44657, #44661, #44668, #44671, #44675
- Failed merges:
2017-09-18 17:30:29 +00:00
Jacob Kiesel
10384ab18a Add requested comment 2017-09-18 10:15:17 -06:00