]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoMove PhantomData<T> from Shared<T> to users of both Shared and #[may_dangle]
Simon Sapin [Fri, 15 Dec 2017 17:58:40 +0000 (18:58 +0100)]
Move PhantomData<T> from Shared<T> to users of both Shared and #[may_dangle]

After discussing [1] today with @pnkfelix and @Gankro,
we concluded that it’s ok for drop checking not to be much smarter
than the current `#[may_dangle]` design which requires an explicit
unsafe opt-in.

[1] https://github.com/rust-lang/rust/issues/27730#issuecomment-316432083

6 years agoAuto merge of #46740 - oli-obk:rls, r=nrc
bors [Fri, 15 Dec 2017 13:26:32 +0000 (13:26 +0000)]
Auto merge of #46740 - oli-obk:rls, r=nrc

Update the rls and rustfmt submodules

r? @nrc

6 years agoUpdate the rls and rustfmt submodules
Oliver Schneider [Fri, 15 Dec 2017 07:37:30 +0000 (08:37 +0100)]
Update the rls and rustfmt submodules

6 years agoAuto merge of #46706 - sunjay:gat-lifetimes, r=nikomatsakis
bors [Fri, 15 Dec 2017 10:50:20 +0000 (10:50 +0000)]
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. :tada:

## 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

6 years agoAuto merge of #46653 - estebank:str-as-ch, r=petrochenkov
bors [Fri, 15 Dec 2017 08:13:37 +0000 (08:13 +0000)]
Auto merge of #46653 - estebank:str-as-ch, r=petrochenkov

When attempting to write str with single quote suggest double quotes

Fix #26101.

6 years agoWhen attempting to write str with single quote suggest double quotes
Esteban Küber [Mon, 11 Dec 2017 07:35:53 +0000 (23:35 -0800)]
When attempting to write str with single quote suggest double quotes

6 years agoAuto merge of #46537 - pnkfelix:two-phase-borrows, r=arielb1
bors [Fri, 15 Dec 2017 05:40:12 +0000 (05:40 +0000)]
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.)

6 years agoAuto merge of #46701 - eddyb:vector-newtypes, r=nagisa
bors [Fri, 15 Dec 2017 02:59:27 +0000 (02:59 +0000)]
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

6 years agoAuto merge of #46641 - petrochenkov:nohelp2, r=nikomatsakis
bors [Fri, 15 Dec 2017 00:11:40 +0000 (00:11 +0000)]
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

6 years agoAddress review feedback: don't treat "first" activation special.
Felix S. Klock II [Thu, 14 Dec 2017 23:34:16 +0000 (17:34 -0600)]
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.

6 years agoReview feedback: Added test with control flow merge of two borrows "before activation"
Felix S. Klock II [Thu, 14 Dec 2017 22:30:05 +0000 (16:30 -0600)]
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...

6 years agoAddress review feedback: don't bother skipping reservations paired with activations.
Felix S. Klock II [Thu, 14 Dec 2017 22:28:26 +0000 (16:28 -0600)]
Address review feedback: don't bother skipping reservations paired with activations.

6 years agoAuto merge of #45047 - durka:trait-alias, r=petrochenkov
bors [Thu, 14 Dec 2017 20:57:09 +0000 (20:57 +0000)]
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`
```

6 years agoFix rebase
Vadim Petrochenkov [Tue, 12 Dec 2017 20:46:33 +0000 (23:46 +0300)]
Fix rebase

Update docs for custom normalization of test output

6 years agoSupport regexes in custom normalization in UI tests
Vadim Petrochenkov [Sun, 10 Dec 2017 23:08:34 +0000 (02:08 +0300)]
Support regexes in custom normalization in UI tests

6 years agoDo the same things for fulldeps tests
Vadim Petrochenkov [Sun, 10 Dec 2017 21:00:10 +0000 (00:00 +0300)]
Do the same things for fulldeps tests

6 years agoRemove NOTE/HELP annotations from UI tests
Vadim Petrochenkov [Sun, 10 Dec 2017 20:29:24 +0000 (23:29 +0300)]
Remove NOTE/HELP annotations from UI tests

