]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agolibextra: Remove @mut from term.
Luqman Aden [Sun, 24 Nov 2013 11:53:08 +0000 (06:53 -0500)]
libextra: Remove @mut from term.

10 years agoauto merge of #10475 : astrieanna/rust/issue8763, r=alexcrichton
bors [Sun, 24 Nov 2013 18:17:03 +0000 (10:17 -0800)]
auto merge of #10475 : astrieanna/rust/issue8763, r=alexcrichton

Issue #8763 is about improving a particular error message.

* added case & better error message for "impl trait for module"
* added compile-fail test trait-impl-for-module.rs
* updated copyright dates
* revised compile-fail test trait-or-new-type-instead
   (the error message for the modified test is still unclear, but that's a different bug https://github.com/mozilla/rust/issues/8767)

10 years agoFix issue #8763
Leah Hanson [Thu, 14 Nov 2013 03:29:37 +0000 (21:29 -0600)]
Fix issue #8763

* added case & better error message for "impl trait for module"
* used better way to print the module
* switched from //error-pattern to //~ ERROR
* added compile-fail test trait-impl-for-module.rs
* revised compile-fail test trait-or-new-type-instead
    (the error message for the modified test is still unclear, but that's a different bug)
* added FIXME to trait-or-new-type-instead

10 years agoauto merge of #10634 : LeoTestard/rust/rc-eq, r=cmr
bors [Sun, 24 Nov 2013 16:42:35 +0000 (08:42 -0800)]
auto merge of #10634 : LeoTestard/rust/rc-eq, r=cmr

10 years agoImplement cmp traits for Rc<T> and add a ptr_eq method.
Léo Testard [Sun, 24 Nov 2013 16:29:44 +0000 (17:29 +0100)]
Implement cmp traits for Rc<T> and add a ptr_eq method.

10 years agoauto merge of #10633 : cmr/rust/linker_opts, r=thestinger
bors [Sun, 24 Nov 2013 13:56:28 +0000 (05:56 -0800)]
auto merge of #10633 : cmr/rust/linker_opts, r=thestinger

r? @Luqmana

10 years agoUse -O1 for non-GNU linkers
Corey Richardson [Sun, 24 Nov 2013 13:50:16 +0000 (08:50 -0500)]
Use -O1 for non-GNU linkers

10 years agoauto merge of #10625 : huonw/rust/json-errors, r=alexcrichton
bors [Sun, 24 Nov 2013 09:26:30 +0000 (01:26 -0800)]
auto merge of #10625 : huonw/rust/json-errors, r=alexcrichton

Fixes #4244.

10 years agoauto merge of #10620 : cmr/rust/linker_opts, r=thestinger
bors [Sun, 24 Nov 2013 07:56:30 +0000 (23:56 -0800)]
auto merge of #10620 : cmr/rust/linker_opts, r=thestinger

10 years agoauto merge of #10578 : luqmana/rust/mingw64, r=alexcrichton
bors [Sun, 24 Nov 2013 05:36:50 +0000 (21:36 -0800)]
auto merge of #10578 : luqmana/rust/mingw64, r=alexcrichton

With these changes I was able to cross compile for windows from a linux box. (Using the mingw-w64 package on Debian Testing).

Fixed a bug where the `target_family` cfg would be wrong when targeting something with a different value than the host. (i.e windows -> unix or unix -> windows).

Also, removed `LIBUV_FLAGS` in `mk/rt.mk` because of the redundancy between it and `CFG_GCCISH_CFLAGS_(target)`.

After this we can create a snapshot and migrate to mingw64 instead of mingw32.

10 years agoauto merge of #10514 : sfackler/rust/mut, r=cmr
bors [Sun, 24 Nov 2013 04:01:42 +0000 (20:01 -0800)]
auto merge of #10514 : sfackler/rust/mut, r=cmr

This is based off of @blake2-ppc's work on #9429. That PR bitrotted and I haven't been able to contact the original author so I decided to take up the cause.

Overview
======
`Mut` encapsulates a mutable, non-nullable slot. The `Cell` type is currently used to do this, but `Cell` is much more commonly used as a workaround for the inability to move values into non-once functions. `Mut` provides a more robust API.

`Mut` duplicates the semantics of borrowed pointers with enforcement at runtime instead of compile time.
```rust
let x = Mut::new(0);

{
    // make some immutable borrows
    let p = x.borrow();
    let y = *p.get() + 10;

    // multiple immutable borrows are allowed simultaneously
    let p2 = x.borrow();

    // this would throw a runtime failure
    // let p_mut = x.borrow_mut();
}

// now we can mutably borrow
let p = x.borrow_mut();
*p.get() = 10;
```
`borrow` returns a `Ref` type and `borrow_mut` returns a `RefMut` type, both of which are simple smart pointer types with a single method, `get`, which returns a reference to the wrapped data.

This also allows `RcMut<T>` to be deleted, as it can be replaced with `Rc<Mut<T>>`.

Changes
======
I've done things a little bit differently than the original proposal.

* I've added `try_borrow` and `try_borrow_mut` methods that return `Option<Ref<T>>` and `Option<RefMut<T>>` respectively instead of failing on a borrow check failure. I'm not totally sure when that'd be useful, but I don't see any reason to not put them in and @cmr requested them.
* `ReadPtr` and `WritePtr` have been renamed to `Ref` and `RefMut` respectively, as `Ref` is to `ref foo` and `RefMut` is to `ref mut foo` as `Mut` is to `mut foo`.
* `get` on `MutRef` now takes `&self` instead of `&mut self` for consistency with `&mut`. As @alexcrichton pointed, out this violates soundness by allowing aliasing `&mut` references.
* `Cell` is being left as is. It solves a different problem than `Mut` is designed to solve.
* There are no longer methods implemented for `Mut<Option<T>>`. Since `Cell` isn't going away, there's less of a need for these, and I didn't feel like they provided a huge benefit, especially as that kind of `impl` is very uncommon in the standard library.

Open Questions
============
* `Cell` should now be used exclusively for movement into closures. Should this be enforced by reducing its API to `new` and `take`? It seems like this use case will be completely going away once the transition to `proc` and co. finishes.
* Should there be `try_map` and `try_map_mut` methods along with `map` and `map_mut`?

10 years agoextra: improve the errors for the JSON Decoder.
Huon Wilson [Sat, 23 Nov 2013 23:17:34 +0000 (10:17 +1100)]
extra: improve the errors for the JSON Decoder.

Fixes #4244.

10 years agoMove mutable::Mut to cell::RefCell
Steven Fackler [Fri, 22 Nov 2013 05:30:34 +0000 (21:30 -0800)]
Move mutable::Mut to cell::RefCell

10 years agoUse linker optimizations on Linux
Corey Richardson [Sat, 23 Nov 2013 14:14:44 +0000 (09:14 -0500)]
Use linker optimizations on Linux

10 years agoUse CXX not CC for linking.
Luqman Aden [Sat, 23 Nov 2013 09:49:16 +0000 (04:49 -0500)]
Use CXX not CC for linking.

10 years agoauto merge of #10611 : cmr/rust/ascii_flesh, r=pcwalton
bors [Sat, 23 Nov 2013 07:06:24 +0000 (23:06 -0800)]
auto merge of #10611 : cmr/rust/ascii_flesh, r=pcwalton

These are super boring. I can add tests if really desired, but they'd be long
and even more boring than the methods.

10 years agoAdd ctype-likes to Ascii
Corey Richardson [Fri, 22 Nov 2013 16:38:50 +0000 (11:38 -0500)]
Add ctype-likes to Ascii

10 years agoRemove sjlj stuff from rust_upcall and don't pass -Werror to libuv.
Luqman Aden [Sat, 23 Nov 2013 02:21:37 +0000 (21:21 -0500)]
Remove sjlj stuff from rust_upcall and don't pass -Werror to libuv.

10 years agoAdd Rc::from_mut
Steven Fackler [Sun, 17 Nov 2013 05:59:42 +0000 (21:59 -0800)]
Add Rc::from_mut

10 years agoMore Mut tests
Steven Fackler [Sat, 16 Nov 2013 22:35:35 +0000 (14:35 -0800)]
More Mut tests

10 years agoStrip down Cell functionality
Steven Fackler [Sat, 16 Nov 2013 21:26:15 +0000 (13:26 -0800)]
Strip down Cell functionality

10 years agoChange Mut::map to Mut::with
Steven Fackler [Sat, 16 Nov 2013 19:19:25 +0000 (11:19 -0800)]
Change Mut::map to Mut::with

10 years agoMake MutRef more consistent with &mut
Steven Fackler [Sat, 16 Nov 2013 07:48:02 +0000 (23:48 -0800)]
Make MutRef more consistent with &mut

10 years agoCell -> Mut switch in comm
Steven Fackler [Sat, 16 Nov 2013 05:08:31 +0000 (21:08 -0800)]
Cell -> Mut switch in comm

10 years agoMove Rc tests away from Cell
Steven Fackler [Fri, 15 Nov 2013 07:25:00 +0000 (23:25 -0800)]
Move Rc tests away from Cell

10 years agoRemove RcMut
Steven Fackler [Fri, 15 Nov 2013 03:57:11 +0000 (19:57 -0800)]
Remove RcMut

Rc<Mut<T>> should be used instead

10 years agoIntroduce Mut<T> to libstd
Steven Fackler [Thu, 14 Nov 2013 07:46:47 +0000 (23:46 -0800)]
Introduce Mut<T> to libstd

Based off of blake2-ppc's work in #9429.

10 years agomk: Get rid of redundant LIBUV_FLAGS.
Luqman Aden [Wed, 20 Nov 2013 11:00:49 +0000 (06:00 -0500)]
mk: Get rid of redundant LIBUV_FLAGS.

10 years agoFix up mingw64 target.
Luqman Aden [Wed, 20 Nov 2013 06:30:51 +0000 (01:30 -0500)]
Fix up mingw64 target.

10 years agoauto merge of #10605 : huonw/rust/ascii-ident-gate, r=pcwalton
bors [Fri, 22 Nov 2013 21:51:34 +0000 (13:51 -0800)]
auto merge of #10605 : huonw/rust/ascii-ident-gate, r=pcwalton

cf. https://mail.mozilla.org/pipermail/rust-dev/2013-November/006920.html

10 years agoPut non-ascii identifiers behind a feature gate.
Huon Wilson [Fri, 22 Nov 2013 12:25:14 +0000 (23:25 +1100)]
Put non-ascii identifiers behind a feature gate.

cf. https://mail.mozilla.org/pipermail/rust-dev/2013-November/006920.html

10 years agoauto merge of #10612 : pnkfelix/rust/remove-cut-and-pasted-rt-fixme, r=pcwalton
bors [Fri, 22 Nov 2013 20:41:36 +0000 (12:41 -0800)]
auto merge of #10612 : pnkfelix/rust/remove-cut-and-pasted-rt-fixme, r=pcwalton

I cannot tell whether the original comment was unsure about the
arithmetic calculations, or if it was unsure about the assumptions
being made about the alignment of the current allocation pointer.

The arithmetic calculation looks fine to me, though.  This technique
is documented e.g. in Henry Warren's "Hacker's Delight" (section 3-1).

(I am sure one can find it elsewhere too, its not an obscure
property.)

10 years agoauto merge of #10583 : alexcrichton/rust/privacy-reexport, r=pcwalton
bors [Fri, 22 Nov 2013 18:06:35 +0000 (10:06 -0800)]
auto merge of #10583 : alexcrichton/rust/privacy-reexport, r=pcwalton

I added a test case which does not compile today, and required changes on
privacy's side of things to get right. Additionally, this moves a good bit of
logic which did not belong in reachability into privacy.

All of reachability should solely be responsible for determining what the
reachable surface area of a crate is given the exported surface area (where the
exported surface area is that which is usable by external crates).

Privacy will now correctly figure out what's exported by deeply looking
through reexports. Previously if a module were reexported under another name,
nothing in the module would actually get exported in the executable. I also
consolidated the phases of privacy to be clearer about what's an input to what.
The privacy checking pass no longer uses the notion of an "all public" path, and
the embargo visitor is no longer an input to the checking pass.

Currently the embargo visitor is built as a saturating analysis because it's
unknown what portions of the AST are going to get re-exported.

This also cracks down on exported methods from impl blocks and trait blocks. If you implement a private trait, none of the symbols are exported, and if you have an impl for a private type none of the symbols are exported either. On the other hand, if you implement a public trait for a private type, the symbols are still exported. I'm unclear on whether this last part is correct, but librustc will fail to link unless it's in place.

10 years agoMove more of the exportation burden into privacy
Alex Crichton [Wed, 20 Nov 2013 23:15:34 +0000 (15:15 -0800)]
Move more of the exportation burden into privacy

I added a test case which does not compile today, and required changes on
privacy's side of things to get right. Additionally, this moves a good bit of
logic which did not belong in reachability into privacy.

All of reachability should solely be responsible for determining what the
reachable surface area of a crate is given the exported surface area (where the
exported surface area is that which is usable by external crates).

Privacy will now correctly figure out what's exported by deeply looking
through reexports. Previously if a module were reexported under another name,
nothing in the module would actually get exported in the executable. I also
consolidated the phases of privacy to be clearer about what's an input to what.
The privacy checking pass no longer uses the notion of an "all public" path, and
the embargo visitor is no longer an input to the checking pass.

Currently the embargo visitor is built as a saturating analysis because it's
unknown what portions of the AST are going to get re-exported.

10 years agoThe original fixme #2699 was removed back in PR #6053.
Felix S. Klock II [Fri, 22 Nov 2013 17:00:21 +0000 (18:00 +0100)]
The original fixme #2699 was removed back in PR #6053.

I cannot tell whether the original comment was unsure about the
arithmetic calculations, or if it was unsure about the assumptions
being made about the alignment of the current allocation pointer.

The arithmetic calculation looks fine to me, though.  This technique
is documented e.g. in Henry Warren's "Hacker's Delight" (section 3-1).

(I am sure one can find it elsewhere too, its not an obscure
property.)

10 years agoauto merge of #10610 : thestinger/rust/breakpoint, r=pnkfelix
bors [Fri, 22 Nov 2013 15:31:35 +0000 (07:31 -0800)]
auto merge of #10610 : thestinger/rust/breakpoint, r=pnkfelix

This can be used to grab the attention of a debugger, and unlike
`abort` execution can be resumed.

10 years agoadd a breakpoint intrinsic for debugging
Daniel Micay [Fri, 22 Nov 2013 15:12:56 +0000 (10:12 -0500)]
add a breakpoint intrinsic for debugging

This can be used to grab the attention of a debugger, and unlike
`abort` execution can be resumed.

10 years agoauto merge of #10608 : thestinger/rust/managed, r=huonw
bors [Fri, 22 Nov 2013 13:52:01 +0000 (05:52 -0800)]
auto merge of #10608 : thestinger/rust/managed, r=huonw

10 years agoauto merge of #10606 : huonw/rust/lint-unsafe-in-macro, r=thestinger
bors [Fri, 22 Nov 2013 12:41:33 +0000 (04:41 -0800)]
auto merge of #10606 : huonw/rust/lint-unsafe-in-macro, r=thestinger

Add a test for the case I mentioned on #10599.

10 years agosyntax: add a visit_ident method to the Visitor.
Huon Wilson [Fri, 22 Nov 2013 12:24:49 +0000 (23:24 +1100)]
syntax: add a visit_ident method to the Visitor.

10 years agominor rewording in the tutorial's `Rc` coverage
Daniel Micay [Fri, 22 Nov 2013 12:03:11 +0000 (07:03 -0500)]
minor rewording in the tutorial's `Rc` coverage

10 years agomention `Gc` in the managed box feature gate
Daniel Micay [Fri, 22 Nov 2013 11:54:33 +0000 (06:54 -0500)]
mention `Gc` in the managed box feature gate

10 years agoauto merge of #10582 : g3xzh/rust/master, r=cmr
bors [Fri, 22 Nov 2013 11:31:37 +0000 (03:31 -0800)]
auto merge of #10582 : g3xzh/rust/master, r=cmr

More new benchmark tests. some of them are benchmarking `starts_with` and `ends_with`.
Let me know if I am missing something.
Thanks in advance.

10 years agoAdd more benchmark tests to vec.rs
g3xzh [Wed, 20 Nov 2013 21:19:48 +0000 (23:19 +0200)]
Add more benchmark tests to vec.rs

New benchmark tests in vec.rs:
`push`, `starts_with_same_vector`, `starts_with_single_element`,
`starts_with_diff_one_element_end`, `ends_with_same_vector`,
`ends_with_single_element`, `ends_with_diff_one_element_beginning` and
`contains_last_element`

10 years agotest: test that the `unsafe_block` lint picks up `unsafe` blocks in
Huon Wilson [Fri, 22 Nov 2013 11:23:04 +0000 (22:23 +1100)]
test: test that the `unsafe_block` lint picks up `unsafe` blocks in
macros.

10 years agoauto merge of #10588 : huonw/rust/un@mutilate-task_rng, r=alexcrichton
bors [Fri, 22 Nov 2013 05:51:26 +0000 (21:51 -0800)]
auto merge of #10588 : huonw/rust/un@mutilate-task_rng, r=alexcrichton

Replace with some unsafe code by storing a pointer into TLS-owned heap
data.

10 years agostd::rand: move TaskRng off @mut.
Huon Wilson [Thu, 21 Nov 2013 08:46:29 +0000 (19:46 +1100)]
std::rand: move TaskRng off @mut.

Replace with some unsafe code by storing a pointer into TLS-owned heap
data.

10 years agoauto merge of #10599 : thestinger/rust/unsafe, r=cmr
bors [Fri, 22 Nov 2013 01:26:31 +0000 (17:26 -0800)]
auto merge of #10599 : thestinger/rust/unsafe, r=cmr

This is just meant to be for containing usage of `unsafe`, much like `heap_memory`.

10 years agoauto merge of #10589 : thestinger/rust/doc, r=pcwalton
bors [Fri, 22 Nov 2013 00:06:32 +0000 (16:06 -0800)]
auto merge of #10589 : thestinger/rust/doc, r=pcwalton

This replaces the old section on managed pointers because the syntax is
going to be removed and it's currently feature gated so the examples
don't work out-of-the-box. Dynamic mutability coverage can be added
after the `Mut<T>` work has landed.

10 years agotutorial: alternatives to ownership
Daniel Micay [Thu, 21 Nov 2013 10:52:33 +0000 (05:52 -0500)]
tutorial: alternatives to ownership

This replaces the old section on managed pointers because the syntax is
going to be removed and it's currently feature gated so the examples
don't work out-of-the-box. Dynamic mutability coverage can be added
after the `Mut<T>` work has landed.

10 years agoadd lint for `unsafe` blocks
Daniel Micay [Thu, 21 Nov 2013 22:36:54 +0000 (17:36 -0500)]
add lint for `unsafe` blocks

10 years agoauto merge of #10598 : alexcrichton/rust/rustdoc, r=thestinger
bors [Thu, 21 Nov 2013 22:56:37 +0000 (14:56 -0800)]
auto merge of #10598 : alexcrichton/rust/rustdoc, r=thestinger

This prevents an assertion from being tripped because the generics weren't
categorized.

Closes #10597

10 years agoProcess ffi generics in rustdoc
Alex Crichton [Thu, 21 Nov 2013 21:17:46 +0000 (13:17 -0800)]
Process ffi generics in rustdoc

This prevents an assertion from being tripped because the generics weren't
categorized.

Closes #10597

10 years agoauto merge of #10595 : hatahet/rust/master, r=thestinger
bors [Thu, 21 Nov 2013 20:56:44 +0000 (12:56 -0800)]
auto merge of #10595 : hatahet/rust/master, r=thestinger

Closes #10579

10 years ago`std::ptr::read_ptr` now takes `*T` instead of `*mut T`
Ziad Hatahet [Thu, 21 Nov 2013 19:31:58 +0000 (11:31 -0800)]
`std::ptr::read_ptr` now takes `*T` instead of `*mut T`

Closes #10579

10 years agoauto merge of #10587 : thestinger/rust/stack, r=pcwalton
bors [Thu, 21 Nov 2013 18:21:37 +0000 (10:21 -0800)]
auto merge of #10587 : thestinger/rust/stack, r=pcwalton

10 years agoremove segmented stacks from the manual
Daniel Micay [Thu, 21 Nov 2013 08:39:15 +0000 (03:39 -0500)]
remove segmented stacks from the manual

10 years agoauto merge of #10584 : klutzy/rust/local-rust-root, r=alexcrichton
bors [Thu, 21 Nov 2013 16:26:50 +0000 (08:26 -0800)]
auto merge of #10584 : klutzy/rust/local-rust-root, r=alexcrichton

Fixes #8756.

10 years agoauto merge of #10590 : sanxiyn/rust/ty-mac, r=thestinger
bors [Thu, 21 Nov 2013 14:16:49 +0000 (06:16 -0800)]
auto merge of #10590 : sanxiyn/rust/ty-mac, r=thestinger

10 years agoRemove ty_mac
Seo Sanghyeon [Thu, 21 Nov 2013 13:59:56 +0000 (22:59 +0900)]
Remove ty_mac

10 years agoauto merge of #10567 : sanxiyn/rust/bytepos, r=alexcrichton
bors [Thu, 21 Nov 2013 07:31:27 +0000 (23:31 -0800)]
auto merge of #10567 : sanxiyn/rust/bytepos, r=alexcrichton

10 years agoauto merge of #10585 : idupree/rust/master, r=catamorphism
bors [Thu, 21 Nov 2013 04:56:27 +0000 (20:56 -0800)]
auto merge of #10585 : idupree/rust/master, r=catamorphism

10 years agoupdate manual to reflect &'lifetime syntax
Isaac Dupree [Thu, 21 Nov 2013 04:50:10 +0000 (23:50 -0500)]
update manual to reflect &'lifetime syntax

10 years agoFix --local-rust-root option on Windows
klutzy [Thu, 21 Nov 2013 03:29:40 +0000 (12:29 +0900)]
Fix --local-rust-root option on Windows

10 years agoauto merge of #10576 : thestinger/rust/gc, r=pcwalton
bors [Wed, 20 Nov 2013 22:16:23 +0000 (14:16 -0800)]
auto merge of #10576 : thestinger/rust/gc, r=pcwalton

This isn't very useful yet, but it does replace most functionality of `@T`. The `Mut<T>` type will make it unnecessary to have a `GcMut<T>` so I haven't included one. Obviously it doesn't work for trait objects but that needs to be figured out for `Rc<T>` too.

10 years agoauto merge of #10527 : eholk/rust/win64, r=alexcrichton
bors [Wed, 20 Nov 2013 19:01:34 +0000 (11:01 -0800)]
auto merge of #10527 : eholk/rust/win64, r=alexcrichton

This was needed to access UEFI boot services in my new Boot2Rust experiment.

I also realized that Rust functions declared as extern always use the C calling convention regardless of how they were declared, so this pull request fixes that as well.

10 years agoFix parsing tests
Seo Sanghyeon [Wed, 20 Nov 2013 16:32:29 +0000 (01:32 +0900)]
Fix parsing tests

10 years agoMake BytePos 32-bit
Seo Sanghyeon [Tue, 19 Nov 2013 17:15:49 +0000 (02:15 +0900)]
Make BytePos 32-bit

10 years agoadd an initial `Gc<T>` stub with the API
Daniel Micay [Wed, 20 Nov 2013 04:20:06 +0000 (23:20 -0500)]
add an initial `Gc<T>` stub with the API

10 years agoauto merge of #10575 : sfackler/rust/non-copyable, r=huonw
bors [Wed, 20 Nov 2013 04:31:21 +0000 (20:31 -0800)]
auto merge of #10575 : sfackler/rust/non-copyable, r=huonw

The issue that required it has been fixed.

10 years agoRemove NonCopyable::new
Steven Fackler [Wed, 20 Nov 2013 04:19:05 +0000 (20:19 -0800)]
Remove NonCopyable::new

The issue that required it has been fixed.

10 years agoauto merge of #10568 : pcwalton/rust/more-bars, r=alexcrichton
bors [Tue, 19 Nov 2013 21:31:19 +0000 (13:31 -0800)]
auto merge of #10568 : pcwalton/rust/more-bars, r=alexcrichton

r? @alexcrichton

10 years agolibrustc: Change most uses of `&fn()` to `||`.
Patrick Walton [Tue, 19 Nov 2013 21:22:03 +0000 (13:22 -0800)]
librustc: Change most uses of `&fn()` to `||`.

10 years agolibsyntax: Change all uses of `&fn` to `||`.
Patrick Walton [Tue, 19 Nov 2013 20:21:21 +0000 (12:21 -0800)]
libsyntax: Change all uses of `&fn` to `||`.

10 years agolibextra: Convert uses of `&fn(A)->B` to `|A|->B`.
Patrick Walton [Tue, 19 Nov 2013 05:54:13 +0000 (21:54 -0800)]
libextra: Convert uses of `&fn(A)->B` to `|A|->B`.

10 years agolibstd: Change all uses of `&fn(A)->B` over to `|A|->B` in libstd
Patrick Walton [Tue, 19 Nov 2013 05:15:42 +0000 (21:15 -0800)]
libstd: Change all uses of `&fn(A)->B` over to `|A|->B` in libstd

10 years agoauto merge of #10495 : alexcrichton/rust/more-native-io, r=brson
bors [Tue, 19 Nov 2013 18:56:42 +0000 (10:56 -0800)]
auto merge of #10495 : alexcrichton/rust/more-native-io, r=brson

This implements a fair amount of the unimpl() functionality in io::native
relating to filesystem operations. I've also modified all io::fs tests to run in
both a native and uv environment (so everything is actually tested).

There are a few bits of remaining functionality which I was unable to get
working:

* truncate on windows
* change_file_times on windows
* lstat on windows

I think that change_file_times may just need a better interface, but the other
two have large implementations in libuv which I didn't want to tackle trying to
copy. I found a `chsize` function to work for truncate on windows, but it
doesn't quite seem to be working out.

10 years agoImplement more native file I/O
Alex Crichton [Wed, 13 Nov 2013 22:48:45 +0000 (14:48 -0800)]
Implement more native file I/O

This implements a fair amount of the unimpl() functionality in io::native
relating to filesystem operations. I've also modified all io::fs tests to run in
both a native and uv environment (so everything is actually tested).

There are a two bits of remaining functionality which I was unable to get
working:

* change_file_times on windows
* lstat on windows

I think that change_file_times may just need a better interface, but lstat has a
large implementation in libuv which I didn't want to tackle trying to copy.

10 years agoDon't use win64 calling convention on 32-bit machines.
Eric Holk [Tue, 19 Nov 2013 17:46:28 +0000 (12:46 -0500)]
Don't use win64 calling convention on 32-bit machines.

10 years agoauto merge of #10558 : alexcrichton/rust/faster-stdout, r=pcwalton,pcwalton
bors [Tue, 19 Nov 2013 13:16:24 +0000 (05:16 -0800)]
auto merge of #10558 : alexcrichton/rust/faster-stdout, r=pcwalton,pcwalton

There are issues with reading stdin when it is actually attached to a pipe, but
I have run into no problems in writing to stdout/stderr when they are attached
to pipes.

10 years agoauto merge of #10557 : huonw/rust/inline-deriving, r=pcwalton
bors [Tue, 19 Nov 2013 12:06:25 +0000 (04:06 -0800)]
auto merge of #10557 : huonw/rust/inline-deriving, r=pcwalton

ToStr, Encodable and Decodable are not marked as such, since they're
already expensive, and lead to large methods, so inlining will bloat the
metadata & the binaries.

This means that something like

    #[deriving(Eq)]
    struct A { x: int }

creates an instance like

    #[doc = "Automatically derived."]
    impl ::std::cmp::Eq for A {
        #[inline]
        fn eq(&self, __arg_0: &A) -> ::bool {
            match *__arg_0 {
                A{x: ref __self_1_0} =>
                match *self {
                    A{x: ref __self_0_0} => true && __self_0_0.eq(__self_1_0)
                }
            }
        }
        #[inline]
        fn ne(&self, __arg_0: &A) -> ::bool {
            match *__arg_0 {
                A{x: ref __self_1_0} =>
                match *self {
                    A{x: ref __self_0_0} => false || __self_0_0.ne(__self_1_0)
                }
            }
        }
    }

(The change being the `#[inline]` attributes.)

10 years agoauto merge of #10542 : huonw/rust/open01, r=alexcrichton
bors [Tue, 19 Nov 2013 08:26:27 +0000 (00:26 -0800)]
auto merge of #10542 : huonw/rust/open01, r=alexcrichton

Provide `Closed01` and `Open01` that generate directly from the
closed/open intervals from 0 to 1, in contrast to the plain impls for
f32 and f64 which generate the half-open [0,1).

Fixes #7755.

10 years agoauto merge of #10561 : pcwalton/rust/procify, r=alexcrichton
bors [Tue, 19 Nov 2013 07:06:29 +0000 (23:06 -0800)]
auto merge of #10561 : pcwalton/rust/procify, r=alexcrichton

r? @alexcrichton

10 years agoauto merge of #10479 : alexcrichton/rust/native-mutex.rs, r=cmr
bors [Tue, 19 Nov 2013 05:51:31 +0000 (21:51 -0800)]
auto merge of #10479 : alexcrichton/rust/native-mutex.rs, r=cmr

This adds a new `std::unstable::mutex` module which contains bindings to the platform-provided mutexes. This module is pretty much entirely unsafe to use, but is critical for the runtime and dropping our C++ dependency.

The actual implementation is to do a compare-and-swap on an initially uninitialized pointer. Pthreads does allow for static initialization, so this wouldn't be necessary if we had all the proper headers and whatnot, but windows it looks like will always require some sort of compare-and-swap operation. For now, I didn't want to have to define all the pthreads headers, so I continue to just malloc the pthreads lock/cvar.

After this, there's only one remaining C++ component of rust, and that's unwinding.

10 years agoMove runtime files to C instead of C++
Alex Crichton [Thu, 14 Nov 2013 18:04:55 +0000 (10:04 -0800)]
Move runtime files to C instead of C++

Explicitly have the only C++ portion of the runtime be one file with exception
handling. All other runtime files must now live in C and be fully defined in C.

10 years agoRemove the C++ lock_and_signal type
Alex Crichton [Thu, 14 Nov 2013 08:21:43 +0000 (00:21 -0800)]
Remove the C++ lock_and_signal type

A the same time this purges all runtime support needed for statically
initialized mutexes, moving all users over to the new Mutex type instead.

10 years agoImplement a native mutex type
Alex Crichton [Thu, 14 Nov 2013 07:17:18 +0000 (23:17 -0800)]
Implement a native mutex type

This mutex is built on top of pthreads for unix and the related windows apis on
windows. This is a straight port of the lock_and_signal type from C++ to rust.
Almost all operations on the type are unsafe, and it's definitely not
recommended for general use.

Closes #9105

10 years agoauto merge of #10458 : yichoi/rust/make_check_pass_android2, r=brson
bors [Tue, 19 Nov 2013 02:56:31 +0000 (18:56 -0800)]
auto merge of #10458 : yichoi/rust/make_check_pass_android2, r=brson

To enable test on android bot #9120

 workcache::test disabled and run-pass/core-run-destroy.rs fixed on android

10 years agolibsyntax: Remove `~fn()` from the language
Patrick Walton [Tue, 19 Nov 2013 02:25:25 +0000 (18:25 -0800)]
libsyntax: Remove `~fn()` from the language

10 years agolibrustc: Convert `~fn()` to `proc()` everywhere.
Patrick Walton [Tue, 19 Nov 2013 01:40:54 +0000 (17:40 -0800)]
librustc: Convert `~fn()` to `proc()` everywhere.

10 years agolibrustc: Remove the one use of `~fn()`
Patrick Walton [Mon, 18 Nov 2013 23:40:29 +0000 (15:40 -0800)]
librustc: Remove the one use of `~fn()`

10 years agolibextra: Remove `~fn()` from libextra.
Patrick Walton [Mon, 18 Nov 2013 23:39:02 +0000 (15:39 -0800)]
libextra: Remove `~fn()` from libextra.

10 years agolibstd: Change all `~fn()`s to `proc`s in the standard library.
Patrick Walton [Mon, 18 Nov 2013 21:25:09 +0000 (13:25 -0800)]
libstd: Change all `~fn()`s to `proc`s in the standard library.

This makes `Cell`s no longer necessary in most cases.

10 years agoauto merge of #10440 : brson/rust/cnamespace, r=bstrie
bors [Tue, 19 Nov 2013 01:46:32 +0000 (17:46 -0800)]
auto merge of #10440 : brson/rust/cnamespace, r=bstrie

10 years agoauto merge of #10366 : brson/rust/ignore-patterns, r=alexcrichton
bors [Tue, 19 Nov 2013 00:36:33 +0000 (16:36 -0800)]
auto merge of #10366 : brson/rust/ignore-patterns, r=alexcrichton

This replaces `*` with `..` in enums, `_` with `..` in structs, and `.._` with `..` in vectors. It adds obsolete syntax warnings for the old forms but doesn't turn them on yet because we need a snapshot.

#5830

10 years agoAllow piped stdout/stderr use uv_tty_t
Alex Crichton [Tue, 19 Nov 2013 00:26:03 +0000 (16:26 -0800)]
Allow piped stdout/stderr use uv_tty_t

There are issues with reading stdin when it is actually attached to a pipe, but
I have run into no problems in writing to stdout/stderr when they are attached
to pipes.

10 years agoUse the correct calling convention for extern rust functions.
Eric Holk [Sun, 17 Nov 2013 00:59:08 +0000 (19:59 -0500)]
Use the correct calling convention for extern rust functions.

10 years agoAdd Win64 calling convention.
Eric Holk [Sat, 16 Nov 2013 23:25:56 +0000 (18:25 -0500)]
Add Win64 calling convention.

10 years agoUse '..' as slice wildcard in vectors
Brian Anderson [Fri, 8 Nov 2013 03:25:39 +0000 (19:25 -0800)]
Use '..' as slice wildcard in vectors

10 years agoUse '..' as multi-field wildcard in enums and structs.
Brian Anderson [Sat, 2 Nov 2013 01:02:30 +0000 (18:02 -0700)]
Use '..' as multi-field wildcard in enums and structs.