]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #14976 : luqmana/rust/focwtc, r=pcwalton
bors [Tue, 17 Jun 2014 18:56:35 +0000 (18:56 +0000)]
auto merge of #14976 : luqmana/rust/focwtc, r=pcwalton

Fixes #14959.

10 years agolibrustc: Check regions for overloaded calls.
Luqman Aden [Tue, 17 Jun 2014 18:14:06 +0000 (14:14 -0400)]
librustc: Check regions for overloaded calls.

10 years agoauto merge of #14957 : alexcrichton/rust/rustdoc-fixups, r=huonw
bors [Tue, 17 Jun 2014 16:26:33 +0000 (16:26 +0000)]
auto merge of #14957 : alexcrichton/rust/rustdoc-fixups, r=huonw

Fixing some of rustdoc's rendering to use newer syntaxes rather than older
syntaxes.

10 years agorustdoc: Remove outdated syntax
Alex Crichton [Tue, 17 Jun 2014 05:14:21 +0000 (22:14 -0700)]
rustdoc: Remove outdated syntax

Fixing some of rustdoc's rendering to use newer syntaxes rather than older
syntaxes.

10 years agoauto merge of #14970 : nkoep/rust/patch-1, r=huonw
bors [Tue, 17 Jun 2014 13:36:35 +0000 (13:36 +0000)]
auto merge of #14970 : nkoep/rust/patch-1, r=huonw

Compiling a crate with `rustc --crate-type=lib` produces an rlib file, not a shared object. The latter is only produced for `--crate-type=dylib`.

10 years agotutorial.md: tiny correction for --crate-type=lib
Niklas Koep [Tue, 17 Jun 2014 13:28:59 +0000 (15:28 +0200)]
tutorial.md: tiny correction for --crate-type=lib

Compiling a crate with `rustc --crate-type=lib` produces an rlib file, not a shared object. The latter is only produced for `--crate-type=dylib`.

10 years agoauto merge of #14818 : tomjakubowski/rust/emacs-attributes-key-value, r=pnkfelix
bors [Tue, 17 Jun 2014 08:16:27 +0000 (08:16 +0000)]
auto merge of #14818 : tomjakubowski/rust/emacs-attributes-key-value, r=pnkfelix

This addresses two problems noted in #14347: the highlight of `#foo]` as an attribute, and the non-highlight of `#[foo = "bar"]`.

10 years agoauto merge of #14945 : alexcrichton/rust/issue-14940, r=brson
bors [Tue, 17 Jun 2014 06:31:28 +0000 (06:31 +0000)]
auto merge of #14945 : alexcrichton/rust/issue-14940, r=brson

This just takes a similar approach to reading stdin on windows by artificially
limiting the size of the buffers going in and out.

Closes #14940

10 years agostd: Chunk writing to stdout on windows
Alex Crichton [Mon, 16 Jun 2014 22:11:13 +0000 (15:11 -0700)]
std: Chunk writing to stdout on windows

This just takes a similar approach to reading stdin on windows by artificially
limiting the size of the buffers going in and out.

Closes #14940

10 years agoauto merge of #14947 : zwarich/rust/check-loans-not-restrictions, r=nikomatsakis
bors [Tue, 17 Jun 2014 04:46:26 +0000 (04:46 +0000)]
auto merge of #14947 : zwarich/rust/check-loans-not-restrictions, r=nikomatsakis

Now that features like `const` are gone, we can remove the concept of restrictions from borrowck and just track loans and their restricted paths.

10 years agoauto merge of #14955 : alexcrichton/rust/rollup, r=alexcrichton
bors [Tue, 17 Jun 2014 02:51:53 +0000 (02:51 +0000)]
auto merge of #14955 : alexcrichton/rust/rollup, r=alexcrichton

10 years agoTest fixes from rollup
Alex Crichton [Tue, 17 Jun 2014 01:45:13 +0000 (18:45 -0700)]
Test fixes from rollup

Closes #14888 (Allow disabling jemalloc as the memory allocator)
Closes #14905 (rustc: Improve span for error about using a method as a field.)
Closes #14920 (Fix #14915)
Closes #14924 (Add a Syntastic plugin for Rust.)
Closes #14935 (debuginfo: Correctly handle indirectly recursive types)
Closes #14938 (Reexport `num_cpus` in `std::os`. Closes #14707)
Closes #14941 (std: Don't fail the task when a Future is dropped)
Closes #14942 (rustc: Don't mark type parameters as exported)
Closes #14943 (doc: Fix a link in the FAQ)
Closes #14944 (Update "use" to "uses" on ln186)
Closes #14949 (Update repo location)
Closes #14950 (fix typo in the libc crate)
Closes #14951 (Update Sublime Rust github link)
Closes #14953 (Fix --disable-rpath and tests)

