]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agodotdoteq_in_patterns feature gate
Badel2 [Thu, 21 Sep 2017 10:14:14 +0000 (12:14 +0200)]
dotdoteq_in_patterns feature gate

6 years agoAdd information about the syntax used in ranges
Badel2 [Thu, 21 Sep 2017 10:13:26 +0000 (12:13 +0200)]
Add information about the syntax used in ranges

... or ..=

6 years agoSubstitute `...` with the expanded form
Badel2 [Wed, 20 Sep 2017 18:57:18 +0000 (20:57 +0200)]
Substitute `...` with the expanded form

RangeInclusive { start, end }, this way we supress the warnings about `...` in expressions being deprecated until `..=` is available in the compiler

6 years agoAdd support for `..=` syntax
Alex Burka [Tue, 19 Sep 2017 05:40:04 +0000 (05:40 +0000)]
Add support for `..=` syntax

Add ..= to the parser

Add ..= to libproc_macro

Add ..= to ICH

Highlight ..= in rustdoc

Update impl Debug for RangeInclusive to ..=

Replace `...` to `..=` in range docs

Make the dotdoteq warning point to the ...

Add warning for ... in expressions

Updated more tests to the ..= syntax

Updated even more tests to the ..= syntax

Updated the inclusive_range entry in unstable book

6 years agoAuto merge of #44691 - cramertj:underscore-lifetimes, r=nikomatsakis
bors [Fri, 22 Sep 2017 14:05:16 +0000 (14:05 +0000)]
Auto merge of #44691 - cramertj:underscore-lifetimes, r=nikomatsakis

Implement underscore lifetimes

Part of https://github.com/rust-lang/rust/issues/44524

6 years agoAuto merge of #44624 - tmerr:master, r=sfackler
bors [Fri, 22 Sep 2017 10:30:20 +0000 (10:30 +0000)]
Auto merge of #44624 - tmerr:master, r=sfackler

Retain suid/sgid/sticky bits in Metadata.permissions

Most users would expect set_permissions(Metadata.permissions()) to be
non-destructive. While we can't guarantee this, we can at least pass
the needed info to chmod.

Also update the PermissionsExt documentation to disambiguate what it
contains, and to refer to the underlying value as `st_mode` rather than
its type `mode_t`.

Closes #44147

6 years agoAuto merge of #44754 - marcusbuffett:bootstrap-config-toml-fix, r=alexcrichton
bors [Fri, 22 Sep 2017 05:01:41 +0000 (05:01 +0000)]
Auto merge of #44754 - marcusbuffett:bootstrap-config-toml-fix, r=alexcrichton

Catch IOError in bootstrap.py when loading config.toml

When I pulled this repo and tried to build using the command in the readme, I got an error about a missing `config.toml`.

If config.toml doesn't exist, then an `IOError` will be raised the `with open(...)` line. Prior to e788fa7b6cf07860eb0ff3e90ff32fc4f9d26cae, this was caught because the `except` clause didn't specify what exceptions it caught, so both `IOError` and `OSError` were caught.

First time contributing, so please let me know if I'm doing anything wrong.

6 years agoAuto merge of #44682 - bluss:iter-rfold, r=dtolnay
bors [Thu, 21 Sep 2017 23:44:11 +0000 (23:44 +0000)]
Auto merge of #44682 - bluss:iter-rfold, r=dtolnay

Add iterator method .rfold(init, function); the reverse of fold

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 and Rev::fold → I::rfold.

On the surface, rfold(..) is just .rev().fold(..), but the special case
implementations allow a data structure specific fold to be used through for
example .iter().rev(); we thus have gains even for users never calling exactly
rfold themselves.

6 years agoAuto merge of #44215 - oli-obk:import_sugg, r=nrc
bors [Thu, 21 Sep 2017 20:12:22 +0000 (20:12 +0000)]
Auto merge of #44215 - oli-obk:import_sugg, r=nrc

don't suggest placing `use` statements into expanded code

r? @nrc

fixes #44210

```rust
#[derive(Debug)]
struct Foo;

type X = Path;
```

will try to place `use std::path::Path;` between `#[derive(Debug)]` and `struct Foo;`

