Commit Graph

68078 Commits

Author SHA1 Message Date
Felix S. Klock II
d9d10c1628 Make mir-borrowck more closely match (draft) NLL RFC.
In particular:

 * introduce the shallow/deep distinction for read/write accesses

 * use the notions of prefixes, shallow prefixes, and supporting prefixes
   rather than trying to recreate the restricted sets from ast-borrowck.

 * Add shallow reads of Discriminant and ArrayLength, and treat them
   as artificial fields when doing prefix traversals.
2017-09-25 14:02:34 +02:00
Felix S. Klock II
c4c32b24bd More fine-grained delineation for mir-borrowck errors. 2017-09-25 13:02:17 +02:00
Ariel Ben-Yehuda
7bb0923e46 fix Debug impls 2017-09-25 13:47:19 +03:00
bors
dcb4378e18 Auto merge of #44646 - petrochenkov:scompress, r=michaelwoerister
Compress most of spans to 32 bits

As described in https://internals.rust-lang.org/t/rfc-compiler-refactoring-spans/1357/28

Closes https://github.com/rust-lang/rust/issues/15594
r? @michaelwoerister
2017-09-25 09:01:53 +00:00
David Tolnay
247b58b4f4
Allow unused extern crate again
This is a partial revert of #42588. There is a usability concern
reported in #44294 that was not considered in the discussion of the PR,
so I would like to back this out of 1.21. As is, I think users would
have a worse and more confusing experience with this lint enabled by
default. We can re-enabled once there are better diagnostics or the case
in #44294 does not trigger the lint.
2017-09-24 23:57:45 -07:00
bjorn3
843cd5bacc Fix error 2017-09-25 08:17:37 +02:00
bors
cd93969ec4 Auto merge of #44612 - pylaligand:magenta-to-zircon, r=alexcrichton
The Magenta kernel is now called Zircon.
2017-09-25 05:05:14 +00:00
James Tucker
a3aef1aa95 Fix fuchsia toolchain prebuild setup
* Adjust bootstrap to provide useful output on failure
 * Add missing package dependencies in the build environment
 * Fix permission bits on prebuilt toolchain files
2017-09-24 21:32:27 -07:00
bors
7a9cdc4c2a Auto merge of #44700 - arielb1:mir-effectck, r=nikomatsakis
Move effect-checking to MIR

This allows emitting lints from MIR and moves the effect-checking pass to work on it.

I'll make `repr(packed)` misuse unsafe in a separate PR.

r? @eddyb
2017-09-25 00:52:15 +00:00
James Tucker
d7a17fb3cf LP_CLONE_FDIO_ROOT is now LP_CLONE_FDIO_NAMESPACE 2017-09-24 14:31:50 -07:00
James Tucker
c481f85dc2 ensure that prebuilt toolchain binaries are +x 2017-09-24 13:55:55 -07:00
Petr Hosek
992e94ab3b Re-add CMake package
This appears to be needed by the Rust build.
2017-09-24 13:55:55 -07:00
Petr Hosek
1fdbfa9930 Use Zircon's Clang rather than building our own
This toolchain is already used to build Zircon itself and is the
official Clang toolchain used by all Fuchsia developers.
2017-09-24 13:55:55 -07:00
James Tucker
0ef87cc109 bump liblibc to 0.2.31 2017-09-24 13:53:11 -07:00
Petr Hosek
850c7cbbf1 Download clang-tools-extra as well 2017-09-24 13:53:10 -07:00
Petr Hosek
6c08208c31 Install unzip into Fuchsia Docker container 2017-09-24 13:53:10 -07:00
P.Y. Laligand
e98e674570 TODO --> FIXME 2017-09-24 13:53:10 -07:00
P.Y. Laligand
d0ff222d0f Update submodules. 2017-09-24 13:53:10 -07:00
Petr Hosek
ae0cf7fd5f Update Fuchsia toolchain build
compiler-rt is now being built as part of the toolchain itself.
2017-09-24 13:53:10 -07:00
P.Y. Laligand
20265ef3ac Updated Zircon version. 2017-09-24 13:53:10 -07:00
P.Y. Laligand
cc4e82fe7a Fixed casing issues. 2017-09-24 13:53:10 -07:00
P.Y. Laligand
de3bb916d8 Testing on Travis. 2017-09-24 13:53:10 -07:00
P.Y. Laligand
43cff131dd The Magenta kernel is now called Zircon. 2017-09-24 13:53:10 -07:00
bors
48c1c548e1 Auto merge of #44758 - arielb1:a-small-path, r=eddyb
put empty generic lists behind a pointer

This reduces the size of hir::Expr from 128 to 88 bytes (!) and shaves
200MB out of #36799.

This is a performance-sensitive PR so please don't roll it up.

r? @eddyb
2017-09-24 19:48:11 +00:00
Esteban Küber
ddee9fbc99 Point at parameter type on E0301
On "the parameter type `T` may not live long enough" error, point to the
parameter type suggesting lifetime bindings:

