Commit Graph

21677 Commits

Author SHA1 Message Date
bors
b8d1fa3994 auto merge of #8645 : alexcrichton/rust/issue-6436-run-non-blocking, r=brson
This overhauls `std::run` to instead run on top of libuv. This is *not* in a mergeable state, I've been attempting to diagnose failures in the compiletest suite. I've managed to find a fair number of bugs so far, but I still  don't seem to be done yet.

Notable changes:
* This requires upgrading libuv. From the discussion on #6567, I took libuv master from a few days ago, applied one patch to fix process spawning with multiple event loops in libuv, and pushed to my own fork
* The build system for libuv has changed since we last used it. There's some extra checkout from a google build system which apparently does all the magic if you don't want to require autotools, and the google system just requires python. I updated the Makefile to get this build system and build libuv with it instead. This is untested on windows and arm, and both will probably need to see some improvement.
* This required adding some pipe bindings to libuv as well. Currently the support is pretty simple and probably completely unsafe for pipes, but you at least get read/write methods. This is necessary for capturing output of processes.
* I didn't redesign `std::run` at all, I simply tried to reimplement all the existing functionality on top of libuv. Some functions ended up dying, but nothing major. All uses of `std::run` in the compiler still work just fine.

I'm not quite sure how the rest of the runtime deals with this, but I marked process structures as `no_send` because the waiting/waking up has to happen in the same event loop right now. If processes start migrating between event loops then very bad things can happen. This may be what threadsafe I/O would fix, and I would be more than willing to rebase on that if it lands first.

Anyway, for now I wanted to put this up for review, I'm still investigating the corruption/deadlock bugs, but this is in an *almost* workable state. Once I find the bugs I'll also rebase on the current master.
2013-08-27 21:55:42 -07:00
Alex Crichton
4635644746 Fix merge fallout 2013-08-27 20:53:26 -07:00
Alex Crichton
2ad05ae014 Fix various issues associated with building on windows 2013-08-27 20:46:43 -07:00
Alex Crichton
b89e1c000e Implement process bindings to libuv
Closes #6436
2013-08-27 20:46:43 -07:00
Alex Crichton
ed204257a0 Upgrade libuv to the current master + our patches
There were two main differences with the old libuv and the master version:

1. The uv_last_error function is now gone. The error code returned by each
   function is the "last error" so now a UvError is just a wrapper around a
   c_int.
2. The repo no longer includes a makefile, and the build system has change.
   According to the build directions on joyent/libuv, this now downloads a `gyp`
   program into the `libuv/build` directory and builds using that. This
   shouldn't add any dependences on autotools or anything like that.

Closes #8407
Closes #6567
Closes #6315
2013-08-27 20:46:17 -07:00
bors
f22b4b1698 auto merge of #8697 : kballard/rust/rustpkg-no-args, r=catamorphism
`rustpkg build` et al were only checking one directory up to see if it
was in a dir named "src". Ditch that entirely and instead check if the
cwd is descended from any of the workspace paths. Besides being more
intelligent about whether or not something is a workspace, this also
allows for package ids composed of multiple path components.

r? @catamorphism
2013-08-27 20:45:40 -07:00
bors
578e680477 auto merge of #8802 : pcwalton/rust/compile-speed, r=brson
r? @brson
2013-08-27 19:35:44 -07:00
Patrick Walton
aac9d6eee9 librustc: Fix merge fallout 2013-08-27 19:09:27 -07:00
Kevin Ballard
eafa63f787 Handle rustpkg build, etc. when given no args properly
`rustpkg build` et al were only checking one directory up to see if it
was in a dir named "src". Ditch that entirely and instead check if the
cwd is descended from any of the workspace paths. Besides being more
intelligent about whether or not something is a workspace, this also
allows for package ids composed of multiple path components.
2013-08-27 19:06:38 -07:00
Patrick Walton
2bd46e767c librustc: Fix problem with cross-crate reexported static methods. 2013-08-27 18:47:59 -07:00
Patrick Walton
6c37e3b7f8 librustc: Implement basic lazy implementation loading.
This is only for implementations defined in the same crate as the trait they
implement.
2013-08-27 18:47:59 -07:00
Patrick Walton
ff7b8d6d88 librustc: Implement lazy module loading. 2013-08-27 18:47:58 -07:00
Patrick Walton
1bbb1e06f1 librustc: Remove each_path.
This does not implement lazy symbol resolution yet.
2013-08-27 18:47:58 -07:00
Patrick Walton
1ad2239f62 libstd: Fix merge fallout. 2013-08-27 18:47:58 -07:00
Patrick Walton
d9bb78efdf librustc: Stop calling each_path in coherence.
10% win or so for small crates.
2013-08-27 18:47:58 -07:00
Patrick Walton
4f32a2d854 librustc: Fix merge fallout. 2013-08-27 18:47:57 -07:00
Patrick Walton
5c9f5ec397 test: xfail a test that relies on old path behavior. 2013-08-27 18:47:57 -07:00
Patrick Walton
a20af8b276 librustc: Convert check loans to use the new visitor 2013-08-27 18:47:57 -07:00
Patrick Walton
8693943676 librustc: Ensure that type parameters are in the right positions in paths.
This removes the stacking of type parameters that occurs when invoking
trait methods, and fixes all places in the standard library that were
relying on it. It is somewhat awkward in places; I think we'll probably
want something like the `Foo::<for T>::new()` syntax.
2013-08-27 18:47:57 -07:00
Patrick Walton
3b6314c39b librustc: Add support for type parameters in the middle of paths.
For example, `foo::<T>::bar::<U>`.

