Commit Graph

66458 Commits

Author SHA1 Message Date
bors
59675d29eb Auto merge of #43800 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 18 pull requests

- Successful merges: #43176, #43632, #43650, #43712, #43715, #43721, #43739, #43741, #43744, #43747, #43752, #43760, #43773, #43779, #43783, #43791, #43793, #43795
- Failed merges:
2017-08-11 09:37:52 +00:00
Guillaume Gomez
742bba0ebf Rollup merge of #43795 - GuillaumeGomez:improve-variants-doc-style, r=QuietMisdreavus
Improve enum variants display

r? @rust-lang/docs

Before:

<img width="1440" alt="screen shot 2017-08-11 at 00 22 54" src="https://user-images.githubusercontent.com/3050060/29194776-728ce0e2-7e2b-11e7-8299-8300cc0c168b.png">

After:

<img width="1440" alt="screen shot 2017-08-11 at 00 22 57" src="https://user-images.githubusercontent.com/3050060/29194783-78867558-7e2b-11e7-9226-1327fd20163a.png">

(The doc of the variant is more aligned with the "[-]" now).
2017-08-11 10:20:33 +02:00
Guillaume Gomez
77904aad52 Rollup merge of #43793 - j-browne:master, r=steveklabnik
Fix broken links in Arc documentation

Some link references had ticks, when they should not have had them.
2017-08-11 10:20:32 +02:00
Guillaume Gomez
4f5f3faa7d Rollup merge of #43791 - GuillaumeGomez:file-docs, r=QuietMisdreavus
File docs

r? @rust-lang/docs
2017-08-11 10:20:31 +02:00
Guillaume Gomez
3e6e26246e Rollup merge of #43783 - prisme60:prisme60-typo, r=Mark-Simulacrum
Fix typo corersponding -> corresponding

I was reading the documentation of __Struct std::os::unix::net::UnixListener__ when I saw a typo inside.
2017-08-11 10:20:30 +02:00
Guillaume Gomez
6af7b9d4b0 Rollup merge of #43779 - mattico:fix-unicode-typo, r=aidanhs
Fix typo in unicode char definition

Reference: http://www.fileformat.info/info/unicode/char/16ed/index.htm
2017-08-11 10:20:29 +02:00
Guillaume Gomez
7fa572e6a5 Rollup merge of #43773 - ubsan:patch-1, r=eddyb
fix a typo

(this should not have been merged with this typo)
2017-08-11 10:20:28 +02:00
Guillaume Gomez
6fac8dc141 Rollup merge of #43760 - ollie27:rustdoc_search_css, r=GuillaumeGomez
rustdoc: Fix broken CSS in search results

The layout is currently broken for struct/union fields and enum variants
in the search results when searching from a struct, union or enum page.

Some examples:
https://doc.rust-lang.org/nightly/std/ops/struct.RangeInclusive.html?search=start
https://doc.rust-lang.org/nightly/std/option/enum.Option.html?search=some

 #34477 was an incomplete fix
2017-08-11 10:20:27 +02:00
Guillaume Gomez
35947cfbc4 Rollup merge of #43752 - arshiamufti:union-test, r=estebank
Add IRC's `!union union` as a test, addresses #43553

This pull request adds a new test, `union` to `weird-exprs.rs`.
2017-08-11 10:20:26 +02:00
Guillaume Gomez
42b06817e6 Rollup merge of #43747 - GuillaumeGomez:fix-css, r=QuietMisdreavus
Improve headers linking

r? @QuietMisdreavus
2017-08-11 10:20:25 +02:00
Guillaume Gomez
2ad3baa2b3 Rollup merge of #43744 - MaloJaffre:stage1-test, r=Mark-Simulacrum
Ignore tests that fail on stage1

That makes `./x.py test --stage 1` work on `x86_64-unknown-linux-gnu`.
2017-08-11 10:20:24 +02:00
Guillaume Gomez
18238c7fa3 Rollup merge of #43741 - Gankro:fix-assert, r=eddyb
fix assertion - trait object pointers don't have infinite fields

r? @eddyb
2017-08-11 10:20:23 +02:00
Guillaume Gomez
6047e9300c Rollup merge of #43739 - ibabushkin:master, r=eddyb
Encode proper module spans in crate metadata.

The spans previously encoded only span the first token after the opening
brace, up to the closing brace of inline `mod` declarations. Thus, when
examining exports from an external crate, the spans don't include the
header of inline `mod` declarations.