```
error[E0310]: the parameter type `T` may not live long enough
  --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
   |
27 | struct Foo<T> {
   |            - help: consider adding an explicit lifetime bound `T: 'static`...
28 |     foo: &'static T
   |     ^^^^^^^^^^^^^^^
   |
note: ...so that the reference type `&'static T` does not outlive the data it points at
  --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5
   |
28 |     foo: &'static T
   |     ^^^^^^^^^^^^^^^
```
2017-09-24 11:50:09 -07:00
Thomas Jespersen
4963394f86 Change Levensthein-based method to a single suggestion
The convention for suggesting close matches is to provide at most one match (the
closest one). Change the suggestions for misspelt method names to obey that.
2017-09-24 20:00:02 +02:00
Steven Fackler
81bac74c2d Add a run-pass-valgrind test for vecdeque issue 2017-09-24 10:56:08 -07:00
bors
1ed7d41d88 Auto merge of #44743 - arielb1:size-rollback, r=eddyb
typeck::check::coercion - roll back failed unsizing type vars

This wraps unsizing coercions within an additional level of
`commit_if_ok`, which rolls back type variables if the unsizing coercion
fails. This prevents a large amount of type-variables from accumulating
while type-checking a large function, e.g. shaving 2GB off one of the
4GB peaks in #36799.

This is a performance-sensitive PR so please don't roll it up.

r? @eddyb
cc @nikomatsakis
2017-09-24 15:41:13 +00:00
Ariel Ben-Yehuda
c10b23e2e0 encode region::Scope using fewer bytes
Now that region::Scope is no longer interned, its size is more
important. This PR encodes region::Scope in 8 bytes instead of 12, which
should speed up region inference somewhat (perf testing needed) and
should improve the margins on #36799 by 64MB (that's not a lot, I did
this PR mostly to speed up region inference).
2017-09-24 17:21:37 +03:00
Ariel Ben-Yehuda
8214ab1662 move Scope behind an enum 2017-09-24 16:13:54 +03:00
bors
647aecc281 Auto merge of #44807 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 4 pull requests

- Successful merges: #44103, #44625, #44789, #44795
- Failed merges:
2017-09-24 12:20:21 +00:00
Guillaume Gomez
a8a0ec2a28 Rollup merge of #44795 - KiChjang:mir-err-notes, r=arielb1
MIR borrowck: Add span labels for E0381 and E0505

Corresponds to `report_use_of_moved` and `report_move_out_when_borrowed`.

Part of #44596.
2017-09-24 14:01:52 +02:00
Guillaume Gomez
4e377081ca Rollup merge of #44789 - GuillaumeGomez:fix-rustdoc-display, r=QuietMisdreavus
Fix warning position in rustdoc code blocks

Before:

<img width="1440" alt="screen shot 2017-09-23 at 14 07 08" src="https://user-images.githubusercontent.com/3050060/30773382-b9649288-a06f-11e7-94ec-faa3c3ed999b.png">

After:

<img width="1440" alt="screen shot 2017-09-23 at 14 58 31" src="https://user-images.githubusercontent.com/3050060/30773384-bdfc9f3e-a06f-11e7-9030-9fb8a5308668.png">

r? @QuietMisdreavus
2017-09-24 14:01:51 +02:00
Guillaume Gomez
b1a1861d60 Rollup merge of #44625 - frewsxcv:frewsxcv-raii-stdin, r=QuietMisdreavus
Indicate how ChildStd{in,out,err} FDs are closed.

Fixes https://github.com/rust-lang/rust/issues/41452.
2017-09-24 14:01:50 +02:00
Guillaume Gomez
8a25ec019e Rollup merge of #44103 - zackmdavis:cmp_op_must_use, r=arielb1
add comparison operators to must-use lint (under `fn_must_use` feature)

Although RFC 1940 is about annotating functions with `#[must_use]`, a
key part of the motivation was linting unused equality operators.

(See
https://github.com/rust-lang/rfcs/pull/1812#issuecomment-265695898—it
seems to have not been clear to discussants at the time that marking the
comparison methods as `must_use` would not give us the lints on
comparison operators, at least in (what the present author understood
as) the most straightforward implementation, as landed in #43728
(3645b062).)

To rectify the situation, we here lint unused comparison operators as
part of the unused-must-use lint (feature gated by the `fn_must_use`
feature flag, which now arguably becomes a slight (tolerable in the
opinion of the present author) misnomer).

This is in the matter of #43302.