This doesn't enforce that the type parameters are in the right
positions, however.
2013-08-27 18:46:51 -07:00
Patrick Walton
5c3504799d librustc: Remove &const and *const from the language.
They are still present as part of the borrow check.
2013-08-27 18:46:51 -07:00
bors
32117132bd auto merge of #8799 : fhahn/rust/ticket_5783, r=catamorphism
I've added a testcase, as mentioned in #5783
2013-08-27 18:20:44 -07:00
bors
58d6eb5048 auto merge of #8797 : nikomatsakis/rust/issue-8625-assign-to-andmut-in-borrowed-loc-2, r=pcwalton
Fixes for #8625 to prevent assigning to `&mut` in borrowed or aliasable locations. The old code was insufficient in that it failed to catch bizarre cases like `& &mut &mut`. 

r? @pnkfelix
2013-08-27 17:05:46 -07:00
bors
d5c144a4cd auto merge of #8792 : adridu59/rust/master, r=catamorphism
`target_library_in_workspace` is imported but unused:
~/rust/src/librustpkg/tests.rs:21:48: 21:75 warning: unused import [-W unused-imports (default)]
2013-08-27 15:50:50 -07:00
bors
7f32ea8820 auto merge of #8771 : thestinger/rust/repr, r=catamorphism 2013-08-27 14:35:49 -07:00
Florian Hahn
890b589491 Add test for #5783 2013-08-27 23:27:10 +02:00
Niko Matsakis
8c09865b66 Remove remnants of implicit self 2013-08-27 16:49:06 -04:00
Daniel Micay
803f941867 reflect: rm unused visit_{var,var_integral,constr} 2013-08-27 16:31:48 -04:00
Daniel Micay
ac4f0df120 repr: include mutability qualifier in visit_ptr 2013-08-27 16:31:48 -04:00
Daniel Micay
c2bc59e086 repr: print integer/float suffixes 2013-08-27 16:31:45 -04:00
bors
3ab0561b00 auto merge of #8790 : huonw/rust/unsafearc, r=thestinger
`UnsafeAtomicRcBox` &rarr; `UnsafeArc` (#7674), and `AtomicRcBoxData` &rarr; `ArcData` to reflect this.

Also, the inner pointer of `UnsafeArc` is now `*mut ArcData`, which avoids some transmutes to `~`: i.e. less chance of mistakes.
2013-08-27 13:20:47 -07:00
Niko Matsakis
35a4177550 Extend aliasability check to uncover & &mut &mut and the like 2013-08-27 15:45:19 -04:00
bors
c822d1070a auto merge of #8581 : FlaPer87/rust/issue/8232, r=bblum
As for now, rekillable is an unsafe function, instead, it should behave
just like unkillable by encapsulating unsafe code within an unsafe
block.

This patch does that and removes unsafe blocks that were encapsulating
rekillable calls throughout rust's libs.

Fixes #8232
2013-08-27 11:35:51 -07:00
Flaper Fesp
cc59d96097 Trailing space 2013-08-27 20:09:57 +02:00
Daniel Micay
20567a0c3c vec: implement DeepClone 2013-08-27 13:47:15 -04:00
bors
7841b77676 auto merge of #8772 : thestinger/rust/option, r=anasazi
Closes #6002 

There is consensus that the current implementation should be changed or
removed, so removing it seems like the right decision for now.
2013-08-27 10:20:52 -07:00
Daniel Micay
9a63be1dbd option: rm implementation of Add
Closes #6002

There is consensus that the current implementation should be changed or
removed, so removing it seems like the right decision for now.
2013-08-27 13:18:57 -04:00
bors
0baa92707a auto merge of #8789 : pnkfelix/rust/fsk-fix-typo-in-rust-mode.el, r=pnkfelix
Fix #6887.  (or rather, a bug injected by my prior commit for fixing that bug.)
2013-08-27 08:00:51 -07:00
bors
4fa09e08ed auto merge of #8777 : Kimundi/rust/doc_stuff, r=cmr 2013-08-27 06:45:50 -07:00
Adrien Tétar
b29696a08a librustpkg/tests.rs: cleanup unused import 2013-08-27 14:45:40 +02:00
bors
932d7b9465 auto merge of #8780 : brson/rust/from_elem, r=thestinger 2013-08-27 05:30:54 -07:00
Huon Wilson
a79575529d std: use ArcData rather than c_void in UnsafeArc.
This means that fewer `transmute`s are required, so there is less
chance of a `transmute` not having the corresponding `forget`
(possibly leading to use-after-free, etc).
2013-08-27 22:24:34 +10:00
bors
d9b0d4b603 auto merge of #8779 : brson/rust/macsupp, r=thestinger
This callstack changed when the FFI did. I am still a little frightened by
this suppression.

cc #8253
2013-08-27 04:15:54 -07:00
Felix S. Klock II
1f13eab3c0 fix typo in rust-mode.el 2013-08-27 12:48:51 +02:00
Huon Wilson
71448d7c37 Rename UnsafeAtomicRcBox to UnsafeArc. Fixes #7674. 2013-08-27 20:12:39 +10:00
bors
947513c4f4 auto merge of #8773 : catamorphism/rust/rustpkg-version-flag, r=anasazi
r? anyone. Now, rustpkg --version does something useful!
2013-08-27 03:00:52 -07:00
Flaper Fesp
df84925b45 Rebased and replaced yield with deschedule 2013-08-27 09:53:31 +02:00
bors
604ab9477a auto merge of #8757 : vadimcn/rust/debug-info-tests, r=brson
Now that new LLVM has landed, the debug info works on Windows as well.   Most existing tests pass, except for the following four, which I left disabled for now:
lexical-scope-in-for-loop
lexical-scope-in-if
lexical-scope-in-match
lexical-scopes-in-block-expression

Also, fixed a small problem with the debug info test runner.
2013-08-26 23:35:54 -07:00
bors
35f975b838 auto merge of #8700 : alexcrichton/rust/better-llvm, r=thestinger
Beforehand, it was unclear whether rust was performing the "recommended set" of
optimizations provided by LLVM for code. This commit changes the way we run
passes to closely mirror that of clang, which in theory does it correctly. The
notable changes include:

* Passes are no longer explicitly added one by one. This would be difficult to
  keep up with as LLVM changes and we don't guaranteed always know the best
  order in which to run passes
* Passes are now managed by LLVM's PassManagerBuilder object. This is then used
  to populate the various pass managers run.
* We now run both a FunctionPassManager and a module-wide PassManager. This is
  what clang does, and I presume that we *may* see a speed boost from the
  module-wide passes just having to do less work. I have no measured this.
* The codegen pass manager has been extracted to its own separate pass manager
  to not get mixed up with the other passes
* All pass managers now include passes for target-specific data layout and
  analysis passes

Some new features include:

* You can now print all passes being run with `-Z print-llvm-passes`
* When specifying passes via `--passes`, the passes are now appended to the
  default list of passes instead of overwriting them.
* The output of `--passes list` is now generated by LLVM instead of maintaining
  a list of passes ourselves
* Loop vectorization is turned on by default as an optimization pass and can be
  disabled with `-Z no-vectorize-loops`


All of these "copies" of clang are based off their [source code](http://clang.llvm.org/doxygen/BackendUtil_8cpp_source.html) in case anyone is curious what my source is. I was hoping that this would fix #8665, but this does not help the performance issues found there. Hopefully i'll allow us to tweak passes or see what's going on to try to debug that problem.
2013-08-26 21:25:55 -07:00
Alex Crichton
73540551e5 Rewrite pass management with LLVM
Beforehand, it was unclear whether rust was performing the "recommended set" of
optimizations provided by LLVM for code. This commit changes the way we run
passes to closely mirror that of clang, which in theory does it correctly. The
notable changes include:

* Passes are no longer explicitly added one by one. This would be difficult to
  keep up with as LLVM changes and we don't guaranteed always know the best
  order in which to run passes
* Passes are now managed by LLVM's PassManagerBuilder object. This is then used
  to populate the various pass managers run.
* We now run both a FunctionPassManager and a module-wide PassManager. This is
  what clang does, and I presume that we *may* see a speed boost from the
  module-wide passes just having to do less work. I have no measured this.
* The codegen pass manager has been extracted to its own separate pass manager
  to not get mixed up with the other passes
* All pass managers now include passes for target-specific data layout and
  analysis passes

Some new features include:

* You can now print all passes being run with `-Z print-llvm-passes`
* When specifying passes via `--passes`, the passes are now appended to the
  default list of passes instead of overwriting them.
* The output of `--passes list` is now generated by LLVM instead of maintaining
  a list of passes ourselves
* Loop vectorization is turned on by default as an optimization pass and can be
  disabled with `-Z no-vectorize-loops`
2013-08-26 20:11:51 -07:00