Commit Graph

26708 Commits

Author SHA1 Message Date
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
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
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
Cameron Zwarich
036833ece9 Rename analyze_move_out_from to analyze_restrictions_on_use
Also rename MoveError to UseError and MoveOk / MoveWhileBorrowed to
UseOk / UseWhileBorrowed.
2014-06-13 20:48:09 -07:00
Cameron Zwarich
24b1b79cf1 Make analyze_move_out_from take a BorrowKind
Currently analyze_move_out_from ignores the BorrowKind of loans, but the
same logic is useful when restricted to loans of specific borrow kinds.
2014-06-13 20:48:09 -07:00
Cameron Zwarich
45a1b97764 Make analyze_move_out_from more field-sensitive
Currently analyze_move_out_from checks all restrictions on all base
paths of the move path, but it only needs to check restrictions from
loans of the base paths, and can disregard restrictions from loans of
extensions of those base paths.
2014-06-13 20:48:09 -07:00
Cameron Zwarich
8c0e1ce6c9 Make check_for_move_of_borrowed_path take an &LoanPath rather than an &Rc<LoanPath>
It doesn't actually need the Rc, and it reduces the net number of
pointer manipulations.
2014-06-13 20:48:09 -07:00
Cameron Zwarich
d2d8fa2a09 Make analyze_move_out_from use a loop rather than recursion
It will be simpler to make some of the changes that I need to make to
analyze_move_out if it uses a loop rather than recursion.
2014-06-13 20:48:09 -07:00
Huon Wilson
09eb95f241 getopts: derive Eq for types. 2014-06-14 11:20:47 +10:00
bors
1cde9d8cbb auto merge of #14866 : bjz/rust/bitwise, r=alexcrichton 2014-06-14 01:11:44 +00:00
Huon Wilson
0642cbbde0 getopts: format failure messages with Show.
This obsoletes the old `to_err_msg` method. Replace

    println!("Error: {}", failure.to_err_msg())

    let string = failure.to_err_msg();

with

    println!("Error: {}", failure)

    let string = failure.to_str();

[breaking-change]
2014-06-14 11:11:09 +10:00
Patrick Walton
1a852a6df7 librustc: Remove useless code to handle let _ = ...
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.)
2014-06-13 17:58:37 -07:00
bors
3851d68a27 auto merge of #14750 : bachm/rust/master, r=alexcrichton
This adds the missing `get_mut` method to the `MutableVector` trait, and implements it for `&'a mut [T]`.
2014-06-13 22:46:35 +00:00
Valentin Tsatskin
0188bebbb7 rustdoc: Larger click areas for sidebar items
* 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-13 15:15:37 -07:00
Alex Crichton
b7af25060a Rolling up PRs in the queue
Closes #14797 (librustc: Fix the issue with labels shadowing variable names by making)
Closes #14823 (Improve error messages for io::fs)
Closes #14827 (libsyntax: Allow `+` to separate trait bounds from objects.)
Closes #14834 (configure: Don't sync unused submodules)
Closes #14838 (Remove typo on collections::treemap::UnionItems)
Closes #14839 (Fix the unused struct field lint for struct variants)
Closes #14840 (Clarify `Any` docs)
Closes #14846 (rustc: [T, ..N] and [T, ..N+1] are not the same)
Closes #14847 (Audit usage of NativeMutex)
Closes #14850 (remove unnecessary PaX detection)
Closes #14856 (librustc: Take in account mutability when casting array to raw ptr.)
Closes #14859 (librustc: Forbid `transmute` from being called on types whose size is)
Closes #14860 (Fix `quote_pat!` & parse outer attributes in `quote_item!`)
2014-06-13 13:53:55 -07:00
Huon Wilson
f907d9772c syntax: parse outer attributes in quote_item! calls.
Fixes #14857.
2014-06-13 13:53:55 -07:00
Huon Wilson
9d5ec04d18 syntax: fix quote_pat! & unignore a quotation test. 2014-06-13 13:53:55 -07:00
Patrick Walton
c9f3f47702 librustc: Forbid transmute from being called on types whose size is
only known post-monomorphization, and report `transmute` errors before
the code is generated for that `transmute`.

This can break code that looked like:

    unsafe fn f<T>(x: T) {
        let y: int = transmute(x);
    }

Change such code to take a type parameter that has the same size as the
type being transmuted to.

Closes #12898.

[breaking-change]
2014-06-13 13:53:55 -07:00
Luqman Aden
8c4a10a159 librustc: Take in account mutability when casting array to raw ptr. 2014-06-13 13:53:35 -07:00
Alex Crichton
ac7b9ddc54 Audit usage of NativeMutex
Once a native mutex has been used once, it is never allowed to be moved again.
This is because some pthreads implementations take pointers inside the mutex
itself.

