Commit Graph

449 Commits

Author SHA1 Message Date
Felix S. Klock II
0cf5f1023e Replaced use of interpret method in mir::dataflow::graphviz with a client-provided closure. 2016-05-24 16:16:42 +02:00
Felix S. Klock II
221cce915a move the tcx and mir parts of associated Ctxt onto each BitDenotation impl. 2016-05-24 15:01:48 +02:00
Felix S. Klock II
ae09c5e36e Moved the four impls of BitDenotation to their own module, mod impls. 2016-05-24 13:26:54 +02:00
Felix S. Klock II
ede29581d2 mir::dataflow::sanity_check: extract an fn each_block to simplify presentation.
As a drive-by: unified pair of match arms that flowed to `bug!`, and
replaced `bug!` invocation with a diagnostic `span_err` invocation.
2016-05-24 12:56:02 +02:00
Felix S. Klock II
b8c6d1c708 Fix comment within sanity_check. 2016-05-24 12:37:39 +02:00
Felix S. Klock II
c48650d14e bug fix to borrowck::indexed_set: wanted bit-count not byte-count. 2016-05-24 12:35:35 +02:00
Jonathan Turner
428099233a Fix #33819 and update ui test 2016-05-23 14:48:11 -04:00
Felix S. Klock II
71af40bb9d revised mir-dataflow so bitvectors carry a phantom type for their index domain.
As some drive-by's:

 * moved bitwise operators into `mod bitslice`

 * factored out `fn gen` and `fn kill` methods on `BlockSets` type

 * removed outdated comment about `fn propagate_call_return`
2016-05-23 18:26:52 +02:00
Felix S. Klock II
0796ee77ba add indexed_set mod for typed wrappers around bitarrays representing sets.
It provides an `Idx` trait for usize wrappers used to represent the
elements of such sets.
2016-05-23 14:31:52 +02:00
Felix S. Klock II
f18bafdbe1 Refactor bitslice: distinguish usize for indexing vs word type being indexed. 2016-05-20 17:40:22 +02:00
Guillaume Gomez
f22c5aab1e Rollup merge of #33676 - rkruppe:e0509-exact-words, r=sanxiyn
Reword the short diagnostic for E0509

Saying that a type *implements* a trait is much more idiomatic than saying it *defines* the trait.
2016-05-20 15:49:52 +02:00
Felix S. Klock II
59008cbd71 review feedback: fix some index-mismatch bugs pointed out by arielb1. 2016-05-20 15:44:30 +02:00
Felix S. Klock II
581195090a Review feedback.
Removed `BitDenotation: DataflowOperator` relationship.

Alpha-renamed `fn initial_value` to `fn bottom_value`.
2016-05-20 14:14:18 +02:00
Felix S. Klock II
a7e3204ac8 mir::dataflow arielb1 review feedback
* removed `on_all_children_bits`, rewriting calls to use `super::on_all_children_bits`

 * moved `fn path` helper routine out of `impl MirBorrowckCtxtPreDataflow`
2016-05-20 13:40:52 +02:00
Felix S. Klock II
9c468f4b65 Added comment pointing out somewhat subtle initialization in fn start_block_effect. 2016-05-20 13:20:33 +02:00
Felix S. Klock II
011c37d59e borrowck::mir: alpha-renamed DropFlagState variant names. 2016-05-20 13:20:00 +02:00
Felix S. Klock II
9fcbe2a2f9 fix comment in impl DataflowOperator for MaybeUninitializedLvals. 2016-05-20 13:18:27 +02:00
Felix S. Klock II
aaad8a209a mir::dataflow::sanity_check: Factor out fn is_rustc_peek helper routine. 2016-05-20 13:18:03 +02:00
Manish Goregaokar
c9ca735a7b Rollup merge of #33353 - timothy-mcroy:E0502, r=sanxiyn
Add error explanation for E0502

I am questioning the order of presentation on the suggested code fixes, but I'm not sure what would be best.  Thoughts?

r? @GuillaumeGomez
2016-05-19 21:21:05 +05:30
Robin Kruppe
e575d19acc Reword the short diagnostic for E0509
Saying that a type *implements* a trait is much more idiomatic than saying it *defines* the trait.
2016-05-19 11:02:41 +02:00
bors
0c5d651d0b Auto merge of #33688 - jonathandturner:fix_old_school, r=nikomatsakis
Fix for old school error issues, improvements to new school

