Commit Graph

60907 Commits

Author SHA1 Message Date
Niko Matsakis
4f5fc4e242 fix case where some edges can't be recreated by expanding the graph
cc #39569 -- almost certainly a fix for that
2017-02-06 10:20:23 -05:00
Niko Matsakis
b9757863df regr test 2017-02-06 09:37:32 -05:00
Niko Matsakis
b3096e25c0 pacify the mercilous tidy, improve cycle unit test 2017-02-04 06:09:19 -05:00
Niko Matsakis
7abab8aee0 add a comment about optimality that somehow got removed 2017-02-03 12:42:18 -05:00
Niko Matsakis
afbf6c8246 s/in_index/input_index/ 2017-02-03 06:09:47 -05:00
Niko Matsakis
ef9ae8581f make dirty process O(dirty)
The old algorithm was O(graph)
2017-02-03 06:08:27 -05:00
Niko Matsakis
d848f1d782 rewrite the predecessors code to create a reduced graph
The old code created a flat listing of "HIR -> WorkProduct" edges.
While perfectly general, this could lead to a lot of repetition if the
same HIR nodes affect many work-products. This is set to be a problem
when we start to skip typeck, since we will be adding a lot more
"work-product"-like nodes.

The newer code uses an alternative strategy: it "reduces" the graph
instead. Basically we walk the dep-graph and convert it to a DAG, where
we only keep intermediate nodes if they are used by multiple
work-products.

This DAG does not contain the same set of nodes as the original graph,
but it is guaranteed that (a) every output node is included in the graph
and (b) the set of input nodes that can reach each output node is
unchanged.

(Input nodes are basically HIR nodes and foreign metadata; output nodes
are nodes that have assocaited state which we will persist to disk in
some way. These are assumed to be disjoint sets.)
2017-01-31 12:07:31 -05:00
bors
55f9712d14 Auto merge of #39407 - GuillaumeGomez:convert_module, r=frewsxcv
Add missing url in convert module

r? @frewsxcv
2017-01-30 13:16:57 +00:00
bors
c8699376cd Auto merge of #39405 - tshepang:nits, r=sfackler
doc: minor Option improvements
2017-01-30 06:45:13 +00:00
Tshepang Lekhonkhobe
4814fa488e doc: minor Option improvements 2017-01-30 08:39:03 +02:00
bors
15ad83f1d9 Auto merge of #39389 - Wilfred:patch-2, r=apasel422
Minor grammar fix 'can not' -> 'cannot'

The previous version suggested that the compiler chooses not to check, rather than being unable to check.
2017-01-30 02:47:06 +00:00
bors
4ef2c3e075 Auto merge of #39392 - ishitatsuyuki:master, r=alexcrichton
Bootstrap: append libjemalloc_pic.a

Fix #35349
2017-01-30 00:17:57 +00:00
Guillaume Gomez
19c9f18b2c Add missing url in convert module 2017-01-29 23:33:12 +01:00
bors
d01e22e53f Auto merge of #39382 - cuviper:ibm-rewind, r=alexcrichton
travis: move IBM backwards in time

Using Ubuntu's cross-toolchains for powerpc* and s390x meant they were
depending on glibc symbols from Ubuntu 16.04. And if that host is ever
updated to a new release, the toolchains would raise the bar too.

This switches powerpc, powerpc64, and s390x to use crosstool-ng
toolchains, configured approximately like RHEL6 with kernel 2.6.32 and
glibc 2.12. This ABI level should also be compatible with Debian 7
(wheezy) and Ubuntu 12.04 (precise).

For powerpc64le, the challenge was that only glibc-2.19 officially added
support, but RHEL7 backported those changes to glibc-2.17. The backport
patches are complex and numerous, so instead of trying to push those
into crosstool-ng, this just uses glibc binaries directly from CentOS 7
and builds the toolchain manually.

This is ported from rust-lang/rust-buildbot#149.

