Commit Graph

29952 Commits

Author SHA1 Message Date
John Schmidt
ebde8cfa61 Change prints: @T -> Gc<T> , ~T -> Box<T>
Fixes #14915
2014-06-16 18:16:01 -07:00
Kevin Butler
9945052e64 rustc: Improve span for error about using a method as a field.
libsyntax: ExprField now contains a SpannedIdent rather than Ident.

[breaking-change]
2014-06-16 18:15:54 -07:00
Alex Crichton
051abae802 alloc: Refactor OOM into a common routine 2014-06-16 18:15:48 -07:00
Alex Crichton
4cd932f94e alloc: Allow disabling jemalloc 2014-06-16 18:15:48 -07:00
Alex Crichton
7613c9dd59 alloc: Format heap.rs to 80-char max 2014-06-16 18:15:48 -07:00
bors
cc30abbcad auto merge of #14855 : TeXitoi/rust/relicense-shootout-binarytrees, r=brson
Everyone agreed.

Related to #14248, close #14720

@brson OK?
2014-06-17 01:01:55 +00:00
Alex Crichton
3324257833 rustc: Start accepting *const T
This does not yet change the compiler and libraries from `*T` to `*const T` as
it will require a snapshot to do so.

cc #7362
2014-06-16 16:58:17 -07:00
bors
ad7508e39c auto merge of #14852 : TeXitoi/rust/relicense-shootout-pidigits, r=brson
Everyone agreed.

Related to #14248, close #14718

@brson OK?
2014-06-16 23:11:46 +00:00
Cameron Zwarich
480cd6fb90 Rename check_for_assignment_to_restricted_or_frozen_location
Rename check_for_assignment_to_restricted_or_frozen_location to
check_for_assignment_to_borrowed_path.
2014-06-16 15:40:21 -07:00
Cameron Zwarich
a924d740df Switch to each_in_scope_loan_affecting_path
The last remaining use of each_in_scope_restriction in
check_for_assignment_to_restricted_or_frozen_location is using the
pattern captured by each_in_scope_loan_affecting_path, so it can be
removed.
2014-06-16 15:40:21 -07:00
Cameron Zwarich
69f4839b92 Always check assigned loan paths to the top of the path
Currently, check_for_assignment_to_restricted_or_frozen_location bails
out early when looking for loaned base paths when it hits an McDeclared
or McImmutable extension. With the current type system, this is actually
irrelevant, since mutation can only occur given a unique mutable access
path, forcing the same requirement on each base path.
2014-06-16 15:40:20 -07:00
Cameron Zwarich
178c4fbccb Remove an unused return value
The only caller of check_for_assignment_to_restricted_or_frozen_location
isn't checking its return value, so we can remove it and simplify the
internal logic of the function.
2014-06-16 15:40:20 -07:00
Cameron Zwarich
702ef1b721 Call mark_variable_as_used_mut even after assignment errors
It doesn't actually matter if we call mark_variable_as_used_mut when the
assignment was invalid, since the variable was still used mutably.
2014-06-16 15:40:20 -07:00
Cameron Zwarich
ba203c5c5d Add a new each_in_scope_loan_affecting_path helper function
Add a helper function that generalizes the loan path restriction
strategy used by analyze_restrictions_on_use.
2014-06-16 15:40:20 -07:00
Cameron Zwarich
e018fc36d1 Remove Restriction
The Restriction struct now consists of a single Rc<LoanPath> field, so
it can be replaced with Rc<LoanPath>.
2014-06-16 15:40:20 -07:00
Cameron Zwarich
59309e0d9b Remove RestrictionSet
Now that RestrictionSet is no longer being used for anything meaningful,
it can be removed, along with any other associated functions and
RestrictionSet fields of other types.
2014-06-16 15:40:20 -07:00
Cameron Zwarich
9934759195 Remove an unused bkcerr_code constructor parameter
The RestrictionSet parameter of the err_borrowed_pointer_too_short
constructor isn't  actually used, so it can be removed.
2014-06-16 15:40:20 -07:00
Cameron Zwarich
6849362f38 Remove the last actual usage of RestrictionSet
Switch to checking BorrowKind values of loans instead of their
RestrictionSet values. This was the last code that made a decision
based on a RestrictionSet.
2014-06-16 15:40:20 -07:00
Cameron Zwarich
6ca8dbfaed Make a new compatible_borrow_kinds helper function
Move the `incompatible` helper function from analyze_restrictions_on_use
to the file scope and invert its meaning to account for future uses.
2014-06-16 15:40:20 -07:00
Cameron Zwarich
d2ca7465aa Remove an unused closure parameter
Remove the unused &Restriction parameter of each_in_scope_restriction's
op parameter.
2014-06-16 15:40:20 -07:00
Cameron Zwarich
2d3f122534 Remove a pointless check for intersection with RESTR_MUTATE
Now that all loans restrict mutation, there's no point in checking for
intersection with RESTR_MUTATE.
2014-06-16 15:40:20 -07:00
Cameron Zwarich
2f77212e0c Remove comments that no longer apply after the removal of const 2014-06-16 15:40:20 -07:00
bors
b755b4db4b auto merge of #14781 : alexcrichton/rust/issue-14724, r=brson
* os::pipe() now returns `IoResult<os::Pipe>`
* os::pipe() is now unsafe because it does not arrange for deallocation of file
  descriptors