This PR:
* Fixes some old school error issues, specifically #33559, #33543, #33366
* Improves wording borrowck errors with match patterns
* De-emphasize multi-line spans, so we don't color the single source character when we're trying to say "span starts here"
* Rollup of #33392 (which should help fix #33390)

r? @nikomatsakis
2016-05-18 21:19:07 -07:00
bors
9743c661b0 Auto merge of #33710 - Manishearth:rollup, r=Manishearth
Rollup of 5 pull requests

- Successful merges: #33656, #33666, #33673, #33675, #33695
- Failed merges:
2016-05-18 05:04:26 -07:00
Timothy McRoy
acfe199c02 Add descriptive error explanation for E0502 2016-05-17 21:13:02 -05:00
Jonathan Turner
175ecfefd5 Improve a few errors and fix #33366 2016-05-17 06:46:08 -04:00
Felix S. Klock II
8999e877ed mir::dataflow::sanity_check: removed hackish tmp = val propagation code.
(it was an artifact of an earlier design of the `rustc_peek` API, but
its totally unnecessary now.)
2016-05-17 09:06:18 +02:00
Felix S. Klock II
b0b1f4da60 Fix comments in mir::dataflow::sanity_check. 2016-05-17 08:41:41 +02:00
Andrew Paseltiner
f3c63d21c1 Add missing code fence to diagnostics.rs
Closes #33662
2016-05-16 16:57:33 -04:00
Vadim Petrochenkov
aad347c4f7 Remove hir::Ident 2016-05-16 22:25:08 +03:00
Felix S. Klock II
ee44f7ed27 DefinitelyInitializedLvals dataflow op (goal: move away from MaybeUninitializedLvals) 2016-05-16 13:34:33 +02:00
Felix S. Klock II
8956789c35 Little unit tests for MIR dataflow analysis.
These use new `rustc_peek` (whose semantics is driven by attribute
attached to fn).
2016-05-16 13:34:33 +02:00
Felix S. Klock II
5839e6bb10 Add ability to unit-test dataflow results via rustc_peek intrinsic.
(The static semantics of `rustc_peek` is derived from attributes
attached to the function being compiled; in this case,
`rustc_peek(&expr)` observes the dataflow state for the l-value
`expr`.)
2016-05-16 13:34:33 +02:00
Felix S. Klock II
c73f3517a2 Revised mir-dataflow.
Incorporates many fixes contributed by arielb1.

----

revise borrowck::mir::dataflow code to allow varying domain for bitvectors.

This particular code implements the `BitDenotation` trait for three
analyses:

 * `MovingOutStatements`, which, like `borrowck::move_data`, maps each
   bit-index to a move instruction, and a 1 means "the effect of this
   move reaches this point" (and the assigned l-value, if a scoped
   declaration, is still in scope).

 * `MaybeInitializedLvals`, which maps each bit-index to an l-value.
   A 1 means "there exists a control flow path to this point that
   initializes the associated l-value."

 * `MaybeUninitializedLvals`, which maps each bit-index to an l-value
   A 1 means "there exists a control flow path to this point that
   de-initializes the associated l-value."

----

Revised `graphviz` dataflow-rendering support in `borrowck::mir`.

One big difference is that this code is now parameterized over the
`BitDenotation`, so that it can be used to render dataflow results
independent of how the dataflow bitvectors are interpreted; see where
reference to `MoveOut` is replaced by the type parameter `D`.

----

Factor out routine to query subattributes in `#[rustc_mir(..)]`.

(Later commits build upon this for some unit testing and instrumentation.)

----

thread through a tcx so that I can query types of lvalues as part of analysis.

----

Revised `BitDenotation::Ctxt`, allowing variation beyond `MoveData`.

The main motivation is to ease threading through a `TyCtxt`.

(In hindsight it might have been better to instead attach the `TyCtxt`
to each of the different dataflow implementations, but that would
require e.g. switching away from having a `Default` impl, so I am
leaving that experiment for another time.)
2016-05-16 13:34:25 +02:00
Felix S. Klock II
6c72c5fa88 borrowck::mir::gather_moves: create MovePaths for lvalues even if unreferenced.
includes misc bug fixes and removal of useless code.
2016-05-16 10:00:35 +02:00
Felix S. Klock II
d03b341e6b Unit struct defns for 3 dataflow analyses for borrowck::mir::dataflow. 2016-05-16 09:13:42 +02:00
Felix S. Klock II
79ab85544b Remove &self parameter from DataflowOperator::initial_value. 2016-05-16 09:13:42 +02:00
Felix S. Klock II
b4972b00c9 Add helper method for getting the dataflow results at exit from a basic block. 2016-05-16 09:13:42 +02:00
Felix S. Klock II
bfe789c044 fixes to librustc_borrowck::bitslice::bits_to_string, used for graphviz printing. 2016-05-16 09:13:42 +02:00
Felix S. Klock II
cd81b60a4a fix bug in debug! output from rustc::middle::dataflow
(bug was cut/pasted into `rustc_borrowck::bitslice`, so I fixed it
there as well.)
2016-05-16 09:13:42 +02:00
bors
5ebe41835f Auto merge of #33619 - jonathandturner:improve_structured_errors, r=nikomatsakis
Batch of improvements to errors for new error format