I am not sure how to obtain a span before the first attribute, because derive attributes are removed during expansion.

It would be trivial to detect this case and place the `use` after the item, but that would be somewhat weird I think.

6 years agoCatch IOError
Marcus Buffett [Thu, 21 Sep 2017 19:15:10 +0000 (12:15 -0700)]
Catch IOError

If config.toml doesn't exist, then an IOError will be raised
on the `with open(...)` line. Prior to e788fa7, this was
caught because the `except` clause didn't specify what
exceptions it caught, so both IOError and OSError were
caught

6 years agoAdd tests for underscore lifetimes in impl headers and struct definitions
Taylor Cramer [Wed, 20 Sep 2017 23:06:08 +0000 (16:06 -0700)]
Add tests for underscore lifetimes in impl headers and struct definitions

6 years agoAdd tests for multiple underscore and non-underscore lifetimes
Taylor Cramer [Tue, 19 Sep 2017 23:43:18 +0000 (16:43 -0700)]
Add tests for multiple underscore and non-underscore lifetimes

6 years agoRefactor lifetime name into an enum
Taylor Cramer [Tue, 19 Sep 2017 23:36:54 +0000 (16:36 -0700)]
Refactor lifetime name into an enum

6 years agoAuto merge of #44679 - oli-obk:clippy_ci, r=alexcrichton
bors [Thu, 21 Sep 2017 13:33:58 +0000 (13:33 +0000)]
Auto merge of #44679 - oli-obk:clippy_ci, r=alexcrichton

Add clippy to `toolstate.toml`

r? @alexcrichton

cc @Manishearth

I have no idea how to get clippy working... it needs proc macros, and I think I did everything right (I just did what the cargo step is doing), but it's not working:

```
error: libproc_macro-6210e4b46662ec28.so: cannot open shared object file: No such file or directory
  --> src/tools/clippy/clippy_lints/src/lib.rs:47:1
   |
47 | extern crate serde_derive;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^

error: libproc_macro-6210e4b46662ec28.so: cannot open shared object file: No such file or directory
  --> src/tools/clippy/clippy_lints/src/lib.rs:47:1
   |
47 | extern crate serde_derive;
   | ^
```

It's especially weird since it used to work

Anyway. Fixing it can be left for a future PR, this one adds it to CI, but marks it as "broken"

6 years agoAuto merge of #44627 - zackmdavis:the_capgate_perogative, r=nrc
bors [Thu, 21 Sep 2017 09:41:26 +0000 (09:41 +0000)]
Auto merge of #44627 - zackmdavis:the_capgate_perogative, r=nrc

`--cap-lints allow` switches off `can_emit_warnings`

This boolean field on the error `Handler` is toggled to silence
warnings when `-A warnings` is passed. (This is actually a separate
mechanism from the global lint level—whether there's some redundancy
to be factored away here is an important question, but not one we
concern ourselves with in this commit.)  But the same rationale
applies for `--cap-lints allow`. In particular, this makes the "soft"
feature-gate warning introduced in 8492ad24 (which is not a lint, but
just calls `struct_span_warn`) not pollute the builds of dependent
crates.

Thanks to @kennytm for pointing out the potential of
`can_emit_warnings` for this purpose.

Resolves #44213.

6 years agoImplement underscore lifetimes
Taylor Cramer [Tue, 19 Sep 2017 05:55:21 +0000 (22:55 -0700)]
Implement underscore lifetimes

6 years agoAuto merge of #44551 - scalexm:copy-clone-closures, r=arielb1
bors [Thu, 21 Sep 2017 00:35:33 +0000 (00:35 +0000)]
Auto merge of #44551 - scalexm:copy-clone-closures, r=arielb1

Implement `Copy`/`Clone` for closures