6 years agoMove compile-fail tests with NOTE/HELP annotations to UI
Vadim Petrochenkov [Sun, 10 Dec 2017 19:47:55 +0000 (22:47 +0300)]
Move compile-fail tests with NOTE/HELP annotations to UI

6 years agoRemove NOTE/HELP annotations from error index tests
Vadim Petrochenkov [Sun, 10 Dec 2017 21:12:25 +0000 (00:12 +0300)]
Remove NOTE/HELP annotations from error index tests

6 years agoAuto merge of #46562 - michaelwoerister:faster-span-hashing, r=eddyb
bors [Thu, 14 Dec 2017 18:22:55 +0000 (18:22 +0000)]
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

6 years agorls depends on rustfmt
Alex Burka [Thu, 14 Dec 2017 17:55:20 +0000 (12:55 -0500)]
rls depends on rustfmt

6 years agoerror for impl trait alias
Alex Burka [Wed, 13 Dec 2017 06:56:22 +0000 (01:56 -0500)]
error for impl trait alias

6 years agotrait alias fallout
Alex Burka [Mon, 4 Dec 2017 19:47:49 +0000 (14:47 -0500)]
trait alias fallout

6 years agofeature gate trait aliases
Alex Burka [Sun, 3 Dec 2017 17:55:22 +0000 (12:55 -0500)]
feature gate trait aliases

6 years agoerror on any use of trait alias
Alex Burka [Sun, 3 Dec 2017 17:57:54 +0000 (12:57 -0500)]
error on any use of trait alias

6 years agoadd trait aliases to typeck
Alex Burka [Mon, 9 Oct 2017 15:49:53 +0000 (17:49 +0200)]
add trait aliases to typeck

6 years agoadd trait aliases to HIR
Alex Burka [Mon, 2 Oct 2017 12:28:16 +0000 (12:28 +0000)]
add trait aliases to HIR

6 years agostub out trait aliases in librustdoc
Alex Burka [Mon, 4 Dec 2017 05:07:15 +0000 (00:07 -0500)]
stub out trait aliases in librustdoc

6 years agostub out trait aliases in save_analysis
Alex Burka [Mon, 2 Oct 2017 13:49:11 +0000 (13:49 +0000)]
stub out trait aliases in save_analysis

6 years agostub out trait aliases in resolve
Alex Burka [Mon, 2 Oct 2017 13:48:57 +0000 (13:48 +0000)]
stub out trait aliases in resolve

6 years agoadd trait aliases to AST
Alex Burka [Mon, 2 Oct 2017 12:27:45 +0000 (12:27 +0000)]
add trait aliases to AST

6 years agoincr.comp.: Do less hashing per Span.
Michael Woerister [Fri, 8 Dec 2017 16:07:48 +0000 (17:07 +0100)]
incr.comp.: Do less hashing per Span.

6 years agoincr.comp.: Speed up span hashing by caching expansion context hashes.
Michael Woerister [Thu, 7 Dec 2017 15:46:31 +0000 (16:46 +0100)]
incr.comp.: Speed up span hashing by caching expansion context hashes.

6 years agoAuto merge of #45002 - oli-obk:miri, r=eddyb
bors [Thu, 14 Dec 2017 15:37:39 +0000 (15:37 +0000)]
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

6 years agoAddress review note: `AccessErrorsReported` meant to track whether error reported...
Felix S. Klock II [Thu, 14 Dec 2017 15:03:04 +0000 (09:03 -0600)]
Address review note: `AccessErrorsReported` meant to track whether error reported at *any* point in past.

6 years agoDo not produce debuginfo for tools
Oliver Schneider [Thu, 14 Dec 2017 14:40:51 +0000 (15:40 +0100)]
Do not produce debuginfo for tools

6 years agoAuto merge of #46335 - oli-obk:cleanups, r=jseyfried
bors [Thu, 14 Dec 2017 12:50:00 +0000 (12:50 +0000)]
Auto merge of #46335 - oli-obk:cleanups, r=jseyfried

Use PathBuf instead of String where applicable

r? @jseyfried

6 years agoMove mir validation out of tree
Oliver Schneider [Thu, 14 Dec 2017 10:36:28 +0000 (11:36 +0100)]
Move mir validation out of tree