This is a batch of improvements to existing errors to help get the most out of the new error format.

* Added labels to primary spans (^^^) for a set of errors that didn't currently have them
* Highlight the source blue under the secondary notes for better readability
* Move some of the "Note:" into secondary spans+labels
* Fix span_label to take &mut instead, which makes it work the same as other methods in that set
2016-05-15 15:08:46 -07:00
Jonathan Turner
65cb5f7378 Add space after equals 2016-05-15 11:57:50 -07:00
Manish Goregaokar
0f4f51b173 Rollup merge of #33533 - GuillaumeGomez:add_E0500, r=steveklabnik
Add E0500 error explanation

r? @Manishearth

Part of #32777.
2016-05-15 20:13:41 +05:30
Manish Goregaokar
7003253b34 Rollup merge of #33475 - billyevans:master, r=guillaumegomez
Add detailed error explanation for E0505

Part of #32777
2016-05-15 20:13:40 +05:30
Jonathan Turner
1b6afd1e42 Update errors to use new error format 2016-05-12 16:48:59 -07:00
Jonathan Turner
f3054ce18c Set of fixes to improve borrowcks that weren't updated 2016-05-12 16:39:19 -07:00
bors
4ec5ce5e44 Auto merge of #33282 - alexcrichton:rustbuild-crate-tests, r=brson
rustbuild: Add support for crate tests + doctests

This commit adds support to rustbuild to run crate unit tests (those defined by
`#[test]`) as well as documentation tests. All tests are powered by `cargo test`
under the hood.

Each step requires the `libtest` library is built for that corresponding stage.
Ideally the `test` crate would be a dev-dependency, but for now it's just easier
to ensure that we sequence everything in the right order.

Currently no filtering is implemented, so there's not actually a method of
testing *only* libstd or *only* libcore, but rather entire swaths of crates are
tested all at once.

A few points of note here are:

* The `coretest` and `collectionstest` crates are just listed as `[[test]]`
  entires for `cargo test` to naturally pick up. This mean that `cargo test -p
  core` actually runs all the tests for libcore.
* Libraries that aren't tested all mention `test = false` in their `Cargo.toml`
* Crates aren't currently allowed to have dev-dependencies due to
  rust-lang/cargo#860, but we can likely alleviate this restriction once
  workspaces are implemented.

cc #31590
2016-05-12 14:31:54 -07:00
Alex Crichton
bb9062a296 rustbuild: Add support for crate tests + doctests
This commit adds support to rustbuild to run crate unit tests (those defined by
`#[test]`) as well as documentation tests. All tests are powered by `cargo test`
under the hood.

Each step requires the `libtest` library is built for that corresponding stage.
Ideally the `test` crate would be a dev-dependency, but for now it's just easier
to ensure that we sequence everything in the right order.

Currently no filtering is implemented, so there's not actually a method of
testing *only* libstd or *only* libcore, but rather entire swaths of crates are
tested all at once.

A few points of note here are:

* The `coretest` and `collectionstest` crates are just listed as `[[test]]`
  entires for `cargo test` to naturally pick up. This mean that `cargo test -p
  core` actually runs all the tests for libcore.
* Libraries that aren't tested all mention `test = false` in their `Cargo.toml`
* Crates aren't currently allowed to have dev-dependencies due to
  rust-lang/cargo#860, but we can likely alleviate this restriction once
  workspaces are implemented.

cc #31590
2016-05-12 08:52:20 -07:00
billyevans
bf09a9eda0 Add detailed error explanation for E0505
Part of #32777
2016-05-11 20:58:19 +01:00
Steve Klabnik
4fe787134a Rollup merge of #33386 - cramertj:E0504, r=steveklabnik
Add detailed error explanation for E0504