r? @alexcrichton
2017-01-29 21:28:28 +00:00
Tatsuyuki Ishi
149242e519 Bootstrap: append libjemalloc_pic.a
Fix #35349
2017-01-29 20:35:11 +09:00
Wilfred Hughes
87bbb3c738 Minor grammar fix 'can not' -> 'cannot'
The previous version suggested that the compiler chooses not to check, rather than being unable to check.
2017-01-29 10:51:26 +00:00
bors
4be49e1937 Auto merge of #39378 - jtxx000:master, r=eddyb
Fix typo in librustc_trans/collector.rs
2017-01-29 09:05:53 +00:00
bors
b37edea656 Auto merge of #39380 - est31:remove_dead_peq, r=jseyfried
Remove dead recursive partial eq impl

Its nowhere used (if it had been used used, the rust stack would have overflown
due to the recursion). Its presence was confusing for mrustc.

cc @thepowersgang
2017-01-29 06:20:33 +00:00
Josh Stone
cb47d9ffc3 Fix the powerpc64 PATH 2017-01-28 22:02:49 -08:00
Josh Stone
c051d2c8ad Add a license to build-powerpc64le-toolchain.sh 2017-01-28 21:41:35 -08:00
Josh Stone
23e8f70b46 travis: move IBM backwards in time
Using Ubuntu's cross-toolchains for powerpc* and s390x meant they were
depending on glibc symbols from Ubuntu 16.04. And if that host is ever
updated to a new release, the toolchains would raise the bar too.

This switches powerpc, powerpc64, and s390x to use crosstool-ng
toolchains, configured approximately like RHEL6 with kernel 2.6.32 and
glibc 2.12. This ABI level should also be compatible with Debian 7
(wheezy) and Ubuntu 12.04 (precise).

For powerpc64le, the challenge was that only glibc-2.19 officially added
support, but RHEL7 backported those changes to glibc-2.17. The backport
patches are complex and numerous, so instead of trying to push those
into crosstool-ng, this just uses glibc binaries directly from CentOS 7
and builds the toolchain manually.

This is ported from rust-lang/rust-buildbot#149.

r? @alexcrichton
2017-01-28 21:25:11 -08:00
est31
7ed78fcbdf Remove dead recursive partial eq impl
Its nowhere used (if it had been used used, the rust stack would have overflown
due to the recursion). Its presence was confusing for mrustc.
2017-01-29 06:07:45 +01:00
Caleb Reach
7e73884941 Fix typo in librustc_trans/collector.rs 2017-01-28 23:02:31 -05:00
bors
f39f273826 Auto merge of #39375 - seeekr:patch-1, r=apasel422
Fix typo in liballoc/lib.rs
2017-01-28 23:14:22 +00:00
Denis Andrejew
339bdc158f Fix typo in liballoc/lib.rs 2017-01-28 22:16:16 +00:00
bors
1491e04259 Auto merge of #39234 - segevfiner:fix-backtraces-on-windows-gnu, r=petrochenkov
Make backtraces work on Windows GNU targets again.

This is done by adding a function that can return a filename
to pass to backtrace_create_state. The filename is obtained in
a safe way by first getting the filename, locking the file so it can't
be moved, and then getting the filename again and making sure it's the same.

See: https://github.com/rust-lang/rust/pull/37359#issuecomment-260123399
Issue: #33985

Note though that this isn't that pretty...

I had to implement a `WideCharToMultiByte` wrapper function to convert to the ANSI code page. This will work better than only allowing ASCII provided that the ANSI code page is set to the user's local language, which is often the case.

Also, please make sure that I didn't break the Unix build.
2017-01-28 20:32:56 +00:00
Segev Finer
ab21314c3f Disable backtrace tests on i686-pc-windows-gnu since it's broken by FPO 2017-01-28 21:52:31 +02:00
bors
c81c1d6a41 Auto merge of #39360 - osa1:typos, r=GuillaumeGomez
Fix typos in libsyntax/tokenstream.rs
2017-01-28 14:13:00 +00:00
Ömer Sinan Ağacan
15411fb0fa Fix typos in libsyntax/tokenstream.rs 2017-01-28 17:00:43 +03:00
bors
010c3e25c4 Auto merge of #39340 - GuillaumeGomez:empty_comment, r=frewsxcv
Don't generate doc if doc comments only filled with 'white' characters