10 years agoFix --disable-rpath and tests
Alex Crichton [Wed, 11 Jun 2014 21:52:38 +0000 (14:52 -0700)]
Fix --disable-rpath and tests

This involved a few changes to the local build system:

* Makefiles now prefer our own LD_LIBRARY_PATH over the user's LD_LIBRARY_PATH
  in order to support building rust with rust already installed.
* The compiletest program was taught to correctly pass through the aux dir as a
  component of LD_LIBRARY_PATH in more situations.

This change was spliced out of #14832 to consist of just the fixes to running
tests without an rpath setting embedded in executables.

10 years agoUpdate Sublime Rust github link
Christopher Bergqvist [Mon, 16 Jun 2014 22:07:15 +0000 (00:07 +0200)]
Update Sublime Rust github link

Package switched maintainer from dbp to jhasse as stated in the README.md at the old link.

10 years agofix typo in the libc crate
Daniel Micay [Mon, 16 Jun 2014 23:24:17 +0000 (19:24 -0400)]
fix typo in the libc crate

10 years agoUpdate repo location
Brian Anderson [Mon, 16 Jun 2014 23:07:34 +0000 (16:07 -0700)]
Update repo location

10 years agoUpdate "use" to "uses" ln186
theptrk [Mon, 16 Jun 2014 21:04:54 +0000 (14:04 -0700)]
Update "use" to "uses" ln186

10 years agodoc: Fix a link in the FAQ
Alex Crichton [Mon, 16 Jun 2014 20:56:54 +0000 (13:56 -0700)]
doc: Fix a link in the FAQ

Closes #14914

10 years agorustc: Don't mark type parameters as exported
Alex Crichton [Mon, 16 Jun 2014 20:53:09 +0000 (13:53 -0700)]
rustc: Don't mark type parameters as exported

This ends up causing the privacy pass to get all confused, and there's nothing
inherently exported about them anyway.

Closes #14933

10 years agostd: Don't fail the task when a Future is dropped
Alex Crichton [Mon, 16 Jun 2014 20:24:31 +0000 (13:24 -0700)]
std: Don't fail the task when a Future is dropped

It's a benign failure that no one needs to know about.

Closes #14892

10 years agoMove `num_cpus` from `std::rt::util` to `std::os`. Closes #14707
Jorge Aparicio [Mon, 16 Jun 2014 20:36:07 +0000 (15:36 -0500)]
Move `num_cpus` from `std::rt::util` to `std::os`. Closes #14707

10 years agodebuginfo: Correctly handle indirectly recursive types.
Michael Woerister [Mon, 16 Jun 2014 12:28:05 +0000 (14:28 +0200)]
debuginfo: Correctly handle indirectly recursive types.

So far handling some indirectly recursive types, such as pointer types, has relied on LLVM metadata uniquing in a very implicit way. This could cause some inconsistencies in the debuginfo, and sometimes to hard to trace LLVM assertions.
With this commit unique type IDs and the TypeMap are used to explicitly make sure that no inconsistencies exist, and, if in the future some regression re-introduces one, give a better error message instead of the hard-to-interpret LLVM error.

10 years agoAdd a Syntastic plugin for Rust.
Andrew Gallant [Mon, 16 Jun 2014 17:07:49 +0000 (13:07 -0400)]
Add a Syntastic plugin for Rust.

10 years agoChange prints: @T -> Gc<T> , ~T -> Box<T>
John Schmidt [Sun, 15 Jun 2014 17:04:55 +0000 (10:04 -0700)]
Change prints: @T -> Gc<T> , ~T -> Box<T>

Fixes #14915

10 years agorustc: Improve span for error about using a method as a field.
Kevin Butler [Fri, 13 Jun 2014 21:56:42 +0000 (22:56 +0100)]
rustc: Improve span for error about using a method as a field.

libsyntax: ExprField now contains a SpannedIdent rather than Ident.

[breaking-change]

10 years agoalloc: Refactor OOM into a common routine
Alex Crichton [Sat, 14 Jun 2014 06:35:54 +0000 (23:35 -0700)]
alloc: Refactor OOM into a common routine