Part of #32777
2016-05-11 09:27:43 -04:00
ggomez
7a9f4c22ff Add E0500 error explanation 2016-05-11 08:03:34 +02:00
Eduard Burtescu
a1c170fc35 rustc: Split local type contexts interners from the global one. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
12e56ea56b rustc: Wrap users of InferCtxt in an anonymous scope. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
8a704f6dc7 rustc: Remove the TyCtxt field from ParameterEnvironment. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
76affa5d6f rustc: Split 'tcx into 'gcx and 'tcx for InferCtxt and its users. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
513d392f7e rustc: Replace &'a TyCtxt<'tcx> with a TyCtxt<'a, 'tcx> wrapper. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
8600a67782 mem_categorization: freely_aliasable doesn't need to take TyCtxt. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
0907c198c4 infer: Use methods for creating an InferCtxt. 2016-05-11 04:14:58 +03:00
Georg Brandl
fef827672d borrowck: do not suggest to change "&mut self" to "&mut mut self"
Matching the snippet string might not be the cleanest, but matching
the AST node instead seems to end in a lot of nested `if let`s...

Fixes #31424.
2016-05-10 14:57:44 +02:00
Manish Goregaokar
57fa783d3c
Rollup merge of #33383 - cramertj:E0509, r=Manishearth
Add detailed error explanation for E0509

Part of #32777
2016-05-09 14:59:33 -07:00
Taylor Cramer
38a5338c63 Add detailed error explanation for E0504
Removed unnecessary use of threads from E0504

Cleaned up line ending on E0504

Added more examples for E0504

Changed to erroneous code wording

Switched Rc example to thread/Arc example

Added comments describing why errors no longer occur
2016-05-09 11:05:11 -07:00
Steve Klabnik
0b8a3d5187 Rollup merge of #33412 - cramertj:E0389, r=Manishearth
Add detailed error explanation for E0389

Part of #32777
2016-05-07 15:35:18 -04:00
Taylor Cramer
f25cbe62e8 Add detailed error explanation for E0389
Cleanup of E0389

Added type-d out version of type in E0389 description
2016-05-06 10:47:57 -07:00
Taylor Cramer
50717281af Add detailed error explanation for E0509
Edited the error explanation for E0509 to clarify dropping of moved fields

Edited the error explanation for E0509 to clarify move out of Drop value language

Fixed typeo in last commit to E0509

Switched to erroneous code wording
2016-05-06 10:45:28 -07:00
Taylor Cramer
8facc97711 Add detailed error explanation for E0506
Broke up long lines in E0506

Trimmed E0506 comment to be under max line width

Added function example to E0506

Changed example of erroneous code wording on E0506
2016-05-04 18:40:09 -07:00
Manish Goregaokar
5bac8cb16d
Rollup merge of #33294 - timothy-mcroy:E0501, r=GuillaumeGomez
Add detailed error explanation for E0501

r? @GuillaumeGomez

Bring on the nits!
2016-05-03 19:54:50 +05:30
Niko Matsakis
489a6c95bf replace fileline_{help,note} with {help,note}
The extra filename and line was mainly there to keep the indentation
relative to the main snippet; now that this doesn't include
filename/line-number as a prefix, it is distracted.
2016-05-02 11:49:23 -04:00
Niko Matsakis
5b150cf0ca add borrowck info inline in main snippet
This uses the new `span_label` APIs
2016-05-02 11:47:10 -04:00
Timothy McRoy
3f49920495 Add error explanation for E0501 2016-05-01 13:41:11 -05:00
Niko Matsakis
ecd10f04ce thread tighter span for closures around
Track the span corresponding to the `|...|` part of the closure.
2016-04-24 18:10:57 +05:30
Eduard Burtescu
ffca6c3e15 rustc: move middle::{def,def_id,pat_util} to hir. 2016-04-06 09:14:21 +03:00
Eduard Burtescu
7bebe80bc2 syntax: dismantle ast_util. 2016-04-06 09:04:15 +03:00
Eduard Burtescu
ef4c7241f8 rustc: dismantle hir::util, mostly moving functions to methods. 2016-04-06 09:01:55 +03:00
Eduard Burtescu
8b0937293b rustc: move rustc_front to rustc::hir. 2016-04-06 09:01:55 +03:00
Benjamin Herr
065dcd0702 librustc_borrowck: use bug!(), span_bug!() 2016-03-31 22:04:23 +02:00
Eduard Burtescu
5efdde0de1 rustc: move cfg, infer, traits and ty from middle to top-level. 2016-03-27 01:05:54 +02:00
Niko Matsakis
1c0fa34310 Update borrowck to use repr::* instead of a mix
We should probably settle on some conventions here. In MIR code, I have
generally been importing `*`, but perhaps borrowck does not want to do
that.
2016-03-23 16:42:54 -04:00
Niko Matsakis
3a16f57fbb extend Terminator into a struct so it can have additional fields 2016-03-23 16:42:52 -04:00
Jorge Aparicio
c548eda362 enable question_mark feature in rustc_borrowck 2016-03-22 22:04:10 -05:00
Jorge Aparicio
2628f3cc8f fix alignment 2016-03-22 22:03:54 -05:00
Jorge Aparicio
0f02309e4b try! -> ?
Automated conversion using the untry tool [1] and the following command:

```
$ find -name '*.rs' -type f | xargs untry
```

at the root of the Rust repo.

[1]: https://github.com/japaric/untry
2016-03-22 22:01:37 -05:00
Felix S. Klock II
782c0cf4a2 Add rustbuild dependency from rustc_borrowck upon rustc_mir crate. 2016-03-22 18:09:57 +01:00
Felix S. Klock II
dd99f58fe1 assigning a (MIR) box into an lvalue allocates heap storage that will
need to be initialized. create a MoveOut to represent that deref'ed
`*lval` path.
2016-03-21 18:36:23 +01:00
Felix S. Klock II
5508c40d04 remove uses of RefCell from move data builder. 2016-03-21 18:36:23 +01:00
Felix S. Klock II
dda892a83d Make fn move_path_for take &mut self instead of &self. This is a
precursor for a number of other simplifying changes (mostly removing
uses of `RefCell`).

Factor lookup method out of `fn move_path_for`.
2016-03-21 18:36:23 +01:00
Felix S. Klock II
9901768b4c dont create MovePathIndex's for individual statics.
Instead, create a single MovePathIndex that represents all statics.

(An alternative here would be to disallow representing statics at all.
I am hesitant to do that right now, in part because it could impose a
requirement that I thread checks for static data into the calling
code, either as pre- or post-invocation of `fn move_path_for`.)
2016-03-21 18:36:23 +01:00
Felix S. Klock II
9b67d099f5 Switch newtype Index wrappers to use NonZero instead of INVALID constants. 2016-03-21 18:36:23 +01:00
Felix S. Klock II
7d53a25b38 factor the wrapped Index newtype definitions into a macro. 2016-03-21 18:36:22 +01:00
Felix S. Klock II
24ff327484 Add fn clear_bit method on BitSlice trait for setting a bit to zero. 2016-03-21 18:36:22 +01:00
Felix S. Klock II
5757e65f7a scaffolding for borrowck on MIR.
emit (via debug!) scary message from `fn borrowck_mir` until basic
prototype is in place.

Gather children of move paths and set their kill bits in
dataflow. (Each node has a link to the child that is first among its
siblings.)

Hooked in libgraphviz based rendering, including of borrowck dataflow
state.

doing this well required some refactoring of the code, so I cleaned it
up more generally (adding comments to explain what its trying to do
and how it is doing it).

Update: this newer version addresses most review comments (at least
the ones that were largely mechanical changes), but I left the more
interesting revisions to separate followup commits (in this same PR).
2016-03-21 18:36:22 +01:00
Felix S. Klock II
213d57983d Expose attached attributes to FnKind abstraction so that I can look at them in borrowck. 2016-03-21 18:36:22 +01:00
Felix S. Klock II
baeae780e0 Switch libgraphviz from type params to associated types for Node/Edge. 2016-03-21 18:36:14 +01:00
Aaron Turon
9bcfdb7b9c Move projection_mode to InferContext rather than SelectionContext to reduce chance of bugs 2016-03-14 15:05:13 -07:00
bors
a9ffe67f98 Auto merge of #31606 - Ms2ger:ClosureKind, r=eddyb
Rename ClosureKind variants and stop re-exporting them.
2016-03-07 22:57:38 -08:00
Jeffrey Seyfried
37ba66a66e Rename middle::ty::ctxt to TyCtxt 2016-03-03 07:37:56 +00:00
Steve Klabnik
0a88c8fb19 Rollup merge of #31679 - GuillaumeGomez:long_error_explanation, r=Manishearth
r? @Manishearth
2016-02-17 18:14:36 -05:00
ggomez
1c8766761e Global error explanations improvements 2016-02-15 17:57:21 +01:00
Vadim Petrochenkov
9b40e1e5b3 Rename hir::Pat_ and its variants 2016-02-14 15:25:12 +03:00
bors
3548b8c273 Auto merge of #31524 - jonas-schievink:autoderef, r=steveklabnik 2016-02-13 00:16:03 +00:00
Jonas Schievink
62bada40de Autoderef in librustc_borrowck 2016-02-12 19:28:42 +01:00
bors
ce4b75f256 Auto merge of #30726 - GuillaumeGomez:compile-fail, r=brson
r? @brson
cc @alexcrichton

