63733 Commits

Author SHA1 Message Date
Michael Woerister
bc7af816f3 ICH: Hash everything that gets encoded into crate metadata. 2017-04-12 11:42:15 +02:00
Michael Woerister
c008cd70f5 Make compiletest write test output to different files for different revisions. 2017-04-12 11:42:15 +02:00
Niko Matsakis
2e327a668e fix nit 2017-04-12 05:42:02 -04:00
bors
1dca19ae3f Auto merge of #40765 - pirate:patch-3, r=aturon
Add contribution instructions to stdlib docs

Generally programming language docs have instructions on how to contribute changes.

I couldn't find any in the rust docs, so I figured I'd add an instructions section, let me know if this belongs somewhere else!
2017-04-12 09:16:14 +00:00
Esteban Küber
439ff69d90 Add a way to get shorter spans until char for pointing at defs
```rust
error[E0072]: recursive type `X` has infinite size
  --> file.rs:10:1
   |
10 | struct X {
   | ^^^^^^^^ recursive type has infinite size
   |
   = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `X` representable
```

vs

```rust
error[E0072]: recursive type `X` has infinite size
  --> file.rs:10:1
   |
10 |   struct X {
   |  _^ starting here...
11 | |     x: X,
12 | | }
   | |_^ ...ending here: recursive type has infinite size
   |
   = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `X` representable
```
2017-04-12 01:10:48 -07:00
bors
8c6e2ff452 Auto merge of #40584 - nrc:rls-submod, r=alexcrichton
Add the RLS as a submodule and build a package out of it

r? @brson (and cc @alexcrichton) Please review closely, I am not at all convinced I've done the right things here. I did run `x.py dist` and it makes an rls package which looks right to my eyes, but I haven't tested on non-linux platforms nor am I really sure what it should look like.

This does not attempt to run tests for the RLS yet.
2017-04-12 05:26:10 +00:00
NODA, Kai
f39145169f
COPYRIGHT: remove hoedown license
Hoedown was removed in b96fef8411f

Also cleanup src/tools/tidy/src/main.rs

Signed-off-by: NODA, Kai <nodakai@gmail.com>
2017-04-12 12:54:27 +08:00
projektir
13c818fa27 Updating docs for std::sync::Weak #29377 2017-04-12 00:19:38 -04:00
projektir
ed7b6c3724 Minor nits in primitive str 2017-04-12 00:10:36 -04:00
bors
da32752d92 Auto merge of #41237 - frewsxcv:rollup, r=frewsxcv
Rollup of 8 pull requests

- Successful merges: #40377, #40559, #41173, #41202, #41204, #41209, #41216, #41231
- Failed merges:
2017-04-12 00:45:49 +00:00
Niko Matsakis
7832db8031 fix long line 2017-04-11 20:32:48 -04:00
Niko Matsakis
0fae3324a2 add some debug! to coercion 2017-04-11 20:32:48 -04:00
Niko Matsakis
59babd80bd add some comments and debug! calls to "obligation forest" 2017-04-11 20:32:48 -04:00
Niko Matsakis
761808ef40 just panic in rustdoc if we encounter a subtype predicate
These are not user expressible anyhow.
2017-04-11 20:32:48 -04:00
Niko Matsakis
1c138ed1c7 update various test cases that generate slightly different output
For the most part, it seems to be better, but one side-effect is that I
cannot seem to reproduce E0102 anymore.
2017-04-11 20:32:48 -04:00
Niko Matsakis
bca56e82a1 generalize type variables too
When we are generalizing a super/sub-type, we have to replace type
variables with a fresh variable (and not just region variables).  So if
we know that `Box<?T> <: ?U`, for example, we instantiate `?U` with
`Box<?V>` and then relate `Box<?T>` to `Box<?V>` (and hence require that
`?T <: ?V`).

This change has some complex interactions, however:

First, the occurs check must be updated to detect constraints like `?T
<: ?U` and `?U <: Box<?T>`. If we're not careful, we'll create a
never-ending sequence of new variables. To address this, we add a second
unification set into `type_variables` that tracks type variables related
through **either** equality **or** subtyping, and use that during the
occurs-check.

Second, the "fudge regions if ok" code was expecting no new type
variables to be created. It must be updated to create new type variables
outside of the probe. This is relatively straight-forward under the new
scheme, since type variables are now independent from one another, and
any relations are moderated by pending subtype obliations and so forth.
This part would be tricky to backport though.

cc #18653
cc #40951
2017-04-11 20:32:47 -04:00
Niko Matsakis
3a5bbf89b2 avoid unneeded subtype obligations in lub/glb
In some specific cases, the new scheme was failing to learn as much from
a LUB/GLB operaiton as the old code, which caused coercion to go awry. A
slight ordering hack fixes this.
2017-04-11 20:32:47 -04:00
Niko Matsakis
14f1e3459f fix a bug in compiletest JSON parsing for duplicate errors
In some cases, we give multiple primary spans, in which case we would
report one `//~` annotation per primary span. That was very confusing
because these things are reported to the user as a single error.