6 years agoUse PathBuf instead of String where applicable
Oliver Schneider [Thu, 14 Dec 2017 07:09:19 +0000 (08:09 +0100)]
Use PathBuf instead of String where applicable

6 years agoAuto merge of #46633 - estebank:arg-mismatch, r=arielb1
bors [Thu, 14 Dec 2017 10:08:48 +0000 (10:08 +0000)]
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.

6 years agoAuto merge of #46605 - estebank:macro-backtrace-spans, r=pnkfelix
bors [Thu, 14 Dec 2017 07:06:02 +0000 (07:06 +0000)]
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
```

6 years agoAuto merge of #46582 - nikomatsakis:nll-master-to-rust-master-4, r=arielb1
bors [Thu, 14 Dec 2017 04:32:14 +0000 (04:32 +0000)]
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

6 years agoAfter discussion with ariel, replacing a guard within kill_loans_out_of_scope_at_loca...
Felix S. Klock II [Thu, 14 Dec 2017 00:10:37 +0000 (18:10 -0600)]
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.

6 years agoAddress review comment: use `.get` instead of indexing to cope w/ terminators.
Felix S. Klock II [Thu, 14 Dec 2017 00:07:02 +0000 (18:07 -0600)]
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.)

6 years agoAdded test to make sure that undeclared lifetimes are in fact detected
Sunjay Varma [Wed, 13 Dec 2017 23:50:45 +0000 (18:50 -0500)]
Added test to make sure that undeclared lifetimes are in fact detected

6 years agoAdded test to make sure we can refer to the declared traits of a generic associated...
Sunjay Varma [Wed, 13 Dec 2017 23:50:22 +0000 (18:50 -0500)]
Added test to make sure we can refer to the declared traits of a generic associated type

6 years agoAuto merge of #46708 - pnkfelix:fix-issue-46112, r=arielb1
bors [Wed, 13 Dec 2017 23:43:56 +0000 (23:43 +0000)]
Auto merge of #46708 - pnkfelix:fix-issue-46112, r=arielb1

Fix visible_parent_map to choose globally minimal paths

Fix #46112: visible_parent_map construction needs a BFS over whole crate forest to get globally minimal paths.

(There are other latent bugs that were e.g. causing this test case to have weirdness like `<unnamed>` in the diagnostic output. Those bugs are not fixed here, since they are issues long-standing in the stable channel.)

6 years agoUpdating tests to remove all "undeclared lifetime" errors (since those should no...
Sunjay Varma [Wed, 13 Dec 2017 23:27:53 +0000 (18:27 -0500)]
Updating tests to remove all "undeclared lifetime" errors (since those should no longer occur)

6 years agoCheck activation points as the place where mutable borrows become relevant.
Felix S. Klock II [Thu, 7 Dec 2017 16:45:13 +0000 (17:45 +0100)]
Check activation points as the place where mutable borrows become relevant.

Since we are now checking activation points, I removed one of the
checks at the reservation point. (You can see the effect this had on
two-phase-reservation-sharing-interference-2.rs)

Also, since we now have checks at both the reservation point and the
activation point, we sometimes would observe duplicate errors (since
either one independently interferes with another mutable borrow).  To
deal with this, I used a similar strategy to one used as discussed on
issue #45360: keep a set of errors reported (in this case for
reservations), and then avoid doing the checks for the corresponding
activations. (This does mean that some errors could get masked, namely
for conflicting borrows that start after the reservation but still
conflict with the activation, which is unchecked when there was an
error for the reservation. But this seems like a reasonable price to
pay.)

6 years agoSidestep ICE from `MirBorrowckCtxt::find_closure_span`.
Felix S. Klock II [Wed, 13 Dec 2017 06:14:32 +0000 (00:14 -0600)]
Sidestep ICE from `MirBorrowckCtxt::find_closure_span`.

6 years agotwo-phase-reservation-sharing-interference.rs variant that is perhaps more surprising.
Felix S. Klock II [Wed, 6 Dec 2017 11:25:36 +0000 (12:25 +0100)]
two-phase-reservation-sharing-interference.rs variant that is perhaps more surprising.

6 years agotest describing a currently unsupported corner case.
Felix S. Klock II [Wed, 6 Dec 2017 10:56:13 +0000 (11:56 +0100)]
test describing a currently unsupported corner case.

6 years agotests transcribed from nikos blog post.
Felix S. Klock II [Tue, 5 Dec 2017 23:37:06 +0000 (00:37 +0100)]
tests transcribed from nikos blog post.

6 years agothe minimal test for two-phase borrows: the core example from niko's blog post on it.
Felix S. Klock II [Tue, 5 Dec 2017 14:17:06 +0000 (15:17 +0100)]
the minimal test for two-phase borrows: the core example from niko's blog post on it.

6 years agoIncorporate active-borrows dataflow into MIR borrow check, yielding
Felix S. Klock II [Fri, 1 Dec 2017 15:02:15 +0000 (16:02 +0100)]
Incorporate active-borrows dataflow into MIR borrow check, yielding
two-phase `&mut`-borrow support.

This (new) support sits under `-Z two-phase-borrows` debugflag.

(Still needs tests. That's coming next.)

6 years agoAdd some doc to `struct Borrows`.
Felix S. Klock II [Wed, 13 Dec 2017 07:06:39 +0000 (01:06 -0600)]
Add some doc to `struct Borrows`.

6 years agoAdd some doc to `each_borrow_involving_path` iteration function.
Felix S. Klock II [Wed, 13 Dec 2017 06:39:42 +0000 (00:39 -0600)]
Add some doc to `each_borrow_involving_path` iteration function.

6 years agoNew `ActiveBorrows` dataflow for two-phase `&mut`; not yet borrowed-checked.
Felix S. Klock II [Fri, 1 Dec 2017 11:32:51 +0000 (12:32 +0100)]
New `ActiveBorrows` dataflow for two-phase `&mut`; not yet borrowed-checked.

High-level picture: The old `Borrows` analysis is now called
`Reservations` (implemented as a newtype wrapper around `Borrows`);
this continues to compute whether a `Rvalue::Ref` can reach a
statement without an intervening `EndRegion`. In addition, we also
track what `Place` each such `Rvalue::Ref` was immediately assigned
to in a given borrow (yay for MIR-structural properties!).

The new `ActiveBorrows` analysis then tracks the initial use of any of
those assigned `Places` for a given borrow. I.e. a borrow becomes
"active" immediately after it starts being "used" in some way. (This
is conservative in the sense that we will treat a copy `x = y;` as a
use of `y`; in principle one might further delay activation in such
cases.)

The new `ActiveBorrows` analysis needs to take the `Reservations`
results as an initial input, because the reservation state influences
the gen/kill sets for `ActiveBorrows`. In particular, a use of `a`
activates a borrow `a = &b` if and only if there exists a path (in the
control flow graph) from the borrow to that use. So we need to know if
the borrow reaches a given use to know if it really gets a gen-bit or
not.

 * Incorporating the output from one dataflow analysis into the input
   of another required more changes to the infrastructure than I had
   expected, and even after those changes, the resulting code is still
   a bit subtle.

 * In particular, Since we need to know the intrablock reservation
   state, we need to dynamically update a bitvector for the
   reservations as we are also trying to compute the gen/kills
   bitvector for the active borrows.

 * The way I ended up deciding to do this (after also toying with at
   least two other designs) is to put both the reservation state and
   the active borrow state into a single bitvector. That is why we now
   have separate (but related) `BorrowIndex` and
   `ReserveOrActivateIndex`: each borrow index maps to a pair of
   neighboring reservation and activation indexes.

As noted above, these changes are solely adding the active borrows
dataflow analysis (and updating the existing code to cope with the
switch from `Borrows` to `Reservations`). The code to process the
bitvector in the borrow checker currently just skips over all of the
active borrow bits.

But atop this commit, one *can* observe the analysis results by
looking at the graphviz output, e.g. via

```rust
 #[rustc_mir(borrowck_graphviz_preflow="pre_two_phase.dot",
             borrowck_graphviz_postflow="post_two_phase.dot")]
