]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoCorrectly populate trait impl map when checking for impl overlaps
Brian Koropoff [Sun, 28 Sep 2014 21:17:22 +0000 (14:17 -0700)]
Correctly populate trait impl map when checking for impl overlaps

Also fix an existing compile-fail test which was intended to cover
this case.

This closes issue #17593

9 years agoauto merge of #17511 : MatejLach/rust/iter_guide_typo, r=alexcrichton
bors [Sat, 27 Sep 2014 13:52:54 +0000 (13:52 +0000)]
auto merge of #17511 : MatejLach/rust/iter_guide_typo, r=alexcrichton

The sentence "The new iterator `filter()` produces returns only the elements that that closure returned `true` for:"  can be structured as:

"The new iterator `filter()` produces only the elements that that closure returned `true` for:"

or as:

"The new iterator `filter()` returns only the elements that that closure returned `true` for:"

however, not both.

I went with "produces", since it then talks about returning true and having "return" so close together doesn't sound nice.
r @steveklabnik ?

9 years agoauto merge of #17515 : mbrubeck/rust/patch-1, r=alexcrichton
bors [Sat, 27 Sep 2014 10:07:54 +0000 (10:07 +0000)]
auto merge of #17515 : mbrubeck/rust/patch-1, r=alexcrichton

r? @steveklabnik

9 years agoauto merge of #17512 : nodakai/rust/fix-ptr-guide, r=alexcrichton
bors [Sat, 27 Sep 2014 07:43:24 +0000 (07:43 +0000)]
auto merge of #17512 : nodakai/rust/fix-ptr-guide, r=alexcrichton

Fix rust-lang/rust#17255

This is such a trivial change.  Devs: perhaps you might want to omit to run `make check` on Travis.

9 years agoauto merge of #17469 : sfackler/rust/into-result, r=aturon
bors [Sat, 27 Sep 2014 04:02:58 +0000 (04:02 +0000)]
auto merge of #17469 : sfackler/rust/into-result, r=aturon

This is the inverse of `Result::ok` and helps to bridge `Option` and
`Result` based APIs.

9 years agoauto merge of #17506 : sfackler/rust/cfg-attr, r=alexcrichton
bors [Sat, 27 Sep 2014 01:37:53 +0000 (01:37 +0000)]
auto merge of #17506 : sfackler/rust/cfg-attr, r=alexcrichton

cc #17490

Reopening of #16230

9 years agoauto merge of #17464 : pcwalton/rust/inherent-methods-on-equal-footing, r=nikomatsakis
bors [Fri, 26 Sep 2014 21:47:47 +0000 (21:47 +0000)]
auto merge of #17464 : pcwalton/rust/inherent-methods-on-equal-footing, r=nikomatsakis

over inherent methods accessible via more autoderefs.

This simplifies the trait matching algorithm. It breaks code like:

    impl Foo {
        fn foo(self) {
            // before this change, this will be called
        }
    }

    impl<'a,'b,'c> Trait for &'a &'b &'c Foo {
        fn foo(self) {
            // after this change, this will be called
        }
    }

    fn main() {
        let x = &(&(&Foo));
        x.foo();
    }

To explicitly indicate that you wish to call the inherent method, perform
explicit dereferences. For example:

    fn main() {
        let x = &(&(&Foo));
        (***x).foo();
    }

Part of #17282.

[breaking-change]

r? @nikomatsakis

9 years agolibrustc: Give trait methods accessible via fewer autoderefs priority
Patrick Walton [Tue, 23 Sep 2014 00:38:49 +0000 (17:38 -0700)]
librustc: Give trait methods accessible via fewer autoderefs priority
over inherent methods accessible via more autoderefs.

This simplifies the trait matching algorithm. It breaks code like:

    impl Foo {
        fn foo(self) {
            // before this change, this will be called
        }
    }

    impl<'a,'b,'c> Trait for &'a &'b &'c Foo {
        fn foo(self) {
            // after this change, this will be called
        }
    }

    fn main() {
        let x = &(&(&Foo));
        x.foo();
    }

To explicitly indicate that you wish to call the inherent method, perform
explicit dereferences. For example:

    fn main() {
        let x = &(&(&Foo));
        (***x).foo();
    }

Part of #17282.

[breaking-change]

9 years agoAdd Option::{ok_or, ok_or_else}
Steven Fackler [Tue, 23 Sep 2014 06:18:30 +0000 (23:18 -0700)]
Add Option::{ok_or, ok_or_else}

These are the inverses of `Result::ok` and help to bridge `Option` and
`Result` based APIs.

9 years agoauto merge of #17494 : aturon/rust/stabilize-mutable-slices, r=alexcrichton
bors [Fri, 26 Sep 2014 11:44:01 +0000 (11:44 +0000)]
auto merge of #17494 : aturon/rust/stabilize-mutable-slices, r=alexcrichton

This commit is another in the series of vector slice API stabilization. The focus here is the *mutable* slice API.