I still need to add error code explanation test with this, but I can't figure out a way to generate the `.md` files in order to test example source codes.

Will fix #27328.
2016-02-12 18:25:08 +00:00
Ms2ger
c6474af96f Rename ClosureKind variants and stop re-exporting them. 2016-02-12 16:44:27 +01:00
Alex Crichton
2581b14147 bootstrap: Add a bunch of Cargo.toml files
These describe the structure of all our crate dependencies.
2016-02-11 11:12:32 -08:00
Guillaume Gomez
6407b9405f Update long error explanations 2016-02-07 13:03:35 +01:00
Steve Klabnik
674f71edd0 Rollup merge of #31270 - ruud-v-a:improve-e0507, r=steveklabnik
E0507 can occur when you try to move out of a member of a mutably borrowed struct, in which case `mem::replace` can help. Mentioning that here hopefully saves future users a trip to Google.
2016-02-02 00:32:18 -05:00
bors
142214d1f2 Auto merge of #30411 - mitaa:multispan, r=nrc
This allows to render multiple spans on one line, or to splice multiple replacements into a code suggestion.

fixes #28124
2016-01-28 22:13:25 +00:00
Ruud van Asseldonk
f841f061ec Improve message for rustc --explain E0507
E0507 can occur when you try to move out of a member of a mutably
borrowed struct, in which case `mem::replace` can help. Mentioning that
here hopefully saves future users a trip to Google.
2016-01-28 22:27:41 +01:00
mitaa
727f959095 Implement MultiSpan error reporting
This allows to render multiple spans on one line,
or to splice multiple replacements into a code suggestion.
2016-01-28 20:51:06 +01:00
Alex Crichton
2273b52023 mk: Move from -D warnings to #![deny(warnings)]
This commit removes the `-D warnings` flag being passed through the makefiles to
all crates to instead be a crate attribute. We want these attributes always
applied for all our standard builds, and this is more amenable to Cargo-based
builds as well.

Note that all `deny(warnings)` attributes are gated with a `cfg(stage0)`
attribute currently to match the same semantics we have today
2016-01-24 20:35:55 -08:00
Steve Klabnik
3f56b29715 Rollup merge of #31050 - apasel422:issue-31048, r=Manishearth
Closes #31048

r? @Manishearth
2016-01-23 09:38:42 -05:00
Andrew Paseltiner
132ec2cde7 Correct code in E0382 explanation
Closes #31048
2016-01-20 10:21:38 -05:00
bors
4ab9a2d1d6 Auto merge of #30964 - GuillaumeGomez:patch-5, r=Manishearth
r? @Manishearth
2016-01-17 22:51:11 +00:00
Guillaume Gomez
f15512e7f9 Add E0507 error explanation 2016-01-17 14:51:41 +01:00
Alex Crichton
9a4f43b9b6 std: Stabilize APIs for the 1.7 release
This commit stabilizes and deprecates the FCP (final comment period) APIs for
the upcoming 1.7 beta release. The specific APIs which changed were:

Stabilized