* PipeStream::pair() has been added. This is a safe method to get a pair of
  pipes.
* Dealing with pipes in native process bindings have been improved to be more
  robust in the face of failure and intermittent errors. This converts a few
  fail!() situations to Err situations.

cc #13538
Closes #14724
[breaking-change]
2014-06-16 20:36:41 +00:00
bors
0973eb4419 auto merge of #14551 : alexcrichton/rust/issue-14467, r=kballard
Forking off a child which survives the parent is often a useful task, and is
currently not possible because the Process type will invoke `wait()` in its
destructor in order to prevent leaking resources. This function adds a new safe
method, `daemonize`, which can be used to consume an instance of `Process` which
will then not call `wait` in the destructor.

This new method is clearly documented as a leak of resources, but it must be
forcibly opted in to.

Closes #14467
2014-06-16 18:46:45 +00:00
Alex Crichton
04eced750e std: Improve pipe() functionality
* os::pipe() now returns IoResult<os::Pipe>
* os::pipe() is now unsafe because it does not arrange for deallocation of file
  descriptors
* os::Pipe fields are renamed from input to reader and out to write.
* PipeStream::pair() has been added. This is a safe method to get a pair of
  pipes.
* Dealing with pipes in native process bindings have been improved to be more
  robust in the face of failure and intermittent errors. This converts a few
  fail!() situations to Err situations.

Closes #9458
cc #13538
Closes #14724
[breaking-change]
2014-06-16 10:53:49 -07:00
Alex Crichton
2fe926431b std: Support consuming a Process without waiting
Forking off a child which survives the parent is often a useful task, and is
currently not possible because the Process type will invoke `wait()` in its
destructor in order to prevent leaking resources. This function adds a new safe
method, `forget`, which can be used to consume an instance of `Process` which
will then not call `wait` in the destructor.

This new method is clearly documented as a leak of resources, but it must be
forcibly opted in to.

Closes #14467
2014-06-16 10:47:25 -07:00
bors
4b672a63da auto merge of #14877 : Seldaek/rust/commdocs, r=alexcrichton
Finally what I promised to do in #13862 /cc @alexcrichton
2014-06-16 17:01:56 +00:00
Jordi Boggiano
5412fdacaf Add examples of how to read from a channel with a timeout, refs #13862 2014-06-16 18:26:39 +02:00
bors
0b32d42a5d auto merge of #14882 : pcwalton/rust/drop-underscore, r=nikomatsakis
This code didn't do anything, but was a vestige of the old semantics for
`let _ = ...`.

Closes #10488. (As near as I can tell anyhow.)

