]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agorollup merge of #17542 : brson/devchannel
Alex Crichton [Mon, 29 Sep 2014 15:12:09 +0000 (08:12 -0700)]
rollup merge of #17542 : brson/devchannel

9 years agorollup merge of #17531 : tomjakubowski/rustdoc-where-clauses
Alex Crichton [Mon, 29 Sep 2014 15:10:47 +0000 (08:10 -0700)]
rollup merge of #17531 : tomjakubowski/rustdoc-where-clauses

9 years agorollup merge of #17519 : pcwalton/unboxed-closure-move-syntax
Alex Crichton [Mon, 29 Sep 2014 15:10:44 +0000 (08:10 -0700)]
rollup merge of #17519 : pcwalton/unboxed-closure-move-syntax

9 years agorollup merge of #17510 : MatejLach/find_fix
Alex Crichton [Mon, 29 Sep 2014 15:10:32 +0000 (08:10 -0700)]
rollup merge of #17510 : MatejLach/find_fix

9 years agorustdoc: Render where clauses as appropriate
Tom Jakubowski [Thu, 25 Sep 2014 09:01:42 +0000 (02:01 -0700)]
rustdoc: Render where clauses as appropriate

Fix #16546

9 years agoauto merge of #17538 : brson/rust/winmk, r=alexcrichton
bors [Mon, 29 Sep 2014 12:43:13 +0000 (12:43 +0000)]
auto merge of #17538 : brson/rust/winmk, r=alexcrichton

9 years agoauto merge of #17409 : farcaller/rust/patch-1, r=huonw
bors [Mon, 29 Sep 2014 10:08:04 +0000 (10:08 +0000)]
auto merge of #17409 : farcaller/rust/patch-1, r=huonw

Parser.parse_method now has a second argument, I assume ast::Inherited is the correct visibility in this case.

9 years agoFixed quote_method!() implementation
Vladimir Pouzanov [Sat, 20 Sep 2014 16:02:48 +0000 (17:02 +0100)]
Fixed quote_method!() implementation

Parser.parse_method now has a second argument, I assume ast::Inherited is the correct visibility in this case.

9 years agoauto merge of #17535 : Manishearth/rust/patch-2, r=steveklabnik
bors [Mon, 29 Sep 2014 07:43:07 +0000 (07:43 +0000)]
auto merge of #17535 : Manishearth/rust/patch-2, r=steveklabnik

It's a rather useful syntax, and non-obvious.

A friend of mine is learning Rust and was trying to find a way to easily do such an initialization — he couldn't find it in the guide and was pretty surprised when I showed him. Looks like something that should be mentioned.

r? @steveklabnik

9 years agoauto merge of #17321 : apoelstra/rust/error-on-unknown-impl, r=alexcrichton
bors [Mon, 29 Sep 2014 05:13:08 +0000 (05:13 +0000)]
auto merge of #17321 : apoelstra/rust/error-on-unknown-impl, r=alexcrichton

Followup to RFC 57.

Fixes #7607
Fixes #8767
Fixes #12729
Fixes #15060

9 years agoauto merge of #17533 : michaelwoerister/rust/function-call-locs, r=luqmana
bors [Mon, 29 Sep 2014 01:03:06 +0000 (01:03 +0000)]
auto merge of #17533 : michaelwoerister/rust/function-call-locs, r=luqmana

This PR makes rustc emit debug locations for *all* call and invoke statements in LLVM IR, if they are contained within a function that debuginfo is enabled for. This is important because LLVM does not handle the case where a function body containing debuginfo is inlined into another function with debuginfo, but the inlined call statement does not have a debug location. In this case, LLVM will not know where (in terms of source code coordinates) the function was inlined to and we end up with some statements still linked to the source locations in there original, non-inlined function without any indication that they are indeed an inline-copy. Later, when generating DWARF from the IR, LLVM will interpret this as corrupt IR and abort.

Unfortunately, the undesirable case described above can still occur when using LTO. If there is a crate compiled without debuginfo calling into a crate compiled with debuginfo, we again end up with the conditions triggering the error. This is why some LTO tests still fail with the dreaded assertion, if the standard library was built with debuginfo enabled. That is, `RUSTFLAGS_STAGE2=-g make rustc-stage2` will succeed but `RUSTFLAGS_STAGE2=-g make check` will still fail after this PR has been merged. I will open a separate issue for this problem.

9 years agoCleanup error messages for anonymous impl for types not declared in the current module
Andrew Poelstra [Tue, 16 Sep 2014 22:39:18 +0000 (17:39 -0500)]
Cleanup error messages for anonymous impl for types not declared in the current module

Followup to RFC 57.

Fixes #7607
Fixes #8767
Fixes #12729
Fixes #15060

9 years agoauto merge of #17532 : ahmedcharles/rust/typo, r=alexcrichton
bors [Sun, 28 Sep 2014 11:38:01 +0000 (11:38 +0000)]
auto merge of #17532 : ahmedcharles/rust/typo, r=alexcrichton

