Commit Graph

72748 Commits

Author SHA1 Message Date
Steve Klabnik
ba67acc0e7 Rollup merge of #46601 - matthewjasper:method-link-change, r=steveklabnik
Use a better link for method resolution in Deref docs

rust-lang-nursery/reference#149 breaks these links, so make them point to somewhere which won't break and provides a more deatailed description of method resolution.

cc @Havvy
r? @steveklabnik
2017-12-15 09:26:56 -05:00
Guillaume Gomez
6351ebb7e5 make doc search more relevant 2017-12-15 14:44:49 +01:00
bors
5a0dc2d06d Auto merge of #46740 - oli-obk:rls, r=nrc
Update the rls and rustfmt submodules

r? @nrc
2017-12-15 13:26:32 +00:00
Oliver Schneider
b1e759762e
Update the rls and rustfmt submodules 2017-12-15 12:29:20 +01:00
bors
b4f323254a Auto merge of #46706 - sunjay:gat-lifetimes, r=nikomatsakis
Lifetime Resolution for Generic Associated Types

Tracking Issue: https://github.com/rust-lang/rust/issues/44265

r? @nikomatsakis

This PR implements lifetime resolution for generic associated types. 🎉

## Remaining Work Before Merge

I'm going to go do these things in the next day or so. Please let me know if you spot anything in my changes until then.

- [x] If I'm not mistaken, at least some tests should pass now. I need to go through the tests and re-enable the ones that should work by removing the appropriate `~ ERROR` comments
2017-12-15 10:50:20 +00:00
Eduard-Mihai Burtescu
8a26e0422d rustc_trans: approximate ABI alignment for padding/union fillers. 2017-12-15 11:35:32 +02:00
bors
04b23449c0 Auto merge of #46653 - estebank:str-as-ch, r=petrochenkov
When attempting to write str with single quote suggest double quotes

Fix #26101.
2017-12-15 08:13:37 +00:00
Esteban Küber
c60aab29f1 When attempting to write str with single quote suggest double quotes 2017-12-14 22:51:42 -08:00
Esteban Küber
02079e44dd Point at var in short lived borrows 2017-12-14 22:45:45 -08:00
bors
84feab34e4 Auto merge of #46537 - pnkfelix:two-phase-borrows, r=arielb1
[MIR-borrowck] Two phase borrows

This adds limited support for two-phase borrows as described in
  http://smallcultfollowing.com/babysteps/blog/2017/03/01/nested-method-calls-via-two-phase-borrowing/

The support is off by default; you opt into it via the flag `-Z two-phase-borrows`

I have written "*limited* support" above because there are simple variants of the simple `v.push(v.len())` example that one would think should work but currently do not, such as the one documented in the test compile-fail/borrowck/two-phase-reservation-sharing-interference-2.rs

(To be clear, that test is not describing something that is unsound. It is just providing an explicit example of a limitation in the implementation given in this PR. I have ideas on how to fix, but I want to land the work that is in this PR first, so that I can stop repeatedly rebasing this branch.)
2017-12-15 05:40:12 +00:00
bors
9331031909 Auto merge of #46701 - eddyb:vector-newtypes, r=nagisa
rustc: unpack newtyped of #[repr(simd)] vector types.

Prerequisite for a `#[repr(transparent)]` implementation that works with SIMD vectors.

cc @rkruppe
2017-12-15 02:59:27 +00:00
bors
2f351415e5 Auto merge of #46641 - petrochenkov:nohelp2, r=nikomatsakis
Move compile-fail tests with NOTE/HELP annotations to UI

Remove NOTE/HELP annotations from UI tests

cc https://github.com/rust-lang/rust/issues/44844 @oli-obk @est31
r? @nikomatsakis
2017-12-15 00:11:40 +00:00
Tshepang Lekhonkhobe
6f6ece2991 doc: a better example
Closes #46734
2017-12-15 02:07:12 +02:00
Felix S. Klock II
159037e053 Address review feedback: don't treat "first" activation special.
Instead, filter out (non-)conflicts of activiations with themselves in
the same manner that we filter out non-conflict between an activation
and its reservation.
2017-12-14 17:34:16 -06:00
Felix S. Klock II
d654cd3b8b Review feedback: Added test with control flow merge of two borrows "before activation"
In reality the currently generated MIR has at least one of the activations
in a copy that occurs before the merge. But still, good to have a test,
in anticipation of that potentially changing...
2017-12-14 16:30:05 -06:00
Felix S. Klock II
b0421fa7de Address review feedback: don't bother skipping reservations paired with activations. 2017-12-14 16:28:26 -06:00
bors
0077d128d3 Auto merge of #45047 - durka:trait-alias, r=petrochenkov
trait alias infrastructure