```

Includes doc for `FindPlaceUses`, as well as `Reservations` and
`ActiveBorrows` structs, which are wrappers are the `Borrows` struct
that dictate which flow analysis should be performed.

6 years agoAuto merge of #46715 - kennytm:download-crosstool-ng-from-github, r=TimNN
bors [Wed, 13 Dec 2017 20:55:53 +0000 (20:55 +0000)]
Auto merge of #46715 - kennytm:download-crosstool-ng-from-github, r=TimNN

Download crosstool-ng from GitHub

Workaround the current problem where http://crosstool-ng.org was done, causing all non-x86 jobs to fail spuriously (cc #40474).

If http://crosstool-ng.org becomes online before this PR is merged, this PR should be closed and the tree should be reopened.

6 years agoDownload the crosstool from GitHub instead of crosstool-ng.org
kennytm [Wed, 13 Dec 2017 17:21:33 +0000 (01:21 +0800)]
Download the crosstool from GitHub instead of crosstool-ng.org

Temporary workaround since crosstool-ng.org was down. Consider mirroring
the release tarball as a more permanent solution.

6 years agoAllow `mir::Place` to be used as a key in hashtables.
Felix S. Klock II [Fri, 1 Dec 2017 11:13:01 +0000 (12:13 +0100)]
Allow `mir::Place` to be used as a key in hashtables.

6 years agoImplement Borrow/BorrowMut/ToOwned relationships betweed IdxSetBuf and IdxSet.
Felix S. Klock II [Fri, 1 Dec 2017 11:12:41 +0000 (12:12 +0100)]
Implement Borrow/BorrowMut/ToOwned relationships betweed IdxSetBuf and IdxSet.

6 years agoRefactoring alpha-rename `place` (`BorrowData` field) to `borrowed_place`.
Felix S. Klock II [Tue, 28 Nov 2017 11:49:06 +0000 (12:49 +0100)]
Refactoring alpha-rename  `place` (`BorrowData` field) to `borrowed_place`.

6 years agoRefactoring: Allow `BlockSets.on_entry` to denote locally accumulated intrablock...
Felix S. Klock II [Mon, 27 Nov 2017 16:37:18 +0000 (17:37 +0100)]
Refactoring: Allow `BlockSets.on_entry` to denote locally accumulated intrablock state.

(Still musing about whether it could make sense to revise the design
here to make these constraints on usage explicit.)

6 years agoRefactoring: pull bitvector initialization out from other parts of dataflow.
Felix S. Klock II [Mon, 27 Nov 2017 14:08:11 +0000 (15:08 +0100)]
Refactoring: pull bitvector initialization out from other parts of dataflow.

This is meant to ease development of multi-stage dataflow analyses
where the output from one analysis is used to initialize the state
for the next; in such a context, you cannot start with `bottom_value`
for all the bits.

6 years agoMove error checks out of span for easier to follow `.stderr`
Esteban Küber [Wed, 13 Dec 2017 19:27:18 +0000 (11:27 -0800)]
Move error checks out of span for easier to follow `.stderr`

6 years agocorrect comment in test
Niko Matsakis [Wed, 13 Dec 2017 00:48:29 +0000 (19:48 -0500)]
correct comment in test

6 years agoadd FIXME related to constant well-formedness
Niko Matsakis [Wed, 13 Dec 2017 00:48:16 +0000 (19:48 -0500)]
add FIXME related to constant well-formedness

6 years agocomments for `defining_ty` and `compute_indices`
Niko Matsakis [Wed, 13 Dec 2017 00:46:36 +0000 (19:46 -0500)]
comments for `defining_ty` and `compute_indices`

Plus an extra assertion.

6 years agodocument return value of `add_live_point`
Niko Matsakis [Tue, 12 Dec 2017 19:21:37 +0000 (14:21 -0500)]
document return value of `add_live_point`

6 years agoimprove comments on `safe_to_unsafe_fn_ty` and `coerce_closure_fn_ty`
Niko Matsakis [Tue, 12 Dec 2017 19:21:10 +0000 (14:21 -0500)]
improve comments on `safe_to_unsafe_fn_ty` and `coerce_closure_fn_ty`

6 years agochange to use an O(1) data structure for looking up point indices
Niko Matsakis [Fri, 1 Dec 2017 19:20:48 +0000 (14:20 -0500)]
change to use an O(1) data structure for looking up point indices

Converting a `RegionElementIndex` to a `Location` is O(n) though could
trivially be O(log n), but we don't do it that much anyhow -- just on
error and debugging.

6 years agorefactor region value bitmatrix
Niko Matsakis [Fri, 1 Dec 2017 16:07:53 +0000 (11:07 -0500)]
refactor region value bitmatrix

6 years agofix closure tests now that MIR typeck works properly
Niko Matsakis [Thu, 7 Dec 2017 11:25:59 +0000 (06:25 -0500)]
fix closure tests now that MIR typeck works properly

These tests had FIXMEs for errors that were not previously being
reported.

6 years agoAuto merge of #46550 - jseyfried:cleanup_builtin_hygiene, r=nrc
bors [Wed, 13 Dec 2017 11:09:55 +0000 (11:09 +0000)]
Auto merge of #46550 - jseyfried:cleanup_builtin_hygiene, r=nrc

macros: hygienize use of `core`/`std` in builtin macros

Today, if a builtin macro wants to access an item from `core` or `std` (depending `#![no_std]`), it generates `::core::path::to::item` or `::std::path::to::item` respectively (c.f. `fn std_path()` in `libsyntax/ext/base.rs`).