Implement RFC [#2132](https://github.com/rust-lang/rfcs/pull/2132) (tracking issue: #44490).

NB: I'm not totally sure about the whole feature gates thing, that's my first PR of this kind...

6 years agoAuto merge of #44392 - Zoxc:yield-order, r=nikomatsakis
bors [Wed, 20 Sep 2017 21:26:15 +0000 (21:26 +0000)]
Auto merge of #44392 - Zoxc:yield-order, r=nikomatsakis

Only consider yields coming after the expressions when computing generator interiors

When looking at the scopes which temporaries of expressions can live for during computation of generator interiors, only consider yields which appear after the expression in question in the HIR.

6 years agoFix ICE
scalexm [Wed, 20 Sep 2017 18:42:49 +0000 (20:42 +0200)]
Fix ICE

6 years agoImplement `Copy`/`Clone` for closures
scalexm [Wed, 13 Sep 2017 20:40:48 +0000 (22:40 +0200)]
Implement `Copy`/`Clone` for closures

6 years agoAuto merge of #44525 - aidanhs:aphs-no-null-deref, r=alexcrichton
bors [Wed, 20 Sep 2017 14:50:31 +0000 (14:50 +0000)]
Auto merge of #44525 - aidanhs:aphs-no-null-deref, r=alexcrichton

Correctly bubble up errors from libbacktrace

Previously the first part of this code didn't check for a null pointer and blindly passed it back down, causing a segfault if libbacktrace failed to initialise. I've changed this to check and bubble up the error if relevant.

Suggested diff view: https://github.com/rust-lang/rust/pull/44525/files?w=1

6 years agorebase fixup
Ariel Ben-Yehuda [Wed, 20 Sep 2017 13:49:27 +0000 (16:49 +0300)]
rebase fixup

6 years agoaddress review comments
Ariel Ben-Yehuda [Wed, 20 Sep 2017 13:36:20 +0000 (16:36 +0300)]
address review comments

6 years agoadd proofs and fix postorder traversal
Ariel Ben-Yehuda [Tue, 12 Sep 2017 22:09:56 +0000 (01:09 +0300)]
add proofs and fix postorder traversal

I don't think the "quasi-postorder" travesal could cause any issues, but
there's no reason for it to stay broken.

6 years agoMark yields after visiting subexpressions. Never ignore yields for scopes in bindings.
John Kåre Alsaker [Fri, 8 Sep 2017 06:52:03 +0000 (08:52 +0200)]
Mark yields after visiting subexpressions. Never ignore yields for scopes in bindings.

6 years agoRemove debug statements
John Kåre Alsaker [Fri, 8 Sep 2017 05:58:08 +0000 (07:58 +0200)]
Remove debug statements

6 years agoSanity check the Expr visitation count
John Kåre Alsaker [Thu, 7 Sep 2017 12:35:02 +0000 (14:35 +0200)]
Sanity check the Expr visitation count

6 years agoOnly consider yields coming after the expressions when computing generator interiors
John Kåre Alsaker [Sun, 3 Sep 2017 10:43:05 +0000 (12:43 +0200)]
Only consider yields coming after the expressions when computing generator interiors

6 years agoFix HIR printing of yield
John Kåre Alsaker [Sun, 3 Sep 2017 10:42:28 +0000 (12:42 +0200)]
Fix HIR printing of yield

6 years agoAuto merge of #44407 - mattico:print-native-cpu, r=arielb1
bors [Wed, 20 Sep 2017 12:24:49 +0000 (12:24 +0000)]
Auto merge of #44407 - mattico:print-native-cpu, r=arielb1

Add 'native' to -C target-cpu=help

Fixes #44393

6 years agoAuto merge of #44707 - GuillaumeGomez:rollup, r=arielb1
bors [Wed, 20 Sep 2017 10:04:31 +0000 (10:04 +0000)]
Auto merge of #44707 - GuillaumeGomez:rollup, r=arielb1

Rollup of 5 pull requests

- Successful merges: #44513, #44626, #44689, #44693, #44703
- Failed merges:

6 years agoAuto merge of #44355 - Xaeroxe:optimize_drain_filter, r=alexcrichton
bors [Wed, 20 Sep 2017 06:29:42 +0000 (06:29 +0000)]
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.

6 years agoAuto merge of #44350 - GuillaumeGomez:id-false-positive, r=QuietMisdreavus
bors [Wed, 20 Sep 2017 02:46:25 +0000 (02:46 +0000)]
Auto merge of #44350 - GuillaumeGomez:id-false-positive, r=QuietMisdreavus

Improve how rustdoc warnings are displayed

cc @rust-lang/dev-tools
r? @nrc

6 years agoAuto merge of #44505 - nikomatsakis:lotsa-comments, r=steveklabnik
bors [Tue, 19 Sep 2017 22:43:58 +0000 (22:43 +0000)]
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

6 years agoImprove how warnings are displayed
Guillaume Gomez [Wed, 6 Sep 2017 09:53:50 +0000 (11:53 +0200)]
Improve how warnings are displayed

6 years agoRollup merge of #44703 - GuillaumeGomez:missing-io-links, r=QuietMisdreavus
Guillaume Gomez [Tue, 19 Sep 2017 19:50:25 +0000 (21:50 +0200)]
Rollup merge of #44703 - GuillaumeGomez:missing-io-links, r=QuietMisdreavus

Add some missing links in io docs

r? @rust-lang/docs

6 years agoRollup merge of #44693 - mssun:native-static-libs-patch, r=alexcrichton
Guillaume Gomez [Tue, 19 Sep 2017 19:50:25 +0000 (21:50 +0200)]
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

6 years agoRollup merge of #44689 - behnam:unicode, r=sfackler
Guillaume Gomez [Tue, 19 Sep 2017 19:50:23 +0000 (21:50 +0200)]
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.

6 years agoRollup merge of #44626 - MaulingMonkey:lld-link-natvis-regression-fix, r=michaelwoerister
Guillaume Gomez [Tue, 19 Sep 2017 19:50:22 +0000 (21:50 +0200)]
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 https://github.com/llvm-mirror/lld/commit/27b9c4285364d8d76bb43839daa100c2f80f8329 to ignore the flag instead of erroring.

r? @michaelwoerister

6 years agoRollup merge of #44513 - redox-os:master, r=alexcrichton
Guillaume Gomez [Tue, 19 Sep 2017 19:50:21 +0000 (21:50 +0200)]
Rollup merge of #44513 - redox-os:master, r=alexcrichton

[Redox] Sync with upstream syscall library

This syncs the vendored syscalls with their upstream versions.

6 years agocore: Assign tracking issue for iter_rfold
Ulrik Sverdrup [Tue, 19 Sep 2017 19:24:04 +0000 (21:24 +0200)]
core: Assign tracking issue for iter_rfold

6 years agoincorporate suggestions from arielb1
Niko Matsakis [Tue, 19 Sep 2017 16:36:32 +0000 (12:36 -0400)]
incorporate suggestions from arielb1

6 years agoAdd some missing links in io docs
Guillaume Gomez [Tue, 19 Sep 2017 16:10:38 +0000 (18:10 +0200)]
Add some missing links in io docs

6 years agostart writing some typeck docs (incomplete)
Niko Matsakis [Tue, 19 Sep 2017 12:43:15 +0000 (08:43 -0400)]
start writing some typeck docs (incomplete)

6 years agodefine span
Niko Matsakis [Mon, 18 Sep 2017 15:35:47 +0000 (11:35 -0400)]
define span

6 years agorevamp the Compiler Process section to be more up to date
Niko Matsakis [Mon, 18 Sep 2017 14:55:15 +0000 (10:55 -0400)]
revamp the Compiler Process section to be more up to date

6 years agosplit maps into submodules, document
Niko Matsakis [Mon, 18 Sep 2017 09:40:13 +0000 (05:40 -0400)]
split maps into submodules, document

6 years agoDisable clippy building
Oliver Schneider [Tue, 19 Sep 2017 14:08:19 +0000 (16:08 +0200)]
Disable clippy building

6 years agoAuto merge of #44620 - zackmdavis:rfc_1940_housekeeping, r=nikomatsakis
bors [Tue, 19 Sep 2017 13:06:31 +0000 (13:06 +0000)]
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

6 years agopromote maps into its own directory
Niko Matsakis [Mon, 18 Sep 2017 09:49:15 +0000 (05:49 -0400)]
promote maps into its own directory

6 years agoapply various nits
Niko Matsakis [Fri, 15 Sep 2017 20:19:44 +0000 (16:19 -0400)]
apply various nits

6 years agorework the README.md for rustc and add other readmes
Niko Matsakis [Thu, 31 Aug 2017 18:33:19 +0000 (14:33 -0400)]
rework the README.md for rustc and add other readmes

This takes way longer than I thought it would. =)