Fixes #39339.

r? @steveklabnik

cc @rust-lang/docs
2017-01-28 09:41:40 +00:00
bors
0f49616a53 Auto merge of #39305 - eddyb:synelide, r=nikomatsakis
Perform lifetime elision (more) syntactically, before type-checking.

The *initial* goal of this patch was to remove the (contextual) `&RegionScope` argument passed around `rustc_typeck::astconv` and allow converting arbitrary (syntactic) `hir::Ty` to (semantic) `Ty`.
I've tried to closely match the existing behavior while moving the logic to the earlier `resolve_lifetime` pass, and [the crater report](https://gist.github.com/eddyb/4ac5b8516f87c1bfa2de528ed2b7779a) suggests none of the changes broke real code, but I will try to list everything:

There are few cases in lifetime elision that could trip users up due to "hidden knowledge":
```rust
type StaticStr = &'static str; // hides 'static
trait WithLifetime<'a> {
    type Output; // can hide 'a
}

// This worked because the type of the first argument contains
// 'static, although StaticStr doesn't even have parameters.
fn foo(x: StaticStr) -> &str { x }

// This worked because the compiler resolved the argument type
// to <T as WithLifetime<'a>>::Output which has the hidden 'a.
fn bar<'a, T: WithLifetime<'a>>(_: T::Output) -> &str { "baz" }
```

In the two examples above, elision wasn't using lifetimes that were in the source, not even *needed* by paths in the source, but rather *happened* to be part of the semantic representation of the types.
To me, this suggests they should have never worked through elision (and they don't with this PR).

Next we have an actual rule with a strange result, that is, the return type here elides to `&'x str`:
```rust
impl<'a, 'b> Trait for Foo<'a, 'b> {
    fn method<'x, 'y>(self: &'x Foo<'a, 'b>, _: Bar<'y>) -> &str {
        &self.name
    }
}
```
All 3 of `'a`, `'b` and `'y` are being ignored, because the `&self` elision rule only cares that the first argument is "`self` by reference". Due implementation considerations (elision running before typeck), I've limited it in this PR to a reference to a primitive/`struct`/`enum`/`union`, but not other types, but I am doing another crater run to assess the impact of limiting it to literally `&self` and `self: &Self` (they're identical in HIR).

It's probably ideal to keep an "implicit `Self` for `self`" type around and *only* apply the rule to `&self` itself, but that would result in more bikeshed, and #21400 suggests some people expect otherwise.
Another decent option is treating `self: X, ... -> Y` like `X -> Y` (one unique lifetime in `X` used for `Y`).