r? @eddyb
2017-08-11 10:20:22 +02:00
Guillaume Gomez
03abb9d97f Rollup merge of #43721 - natboehm:patch-1, r=steveklabnik
Provide more explanation for Deref in String docs

While working on a different project I encountered a point of confusion where using `&String` to dereference a `String` into `&str` did not compile. I found the explanation of [String Deref](https://doc.rust-lang.org/std/string/struct.String.html#deref), thought that it matched what I was trying to do, and was confused as to why my program did not compile when the docs stated that it would work with 'any function which takes a `&str`'. At the bottom it is mentioned that this will 'generally' work, unless `String` is needed, but I found this statement confusing based on the previous claim of 'any'. Looking further into the docs I was able to find the function `as_str()` that works instead.

I thought it might be helpful to mention here deref coercion, an instance in which using `&String` does not work, to explain why it does not work, then direct users to a different option that should work in this instance. A user casually skimming the page will likely come to this explanation first, then find `as_str()` later, but be no the wiser as to what potentially went wrong.

r? @steveklabnik
2017-08-11 10:20:21 +02:00
Guillaume Gomez
e9d39094c9 Rollup merge of #43715 - ollie27:docs_long_link, r=QuietMisdreavus
Stop using URL shortener in docs

tidy will no longer complain about long lines containing links so there
is no reason to use a URL shortener here.
2017-08-11 10:20:20 +02:00
Guillaume Gomez
aebfe2b60b Rollup merge of #43712 - oli-obk:cfg, r=arielb1
Reexport all SyntaxExtension variants

This was previously done very inconsistently and made matches look weird since some variants had the `SyntaxExtension::` prefix while others didn't.
2017-08-11 10:20:19 +02:00
Guillaume Gomez
96c09f8550 Rollup merge of #43650 - RalfJung:mir-validate, r=arielb1
test MIR validation statements in closures

r? @nikomatsakis
2017-08-11 10:20:18 +02:00
Guillaume Gomez
643231313a Rollup merge of #43632 - ruuda:allow-long-relative-urls, r=Mark-Simulacrum
Detect relative urls in tidy check

This came up in #43631: there can be long relative urls in Markdown comments, that do not start with `http://` or `https://`, so the tidy check will not detect them as urls and complain about the line length. This PR adds detection of relative urls starting with `../`.
2017-08-11 10:20:17 +02:00
Guillaume Gomez
7a80cf1ef1 Rollup merge of #43176 - RalfJung:explain, r=eddyb
E0122: clarify wording

I *assume* the reason these constraints are not hard errors is backwards compatibility. If yes, I think the error explanation (at least the long form) should be clearer about that, which is what this PR does.

If not, the explanation should give some other suitable explanation.
2017-08-11 10:20:16 +02:00
bors
9868352b95 Auto merge of #43745 - kennytm:fix-43162, r=aturon
Type-check `break value;` even outside of `loop {}`.

Fix #43162, fix #43727.
2017-08-11 07:09:44 +00:00
bors
73c3f55a3e Auto merge of #43743 - michaelwoerister:gcx-tcx-switcheroo, r=eddyb
Some assorted region hashing fixes.

This PR contains three changes.
1. It changes what we implement `HashStable` for. Previously, the trait was implemented for things in the local `TyCtxt`. That was OK, since we only invoked hashing with a `TyCtxt<'_,  'tcx, 'tcx>` where there is no difference. With query result hashing this becomes a problem though. So we now implement `HashStable` for things in `'gcx`.
2. The PR makes the regular `HashStable` implementation *not* anonymize late-bound regions anymore. It's a waste of computing resources and it's not clear that it would always be correct to do so.
3. The PR adds an option for stable hashing to treat all regions as erased and uses this new option when computing the `TypeId`. This should help with https://github.com/rust-lang/rust/issues/41875.

I did not add a test case for (3) since that's not possible yet. But it looks like @zackmdavis has something in the pipeline there `:)`.

r? @eddyb
2017-08-11 02:23:16 +00:00
Guillaume Gomez
b6172008bf Improve enum variants display 2017-08-11 00:34:17 +02:00
bors
6c5212ffa0 Auto merge of #43589 - aidanhs:aphs-fix-system-malloc, r=alexcrichton
Make a disable-jemalloc build work

Fixes #43510. I've tested this up to building a stage1 compiler.

r? @alexcrichton

cc @cuviper @vorner

@cuviper your fix was almost correct, you just had a stray `!` in there which caused the second error you saw.
2017-08-10 22:32:51 +00:00
Justin Browne
4b80d598c5 Fix broken links in Arc documentation 2017-08-10 18:03:22 -04:00
Guillaume Gomez
972d67cec1 Add missing links for Error docs 2017-08-10 23:14:49 +02:00
Guillaume Gomez
592bdc3974 Add missing links in io module docs 2017-08-10 23:11:40 +02:00
Guillaume Gomez
ac0ee51c17 Add missing links in io::Error docs 2017-08-10 23:05:50 +02:00
Guillaume Gomez
9e25984ee1 Add missing links in ReadDir docs 2017-08-10 23:01:59 +02:00
Guillaume Gomez
645117fd96 Add missing links on File struct docs 2017-08-10 22:50:29 +02:00
bors
13d94d5fa8 Auto merge of #43559 - Nashenas88:nll-region-renumberer, r=arielb1
Non-lexical lifetimes region renumberer

Regenerates region variables for all regions in a cloned MIR in the nll mir pass. This is part of the work for #43234.
2017-08-10 19:48:14 +00:00
Aidan Hobson Sayers
56a07539c0 Fix cross-crate global allocators on windows 2017-08-10 16:22:09 +01:00
bors
b6179602be Auto merge of #43720 - pornel:staticconst, r=petrochenkov
Hint correct extern constant syntax

Error message for `extern "C" { const …}` is terse, and the right syntax is hard to guess given unfortunate difference between meaning of `static` in C and Rust.

I've added a hint for the right syntax.
2017-08-10 15:10:17 +00:00
Kornel
cabc9be9e2 Reword error hint 2017-08-10 12:31:02 +01:00
bors
2400ebfe76 Auto merge of #43522 - alexcrichton:rewrite-lints, r=michaelwoerister
rustc: Rearchitect lints to be emitted more eagerly

In preparation for incremental compilation this commit refactors the lint
handling infrastructure in the compiler to be more "eager" and overall more
incremental-friendly. Many passes of the compiler can emit lints at various
points but before this commit all lints were buffered in a table to be emitted
at the very end of compilation. This commit changes these lints to be emitted
immediately during compilation using pre-calculated lint level-related data
structures.

Linting today is split into two phases, one set of "early" lints run on the
`syntax::ast` and a "late" set of lints run on the HIR. This commit moves the
"early" lints to running as late as possible in compilation, just before HIR
lowering. This notably means that we're catching resolve-related lints just
before HIR lowering. The early linting remains a pass very similar to how it was
before, maintaining context of the current lint level as it walks the tree.

Post-HIR, however, linting is structured as a method on the `TyCtxt` which
transitively executes a query to calculate lint levels. Each request to lint on
a `TyCtxt` will query the entire crate's 'lint level data structure' and then go
from there about whether the lint should be emitted or not.

The query depends on the entire HIR crate but should be very quick to calculate
(just a quick walk of the HIR) and the red-green system should notice that the
lint level data structure rarely changes, and should hopefully preserve
incrementality.

Overall this resulted in a pretty big change to the test suite now that lints
are emitted much earlier in compilation (on-demand vs only at the end). This in
turn necessitated the addition of many `#![allow(warnings)]` directives
throughout the compile-fail test suite and a number of updates to the UI test
suite.

Closes https://github.com/rust-lang/rust/issues/42511
2017-08-10 11:20:15 +00:00
bors
d21ec9b4ef Auto merge of #43582 - ivanbakel:unused_mut_ref, r=arielb1
Fixed mutable vars being marked used when they weren't

#### NB : bootstrapping is slow on my machine, even with `keep-stage` - fixes for occurances in the current codebase are <s>in the pipeline</s> done. This PR is being put up for review of the fix of the issue.

Fixes #43526, Fixes #30280, Fixes #25049

### Issue
Whenever the compiler detected a mutable deref being used mutably, it marked an associated value as being used mutably as well. In the case of derefencing local variables which were mutable references, this incorrectly marked the reference itself being used mutably, instead of its contents - with the consequence of making the following code emit no warnings
```
fn do_thing<T>(mut arg : &mut T) {
    ... // don't touch arg - just deref it to access the T
}
```

### Fix
Make dereferences not be counted as a mutable use, but only when they're on borrows on local variables.
#### Why not on things other than local variables?
  * Whenever you capture a variable in a closure, it gets turned into a hidden reference - when you use it in the closure, it gets dereferenced. If the closure uses the variable mutably, that is actually a mutable use of the thing being dereffed to, so it has to be counted.
  * If you deref a mutable `Box` to access the contents mutably, you are using the `Box` mutably - so it has to be counted.
2017-08-10 08:53:22 +00:00
Foucher
27d7e61f1b Fix typo corersponding -> corresponding 2017-08-10 08:49:40 +02:00
bors
2ac5f7d249 Auto merge of #43737 - GuillaumeGomez:duplicate-method, r=eddyb
Improve error message when duplicate names for type and trait method

Fixes #43626.
2017-08-10 06:32:19 +00:00
bors
16268a88fc Auto merge of #43735 - est31:master, r=alexcrichton
Avoid calling the column!() macro in panic

Closes #43057

This "fix" adds a new macro called `__rust_unstable_column` and to use it instead of the `column` macro inside panic. The new macro can be shadowed as well as `column` can, but its very likely that there is no code that does this in practice.

There is no real way to make "unstable" macros that are usable by stable macros, so we do the next best thing and prefix the macro with `__rust_unstable` to make sure people recognize it is unstable.

r? @alexcrichton
2017-08-10 04:01:21 +00:00
bors
57e720d2cd Auto merge of #43730 - nrc:driver-shim, r=eddyb
Make the driver API a little more useful for a tools shim

Example use case: https://github.com/nrc/rls-rustc
2017-08-10 01:22:43 +00:00
Isaac van Bakel
8f78d453de Updated cargo submodule to fix compile error 2017-08-10 02:00:48 +01:00
est31
5cf9f6330a Add a feature gate
@alexcrichton figured out a way how to do it :)
2017-08-10 02:43:31 +02:00
Matt Ickstadt
8c311e56b0 Fix typo in unicode char definition 2017-08-09 19:23:05 -05:00
Vadim Petrochenkov
a965beef8f Better diagnostics and recovery for const in extern blocks 2017-08-10 00:52:50 +01:00
bors
875bcf5c5f Auto merge of #43627 - Aaronepower:master, r=alexcrichton
Updated release notes for 1.20

