Commit Graph

67876 Commits

Author SHA1 Message Date
Badel2
7aabf57278 Add information about the syntax used in ranges
... or ..=
2017-09-22 22:05:18 +02:00
Badel2
4737c5a068 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
2017-09-22 22:05:18 +02:00
Alex Burka
e64efc91f4 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
2017-09-22 22:05:18 +02:00
bors
3eb19bf9b1 Auto merge of #44691 - cramertj:underscore-lifetimes, r=nikomatsakis
Implement underscore lifetimes

Part of https://github.com/rust-lang/rust/issues/44524
2017-09-22 14:05:16 +00:00
bors
ee409a489e 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
2017-09-22 10:30:20 +00:00
bors
0962b8fe4f 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 e788fa7b6c, 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.
2017-09-22 05:01:41 +00:00
bors
17600c1ea7 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.
2017-09-21 23:44:11 +00:00
bors
17f56c549c 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.
2017-09-21 20:12:22 +00:00
Marcus Buffett
5463aa06b8 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
2017-09-21 12:15:10 -07:00
Taylor Cramer
f5505d185c Add tests for underscore lifetimes in impl headers and struct definitions 2017-09-21 10:19:12 -07:00
Taylor Cramer
06926b6298 Add tests for multiple underscore and non-underscore lifetimes 2017-09-21 10:19:12 -07:00
Taylor Cramer
f64af7a32e Refactor lifetime name into an enum 2017-09-21 10:19:03 -07:00
bors
1b55d19479 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"
2017-09-21 13:33:58 +00:00
bors
35edf7d8cb 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.
2017-09-21 09:41:26 +00:00
Taylor Cramer
64314e3ae2 Implement underscore lifetimes 2017-09-20 23:45:05 -07:00
bors
e2504cfc76 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...
2017-09-21 00:35:33 +00:00
bors
870483a57f 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.
2017-09-20 21:26:15 +00:00
scalexm
3fa3fe01b6 Fix ICE 2017-09-20 20:48:06 +02:00
scalexm
f7964aebe5 Implement Copy/Clone for closures 2017-09-20 20:43:41 +02:00
bors
01c65cb15a 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
2017-09-20 14:50:31 +00:00
Ariel Ben-Yehuda
2384dd92dc rebase fixup 2017-09-20 17:28:49 +03:00
Ariel Ben-Yehuda
018525ea70 address review comments 2017-09-20 16:49:21 +03:00
Ariel Ben-Yehuda
5c0feb86b9 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.
2017-09-20 16:36:24 +03:00
John Kåre Alsaker
0bb3dc19bf Mark yields after visiting subexpressions. Never ignore yields for scopes in bindings. 2017-09-20 16:36:24 +03:00
John Kåre Alsaker
0bf7b55158 Remove debug statements 2017-09-20 16:36:24 +03:00
John Kåre Alsaker
dba2ca888a Sanity check the Expr visitation count 2017-09-20 16:36:24 +03:00
John Kåre Alsaker
3a511e06a5 Only consider yields coming after the expressions when computing generator interiors 2017-09-20 16:36:24 +03:00
John Kåre Alsaker
1e6ec9f33a Fix HIR printing of yield 2017-09-20 16:36:23 +03: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
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
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
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
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