UI tests would be better here.
2017-04-11 20:32:47 -04:00
Niko Matsakis
77d9e38e94 add FIXME for bivariant lub/glb 2017-04-11 20:32:47 -04:00
Niko Matsakis
d1033d06ba add FIXME to #18653 2017-04-11 20:32:47 -04:00
Niko Matsakis
e4b762b532 add regression test for #30225
Fixes #30225
2017-04-11 20:32:47 -04:00
Niko Matsakis
e58e2b423d remove the subtyping relations from TypeVariable 2017-04-11 20:32:46 -04:00
Niko Matsakis
105ec7e3bb use obligations to propagate sub-typing instead of the TV code 2017-04-11 20:32:46 -04:00
Niko Matsakis
4e4bdea0ae propagate sub-obligations better
The most interesting place is the hinting mechanism; once we start
having subtyping obligations, it's important to see those through.
2017-04-11 20:32:46 -04:00
Niko Matsakis
58609ef879 add Subtype predicate 2017-04-11 20:32:46 -04:00
Niko Matsakis
18ea55fe16 remove bivariance
There is one fishy part of these changes: when computing the LUB/GLB of
a "bivariant" type parameter, I currently return the `a`
value. Bivariant type parameters are only allowed in a very particular
situation, where the type parameter is only used as an associated type
output, like this:

```rust
pub struct Foo<A, B>
    where A: Fn() -> B
    {
        data: A
        }
        ```

In principle, if one had `T=Foo<A, &'a u32>` and `U=Foo<A, &'b u32>`
and (e.g.) `A: for<'a> Fn() -> &'a u32`, then I think that computing the
LUB of `T` and `U` might do the wrong thing. Probably the right behavior
is just to create a fresh type variable. However, that particular
example would not compile (because the where-clause is illegal; `'a`
does not appear in any input type). I was not able to make an example
that *would* compile and demonstrate this shortcoming, and handling the
LUB/GLB was mildly inconvenient, so I left it as is. I am considering
whether to revisit this.
2017-04-11 20:19:23 -04:00
Niko Matsakis
4a0a0e949a remove type variable defaults code
This just limits ourselves to the "old school" defaults: diverging
variables and integer variables.
2017-04-11 20:19:23 -04:00
Esteban Küber
2389830dea Highlight and simplify mismatched types
Shorten mismatched types errors by replacing subtypes that are not
different with `_`, and highlighting only the subtypes that are
different.

Given a file

```rust
struct X<T1, T2> {
    x: T1,
    y: T2,
}

fn foo() -> X<X<String, String>, String> {
    X { x: X {x: "".to_string(), y: 2}, y: "".to_string()}
}

fn bar() -> Option<String> {
    "".to_string()
}
```

provide the following output

```rust
error[E0308]: mismatched types
  --> file.rs:6:5
   |
 6 |     X { x: X {x: "".to_string(), y: 2}, y: "".to_string()}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found {integer}
   |
   = note: expected type `X<X<_, std::string::String>, _>`
                                 ^^^^^^^^^^^^^^^^^^^   // < highlighted
              found type `X<X<_, {integer}>, _>`
                                 ^^^^^^^^^             // < highlighted

error[E0308]: mismatched types
  --> file.rs:6:5
   |
10 |     "".to_string()
   |     ^^^^^^^^^^^^^^ expected struct `std::option::Option`, found `std::string::String`
   |
   = note: expected type `Option<std::string::String>`
                          ^^^^^^^                   ^  // < highlighted
              found type `std::string::String`
```
2017-04-11 15:45:00 -07:00
Corey Farwell
72538dee4d Rollup merge of #41231 - TimNN:fix-centos, r=frewsxcv
Use correct vault URL in CentOS images

r? @frewsxcv
2017-04-11 18:36:17 -04:00
Corey Farwell
3ebeaf6d5c Rollup merge of #41216 - shahn:iter_pos, r=steveklabnik
Clarify Iterator::position doc

Extend the example a little bit to show behaviour better.

r? @steveklabnik
2017-04-11 18:36:16 -04:00
Corey Farwell
828ed96377 Rollup merge of #41209 - aidanhs:aphs-quiet-sccache, r=alexcrichton
Make sccache a bit quieter

...and remove the single mention of `SCCACHE_LOG_LEVEL` that would only take effect on Docker (i.e. Linux) builds since it had no effect anyway (because [`RUST_LOG` takes priority](ec10cdb2dd/src/main.rs (L124-L128))).