10 years agoalloc: Allow disabling jemalloc
Alex Crichton [Sat, 14 Jun 2014 06:23:31 +0000 (23:23 -0700)]
alloc: Allow disabling jemalloc

10 years agoalloc: Format heap.rs to 80-char max
Alex Crichton [Sat, 14 Jun 2014 06:22:58 +0000 (23:22 -0700)]
alloc: Format heap.rs to 80-char max

10 years agoauto merge of #14855 : TeXitoi/rust/relicense-shootout-binarytrees, r=brson
bors [Tue, 17 Jun 2014 01:01:55 +0000 (01:01 +0000)]
auto merge of #14855 : TeXitoi/rust/relicense-shootout-binarytrees, r=brson

Everyone agreed.

Related to #14248, close #14720

@brson OK?

10 years agoauto merge of #14852 : TeXitoi/rust/relicense-shootout-pidigits, r=brson
bors [Mon, 16 Jun 2014 23:11:46 +0000 (23:11 +0000)]
auto merge of #14852 : TeXitoi/rust/relicense-shootout-pidigits, r=brson

Everyone agreed.

Related to #14248, close #14718

@brson OK?

10 years agoRename check_for_assignment_to_restricted_or_frozen_location
Cameron Zwarich [Mon, 16 Jun 2014 22:40:21 +0000 (15:40 -0700)]
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.

10 years agoSwitch to each_in_scope_loan_affecting_path
Cameron Zwarich [Mon, 16 Jun 2014 22:40:21 +0000 (15:40 -0700)]
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.

10 years agoAlways check assigned loan paths to the top of the path
Cameron Zwarich [Mon, 16 Jun 2014 22:40:20 +0000 (15:40 -0700)]
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.

10 years agoRemove an unused return value
Cameron Zwarich [Mon, 16 Jun 2014 22:40:20 +0000 (15:40 -0700)]
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.

10 years agoCall mark_variable_as_used_mut even after assignment errors
Cameron Zwarich [Mon, 16 Jun 2014 22:40:20 +0000 (15:40 -0700)]
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.

10 years agoAdd a new each_in_scope_loan_affecting_path helper function
Cameron Zwarich [Mon, 16 Jun 2014 22:40:20 +0000 (15:40 -0700)]
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.

10 years agoRemove Restriction
Cameron Zwarich [Mon, 16 Jun 2014 22:40:20 +0000 (15:40 -0700)]
Remove Restriction

The Restriction struct now consists of a single Rc<LoanPath> field, so
it can be replaced with Rc<LoanPath>.

10 years agoRemove RestrictionSet
Cameron Zwarich [Mon, 16 Jun 2014 22:40:20 +0000 (15:40 -0700)]
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.

10 years agoRemove an unused bkcerr_code constructor parameter
Cameron Zwarich [Mon, 16 Jun 2014 22:40:20 +0000 (15:40 -0700)]
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.

10 years agoRemove the last actual usage of RestrictionSet
Cameron Zwarich [Mon, 16 Jun 2014 22:40:20 +0000 (15:40 -0700)]
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.

10 years agoMake a new compatible_borrow_kinds helper function
Cameron Zwarich [Mon, 16 Jun 2014 22:40:20 +0000 (15:40 -0700)]
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.

10 years agoRemove an unused closure parameter
Cameron Zwarich [Mon, 16 Jun 2014 22:40:20 +0000 (15:40 -0700)]
Remove an unused closure parameter

Remove the unused &Restriction parameter of each_in_scope_restriction's
op parameter.

10 years agoRemove a pointless check for intersection with RESTR_MUTATE
Cameron Zwarich [Mon, 16 Jun 2014 22:40:20 +0000 (15:40 -0700)]
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.

10 years agoRemove comments that no longer apply after the removal of `const`
Cameron Zwarich [Mon, 16 Jun 2014 22:40:20 +0000 (15:40 -0700)]
Remove comments that no longer apply after the removal of `const`

10 years agoauto merge of #14781 : alexcrichton/rust/issue-14724, r=brson
bors [Mon, 16 Jun 2014 20:36:41 +0000 (20:36 +0000)]
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]

10 years agoauto merge of #14551 : alexcrichton/rust/issue-14467, r=kballard
bors [Mon, 16 Jun 2014 18:46:45 +0000 (18:46 +0000)]
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

10 years agostd: Improve pipe() functionality
Alex Crichton [Mon, 9 Jun 2014 20:23:49 +0000 (13:23 -0700)]
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]