9 years agoauto merge of #17527 : sfackler/rust/cfg-syntax, r=alexcrichton
bors [Sun, 28 Sep 2014 08:57:57 +0000 (08:57 +0000)]
auto merge of #17527 : sfackler/rust/cfg-syntax, r=alexcrichton

We'll need a snapshot before we can convert the codebase over and turn on the deprecation warnings.

cc #17490

This is sitting on top of #17506

9 years agoConvert cfg syntax to new system
Steven Fackler [Thu, 25 Sep 2014 03:22:57 +0000 (20:22 -0700)]
Convert cfg syntax to new system

This removes the ability to use `foo(bar)` style cfgs. Switch them to
`foo_bar` or `foo="bar"` instead.

[breaking-change]

9 years agoauto merge of #17529 : nodakai/rust/rustdoc-div-in-h1, r=alexcrichton
bors [Sun, 28 Sep 2014 05:58:04 +0000 (05:58 +0000)]
auto merge of #17529 : nodakai/rust/rustdoc-div-in-h1, r=alexcrichton

W3C HTML5 spec states that H1 must enclose "phrasing content" which
doesn't include DIV.  But SPAN is OK.
http://www.w3.org/TR/html5/sections.html#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements

9 years agoauto merge of #17523 : TeXitoi/rust/relicense-shootout-fasta-redux, r=brson
bors [Sat, 27 Sep 2014 23:12:54 +0000 (23:12 +0000)]
auto merge of #17523 : TeXitoi/rust/relicense-shootout-fasta-redux, r=brson

Everyone agreed.

Fix #17078

#14248 seems completed, as every src/test/bench/shootout-*.rs are relicensed after acceptation of this PR except:
- shootout-ackermann.rs: obsolete shootout bench
- shootout-fibo.rs:  obsolete shootout bench
- shootout-k-nucleotide-pipes.rs: slower that shootout-k-nucleotide-pipes.rs (and not so interesting as a benchmark)
- shootout-pfib.rs: does not seems related to the shootout

@brson OK?

9 years agoauto merge of #17517 : pczarn/rust/hashmap-lifetimes, r=alexcrichton
bors [Sat, 27 Sep 2014 18:57:46 +0000 (18:57 +0000)]
auto merge of #17517 : pczarn/rust/hashmap-lifetimes, r=alexcrichton

Fixes #17500

9 years agoauto merge of #17334 : Gankro/rust/btree-vec, r=huonw
bors [Sat, 27 Sep 2014 16:17:50 +0000 (16:17 +0000)]
auto merge of #17334 : Gankro/rust/btree-vec, r=huonw

Replaces BTree with BTreeMap and BTreeSet, which are completely new implementations.
BTreeMap's internal Node representation is particularly inefficient at the moment to
make this first implementation easy to reason about and fairly safe. Both collections
are also currently missing some of the tooling specific to sorted collections, which
is planned as future work pending reform of these APIs. General implementation issues
are discussed with TODOs internally

[breaking-change]

Still waiting on compilation/test/bench stuff locally, but the edit-distance on any errors should be very small at this point. This is ready to be reviewed.

9 years agocomplete btree rewrite
Alexis Beingessner [Tue, 16 Sep 2014 14:49:26 +0000 (10:49 -0400)]
complete btree rewrite

Replaces BTree with BTreeMap and BTreeSet, which are completely new implementations.
BTreeMap's internal Node representation is particularly inefficient at the moment to
make this first implementation easy to reason about and fairly safe. Both collections
are also currently missing some of the tooling specific to sorted collections, which
is planned as future work pending reform of these APIs. General implementation issues
are discussed with TODOs internally

Perf results on x86_64 Linux:

test treemap::bench::find_rand_100                         ... bench:        76 ns/iter (+/- 4)
test treemap::bench::find_rand_10_000                      ... bench:       163 ns/iter (+/- 6)
test treemap::bench::find_seq_100                          ... bench:        77 ns/iter (+/- 3)
test treemap::bench::find_seq_10_000                       ... bench:       115 ns/iter (+/- 1)
test treemap::bench::insert_rand_100                       ... bench:       111 ns/iter (+/- 1)
test treemap::bench::insert_rand_10_000                    ... bench:       996 ns/iter (+/- 18)
test treemap::bench::insert_seq_100                        ... bench:       486 ns/iter (+/- 20)
test treemap::bench::insert_seq_10_000                     ... bench:       800 ns/iter (+/- 15)