[Rendered](https://github.com/Aaronepower/rust/blob/master/RELEASES.md)
2017-08-09 22:41:10 +00:00
Nick Cameron
a9a181d4dc driver: factor out continue_parse_after_error so it can be controlled via driver API 2017-08-10 10:14:17 +12:00
nicole mazzuca
445c08d212 fix a typo
(this should not have been merged with this typo)
2017-08-09 13:52:43 -07:00
bors
f142499539 Auto merge of #43484 - estebank:point-to-return, r=arielb1
Point at return type always when type mismatch against it

Before this, the diagnostic errors would only point at the return type
when changing it would be a possible solution to a type error. Add a
label to the return type without a suggestion to change in order to make
the source of the expected type obvious.

Follow up to #42850, fixes #25133, fixes #41897.
2017-08-09 19:50:03 +00:00
Esteban Küber
9bd62a4691 Readd backticks around () 2017-08-09 10:48:33 -07:00
bors
33d71944cd Auto merge of #43732 - kennytm:pass-wrapper-warning, r=arielb1
Fix covered-switch-default warnings in PassWrapper

(See #39063 for explanation)
2017-08-09 17:08:13 +00:00
Alex Crichton
0374e6aab7 rustc: Rearchitect lints to be emitted more eagerly
In preparation for incremental compilation this commit refactors the lint
handling infrastructure in the compiler to be more "eager" and overall more
incremental-friendly. Many passes of the compiler can emit lints at various
points but before this commit all lints were buffered in a table to be emitted
at the very end of compilation. This commit changes these lints to be emitted
immediately during compilation using pre-calculated lint level-related data
structures.

Linting today is split into two phases, one set of "early" lints run on the
`syntax::ast` and a "late" set of lints run on the HIR. This commit moves the
"early" lints to running as late as possible in compilation, just before HIR
lowering. This notably means that we're catching resolve-related lints just
before HIR lowering. The early linting remains a pass very similar to how it was
before, maintaining context of the current lint level as it walks the tree.

Post-HIR, however, linting is structured as a method on the `TyCtxt` which
transitively executes a query to calculate lint levels. Each request to lint on
a `TyCtxt` will query the entire crate's 'lint level data structure' and then go
from there about whether the lint should be emitted or not.

The query depends on the entire HIR crate but should be very quick to calculate
(just a quick walk of the HIR) and the red-green system should notice that the
lint level data structure rarely changes, and should hopefully preserve
incrementality.

Overall this resulted in a pretty big change to the test suite now that lints
are emitted much earlier in compilation (on-demand vs only at the end). This in
turn necessitated the addition of many `#![allow(warnings)]` directives
throughout the compile-fail test suite and a number of updates to the UI test
suite.
2017-08-09 09:13:51 -07:00