10 years agostd: Support consuming a Process without waiting
Alex Crichton [Sat, 31 May 2014 00:18:12 +0000 (17:18 -0700)]
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

10 years agoauto merge of #14877 : Seldaek/rust/commdocs, r=alexcrichton
bors [Mon, 16 Jun 2014 17:01:56 +0000 (17:01 +0000)]
auto merge of #14877 : Seldaek/rust/commdocs, r=alexcrichton

Finally what I promised to do in #13862 /cc @alexcrichton

10 years agoAdd examples of how to read from a channel with a timeout, refs #13862
Jordi Boggiano [Fri, 13 Jun 2014 22:49:01 +0000 (00:49 +0200)]
Add examples of how to read from a channel with a timeout, refs #13862

10 years agoauto merge of #14882 : pcwalton/rust/drop-underscore, r=nikomatsakis
bors [Mon, 16 Jun 2014 15:06:48 +0000 (15:06 +0000)]
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

10 years agoauto merge of #14932 : Sawyer47/rust/json-smallfix, r=huonw
bors [Mon, 16 Jun 2014 13:16:44 +0000 (13:16 +0000)]
auto merge of #14932 : Sawyer47/rust/json-smallfix, r=huonw

10 years agoauto merge of #14906 : P1start/rust/rustdoc-lifetimes, r=huonw
bors [Mon, 16 Jun 2014 11:31:56 +0000 (11:31 +0000)]
auto merge of #14906 : P1start/rust/rustdoc-lifetimes, r=huonw

rustdoc was previously formatting lifetimes with two apostrophes, presumably as a result of #14797.

10 years agoFix rustdoc's formatting of lifetimes
P1start [Sun, 15 Jun 2014 02:59:01 +0000 (14:59 +1200)]
Fix rustdoc's formatting of lifetimes

rustdoc was previously formatting lifetimes with two apostrophes, presumably
as a result of #14797.

10 years agoauto merge of #14900 : alexcrichton/rust/snapshots, r=huonw
bors [Mon, 16 Jun 2014 08:16:49 +0000 (08:16 +0000)]
auto merge of #14900 : alexcrichton/rust/snapshots, r=huonw

Closes #14898
Closes #14918

10 years agoauto merge of #14715 : vhbit/rust/ios-pr2, r=alexcrichton
bors [Mon, 16 Jun 2014 06:32:03 +0000 (06:32 +0000)]
auto merge of #14715 : vhbit/rust/ios-pr2, r=alexcrichton

10 years agoRegister new snapshots
Alex Crichton [Sat, 14 Jun 2014 18:03:34 +0000 (11:03 -0700)]
Register new snapshots

10 years agoPotential fix for Win32 build
Valerii Hiora [Mon, 16 Jun 2014 05:48:59 +0000 (08:48 +0300)]
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.

10 years agoSmall improvement for json PrettyEncoder
Piotr Jawniak [Sun, 15 Jun 2014 07:31:14 +0000 (09:31 +0200)]
Small improvement for json PrettyEncoder

10 years agoUpdated compiler-rt
Valerii Hiora [Sat, 14 Jun 2014 15:00:28 +0000 (18:00 +0300)]
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.

10 years agoauto merge of #14835 : alexcrichton/rust/no-more-at, r=brson
bors [Sat, 14 Jun 2014 17:51:49 +0000 (17:51 +0000)]
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).

10 years agorustc: Obsolete the `@` syntax entirely
Alex Crichton [Thu, 12 Jun 2014 02:33:52 +0000 (19:33 -0700)]
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]

10 years agoRegister new snapshots
Alex Crichton [Thu, 12 Jun 2014 01:47:09 +0000 (18:47 -0700)]
Register new snapshots

10 years agoauto merge of #14884 : huonw/rust/getoptsfail, r=alexcrichton
bors [Sat, 14 Jun 2014 10:36:46 +0000 (10:36 +0000)]
auto merge of #14884 : huonw/rust/getoptsfail, r=alexcrichton

10 years agoauto merge of #14874 : pcwalton/rust/enum-to-float-casts-part-deux, r=alexcrichton
bors [Sat, 14 Jun 2014 08:46:48 +0000 (08:46 +0000)]
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

10 years agoauto merge of #14739 : zwarich/rust/mut-unique-path, r=nikomatsakis
bors [Sat, 14 Jun 2014 06:36:49 +0000 (06:36 +0000)]
auto merge of #14739 : zwarich/rust/mut-unique-path, r=nikomatsakis