r? @frewsxcv
2017-04-11 18:36:16 -04:00
Corey Farwell
704cbad248 Rollup merge of #41204 - remexre:master, r=steveklabnik
Fixes incorrect formatting in array's documentation.

Changes

 - [`Clone`][clone] (only if `T: [Copy][copy]`)

to

 - [`Clone`][clone] (only if `T: `[`Copy`](copy))

r? @steveklabnik
2017-04-11 18:36:15 -04:00
Corey Farwell
c03061d347 Rollup merge of #41202 - brson:btree, r=nikomatsakis
Convert HashMap to BTree in build-manifest

This is just for my peace of mind since it's important the output of this program be deterministic.
2017-04-11 18:36:14 -04:00
Corey Farwell
b72c30a8df Rollup merge of #41173 - GuillaumeGomez:fix-rustdoc-code-block-parsing, r=steveklabnik
Fix block code headers parsing

Fixes #41167.

r? @rust-lang/docs
2017-04-11 18:36:13 -04:00
Corey Farwell
acb43ce573 Rollup merge of #40559 - nagisa:manually-drop, r=alexcrichton
Implement Manually Drop

As the RFC has been from approx a week in FCP without any major comments, I’m taking the opportunity to submit the PR early.
2017-04-11 18:36:12 -04:00
Corey Farwell
4f6f4eb7c3 Rollup merge of #40377 - camlorn:optimization_fuel, r=eddyb
Implement optimization fuel and re-enable struct field reordering

See [this discussion](https://internals.rust-lang.org/t/rolling-out-or-unrolling-struct-field-reorderings/4485) for background.

This pull request adds two new compilation options: `-Z print-fuel=crate` prints the optimization fuel used by a crate and `-Z fuel=crate=n` sets the optimization fuel for a crate.

It also turns field reordering back on.  There is no way to test this feature without something consuming fuel.  We can roll this back if we want, but then the optimization fuel bits will be dead code.

The one notable absence from this PR is a test case.  I'm not sure how to do one that's worth having.  The only thing I can think of to test is `-Z fuel=foo=0`.  The problem with other tests is that either (1) they're so big that future optimizations will apply, thus breaking them or (2) we don't know which order the optimizations will be applied in, so we can't guess the message that will be printed.  If someone has a useful proposal for a good test, I certainly want to add one.
2017-04-11 18:36:12 -04:00
Ariel Ben-Yehuda
540a069761 address review comments 2017-04-12 00:45:54 +03:00
bors
f8107c0d7c Auto merge of #41231 - TimNN:fix-centos, r=frewsxcv
Use correct vault URL in CentOS images

r? @frewsxcv
2017-04-11 20:56:00 +00:00
Ariel Ben-Yehuda
0144613078 Move rvalue checking to MIR
Fixes #41139.
2017-04-11 23:53:20 +03:00
Tim Neumann
56503dd4ad use correct vault url 2017-04-11 22:53:16 +02:00
Ariel Ben-Yehuda
384ec80d2b store Spans for all MIR locals 2017-04-11 23:52:51 +03:00
Paul Lange
4b4b1e1b25 Improve module description for std::f32 and std::f64.
Fixes #29353
2017-04-11 21:57:54 +02:00
Alex Crichton
13d008d1e8 Touch up rls integration
* Use the right version when building combined installer
* Update dependencies of rls as it depends on rustc and plugins
* Fix build-manifest and the versions it uses for the rls
2017-04-11 10:47:53 -07:00
Sebastian Hahn
316af6082c Clarify Iterator::position doc
Extend the example a little bit to show behaviour better.
2017-04-11 19:39:58 +02:00
Guillaume Gomez
143f7be8b6 Remove strings fulfilled with whitespaces in code block headers 2017-04-11 17:36:52 +02:00
Simonas Kazlauskas
e18c59fd48 Fix some nits 2017-04-11 16:06:30 +03:00
Simonas Kazlauskas
a384f131cb Fix handling of closure arguments
Those did not take tuple reordering into account, causing majority of the compiler test suite to
fail.
2017-04-11 15:21:07 +03:00
bors
c58c928e65 Auto merge of #41096 - clarcharr:as_bytes_mut, r=alexcrichton
Reduce str transmutes, add mut versions of methods.

When I was working on the various parts involved in #40380 one of the comments I got was the excess of transmutes necessary to make the changes work. This is part of a set of multiple changes I'd like to offer to fix this problem.

I think that having these methods is reasonable because they're already possible via transmutes, and it makes the code that uses them safer. I can also add `pub(crate)` to these methods for now if the libs team would rather not expose them to the public without an RFC.
2017-04-11 12:13:49 +00:00
Austin Hicks
d821e98fd7 Make a comment better. 2017-04-11 14:36:08 +03:00
Austin Hicks
0931e2006a Initial attempt at implementing optimization fuel and re-enabling struct field reordering. 2017-04-11 14:36:08 +03:00