* `Path::strip_prefix` (renamed from `relative_from`)
* `path::StripPrefixError` (new error type returned from `strip_prefix`)
* `Ipv4Addr::is_loopback`
* `Ipv4Addr::is_private`
* `Ipv4Addr::is_link_local`
* `Ipv4Addr::is_multicast`
* `Ipv4Addr::is_broadcast`
* `Ipv4Addr::is_documentation`
* `Ipv6Addr::is_unspecified`
* `Ipv6Addr::is_loopback`
* `Ipv6Addr::is_unique_local`
* `Ipv6Addr::is_multicast`
* `Vec::as_slice`
* `Vec::as_mut_slice`
* `String::as_str`
* `String::as_mut_str`
* `<[T]>::clone_from_slice` - the `usize` return value is removed
* `<[T]>::sort_by_key`
* `i32::checked_rem` (and other signed types)
* `i32::checked_neg` (and other signed types)
* `i32::checked_shl` (and other signed types)
* `i32::checked_shr` (and other signed types)
* `i32::saturating_mul` (and other signed types)
* `i32::overflowing_add` (and other signed types)
* `i32::overflowing_sub` (and other signed types)
* `i32::overflowing_mul` (and other signed types)
* `i32::overflowing_div` (and other signed types)
* `i32::overflowing_rem` (and other signed types)
* `i32::overflowing_neg` (and other signed types)
* `i32::overflowing_shl` (and other signed types)
* `i32::overflowing_shr` (and other signed types)
* `u32::checked_rem` (and other unsigned types)
* `u32::checked_neg` (and other unsigned types)
* `u32::checked_shl` (and other unsigned types)
* `u32::saturating_mul` (and other unsigned types)
* `u32::overflowing_add` (and other unsigned types)
* `u32::overflowing_sub` (and other unsigned types)
* `u32::overflowing_mul` (and other unsigned types)
* `u32::overflowing_div` (and other unsigned types)
* `u32::overflowing_rem` (and other unsigned types)
* `u32::overflowing_neg` (and other unsigned types)
* `u32::overflowing_shl` (and other unsigned types)
* `u32::overflowing_shr` (and other unsigned types)
* `ffi::IntoStringError`
* `CString::into_string`
* `CString::into_bytes`
* `CString::into_bytes_with_nul`
* `From<CString> for Vec<u8>`
* `From<CString> for Vec<u8>`
* `IntoStringError::into_cstring`
* `IntoStringError::utf8_error`
* `Error for IntoStringError`

Deprecated

* `Path::relative_from` - renamed to `strip_prefix`
* `Path::prefix` - use `components().next()` instead
* `os::unix::fs` constants - moved to the `libc` crate
* `fmt::{radix, Radix, RadixFmt}` - not used enough to stabilize
* `IntoCow` - conflicts with `Into` and may come back later
* `i32::{BITS, BYTES}` (and other integers) - not pulling their weight
* `DebugTuple::formatter` - will be removed
* `sync::Semaphore` - not used enough and confused with system semaphores

Closes #23284
cc #27709 (still lots more methods though)
Closes #27712
Closes #27722
Closes #27728
Closes #27735
Closes #27729
Closes #27755
Closes #27782
Closes #27798
2016-01-16 11:03:10 -08:00
Niko Matsakis
20e088c4e2 fallout from removing the errors_will_be_reported flag 2016-01-16 05:22:32 -05:00
Simonas Kazlauskas
caf6095fcf Rollup merge of #30737 - Ms2ger:MutateMode, r=sanxiyn 2016-01-11 21:17:52 +02:00
Ms2ger
6f0e58fc5f Stop re-exporting MutateMode's variants. 2016-01-06 13:16:30 +01:00
Niko Matsakis
005fa14358 Annotate the compiler with information about what it is doing when. 2016-01-05 21:05:50 -05:00
Nick Cameron
95dc7efad0 use structured errors 2015-12-30 14:27:59 +13:00
Alex Crichton
cd1848a1a6 Register new snapshots
Lots of cruft to remove!
2015-12-21 09:26:21 -08:00
Jeffrey Seyfried
8364a6feef Remove unused imports 2015-12-17 05:43:27 +00:00
Ms2ger
9a0ab50ac0 Stop re-exporting RestrictionResult variants. 2015-12-15 16:15:59 +01:00
w00ns
43725dcb39 Fix for issue #27889: same field names in enum variants 2015-12-11 14:45:07 +01:00
bors
f41f327f7f Auto merge of #30185 - fhahn:improve-borrowck-public-accessibility, r=pnkfelix
This PR makes `AnalysisData` and`BorrowckCtxt` public. Those types are returned by the public function `build_borrowck_dataflow_data_for_fn` and are needed if a caller wants to pass on the return values.

It also removes `FnPartsWithCFG`, which required callers of  `build_borrowck_dataflow_data_for_fn` to have a reference to a `CFG` with the same lifetime as `FnParts`, which is more limiting than required.
2015-12-05 09:08:14 +00:00
Florian Hahn
b1b40c7ef6 Make public borrowck api more accessible 2015-12-03 18:47:47 +01:00
Tobias Bucher
57dad535f5 s/isize/i32 2015-12-02 09:06:28 +00:00
Florian Hahn
e48030d7d1 Replace uses of int/uint with isize/uzsize in doc examples 2015-12-01 21:21:45 +01:00
bors
e9ac44026d Auto merge of #29383 - petrochenkov:empstr, r=pnkfelix
Fixes https://github.com/rust-lang/rust/issues/28692
Fixes https://github.com/rust-lang/rust/issues/28992
Fixes some other similar issues (see the tests)

[breaking-change], needs crater run (cc @brson or @alexcrichton )