Implement the stronger guarantees for mutable borrows proposed in #12624.

10 years agoauto merge of #14878 : vtsatskin/rust/rustdoc-sidebar-click-targets, r=alexcrichton
bors [Sat, 14 Jun 2014 04:46:46 +0000 (04:46 +0000)]
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

10 years agoReorganize code in check_loans
Cameron Zwarich [Sat, 14 Jun 2014 03:48:10 +0000 (20:48 -0700)]
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.

10 years agoAdd new tests for uses of mutably borrowed paths
Cameron Zwarich [Sat, 14 Jun 2014 03:48:10 +0000 (20:48 -0700)]
Add new tests for uses of mutably borrowed paths

10 years agoEnforce stronger guarantees for mutable borrows
Cameron Zwarich [Sat, 14 Jun 2014 03:48:09 +0000 (20:48 -0700)]
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]

10 years agoFix all violations of stronger guarantees for mutable borrows
Cameron Zwarich [Sat, 14 Jun 2014 03:48:09 +0000 (20:48 -0700)]
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.

10 years agoRename analyze_move_out_from to analyze_restrictions_on_use
Cameron Zwarich [Sat, 14 Jun 2014 03:48:09 +0000 (20:48 -0700)]
Rename analyze_move_out_from to analyze_restrictions_on_use

Also rename MoveError to UseError and MoveOk / MoveWhileBorrowed to
UseOk / UseWhileBorrowed.

10 years agoMake analyze_move_out_from take a BorrowKind
Cameron Zwarich [Sat, 14 Jun 2014 03:48:09 +0000 (20:48 -0700)]
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.

10 years agoMake analyze_move_out_from more field-sensitive
Cameron Zwarich [Sat, 14 Jun 2014 03:48:09 +0000 (20:48 -0700)]
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.

10 years agoMake check_for_move_of_borrowed_path take an &LoanPath rather than an &Rc<LoanPath>
Cameron Zwarich [Sat, 14 Jun 2014 03:48:09 +0000 (20:48 -0700)]
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.

10 years agoMake analyze_move_out_from use a loop rather than recursion
Cameron Zwarich [Sat, 14 Jun 2014 03:48:09 +0000 (20:48 -0700)]
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.

10 years agogetopts: derive Eq for types.
Huon Wilson [Sat, 14 Jun 2014 01:20:47 +0000 (11:20 +1000)]
getopts: derive Eq for types.

10 years agoauto merge of #14866 : bjz/rust/bitwise, r=alexcrichton
bors [Sat, 14 Jun 2014 01:11:44 +0000 (01:11 +0000)]
auto merge of #14866 : bjz/rust/bitwise, r=alexcrichton

10 years agogetopts: format failure messages with `Show`.
Huon Wilson [Sat, 14 Jun 2014 01:11:09 +0000 (11:11 +1000)]
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]

10 years agolibrustc: Remove useless code to handle `let _ = ...`
Patrick Walton [Sat, 14 Jun 2014 00:57:36 +0000 (17:57 -0700)]
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.)

10 years agoauto merge of #14750 : bachm/rust/master, r=alexcrichton
bors [Fri, 13 Jun 2014 22:46:35 +0000 (22:46 +0000)]
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]`.

10 years agorustdoc: Larger click areas for sidebar items
Valentin Tsatskin [Fri, 13 Jun 2014 22:15:37 +0000 (15:15 -0700)]
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

10 years agoauto merge of #14867 : alexcrichton/rust/rollup, r=alexcrichton
bors [Fri, 13 Jun 2014 20:57:30 +0000 (20:57 +0000)]
auto merge of #14867 : alexcrichton/rust/rollup, r=alexcrichton

10 years agoRolling up PRs in the queue
Alex Crichton [Fri, 13 Jun 2014 04:34:32 +0000 (21:34 -0700)]
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!`)

10 years agosyntax: parse outer attributes in `quote_item!` calls.
Huon Wilson [Thu, 12 Jun 2014 23:40:10 +0000 (09:40 +1000)]
syntax: parse outer attributes in `quote_item!` calls.

Fixes #14857.

10 years agosyntax: fix quote_pat! & unignore a quotation test.
Huon Wilson [Thu, 12 Jun 2014 23:36:26 +0000 (09:36 +1000)]
syntax: fix quote_pat! & unignore a quotation test.