This commit adds stern wording around the methods on native mutexes, and fixes
one use case in the codebase. The Mutex type in libsync was susceptible to
movement, so the inner static mutex is now boxed to ensure that the address of
the native mutex is constant.
2014-06-13 13:53:34 -07:00
Alex Crichton
b612ae9ede rustc: [T, ..N] and [T, ..N+1] are not the same
This commit fixes a bug in the calculation of the hash of a type which didn't
factor in the length of a constant-sized vector. As a result of this, a type
placed into an Any of a fixed length could be peeled out with any other fixed
length in a safe manner.
2014-06-13 13:53:34 -07:00
P1start
00e1a69237 Clarify Any docs
The `Any` docs previously did not state that only `'static` types implement it.
2014-06-13 13:53:34 -07:00
Jakub Wieczorek
42d538e615 Fix the unused struct field lint for struct variants
Fixes #14837.
2014-06-13 13:53:34 -07:00
Renato Riccieri Santos Zannon
c17af5d7fd Remove typo on collections::treemap::UnionItems
The docstring stated it was a intersection iterator, when in fact it is the union iterator
2014-06-13 13:53:34 -07:00
Patrick Walton
9b9ef44233 libsyntax: Allow + to separate trait bounds from objects.
RFC #27.

After a snapshot, the old syntax will be removed.

This can break some code that looked like `foo as &Trait:Send`. Now you
will need to write `foo as (&Trait+Send)`.

Closes #12778.

[breaking-change]
2014-06-13 13:53:34 -07:00
Alex Crichton
03ec8e5cc9 std: Rebase better errors on master 2014-06-13 13:53:34 -07:00
Yehuda Katz
298412a6e8 Improve error messages for io::fs 2014-06-13 13:53:34 -07:00
Patrick Walton
2ed4734873 librustc: Fix the issue with labels shadowing variable names by making
the leading quote part of the identifier for the purposes of hygiene.

This adopts @jbclements' solution to #14539.

I'm not sure if this is a breaking change or not.

Closes #12512.

[breaking-change]
2014-06-13 13:53:34 -07:00
Patrick Walton
30772d94b1 librustc: Forbid enum-to-float casts.
Closes #14794.

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

[breaking-change]
2014-06-13 11:23:47 -07:00
Niko Matsakis
9153d8ad6c Introduce VecPerParamSpace and use it to represent sets of types and
parameters

This involves numerous substeps:

1. Treat Self same as any other parameter.
2. No longer compute offsets for method parameters.
3. Store all generic types (both trait/impl and method) with a method,
   eliminating odd discrepancies.
4. Stop doing unspeakable things to static methods and instead just use
   the natural types, now that we can easily add the type parameters from
   trait into the method's polytype.
5. No doubt some more. It was hard to separate these into distinct commits.

Fixes #13564
2014-06-13 13:20:24 -04:00
Brendan Zabarauskas
ffa4ae81e4 Add Bitwise::{swap_bytes, rotate_left, rotate_right} methods 2014-06-13 09:28:32 -07:00
bors
0422934e24 auto merge of #14831 : alexcrichton/rust/format-intl, r=brson
* The select/plural methods from format strings are removed
* The # character no longer needs to be escaped
* The \-based escapes have been removed
* '{{' is now an escape for '{'
* '}}' is now an escape for '}'

Closes #14810
[breaking-change]
2014-06-13 14:42:03 +00:00
Nick Cameron
984e9afae5 Dump results of analysis phase as CSV
Adds the option -Zsave-analysis which will dump the results of syntax and type checking into CSV files. These can be interpreted by tools such as DXR to provide semantic information about Rust programs for code search, cross-reference, etc.

