]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agorollup merge of #19310: steveklabnik/gh19178
Alex Crichton [Wed, 26 Nov 2014 17:44:57 +0000 (09:44 -0800)]
rollup merge of #19310: steveklabnik/gh19178

Fixes #19178

9 years agorollup merge of #19308: thestinger/oom
Alex Crichton [Wed, 26 Nov 2014 17:44:55 +0000 (09:44 -0800)]
rollup merge of #19308: thestinger/oom

Closes #19305

9 years agorollup merge of #19307: steveklabnik/gh19199
Alex Crichton [Wed, 26 Nov 2014 17:44:53 +0000 (09:44 -0800)]
rollup merge of #19307: steveklabnik/gh19199

Fixes #19199

9 years agorollup merge of #19304: steveklabnik/gh19302
Alex Crichton [Wed, 26 Nov 2014 17:44:51 +0000 (09:44 -0800)]
rollup merge of #19304: steveklabnik/gh19302

Fixes #19302.

Also made a minor cosmetic change to bring the example in line with style guidelines.

9 years agorollup merge of #19301: Gankro/take-fix
Alex Crichton [Wed, 26 Nov 2014 17:44:49 +0000 (09:44 -0800)]
rollup merge of #19301: Gankro/take-fix

Was taking the value out correctly, but then not doing anything to actually fix the table. derp.

9 years agorollup merge of #19300: killercup/patch-1
Alex Crichton [Wed, 26 Nov 2014 17:44:47 +0000 (09:44 -0800)]
rollup merge of #19300: killercup/patch-1

Just saw this when looking at #19297 and couldn't find an issue/PR dealing with this. #18773 seems to have missed this file.

Compiler output is generated [here](https://github.com/rust-lang/rust/blob/770378a313a573776b16237a46b75bafa49072c1/src/librustc_trans/driver/mod.rs#L466).

cc @steveklabnik

9 years agorollup merge of #19299: nikomatsakis/stop-indenting-test-output
Alex Crichton [Wed, 26 Nov 2014 17:44:45 +0000 (09:44 -0800)]
rollup merge of #19299: nikomatsakis/stop-indenting-test-output

This fixes a long-time irritant of mine. Inserting tabs causes M-x next-error to not work in emacs and seems to serve relatively little purpose in improving overall readability.

r? @brson

9 years agorollup merge of #19298: nikomatsakis/unboxed-closure-parse-the-plus
Alex Crichton [Wed, 26 Nov 2014 17:44:43 +0000 (09:44 -0800)]
rollup merge of #19298: nikomatsakis/unboxed-closure-parse-the-plus

Implements RFC 438.

Fixes #19092.

This is a [breaking-change]: change types like `&Foo+Send` or `&'a mut Foo+'a` to `&(Foo+Send)` and `&'a mut (Foo+'a)`, respectively.

r? @brson

9 years agorollup merge of #19296: csouth3/trieset-union
Alex Crichton [Wed, 26 Nov 2014 17:44:38 +0000 (09:44 -0800)]
rollup merge of #19296: csouth3/trieset-union

TrieSet doesn't yet have union, intersection, difference, and symmetric difference functions implemented.  Luckily, TrieSet is largely similar to TreeSet, so I was able to reference the implementations of these functions in the latter, and adapt them as necessary to make them work for TrieSet.

One thing that I thought was interesting is that the Iterator yielded by `iter()` for TrieSet iterates over the set's values directly rather than references to the values (whereas I think in most cases I see the Iterator given by `iter()` iterating over immutable references), so for consistency within TrieSet's interface, all of these Iterators also iterate over the values directly.  Let me know if all of these should be instead iterating over references.

9 years agorollup merge of #19288: steveklabnik/doc_style_cleanup
Alex Crichton [Wed, 26 Nov 2014 17:44:33 +0000 (09:44 -0800)]
rollup merge of #19288: steveklabnik/doc_style_cleanup

This is considered good convention.

This is about half of them in total, I just don't want an impossible to land patch. :smile:

9 years agorollup merge of #19287: alexcrichton/issue-19272
Alex Crichton [Wed, 26 Nov 2014 17:44:30 +0000 (09:44 -0800)]
rollup merge of #19287: alexcrichton/issue-19272

At the same time remove the `pub use` of the variants in favor of accessing
through the enum type itself. This is a breaking change as the `Found` and
`NotFound` variants must now be imported through `BinarySearchResult` instead of
just `std::slice`.

[breaking-change]
Closes #19271

9 years agorollup merge of #19282: steveklabnik/remove_grammar
Alex Crichton [Wed, 26 Nov 2014 17:44:27 +0000 (09:44 -0800)]
rollup merge of #19282: steveklabnik/remove_grammar

I stumbled across this today, and it's not really working. It's been around for a very, very long time, and seems to be based on stuff we don't even have anymore.

I asked in `#rust-internals`, and @cmr said we should just kill it, so here I am. :) I don't think that anything else uses Java, but maybe I missed something.

And if this _isn't_ what we want, I'm fine with closing too. Just some housekeeping.

9 years agorollup merge of #19273: ogham/rename-file-types
Alex Crichton [Wed, 26 Nov 2014 17:44:21 +0000 (09:44 -0800)]
rollup merge of #19273: ogham/rename-file-types

All of the enum components had a redundant 'Type' specifier: TypeSymlink, TypeDirectory, TypeFile. This change removes them, replacing them with a namespace: FileType::Symlink, FileType::Directory, and FileType::RegularFile.

RegularFile is used instead of just File, as File by itself could be mistakenly thought of as referring to the struct.

Part of #19253.

9 years agorollup merge of #19272: tomjakubowski/rustdoc-sized
Alex Crichton [Wed, 26 Nov 2014 17:44:18 +0000 (09:44 -0800)]
rollup merge of #19272: tomjakubowski/rustdoc-sized