The remaining changes have to do with "object lifetime defaults" (see RFCs [599](https://github.com/rust-lang/rfcs/blob/master/text/0599-default-object-bound.md) and [1156](https://github.com/rust-lang/rfcs/blob/master/text/1156-adjust-default-object-bounds.md)):
```rust
trait Trait {}
struct Ref2<'a, 'b, T: 'a+'b>(&'a T, &'b T);

// These apply specifically within a (fn) body,
// which allows type and lifetime inference:
fn main() {
    // Used to be &'a mut (Trait+'a) - where 'a is one
    // inference variable - &'a mut (Trait+'b) in this PR.
    let _: &mut Trait;

    // Used to be an ambiguity error, but in this PR it's
    // Ref2<'a, 'b, Trait+'c> (3 inference variables).
    let _: Ref2<Trait>;
}
```
What's happening here is that inference variables are created on the fly by typeck whenever a lifetime has no resolution attached to it - while it would be possible to alter the implementation to reuse inference variables based on decisions made early by `resolve_lifetime`, not doing that is more flexible and works better - it can compile all testcases from #38624 by not ending up with `&'static mut (Trait+'static)`.

The ambiguity specifically cannot be an early error, because this is only the "default" (typeck can still pick something better based on the definition of `Trait` and whether it has any lifetime bounds), and having an error at all doesn't help anyone, as we can perfectly infer an appropriate lifetime inside the `fn` body.

**TODO**: write tests for the user-visible changes.

cc @nikomatsakis @arielb1
2017-01-28 06:21:23 +00:00
bors
0f8a296475 Auto merge of #39353 - alexcrichton:rollup, r=alexcrichton
Rollup of 21 pull requests

- Successful merges: #38617, #39284, #39285, #39290, #39302, #39305, #39306, #39307, #39311, #39313, #39314, #39321, #39325, #39332, #39335, #39344, #39345, #39346, #39348, #39350, #39351
- Failed merges:
2017-01-28 02:50:51 +00:00
Eduard-Mihai Burtescu
c0e474d9a6 test: add missing lifetime in recently added test. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
9a0af1638a rustc: remove unused bounds field from RegionParameterDef. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
4eac052a33 rustc: move object default lifetimes to resolve_lifetimes. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
c5befdc630 rustc: always keep an explicit lifetime in trait objects. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
41553d6fbc rustc: lower trait type paths as TyTraitObject. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
9783947c2a rustc_typeck: move impl Trait checks out of RegionScope. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
ba1849daec rustc: move most of lifetime elision to resolve_lifetimes. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
bbc341424c rustc: simplify scope-tracking in resolve_lifetime. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
0682a75f44 rustc: clean up the style of middle::resolve_lifetime. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
7a2a669bb7 rustc: always include elidable lifetimes in HIR types. 2017-01-28 02:56:46 +02:00
Eduard-Mihai Burtescu
f79feba205 rustc_typeck: pass all lifetimes through AstConv::opt_ast_region_to_region. 2017-01-28 02:55:37 +02:00
Eduard-Mihai Burtescu
4f559f8c33 rustc_typeck: force users of RegionScope to get anon_region's one by one. 2017-01-28 02:55:21 +02:00
Alex Crichton
1767d9715c Rollup merge of #39351 - nikomatsakis:incr-comp-skip-typeck-1, r=eddyb
move `cast_kinds` into `TypeckTables` where it belongs

r? @eddyb
2017-01-27 16:42:08 -08:00
Alex Crichton
9eb00687ac Rollup merge of #39350 - nagisa:i128-test-helpers-better-def, r=alexcrichton
Use __SIZEOF_INT128__ to test __int128 presence

Previously we tested whether a handful of preprocessor variables indicating certain 64 bit
platforms, but this does not work for other 64 bit targets which have support for __int128 in C
compiler.

Use the `__SIZEOF__INT128__` preprocessor variable instead. This variable gets set to 16 by gcc and
clang for every target where __int128 is supported.
2017-01-27 16:42:08 -08:00
Alex Crichton
ebe17b0c70 Rollup merge of #39348 - steveklabnik:cyryl-mailmap, r=alexcrichton
Fix cyryl's mailmap entry
2017-01-27 16:42:08 -08:00
Alex Crichton
86af9a19ec Rollup merge of #39346 - steveklabnik:jethro-mailmap, r=brson
Fix @jethrogb's mailmap entry

cc rust-lang-nursery/thanks#51
2017-01-27 16:42:07 -08:00
Alex Crichton
854690c0d8 Rollup merge of #39345 - steveklabnik:carol-mailmap, r=alexcrichton
Fix up @carols10cents' mailmap entry

The previous ways didn't work; this does.

cc rust-lang-nursery/thanks#45
2017-01-27 16:42:07 -08:00
Alex Crichton
7c75608cfb Rollup merge of #39344 - ollie27:links, r=steveklabnik
Fix a few links in the docs

r? @steveklabnik
2017-01-27 16:42:07 -08:00