Authored by Nick Cameron and Peter Elmers (@pelmers; including enums, type parameters/generics).
2014-06-13 21:09:50 +12:00
Valerii Hiora
41522aaf72 There should be no metadata to read on iOS 2014-06-13 11:41:00 +03:00
bachm
78053f0825 added get_mut() for [T] 2014-06-13 09:55:36 +02:00
Valerii Hiora
ebc6474668 Cosmetic fixes & comments 2014-06-13 10:18:12 +03:00
bors
c20aed0930 auto merge of #14819 : michaelwoerister/rust/unique_type_id, r=alexcrichton
With this change, rustc creates a unique type identifier for types in debuginfo. These type identifiers are used by LLVM to correctly handle link-time-optimization scenarios but also help rustc with dealing with inlining from other crates. For more information, see the documentation block at the top of librustc/middle/trans/debuginfo.rs and also [my blog post about the topic](http://michaelwoerister.github.io/2014/06/05/rust-debuginfo-and-unique-type-identifiers.html). This should fix the LTO issues that have been popping up lately. 

The changes to the debuginfo module's inner workings are also improved by this. Metadata uniquing of pointer types is not handled explicitly instead of relying on LLVM doing the right thing behind the scenes, and region parameters on types should not lead to metadata duplication anymore.

There are two things that I'd like to get some feedback on:
1. IDs for named items consist of two parts: The [Strict Version Hash](https://github.com/mozilla/rust/blob/0.10/src/librustc/back/svh.rs#L11) of their defining crate and the AST node id of their definition within that crate. My question is: Is the SVH a good choice for identifying the crate? Is it even going to stay? The [crate-id RFC](https://github.com/rust-lang/rfcs/pull/109) got me confused.
2. Unique Type Identifiers can be arbitrary strings and right now the format is rather verbose. For debugging this is nice, because one can infer a lot about a type from the type id alone (it's more or less a signature). For deeply nested generics, id strings could get rather long though. One option to limit the id size would be to use some hashcode instead of the full id (anything that avoids collision as much as possible). Another option would be to use a more compact representation, like ty_encode. This reduces size but also readability.
Since these ID's only show up in LLVM IR, I'm inclined to just leave in the verbose format for now, and only act if sizes of rlibs become a problem.
2014-06-13 01:52:02 +00:00
bors
7c7f4b0e0b auto merge of #14816 : theptrk/rust/unclear-comment, r=huonw
The old comment left it unclear if this is creating a random value or doing a check as to whether or not the generator is available or some other operation.

See: http://stackoverflow.com/questions/24153311/when-is-rng-gen-not-true
2014-06-13 00:07:05 +00:00
Guillaume Pinot
15f65bae65 Relicense shootout-binarytrees.rs
Everyone agreed.

Related to #14248, close #14720
2014-06-12 23:41:48 +02:00
bors
021bea15fc auto merge of #14813 : cmr/rust/once-docs-unsafe, r=alexcrichton 2014-06-12 21:22:01 +00:00
Guillaume Pinot
fed6e8b5c1 Relicense shootout-pidigits.rs
Everyone agreed.

Related to #14248, close #14718
2014-06-12 22:47:40 +02:00
bors
3a9228b7ea auto merge of #14811 : forticulous/rust/refcell-show, r=alexcrichton
Show impl for RefCell and friends
2014-06-12 19:36:53 +00:00
Valerii Hiora
70a79a9e05 Better dylib skipping based on Alex Crichton code 2014-06-12 21:15:14 +03:00
Valerii Hiora
a49b765f9a Basic iOS support 2014-06-12 21:15:14 +03:00
Valerii Hiora
0c10c68682 Disable generating split-stack code
Allows to compile for archs which do not have (or have limited)
segmented stack support like embedded.
2014-06-12 20:24:08 +03:00
Valerii Hiora
d730ae2fb0 Runtime support for arm on iOS 2014-06-12 20:24:08 +03:00
Valerii Hiora
9ece0510b1 Updated deps 2014-06-12 20:20:12 +03:00
Michael Woerister
c7426cf05a debuginfo: Fix issue with unique type IDs not being passed to LLVM for LLVM 3.4 2014-06-12 18:48:14 +02:00
Michael Woerister
0a98a4e422 debuginfo: Generate cross-crate unique type identifiers for debuginfo types.
With this change, rustc creates a unique type identifier for types in debuginfo. These type identifiers are used by LLVM to correctly handle link-time-optimization scenarios but also help rustc with dealing with inlining from other crates. For more information, see the documentation block at the top of librustc/middle/trans/debuginfo.rs.

Fixes #13681.
2014-06-12 18:39:01 +02:00
bors
8b87c3a2a8 auto merge of #14809 : zzmp/rust/patch-2, r=alexcrichton
Previously, the type system's restrictions on borrowing were summarized as

> The previous example showed that the type system forbids any borrowing of owned boxes found in aliasable, mutable memory.

This did not jive with the example, which allowed mutations so long as the borrowed reference had been returned. Also, the language has changed to no longer allow aliasable mutable locations. This changes the summary to read

> The previous example showed that the type system forbids mutations of owned boxed values while they are being borrowed. In general, the type system also forbids borrowing a value as mutable if it is already being borrowed - either as a mutable reference or an immutable one.

This adds more general information for the experienced reader as well, to offer a more complete understanding.
2014-06-12 16:02:05 +00:00
bors
c0a6f72e8b auto merge of #14805 : zzmp/rust/patch-1, r=alexcrichton
The guide previously stated:

> The compiler will automatically convert a box box point to a reference like &amp;point.

This fixes the doubled word `box`, so the statement reads

> The compiler will automatically convert a box point to a reference like &amp;point.

The code it is referring to is `compute_distance(&on_the_stack, on_the_heap);`, so a single `box` is appropriate.
2014-06-12 14:17:13 +00:00
bors
87bf47a0f7 auto merge of #14801 : pcwalton/rust/name-shadowing-in-one-pattern, r=alexcrichton
bindings and function arguments.

Issue #14581.

To fix code that this breaks, give the pattern identifiers different names.

[breaking-change]

r? @brson
2014-06-12 12:32:13 +00:00
bors
614e448b02 auto merge of #14800 : reem/rust/patch-1, r=alexcrichton
According to #14767 and the grammar right above this documentation, nested comments are supported.
2014-06-12 10:47:03 +00:00
bors
fce98e5262 auto merge of #14799 : mcreinhard/rust/tilde-fix, r=alexcrichton
Replaced `~Drawable` with `Box<Drawable>` in tutorial
2014-06-11 22:02:00 -07:00
bors
f03863ae7d auto merge of #14713 : darnuria/rust/Improve_std_os_documentation_#2, r=alexcrichton
Improving documentation, consistency, removes evils empty lines etc...
2014-06-11 19:06:58 -07:00
Axel Viala
6dc06249d7 Improve docs and refactore std::os. 2014-06-12 02:17:52 +02:00
Alex Crichton
cac7a2053a std: Remove i18n/l10n from format!
* The select/plural methods from format strings are removed
* The # character no longer needs to be escaped
* The \-based escapes have been removed
* '{{' is now an escape for '{'
* '}}' is now an escape for '}'

Closes #14810
[breaking-change]
2014-06-11 16:04:24 -07:00
Alex Crichton
3316b1eb7c rustc: Remove ~[T] from the language
The following features have been removed

* box [a, b, c]
* ~[a, b, c]
* box [a, ..N]
* ~[a, ..N]
* ~[T] (as a type)
* deprecated_owned_vector lint

All users of ~[T] should move to using Vec<T> instead.
2014-06-11 15:02:17 -07:00
Patrick Walton
c23748c59c librustc: Forbid identifiers that shadow in the same pattern in let
bindings and function arguments.

Issue #14581.

To fix code that this breaks, give the pattern identifiers different names.

[breaking-change]
2014-06-11 13:23:04 -07:00
bors
f9260d41d6 auto merge of #14746 : alexcrichton/rust/libsync, r=brson
This commit is the final step in the libstd facade, #13851. The purpose of this
commit is to move libsync underneath the standard library, behind the facade.
This will allow core primitives like channels, queues, and atomics to all live
in the same location.

There were a few notable changes and a few breaking changes as part of this
movement:

* The `Vec` and `String` types are reexported at the top level of libcollections
* The `unreachable!()` macro was copied to libcore
* The `std::rt::thread` module was moved to librustrt, but it is still
  reexported at the same location.
* The `std::comm` module was moved to libsync
* The `sync::comm` module was moved under `sync::comm`, and renamed to `duplex`.
  It is now a private module with types/functions being reexported under
  `sync::comm`. This is a breaking change for any existing users of duplex
  streams.
* All concurrent queues/deques were moved directly under libsync. They are also
  all marked with #![experimental] for now if they are public.
* The `task_pool` and `future` modules no longer live in libsync, but rather
  live under `std::sync`. They will forever live at this location, but they may
  move to libsync if the `std::task` module moves as well.

[breaking-change]
2014-06-11 11:47:04 -07:00
bors
f0f9095f1d auto merge of #14250 : alexcrichton/rust/gc, r=brson
This commit removes `@T` from the compiler by moving the AST to using `Gc<T>`. This also starts treating `Gc<T>` as `@T` in the same way that `Box<T>` is the same as `~T` in the compiler.

After this hits a snapshot, the `@T` syntax should be able to be removed completely.
2014-06-11 10:02:04 -07:00
Alex Crichton
b1c9ce9c6f sync: Move underneath libstd
This commit is the final step in the libstd facade, #13851. The purpose of this
commit is to move libsync underneath the standard library, behind the facade.
This will allow core primitives like channels, queues, and atomics to all live
in the same location.

There were a few notable changes and a few breaking changes as part of this
movement:

* The `Vec` and `String` types are reexported at the top level of libcollections
* The `unreachable!()` macro was copied to libcore
* The `std::rt::thread` module was moved to librustrt, but it is still
  reexported at the same location.
* The `std::comm` module was moved to libsync
* The `sync::comm` module was moved under `sync::comm`, and renamed to `duplex`.
  It is now a private module with types/functions being reexported under
  `sync::comm`. This is a breaking change for any existing users of duplex
  streams.
* All concurrent queues/deques were moved directly under libsync. They are also
  all marked with #![experimental] for now if they are public.
* The `task_pool` and `future` modules no longer live in libsync, but rather
  live under `std::sync`. They will forever live at this location, but they may
  move to libsync if the `std::task` module moves as well.

[breaking-change]
2014-06-11 10:00:43 -07:00
Alex Crichton
54c2a1e1ce rustc: Move the AST from @T to Gc<T> 2014-06-11 09:51:37 -07:00
Alex Crichton
53ad426e92 syntax: Move the AST from @T to Gc<T> 2014-06-11 09:11:40 -07:00
Alex Crichton
531ed3d599 rustc: Update how Gc<T> is recognized
This commit uses the same trick as ~/Box to map Gc<T> to @T internally inside
the compiler. This moves a number of implementations of traits to the `gc`
module in the standard library.

This removes functions such as `Gc::new`, `Gc::borrow`, and `Gc::ptr_eq` in
favor of the more modern equivalents, `box(GC)`, `Deref`, and pointer equality.

The Gc pointer itself should be much more useful now, and subsequent commits
will move the compiler away from @T towards Gc<T>

[breaking-change]
2014-06-11 09:11:40 -07:00
bors
c54ce27b39 auto merge of #14789 : aochagavia/rust/prelude, r=alexcrichton 2014-06-11 07:42:07 -07:00
bors
ea41101b35 auto merge of #14788 : Sawyer47/rust/issue-13214, r=huonw
Closes #13214
2014-06-11 06:02:10 -07:00
Tom Jakubowski
e5baf1d94a emacs: highlight #[foo = "bar"] attributes
Setting `OVERRIDE` to `t` overrides the conflicting highlight Emacs
places on string literals.

Fix #14347
2014-06-11 05:06:51 -07:00
Tom Jakubowski
fca57b3aee emacs: do not highlight #foo] as an attribute
part of #14347
2014-06-11 05:01:16 -07:00
bors
db9e0a1142 auto merge of #14787 : alexcrichton/rust/issue-14784, r=pcwalton
This is another case of #13246. The RAII lock wasn't being destroyed until after
the allocation was free'd due to destructor scheduling.

Closes #14784
2014-06-11 04:22:02 -07:00
bors
4fdc27e55e auto merge of #14786 : pcwalton/rust/enum-to-float-casts, r=alexcrichton
If this breaks your code, take a deep breath, go for a walk, and
consider why you're relying on the sign extension semantics of
enum-to-float casts.

[breaking-change]

Closes #8230.
2014-06-10 23:37:06 -07:00
theptrk
f3020c3f1f Fix unclear wording of comment 2014-06-10 20:29:09 -07:00
fort
a8f581fad1 Show impl for Ref & RefMut 2014-06-10 19:24:48 -07:00
bors
f92a8facf9 auto merge of #14768 : riccieri/rust/detransmute-arena, r=alexcrichton
**Update**

I've reimplemented this using `Cell` and `RefCell`, as suggested by @alexcrichton. By taking care with the duration of the borrows, I was able to maintain the recursive allocation feature (now covered by a test) without the use of `Unsafe`, and without breaking the non-aliasing `&mut` invariant.

**Original**

Changes both `Arena` and `TypedArena` to contain an inner struct wrapped in a `Unsafe`, and change field access to go through those instead of transmuting `&self` to `&mut self`.

Part of #13933
2014-06-10 18:07:07 -07:00
Corey Richardson
8472849529 sync: Once is no longer unsafe, update docs 2014-06-10 17:55:04 -07:00
Zach Pomerantz
4f90025b68 Update description to reflect language changes
Previously, the type system's restrictions on borrowing were summarized as

> The previous example showed that the type system forbids any borrowing of owned boxes found in aliasable, mutable memory

This did not jive with the example, which allowed mutations so long as the borrowed reference had been returned. Also, the language has changed to no longer allow aliasable mutable locations. This changes the summary to read

> The previous example showed that the type system forbids mutations of owned boxed values while they are being borrowed. In general, the type system also forbids borrowing a value as mutable if it is already being borrowed - either as a mutable reference or an immutable one.

This adds more general information for the experienced reader as well, to offer a more complete understanding.
2014-06-10 17:36:02 -07:00
Zach Pomerantz
782c52a924 Removed doubled wording.
The guide previously stated:

> The compiler will automatically convert a box box point to a reference like &amp;point.

This fixes the doubled word `box`, so the statement reads

> The compiler will automatically convert a box point to a reference like &amp;point.

The code it is referring to is `compute_distance(&on_the_stack, on_the_heap);`, so a single `box` is appropriate.
2014-06-10 16:53:04 -07:00
Jonathan Reem
e5ebdb4c07 Remove outdated info about nested block comments. Fixes #14767 2014-06-10 15:58:54 -07:00
bors
b1302f9c4f auto merge of #14764 : jbcrail/rust/fix-more-comments, r=alexcrichton 2014-06-10 15:17:01 -07:00
Michael Reinhard
a0eca23786 Fix deprecated use of ~ 2014-06-10 14:44:27 -07:00
bors
7f777a5ba4 auto merge of #14752 : jakub-/rust/issue-11940, r=alexcrichton
Fixes #8315
Fixes #11940
2014-06-10 13:17:10 -07:00
bors
9bb8f88d3a auto merge of #14696 : jakub-/rust/dead-struct-fields, r=alexcrichton
This uncovered some dead code, most notably in middle/liveness.rs, which I think suggests there must be something fishy with that part of the code.

The #[allow(dead_code)] annotations on some of the fields I am not super happy about but as I understand, marker type may disappear at some point.
2014-06-10 09:49:29 -07:00
Joseph Crail
c2c9946372 Fix more misspelled comments and strings. 2014-06-10 11:24:17 -04:00
Adolfo Ochagavía
02866e6fe2 Pub use CheckedDiv in the prelude 2014-06-10 10:01:49 +02:00
Piotr Jawniak
9bead9b3f1 Add test for issue #13214
Closes #13214
2014-06-10 09:26:49 +02:00
bors
0ee6a8e8a5 auto merge of #14606 : pcwalton/rust/fn-trait-sugar, r=alexcrichton
r? @alexcrichton
2014-06-09 23:41:53 -07:00
bors
5bc2d03955 auto merge of #14783 : alexcrichton/rust/rollup, r=alexcrichton
Closes #14611 (std: Remove the as_utf16_p functions)
Closes #14694 (Num cleanup)
Closes #14760 (Add --color to test binary options)
Closes #14763 (std: Move dynamic_lib from std::unstable to std)
Closes #14766 (Add test for issue #13446)
Closes #14769 (collections: Add missing Default impls)
Closes #14773 (General nits)
Closes #14776 (rustdoc: Correctly classify enums/typedefs)
2014-06-09 21:57:09 -07:00
Alex Crichton
5ede96c2fd Test fixes from rollup 2014-06-09 21:52:37 -07:00
Alex Crichton
4fecc503ee rustrt: Fix invalid reads caught by valgrind
This is another case of #13246. The RAII lock wasn't being destroyed until after
the allocation was free'd due to destructor scheduling.

Closes #14784
2014-06-09 20:57:55 -07:00
Patrick Walton
1a381fa2d2 librustc: Use *signed* extension when converting enums to floats.
Previously, constants used unsigned extension, while non-constants used
signed extension. This unifies both paths to use signed extension.

If this breaks your code, take a deep breath, go for a walk, and
consider why you're relying on the sign extension semantics of
enum-to-float casts.

Closes #8230.

[breaking-change]
2014-06-09 20:55:38 -07:00
Renato Zannon
47b72e388d Remove & -> &mut transmute from TypedArena 2014-06-10 00:41:44 -03:00
Renato Zannon
a535cfb1f0 Remove & -> &mut transmute from Arena 2014-06-10 00:29:42 -03:00
Patrick Walton
f02b6f3a8b librustc: Implement sugar for the FnMut trait 2014-06-09 20:19:07 -07:00
Renato Zannon
e0855bccd3 Add a test for nested Arena.alloc 2014-06-09 23:54:52 -03:00
bors
5bf5cc605f auto merge of #14694 : aochagavia/rust/num-cleanup, r=alexcrichton 2014-06-09 19:52:08 -07:00
Alex Crichton
24cbe38423 rustdoc: Correctly classify enums/typedefs
Both of these items are surfaced as a DefTy, so some extra logic was needed in
the decoder module to figure out whether one is actually an enum or whether it's
a typedef.

Closes #14757
2014-06-09 17:46:53 -07:00
Huon Wilson
14668f2791 std: adjust the TCP io doc example to work reliably.
Fixes #11576 by making the code never run (and hence never
pass when the test was marked `should_fail`).
2014-06-09 17:46:53 -07:00
Huon Wilson
05810604c8 native: add more info to the native unimplemented error.
This refers to green, which (AFAICT) has everything implemented. In
particular, this will help guide people to get working signal handling
via libgreen.
2014-06-09 17:46:53 -07:00
Tom Jakubowski
d6a39419db collections: Add missing Default impls
Add Default impls for TreeMap, TreeSet, SmallIntMap, BitvSet, DList,
PriorityQueue, RingBuf, TrieMap, and TrieSet.
2014-06-09 17:46:53 -07:00
Piotr Jawniak
810ddfd611 Add test for issue #13446
Closes #13446
2014-06-09 17:46:53 -07:00
Brian Anderson
1635ef2a19 std: Move dynamic_lib from std::unstable to std
This leaves a deprecated reexport in place temporarily.

Closes #1457.
2014-06-09 17:46:53 -07:00
Steven Fackler
5eb4d19dc3 Add a --color flag to test binaries
It uses the same behavior as rustc's.
2014-06-09 17:46:27 -07:00
Adolfo Ochagavía
9faf5a3483 Cleanup bigint 2014-06-09 17:46:27 -07:00
Adolfo Ochagavía
1e931918c8 Moved integer trait and functions to submodule 2014-06-09 17:46:27 -07:00
Alex Crichton
d42cc130f9 std: Remove the as_utf16_p functions
These functions are all much better expressed via RAII using the to_utf16()
method on strings. This refactoring also takes this opportunity to properly
handle when filenames aren't valid unicode when passed through to the windows
I/O layer by properly returning I/O errors.

All previous users of the `as_utf16_p` or `as_utf16_mut_p` functions will need
to convert their code to using `foo.to_utf16().append_one(0)` to get a
null-terminated utf16 string.

[breaking-change]
2014-06-09 17:46:27 -07:00
bors
907d961876 auto merge of #14590 : pcwalton/rust/overloaded-call, r=nick29581
gate.

This is part of unboxed closures.

r? @nick29581
2014-06-09 17:37:08 -07:00
bors
0ea7aa30cc auto merge of #14554 : kmcallister/rust/plugin_registrar, r=cmr
This implements the design in rust-lang/rfcs#86.  It shouldn't be merged until that RFC is accepted, but it would be great if somebody has time to review the code before then.
2014-06-09 15:52:07 -07:00
Keegan McAllister
d43a948bb1 Document rustc::plugin 2014-06-09 14:29:30 -07:00
Keegan McAllister
7c674aceeb Add a test for deprecated phase(syntax) 2014-06-09 14:29:30 -07:00
Keegan McAllister
5084de3aaf Convert tests to use #[plugin_registrar] 2014-06-09 14:29:30 -07:00
Keegan McAllister
aca0bac29f Convert libraries to use #[plugin_registrar] 2014-06-09 14:29:30 -07:00
Keegan McAllister
ed41b71fbe Use phase(plugin) in tests 2014-06-09 14:29:30 -07:00
Keegan McAllister
84243ed6e1 Use phase(plugin) in other crates 2014-06-09 14:29:30 -07:00
Keegan McAllister
ffb2f12ed8 Use phase(plugin) in bootstrap crates
Do this to avoid warnings on post-stage0 builds.
2014-06-09 14:29:30 -07:00
Keegan McAllister
6d15c6749c Implement #[plugin_registrar]
See RFC 22.

[breaking-change]
2014-06-09 14:29:29 -07:00
Jakub Wieczorek
8e34f647ee Add missing repr(C) annotations to mutex.rs 2014-06-09 22:14:51 +02:00
Alex Crichton
a7872b3c1e std: Read HOME instead of USER
Apparently one of the linux bots doesn't have the USER variable defined, and
this fix will likely land more quickly than a fix to the bots.
2014-06-09 12:44:45 -07:00
Patrick Walton
966c7346ca librustc: Implement overloading for the call operator behind a feature
gate.

This is part of unboxed closures.
2014-06-09 12:39:17 -07:00
Adolfo Ochagavía
0eb858b4c9 Cleanup bigint 2014-06-09 16:36:56 +02:00
Adolfo Ochagavía
3ca00ec0db Moved integer trait and functions to submodule 2014-06-09 16:36:40 +02:00
bors
e55f64f997 auto merge of #14709 : alexcrichton/rust/collections, r=brson
This is mostly just a cosmetic change, continuing the work from #14333.
2014-06-09 01:11:58 -07:00
Alex Crichton
da0703973a core: Move the collections traits to libcollections
This commit moves Mutable, Map, MutableMap, Set, and MutableSet from
`core::collections` to the `collections` crate at the top-level. Additionally,
this removes the `deque` module and moves the `Deque` trait to only being
available at the top-level of the collections crate.

All functionality continues to be reexported through `std::collections`.

[breaking-change]
2014-06-09 00:38:46 -07:00
bors
a6a9e09f98 auto merge of #14740 : P1start/rust/name-warnings, r=alexcrichton
This updates identifier warnings such as ``struct `foo_bar` should have a
camel case identifier`` to provide an example.

Closes #14738.
2014-06-08 23:26:57 -07:00
Brian Anderson
50942c7695 core: Rename container mod to collections. Closes #12543
Also renames the `Container` trait to `Collection`.

[breaking-change]
2014-06-08 21:29:57 -07:00
bors
61d65cd56e auto merge of #14765 : rapha/rust/master, r=alexcrichton 2014-06-08 21:26:59 -07:00
Raphael Speyer
1638c4b749 Converted PortReader and ChanWriter to use Vec. 2014-06-09 14:18:11 +10:00
bors
443a1cdf94 auto merge of #14756 : TeXitoi/rust/relicense-shootout-fannkuch-redux, r=brson
Part of #14248

Main contributors are @pcwalton, @alexcrichton and me.  Only
@dguenther appear in git blame as a minor contribution, but it is
only adding the rust license, so removed by this relicensing.

@brson OK?
2014-06-08 14:56:52 -07:00
Guillaume Pinot
b13e275852 relicense shootout-fannkuch-redux.rs
Part of #14248

Main contributors are @pcwalton, @alexcrichton and me.  Only
@dguenther appear in git blame as a minor contribution, but it is
only adding the rust license, so removed by this relicensing.
2014-06-08 22:25:49 +02:00
Jakub Wieczorek
135625df96 Mark relevant structs with repr(C) 2014-06-08 22:20:17 +02:00
bors
e688d0e846 auto merge of #14751 : jbcrail/rust/fix-comments, r=alexcrichton 2014-06-08 12:51:51 -07:00
Jakub Wieczorek
f8b4e821ea Remove a redundant bitcast from fail!() handling 2014-06-08 20:01:38 +02:00
Jakub Wieczorek
a2bbcb594f Fix an LLVM assertion when matching against static strings
Fixes #8315
Fixes #11940
2014-06-08 19:43:38 +02:00
Joseph Crail
45e56eccbe Fix spelling errors in comments. 2014-06-08 13:39:42 -04:00
Steven Fackler
89c76bb142 Implement Hash for Bitv and BitvSet
Closes #14744
2014-06-08 10:29:55 -07:00
bors
17ba0cf428 auto merge of #14745 : huonw/rust/timer-doc, r=alexcrichton
std::io: expand the oneshot/periodic docs.

Examples!

Fixes #14714.
2014-06-08 06:01:49 -07:00
Jakub Wieczorek
f7d86b2f4a Remove the dead code identified by the new lint 2014-06-08 13:36:28 +02:00
Jakub Wieczorek
0271224bda Add detection of dead struct fields 2014-06-08 13:30:04 +02:00
bors
9239bb4960 auto merge of #14741 : sfackler/rust/visit-attr, r=alexcrichton
The lint was missing a *lot* of cases previously.
2014-06-08 04:16:53 -07:00
bors
010d96ede9 auto merge of #14728 : TeXitoi/rust/relicense-shootout-regex-dna, r=brson
Part of #14248

The authors are @pcwalton and @BurntSushi, and we have their agreement.

@brson OK?
2014-06-08 02:31:53 -07:00
Huon Wilson
e8d180df46 std::io: expand the oneshot/periodic docs.
Examples!

Fixes #14714.
2014-06-08 18:32:15 +10:00
bors
7580ef902e auto merge of #14743 : Sawyer47/rust/range-msg, r=huonw
Range allows char and numeric types, but previous error message
mentioned only numeric types.
2014-06-08 00:46:57 -07:00
Steven Fackler
9452cd24fb Remove unused name_str_pair method 2014-06-08 00:21:35 -07:00
Steven Fackler
862cd65dca Add back hint for crate level attributes 2014-06-08 00:21:15 -07:00
Piotr Jawniak
90339ef189 Improve error message for range in match
Range allows char and numeric types, but previous error message
mentioned only numeric types.
2014-06-08 08:57:33 +02:00
Steven Fackler
42a18bd985 Remove the attribute_usage lint
It has been superseded by the unused_attribute lint.

[breaking change]
2014-06-07 23:46:32 -07:00
Steven Fackler
3654ac68be Add visit_attribute to Visitor, use it for unused_attribute
The lint was missing a *lot* of cases previously.
2014-06-07 23:21:33 -07:00
P1start
c1c76590cb update identifier naming warnings to give an example
This updates identifier warnings such as ``struct `foo_bar` should have a
camel case identifier`` to provide an example.

Closes #14738.
2014-06-08 17:56:09 +12:00
bors
bbd448a27c auto merge of #14733 : sfackler/rust/partial-eq-nan-docs, r=alexcrichton
It is in fact the case that `NaN != NaN`. The true relations for
compareQuietNotEqual are LT, GT *and* UN.

I also rephrased the docs for PartialOrd since floats are not the only
types which are not totally ordered.
2014-06-07 18:01:46 -07:00
Steven Fackler
6b3d3803eb Clarify restrictions on ne
I can't think of any sane cases where this restriction would not hold,
and the standard library seems to assume it pretty much everywhere.
2014-06-07 17:52:48 -07:00
Steven Fackler
92221aba7b Fix PartialEq documentation with regards to floats
It is in fact the case that `NaN != NaN`. The true relations for
compareQuietNotEqual are LT, GT *and* UN.

I also rephrased the docs for PartialOrd since floats are not the only
types which are not totally ordered.
2014-06-07 17:48:54 -07:00
bors
fa1832800a auto merge of #14725 : aochagavia/rust/show, r=alexcrichton 2014-06-07 15:31:44 -07:00
bors
01eb0ce122 auto merge of #14722 : hannobraun/rust/quote-args, r=alexcrichton
The need for this came up while I worked on a procedural macro that parses an argument and adds the same argument to a generated function.
2014-06-07 13:46:42 -07:00
bors
ddd09df137 auto merge of #14730 : alexcrichton/rust/issue-14723, r=cmr
Closes #14723
2014-06-07 12:01:41 -07:00
Alex Crichton
3688c1d0ca rustdoc: More selectively remove execute links
Closes #14723
2014-06-07 10:53:22 -07:00
Adolfo Ochagavía
9731c28e11 Implement Show for SmallIntMap 2014-06-07 19:44:45 +02:00
Guillaume Pinot
fe7fc4aeb2 relicense shootout-regex-dna.rs
Part of #14248

The authors are @pcwalton and @BurntSushi, and we have their agreement.
2014-06-07 19:34:29 +02:00
bors
ffdb881337 auto merge of #14717 : zwarich/rust/borrowck-tests, r=cmr
After sitting down to build on the work merged in #14318, I realized that some of the test names were not clear, others probably weren't testing the right thing, and they were also not as exhaustive as they could have been.
2014-06-07 10:17:38 -07:00
Hanno Braun
cc28ae5201 Implement ToSource and ToToken for ast::Arg
This makes ast::Arg usable in the quote_ macros.

Please note that this commit doesn't include a regression test. There
are tests that use the quote macros, but all of them are ignored. Due to
that, there is no obvious (to me) way to test this.

Since this change is absolutely trivial and only hooks up an additional
type to existing infrastructure (which presumably is tested elsewhere),
I concluded it's not worth the effort to follow up on this.
2014-06-07 13:46:41 +00:00
Adolfo Ochagavía
f1bff592b1 Implement Show for DList 2014-06-07 15:01:44 +02:00
Cameron Zwarich
4666792ac6 Clean up borrows in borrowck field-sensitivity tests
Instead of calling a borrow() function that takes a pointer type, just
create a local pointer and dereference it. The dereference is there to
outsmart any future liveness analysis in borrowck.
2014-06-07 03:03:03 -07:00
Cameron Zwarich
653f57af20 Fix bad borrowck tests and move them from run-pass to compile-fail
The move_after_borrow / fu_move_after_borrow tests in
run-pass/borrowck-field-sensitivity.rs are not testing the right thing,
since the scope of the borrow is limited to the call to borrow(). When
fixed, these tests fail and thus should be moved to the corresponding
compile-fail test file.
2014-06-07 03:03:03 -07:00
Cameron Zwarich
61c81bf00c Add more borrowck tests for functional update moves
Add more borrowck field-sensitivity tests for functional update moves.
This makes the collection of test functions more combinatorially
exhaustive.
2014-06-07 02:31:01 -07:00