Largely, this API inherits the stability attributes [previously assigned](rust-lang#16332) to the analogous methods on immutable slides. It also adds comments to a few `unstable` attributes that were previously missing them.

In addition, the commit adds several `_mut` variants of APIs that were missing:

- `init_mut`
- `head_mut`
- `tail_mut`
- `splitn_mut`
- `rsplitn_mut`

Some of the unsafe APIs -- `unsafe_set`, `init_elem`, and `copy_memory` -- were deprecated in favor of working through `as_mut_ptr`, to simplify the API surface.

Due to deprecations, this is a:

[breaking-change]

9 years agoauto merge of #17549 : brson/rust/morewinfail, r=alexcrichton
bors [Fri, 26 Sep 2014 05:57:49 +0000 (05:57 +0000)]
auto merge of #17549 : brson/rust/morewinfail, r=alexcrichton

32-bit builds pass the full 'make check' on the bots after this.

9 years agoIgnore two I/O tests that are failing on the win32 bot
Brian Anderson [Thu, 25 Sep 2014 20:11:57 +0000 (13:11 -0700)]
Ignore two I/O tests that are failing on the win32 bot

9 years agoauto merge of #17504 : danburkert/rust/tuple-serialization, r=alexcrichton
bors [Fri, 26 Sep 2014 03:32:46 +0000 (03:32 +0000)]
auto merge of #17504 : danburkert/rust/tuple-serialization, r=alexcrichton

The tuple serialization logic should be using the tuple-specific emit function.  This fixes part of #17158.  The JSON encoder already proxies to `emit_seq_elt` when `emit_tuple_arg` is called, so this should have an effect.

9 years agoAdd tests for new _mut variants
Aaron Turon [Tue, 23 Sep 2014 23:23:27 +0000 (16:23 -0700)]
Add tests for new _mut variants

9 years agoFallout from deprecation
Aaron Turon [Tue, 23 Sep 2014 22:33:35 +0000 (15:33 -0700)]
Fallout from deprecation

9 years agoStabilize mutable slice API
Aaron Turon [Mon, 22 Sep 2014 23:23:00 +0000 (16:23 -0700)]
Stabilize mutable slice API

This commit is another in the series of vector slice API
stabilization. The focus here is the *mutable* slice API.

Largely, this API inherits the stability attributes [previously
assigned](https://github.com/rust-lang/rust/pull/16332) to the analogous
methods on immutable slides. It also adds comments to a few `unstable`
attributes that were previously missing them.

In addition, the commit adds several `_mut` variants of APIs that were
missing:

- `init_mut`
- `head_mut`
- `tail_mut`
- `splitn_mut`
- `rsplitn_mut`

Some of the unsafe APIs -- `unsafe_set`, `init_elem`, and `copy_memory`
-- were deprecated in favor of working through `as_mut_ptr`, to simplify
the API surface.

Due to deprecations, this is a:

[breaking-change]

9 years agoauto merge of #17495 : alexcrichton/rust/snapshots, r=pcwalton
bors [Fri, 26 Sep 2014 00:27:45 +0000 (00:27 +0000)]
auto merge of #17495 : alexcrichton/rust/snapshots, r=pcwalton

cc @nick29581

9 years agoauto merge of #17466 : nikomatsakis/rust/oibt, r=pcwalton
bors [Thu, 25 Sep 2014 19:02:44 +0000 (19:02 +0000)]
auto merge of #17466 : nikomatsakis/rust/oibt, r=pcwalton

Moves the vast majority of builtin bound checking out of type contents and into the trait system.

This is a preliminary step for a lot of follow-on work:

- opt-in builtin types, obviously
- generalized where clauses, because TypeContents has this notion that a type parameter has a single set of builtin kinds, but with where clauses it depends on context
- generalized coherence, because this adds support for recursive trait selection

Unfortunately I wasn't able to completely remove Type Contents from the front-end checking in this PR. It's still used by EUV to decide what gets moved and what doesn't.

r? @pcwalton

9 years agoFix various places that were affected by adding core as dep of libc
Niko Matsakis [Thu, 25 Sep 2014 17:59:24 +0000 (13:59 -0400)]
Fix various places that were affected by adding core as dep of libc

9 years agoauto merge of #17482 : hoeppnertill/rust/master, r=alexcrichton
bors [Thu, 25 Sep 2014 17:17:43 +0000 (17:17 +0000)]
auto merge of #17482 : hoeppnertill/rust/master, r=alexcrichton

Intended to prevent each user to write his own partial_min/max, possibly differing in slight details. @sfackler encouraged to PR this on IRC.

(Let's hope this works... First PR.)

9 years agoauto merge of #17455 : steveklabnik/rust/document_default, r=alexcrichton
bors [Thu, 25 Sep 2014 15:32:49 +0000 (15:32 +0000)]
auto merge of #17455 : steveklabnik/rust/document_default, r=alexcrichton

Given that the `Default` module is now stable, it might as well get good docs.

9 years agoCorrect tense
Matej Lach [Thu, 25 Sep 2014 15:13:20 +0000 (16:13 +0100)]
Correct tense

9 years agoauto merge of #17498 : coyotebush/rust/iter-doc, r=huonw
bors [Thu, 25 Sep 2014 13:47:46 +0000 (13:47 +0000)]
auto merge of #17498 : coyotebush/rust/iter-doc, r=huonw

OrdIterator: the doc says that values must implement `PartialOrd`, while the implementation is only for `Ord` values. It looks like this initially got out of sync in 4e1c215. Removed the doc sentence entirely since it seems redundant.

MultiplicativeIterator: Fixed weird sentence.

9 years agoAdd partial_min/max to libcore/cmp
Till Hoeppner [Tue, 23 Sep 2014 18:01:59 +0000 (20:01 +0200)]
Add partial_min/max to libcore/cmp

Add partial_min/max to libcore/cmp

Match against None and mark as experimental

Shortened documentation.

Removed whitespace

9 years agoauto merge of #17497 : nodakai/rust/libnative-misc-fixes, r=alexcrichton
bors [Thu, 25 Sep 2014 12:02:52 +0000 (12:02 +0000)]
auto merge of #17497 : nodakai/rust/libnative-misc-fixes, r=alexcrichton

libnative/io: datasync() wrongly called fsync().
liblibc and libnative: send() should use const buffers.

9 years agoRemove as much of TypeContents as I can -- unfortunately, it is still
Niko Matsakis [Tue, 23 Sep 2014 00:54:02 +0000 (20:54 -0400)]
Remove as much of TypeContents as I can -- unfortunately, it is still
used by EUV to compute whether a given type moves-by-default.

9 years agoMove checking of whether fields are Sized or not into wf / trait code.
Niko Matsakis [Tue, 23 Sep 2014 00:12:15 +0000 (20:12 -0400)]
Move checking of whether fields are Sized or not into wf / trait code.

9 years agoRemove the last redundant check from kindck, and then remove the pass as well.
Niko Matsakis [Mon, 22 Sep 2014 19:08:23 +0000 (15:08 -0400)]
Remove the last redundant check from kindck, and then remove the pass as well.

9 years agoMove checks for closure bounds out of kind.rs
Niko Matsakis [Mon, 22 Sep 2014 18:47:06 +0000 (14:47 -0400)]
Move checks for closure bounds out of kind.rs

9 years agoRemove redundant local variable checks.
Niko Matsakis [Mon, 22 Sep 2014 14:05:49 +0000 (10:05 -0400)]
Remove redundant local variable checks.

9 years agoRemove checks that are already being done during typeck
Niko Matsakis [Sat, 20 Sep 2014 13:46:58 +0000 (09:46 -0400)]
Remove checks that are already being done during typeck

9 years agoMove unsafe destructor check from kind.rs into wf.rs
Niko Matsakis [Sat, 20 Sep 2014 13:19:45 +0000 (09:19 -0400)]
Move unsafe destructor check from kind.rs into wf.rs

9 years agoIntegrate caching of results. Measurements show approx 90% hit rate.
Niko Matsakis [Wed, 17 Sep 2014 20:12:02 +0000 (16:12 -0400)]
Integrate caching of results. Measurements show approx 90% hit rate.

9 years agoIntegrate builtin bounds fully into the trait checker
Niko Matsakis [Thu, 18 Sep 2014 15:08:04 +0000 (11:08 -0400)]
Integrate builtin bounds fully into the trait checker

9 years agoauto merge of #17492 : alexcrichton/rust/issue-16274, r=aturon
bors [Thu, 25 Sep 2014 07:12:37 +0000 (07:12 +0000)]
auto merge of #17492 : alexcrichton/rust/issue-16274, r=aturon

Details in the commits.

9 years agoauto merge of #17428 : fhahn/rust/issue-16114-rename-begin-unwind-2, r=alexcrichton
bors [Thu, 25 Sep 2014 05:17:31 +0000 (05:17 +0000)]
auto merge of #17428 : fhahn/rust/issue-16114-rename-begin-unwind-2, r=alexcrichton

This is a PR for #16114 and includes to following things:

* Rename `begin_unwind` lang item to `fail_fmt`
*  Rename `core::failure::begin_unwind` to `fail_impl`
* Rename `fail_` lang item to `fail`

9 years agoauto merge of #17378 : Gankro/rust/hashmap-entry, r=aturon
bors [Thu, 25 Sep 2014 03:32:36 +0000 (03:32 +0000)]
auto merge of #17378 : Gankro/rust/hashmap-entry, r=aturon

Deprecates the `find_or_*` family of "internal mutation" methods on `HashMap` in
favour of the "external mutation" Entry API as part of RFC 60. Part of #17320,
but this still needs to be done on the rest of the maps. However they don't have
any internal mutation methods defined, so they can be done without deprecating
or breaking anything. Work on `BTree` is part of the complete rewrite in #17334.

The implemented API deviates from the API described in the RFC in two key places:

* `VacantEntry.set` yields a mutable reference to the inserted element to avoid code
duplication where complex logic needs to be done *regardless* of whether the entry
was vacant or not.
* `OccupiedEntry.into_mut` was added so that it is possible to return a reference
into the map beyond the lifetime of the Entry itself, providing functional parity
to `VacantEntry.set`.

This allows the full find_or_insert functionality to be implemented using this API.
A PR will be submitted to the RFC to amend this.

[breaking-change]

9 years agohandling fallout from entry api
Alexis Beingessner [Thu, 18 Sep 2014 21:05:52 +0000 (17:05 -0400)]
handling fallout from entry api

9 years agoimplement entry API for HashMap
Alexis Beingessner [Thu, 18 Sep 2014 21:05:22 +0000 (17:05 -0400)]
implement entry API for HashMap

Deprecates the `find_or_*` family of "internal mutation" methods on `HashMap` in
favour of the "external mutation" Entry API as part of RFC 60. Part of #17320,
although this still needs to be done on the rest of the maps, they don't have
any internal mutation methods defined, so they can be done without deprecating
or breaking anything. Work on `BTree`'s is part of the complete rewrite in #17334.

The implemented API deviates from the API described in the RFC in two key places:

* `VacantEntry.set` yields a mutable reference to the inserted element to avoid code
duplication where complex logic needs to be done *regardless* of whether the entry
was vacant or not.
* `OccupiedEntry.into_mut` was added so that it is possible to return a reference
into the map beyond the lifetime of the Entry itself, providing functional parity
to `VacantEntry.set`.

This allows the full find_or_insert functionality to be implemented using this API.
A PR will be submitted to the RFC to amend this.

[breaking-change]

9 years agoBeef up Default documentation
Steve Klabnik [Mon, 22 Sep 2014 20:43:47 +0000 (16:43 -0400)]
Beef up Default documentation

9 years agoRename `begin_unwind_string` to `fail_str`, refs #16114
Florian Hahn [Mon, 22 Sep 2014 21:14:33 +0000 (23:14 +0200)]
Rename `begin_unwind_string` to `fail_str`, refs #16114

9 years agoRename `fail_` lang item to `fail`, closes #16114
Florian Hahn [Sun, 21 Sep 2014 21:35:43 +0000 (23:35 +0200)]
Rename `fail_` lang item to `fail`, closes #16114

9 years agoRename `core::failure::begin_unwind` to `fail_impl`, refs #16114
Florian Hahn [Sun, 21 Sep 2014 21:25:24 +0000 (23:25 +0200)]
Rename `core::failure::begin_unwind` to `fail_impl`, refs #16114

9 years agoRename `begin_unwind` lang item to `fail_fmt`, refs #16114
Florian Hahn [Sun, 21 Sep 2014 21:11:33 +0000 (23:11 +0200)]
Rename `begin_unwind` lang item to `fail_fmt`, refs #16114

9 years agoauto merge of #17410 : jakub-/rust/dead-code, r=alexcrichton
bors [Wed, 24 Sep 2014 20:35:52 +0000 (20:35 +0000)]
auto merge of #17410 : jakub-/rust/dead-code, r=alexcrichton

9 years agoRemove dead code from librustc
Jakub Wieczorek [Sat, 20 Sep 2014 13:20:54 +0000 (15:20 +0200)]
Remove dead code from librustc

9 years agoRemove unused enum variants
Jakub Wieczorek [Sat, 20 Sep 2014 13:37:14 +0000 (15:37 +0200)]
Remove unused enum variants

9 years agoUse more descriptive names in dead code messages
Jakub Wieczorek [Sat, 20 Sep 2014 12:08:10 +0000 (14:08 +0200)]
Use more descriptive names in dead code messages

9 years agoAdd detection of unused enum variants
Jakub Wieczorek [Sat, 20 Sep 2014 11:26:10 +0000 (13:26 +0200)]
Add detection of unused enum variants

9 years agoauto merge of #17477 : vhbit/rust/ios-deprecation-fix, r=alexcrichton
bors [Wed, 24 Sep 2014 17:30:51 +0000 (17:30 +0000)]
auto merge of #17477 : vhbit/rust/ios-deprecation-fix, r=alexcrichton

9 years agoFix typo in unsafe guide (s/xlibrary/library)
Matt Brubeck [Wed, 24 Sep 2014 16:58:06 +0000 (09:58 -0700)]
Fix typo in unsafe guide (s/xlibrary/library)

9 years agoauto merge of #17472 : kaseyc/rust/ICE_fix, r=aturon
bors [Wed, 24 Sep 2014 15:45:48 +0000 (15:45 +0000)]
auto merge of #17472 : kaseyc/rust/ICE_fix, r=aturon

Add checks for null bytes in the value strings for the export_name and link_section attributes, reporting an error if any are found, before calling with_c_str on them.

Fixes #16478

9 years agoauto merge of #17438 : alexcrichton/rust/string-stable, r=aturon
bors [Wed, 24 Sep 2014 14:00:57 +0000 (14:00 +0000)]
auto merge of #17438 : alexcrichton/rust/string-stable, r=aturon

# Rationale

When dealing with strings, many functions deal with either a `char` (unicode
codepoint) or a byte (utf-8 encoding related). There is often an inconsistent
way in which methods are referred to as to whether they contain "byte", "char",
or nothing in their name.  There are also issues open to rename *all* methods to
reflect that they operate on utf8 encodings or bytes (e.g. utf8_len() or
byte_len()).

The current state of String seems to largely be what is desired, so this PR
proposes the following rationale for methods dealing with bytes or characters:

> When constructing a string, the input encoding *must* be mentioned (e.g.
> from_utf8). This makes it clear what exactly the input type is expected to be
> in terms of encoding.
>
> When a method operates on anything related to an *index* within the string
> such as length, capacity, position, etc, the method *implicitly* operates on
> bytes. It is an understood fact that String is a utf-8 encoded string, and
> burdening all methods with "bytes" would be redundant.
>
> When a method operates on the *contents* of a string, such as push() or pop(),
> then "char" is the default type. A String can loosely be thought of as being a
> collection of unicode codepoints, but not all collection-related operations
> make sense because some can be woefully inefficient.

# Method stabilization

The following methods have been marked #[stable]

* The String type itself
* String::new
* String::with_capacity
* String::from_utf16_lossy
* String::into_bytes
* String::as_bytes
* String::len
* String::clear
* String::as_slice

The following methods have been marked #[unstable]

* String::from_utf8 - The error type in the returned `Result` may change to
                      provide a nicer message when it's `unwrap()`'d
* String::from_utf8_lossy - The returned `MaybeOwned` type still needs
                            stabilization
* String::from_utf16 - The return type may change to become a `Result` which
                       includes more contextual information like where the error
                       occurred.
* String::from_chars - This is equivalent to iter().collect(), but currently not
                       as ergonomic.
* String::from_char - This method is the equivalent of Vec::from_elem, and has
                      been marked #[unstable] becuase it can be seen as a
                      duplicate of iterator-based functionality as well as
                      possibly being renamed.
* String::push_str - This *can* be emulated with .extend(foo.chars()), but is
                     less efficient because of decoding/encoding. Due to the
                     desire to minimize API surface this may be able to be
                     removed in the future for something possibly generic with
                     no loss in performance.
* String::grow - This is a duplicate of iterator-based functionality, which may
                 become more ergonomic in the future.
* String::capacity - This function was just added.
* String::push - This function was just added.
* String::pop - This function was just added.
* String::truncate - The failure conventions around String methods and byte
                     indices isn't totally clear at this time, so the failure
                     semantics and return value of this method are subject to
                     change.
* String::as_mut_vec - the naming of this method may change.
* string::raw::* - these functions are all waiting on [an RFC][2]

[2]: rust-lang/rfcs#240

The following method have been marked #[experimental]

* String::from_str - This function only exists as it's more efficient than
                     to_string(), but having a less ergonomic function for
                     performance reasons isn't the greatest reason to keep it
                     around. Like Vec::push_all, this has been marked
                     experimental for now.

The following methods have been #[deprecated]

* String::append - This method has been deprecated to remain consistent with the
                   deprecation of Vec::append. While convenient, it is one of
                   the only functional-style apis on String, and requires more
                   though as to whether it belongs as a first-class method or
                   now (and how it relates to other collections).
* String::from_byte - This is fairly rare functionality and can be emulated with
                      str::from_utf8 plus an assert plus a call to to_string().
                      Additionally, String::from_char could possibly be used.
* String::byte_capacity - Renamed to String::capacity due to the rationale
                          above.
* String::push_char - Renamed to String::push due to the rationale above.
* String::pop_char - Renamed to String::pop due to the rationale above.
* String::push_bytes - There are a number of `unsafe` functions on the `String`
                       type which allow bypassing utf-8 checks. These have all
                       been deprecated in favor of calling `.as_mut_vec()` and
                       then operating directly on the vector returned. These
                       methods were deprecated because naming them with relation
                       to other methods was difficult to rationalize and it's
                       arguably more composable to call .as_mut_vec().
* String::as_mut_bytes - See push_bytes
* String::push_byte - See push_bytes
* String::pop_byte - See push_bytes
* String::shift_byte - See push_bytes

# Reservation methods

This commit does not yet touch the methods for reserving bytes. The methods on
Vec have also not yet been modified. These methods are discussed in the upcoming
[Collections reform RFC][1]

[1]: https://github.com/aturon/rfcs/blob/collections-conventions/active/0000-collections-conventions.md#implicit-growth

9 years agoguide-pointers.md: C sample code should match the Rust version.
NODA, Kai [Wed, 24 Sep 2014 13:47:11 +0000 (21:47 +0800)]
guide-pointers.md: C sample code should match the Rust version.

Fix rust-lang/rust#17255

9 years agoCorrect typo in the Iterator adapters section
Matej Lach [Wed, 24 Sep 2014 12:35:33 +0000 (13:35 +0100)]
Correct typo in the Iterator adapters section

9 years agoauto merge of #17471 : vadimcn/rust/link-libgcc, r=alexcrichton
bors [Wed, 24 Sep 2014 11:25:48 +0000 (11:25 +0000)]
auto merge of #17471 : vadimcn/rust/link-libgcc, r=alexcrichton

Closes #17271
Closes #15420

9 years agoauto merge of #17463 : oskchaitanya/rust/master, r=alexcrichton
bors [Wed, 24 Sep 2014 09:40:52 +0000 (09:40 +0000)]
auto merge of #17463 : oskchaitanya/rust/master, r=alexcrichton

Setting LC_ALL to C helps keep gdb's output consistent ('print' gives us expected output). This fixes #17423. I do not have access to a windows/mac machines to test this. I've only tested it on an x86_64 linux box.

9 years agoauto merge of #17459 : dradtke/rust/master, r=brson
bors [Wed, 24 Sep 2014 07:55:46 +0000 (07:55 +0000)]
auto merge of #17459 : dradtke/rust/master, r=brson

This PR adds a new Vim compiler file specifically for use with Cargo. It passes all arguments through, so commands like `:make build`, `:make clean`, and `:make run` all work as expected.

It also adds a quickfix autocommand for fixing the paths before populating the error list. `cargo build` reports errors with file paths that are relative to Cargo.toml, so if you're further down in the project tree, then trying to open the error will result in a blank buffer because Vim treats that path as relative to the working directory instead. With this fix, the paths work properly no matter where you are in the project.

9 years agoFix rebase fallout
Steven Fackler [Wed, 24 Sep 2014 07:35:42 +0000 (00:35 -0700)]
Fix rebase fallout

9 years agoDeprecate `#[ignore(cfg(...))]`
Steven Fackler [Mon, 4 Aug 2014 00:41:58 +0000 (17:41 -0700)]
Deprecate `#[ignore(cfg(...))]`

Replace `#[ignore(cfg(a, b))]` with `#[cfg_attr(all(a, b), ignore)]`

9 years agoAdd a cfg_attr syntax extension
Steven Fackler [Sun, 3 Aug 2014 21:25:30 +0000 (14:25 -0700)]
Add a cfg_attr syntax extension

This extends cfg-gating to attributes.

```rust
 #[cfg_attr(<cfg pattern>, <attr>)]
```
will expand to
```rust
 #[<attr>]
```
if the `<cfg pattern>` matches the current cfg environment, and nothing
if it does not. The grammar for the cfg pattern has a simple
recursive structure:

 * `value` and `key = "value"` are cfg patterns,
 * `not(<cfg pattern>)` is a cfg pattern and matches if `<cfg pattern>`
    does not.
 * `all(<cfg pattern>, ...)` is a cfg pattern and matches if all of the
    `<cfg pattern>`s do.
 * `any(<cfg pattern>, ...)` is a cfg pattern and matches if any of the
    `<cfg pattern>`s do.

Examples:

```rust
 // only derive Show for assert_eq! in tests
 #[cfg_attr(test, deriving(Show))]
 struct Foo { ... }

 // only derive Show for assert_eq! in tests and debug builds
 #[cfg_attr(any(test, not(ndebug)), deriving(Show))]
 struct Foo { ... }

 // ignore a test in certain cases
 #[test]
 #[cfg_attr(all(not(target_os = "linux"), target_endian = "big"), ignore)]
 fn test_broken_thing() { ... }

 // Avoid duplication when fixing staging issues in rustc
 #[cfg_attr(not(stage0), lang="iter")]
 pub trait Iterator<T> { ... }
```

9 years agouse emit_tuple_arg while serializing tuples
Dan Burkert [Wed, 24 Sep 2014 06:45:56 +0000 (23:45 -0700)]
use emit_tuple_arg while serializing tuples

9 years agoauto merge of #17449 : mcoffin/rust/master, r=alexcrichton
bors [Wed, 24 Sep 2014 05:10:45 +0000 (05:10 +0000)]
auto merge of #17449 : mcoffin/rust/master, r=alexcrichton

Right now, libuv will **always** be built for the host system (at least when building on OSX) because the information about the cross compiler is never actually passed to GYP. I don't know how anybody has been managing to build cross compilers with this.

Note that, at least on OSX, there is a bug in GYP that will send clang flags to non-clang compilers and it will still attempt to use Xcode's libtool, so this doesn't completely fix the problem of cross-compiling on an OSX host, but it's a start.

9 years agoFix iterator doc
Corey Ford [Wed, 24 Sep 2014 03:59:26 +0000 (20:59 -0700)]
Fix iterator doc

OrdIterator: the doc says that values must implement `PartialOrd`, while the implementation is only for `Ord` values. It looks like this initially got out of sync in 4e1c215. Removed the doc sentence entirely since it seems redundant.

MultiplicativeIterator: Fixed weird sentence.

9 years agoauto merge of #17248 : jbcrail/rust/fix-rational-rounding, r=alexcrichton
bors [Wed, 24 Sep 2014 03:25:44 +0000 (03:25 +0000)]
auto merge of #17248 : jbcrail/rust/fix-rational-rounding, r=alexcrichton

When I fixed the previous issue with rational rounding, I had introduced a regression. There was also an overflow bug introduced for fixed-precision rationals. This patch corrects both bugs.

9 years agoliblibc and libnative: send() should use const buffers.
NODA, Kai [Mon, 22 Sep 2014 01:29:39 +0000 (09:29 +0800)]
liblibc and libnative: send() should use const buffers.

9 years agoDeal with the fallout of string stabilization
Alex Crichton [Mon, 22 Sep 2014 15:28:35 +0000 (08:28 -0700)]
Deal with the fallout of string stabilization

9 years agoRegister new snapshots
Alex Crichton [Wed, 24 Sep 2014 01:21:28 +0000 (18:21 -0700)]
Register new snapshots

9 years agolibnative/io: datasync() wrongly called fsync().
NODA, Kai [Mon, 22 Sep 2014 00:03:54 +0000 (08:03 +0800)]
libnative/io: datasync() wrongly called fsync().

9 years agoFix regression and overflow bug for rationals.
Joseph Crail [Sun, 14 Sep 2014 05:41:23 +0000 (01:41 -0400)]
Fix regression and overflow bug for rationals.

9 years agorustdoc: Don't try to inline the crate root
Alex Crichton [Tue, 23 Sep 2014 22:19:30 +0000 (15:19 -0700)]
rustdoc: Don't try to inline the crate root

Fixes other test cases found in #16274

9 years agorustdoc: Prevent infinite recursion when inlining
Alex Crichton [Tue, 23 Sep 2014 22:13:56 +0000 (15:13 -0700)]
rustdoc: Prevent infinite recursion when inlining

Cyclic pub-use chains triggered infinite recursion, and this commit adds a hash
set to guard against cyclic recursion. This will cause one of the reexports to
render as a `pub use` instead of inlining the documentation.

Closes #16274

9 years agoauto merge of #17402 : steveklabnik/rust/update_manual, r=brson
bors [Tue, 23 Sep 2014 22:05:38 +0000 (22:05 +0000)]
auto merge of #17402 : steveklabnik/rust/update_manual, r=brson

Because I'm still :mask: :mask: :mask: , I figured some mindless tasks would be better than trying to finish the ownership guide.

The manual has long been waiting for some :heart: :heart: :heart: , and so I gave it a quick once-over. I made small commits in case any of the changes are a bit weird, I mostly did a few things:

1. changed 'manual' to 'reference.' I feel like this name is better. If it's not, It's not a huge deal. it shouldn't be `rust.md` though.
2. word wrapped everything appropriately. Changes 1&2 are in the first commit, so that its' easier to see the changes in the later ones.
3. fixed other small style issues
4. removed references to things that are in the standard library, and not the language itself

There's still lots of gross in here, but I didn't want to pile on too too many changes.

/cc @brson @nikomatsakis

9 years agoauto merge of #17366 : ohazi/rust/master, r=steveklabnik
bors [Tue, 23 Sep 2014 20:20:41 +0000 (20:20 +0000)]
auto merge of #17366 : ohazi/rust/master, r=steveklabnik

See: http://doc.rust-lang.org/std/from_str/trait.FromStr.html
```
let input_num = from_str::<Option<uint>>("5");
```
```
<anon>:2:21: 2:45 error: failed to find an implementation of trait std::from_str::FromStr for core::option::Option<uint>
<anon>:2     let input_num = from_str::<Option<uint>>("5");
                             ^~~~~~~~~~~~~~~~~~~~~~~~
```

9 years agoCleanup the check_null function.
Kasey Carrothers [Tue, 23 Sep 2014 19:54:16 +0000 (12:54 -0700)]
Cleanup the check_null function.

9 years agoauto merge of #17413 : jakub-/rust/issue-17385, r=pcwalton
bors [Tue, 23 Sep 2014 17:05:39 +0000 (17:05 +0000)]
auto merge of #17413 : jakub-/rust/issue-17385, r=pcwalton

This is to make sure it hadn't been moved if there are no bindings
in any of the arms.

Fixes #17385.

9 years agoFixed: iOS build was broken because of deprecated APIs
Valerii Hiora [Tue, 23 Sep 2014 14:36:33 +0000 (17:36 +0300)]
Fixed: iOS build was broken because of deprecated APIs

9 years agoauto merge of #17028 : pcwalton/rust/higher-rank-trait-lifetimes, r=pnkfelix
bors [Tue, 23 Sep 2014 14:30:40 +0000 (14:30 +0000)]
auto merge of #17028 : pcwalton/rust/higher-rank-trait-lifetimes, r=pnkfelix

They will ICE during typechecking if used, because they depend on trait
reform.

This is part of unboxed closures.

r? @nikomatsakis

9 years agoauto merge of #17456 : alfie/rust/master, r=steveklabnik
bors [Tue, 23 Sep 2014 12:45:45 +0000 (12:45 +0000)]
auto merge of #17456 : alfie/rust/master, r=steveklabnik

While reading the intro, I was confused as to why there were two variables named "numbers". Unless I'm mistaken and it's not necessary, let's get rid of it to make it clearer.

9 years agoauto merge of #17446 : steveklabnik/rust/gh17445, r=alexcrichton
bors [Tue, 23 Sep 2014 09:00:40 +0000 (09:00 +0000)]
auto merge of #17446 : steveklabnik/rust/gh17445, r=alexcrichton

Fixes #17445.

9 years agoCheck for null bytes before calling with_c_str on link_section and export_name value...
Kasey Carrothers [Tue, 23 Sep 2014 07:14:46 +0000 (00:14 -0700)]
Check for null bytes before calling with_c_str on link_section and export_name value strings.

9 years agoauto merge of #17443 : alexcrichton/rust/issue-17442, r=brson
bors [Tue, 23 Sep 2014 07:15:40 +0000 (07:15 +0000)]
auto merge of #17443 : alexcrichton/rust/issue-17442, r=brson

...des a full path via -Clinker=..."

This reverts commit 94f05324fee6cd4637adc01f441fafd09e678668.

9 years agoauto merge of #17401 : pcwalton/rust/private-items-in-public-apis, r=alexcrichton
bors [Tue, 23 Sep 2014 04:15:37 +0000 (04:15 +0000)]
auto merge of #17401 : pcwalton/rust/private-items-in-public-apis, r=alexcrichton

This breaks code like:

    struct Foo {
        ...
    }

    pub fn make_foo() -> Foo {
        ...
    }

Change this code to:

    pub struct Foo {    // note `pub`
        ...
    }

    pub fn make_foo() -> Foo {
        ...
    }

The `visible_private_types` lint has been removed, since it is now an
error to attempt to expose a private type in a public API.

Closes #16463.

RFC #48.

[breaking-change]

r? @alexcrichton

9 years agolibrustc: Parse and resolve higher-rank lifetimes in traits.
Patrick Walton [Fri, 5 Sep 2014 19:21:02 +0000 (12:21 -0700)]
librustc: Parse and resolve higher-rank lifetimes in traits.

They will ICE during typechecking if used, because they depend on trait
reform.

This is part of unboxed closures.

9 years agolibrustc: Forbid private types in public APIs.
Patrick Walton [Fri, 19 Sep 2014 19:30:07 +0000 (12:30 -0700)]
librustc: Forbid private types in public APIs.

This breaks code like:

    struct Foo {
        ...
    }

    pub fn make_foo() -> Foo {
        ...
    }

Change this code to:

    pub struct Foo {    // note `pub`
        ...
    }

    pub fn make_foo() -> Foo {
        ...
    }

The `visible_private_types` lint has been removed, since it is now an
error to attempt to expose a private type in a public API. In its place
a `#[feature(visible_private_types)]` gate has been added.

Closes #16463.

RFC #48.

[breaking-change]

9 years agoauto merge of #17432 : nick29581/rust/contrib, r=brson
bors [Tue, 23 Sep 2014 02:30:36 +0000 (02:30 +0000)]
auto merge of #17432 : nick29581/rust/contrib, r=brson

r? @brson

9 years agocollapse setting and exporting RUST_BENCH into one line
O S K Chaitanya [Tue, 23 Sep 2014 01:12:37 +0000 (03:12 +0200)]
collapse setting and exporting RUST_BENCH into one line

9 years agoUse locale 'C' for running tests. Closes #17423
O S K Chaitanya [Tue, 23 Sep 2014 00:20:19 +0000 (02:20 +0200)]
Use locale 'C' for running tests. Closes #17423

9 years agoauto merge of #17286 : vberger/rust/deprecated_in_macros, r=aturon
bors [Mon, 22 Sep 2014 23:50:30 +0000 (23:50 +0000)]
auto merge of #17286 : vberger/rust/deprecated_in_macros, r=aturon

Closes #17185.

The stability lint will now check code generated by macro expansion. It will allow to detect :
- arguments passed to macros using deprecated (and others) items
- macro expansion generating code using deprecated items due to its arguments (hence the second commit, fixing such issue found in libcollections)

Checking is still done at expansion, but it will also detect a macro explicitly using a deprecated item in its definition.

9 years agoLink libgcc statically on Win64.
Vadim Chugunov [Mon, 22 Sep 2014 23:33:18 +0000 (16:33 -0700)]
Link libgcc statically on Win64.
Allow linking it statically on Win32 with an override.

9 years agoAdd cargo.vim compiler file.
Damien Radtke [Mon, 22 Sep 2014 22:24:26 +0000 (17:24 -0500)]
Add cargo.vim compiler file.

9 years agoauto merge of #17408 : bkoropoff/rust/bot-ice, r=alexcrichton
bors [Mon, 22 Sep 2014 22:05:33 +0000 (22:05 +0000)]
auto merge of #17408 : bkoropoff/rust/bot-ice, r=alexcrichton

- Don't attempt to autoderef `!`.  The `Deref`/`DerefMut` trait lookup would generate a bunch of unhelpful error spew.
- Don't allow explicit deref of `!`, since later passes just ICE.  This closes issue #17373
- Don't allow explicit index of `!`, since later passes just ICE.  There does not seem to be an issue associated with this

9 years agoclean up some references to 'owned'
Steve Klabnik [Fri, 19 Sep 2014 21:03:50 +0000 (17:03 -0400)]
clean up some references to 'owned'

9 years agovectors are not in the language
Steve Klabnik [Fri, 19 Sep 2014 21:02:54 +0000 (17:02 -0400)]
vectors are not in the language

9 years agodie 'managed'
Steve Klabnik [Fri, 19 Sep 2014 21:01:48 +0000 (17:01 -0400)]
die 'managed'

9 years agologging is an external crate
Steve Klabnik [Fri, 19 Sep 2014 20:59:43 +0000 (16:59 -0400)]
logging is an external crate

9 years agono it won't
Steve Klabnik [Fri, 19 Sep 2014 20:58:45 +0000 (16:58 -0400)]
no it won't

9 years agoruntime has no C++
Steve Klabnik [Fri, 19 Sep 2014 20:58:26 +0000 (16:58 -0400)]
runtime has no C++

9 years agoRemove lies about task scheduling
Steve Klabnik [Fri, 19 Sep 2014 20:57:48 +0000 (16:57 -0400)]
Remove lies about task scheduling

it's 1:1 by default now, and N:M is on its way out

9 years agoFix terminology around boxes
Steve Klabnik [Fri, 19 Sep 2014 20:54:47 +0000 (16:54 -0400)]
Fix terminology around boxes

it's just 'box' not 'owned box'