This PR refactors the builtin macros to instead always emit `$crate::path::to::item` here. That is, the def site of builtin macros is taken to be in `extern crate core;` or `extern crate std;`. Since builtin macros are macros 1.0 (i.e. mostly unhygienic), changing the def site can only effect the resolution of `$crate`.

r? @nrc

6 years agowhen reifying a safe fn as an unsafe fn ptr, insert two casts
Niko Matsakis [Sat, 2 Dec 2017 02:11:25 +0000 (21:11 -0500)]
when reifying a safe fn as an unsafe fn ptr, insert two casts

Otherwise, `run-pass/typeck-fn-to-unsafe-fn-ptr.rs` fails the MIR type checker.

6 years agonormalize fn sig as part of reification
Niko Matsakis [Fri, 1 Dec 2017 18:55:27 +0000 (13:55 -0500)]
normalize fn sig as part of reification

6 years agoMir typeck Cast for Unsize value
Santiago Pastorino [Thu, 30 Nov 2017 19:09:27 +0000 (16:09 -0300)]
Mir typeck Cast for Unsize value

6 years agoMir typeck Cast for ClosureFnPtr value
Santiago Pastorino [Thu, 30 Nov 2017 15:43:32 +0000 (12:43 -0300)]
Mir typeck Cast for ClosureFnPtr value

