]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoRollup merge of #44776 - spastorino:add_forge, r=nikomatsakis
Corey Farwell [Sat, 23 Sep 2017 04:29:22 +0000 (00:29 -0400)]
Rollup merge of #44776 - spastorino:add_forge, r=nikomatsakis

Link to Rust forge from CONTRIBUTING.md

6 years agoRollup merge of #44773 - GuillaumeGomez:arc-docs, r=@QuietMisdreavus
Corey Farwell [Sat, 23 Sep 2017 04:29:21 +0000 (00:29 -0400)]
Rollup merge of #44773 - GuillaumeGomez:arc-docs, r=@QuietMisdreavus

Add missing links for Arc

r? @rust-lang/docs

6 years agoRollup merge of #44770 - dtolnay:borrowed, r=sfackler
Corey Farwell [Sat, 23 Sep 2017 04:29:20 +0000 (00:29 -0400)]
Rollup merge of #44770 - dtolnay:borrowed, r=sfackler

Less confusing placeholder when RefCell is exclusively borrowed

Based on ExpHP's comment in [*RefCell.borrow_mut get strange result*](https://users.rust-lang.org/t/refcell-borrow-mut-get-strange-result/12994):

> it would perhaps be nicer if it didn't put something that could be misinterpreted as a valid string value

The previous Debug implementation would show:

    RefCell { value: "<borrowed>" }

The new one is:

    RefCell { value: <borrowed> }

6 years agoRollup merge of #44759 - durka:patch-43, r=steveklabnik
Corey Farwell [Sat, 23 Sep 2017 04:29:19 +0000 (00:29 -0400)]
Rollup merge of #44759 - durka:patch-43, r=steveklabnik

improve english in create_dir_all docs

Just minor nitpicking.

6 years agoRollup merge of #44749 - zilbuz:issue-44596/E0503, r=pnkfelix
Corey Farwell [Sat, 23 Sep 2017 04:29:18 +0000 (00:29 -0400)]
Rollup merge of #44749 - zilbuz:issue-44596/E0503, r=pnkfelix

MIR-borrowck: Adding notes to E0503

This PR adds notes to the MIR borrowck error E0503.

Part of #44596

6 years agoRollup merge of #44746 - topecongiro:span-for-unary, r=petrochenkov
Corey Farwell [Sat, 23 Sep 2017 04:29:17 +0000 (00:29 -0400)]
Rollup merge of #44746 - topecongiro:span-for-unary, r=petrochenkov

Include unary operator to span for ExprKind::Unary

6 years agoRollup merge of #44745 - alexcrichton:no-delim-none, r=estebank
Corey Farwell [Sat, 23 Sep 2017 04:29:16 +0000 (00:29 -0400)]
Rollup merge of #44745 - alexcrichton:no-delim-none, r=estebank

rustc: Don't use DelimToken::None if possible

This commit fixes a regression from #44601 where lowering attribute to HIR now
involves expanding interpolated tokens to their actual tokens. In that commit
all interpolated tokens were surrounded with a `DelimToken::None` group of
tokens, but this ended up causing regressions like #44730 where the various
attribute parsers in `syntax/attr.rs` weren't ready to cope with
`DelimToken::None`. Instead of fixing the parser in `attr.rs` this commit
instead opts to just avoid the `DelimToken::None` in the first place, ensuring
that the token stream should look the same as it did before where possible.

Closes #44730

6 years agoRollup merge of #44726 - mattico:patch-3, r=eddyb
Corey Farwell [Sat, 23 Sep 2017 04:29:15 +0000 (00:29 -0400)]
Rollup merge of #44726 - mattico:patch-3, r=eddyb

Fix librustc/README.md diagram

6 years agoRollup merge of #44717 - pnkfelix:debugflags-borrowckmir-implies-emitendregions,...
Corey Farwell [Sat, 23 Sep 2017 04:29:14 +0000 (00:29 -0400)]
Rollup merge of #44717 - pnkfelix:debugflags-borrowckmir-implies-emitendregions, r=arielb1

Make `-Z borrowck-mir` imply that `EndRegion`'s should be emitted.

Before this change, the `-Z borrowck-mir` flag is useless if you do not also pass `-Z emit-end-regions`.

So, in the same spirit as f2892ad281cb11421ebae741d698e0af14d3ecf6, make `-Z borrowck-mir` also emit `EndRegion` statements. (This will hopefully avoid some initial speed bumps for new-comers helping out with NLL.)

