Commit Graph

67215 Commits

Author SHA1 Message Date
John Kåre Alsaker
6601ab9b1b Remove allocations 2017-08-11 07:35:01 +02:00
John Kåre Alsaker
be9c64b0c7 Store generator interior in MIR literals 2017-08-11 07:15:33 +02:00
John Kåre Alsaker
91dde3eb2d Typo 2017-08-11 06:23:22 +02:00
John Kåre Alsaker
bbe15522d5 Some tweaks and comments 2017-08-11 06:20:28 +02:00
John Kåre Alsaker
ffcd32cfe6 Remove code related to the dropping of generator arguments 2017-08-11 04:36:39 +02:00
John Kåre Alsaker
2d30e7e982 Fix merge of scope.rs 2017-08-11 04:24:25 +02: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
Tobias Bucher
faadd35ee5 Add #[inline] to mem::unreachable 2017-08-11 03:42:36 +02:00
steveklabnik
92f8442434 ignore more things 2017-08-10 20:17:41 -04:00
Vadim Petrochenkov
804459bdca Issue warnings for unnecessary path disambiguators 2017-08-11 02:47:22 +03:00
Vadim Petrochenkov
7d21f21f71 syntax: Relax path grammar 2017-08-11 02:06:27 +03:00
steveklabnik
640cf596ec review feedback 2017-08-10 18:59:51 -04:00
steveklabnik
bc9e0820e7 doc doc(inline) and doc(no_inline) 2017-08-10 18:52:10 -04: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
Bastien Orivel
ea5be96bab Fix some more typos, this time words that are duplicated. 2017-08-11 00:31:47 +02:00
Bastien Orivel
47cb3c5bc2 Fix some typos 2017-08-11 00:16:18 +02:00
Justin Browne
4b80d598c5 Fix broken links in Arc documentation 2017-08-10 18:03:22 -04:00
steveklabnik
99e943c8b8 Document the doc attribute
cc #42322
2017-08-10 17:53:36 -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
Alex Crichton
b8aa595e6d Merge remote-tracking branch 'origin/master' into gen 2017-08-10 14:05:58 -07: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
scalexm
94703ce3f7 Do not elaborate trait obligations in where clauses 2017-08-10 15:52:08 +02:00
scalexm
e3b28b4ae8 Add tests 2017-08-10 15:13:34 +02:00
scalexm
488dccbe87 Elaborate trait obligations when typechecking impls
Fixes #43784.
2017-08-10 15:02:41 +02:00
Ariel Ben-Yehuda
17d2bcd162 For box expressions, use NZ drop instead of a free block
This falls naturally out of making drop elaboration work with `box`
expressions, which is probably required for sane MIR borrow-checking.
This is a pure refactoring with no intentional functional effects.
2017-08-10 15:57:28 +03:00
scalexm
1ebc7eff46 Fix for the supertrait example in #43784 2017-08-10 14:41:24 +02: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
Nick Cameron
6d736df76b doc tests: use the filename from the source file for doc test programs, rather than a dummy name 2017-08-10 17:59:20 +12:00
Nick Cameron
177cbe01be Some tidying up around include! 2017-08-10 17:59:03 +12:00
kennytm
b4114ebe3a
Exposed all platform-specific documentation. 2017-08-10 13:43:59 +08:00
kennytm
a2b888675a
Implemented #[doc(cfg(...))].
This attribute has two effects:

1. Items with this attribute and their children will have the "This is
   supported on **** only" message attached in the documentation.

2. The items' doc tests will be skipped if the configuration does not
   match.
2017-08-10 13:43:59 +08:00
kennytm
8f935fbb5b
Strip out function implementation when documenting.
This prevents compilation failure we want to document a platform-specific
module. Every function is replaced by `loop {}` using the same construct
as `--unpretty everybody_loops`.

Note also a workaround to #43636 is included: `const fn` will retain their
bodies, since the standard library has quite a number of them.
2017-08-10 13:43:57 +08: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
Alex Crichton
be95ca4b17 Add a failing xcrate generator test 2017-08-09 16:38:05 -07:00