6 years agoAuto merge of #44601 - alexcrichton:lower-attributes-in-hir, r=nrc
bors [Tue, 19 Sep 2017 08:19:45 +0000 (08:19 +0000)]
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

6 years agoAdd clippy to `toolstate.toml`
Oliver Schneider [Mon, 18 Sep 2017 11:13:57 +0000 (13:13 +0200)]
Add clippy to `toolstate.toml`

6 years agoFix a typo in rustc help menu
Bob Sun [Tue, 19 Sep 2017 07:12:37 +0000 (00:12 -0700)]
Fix a typo in rustc help menu

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

6 years agoAuto merge of #44026 - QuietMisdreavus:trimmed-std, r=steveklabnik
bors [Tue, 19 Sep 2017 04:20:56 +0000 (04:20 +0000)]
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.

6 years ago[libstd_unicode] Expose UnicodeVersion type
Behnam Esfahbod [Tue, 19 Sep 2017 02:27:08 +0000 (19:27 -0700)]
[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.

6 years agorustc: Forbid interpolated tokens in the HIR
Alex Crichton [Fri, 15 Sep 2017 15:28:34 +0000 (08:28 -0700)]
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

6 years agoAuto merge of #44680 - infinity0:master, r=Mark-Simulacrum
bors [Mon, 18 Sep 2017 23:46:15 +0000 (23:46 +0000)]
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.

6 years agocore: Add feature gate to rfold example code
Ulrik Sverdrup [Mon, 18 Sep 2017 21:09:00 +0000 (23:09 +0200)]
core: Add feature gate to rfold example code

6 years agoalloc: Implement rfold for VecDeque iterators
Ulrik Sverdrup [Mon, 18 Sep 2017 19:52:13 +0000 (21:52 +0200)]
alloc: Implement rfold for VecDeque iterators

6 years agocore: Implement rfold for Map, Cloned, Chain
Ulrik Sverdrup [Mon, 18 Sep 2017 19:27:19 +0000 (21:27 +0200)]
core: Implement rfold for Map, Cloned, Chain

6 years agocore: Implement fold / rfold for Rev
Ulrik Sverdrup [Mon, 18 Sep 2017 19:24:33 +0000 (21:24 +0200)]
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.

6 years agocore: Add DoubleEndedIterator::rfold
Ulrik Sverdrup [Mon, 18 Sep 2017 19:19:58 +0000 (21:19 +0200)]
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.

6 years agocore: Small fix in fold docs
Ulrik Sverdrup [Mon, 18 Sep 2017 19:18:15 +0000 (21:18 +0200)]
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.

6 years agorustbuild: with --no-fail-fast, report the specific commands that failed
Ximin Luo [Mon, 18 Sep 2017 19:21:24 +0000 (21:21 +0200)]
rustbuild: with --no-fail-fast, report the specific commands that failed

6 years agoAuto merge of #44678 - alexcrichton:rollup, r=alexcrichton
bors [Mon, 18 Sep 2017 17:30:29 +0000 (17:30 +0000)]
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:

6 years agoAdd requested comment
Jacob Kiesel [Mon, 18 Sep 2017 16:15:17 +0000 (10:15 -0600)]
Add requested comment

6 years agoRollup merge of #44671 - GuillaumeGomez:run-button, r=steveklabnik
Alex Crichton [Mon, 18 Sep 2017 16:04:28 +0000 (11:04 -0500)]
Rollup merge of #44671 - GuillaumeGomez:run-button, r=steveklabnik

Fix run button

r? @QuietMisdreavus

Before:

![before](https://user-images.githubusercontent.com/3050060/30538927-612c6a44-9c70-11e7-9ca2-f3860d880b95.png)

After:

![after](https://user-images.githubusercontent.com/3050060/30538929-6416ea0e-9c70-11e7-990a-7e4fbf5d7319.png)

Quite urgent.

6 years agoRollup merge of #44668 - iwillspeak:into-iterator-docs, r=steveklabnik
Alex Crichton [Mon, 18 Sep 2017 16:04:27 +0000 (11:04 -0500)]
Rollup merge of #44668 - iwillspeak:into-iterator-docs, r=steveklabnik

Add Example of `IntoIterator` as Trait Bound to Docs

Part of #44600.

6 years agoRollup merge of #44661 - GuillaumeGomez:more-links, r=QuietMisdreavus
Alex Crichton [Mon, 18 Sep 2017 16:04:26 +0000 (11:04 -0500)]
Rollup merge of #44661 - GuillaumeGomez:more-links, r=QuietMisdreavus

Add more links and put the link character to the left

r? @QuietMisdreavus

And of course, a few screenshots:

<img width="1440" alt="screen shot 2017-09-17 at 22 08 46" src="https://user-images.githubusercontent.com/3050060/30524496-44a50208-9bf5-11e7-942e-a3707ba125c3.png">
<img width="1440" alt="screen shot 2017-09-17 at 22 09 47" src="https://user-images.githubusercontent.com/3050060/30524502-49068dbc-9bf5-11e7-8e59-ec38664e0e0f.png">
<img width="1440" alt="screen shot 2017-09-17 at 22 10 56" src="https://user-images.githubusercontent.com/3050060/30524503-491c8c34-9bf5-11e7-9ce5-f1bd5ef8600b.png">

6 years agoRollup merge of #44657 - Ixrec:patch-1, r=eddyb
Alex Crichton [Mon, 18 Sep 2017 16:04:25 +0000 (11:04 -0500)]
Rollup merge of #44657 - Ixrec:patch-1, r=eddyb

Replace str's transmute() calls with pointer casts

After the following conversation in #rust-lang:
```
[14:43:50] <Ixrec> TIL the implementation of from_utf_unchecked is literally just "mem::transmute(x)"
[14:43:59] <Ixrec> no wonder people keep saying transmute is overpowered
[15:15:30] <eddyb> Ixrec: it should be a pointer cast lol
[15:15:46] <eddyb> unless it doesn't let you
[16:50:34] <Ixrec> https://play.rust-lang.org/?gist=d1e6b629ad9ec1baf64ce261c63845e6&version=stable seems like it does let me
[16:52:35] <eddyb> Ixrec: yeah that's the preferred impl
[16:52:46] <eddyb> Ixrec: it just wasn't in 1.0
[16:52:50] <eddyb> IIRC
[16:53:00] <eddyb> (something something fat pointers)
```
Since I already wrote half of the preferred impls in the playground, might as well make an actual PR.

6 years agoRollup merge of #44651 - bluss:document-thread-name-no-nuls, r=steveklabnik
Alex Crichton [Mon, 18 Sep 2017 16:04:24 +0000 (11:04 -0500)]
Rollup merge of #44651 - bluss:document-thread-name-no-nuls, r=steveklabnik

Document thread builder panics for nul bytes in thread names

This seems to have been undocumented. Mention this where the name is set
(Builder::name) and where the panic could happen (Builder::spawn).

Thread::new is private and I think the builder is the only user where
this matters. A short comment was added to "document" Thread::new too.

6 years agoRollup merge of #44640 - budziq:stabilize_splice, r=dtolnay
Alex Crichton [Mon, 18 Sep 2017 16:04:23 +0000 (11:04 -0500)]
Rollup merge of #44640 - budziq:stabilize_splice, r=dtolnay

Stabilized vec_splice and modified splice tracking issue

This stabilizes the vec_splice (Vec part of splice RFC)
Fixes #32310.

6 years agoRollup merge of #44548 - oyvindln:rustc_help_fix, r=arielb1
Alex Crichton [Mon, 18 Sep 2017 16:04:22 +0000 (11:04 -0500)]
Rollup merge of #44548 - oyvindln:rustc_help_fix, r=arielb1

Add proper help line for `-C inline threshold`

Looks like someone accidentally some words when adding this.

This also remove a period on a different help line for consistency, as no options have a period.

6 years agoRollup merge of #44537 - oli-obk:memchr, r=alexcrichton
Alex Crichton [Mon, 18 Sep 2017 16:04:21 +0000 (11:04 -0500)]
Rollup merge of #44537 - oli-obk:memchr, r=alexcrichton

More `align_offset` things

cc #44488

6 years agoRollup merge of #44466 - clarcharr:cow_error, r=alexcrichton
Alex Crichton [Mon, 18 Sep 2017 16:04:20 +0000 (11:04 -0500)]
Rollup merge of #44466 - clarcharr:cow_error, r=alexcrichton

Add Cow<str> -> Box<Error> impls.

Considering how impls exist for `String` and `&str`, it makes sense to also add an impl for `Cow<str>` as well.

This would allow converting `String::from_utf8_lossy` directly into a `Box<Error>` or `io::Error` without having to add an extra `into_ownd()`.

6 years agoRollup merge of #44364 - michaelwoerister:hash-all-the-things2, r=nikomatsakis
Alex Crichton [Mon, 18 Sep 2017 16:04:19 +0000 (11:04 -0500)]
Rollup merge of #44364 - michaelwoerister:hash-all-the-things2, r=nikomatsakis

incr.comp.: Compute fingerprint for all query results.

This PR enables query result fingerprinting in incremental mode. This is an essential piece of infrastructure for red/green tracking. We don't do anything with the fingerprints yet but merging the infrastructure should protect it from bit-rotting and will make it easier to start measuring its performance impact (and thus let us determine if we should switch to a faster hashing algorithm rather sooner than later).

Note, this PR also includes the changes from https://github.com/rust-lang/rust/pull/43887 which I'm therefore closing. No need to re-review the first commit though.

r? @nikomatsakis

6 years agoFix run button
Guillaume Gomez [Mon, 18 Sep 2017 10:51:48 +0000 (12:51 +0200)]
Fix run button

6 years agoincr.comp.: Fix ICE caused by trying to hash INVALID_CRATE_NUM.
Michael Woerister [Mon, 18 Sep 2017 11:14:38 +0000 (13:14 +0200)]
incr.comp.: Fix ICE caused by trying to hash INVALID_CRATE_NUM.

6 years agoincr.comp.: Fix rebase fallout.
Michael Woerister [Mon, 18 Sep 2017 10:14:52 +0000 (12:14 +0200)]
incr.comp.: Fix rebase fallout.

6 years agoincr.comp.: Remove tcx from StableHashingContext.
Michael Woerister [Thu, 14 Sep 2017 13:10:24 +0000 (15:10 +0200)]
incr.comp.: Remove tcx from StableHashingContext.

6 years agoincr.comp.: Make the StableHashingContext mostly independent of the tcx.
Michael Woerister [Thu, 14 Sep 2017 12:01:40 +0000 (14:01 +0200)]
incr.comp.: Make the StableHashingContext mostly independent of the tcx.

6 years agoincr.comp.: Initialize IGNORED_ATTRS in StableHashingContext lazily.
Michael Woerister [Thu, 14 Sep 2017 10:29:16 +0000 (12:29 +0200)]
incr.comp.: Initialize IGNORED_ATTRS in StableHashingContext lazily.

6 years agoincr.comp.: Initialize the CachingCodemapView in StableHashingContext lazily.
Michael Woerister [Thu, 14 Sep 2017 10:08:03 +0000 (12:08 +0200)]
incr.comp.: Initialize the CachingCodemapView in StableHashingContext lazily.

6 years agoincr.comp.: Use StableHash impls instead of functions for hashing most maps.
Michael Woerister [Wed, 13 Sep 2017 16:20:27 +0000 (18:20 +0200)]
incr.comp.: Use StableHash impls instead of functions for hashing most maps.

6 years agoincr.comp.: Already hash HIR bodies during metadata export so they don't have to...
Michael Woerister [Wed, 13 Sep 2017 12:59:10 +0000 (14:59 +0200)]
incr.comp.: Already hash HIR bodies during metadata export so they don't have to be hashed in downstream crates.

6 years agoFix issues uncovered by rebasing:
Michael Woerister [Tue, 12 Sep 2017 15:07:09 +0000 (17:07 +0200)]
Fix issues uncovered by rebasing:

- Don't hash traits in scope as part of HIR hashing any more.
- Some queries returned DefIndexes from other crates.
- Provide a generic way of stably hashing maps (not used everywhere yet).

6 years agoincr.comp.: Move result fingerprinting to DepGraph::with_task().
Michael Woerister [Thu, 7 Sep 2017 14:11:58 +0000 (16:11 +0200)]
incr.comp.: Move result fingerprinting to DepGraph::with_task().

This makes sure that we don't introduce strange cases where we have
nodes outside the query system that could break red/green tracking
and it will allow to keep red/green neatly encapsulated within the
DepGraph implementation.

6 years agoincr.comp.: Compute hashes of all query results.
Michael Woerister [Mon, 14 Aug 2017 16:19:42 +0000 (18:19 +0200)]
incr.comp.: Compute hashes of all query results.

6 years agoUse DefId instead of NodeId as identifier in resolve_lifetime::Region.
Michael Woerister [Tue, 15 Aug 2017 15:05:25 +0000 (17:05 +0200)]
Use DefId instead of NodeId as identifier in resolve_lifetime::Region.

These Region values end up in crate metadata so they should not use NodeId.

6 years agoAuto merge of #44441 - tamird:cargo-bitflags, r=alexcrichton
bors [Mon, 18 Sep 2017 07:00:28 +0000 (07:00 +0000)]
Auto merge of #44441 - tamird:cargo-bitflags, r=alexcrichton

Remove rustc_bitflags; use the bitflags crate

r? @alexcrichton

6 years agoAdd Example of `IntoIterator` as Trait Bound to Docs
Will Speak [Mon, 18 Sep 2017 06:38:32 +0000 (07:38 +0100)]
Add Example of `IntoIterator` as Trait Bound to Docs

Part of #44600.

6 years agoAuto merge of #43628 - oli-obk:orbital_standard_library, r=alexcrichton
bors [Mon, 18 Sep 2017 01:50:29 +0000 (01:50 +0000)]
Auto merge of #43628 - oli-obk:orbital_standard_library, r=alexcrichton

Run the miri test suite on the aux builder and travis

Reopen of #38350

see https://github.com/rust-lang/rust/pull/43340#issuecomment-316940762 for earlier discussion

Rationale for running miri's test suite in rustc's CI is that miri currently contains many features that we want in const eval in the future, and these features would break if the test suite is not run.

fixes #44077

r? @nikomatsakis

cc @eddyb

6 years agoRemove st_mode mask
Trevor Merrifield [Sun, 17 Sep 2017 21:42:58 +0000 (17:42 -0400)]
Remove st_mode mask

6 years agoAdd test case for unix permissions
Trevor Merrifield [Sun, 17 Sep 2017 21:01:35 +0000 (17:01 -0400)]
Add test case for unix permissions

6 years agoAuto merge of #44529 - alexcrichton:trans-query, r=michaelwoerister
bors [Sun, 17 Sep 2017 22:05:31 +0000 (22:05 +0000)]
Auto merge of #44529 - alexcrichton:trans-query, r=michaelwoerister

Refactor translation unit partitioning/collection as a query

This commit is targeted at #44486 with the ultimate goal of making the `collect_and_partition_translation_items` function a query. This mostly just involved query-ifying a few other systems along with plumbing the tcx instead of `SharedCrateContext` in a few locations.

Currently this only tackles the first bullet of #44486 and doesn't add a dedicated query for a particular codegen unit. I wasn't quite sure how to do that yet but figured this was good to put up.

Closes #44486

6 years agoAdd more links and put the link character to the left
Guillaume Gomez [Sun, 17 Sep 2017 20:11:37 +0000 (22:11 +0200)]
Add more links and put the link character to the left

6 years agoRebase fallout
Oliver Schneider [Sun, 17 Sep 2017 19:45:54 +0000 (21:45 +0200)]
Rebase fallout

6 years agoUpdate miri submodule
Oliver Schneider [Sun, 17 Sep 2017 19:42:35 +0000 (21:42 +0200)]
Update miri submodule