Both `trait Foo for Sized?` and `<Sized? T>` are handled correctly.

Fix #18515

9 years agorollup merge of #19266: aochagavia/const
Alex Crichton [Wed, 26 Nov 2014 17:44:14 +0000 (09:44 -0800)]
rollup merge of #19266: aochagavia/const

With this PR, the following code works:

```
#![feature(tuple_indexing)]
struct MyStruct { field1: uint }

const S: MyStruct = MyStruct { field1: 42u };
const T: (uint,) = (42u,);

struct ConstCheck {
    array1: [int, ..S.field1],
    array2: [int, ..T.0],
}
```

Closes https://github.com/rust-lang/rust/issues/19244
Related https://github.com/rust-lang/rust/issues/19265

9 years agorollup merge of #19231: Gankro/ringbuf-into-iter
Alex Crichton [Wed, 26 Nov 2014 17:44:06 +0000 (09:44 -0800)]
rollup merge of #19231: Gankro/ringbuf-into-iter

r? @huonw @csherratt

9 years agorollup merge of #19224: frewsxcv/unprefix-json-types
Alex Crichton [Wed, 26 Nov 2014 17:44:03 +0000 (09:44 -0800)]
rollup merge of #19224: frewsxcv/unprefix-json-types

Addressing the issues brought up in [this thread](https://github.com/rust-lang/rust/pull/19114#discussion_r20614461)

This pull request:

* Unpublicizes reexports
* Renames type aliases:
 * `json::JsonArray` ☞ `json::Array`
 * `json::JsonObject` ☞ `json::Object`

9 years agoauto merge of #19115 : jakub-/rust/issue-19100, r=alexcrichton
bors [Wed, 26 Nov 2014 22:37:06 +0000 (22:37 +0000)]
auto merge of #19115 : jakub-/rust/issue-19100, r=alexcrichton

...of the type being matched.

This change will result in a better diagnostic for code like the following:

```rust
enum Enum {
    Foo,
    Bar
}

fn f(x: Enum) {
    match x {
        Foo => (),
        Bar => ()
    }
}
```

which would currently simply fail with an unreachable pattern error
on the 2nd arm.

The user is advised to either use a qualified path in the patterns
or import the variants explicitly into the scope.

9 years agoDo not print any warnings if '-A warnings' is specified on the command line
Jakub Bukaj [Mon, 24 Nov 2014 19:53:12 +0000 (14:53 -0500)]
Do not print any warnings if '-A warnings' is specified on the command line

9 years agoWarn on pattern bindings that have the same name as a variant
Jakub Bukaj [Thu, 20 Nov 2014 15:57:36 +0000 (16:57 +0100)]
Warn on pattern bindings that have the same name as a variant

...of the type being matched.

This change will result in a better diagnostic for code like the following:

```rust
enum Enum {
    Foo,
    Bar
}

fn f(x: Enum) {
    match x {
        Foo => (),
        Bar => ()
    }
}
```

which would currently simply fail with an unreachable pattern error
on the 2nd arm.

The user is advised to either use a qualified path in the patterns
or import the variants explicitly into the scope.

9 years agoauto merge of #19144 : michaelwoerister/rust/lldb-scripts, r=alexcrichton
bors [Wed, 26 Nov 2014 20:12:09 +0000 (20:12 +0000)]
auto merge of #19144 : michaelwoerister/rust/lldb-scripts, r=alexcrichton

This PR adds the `rust-lldb` script (feel free to bikeshed about the name).
The script will start LLDB and, before doing anything else, load [LLDB type summaries](http://lldb.llvm.org/varformats.html) that will make LLDB print values with Rust syntax. Just use the script like you would normally use LLDB:

```
rust-lldb executable-to-debug --and-any-other-commandline --args
```
The script will just add one additional commandline argument to the LLDB invocation and pass along the rest of the arguments to LLDB after that.

Given the following program...
```rust
fn main() {
let x = Some(1u);
let y = [0, 1, 2i];
let z = (x, y);

println!("{} {} {}", x, y, z);
}
```
...*without* the 'LLDB type summaries', values will be printed something like this...
```
(lldb) p x
(core::option::Option<uint>) $3 = {
   = (RUST$ENUM$DISR = Some)
   = (RUST$ENUM$DISR = Some, 1)
}
(lldb) p y
(long [3]) $4 = ([0] = 0, [1] = 1, [2] = 2)
(lldb) p z
((core::option::Option<uint>, [int, ..3])) $5 = {
   = {
     = (RUST$ENUM$DISR = Some)
     = (RUST$ENUM$DISR = Some, 1)
  }
   = ([0] = 0, [1] = 1, [2] = 2)
}
```
...*with* the 'LLDB type summaries', values will be printed like this:
```
(lldb) p x
(core::option::Option<uint>) $0 = Some(1)
(lldb) p y
(long [3]) $1 = [0, 1, 2]
(lldb) p z
((core::option::Option<uint>, [int, ..3])) $2 = (Some(1), [0, 1, 2])
```

The 'LLDB type summaries' used by the script have been in use for a while in the LLDB autotests but I still consider them to be of alpha-version quality. If you see anything weird when you use them, feel free to file an issue.

The script will use whatever Rust "installation" is in PATH, so whichever `rustc` will be called if you type `rustc` into the console, this is the one that the script will ask for the LLDB extension module location. The build system will take care of putting the script and LLDB python module in the right places, whether you want to use the stage1 or stage2 compiler or the one coming with `make install` / `rustup.sh`.

Since I don't have much experience with the build system, Makefiles and shell scripts, please look these changes over carefully.

9 years agoauto merge of #19176 : aturon/rust/stab-iter, r=alexcrichton
bors [Wed, 26 Nov 2014 17:42:07 +0000 (17:42 +0000)]
auto merge of #19176 : aturon/rust/stab-iter, r=alexcrichton

This is an initial pass at stabilizing the `iter` module. The module is
fairly large, but is also pretty polished, so most of the stabilization
leaves things as they are.

Some changes:

* Due to the new object safety rules, various traits needs to be split
  into object-safe traits and extension traits. This includes `Iterator`
  itself. While splitting up the traits adds some complexity, it will
  also increase flexbility: once we have automatic impls of `Trait` for
  trait objects over `Trait`, then things like the iterator adapters
  will all work with trait objects.

* Iterator adapters that use up the entire iterator now take it by
  value, which makes the semantics more clear and helps catch bugs. Due
  to the splitting of Iterator, this does not affect trait objects. If
  the underlying iterator is still desired for some reason, `by_ref` can
  be used. (Note: this change had no fallout in the Rust distro except
  for the useless mut lint.)

* In general, extension traits new and old are following an [in-progress
  convention](rust-lang/rfcs#445). As such, they
  are marked `unstable`.

* As usual, anything involving closures is `unstable` pending unboxed
  closures.

* A few of the more esoteric/underdeveloped iterator forms (like
  `RandomAccessIterator` and `MutableDoubleEndedIterator`, along with
  various unfolds) are left experimental for now.

* The `order` submodule is left `experimental` because it will hopefully
  be replaced by generalized comparison traits.

* "Leaf" iterators (like `Repeat` and `Counter`) are uniformly
  constructed by free fns at the module level. That's because the types
  are not otherwise of any significance (if we had `impl Trait`, you
  wouldn't want to define a type at all).

Closes #17701

Due to renamings and splitting of traits, this is a:

[breaking-change]

9 years agodebuginfo: Fix LLDB pretty printer for enum variants with zero fields.
Michael Woerister [Wed, 26 Nov 2014 16:42:32 +0000 (17:42 +0100)]
debuginfo: Fix LLDB pretty printer for enum variants with zero fields.

9 years agoAdd tests for the parsing of `+` and the error messages if people get it wrong.
Niko Matsakis [Tue, 25 Nov 2014 12:42:16 +0000 (07:42 -0500)]
Add tests for the parsing of `+` and the error messages if people get it wrong.

Fixes #18772.

9 years agoFix odd example where bounds were permitted and then ignored
Niko Matsakis [Fri, 21 Nov 2014 00:45:42 +0000 (19:45 -0500)]
Fix odd example where bounds were permitted and then ignored

9 years agoFix rustdoc
Niko Matsakis [Fri, 21 Nov 2014 00:44:49 +0000 (19:44 -0500)]
Fix rustdoc

9 years agoRote changes due to the fact that ast paths no longer carry this extraneous bounds.
Niko Matsakis [Thu, 20 Nov 2014 20:08:48 +0000 (15:08 -0500)]
Rote changes due to the fact that ast paths no longer carry this extraneous bounds.

9 years agoFixup various places that were doing `&T+'a` and do `&(T+'a)`
Niko Matsakis [Thu, 20 Nov 2014 20:08:02 +0000 (15:08 -0500)]
Fixup various places that were doing `&T+'a` and do `&(T+'a)`

9 years agoImplement the new parsing rules for types in the parser, modifying the AST appropriately.
Niko Matsakis [Thu, 20 Nov 2014 20:05:29 +0000 (15:05 -0500)]
Implement the new parsing rules for types in the parser, modifying the AST appropriately.

9 years agoUnpublicize reexports, unprefix JSON type aliases
Corey Farwell [Sat, 22 Nov 2014 18:48:01 +0000 (13:48 -0500)]
Unpublicize reexports, unprefix JSON type aliases

The type aliases json::JsonString and json::JsonObject were originally
prefixed with 'json' to prevent collisions with (at the time) the enums
json::String and json::Object respectively. Now that enum namespacing
has landed, this 'json' prefix is redundant and can be removed:

json::JsonArray -> json::Array
json::JsonObject -> json::Object

In addition, this commit also unpublicizes all of the re-exports in this
JSON module, as a part of #19253

[breaking-change]

9 years agoauto merge of #19262 : murarth/rust/module-path-fix, r=jakub-
bors [Wed, 26 Nov 2014 15:07:23 +0000 (15:07 +0000)]
auto merge of #19262 : murarth/rust/module-path-fix, r=jakub-

Closes #18859

9 years agodebuginfo: Add script that allows to conveniently start LLDB in "rust-mode"
Michael Woerister [Thu, 13 Nov 2014 16:25:15 +0000 (17:25 +0100)]
debuginfo: Add script that allows to conveniently start LLDB in "rust-mode"

9 years agoAdd -Z print-sysroot commandline option to rustc.
Michael Woerister [Thu, 13 Nov 2014 08:39:27 +0000 (09:39 +0100)]
Add -Z print-sysroot commandline option to rustc.

9 years agoauto merge of #19252 : japaric/rust/cow, r=aturon
bors [Wed, 26 Nov 2014 12:02:16 +0000 (12:02 +0000)]
auto merge of #19252 : japaric/rust/cow, r=aturon

- Add `IntoCow` trait, and put it in the prelude
- Add `is_owned`/`is_borrowed` methods to `Cow`
- Add `CowString`/`CowVec` type aliases (to `Cow<'_, String, str>`/`Cow<'_, Vec, [T]>` respectively)
- `Cow` implements: `Show`, `Hash`, `[Partial]{Eq,Ord}`
- `impl BorrowFrom<Cow<'a, T, B>> for B`

[breaking-change]s:

- `IntoMaybeOwned` has been removed from the prelude
- libcollections: `SendStr` is now an alias to `CowString<'static>` (it was aliased to `MaybeOwned<'static>`)
- libgraphviz:
  - `LabelText` variants now wrap `CowString` instead of `MaybeOwned`
  - `Nodes` and `Edges` are now type aliases to `CowVec` (they were aliased to `MaybeOwnedVec`)
- libstd/path: `Display::as_maybe_owned` has been renamed to `Display::as_cow` and now returns a `CowString`
- These functions now accept/return `Cow` instead of `MaybeOwned[Vector]`:
  - libregex: `Replacer::reg_replace`
  - libcollections: `str::from_utf8_lossy`
  - libgraphviz: `Id::new`, `Id::name`, `LabelText::pre_escaped_content`
  - libstd: `TaskBuilder::named`

r? @aturon

9 years agoauto merge of #19169 : aturon/rust/fds, r=alexcrichton
bors [Wed, 26 Nov 2014 08:42:09 +0000 (08:42 +0000)]
auto merge of #19169 : aturon/rust/fds, r=alexcrichton

This PR adds some internal infrastructure to allow the private `std::sys` module to access internal representation details of `std::io`.

It then exposes those details in two new, platform-specific API surfaces: `std::os::unix` and `std::os::windows`.

To start with, these will provide the ability to extract file descriptors, HANDLEs, SOCKETs, and so on from `std::io` types.

More functionality, and more specific platforms (e.g. `std::os::linux`) will be added over time.

Closes #18897

9 years agoauto merge of #19212 : steveklabnik/rust/doc_format_specifiers, r=alexcrichton
bors [Wed, 26 Nov 2014 06:42:06 +0000 (06:42 +0000)]
auto merge of #19212 : steveklabnik/rust/doc_format_specifiers, r=alexcrichton

Fixes #19209

9 years ago/** -> ///
Steve Klabnik [Tue, 25 Nov 2014 01:06:06 +0000 (20:06 -0500)]
/** -> ///

This is considered good convention.

9 years agoremove deprecated stuff from std::fmt docs
Steve Klabnik [Sat, 22 Nov 2014 16:13:38 +0000 (11:13 -0500)]
remove deprecated stuff from std::fmt docs

Fixes #19209

9 years agoFallout from stabilization
Aaron Turon [Thu, 6 Nov 2014 17:32:37 +0000 (09:32 -0800)]
Fallout from stabilization

9 years agolibs: stabilize iter module
Aaron Turon [Thu, 6 Nov 2014 17:32:32 +0000 (09:32 -0800)]
libs: stabilize iter module

This is an initial pass at stabilizing the `iter` module. The module is
fairly large, but is also pretty polished, so most of the stabilization
leaves things as they are.

Some changes:

* Due to the new object safety rules, various traits needs to be split
  into object-safe traits and extension traits. This includes `Iterator`
  itself. While splitting up the traits adds some complexity, it will
  also increase flexbility: once we have automatic impls of `Trait` for
  trait objects over `Trait`, then things like the iterator adapters
  will all work with trait objects.

* Iterator adapters that use up the entire iterator now take it by
  value, which makes the semantics more clear and helps catch bugs. Due
  to the splitting of Iterator, this does not affect trait objects. If
  the underlying iterator is still desired for some reason, `by_ref` can
  be used. (Note: this change had no fallout in the Rust distro except
  for the useless mut lint.)

* In general, extension traits new and old are following an [in-progress
  convention](https://github.com/rust-lang/rfcs/pull/445). As such, they
  are marked `unstable`.

* As usual, anything involving closures is `unstable` pending unboxed
  closures.

* A few of the more esoteric/underdeveloped iterator forms (like
  `RandomAccessIterator` and `MutableDoubleEndedIterator`, along with
  various unfolds) are left experimental for now.

* The `order` submodule is left `experimental` because it will hopefully
  be replaced by generalized comparison traits.

* "Leaf" iterators (like `Repeat` and `Counter`) are uniformly
  constructed by free fns at the module level. That's because the types
  are not otherwise of any significance (if we had `impl Trait`, you
  wouldn't want to define a type at all).

Closes #17701

Due to renamings and splitting of traits, this is a:

[breaking-change]

9 years agoauto merge of #19011 : ricky26/rust/trait_supertraits, r=nikomatsakis
bors [Tue, 25 Nov 2014 22:36:59 +0000 (22:36 +0000)]
auto merge of #19011 : ricky26/rust/trait_supertraits, r=nikomatsakis

It looks like currently kinds required by traits are not propagated when they are wrapped in a TyTrait. Additionally, in SelectionContext::builtin_bound, no attempt is made to check whether the target trait or its supertraits require the kind specified.

This PR alters SelectionContext::builtin_bound to examine all supertraits in the target trait's bounds recursively for required kinds.

Alternatively, the kinds could be added to the TyTrait upon creation (by just setting its builtin_bounds to the union of the bounds requested in this instance and the bounds required by the trait), this option may have less overhead during compilation but information is lost about which kinds were explicitly requested for this instance (vs those specified by traits/supertraits) would be lost.

9 years agoauto merge of #19255 : aturon/rust/merge-sync, r=alexcrichton,alexcrichton
bors [Tue, 25 Nov 2014 20:32:20 +0000 (20:32 +0000)]
auto merge of #19255 : aturon/rust/merge-sync, r=alexcrichton,alexcrichton

This patch merges the `libsync` crate into `libstd`, undoing part of the
facade. This is in preparation for ultimately merging `librustrt`, as
well as the upcoming rewrite of `sync`.

Because this removes the `libsync` crate, it is a:

[breaking-change]

However, all uses of `libsync` should be able to reroute through
`std::sync` and `std::comm` instead.

r? @alexcrichton

9 years agoExtra note about struct matching order
Steve Klabnik [Tue, 25 Nov 2014 16:31:49 +0000 (11:31 -0500)]
Extra note about struct matching order

Fixes #19178

9 years agoDeprecate MaybeOwned[Vector] in favor of Cow
Jorge Aparicio [Fri, 21 Nov 2014 22:10:42 +0000 (17:10 -0500)]
Deprecate MaybeOwned[Vector] in favor of Cow

9 years agovec: add missing out-of-memory check
Daniel Micay [Tue, 25 Nov 2014 16:18:31 +0000 (11:18 -0500)]
vec: add missing out-of-memory check

Closes #19305

9 years agoMake note that examples need a main()
Steve Klabnik [Tue, 25 Nov 2014 16:18:39 +0000 (11:18 -0500)]
Make note that examples need a main()

Fixes #19199

9 years agoMake note about cross-borrowing.
Steve Klabnik [Tue, 25 Nov 2014 15:57:17 +0000 (10:57 -0500)]
Make note about cross-borrowing.

Fixes #19302.

9 years agoauto merge of #18234 : pnkfelix/rust/fsk-type-fragments-for-needsdrop-2, r=nikomatsakis
bors [Tue, 25 Nov 2014 15:48:05 +0000 (15:48 +0000)]
auto merge of #18234 : pnkfelix/rust/fsk-type-fragments-for-needsdrop-2, r=nikomatsakis

Code to fragment paths into pieces based on subparts being moved around, e.g. moving `x.1` out of a tuple `(A,B,C)` leaves behind the fragments `x.0: A` and `x.2: C`.  Further discussion in borrowck/doc.rs.

Includes differentiation between assigned_fragments and moved_fragments, support for all-but-one array fragments, and instrumentation to print out the moved/assigned/unmmoved/parents for each function, factored out into a separate submodule.

These fragments can then be used by `trans` to inject stack-local dynamic drop flags.  (They also can be hooked up with dataflow to reduce the expected number of injected flags.)

9 years agoFirst tests making use of the new fn move-fragments instrumentation.
Felix S. Klock II [Wed, 1 Oct 2014 16:53:10 +0000 (18:53 +0200)]
First tests making use of the new fn move-fragments instrumentation.

The tests use new "//~| ERROR" follow syntax.

Includes a test for moves involving array elements.  It was easier
than i realized to get something naive off the ground here.

9 years agoAdded fragments.rs: compute drop obligations remaining post moves.
Felix S. Klock II [Thu, 18 Sep 2014 13:33:36 +0000 (15:33 +0200)]
Added fragments.rs: compute drop obligations remaining post moves.

Includes differentiation between assigned_fragments and
moved_fragments, support for all-but-one array fragments, and
instrumentation to print out the moved/assigned/unmmoved/parents for
each function, factored out into separate submodule.

9 years agoCheck other fields are consistent in `LoanPath::common`.
Felix S. Klock II [Wed, 8 Oct 2014 14:15:28 +0000 (16:15 +0200)]
Check other fields are consistent in `LoanPath::common`.

9 years agoTrack what drop obligations are established on match arms.
Felix S. Klock II [Tue, 16 Sep 2014 13:24:56 +0000 (15:24 +0200)]
Track what drop obligations are established on match arms.

This is accomplished by:

1. Add `MatchMode` enum to `expr_use_visitor`.

2. Computing the match mode for each pattern via a pre-pass, and then
   passing the mode along when visiting the pattern in
   expr_use_visitor.

3. Adding a `fn matched_pat` callback to expr_use_visitor, which is
   called on interior struct and enum nodes of the pattern (as opposed
   to `fn consume_pat`, which is only invoked for identifiers at the
   leaves of the pattern), and invoking it accordingly.

Of particular interest are the `cat_downcast` instances established
when matching enum variants.

9 years agoOverride `LoanPath` Eq impl to enforce invariant: eq lp's always have eq types.
Felix S. Klock II [Tue, 14 Oct 2014 01:23:34 +0000 (03:23 +0200)]
Override `LoanPath` Eq impl to enforce invariant: eq lp's always have eq types.

9 years ago`MemCategorizationContext::pat_ty(BindByRef)` yields type of borrowed val now.
Felix S. Klock II [Tue, 14 Oct 2014 01:21:54 +0000 (03:21 +0200)]
`MemCategorizationContext::pat_ty(BindByRef)` yields type of borrowed val now.

This is to fix a problem where I could not reliably map attach the
type for each loan-path to the loan-path itself because the same
loan-path was ending up associated with two different types, because
the cmt's had diverged in their interpretation of the path.

9 years agoAdd `ty` to `LoanPath`.
Felix S. Klock II [Thu, 18 Sep 2014 05:58:26 +0000 (07:58 +0200)]
Add `ty` to `LoanPath`.

To make this clean, refactored old `LoanPath` enum into a
`LoanPath` struct with a `ty::t` and a newly-added `LoanPathVariant` enum.

This enabled me to get rid of the ugly and fragile `LoanPath::to_type`
method, and I can probably also get rid of other stuff that was
supporting it, maybe.

9 years agoAdd `LpDowncast`, `LoanPath` variant tracking downcasts in match arms.
Felix S. Klock II [Tue, 16 Sep 2014 12:14:59 +0000 (14:14 +0200)]
Add `LpDowncast`, `LoanPath` variant tracking downcasts in match arms.

`LpDowncast` carries the `DefId` of the variant itself.  To support
this, added the enum variant `DefId` to the `cat_downcast` variant in
`mem_categorization::categorization`.

(updated to fix mem_categorization to handle downcast of enum
struct-variants properly.)

9 years agoauto merge of #19174 : tomjakubowski/rust/rustdoc-assoc-types, r=alexcrichton
bors [Tue, 25 Nov 2014 13:46:45 +0000 (13:46 +0000)]
auto merge of #19174 : tomjakubowski/rust/rustdoc-assoc-types, r=alexcrichton

Render associated types on traits and impls, and qualified paths in types.

r? @alexcrichton

9 years agoMake HashMap::take not corrupt the map. Fixes #19292
Alexis Beingessner [Tue, 25 Nov 2014 06:16:50 +0000 (01:16 -0500)]
Make HashMap::take not corrupt the map. Fixes #19292

9 years agoChange 'Failure' to 'Panic' in Bug Report Docs
Pascal Hertleif [Tue, 25 Nov 2014 12:20:47 +0000 (13:20 +0100)]
Change 'Failure' to 'Panic' in Bug Report Docs

9 years agoauto merge of #19172 : alfie/rust/impl-traitless, r=steveklabnik
bors [Tue, 25 Nov 2014 11:46:39 +0000 (11:46 +0000)]
auto merge of #19172 : alfie/rust/impl-traitless, r=steveklabnik

An example of how implementations work without traits would be handy

9 years agoStop indenting error messages. It throws off M-x next-error in emacs and seems to...
Niko Matsakis [Tue, 25 Nov 2014 11:13:45 +0000 (06:13 -0500)]
Stop indenting error messages. It throws off M-x next-error in emacs and seems to serve little purpose.

9 years agoAdd tests for issue 19244
Adolfo Ochagavía [Tue, 25 Nov 2014 09:19:58 +0000 (10:19 +0100)]
Add tests for issue 19244

9 years agoAllow constant struct fields and tuple indexing
Adolfo Ochagavía [Mon, 24 Nov 2014 11:46:02 +0000 (12:46 +0100)]
Allow constant struct fields and tuple indexing

9 years agoauto merge of #19149 : alexcrichton/rust/issue-19091, r=aturon
bors [Tue, 25 Nov 2014 09:21:45 +0000 (09:21 +0000)]
auto merge of #19149 : alexcrichton/rust/issue-19091, r=aturon

This change applies the conventions to unwrap listed in [RFC 430][rfc] to rename
non-failing `unwrap` methods to `into_inner`. This is a breaking change, but all
`unwrap` methods are retained as `#[deprecated]` for the near future. To update
code rename `unwrap` method calls to `into_inner`.

[rfc]: https://github.com/rust-lang/rfcs/pull/430
[breaking-change]

cc #19091

9 years agoImplement union, intersection, and difference functions for TrieSet.
Chase Southwood [Tue, 25 Nov 2014 08:15:28 +0000 (02:15 -0600)]
Implement union, intersection, and difference functions for TrieSet.

9 years agoauto merge of #18966 : huonw/rust/iter2slice, r=aturon
bors [Tue, 25 Nov 2014 06:51:38 +0000 (06:51 +0000)]
auto merge of #18966 : huonw/rust/iter2slice, r=aturon

A slice iterator is isomorphic to a slice, just with a slightly
different form: storing start and end pointers rather than start pointer
and length. This patch reflects this by making converting between them
as easy as `iter.as_slice()` (or even `iter[]` if the shorter lifetime
is ok). That is, `slice.iter().as_slice() == slice`.

r? @aturon

9 years agoAdd methods to go from a slice iterators to a slice.
Huon Wilson [Sat, 15 Nov 2014 03:44:55 +0000 (14:44 +1100)]
Add methods to go from a slice iterators to a slice.

A slice iterator is isomorphic to a slice, just with a slightly
different form: storing start and end pointers rather than start pointer
and length. This patch reflects this by making converting between them
as easy as `iter.as_slice()` (or even `iter[]` if the shorter lifetime
is ok). That is, `slice.iter().as_slice() == slice`.

9 years agoauto merge of #19285 : alexcrichton/rust/issue-19280, r=aturon
bors [Tue, 25 Nov 2014 01:06:41 +0000 (01:06 +0000)]
auto merge of #19285 : alexcrichton/rust/issue-19280, r=aturon

It turns out that rustrt::at_exit() doesn't actually occur after all pthread
threads have exited (nor does atexit()), so there's not actually a known point
at which we can deallocate these keys. It's not super critical that we do so,
however, because we're about to exit anyway!

Closes #19280

9 years agostd: Export BinarySearchResult
Alex Crichton [Mon, 24 Nov 2014 23:54:14 +0000 (15:54 -0800)]
std: Export BinarySearchResult

At the same time remove the `pub use` of the variants in favor of accessing
through the enum type itself. This is a breaking change as the `Found` and
`NotFound` variants must now be imported through `BinarySearchResult` instead of
just `std::slice`.

[breaking-change]
Closes #19272

9 years agostd: Leak all statically allocated TLS keys
Alex Crichton [Mon, 24 Nov 2014 23:24:29 +0000 (15:24 -0800)]
std: Leak all statically allocated TLS keys

It turns out that rustrt::at_exit() doesn't actually occur after all pthread
threads have exited (nor does atexit()), so there's not actually a known point
at which we can deallocate these keys. It's not super critical that we do so,
however, because we're about to exit anyway!

Closes #19280

9 years agoauto merge of #19021 : roysc/rust/emacs-pr, r=brson
bors [Mon, 24 Nov 2014 23:06:45 +0000 (23:06 +0000)]
auto merge of #19021 : roysc/rust/emacs-pr, r=brson

"_" should keep the default syntax class (symbol, not word). This
allows, e.g., `forward-word' to behave in the familiar way, jumping to
underscores within a function or variable name.

9 years agoClean up FileType enum following enum namespacing
Ben S [Mon, 24 Nov 2014 19:04:54 +0000 (19:04 +0000)]
Clean up FileType enum following enum namespacing

All of the enum components had a redundant 'Type' specifier: TypeSymlink, TypeDirectory, TypeFile. This change removes them, replacing them with a namespace: FileType::Symlink, FileType::Directory, and FileType::RegularFile.

RegularFile is used instead of just File, as File by itself could be mistakenly thought of as referring to the struct.

[breaking-change]

9 years agoremove the generation of grammar from the reference
Steve Klabnik [Mon, 24 Nov 2014 22:23:55 +0000 (17:23 -0500)]
remove the generation of grammar from the reference

9 years agoauto merge of #18818 : steveklabnik/rust/tcp_doc, r=alexcrichton
bors [Mon, 24 Nov 2014 21:02:33 +0000 (21:02 +0000)]
auto merge of #18818 : steveklabnik/rust/tcp_doc, r=alexcrichton

This suggests that you must call it, which is normally not what you want to do.

See here: http://www.reddit.com/r/rust/comments/2lpw9k/rust_irc_example_looking_for_feedback/clxnxxc?context=4

9 years agoDon't call drop in tcpstream docs
Steve Klabnik [Sun, 9 Nov 2014 20:23:56 +0000 (15:23 -0500)]
Don't call drop in tcpstream docs

This suggests that you must call it, which is normally not what you want to do.

9 years agoMerge libsync into libstd
Aaron Turon [Sun, 23 Nov 2014 20:52:37 +0000 (12:52 -0800)]
Merge libsync into libstd

This patch merges the `libsync` crate into `libstd`, undoing part of the
facade. This is in preparation for ultimately merging `librustrt`, as
well as the upcoming rewrite of `sync`.

Because this removes the `libsync` crate, it is a:

[breaking-change]

However, all uses of `libsync` should be able to reroute through
`std::sync` and `std::comm` instead.

9 years agorustdoc: Render Sized? on traits and generics
Tom Jakubowski [Mon, 24 Nov 2014 18:14:46 +0000 (10:14 -0800)]
rustdoc: Render Sized? on traits and generics

Both `trait Foo for Sized?` and `<Sized? T>` are handled correctly.

Fix #18515

9 years agoAdded test for module_path! fix
Murarth [Mon, 24 Nov 2014 05:24:38 +0000 (22:24 -0700)]
Added test for module_path! fix

9 years agoFixed "::::" appearing in module_path!()
Murarth [Mon, 24 Nov 2014 05:22:07 +0000 (22:22 -0700)]
Fixed "::::" appearing in module_path!()

9 years agoauto merge of #19258 : nick29581/rust/dxr-minor, r=brson
bors [Mon, 24 Nov 2014 16:07:00 +0000 (16:07 +0000)]
auto merge of #19258 : nick29581/rust/dxr-minor, r=brson

r?

9 years agoauto merge of #19250 : kmcallister/rust/atomicoption, r=alexcrichton
bors [Mon, 24 Nov 2014 13:56:36 +0000 (13:56 +0000)]
auto merge of #19250 : kmcallister/rust/atomicoption, r=alexcrichton

Fixes #19247.

9 years agorustdoc: render ast::QPath
Tom Jakubowski [Fri, 21 Nov 2014 05:45:05 +0000 (21:45 -0800)]
rustdoc: render ast::QPath

Fix #18594

9 years agorustdoc: Render associated types on traits and impls
Tom Jakubowski [Thu, 20 Nov 2014 19:22:09 +0000 (11:22 -0800)]
rustdoc: Render associated types on traits and impls

9 years agoAdd `node_to_user_string`, `node_to_string` variant that drops id from output.
Felix S. Klock II [Fri, 19 Sep 2014 13:38:53 +0000 (15:38 +0200)]
Add `node_to_user_string`, `node_to_string` variant that drops id from output.

9 years agocompiletest: extend syntax with support for choosing same line as previous line.
Felix S. Klock II [Tue, 7 Oct 2014 16:30:35 +0000 (18:30 +0200)]
compiletest: extend syntax with support for choosing same line as previous line.

9 years agoauto merge of #19248 : japaric/rust/str, r=alexcrichton
bors [Mon, 24 Nov 2014 11:56:34 +0000 (11:56 +0000)]
auto merge of #19248 : japaric/rust/str, r=alexcrichton

Just like we do with AsSlice

This comes in handy when dealing with iterator-centric APIs (`IntoIterator`!) and you want to receive an `Iterator<S> where S: Str` argument. Without this PR, e.g. you can't receive `&["a", "b"].iter()` instead you'll have to type `&["a", "b"].iter().map(|&x| x)` (A similar thing happens with `&[String]`).

r? @aturon

Full disclaimer: I haven't run `make`/`make check` yet (All my cores are busy)

9 years agoauto merge of #19094 : alexcrichton/rust/rm-std-local-data, r=aturon
bors [Mon, 24 Nov 2014 09:56:34 +0000 (09:56 +0000)]
auto merge of #19094 : alexcrichton/rust/rm-std-local-data, r=aturon

This commit removes the `std::local_data` module in favor of a new `std::thread_local`
module providing thread local storage. The module provides two variants of TLS:
one which owns its contents and one which is based on scoped references. Each
implementation has pros and cons listed in the documentation.

Both flavors have accessors through a function called `with` which yield a
reference to a closure provided. Both flavors also panic if a reference cannot
be yielded and provide a function to test whether an access would panic or not.
This is an implementation of [RFC 461][rfc] and full details can be found in
that RFC.

This is a breaking change due to the removal of the `std::local_data` module.
All users can migrate to the new tls system like so:

    thread_local!(static FOO: Rc<RefCell<Option<T>>> = Rc::new(RefCell::new(None)))

The old `local_data` module inherently contained the `Rc<RefCell<Option<T>>>` as
an implementation detail which must now be explicitly stated by users.

[rfc]: https://github.com/rust-lang/rfcs/pull/461
[breaking-change]

9 years agoauto merge of #19236 : csouth3/rust/master, r=Gankro
bors [Mon, 24 Nov 2014 07:51:32 +0000 (07:51 +0000)]
auto merge of #19236 : csouth3/rust/master, r=Gankro

Whilst browsing the source for BinaryHeap, I saw a FIXME for implementing into_iter.  I think, since the BinaryHeap is represented internally using just a Vec, just calling into_iter() on the BinaryHeap's data should be sufficient to do what we want here.  If this actually isn't the right approach (e.g., I should write a struct MoveItems and appropriate implementation for BinaryHeap instead), let me know and I'll happily rework this.

Both of the tests that I have added pass.  This is my first contribution to Rust, so please let me know any ways I can improve this PR!

9 years agostd: Add a new top-level thread_local module
Alex Crichton [Fri, 14 Nov 2014 22:20:57 +0000 (14:20 -0800)]
std: Add a new top-level thread_local module

This commit removes the `std::local_data` module in favor of a new
`std::thread_local` module providing thread local storage. The module provides
two variants of TLS: one which owns its contents and one which is based on
scoped references. Each implementation has pros and cons listed in the
documentation.

Both flavors have accessors through a function called `with` which yield a
reference to a closure provided. Both flavors also panic if a reference cannot
be yielded and provide a function to test whether an access would panic or not.
This is an implementation of [RFC 461][rfc] and full details can be found in
that RFC.

This is a breaking change due to the removal of the `std::local_data` module.
All users can migrate to the new thread local system like so:

    thread_local!(static FOO: Rc<RefCell<Option<T>>> = Rc::new(RefCell::new(None)))

The old `local_data` module inherently contained the `Rc<RefCell<Option<T>>>` as
an implementation detail which must now be explicitly stated by users.

[rfc]: https://github.com/rust-lang/rfcs/pull/461
[breaking-change]

9 years agoauto merge of #19223 : reem/rust/any-typeid-unstable, r=aturon
bors [Mon, 24 Nov 2014 02:56:35 +0000 (02:56 +0000)]
auto merge of #19223 : reem/rust/any-typeid-unstable, r=aturon

It is likely going to be removed and replaced
with an associated static.

9 years agosave-analysis: two minor bugs
Nick Cameron [Mon, 24 Nov 2014 01:10:16 +0000 (14:10 +1300)]
save-analysis: two minor bugs

9 years agoauto merge of #19192 : nodakai/rust/generalize-strvector, r=alexcrichton
bors [Mon, 24 Nov 2014 00:46:30 +0000 (00:46 +0000)]
auto merge of #19192 : nodakai/rust/generalize-strvector, r=alexcrichton

A single impl supports all of `[T]`, `Vec<T>` and `CVec<T>`.

Once `Iterable` is implemented, we will prefer it to `SlicePrelude`.
But the `with_capacity()` part might become tricky.

9 years agoImplement into_iter() for BinaryHeap.
Chase Southwood [Sun, 23 Nov 2014 06:31:40 +0000 (00:31 -0600)]
Implement into_iter() for BinaryHeap.

9 years agoRename unwrap functions to into_inner
Alex Crichton [Thu, 20 Nov 2014 17:23:43 +0000 (09:23 -0800)]
Rename unwrap functions to into_inner

This change applies the conventions to unwrap listed in [RFC 430][rfc] to rename
non-failing `unwrap` methods to `into_inner`. This is a breaking change, but all
`unwrap` methods are retained as `#[deprecated]` for the near future. To update
code rename `unwrap` method calls to `into_inner`.

[rfc]: https://github.com/rust-lang/rfcs/pull/430
[breaking-change]

Closes #13159
cc #19091

9 years agoauto merge of #19246 : frewsxcv/rust/json-cleanup, r=jakub-
bors [Sun, 23 Nov 2014 22:36:33 +0000 (22:36 +0000)]
auto merge of #19246 : frewsxcv/rust/json-cleanup, r=jakub-

Was looking through the JSON code and cleaned parts of it up

9 years agoadd MoveItems to RingBuf, fixes #19085
Alexis Beingessner [Sun, 23 Nov 2014 02:34:11 +0000 (21:34 -0500)]
add MoveItems to RingBuf, fixes #19085

9 years agoauto merge of #19242 : jakub-/rust/roll-up, r=jakub-
bors [Sun, 23 Nov 2014 20:26:58 +0000 (20:26 +0000)]
auto merge of #19242 : jakub-/rust/roll-up, r=jakub-

9 years agoFixes to the roll-up
Jakub Bukaj [Sun, 23 Nov 2014 15:47:25 +0000 (10:47 -0500)]
Fixes to the roll-up

9 years agorollup merge of #19239: jauhien/fix-libdir
Jakub Bukaj [Sun, 23 Nov 2014 19:12:03 +0000 (14:12 -0500)]
rollup merge of #19239: jauhien/fix-libdir

A fix for a windows problem pointed by @retep998 in the PR #16552.

9 years agorollup merge of #19234: P1start/rustdoc-misc
Jakub Bukaj [Sun, 23 Nov 2014 19:12:01 +0000 (14:12 -0500)]
rollup merge of #19234: P1start/rustdoc-misc

This PR:

- makes rustdoc colour trait methods like other functions in search results;
- makes rustdoc display `extern crate` statements with the new `as` syntax instead of the old `=` syntax;
- changes rustdoc to list constants and statics in a way that is more similar to functions and modules and show their full definition and documentation on their own page, fixing #19046:

  ![Constant listing](https://i.imgur.com/L4ZTOCN.png)

  ![Constant page](https://i.imgur.com/RcjZfCv.png)