The pattern with parens `UnitVariant(..)` for unit variants seems to be popular in rustc (see the second commit), but mostly used by one person (@nikomatsakis), according to git blame. If it causes breakage on crates.io I'll add an exceptional case for it.
2015-11-28 00:45:34 +00:00
Vadim Petrochenkov
be8ace8cac Remove all uses of #[staged_api] 2015-11-25 21:55:26 +03:00
Ms2ger
0eebc0cc04 Use the EntryOrExit variants qualified. 2015-11-24 13:06:12 +01:00
Vadim Petrochenkov
35749923ee Fix the fallout 2015-11-19 11:41:09 +03:00
Niko Matsakis
e4ff9f71db Port a bunch of code new-visitor; all of these ports were
straightforward uses of `visit_all_items`. In some cases I had to remove
empty `visit_item` calls that were just to suppress visiting nested
items.
2015-11-18 19:22:18 -05:00
Oliver Schneider
e36872da5b ImplItem_ -> ImplItemKind rename 2015-11-16 10:35:30 +01:00
Oliver Schneider
eaaa60dbea rename ImplItem_::*ImplItem to ImplItem_::*
[breaking change]
2015-11-16 10:34:45 +01:00
Jonathan S
d842a54b25 Stop using dynamic borrowing in MoveErrorCollector 2015-11-14 17:39:15 -06:00
Seo Sanghyeon
0b3394a4d5 Suggest mut for mutability errors 2015-11-10 13:05:28 +09:00
Ms2ger
9e135f7b15 Rename categorization and stop re-exporting its variants. 2015-10-29 09:38:11 +01:00
bors
8a72584f97 Auto merge of #28833 - jryans:borrowck-linear-errors, r=pnkfelix
Change error reporting of conflicting loans to stop earlier after printing
an error for a given borrow, instead of proceeding to error on possibly every
issued loan.  This keeps us down to O(n) errors (for n problem lines), instead
of O(n^2) errors in some cases.

Fixes #27485.
2015-10-27 21:04:59 +00:00
Cristi Cobzarenco
4b308b44e1 typos: fix a grabbag of typos all over the place 2015-10-08 19:49:31 +01:00
J. Ryan Stinnett
ba9c383790 Only report error for first issued loan with conflict
Change error reporting of conflicting loans to stop earlier after printing
an error for a given borrow, instead of proceeding to error on possibly every
issued loan.  This keeps us down to O(n) errors (for n problem lines), instead
of O(n^2) errors in some cases.

Fixes #27485.
2015-10-04 04:57:32 -05:00
Niko Matsakis
5600c6282e move direct accesses of node to go through as_local_node_id, unless
they are being used as an opaque "position identifier"
2015-10-01 10:37:19 -04:00
Niko Matsakis
dc4a4ada58 move LOCAL_CRATE to cstore 2015-10-01 09:44:28 -04:00
Vadim Petrochenkov
f284cbc7af Cleanup interfaces of Name, SyntaxContext and Ident
Make sure Name, SyntaxContext and Ident are passed by value
Make sure Idents don't serve as keys (or parts of keys) in maps, Ident comparison is not well defined
2015-09-24 23:05:02 +03:00
Vadim Petrochenkov
40ce80484c Remove random Idents outside of libsyntax 2015-09-23 20:04:49 +03:00
Guillaume Gomez
1adcfb8c13 Add librustc_trans error codes 2015-09-19 17:04:27 +02:00
Guillaume Gomez
7badafa593 Add url to rust-book 2015-09-18 19:12:27 +02:00
Guillaume Gomez
bc72f540ac Add span_err_with_code method for BorrowckCtxt struct 2015-09-17 23:31:37 +02:00
Guillaume Gomez
37cfa75d43 Add error codes for librustc_borrowck 2015-09-16 23:55:33 +02:00
Nick Cameron
e9f1b06329 Use ast attributes every where (remove HIR attributes).
This could be a [breaking-change] if your lint or syntax extension (is that even possible?) uses HIR attributes or literals.
2015-09-16 10:57:06 +12:00
Niko Matsakis
01de381b48 Treat loans of 'static data as extending to the end of the enclosing
fn. Fixes #27616.
2015-09-09 16:04:55 -04:00
Nick Cameron
facdf2ebb1 Add an intital HIR and lowering step 2015-09-03 10:02:36 +12:00
bors
8f28c9b01e Auto merge of #28007 - Ms2ger:FnKind, r=nrc
There is no longer a need for that pattern, since enums are now qualified.
2015-08-31 01:09:40 +00:00