6 years agoRollup merge of #44712 - oconnor663:copy_test, r=GuillaumeGomez
Corey Farwell [Sat, 23 Sep 2017 04:29:13 +0000 (00:29 -0400)]
Rollup merge of #44712 - oconnor663:copy_test, r=GuillaumeGomez

fix an incorrect assertion in the doc example for `std::io::copy`

I think this wasn't caught by CI because the `foo` wrapper function was only defined and not called. This seems to be the norm for doc examples that define a `foo` function. Is that on purpose?

6 years agoRollup merge of #44658 - leodasvacas:remove-str-eq-lang-item, r=arielb1
Corey Farwell [Sat, 23 Sep 2017 04:29:11 +0000 (00:29 -0400)]
Rollup merge of #44658 - leodasvacas:remove-str-eq-lang-item, r=arielb1

Remove str_eq lang item

It's not really a lang item. Also remove outdated note. The reference uses this as an example so it has to be updated.

6 years agoRollup merge of #44648 - Havvy:doc-size_of, r=dtolnay
Corey Farwell [Sat, 23 Sep 2017 04:29:10 +0000 (00:29 -0400)]
Rollup merge of #44648 - Havvy:doc-size_of, r=dtolnay

Expand size_of docs

This PR does 3 things.

1. Adds a description of what pointer size means to the primitive pages for usize and isize.
2. Says the general size of things is not stable from compiler to compiler.
3. Adds a table of sizes of things that we do guarantee. As this is the first table in the libstd docs, I've included a picture of how that looks.

