Commit Graph

21402 Commits

Author SHA1 Message Date
Seo Sanghyeon
cd7a9b7234 Remove arms_have_move_bindings 2013-11-25 23:36:20 +09:00
bors
55201ed858 auto merge of #10628 : huonw/rust/3614, r=alexcrichton
Fixes #3614.
2013-11-25 01:12:36 -08:00
Huon Wilson
e36cb0d5c1 syntax: parse inner attributes on impls.
Fixes #3614.
2013-11-25 19:18:44 +11:00
bors
ce32f72f1d auto merge of #10641 : cmr/rust/close_delims, r=alexcrichton
Currently, the parser doesn't give any context when it finds an unclosed
delimiter and it's not EOF. Report the most recent unclosed delimiter, to help
the user along.

Closes #10636
2013-11-24 23:56:46 -08:00
bors
07ad0ccadc auto merge of #10635 : alexcrichton/rust/issue-10626, r=cmr
This is both useful for performance (otherwise logging is unbuffered), but also
useful for correctness. Because when a task is destroyed we can't block the task
waiting for the logger to close, loggers are opened with a 'CloseAsynchronously'
specification. This causes libuv do defer the call to close() until the next
turn of the event loop.

If you spin in a tight loop around printing, you never yield control back to the
libuv event loop, meaning that you simply enqueue a large number of close
requests but nothing is actually closed. This queue ends up never getting
closed, meaning that if you keep trying to create handles one will eventually
fail, which the runtime will attempt to print the failure, causing mass
destruction.

Caching will provide better performance as well as prevent creation of too many
handles.

Closes #10626
2013-11-24 22:47:10 -08:00
bors
2cc1e16ac0 auto merge of #10603 : alexcrichton/rust/no-linked-failure, r=brson
The reasons for doing this are:

* The model on which linked failure is based is inherently complex
* The implementation is also very complex, and there are few remaining who
  fully understand the implementation
* There are existing race conditions in the core context switching function of
  the scheduler, and possibly others.
* It's unclear whether this model of linked failure maps well to a 1:1 threading
  model

Linked failure is often a desired aspect of tasks, but we would like to take a
much more conservative approach in re-implementing linked failure if at all.

Closes #8674
Closes #8318
Closes #8863
2013-11-24 21:32:13 -08:00
Alex Crichton
9fe8fc8836 Cache a task's stderr logger
This is both useful for performance (otherwise logging is unbuffered), but also
useful for correctness. Because when a task is destroyed we can't block the task
waiting for the logger to close, loggers are opened with a 'CloseAsynchronously'
specification. This causes libuv do defer the call to close() until the next
turn of the event loop.

If you spin in a tight loop around printing, you never yield control back to the
libuv event loop, meaning that you simply enqueue a large number of close
requests but nothing is actually closed. This queue ends up never getting
closed, meaning that if you keep trying to create handles one will eventually
fail, which the runtime will attempt to print the failure, causing mass
destruction.

Caching will provide better performance as well as prevent creation of too many
handles.

Closes #10626
2013-11-24 21:22:19 -08:00
Alex Crichton
acca9e3834 Remove linked failure from the runtime
The reasons for doing this are:

* The model on which linked failure is based is inherently complex
* The implementation is also very complex, and there are few remaining who
  fully understand the implementation
* There are existing race conditions in the core context switching function of
  the scheduler, and possibly others.
* It's unclear whether this model of linked failure maps well to a 1:1 threading
  model

Linked failure is often a desired aspect of tasks, but we would like to take a
much more conservative approach in re-implementing linked failure if at all.

Closes #8674
Closes #8318
Closes #8863
2013-11-24 21:21:12 -08:00
bors
ca3274336e auto merge of #10639 : jix/rust/fix_find_mut_in_trie, r=thestinger
Make TrieMap/TrieSet's find_mut check the key for external nodes.
Without this find_mut sometimes returns a reference to another key when
querying for a non-present key.
2013-11-24 20:22:03 -08:00
bors
09eca11805 auto merge of #10637 : luqmana/rust/nmt, r=cmr
There's no need for it to be @mut.
2013-11-24 19:07:44 -08:00
Corey Richardson
ab19861037 Add a note for unclosed delimiters
Currently, the parser doesn't give any context when it finds an unclosed
delimiter and it's not EOF. Report the most recent unclosed delimiter, to help
the user along.

