Commit Graph

54526 Commits

Author SHA1 Message Date
Carlo Teubner
2c937204e9 parser.rs: fix typos in comments 2016-05-25 20:02:20 +00:00
bors
34fd686681 Auto merge of #33667 - pnkfelix:fixes-to-mir-dataflow, r=arielb1
Fixes to mir dataflow

Fixes to mir dataflow

This collects a bunch of changes to `rustc_borrowck::borrowck::dataflow` (which others have pointed out should probably migrate to some crate that isn't tied to the borrow-checker -- but I have not attempted that here, especially since there are competing approaches to dataflow that we should also evaluate).

These changes:
 1. Provide a family of related analyses: MovingOutStatements (which is what the old AST-based dataflo computed), as well as MaybeInitialized, MaybeUninitalized, and DefinitelyInitialized.
   * (The last two are actually inverses of each other; we should pick one and drop the other.)
 2. Fix bugs in the pre-existing analysis implementation, which was untested and thus some obvious bugs went unnoticed, which brings us to the third point:
 3. Add a unit test infrastructure for the MIR dataflow analysis.
   * The tests work by adding a new intrinsic that is able to query the analysis state for a particular expression (technically, a particular L-value).
   * See the examples in compile-fail/mir-dataflow/inits-1.rs and compile-fail/mir-dataflow/uninits-1.rs
   * These tests are only checking the results for MaybeInitialized, MaybeUninitalized, and DefinitelyInitialized; I am not sure if it will be feasible to generalize this testing strategy to the MovingOutStatements dataflow operator.
2016-05-25 12:34:39 -07:00
Vadim Petrochenkov
dcea4b2626 Fix rebase 2016-05-25 22:17:58 +03:00
Vadim Petrochenkov
1a1de5bf89 Add a new AST-only type variant ImplicitSelf 2016-05-25 21:55:04 +03:00
Vadim Petrochenkov
5660a00486 Remove ExplicitSelf from AST 2016-05-25 21:55:04 +03:00
Ariel Ben-Yehuda
040fc94b4e catch attempts to leak obligations out of snapshots 2016-05-25 21:12:35 +03:00
bors
da66f2fd8c Auto merge of #33713 - LeoTestard:macro-rules-invalid-lhs, r=pnkfelix
Make sure that macros that didn't pass LHS checking are not expanded.

This avoid duplicate errors for things like invalid fragment specifiers, or
parsing errors for ambiguous macros.
2016-05-25 09:40:06 -07:00
Felix S. Klock II
df5c116250 Alpha rename OwnIdxSet to IdxSetBuf. 2016-05-25 15:55:46 +02:00
Felix S. Klock II
ad0e6adbb1 fixes to indexed_set: add comments and fix PhantomData def'n. 2016-05-25 15:53:59 +02:00
Felix S. Klock II
a28771cc97 remove indexed_set::Indexed trait. 2016-05-25 15:41:57 +02:00
Felix S. Klock II
58f1a4949d remove unnecessary use of indexed_set::Indexed trait. 2016-05-25 15:41:49 +02:00
Felix S. Klock II
25f37fd651 Add notes that data-structures should potentially move to different crate. 2016-05-25 14:54:31 +02:00
Felix S. Klock II
d9680f5b36 Fix some comments. 2016-05-25 14:52:40 +02:00
ggomez
6d669b4f45 Add new error code tests 2016-05-25 13:58:07 +02:00
Guillaume Gomez
dfa0d2c46e Improve E0084 error explanation 2016-05-25 13:40:35 +02:00
bors
5229e0efb3 Auto merge of #33602 - eddyb:no-trans--check, r=michaelwoerister
Save metadata even with -Z no-trans (e.g. for multi-crate cargo check).

Removes the item symbol map in metadata, as we can now generate them in a deterministic manner.
The `-Z no-trans` change lets the LLVM passes and linking run, but with just metadata and no code.
It fails while trying to link a binary because there's no `main` function, which is correct but not good UX.

There's also no way to easily throw away all of the artifacts to rebuild with actual code generation.
We might want `cargo check` to do that using cargo-internal information and then it would just work.

cc @alexcrichton @nikomatsakis @Aatch @michaelwoerister
2016-05-25 02:33:29 -07:00
Guillaume Gomez
394c23b084 Implement Error trait for fmt::Error type 2016-05-25 10:52:10 +02:00
Eduard Burtescu
a619901e3d trans: save metadata even with -Z no-trans. 2016-05-25 08:46:36 +03:00
bors
487de42083 Auto merge of #33615 - GuillaumeGomez:field_static_method, r=pnkfelix
Don't suggest using fields in a static method

Fixes #33613.

cc @LeoTestard
2016-05-24 21:52:02 -07:00
Michael Rosenberg
e8007e889b antlr grammar verification script now compiles under latest nightly 2016-05-25 00:15:26 -04:00
Nick Cameron
c8ee3f2082 save-analysis: be a bit more defensive with field sub-expressions
Prevents an ice with `(...).f` since the sub-expression is in the AST but not the HIR.

We could actually do better in this specific case, but it doesn't seem worth it.
2016-05-25 15:24:55 +12:00
Liigo Zhuang
f5a398d056 Point out the clone operation in summary line docs of Vec::extend_from_slice 2016-05-25 10:09:20 +08:00
Eduard Burtescu
04464db954 trans: remove item_symbols from metadata and CrateContext. 2016-05-25 01:56:49 +03:00
Eduard Burtescu
b03bde9c2a trans: move the linker support to compute symbols on-demand. 2016-05-25 01:45:25 +03:00
Eduard Burtescu
c9a10bd26b trans: move exported_symbol to Instance::symbol_name. 2016-05-25 01:34:20 +03:00
Eduard Burtescu
a6a5e4884a trans: force absolute item paths within symbols. 2016-05-25 01:34:20 +03:00
Eduard Burtescu
14133d33bc trans: move exported_name's logic into symbol_names. 2016-05-25 01:34:17 +03:00
Alex Crichton
33dfd0fb16 std: Use memalign, not posix_memalign, on Android
We've gotten requests to move our Android support as far back as API level 9
where unfortunately the `posix_memalign` API wasn't implemented yet. Thankfully,
however, the `memalign` API was and it appears to be usable with `free` on the
Android platform (see comments included in commit).

This should help fix some of the last few test failures when compiling against
API level 9.
2016-05-24 15:21:01 -07:00
Eduard Burtescu
39184741bc trans: remove unused symbol_names::exported_name_with_suffix. 2016-05-25 01:20:55 +03:00
Eduard Burtescu
7462da5c38 rustc: use a simpler scheme for plugin registrar symbol names. 2016-05-25 01:20:55 +03:00
Felix S. Klock II
4412c7ab37 placate tidy in compile-fail test. 2016-05-24 23:08:34 +02:00
Felix S. Klock II
fe49b41f83 placate tidy in mir::gather_moves. 2016-05-24 23:08:24 +02:00
Felix S. Klock II
ac6ea44549 placate tidy in mir::dataflow. 2016-05-24 23:08:16 +02:00
Felix S. Klock II
a82676eefa placate tidy in mir::dataflow::graphviz. 2016-05-24 23:08:07 +02:00
Felix S. Klock II
ad1294dbe7 threaded a ty::ParameterEnvironment for the current node id via the associated Ctxt item.
used this to address a long-standing wart/bug in how filtering-out of
values with type impl'ing `Copy` was done.
2016-05-24 23:03:52 +02:00
Ariel Ben-Yehuda
c209d44c34 refactor autoderef to avoid registering obligations
Refactor `FnCtxt::autoderef` to use an external iterator and to not
register any obligation from the main autoderef loop, but rather to
register them after (and if) the loop successfully completes.

Fixes #24819
Fixes #25801
Fixes #27631
Fixes #31258
Fixes #31964
Fixes #32320
Fixes #33515
Fixes #33755
2016-05-25 00:03:33 +03:00
Vadim Petrochenkov
40285ca717 Apply visit_path to import prefixes by default 2016-05-24 23:49:08 +03:00
cheercroaker
c4ed094ef2 Mention initial copyright year only
As stated in #31007 the copyright notice should reflect the year of original publication, thus avoiding useless updates every year.
2016-05-24 21:52:32 +02:00
Niko Matsakis
be7b576cc5 correct typo in comment 2016-05-24 15:08:07 -04:00
bors
8393d99c35 Auto merge of #33833 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 7 pull requests

- Successful merges: #33692, #33759, #33779, #33781, #33797, #33810, #33832
- Failed merges:
2016-05-24 10:39:00 -07:00
Alex Crichton
0f3e8650f7 test: Use set sysroot for more NDK compatibility
Recent versions of the Android NDK no longer ship debuggers like
`arm-linux-androideabi-gdb`, but instead one prebuilt binary `gdb`. We can
symlink this into place at least to get our detection still working, but it now
needs to be told what the sysroot is so it can correctly do... something. Long
story short, tests didn't pass with this change and after this change they pass.
2016-05-24 09:51:29 -07:00
Alex Crichton
cae91d7c8c std: Stabilize APIs for the 1.10 release
This commit applies the FCP decisions made by the libs team for the 1.10 cycle,
including both new stabilizations and deprecations. Specifically, the list of
APIs is:

Stabilized:

* `os::windows::fs::OpenOptionsExt::access_mode`
* `os::windows::fs::OpenOptionsExt::share_mode`
* `os::windows::fs::OpenOptionsExt::custom_flags`
* `os::windows::fs::OpenOptionsExt::attributes`
* `os::windows::fs::OpenOptionsExt::security_qos_flags`
* `os::unix::fs::OpenOptionsExt::custom_flags`
* `sync::Weak::new`
* `Default for sync::Weak`
* `panic::set_hook`
* `panic::take_hook`
* `panic::PanicInfo`
* `panic::PanicInfo::payload`
* `panic::PanicInfo::location`
* `panic::Location`
* `panic::Location::file`
* `panic::Location::line`
* `ffi::CStr::from_bytes_with_nul`
* `ffi::CStr::from_bytes_with_nul_unchecked`
* `ffi::FromBytesWithNulError`
* `fs::Metadata::modified`
* `fs::Metadata::accessed`
* `fs::Metadata::created`
* `sync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange`
* `sync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange_weak`
* `collections::{btree,hash}_map::{Occupied,Vacant,}Entry::key`
* `os::unix::net::{UnixStream, UnixListener, UnixDatagram, SocketAddr}`
* `SocketAddr::is_unnamed`
* `SocketAddr::as_pathname`
* `UnixStream::connect`
* `UnixStream::pair`
* `UnixStream::try_clone`
* `UnixStream::local_addr`
* `UnixStream::peer_addr`
* `UnixStream::set_read_timeout`
* `UnixStream::set_write_timeout`
* `UnixStream::read_timeout`
* `UnixStream::write_Timeout`
* `UnixStream::set_nonblocking`
* `UnixStream::take_error`
* `UnixStream::shutdown`
* Read/Write/RawFd impls for `UnixStream`
* `UnixListener::bind`
* `UnixListener::accept`
* `UnixListener::try_clone`
* `UnixListener::local_addr`
* `UnixListener::set_nonblocking`
* `UnixListener::take_error`
* `UnixListener::incoming`
* RawFd impls for `UnixListener`
* `UnixDatagram::bind`
* `UnixDatagram::unbound`
* `UnixDatagram::pair`
* `UnixDatagram::connect`
* `UnixDatagram::try_clone`
* `UnixDatagram::local_addr`
* `UnixDatagram::peer_addr`
* `UnixDatagram::recv_from`
* `UnixDatagram::recv`
* `UnixDatagram::send_to`
* `UnixDatagram::send`
* `UnixDatagram::set_read_timeout`
* `UnixDatagram::set_write_timeout`
* `UnixDatagram::read_timeout`
* `UnixDatagram::write_timeout`
* `UnixDatagram::set_nonblocking`
* `UnixDatagram::take_error`
* `UnixDatagram::shutdown`
* RawFd impls for `UnixDatagram`
* `{BTree,Hash}Map::values_mut`
* `<[_]>::binary_search_by_key`

Deprecated:

* `StaticCondvar` - this, and all other static synchronization primitives
                    below, are usable today through the lazy-static crate on
                    stable Rust today. Additionally, we'd like the non-static
                    versions to be directly usable in a static context one day,
                    so they're unlikely to be the final forms of the APIs in any
                    case.
* `CONDVAR_INIT`
* `StaticMutex`
* `MUTEX_INIT`
* `StaticRwLock`
* `RWLOCK_INIT`
* `iter::Peekable::is_empty`

Closes #27717
Closes #27720
cc #27784 (but encode methods still exist)
Closes #30014
Closes #30425
Closes #30449
Closes #31190
Closes #31399
Closes #31767
Closes #32111
Closes #32281
Closes #32312
Closes #32551
Closes #33018
2016-05-24 09:00:39 -07:00
Jonathan Turner
df87a781de Satisfy tidy 2016-05-24 10:57:44 -04:00
Felix S. Klock II
fdf80bc60c Removed type Bit and fn interpret items from trait BitDenotation.
Also got rid of the `trait HasMoveData`, since I am now just imposing
the constraint that `BitDenotation<Ctxt=MoveData<'tcx>>` where
necessary instead.
2016-05-24 16:46:19 +02:00
Jonathan Turner
00b78d0d6a Back to single line between errors. Add header space to secondary files 2016-05-24 10:42:32 -04:00
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
Kamal Marhubi
3bef085ea8 syntax: Make codemap::get_filemap() return an Option
This is more idiomatic, putting the caller in charge of whether or not
to panic.
2016-05-24 16:08:01 +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
Brian Anderson
696a570a00 Open code the __fastfail intrinsic for rtabort! on windows
As described https://msdn.microsoft.com/en-us/library/dn774154.aspx

This is a Windows 8+ mechanism for terminating the process quickly,
which degrades to either an access violation or bugcheck in older versions.

I'm not sure this is better the the current mechanism of terminating
with an illegal instruction, but we recently converted unix to
terminate more correctly with SIGABORT, and this *seems* more correct
for windows.

[breaking-change]
2016-05-24 08:56:03 -04:00
Georg Brandl
2e812e10f4 syntax/hir: give loop labels a span
This makes the "shadowing labels" warning *not* print the entire loop
as a span, but only the lifetime.

Also makes #31719 go away, but does not fix its root cause (the span
of the expanded loop is still wonky, but not used anymore).
2016-05-24 14:22:14 +02:00