r? @nikomatsakis
2014-06-16 15:06:48 +00:00
bors
8a5c5b6081 auto merge of #14932 : Sawyer47/rust/json-smallfix, r=huonw 2014-06-16 13:16:44 +00:00
bors
5abf794707 auto merge of #14906 : P1start/rust/rustdoc-lifetimes, r=huonw
rustdoc was previously formatting lifetimes with two apostrophes, presumably as a result of #14797.
2014-06-16 11:31:56 +00:00
P1start
0204ca1726 Fix rustdoc's formatting of lifetimes
rustdoc was previously formatting lifetimes with two apostrophes, presumably
as a result of #14797.
2014-06-16 21:15:48 +12:00
bors
7ec78053ec auto merge of #14900 : alexcrichton/rust/snapshots, r=huonw
Closes #14898
Closes #14918
2014-06-16 08:16:49 +00:00
bors
2ef910f71a auto merge of #14715 : vhbit/rust/ios-pr2, r=alexcrichton 2014-06-16 06:32:03 +00:00
Alex Crichton
89b0e6e12b Register new snapshots 2014-06-15 23:30:24 -07:00
Valerii Hiora
2ec323e4c3 Potential fix for Win32 build
It seems in one of rebases I’ve resolved conflicts wrong and left one redundant line, it is absent in current master and it might cause compilation failure by copying file into itself.
2014-06-16 08:48:59 +03:00
Piotr Jawniak
b71fa9bd72 Small improvement for json PrettyEncoder 2014-06-15 09:31:14 +02:00
Jakub Wieczorek
f6efb54d44 Fix an ICE on a cast from an inferred nil to uint
Fixes #10991.
2014-06-14 23:32:28 +02:00
Valerii Hiora
3446f28879 Updated compiler-rt
Previous update unfortunately included changes which
broke Android compilation. This update fixes it and
should allow correct compilation of SjLj for iOS and
all builtins for Android.
2014-06-14 21:48:12 +03:00
bors
6d8342f5e9 auto merge of #14835 : alexcrichton/rust/no-more-at, r=brson
All functionality is now available through `Gc<T>` and `box(GC) expr`. This change also removes `GC` from the prelude (it's an experimental feature).
2014-06-14 17:51:49 +00:00
Alex Crichton
ade807c6dc rustc: Obsolete the @ syntax entirely
This removes all remnants of `@` pointers from rustc. Additionally, this removes
the `GC` structure from the prelude as it seems odd exporting an experimental
type in the prelude by default.

Closes #14193
[breaking-change]
2014-06-14 10:45:37 -07:00
Alex Crichton
f20b1293fc Register new snapshots 2014-06-14 10:28:09 -07:00
bors
d64f18c490 auto merge of #14884 : huonw/rust/getoptsfail, r=alexcrichton 2014-06-14 10:36:46 +00:00
bors
dbd29ea96e auto merge of #14874 : pcwalton/rust/enum-to-float-casts-part-deux, r=alexcrichton
Closes #14794.

If you're casting from an enum to a float, cast through an integer
first.

[breaking-change]

r? @alexcrichton
2014-06-14 08:46:48 +00:00
bors
18c451fc49 auto merge of #14739 : zwarich/rust/mut-unique-path, r=nikomatsakis
Implement the stronger guarantees for mutable borrows proposed in #12624.
2014-06-14 06:36:49 +00:00
bors
2c6caad1ba auto merge of #14878 : vtsatskin/rust/rustdoc-sidebar-click-targets, r=alexcrichton
There was feedback gathered by @bjz which request for larger click targets in the rustdoc sidebar. Here's my attempt at that.

My only concern with this patch is the removal of `<br>` between sidebar links. This may break formatting for text-only viewers of this documentation. If there is a large enough demographic of people that will be affected, perhaps we can try switching the structure of each sidebar block sidebar to an `<ol>` with each item as a `<li>`. 

* Change links to display:block for click larger targets
* Remove linebreaks due to extra space
* Adjust margins so that element spacing stays the same
* Sidebar item hover background colour chosen from `<pre>` styling
2014-06-14 04:46:46 +00:00
Cameron Zwarich
6fc788916c Reorganize code in check_loans
Move analyze_restrictions_on_use and check_if_path_is_moved so that all
of the code related to assignments is in a contiguous block at the end
of the file.
2014-06-13 20:48:10 -07:00
Cameron Zwarich
5878b5edb0 Add new tests for uses of mutably borrowed paths 2014-06-13 20:48:10 -07:00
Cameron Zwarich
d7de4e9aff Enforce stronger guarantees for mutable borrows
Implement the stronger guarantees for mutable borrows from #12624. This
removes the ability to read from a mutably borrowed path for the
duration of the borrow, and enforces a unique access path for any
mutable borrow, for both reads and writes.

This makes mutable borrows work better with concurrent accesses from
multiple threads, and it opens the door for allowing moves out of
mutably borrowed values, as long as a new value is written before the
mutable borrow ends. This also aligns Rust more closely with academic
languages based on substructural types and separation logic.

The most common situation triggering an error after this change is a
call to a function mutably borrowing self with self.field as one of the
arguments. The workaround is to bind self.field to a temporary, but the
need for these temporaries will hopefully go away after #6268 is fixed.

Another situation that triggers an error is using the head expression of
a match in an arm that binds a variable with a mutable reference. The
use of the head expression needs to be replaced with an expression that
reconstructs it from match-bound variables.

This fixes #12624.

[breaking-change]
2014-06-13 20:48:09 -07:00
Cameron Zwarich
159e27aebb Fix all violations of stronger guarantees for mutable borrows
Fix all violations in the Rust source tree of the stronger guarantee
of a unique access path for mutable borrows as described in #12624.
2014-06-13 20:48:09 -07:00