10 years agolibrustc: Forbid `transmute` from being called on types whose size is
Patrick Walton [Thu, 12 Jun 2014 21:08:44 +0000 (14:08 -0700)]
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]

10 years agolibrustc: Take in account mutability when casting array to raw ptr.
Luqman Aden [Thu, 12 Jun 2014 22:58:37 +0000 (18:58 -0400)]
librustc: Take in account mutability when casting array to raw ptr.

10 years agoremove unnecessary PaX detection
Daniel Micay [Thu, 12 Jun 2014 20:11:21 +0000 (16:11 -0400)]
remove unnecessary PaX detection

Rust no longer has support for JIT compilation, so it doesn't currently
require a PaX MPROTECT exception. The extended attributes are preferred
over modifying the binaries so it's not actually going to work on most
systems like this anyway.

If JIT compilation ends up being supported again, it should handle this
by *always* applying the exception via an extended attribute without
performing auto-detection of PaX on the host. The `paxctl` tool is only
necessary with the older method involving modifying the ELF binary.

10 years agoAudit usage of NativeMutex
Alex Crichton [Thu, 12 Jun 2014 18:40:13 +0000 (11:40 -0700)]
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.

10 years agorustc: [T, ..N] and [T, ..N+1] are not the same
Alex Crichton [Thu, 12 Jun 2014 17:27:44 +0000 (10:27 -0700)]
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.

10 years agoClarify `Any` docs
P1start [Thu, 12 Jun 2014 07:54:03 +0000 (19:54 +1200)]
Clarify `Any` docs

The `Any` docs previously did not state that only `'static` types implement it.

10 years agoFix the unused struct field lint for struct variants
Jakub Wieczorek [Thu, 12 Jun 2014 06:38:30 +0000 (08:38 +0200)]
Fix the unused struct field lint for struct variants

Fixes #14837.

10 years agoRemove typo on collections::treemap::UnionItems
Renato Riccieri Santos Zannon [Thu, 12 Jun 2014 06:36:46 +0000 (03:36 -0300)]
Remove typo on collections::treemap::UnionItems

The docstring stated it was a intersection iterator, when in fact it is the union iterator

10 years agoconfigure: Don't sync unused submodules
Alex Crichton [Thu, 12 Jun 2014 01:54:14 +0000 (18:54 -0700)]
configure: Don't sync unused submodules

If the compiler is built with --{llvm,jemalloc,libuv}-root, then the configure
script can skip updating these submodules.

Closes #14822

10 years agolibsyntax: Allow `+` to separate trait bounds from objects.
Patrick Walton [Wed, 11 Jun 2014 19:14:38 +0000 (12:14 -0700)]
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]

10 years agostd: Rebase better errors on master
Alex Crichton [Wed, 11 Jun 2014 17:24:04 +0000 (10:24 -0700)]
std: Rebase better errors on master

10 years agoImprove error messages for io::fs
Yehuda Katz [Tue, 3 Jun 2014 19:33:18 +0000 (12:33 -0700)]
Improve error messages for io::fs

10 years agolibrustc: Fix the issue with labels shadowing variable names by making
Patrick Walton [Tue, 10 Jun 2014 20:54:13 +0000 (13:54 -0700)]
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]

10 years agoauto merge of #14604 : nikomatsakis/rust/issue-5527-namespace-substs, r=pcwalton
bors [Fri, 13 Jun 2014 19:02:11 +0000 (19:02 +0000)]
auto merge of #14604 : nikomatsakis/rust/issue-5527-namespace-substs, r=pcwalton

The current setup is to have a single vector of type parameters in
scope at any one time. We then have to concatenate the parameters from
the impl/trait with those of the method. This makes a lot of things
awkward, most notably associated fns ("static fns"). This branch
restructures the substitutions into three distinct namespaces (type,
self, fn). This makes most of the "type parameter management"
trivial. This also sets us up to support UFCS (though I haven't made
any particular changes in that direction in this patch).

Along the way, this patch fixes a few miscellaneous bits of code cleanup:

1. Patch resolve to detect references to out-of-scope type parameters,
   rather than checking for "out of bound" indices during substitution
   (fixes #14603).

2. Move def out of libsyntax into librustc where it belongs. I should have
   moved DefId too, but didn't.

3. Permit homogeneous tuples like `(T, T, T)` to be used as fixed-length
   vectors like `[T, ..3]`. This is awfully handy, though public facing.
   I suppose it requires an RFC.

4. Add some missing tests.

cc #5527

r? @pcwalton or @pnkfelix