6 years agoExtract coerce_closure_fn_ty function
Santiago Pastorino [Thu, 30 Nov 2017 15:22:11 +0000 (12:22 -0300)]
Extract coerce_closure_fn_ty function

6 years agoMir typeck Cast for UnsafeFnPtr value
Santiago Pastorino [Thu, 30 Nov 2017 14:07:04 +0000 (11:07 -0300)]
Mir typeck Cast for UnsafeFnPtr value

6 years agoMir typeck Cast for ReifyFnPtr value
Santiago Pastorino [Wed, 29 Nov 2017 11:38:07 +0000 (08:38 -0300)]
Mir typeck Cast for ReifyFnPtr value

6 years agoRestructure a bit check_aggregate_rvalue code
Santiago Pastorino [Tue, 28 Nov 2017 17:54:17 +0000 (14:54 -0300)]
Restructure a bit check_aggregate_rvalue code

6 years agoAdd more debug logs
Santiago Pastorino [Tue, 28 Nov 2017 03:54:50 +0000 (00:54 -0300)]
Add more debug logs

6 years agoCheck functions predicates
Santiago Pastorino [Mon, 27 Nov 2017 15:25:01 +0000 (12:25 -0300)]
Check functions predicates

6 years agoCheck Aggregate predicates
Santiago Pastorino [Sun, 26 Nov 2017 20:28:04 +0000 (17:28 -0300)]
Check Aggregate predicates

6 years agoCheck NullaryOp Rvalue
Santiago Pastorino [Mon, 20 Nov 2017 14:09:45 +0000 (11:09 -0300)]
Check NullaryOp Rvalue