This will be an implementation of trait aliases (RFC 1733, #41517).

Progress so far:

- [x] Feature gate
- [x] Add to parser
  - [x] `where` clauses
    - [x] prohibit LHS type parameter bounds via AST validation https://github.com/rust-lang/rust/pull/45047#discussion_r143575575
- [x] Add to AST and HIR
  - [x] make a separate PathSource for trait alias contexts https://github.com/rust-lang/rust/pull/45047#discussion_r143353932
- [x] Stub out enough of typeck and resolve to just barely not ICE

Postponed:

- [ ] Actually implement the alias part
- [ ] #21903
- [ ] #24010

I need some pointers on where to start with that last one. The test currently does this:

```
error[E0283]: type annotations required: cannot resolve `_: CD`
  --> src/test/run-pass/trait-alias.rs:34:16
   |
34 |     let both = foo();
   |                ^^^
   |
   = note: required by `foo`
```
2017-12-14 20:57:09 +00:00
Vadim Petrochenkov
66bd53ad2a Fix rebase
Update docs for custom normalization of test output
2017-12-14 23:54:08 +03:00
Vadim Petrochenkov
c3a7d36c6e Support regexes in custom normalization in UI tests 2017-12-14 23:26:40 +03:00
Vadim Petrochenkov
3fe1d9c524 Do the same things for fulldeps tests 2017-12-14 23:26:40 +03:00
Vadim Petrochenkov
1f5b201aff Remove NOTE/HELP annotations from UI tests 2017-12-14 23:26:39 +03:00
Vadim Petrochenkov
d4e51a8fb2 Move compile-fail tests with NOTE/HELP annotations to UI 2017-12-14 23:23:07 +03:00
Vadim Petrochenkov
3a2ad576c5 Remove NOTE/HELP annotations from error index tests 2017-12-14 23:23:07 +03:00
bors
3fc7f8522b Auto merge of #46562 - michaelwoerister:faster-span-hashing, r=eddyb
incr.comp.: Speed up span hashing by caching expansion context hashes.

This PR fixes the performance regressions from https://github.com/rust-lang/rust/pull/46338.

r? @nikomatsakis
2017-12-14 18:22:55 +00:00
Alex Burka
834674fa1d rls depends on rustfmt 2017-12-14 12:56:27 -05:00
Alex Burka
aaeae4c72e error for impl trait alias 2017-12-14 12:56:26 -05:00
Alex Burka
435fe5b794 trait alias fallout 2017-12-14 12:56:26 -05:00
Alex Burka
4f0b4f267f feature gate trait aliases 2017-12-14 12:56:26 -05:00
Alex Burka
4029a01984 error on any use of trait alias 2017-12-14 12:56:26 -05:00
Alex Burka
63f1c24d8a add trait aliases to typeck 2017-12-14 12:56:26 -05:00
Alex Burka
2eefc9db15 add trait aliases to HIR 2017-12-14 12:56:26 -05:00
Alex Burka
1b6ad1e647 stub out trait aliases in librustdoc 2017-12-14 12:56:26 -05:00
Alex Burka
46dc7c59de stub out trait aliases in save_analysis 2017-12-14 12:56:26 -05:00
Alex Burka
f1c4a922fe stub out trait aliases in resolve 2017-12-14 12:56:26 -05:00
Alex Burka
d4a28268cc add trait aliases to AST 2017-12-14 12:56:26 -05:00
Michael Woerister
0b4c2cccac incr.comp.: Do less hashing per Span. 2017-12-14 10:29:16 -06:00
Michael Woerister
9faa31612f incr.comp.: Speed up span hashing by caching expansion context hashes. 2017-12-14 10:15:10 -06:00
bors
2974104276 Auto merge of #45002 - oli-obk:miri, r=eddyb
Validate miri against the HIR const evaluator

r? @eddyb

cc @alexcrichton @arielb1 @RalfJung

The interesting parts are the last few functions in `librustc_const_eval/eval.rs`

* We warn if miri produces an error while HIR const eval does not.
* We warn if miri produces a value that does not match the value produced by HIR const eval
* if miri succeeds and HIR const eval fails, nothing is emitted, but we still return the HIR error
* if both error, nothing is emitted and the HIR const eval error is returned

So there are no actual changes, except that miri is forced to produce the same values as the old const eval.

* This does **not** touch the const evaluator in trans at all. That will come in a future PR.
* This does **not** cause any code to compile that didn't compile before. That will also come in the future

It would be great if someone could start a crater run if travis passes
2017-12-14 15:37:39 +00:00
Felix S. Klock II
b75248ef4e Address review note: AccessErrorsReported meant to track whether error reported at *any* point in past. 2017-12-14 09:03:04 -06:00
Oliver Schneider
7a2bff7f1a
Do not produce debuginfo for tools 2017-12-14 15:40:51 +01:00
varkor
7b5981aad4 Fix division-by-zero ICE in -Z perf-stats
An invalid average now simply prints “N/A”. Fixes #46725.
2017-12-14 14:19:57 +00:00
bors
8624ea5117 Auto merge of #46335 - oli-obk:cleanups, r=jseyfried
Use PathBuf instead of String where applicable

r? @jseyfried
2017-12-14 12:50:00 +00:00
Oliver Schneider
1ba46dc378
Move mir validation out of tree 2017-12-14 11:36:28 +01:00
Oliver Schneider
d732da813b
Use PathBuf instead of String where applicable 2017-12-14 11:22:08 +01:00
bors
75a02a919c Auto merge of #46633 - estebank:arg-mismatch, r=arielb1
Point at whole method call instead of args

To avoid confusion in cases where the code is

```rust
fn foo() {}
/ foo(
|     bar()
|     ^^^ current diagnostics point here for arg count mismatch
| );
|_^ new diagnostic span points here
```

as this leads to confusion making people think that the diagnostic is
talking about `bar`'s arg count, not `foo`'s.

Point at `fn`s definition on arg mismatch, just like we do for closures.

Re #42855, Fix #45633.
2017-12-14 10:08:48 +00:00
bors
8954b16beb Auto merge of #46605 - estebank:macro-backtrace-spans, r=pnkfelix
Use spans for -Z external-macro-backtrace

```
% rustc ui/type-check/cannot_infer_local_or_vec.rs -Z external-macro-backtrace
error[E0282]: type annotations needed
  --> <vec macros>:3:1
   |
1  | / ( $ elem : expr ; $ n : expr ) => (
2  | | $ crate :: vec :: from_elem ( $ elem , $ n ) ) ; ( $ ( $ x : expr ) , * ) => (
3  | | < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ) ) ; ( $ ( $ x : expr , ) * )
   | | ^^^^^^^^^^^^^^^^^^^^^
   | | |
   | | cannot infer type for `T`
4  | | => ( vec ! [ $ ( $ x ) , * ] )
   | |______________________________- in this expansion of `vec!`
   |
  ::: ui/type-check/cannot_infer_local_or_vec.rs
   |
12 |       let x = vec![];
   |           -   ------ in this macro invocation
   |           |
   |           consider giving `x` a type

error: aborting due to previous error
```
2017-12-14 07:06:02 +00:00
Ariel Ben-Yehuda
2679944653 fix broken assertion in type_param
Nested generics (aka method generics) in trait methods don't have an
*additional* Self parameter in their own type parameter list (they have
a Self parameter in the parent generics), so don't try to check we're
correctly adjusting for it.

Fixes #46568.
2017-12-13 23:06:54 -06:00
bors
f03e06762e Auto merge of #46582 - nikomatsakis:nll-master-to-rust-master-4, r=arielb1
make MIR type checker handle a number of other cases

The existing type checker was primarily used to verify types, but was skipping over a number of details. For example, it was not checking that the predicates on functions were satisfied and so forth. This meant that the NLL region checker was not getting a lot of the constraints it needed. This PR closes those gaps. It also includes a bit of refactoring for the way that we store region values, encapsulating the bit matrix over into its own module and improving the data structures in use.

This is mostly work by @spastorino being ported over from nll-master.

r? @arielb1 or @pnkfelix
2017-12-14 04:32:14 +00:00
Felix S. Klock II
f96777c9ff After discussion with ariel, replacing a guard within kill_loans_out_of_scope_at_location.
Instead we are "just" careful to invoke it (which sets up a bunch of kill bits)
before we go into the code that sets up the gen bits.

That way, when the gen bits are set up, they will override any
previously set kill-bits for those reservations or activations.
2017-12-13 18:10:37 -06:00
Felix S. Klock II
3c7d9ff90a Address review comment: use .get instead of indexing to cope w/ terminators.
(Same net effect as code from before; just cleaner way to get there.)
2017-12-13 18:07:02 -06:00