![](https://i.imgur.com/YZ6IChH.png?1)

6 years agoRollup merge of #44554 - GuillaumeGomez:add-missing-pub, r=QuietMisdreavus
Corey Farwell [Sat, 23 Sep 2017 04:29:09 +0000 (00:29 -0400)]
Rollup merge of #44554 - GuillaumeGomez:add-missing-pub, r=QuietMisdreavus

Add pub visibility for methods as well

Fixes #44527.

r? @QuietMisdreavus

6 years agoAuto merge of #44720 - est31:master, r=alexcrichton
bors [Fri, 22 Sep 2017 22:24:23 +0000 (22:24 +0000)]
Auto merge of #44720 - est31:master, r=alexcrichton

Use SHA512 for signatures

Fixes #44714 . Untested but I hope it works... r? @alexcrichton

6 years agoexpand text, make link to forge more prominent
Niko Matsakis [Fri, 22 Sep 2017 20:27:55 +0000 (16:27 -0400)]
expand text, make link to forge more prominent

6 years agoLink to Rust forge from CONTRIBUTING.md
Santiago Pastorino [Fri, 22 Sep 2017 20:10:51 +0000 (17:10 -0300)]
Link to Rust forge from CONTRIBUTING.md

6 years agoAuto merge of #44696 - michaelwoerister:fingerprints-in-dep-graph-3, r=nikomatsakis
bors [Fri, 22 Sep 2017 17:24:29 +0000 (17:24 +0000)]
Auto merge of #44696 - michaelwoerister:fingerprints-in-dep-graph-3, r=nikomatsakis

incr.comp.: Move task result fingerprinting into DepGraph.

This PR
- makes the DepGraph store all `Fingerprints` of task results,
- allows `DepNode` to be marked as input nodes,
- makes HIR node hashing use the regular fingerprinting infrastructure,
- removes the now unused `IncrementalHashesMap`, and
- makes sure that `traits_in_scope_map` fingerprints are stable.

r? @nikomatsakis
cc @alexcrichton

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 agoAdd missing links for Arc
Guillaume Gomez [Fri, 22 Sep 2017 13:45:37 +0000 (15:45 +0200)]
Add missing links for Arc

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 agoLess confusing placeholder when RefCell is exclusively borrowed
David Tolnay [Fri, 22 Sep 2017 04:52:59 +0000 (21:52 -0700)]
Less confusing placeholder when RefCell is exclusively borrowed

Based on ExpHP's comment in
https://users.rust-lang.org/t/refcell-borrow-mut-get-strange-result/12994

> it would perhaps be nicer if it didn't put something that could be
> misinterpreted as a valid string value

The previous Debug implementation would show:

    RefCell { value: "<borrowed>" }

The new one is:

    RefCell { value: <borrowed> }

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 agoimprove english in create_dir_all docs
Alex Burka [Thu, 21 Sep 2017 20:31:39 +0000 (16:31 -0400)]
improve english in create_dir_all docs

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 agoInclude unary operator to span for ExprKind::Unary
Seiichi Uchida [Thu, 21 Sep 2017 16:19:34 +0000 (01:19 +0900)]
Include unary operator to span for ExprKind::Unary

6 years agorustc: Don't use DelimToken::None if possible
Alex Crichton [Thu, 21 Sep 2017 15:13:25 +0000 (08:13 -0700)]
rustc: Don't use DelimToken::None if possible

This commit fixes a regression from #44601 where lowering attribute to HIR now
involves expanding interpolated tokens to their actual tokens. In that commit
all interpolated tokens were surrounded with a `DelimToken::None` group of
tokens, but this ended up causing regressions like #44730 where the various
attribute parsers in `syntax/attr.rs` weren't ready to cope with
`DelimToken::None`. Instead of fixing the parser in `attr.rs` this commit
instead opts to just avoid the `DelimToken::None` in the first place, ensuring
that the token stream should look the same as it did before where possible.

Closes #44730

6 years agomir-borrowck: Add FIXME comment to report name of field instead of index at a later...
Basile Desloges [Thu, 21 Sep 2017 14:33:41 +0000 (16:33 +0200)]
mir-borrowck: Add FIXME comment to report name of field instead of index at a later date

6 years agomir-borrowck: Add span labels to `report_use_while_mutably_borrowed()`
Basile Desloges [Thu, 21 Sep 2017 14:31:34 +0000 (16:31 +0200)]
mir-borrowck: Add span labels to `report_use_while_mutably_borrowed()`

6 years agomir-borrowck: Add borrow data parameter to `report_use_while_mutably_borrowed()`
Basile Desloges [Thu, 21 Sep 2017 14:29:54 +0000 (16:29 +0200)]
mir-borrowck: Add borrow data parameter to `report_use_while_mutably_borrowed()`

6 years agomir-borrowck: Add method to MIR borrowck context to retrieve the span of a given...
Basile Desloges [Thu, 21 Sep 2017 14:13:03 +0000 (16:13 +0200)]
mir-borrowck: Add method to MIR borrowck context to retrieve the span of a given borrow

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 agoDocument stable size_of primitives and pointer size guarantees
Havvy [Sun, 17 Sep 2017 03:40:05 +0000 (20:40 -0700)]
Document stable size_of primitives and pointer size guarantees

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 librusc/README.md diagram
Matt Ickstadt [Wed, 20 Sep 2017 19:08:30 +0000 (14:08 -0500)]
Fix librusc/README.md diagram

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 agoUse SHA512 for signatures
est31 [Wed, 20 Sep 2017 15:25:56 +0000 (17:25 +0200)]
Use SHA512 for signatures

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 agoMake `-Z borrowck-mir` imply that `EndRegion`'s should be emitted.
Felix S. Klock II [Wed, 20 Sep 2017 13:25:44 +0000 (15:25 +0200)]
Make `-Z borrowck-mir` imply that `EndRegion`'s should be emitted.

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 agoincr.comp.: Add some comments.
Michael Woerister [Tue, 19 Sep 2017 10:13:09 +0000 (12:13 +0200)]
incr.comp.: Add some comments.

6 years agoincr.comp.: Remove IncrementalHashesMap and calculate_svh module.
Michael Woerister [Mon, 18 Sep 2017 16:03:09 +0000 (18:03 +0200)]
incr.comp.: Remove IncrementalHashesMap and calculate_svh module.

6 years agoincr.comp.: Store result fingerprints in DepGraph.
Michael Woerister [Thu, 14 Sep 2017 15:43:03 +0000 (17:43 +0200)]
incr.comp.: Store result fingerprints in DepGraph.

6 years agoincr.comp.: Allow for marking DepKinds as inputs.
Michael Woerister [Thu, 14 Sep 2017 15:42:12 +0000 (17:42 +0200)]
incr.comp.: Allow for marking DepKinds as inputs.

6 years agoincr.comp.: Make sure traits_in_scope results are hashed in a stable way.
Michael Woerister [Thu, 14 Sep 2017 15:40:37 +0000 (17:40 +0200)]
incr.comp.: Make sure traits_in_scope results are hashed in a stable way.

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 agofix an incorrect assertion in the doc example for `std::io::copy`
Jack O'Connor [Wed, 20 Sep 2017 05:25:47 +0000 (01:25 -0400)]
fix an incorrect assertion in the doc example for `std::io::copy`

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 agoAdd pub visibility for methods as well
Guillaume Gomez [Wed, 13 Sep 2017 22:20:04 +0000 (00:20 +0200)]
Add pub visibility for methods as well

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: