Matthew Jasper
37a99038d0
Remove rustc_mir::borrowck_errors::Origin
2019-07-14 20:20:50 +01:00
Matthew Jasper
2975c01747
Remove unused BorrowckErrors methods
2019-07-14 20:19:16 +01:00
Matthew Jasper
be085d7c0f
Remove rustc_mir dependency from rustc_borrowck
2019-07-11 18:54:02 +01:00
Eduard-Mihai Burtescu
f3f9d6dfd9
Unify all uses of 'gcx and 'tcx.
2019-06-14 18:58:23 +03:00
Eduard-Mihai Burtescu
17cdd356da
rustc: replace TyCtxt<'tcx, 'gcx, 'tcx>
with TyCtxt<'gcx, 'tcx>
.
2019-06-12 13:38:27 +03:00
Eduard-Mihai Burtescu
37799a5552
rustc: replace TyCtxt<'a, 'gcx, 'tcx>
with TyCtxt<'tcx, 'gcx, 'tcx>
.
2019-06-12 13:38:27 +03:00
Matthew Jasper
f7e86a5a49
Improve cannot move errors
...
* Show the place and type being moved
* Give a special error for variables in match guard
* Simplify search for overloaded deref
* Search for overloaded index
2019-06-03 14:55:29 +01:00
Mazdak Farrokhzad
2821329c34
Rollup merge of #60176 - matthewjasper:yield-ref-to-local, r=pnkfelix
...
Explain error when yielding a reference to a local variable
Closes #56508
2019-05-13 21:36:49 +02:00
Christopher Vittal
2a0426c269
Stub display impl for Origin
2019-05-02 15:36:30 -04:00
flip1995
e1da67e69c
Fix lint findings in librustc_mir
2019-04-28 21:19:27 +02:00
Matthew Jasper
d9ea132b73
Explain error when yielding a reference to a local variable
2019-04-22 18:50:26 +01:00
Matthew Jasper
aa6fb6caf9
Enable migrate mode by default on the 2015 edition
...
This also fully stabilizes two-phase borrows on all editions
2019-04-21 20:50:02 +01:00
Taiki Endo
725af30809
librustc_mir => 2018
2019-02-08 06:28:15 +09:00
David Wood
c2b477c19a
Improve diagnostic labels and add note.
...
This commit improves diagnostic labels to mention which field a borrow
overlaps with and adds a note explaining that the fields overlap.
2019-01-04 22:43:51 +01:00
Mark Rousskov
2a663555dd
Remove licenses
2018-12-25 21:08:33 -07:00
Daan de Graaf
1560a75f6a
Refer to the second borrow as the "second borrow".
2018-11-30 14:55:51 +01:00
Matthias Krüger
f6b8876d45
use String::from() instead of format!() macro to construct Strings.
2018-10-31 00:10:10 +01: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
ljedrz
d28aed6dc4
Prefer unwrap_or_else to unwrap_or in case of function calls/allocations
2018-10-19 09:45:45 +02:00
David Wood
aa701154f0
Extend closure special-casing for generators.
...
This commit extends existing special-casing of closures to highlight the
use of variables within generators that are causing the generator to
borrow them.
2018-10-18 17:48:18 +02:00
Felix S. Klock II
ea4d934c32
Change the diagnostic number from 714 to 716.
2018-09-25 15:23:57 +01:00
Mikhail Modin
5fc0b743d7
add "temporary value dropped while borrowed" error
...
Issue #54131
2018-09-25 15:23:56 +01:00
Matthew Jasper
b55bb2e918
Better messages for errors from Shallow borrows
2018-09-24 23:33:13 +01:00
Felix S. Klock II
1f0fbddfff
Fine tune dianostics for when a borrow conflicts with a destructor that needs exclusive access.
...
In particular:
1. Extend `WriteKind::StorageDeadOrDrop` with state to track whether
we are running a destructor or just freeing backing storage. (As
part of this, when we drop a Box<..<Box<T>..> where `T` does not
need drop, we now signal that the drop of `T` is a kind of storage
dead rather than a drop.)
2. When reporting that a value does not live long enough, check if
we're doing an "interesting" drop, i.e. we aren't just trivally
freeing the borrowed state, but rather a user-defined dtor will
run and potentially require exclusive aces to the borrowed state.
3. Added a new diagnosic to describe the scenario here.
2018-09-18 02:06:45 +02:00
Matthias Krüger
ede1f7d2a5
use String::new() instead of String::from(""), "".to_string(), "".to_owned() or "".into()
2018-08-23 10:14:52 +02:00
varkor
6f637da50c
Remove Ty prefix from Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynamic|Closure|Generator|GeneratorWitness|Never|Tuple|Projection|Anon|Infer|Error}
2018-08-22 16:07:44 +01:00
David Wood
43850e0bee
Special case error message for thread-local statics.
2018-08-07 12:08:52 +02:00
Matthew Jasper
903851f785
Highlight closure spans for borrow and initialization errors
2018-08-03 23:00:27 +01:00
Matthew Jasper
13b5f69848
Improve NLL mutability errors
...
* Better explain why the place is immutable
* Distinguish &T and *const T
* Use better spans when a mutable borrow is for a closure capture
2018-07-20 20:01:11 +01:00
Santiago Pastorino
1dae309ca1
Run rustfmt
2018-06-22 18:24:02 -03:00
Santiago Pastorino
ad612d660c
Fix erroneous error note when using field after move
2018-06-22 18:23:33 -03:00
Felix S. Klock II
fbe7d5bce8
When NLL has illegal move due to borrowed content, provide feedback about why the move wasn't a copy.
...
This should address #51190 .
2018-06-06 22:42:27 +02:00
gaurikholkar
e5a96a4b95
modify the error message- CR Comments
2018-04-07 13:17:16 +05:30
gaurikholkar
1fb25fbbe3
reduce nested loops in the code
2018-04-06 20:00:21 +05:30
Gauri Kholkar
c1192065ea
Update borrowck_errors.rs
2018-04-05 22:04:20 +05:30
gaurikholkar
1b06fe1ef5
Merge branch 'master' of https://github.com/rust-lang/rust into e0389
2018-04-05 21:52:40 +05:30
csmoe
55116243e7
remove unneeded where clause
2018-03-18 20:18:21 +08:00
csmoe
c62d9eb729
fix formatting
2018-03-16 14:52:16 +08:00
csmoe
0b111e677c
change &self to self and fix lifetime annotations
2018-03-16 14:52:15 +08:00
gaurikholkar
0c7fc046d3
code refactor, modify compile-fail tests
2018-03-10 20:55:02 +05:30
Michael Woerister
542bc75dea
Turn features() into a query.
2018-03-05 11:05:01 +01:00
Esteban Küber
90bc98c5d1
Modify message to match label
2018-01-10 11:41:12 -08:00
Santiago Pastorino
e980fb8bef
feature nll implies borrowck=mir
2017-12-20 14:38:13 -05:00
Niko Matsakis
0e64a756f8
integrate -Znll-dump-cause into borrowck
2017-12-20 14:04:51 -05:00
est31
c9af68e90c
Replace -Zborrowck-mir with -Zborrowck=mode
...
where mode is one of {ast,mir,compare}.
This commit only implements the functionality.
The tests will be updated in a follow up commit.
2017-11-26 16:36:52 +01:00
Oliver Schneider
6ae440e048
Make the difference between lint codes and error codes explicit
2017-11-02 10:19:41 +01:00
Niko Matsakis
b2c248efea
reorder 'gcx and 'tcx in BorrowckErrors
impl
2017-10-31 12:41:40 -04:00
Niko Matsakis
f700728a3b
make end-point optional in the borrow check
2017-10-31 12:41:39 -04:00
Carol (Nichols || Goulding)
0e46cf4db4
Reword to avoid using either re-assignment or reassignment in errors
2017-10-25 11:29:52 -04:00