Commit Graph

202 Commits

Author SHA1 Message Date
csmoe
48de0ff333 add non-copy note to stderr 2018-12-29 10:36:23 +08:00
csmoe
8d77c7c037 retrieve ty info from place_ty
describe index with _
2018-12-27 17:25:45 +08:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
bors
14b96659e4 Auto merge of #57088 - euclio:non-camel-case-early-lint, r=estebank
make non_camel_case_types an early lint

This allows us to catch these kinds of style violations much earlier, as evidenced by the large number of tests that had to be updated for this change.
2018-12-25 16:12:24 +00:00
bors
27a25df2e2 Auto merge of #56962 - nivkner:fixme_fixup4, r=pnkfelix
address some FIXME whose associated issues were marked as closed

part of #44366
2018-12-25 13:32:31 +00:00
Andy Russell
6474de904c
make non_camel_case_types an early lint 2018-12-24 12:58:52 -05:00
Niv Kaminer
e32c63eedc bless ui tests in compare mode 2018-12-23 09:23:50 +02:00
David Wood
22b2bd8657
Update migrate warning wording.
This commit modifies the wording of the warning for
backwards-incompatible changes in migrate mode. The warning messages are
changed to be lowercase and not include line-breaks in order to be
consistent with other compiler diagnostics.
2018-12-22 14:54:30 +01:00
Niv Kaminer
e06b81e029 FIXME(21232) update fixme to point to the open issue about accepting partial initialization 2018-12-19 10:51:47 +02:00
Niv Kaminer
cc568e7be1 FIXME(49824) remove fixme because there is no free region error anymore 2018-12-19 10:51:47 +02:00
Matthew Jasper
cdd537339e Make determining the discriminant a normal Shallow read
Enum layout optimizations mean that the discriminant of an enum may not
be stored in a tag disjoint from the rest of the fields of the enum.
Stop borrow checking as though they are.
2018-12-13 20:53:07 +00:00
Alexander Regueiro
ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
Pietro Albini
b2a002dc4b
Rollup merge of #56372 - wildarch:issue-55314-second-borrow-ref, r=davidtwco
Refer to the second borrow as the "second borrow" in E0501.rs

Fixes #55314.

r? @davidtwco
2018-12-05 23:54:27 +01:00
Oliver Scherer
61efc3b71b Update tests 2018-12-04 10:06:05 +01:00
Daan de Graaf
1560a75f6a Refer to the second borrow as the "second borrow". 2018-11-30 14:55:51 +01:00
Matthew Jasper
b16985a354 Remove mir::StatementKind::EndRegion
Since lexical MIR borrow check is gone, and validation no longer uses
these, they can be removed.
2018-11-18 11:05:19 +00:00
bors
5a2ca1a6f1 Auto merge of #55657 - davidtwco:issue-55651, r=pnkfelix
NLL Diagnostic Review 3: Unions not reinitialized after assignment into field

Fixes #55651, #55652.

This PR makes two changes:

First, it updates the dataflow builder to add an init for the place
containing a union if there is an assignment into the field of
that union.

Second, it stops a "use of uninitialized" error occuring when there is an
assignment into the field of an uninitialized union that was previously
initialized. Making this assignment would re-initialize the union, as
tested in `src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr`.
The check for previous initialization ensures that we do not start
supporting partial initialization yet (cc #21232, #54499, #54986).

This PR also fixes #55652 which was marked as requiring investigation
as the changes in this PR add an error that was previously missing
(and mentioned in the review comments) and confirms that the error
that was present is correct and a result of earlier partial
initialization changes in NLL.

r? @pnkfelix (due to earlier work with partial initialization)
cc @nikomatsakis
2018-11-11 17:05:36 +00:00
Pietro Albini
18195d4133
Rollup merge of #55801 - pnkfelix:update-box-insensitivity-test-for-nll, r=davidtwco
NLL: Update box insensitivity test

This is just keeping one of our tests honest with respect to NLL, in two ways:

 1. Adds uses of borrows that would otherwise be too short to observe the error that we would have expected to see...
 2. ... I say "would have expected" because all of the errors in this file are part of the reversion of rust-lang/rfcs#130 that is attached to NLL (you can see more discussion of this here https://github.com/rust-lang/rust/issues/43234#issuecomment-411017768 )
2018-11-11 00:21:17 +01:00
bors
4cd3294a1d Auto merge of #55637 - pnkfelix:issue-55552-dont-attempt-to-ascribe-projections-out-of-a-ty-var, r=nikomatsakis
Do not attempt to ascribe projections out of a ty var

If we encounter `_` ascribed to structural pattern like `(a, b)`, just skip relate_types.

Fix #55552
2018-11-10 09:38:10 +00:00
Felix S. Klock II
9b6a568c6f Fix the expected error annotations.
(The commit prior to this actual passes our test suite, "thanks"
to #55695. But since I am aware of that bug, I took advantage of it
in choosing how to order my commit series...)
2018-11-09 00:26:28 +01:00
Felix S. Klock II
d0151cac17 Switch to using // revisions to explicit encode NLL's change to Box treatment. 2018-11-09 00:21:46 +01:00
Felix S. Klock II
92ef0c4bff Make test robust to NLL, in sense of ensuring borrows extend to something approximating lexical scope. 2018-11-09 00:14:11 +01:00
Felix S. Klock II
b75fbbf540 Make ui/borrowck/borrowck-overloaded-call.rs robust w.r.t. NLL. 2018-11-05 16:29:41 +01:00
Felix S. Klock II
c25319fcfc Update ui/borrowck/borrowck-closures-mut-of-imm.rs robust w.r.t. NLL. 2018-11-05 15:26:02 +01:00
Felix S. Klock II
fe29cd0a3d Add ui/borrowck/borrowck-closures-mut-of-mut.rs.
This is a variant of `ui/borrowck/borrowck-closures-mut-of-imm.rs`
that I used to help identify what changes I needed to make to the
latter file in order to recover its instances of E0524 under NLL.

(Basically this test includes the changes you'd need to make to
`ui/borrowck/borrowck-closures-mut-of-imm.rs` in order to get rid of
occurrences of E0596. And then I realized that one needs to add
invocations of the closures in order to properly extend the mutable
reborrows in a manner such that NLL will roughly match AST-borrowck.)
2018-11-05 15:26:02 +01:00
Felix S. Klock II
9843a38632 Make ui/borrowck/borrowck-unboxed-closures.rs robust w.r.t. NLL. 2018-11-05 15:26:02 +01:00
Felix S. Klock II
6c7d82e1ca Make ui/borrowck/borrowck-reborrow-from-mut.rs robust w.r.t. NLL. 2018-11-05 15:26:02 +01:00
Felix S. Klock II
9f9bf94b8d Make ui/borrowck/borrowck-overloaded-index-move-index.rs robust w.r.t. NLL. 2018-11-05 15:26:02 +01:00
Felix S. Klock II
5f524ed5c4 Switch to using revisions in borrowck-lend-flow-loop.rs
Most of the time we want to robustify tests, but in this case this
test is deliberately encoding artifacts of AST-borrowck.  So instead
of adding artificial uses that would obscure the aspects of
AST-borrowck that are being tests, we instead use revisions and then
mark the cases that apply to NLL as well as AST-borrowck.
2018-11-05 15:26:02 +01:00
David Wood
a4e0945621
Unions reinitialized after assignment into field.
This commit makes two changes:

First, it updates the dataflow builder to add an init for the place
containing a union if there is an assignment into the field of
that union.

Second, it stops a "use of uninitialized" error occuring when there is an
assignment into the field of an uninitialized union that was previously
initialized. Making this assignment would re-initialize the union, as
tested in `src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr`.
The check for previous initialization ensures that we do not start
supporting partial initialization yet (cc #21232, #54499, #54986).
2018-11-03 18:14:21 +01:00
Felix S. Klock II
1bbaa55341 Regression test for issue 55552. 2018-11-03 02:03:04 +01:00
kennytm
93f84e5586
Rollup merge of #55494 - pnkfelix:issue-55492-borrowck-migrate-must-look-at-parents-of-closures, r=davidtwco
borrowck=migrate must look at parents of closures

This fixes the NLL migration mode (which is the default with edition=2018) to inspect all parents of a closure in addition to the closure itself when looking to see if AST-borrowck issues an error for the given code.

This should be a candidate for beta backport.

Fix #55492
2018-10-30 18:55:37 +08:00
Felix S. Klock II
87ce5ec6e9 Update compare-mode=nll stderr files to reflect the fix to #55492. 2018-10-30 00:37:38 +01:00
Felix S. Klock II
d5798c9554 Regression test for issue 55492. 2018-10-30 00:25:09 +01:00
Matthew Jasper
42a541e0f1 Don't emit cannot move errors twice in migrate mode 2018-10-29 20:22:01 +00:00
bors
f32f1113c9 Auto merge of #55150 - pnkfelix:issues-47215-54797-fix-ice-from-moving-out-of-thread-local-under-ast-borrowck, r=nikomatsakis
Do not allow moving out of thread local under ast borrowck

AST borrowck failed to prevent moving out of a thread-local static.

This was broken. And it also (sometimes?) caused an ICE during drop elaboration.

Fix #47215
Fix #54797
2018-10-27 09:56:37 +00:00
Matthew Jasper
2a3969a3f7 Use new region infer errors for explaining borrows
This gives at least some explanation for why a borrow is expected to
last for a certain free region. Also:

* Reports E0373: "closure may outlive the current function" with NLL.
* Special cases the case of returning a reference to (or value
  referencing) a local variable or temporary (E0515).
* Special case assigning a reference to a local variable in a closure
  to a captured variable.
2018-10-21 12:35:00 +01:00
Matthew Jasper
275432c115 Give an error number for "borrowed data escapes outside of closure" 2018-10-20 23:11:30 +01:00
kennytm
bea91dcb69
Rollup merge of #55090 - pnkfelix:issue-54597-regression-test, r=estebank
regression test for move out of borrow via pattern

regression test for issue #54597.

(We may have other tests that cover this, but I couldn't immediately find them associated with the PR that originally fixed the ICE here.)
2018-10-18 12:54:59 +08:00
bors
f7eb7fbbf6 Auto merge of #55134 - davidtwco:issue-55118, r=pnkfelix
NLL: change compare-mode=nll to use borrowck=migrate

Fixes #55118.

This PR is split into two parts:

The first commit is a minor change that fixes a flaw in the existing `borrowck=migrate` implementation whereby a lint that was promoted to an error in the AST borrow checker would result in the same lint from the NLL borrow checker being downgraded to a warning in migrate mode. This PR fixes this by ensuring lints are exempt from buffering in the NLL borrow checker.

The second commit updates `compiletest` to make the NLL compare mode use `-Z borrowck=migrate` rather than `-Z borrowck=mir`. The third commit shows all the test output changes that result from this.

r? @pnkfelix
2018-10-17 23:16:10 +00:00
Felix S. Klock II
1d46ce5a72 Add regression test for issue 47215. 2018-10-17 16:32:43 +02:00
Felix S. Klock II
e6e4fe6209 Update existing tests and .stderr files to reflect introduction of thread-local mem category. 2018-10-17 16:32:03 +02:00
Felix S. Klock II
233fdb4b14 Some new tests I added. 2018-10-17 02:33:03 +02:00
David Wood
539404b77d
Update output for borrowck=migrate compare mode.
This commit updates the test output for the updated NLL compare mode
that uses `-Z borrowck=migrate` rather than `-Z borrowck=mir`. The
previous commit changes `compiletest` and this commit only updates
`.nll.stderr` files.
2018-10-17 00:57:32 +02:00
Felix S. Klock II
b10beb3233 updates to existing ui/borrowck tests. 2018-10-16 17:11:33 +02:00
Felix S. Klock II
481ad0ea35 regression test for issue #54597 2018-10-15 14:07:19 +02:00
bors
c47785f6be Auto merge of #54945 - estebank:asm-span, r=petrochenkov
Point to variable in `asm!` macro when failing borrowck

Fix #34940.
2018-10-13 00:56:30 +00:00
kennytm
44a527a27a
Rollup merge of #54825 - davidtwco:issue-52663-deref-raw-pointer, r=pnkfelix
NLL says "borrowed content" instead of more precise "dereference of raw pointer"

Part of #52663.

Previously, move errors involving the dereference of a raw pointer would
say "borrowed content". This commit changes it to say "dereference of
raw pointer".

r? @nikomatsakis
cc @pnkfelix
2018-10-12 22:04:03 +08:00
Esteban Küber
57f10c7911 Point to variable in asm! macro when failing borrowck 2018-10-09 15:53:37 -07:00
David Wood
98633b458b
Improve message for closure returning a closure.
Now when a `FnMut` closure is returning a closure that contains a
reference to a captured variable, we provide an error that makes it more
clear what is happening.
2018-10-09 12:31:51 +02:00