cc @crumblingstatue
2017-09-24 14:01:49 +02:00
Ariel Ben-Yehuda
b6bce56ac7 sort the list of inference errors by span
this should produce more error stability
2017-09-24 13:45:19 +03:00
Ariel Ben-Yehuda
516534ffdf fix test 2017-09-24 13:15:18 +03:00
Ariel Ben-Yehuda
b408144dbe remove test code accidentally checked in 2017-09-24 12:46:00 +03:00
Ariel Ben-Yehuda
9c4898eadd address review comments 2017-09-24 12:46:00 +03:00
Ariel Ben-Yehuda
c72a979979 move unsafety checking to MIR
No functional changes intended.
2017-09-24 12:46:00 +03:00
Ariel Ben-Yehuda
8c7500f9b6 add lint levels to VisibilityScope 2017-09-24 12:46:00 +03:00
Ariel Ben-Yehuda
9d6b9d62ba typeck::check::coercion - roll back failed unsizing type vars
This wraps unsizing coercions within an additional level of
`commit_if_ok`, which rolls back type variables if the unsizing coercion
fails. This prevents a large amount of type-variables from accumulating
while type-checking a large function, e.g. shaving 2GB off one of the
4GB peaks in #36799.
2017-09-24 12:40:29 +03:00
Ariel Ben-Yehuda
e921b32be3 put empty generic lists behind a pointer
This reduces the size of hir::Expr from 128 to 88 bytes (!) and shaves
200MB out of #36799.
2017-09-24 12:34:21 +03:00
bors
6f9078745e Auto merge of #44786 - thombles:tk/i41314, r=petrochenkov
Improve diagnostics when attempting to match tuple enum variant with struct pattern

Adds an extra note as below to explain that a tuple pattern was probably intended.

```
error[E0026]: variant `X::Y` does not have a field named `data`
  --> src/main.rs:18:16
   |
18 |         X::Y { data } => println!("The data is {}", data)
   |                ^^^^ variant `X::Y` does not have field `data`

error[E0027]: pattern does not mention field `0`
  --> src/main.rs:18:9
   |
18 |         X::Y { data } => println!("The data is {}", data)
   |         ^^^^^^^^^^^^^ missing field `0`
   |
   = note: trying to match a tuple variant with a struct variant pattern
```

Fixes #41314.
2017-09-24 09:02:19 +00:00
Keith Yeung
ed59a868dd Add span labels for E0505 for MIR borrowck 2017-09-23 23:44:51 -07:00
Steven Fackler
9733463d2b Fix capacity comparison in reserve
You can otherwise end up in a situation where you don't actually resize
but still call into handle_cap_increase which then corrupts head/tail.

Closes #44800
2017-09-23 21:19:01 -07:00
bors
acb73dbe8b Auto merge of #44772 - michaelwoerister:new-graph, r=nikomatsakis
incr.comp.: Add new DepGraph implementation.

This commits does a few things:
1. It adds the new dep-graph implementation -- *in addition* to the old one. This way we can start testing the new implementation without switching all tests at once.
2. It persists the new dep-graph (which includes query result fingerprints) to the incr. comp. caching directory and also loads this data.
3. It removes support for loading fingerprints of metadata imported from other crates (except for when running autotests). This is not needed anymore with red/green. It could provide a performance advantage but that's yet to be determined. For now, as red/green is not fully implemented yet, the cross-crate incremental tests are disabled.

Note, this PR is based on top of soon-to-be-merged #44696 and only the last 4 commits are new:
```
- incr.comp.: Initial implemenation of append-only dep-graph. (c90147c)
- incr.comp.: Do some various cleanup. (8ce20c5)
- incr.comp.: Serialize and deserialize new DepGraph. (0e13c1a)
- incr.comp.: Remove support for loading metadata fingerprints. (270a134)
EDIT 2:
- incr.comp.: Make #[rustc_dirty/clean] test for fingerprint equality ... (d8f7ff9)
```
(EDIT: GH displays the commits in the wrong order for some reason)

Also note that this PR is expected to certainly result in performance regressions in the incr. comp. test cases, since we are adding quite a few things (a whole additional dep-graph, for example) without removing anything. End-to-end performance measurements will only make sense again after red/green is enabled and all the legacy tracking has been turned off.

EDIT 2: Pushed another commit that makes the `#[rustc_dirty]`/`#[rustc_clean]` based autotests compared query result fingerprints instead of testing `DepNode` existence.
2017-09-24 03:55:23 +00:00
bors
24831c7221 Auto merge of #44436 - MicroJoe:master, r=alexcrichton
Add Duration::from_micros

This fixes #44400 that explains why it could be useful for embedded designs timing.
2017-09-23 22:21:32 +00:00
Ben Cressey
f94bd36fd1 add aarch64-unknown-linux-musl target
Signed-off-by: Ben Cressey <bcressey@amazon.com>
Signed-off-by: Tom Kirchner <tjk@amazon.com>
2017-09-23 14:46:33 -07:00
Clar Charr
1c589b7a51 TrustedRandomAccess specialisation for Cloned.
This verifies that TrustedRandomAccess has no side effects when the
iterator item implements Copy. This also implements TrustedLen and
TrustedRandomAccess for str::Bytes.
2017-09-23 15:30:53 -04:00