Closes #10636
2013-11-24 21:32:38 -05:00
Kiet Tran
9a4c8da501 Add comments to ast, ast_map, ty, and pat_util 2013-11-24 18:38:41 -05:00
Luqman Aden
2431ac3080 libextra: Remove @mut from term. 2013-11-24 18:22:50 -05:00
Jannis Harder
525878fc96 std::trie: Fix find_mut for non-present keys
Make TrieMap/TrieSet's find_mut check the key for external nodes.
Without this find_mut sometimes returns a reference to another key when
querying for a non-present key.
2013-11-25 00:09:40 +01:00
bors
b3ff24adaa 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)
2013-11-24 10:17:03 -08:00
Leah Hanson
e1d1ad34f7 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
2013-11-24 11:14:27 -06:00
bors
01b5381703 auto merge of #10634 : LeoTestard/rust/rc-eq, r=cmr 2013-11-24 08:42:35 -08:00
Léo Testard
fdac9e470c Implement cmp traits for Rc<T> and add a ptr_eq method. 2013-11-24 17:29:44 +01:00
Corey Richardson
a8a6188a1a Use -O1 for non-GNU linkers 2013-11-24 08:50:16 -05:00
bors
ce45bb7f44 auto merge of #10625 : huonw/rust/json-errors, r=alexcrichton
Fixes #4244.
2013-11-24 01:26:30 -08:00
bors
738eb9b930 auto merge of #10620 : cmr/rust/linker_opts, r=thestinger 2013-11-23 23:56:30 -08:00
bors
9ba473f86f 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.
2013-11-23 21:36:50 -08:00
bors
33375a31e8 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`?
2013-11-23 20:01:42 -08:00
Huon Wilson
b052f28fd6 extra: improve the errors for the JSON Decoder.
Fixes #4244.
2013-11-24 10:34:27 +11:00
Steven Fackler
bdfaf04bd5 Move mutable::Mut to cell::RefCell 2013-11-23 13:45:05 -08:00
Corey Richardson
672549372c Use linker optimizations on Linux 2013-11-23 10:03:41 -05:00
bors
6cbc57cadb 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.
2013-11-22 23:06:24 -08:00
Corey Richardson
09af9d4856 Add ctype-likes to Ascii 2013-11-23 02:01:10 -05:00
Luqman Aden
84403eb897 Remove sjlj stuff from rust_upcall and don't pass -Werror to libuv. 2013-11-22 22:04:36 -08:00
Steven Fackler
c6ca9abcc6 Add Rc::from_mut 2013-11-22 21:19:53 -08:00
Steven Fackler
48cd8c646a More Mut tests 2013-11-22 21:19:53 -08:00
Steven Fackler
5759f2fc57 Strip down Cell functionality 2013-11-22 21:19:53 -08:00
Steven Fackler
8a26266f65 Change Mut::map to Mut::with 2013-11-22 21:19:53 -08:00
Steven Fackler
bb39cc3ae6 Make MutRef more consistent with &mut 2013-11-22 21:19:53 -08:00
Steven Fackler
2e4bb2b9e9 Cell -> Mut switch in comm 2013-11-22 21:19:53 -08:00
Steven Fackler
18119afbbe Move Rc tests away from Cell 2013-11-22 21:19:53 -08:00
Steven Fackler
7c9daa8ff7 Remove RcMut
Rc<Mut<T>> should be used instead
2013-11-22 21:19:53 -08:00
Steven Fackler
0fade3a714 Introduce Mut<T> to libstd
Based off of blake2-ppc's work in #9429.
2013-11-22 21:19:53 -08:00
Luqman Aden
6820ed4dcf Fix up mingw64 target. 2013-11-22 20:39:58 -05:00
bors
fb279aa02a auto merge of #10605 : huonw/rust/ascii-ident-gate, r=pcwalton
cf. https://mail.mozilla.org/pipermail/rust-dev/2013-November/006920.html
2013-11-22 13:51:34 -08:00
Huon Wilson
ab2a99f699 Put non-ascii identifiers behind a feature gate.
cf. https://mail.mozilla.org/pipermail/rust-dev/2013-November/006920.html
2013-11-23 08:18:50 +11:00
bors
09ed7913e4 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.)
2013-11-22 12:41:36 -08:00
bors
cd9069ca73 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.
2013-11-22 10:06:35 -08:00
Alex Crichton
93a0dec202 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.
2013-11-22 10:02:10 -08:00
Felix S. Klock II
861e6f5cd2 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.)
2013-11-22 18:00:21 +01:00
bors
d3cb24b1fe 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.
2013-11-22 07:31:35 -08:00
Daniel Micay
bf61641e9f add a breakpoint intrinsic for debugging
This can be used to grab the attention of a debugger, and unlike
`abort` execution can be resumed.
2013-11-22 10:29:04 -05:00
bors
cad1f89bb5 auto merge of #10608 : thestinger/rust/managed, r=huonw 2013-11-22 05:52:01 -08:00
bors
a9b1dcf24a auto merge of #10606 : huonw/rust/lint-unsafe-in-macro, r=thestinger
Add a test for the case I mentioned on #10599.
2013-11-22 04:41:33 -08:00
Huon Wilson
efe9d744f9 syntax: add a visit_ident method to the Visitor. 2013-11-22 23:24:49 +11:00