test btree::map::bench::find_rand_100                      ... bench:        74 ns/iter (+/- 4)
test btree::map::bench::find_rand_10_000                   ... bench:       153 ns/iter (+/- 5)
test btree::map::bench::find_seq_100                       ... bench:        82 ns/iter (+/- 1)
test btree::map::bench::find_seq_10_000                    ... bench:       108 ns/iter (+/- 0)
test btree::map::bench::insert_rand_100                    ... bench:       220 ns/iter (+/- 1)
test btree::map::bench::insert_rand_10_000                 ... bench:       620 ns/iter (+/- 16)
test btree::map::bench::insert_seq_100                     ... bench:       411 ns/iter (+/- 12)
test btree::map::bench::insert_seq_10_000                  ... bench:       534 ns/iter (+/- 14)

BTreeMap still has a lot of room for optimization, but it's already beating out TreeMap on most access patterns.

[breaking-change]

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 agolibrustc: Eliminate the `ref` syntax for unboxed closure capture clauses
Patrick Walton [Wed, 24 Sep 2014 17:58:53 +0000 (10:58 -0700)]
librustc: Eliminate the `ref` syntax for unboxed closure capture clauses
in favor of `move`.

This breaks code that used `move` as an identifier, because it is now a
keyword. Change such identifiers to not use the keyword `move`.
Additionally, this breaks code that was counting on by-value or
by-reference capture semantics for unboxed closures (behind the feature
gate). Change `ref |:|` to `|:|` and `|:|` to `move |:|`.

Part of RFC #63; part of issue #12831.

[breaking-change]

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 agoUse 'dev' for the release channel and version suffix when building from source
Brian Anderson [Thu, 25 Sep 2014 22:28:00 +0000 (15:28 -0700)]
Use 'dev' for the release channel and version suffix when building from source

This is more consistent with how the other channels work.

9 years agoconfigure: Fix the compatibility code for --enable-nightly
Brian Anderson [Thu, 25 Sep 2014 20:34:16 +0000 (13:34 -0700)]
configure: Fix the compatibility code for --enable-nightly

When --enable-nightly is not specified this expression is malformed
because $CFG_ENABLE_NIGHTLY is undefined.

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 agoMention array sugar in guide
Manish Goregaokar [Thu, 25 Sep 2014 18:30:04 +0000 (00:00 +0530)]
Mention array sugar in guide

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 agodebuginfo: Make sure that all calls to drop glue are associated with debug locations.
Michael Woerister [Wed, 24 Sep 2014 06:49:38 +0000 (08:49 +0200)]
debuginfo: Make sure that all calls to drop glue are associated with debug locations.

This commit makes rustc emit debug locations for all call
and invoke statements in LLVM IR, if they are contained
within a function that debuginfo is enabled for. This is
important because LLVM does not handle the case where a
function body containing debuginfo is inlined into another
function with debuginfo, but the inlined call statement
does not have a debug location. In this case, LLVM will
not know where (in terms of source code coordinates) the
function was inlined to and we end up with some statements
still linked to the source locations in there original,
non-inlined function without any indication that they are
indeed an inline-copy. Later, when generating DWARF from
the IR, LLVM will interpret this as corrupt IR and abort.

Unfortunately, the undesirable case described above can
still occur when using LTO. If there is a crate compiled
without debuginfo calling into a crate compiled with
debuginfo, we again end up with the conditions triggering
the error. This is why some LTO tests still fail with the
dreaded assertion, if the standard library was built with
debuginfo enabled.
That is, `RUSTFLAGS_STAGE2=-g make rustc-stage2` will
succeed but `RUSTFLAGS_STAGE2=-g make check` will still
fail after this commit has been merged. This is a problem
that has to be dealt with separately.

Fixes #17201
Fixes #15816
Fixes #15156

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 agoFix typo, structs => fields.
Ahmed Charles [Thu, 25 Sep 2014 11:51:18 +0000 (04:51 -0700)]
Fix typo, structs => fields.

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 agorustdoc: replace DIV inside H1 with SPAN.
NODA, Kai [Wed, 24 Sep 2014 04:47:25 +0000 (12:47 +0800)]
rustdoc: replace DIV inside H1 with SPAN.

W3C HTML5 spec states that H1 must enclose "phrasing content" which
doesn't include DIV.  But SPAN is OK.
http://www.w3.org/TR/html5/sections.html#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements

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 agomk: Fix a minor makefile warning on windows
Brian Anderson [Thu, 25 Sep 2014 00:46:36 +0000 (17:46 -0700)]
mk: Fix a minor makefile warning on windows

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 agoRelicense shootout-fasta-redux.rs to the shootout license.
Guillaume Pinot [Wed, 24 Sep 2014 22:31:47 +0000 (00:31 +0200)]
Relicense shootout-fasta-redux.rs to the shootout license.

Everyone agreed.

Fix #17078

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 agoFix free lifetime vars in HashMap's iterators
Piotr Czarnecki [Wed, 24 Sep 2014 18:38:15 +0000 (19:38 +0100)]
Fix free lifetime vars in HashMap's iterators

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 agoRemove unnecessary code from an example
Matej Lach [Wed, 24 Sep 2014 11:39:16 +0000 (12:39 +0100)]
Remove unnecessary code from an example

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.