Mazdak Farrokhzad
0cb9e36090
rustc -> rustc_middle part 2
2020-03-30 07:16:56 +02:00
Mazdak Farrokhzad
632c0af38f
borrowck diagnostics: address review comments.
2020-03-26 02:13:17 +01:00
Mazdak Farrokhzad
c70aa344e4
borrowck: prefer "value" over "_
".
2020-03-25 11:42:25 +01:00
Mazdak Farrokhzad
de6046fa0f
remove rustc_error_codes deps except in rustc_driver
2020-01-18 21:53:53 +01:00
Mazdak Farrokhzad
2c3e5d3de0
- remove syntax::{span_warn!, span_err!, span_fatal!. struct_err!}
...
- remove syntax::{help!, span_help!, span_note!}
- remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!}
- lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints
- inline syntax::{struct_span_warn!, diagnostic_used!}
- stringify_error_code! -> error_code! & use it more.
- find_plugin_registrar: de-fatalize an error
- de-fatalize metadata errors
- move type_error_struct! to rustc_typeck
- struct_span_err! -> rustc_errors
2020-01-08 04:25:33 +01:00
Vadim Petrochenkov
70f1d57048
Rename syntax_pos
to rustc_span
in source code
2020-01-01 09:15:18 +03:00
Mark Rousskov
a06baa56b9
Format the world
2019-12-22 17:42:47 -05:00
Guillaume Gomez
798e389e57
Update to use new librustc_error_codes library
2019-11-14 13:05:42 +01:00
Matthew Jasper
7320818292
Fix soundness issue with index bounds checks
...
An expression like `x[1][{ x = y; 2}]` would perform the bounds check
for the inner index operation before evaluating the outer index. This
would allow out of bounds memory accesses.
2019-11-11 22:06:54 +00:00
varkor
e2e0f9af85
Rename sty
to kind
2019-09-25 15:50:04 +01:00
Alexander Regueiro
022d9c8eb5
Fixed grammar/style in error messages and reblessed tests.
2019-09-06 03:46:08 +01:00
Matthew Jasper
9709b73561
pub(crate)
-> crate
...
The borrow checker code is already using `crate` extensively, so prefer
being consistent with it.
2019-07-14 20:22:20 +01:00
Matthew Jasper
2cc2b942cf
Remove BorrowckErrors trait
...
Its methods are now inherent methods of `MirBorrowckCtxt`
2019-07-14 20:22:19 +01:00
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