6 years agofix universal regions to handle constant expressions like `[T; 22]`
Niko Matsakis [Mon, 27 Nov 2017 01:05:18 +0000 (20:05 -0500)]
fix universal regions to handle constant expressions like `[T; 22]`

6 years agoCheck Repeat Rvalue
Santiago Pastorino [Tue, 28 Nov 2017 03:39:38 +0000 (00:39 -0300)]
Check Repeat Rvalue

6 years agoAuto merge of #46419 - jseyfried:all_imports_in_metadata, r=nrc
bors [Wed, 13 Dec 2017 08:32:25 +0000 (08:32 +0000)]
Auto merge of #46419 - jseyfried:all_imports_in_metadata, r=nrc

Record all imports (`use`, `extern crate`) in the crate metadata

This PR adds non-`pub` `use` and `extern crate` imports in the crate metadata since hygienic macros invoked in other crates may use them. We already include all other non-`pub` items in the crate metadata. This improves import suggestions in some cases.

Fixes #42337.

r? @nrc

6 years agoImprove pretty printing `$crate::` paths.
Jeffrey Seyfried [Tue, 12 Dec 2017 19:57:58 +0000 (11:57 -0800)]
Improve pretty printing `$crate::` paths.

6 years agoExpanded HIR `--unpretty hir,identified` to include HIR local id.
Felix S. Klock II [Fri, 24 Nov 2017 12:44:36 +0000 (13:44 +0100)]
Expanded HIR `--unpretty hir,identified` to include HIR local id.

Having the HIR local id is useful for cases like understanding the
ReScope identifiers, which are now derived from the HIR local id, and
thus one can map an ReScope back to the HIR node, once one knows what
those local ids are.

6 years agoRevised graphviz rendering API to avoid requiring borrowed state.
Felix S. Klock II [Fri, 24 Nov 2017 12:00:09 +0000 (13:00 +0100)]
Revised graphviz rendering API to avoid requiring borrowed state.

Made `do_dataflow` and related API `pub(crate)`.

6 years agoRegression test for issue #46112.
Felix S. Klock II [Wed, 13 Dec 2017 05:18:53 +0000 (23:18 -0600)]
Regression test for issue #46112.

6 years agoAuto merge of #46616 - cramertj:impl-trait-elision, r=nikomatsakis
bors [Wed, 13 Dec 2017 04:19:26 +0000 (04:19 +0000)]
Auto merge of #46616 - cramertj:impl-trait-elision, r=nikomatsakis

Implement impl Trait lifetime elision

Fixes #43396.

There's one weird ICE in the interaction with argument-position `impl Trait`. I'm still debugging it-- I've left a test for it commented out with a FIXME.

Also included a FIXME to ensure that `impl Trait` traits are caught under the lint in https://github.com/rust-lang/rust/issues/45992.

r? @nikomatsakis

6 years agoTrait item lifetime resolution for GATs
Sunjay Varma [Wed, 13 Dec 2017 02:11:15 +0000 (21:11 -0500)]
Trait item lifetime resolution for GATs

6 years agoAuto merge of #46613 - petrochenkov:absext, r=nikomatsakis
bors [Wed, 13 Dec 2017 01:44:36 +0000 (01:44 +0000)]
Auto merge of #46613 - petrochenkov:absext, r=nikomatsakis

Resolve absolute paths as extern under a feature flag

cc https://github.com/rust-lang/rust/issues/44660
r? @nikomatsakis

6 years agoFix #46112: visible_parent_map construction needs a BFS over whole crate forest.
Felix S. Klock II [Wed, 13 Dec 2017 01:05:12 +0000 (19:05 -0600)]
Fix #46112: visible_parent_map construction needs a BFS over whole crate forest.

6 years agorustc: unpack newtyped of #[repr(simd)] vector types.
Eduard-Mihai Burtescu [Tue, 12 Dec 2017 23:57:56 +0000 (01:57 +0200)]
rustc: unpack newtyped of #[repr(simd)] vector types.

6 years agoAuto merge of #46570 - AgustinCB:issue-46553, r=oli-obk
bors [Tue, 12 Dec 2017 23:08:56 +0000 (23:08 +0000)]
Auto merge of #46570 - AgustinCB:issue-46553, r=oli-obk

Ignore `unsopported constant expr` error

Fixes #46553