Commit Graph

30138 Commits

Author SHA1 Message Date
bors
94343da1bd auto merge of #15275 : sfackler/rust/distcheck, r=alexcrichton
libcoretest wasn't being included which broke the verification of the
tarball.
2014-06-30 16:36:33 +00:00
Steven Fackler
21dba11fec Fix distcheck
libcoretest wasn't being included which broke the verification of the
tarball.
2014-06-30 09:13:09 -07:00
bors
04da31e64c auto merge of #15267 : ruud-v-a/rust/patch-1, r=huonw
[This commit](25fe2cadb1 (diff-04c6e90faac2675aa89e2176d2eec7d8R57)) forgot to remove one line.
2014-06-30 14:06:31 +00:00
bors
566b57f3de auto merge of #15259 : steveklabnik/rust/patch-3, r=alexcrichton
It wasn't clear if we needed to install Hello World or Cargo.
2014-06-30 12:16:30 +00:00
bors
287dcb77b3 auto merge of #15262 : zecozephyr/rust/15620, r=luqmana
Fixes #15260
2014-06-30 10:26:28 +00:00
Ruud van Asseldonk
9df25449f2 fix typo in readme 2014-06-30 11:17:25 +02:00
bors
2735c7bb10 auto merge of #15237 : zzmp/rust/feat/markdown-in-crate-documentation, r=huonw
This makes the `in-header`, `markdown-before-content`, and `markdown-after-content` options available to `rustdoc` when generating documentation for any crate.

Before, these options were only available when creating documentation *from* markdown. Now, they are available when generating documentation from source.

This also updates the `rustdoc -h` output to reflect these changes. It does not update the `man rustdoc` page, nor does it update the documentation in [the `rustdoc` manual](http://doc.rust-lang.org/rustdoc.html).
2014-06-30 07:31:29 +00:00
zzmp
63afc08262 Allow external html in rustdoc for crates.
Updated documentation to reflect md->html.
Modularized external file loading.
2014-06-30 00:03:34 -07:00
Jonathan Bailey
6821a18122 librustc: Don't ICE on binding same field multiple times in struct
pattern.
2014-06-29 22:38:53 -07:00
bors
e1683f50c0 auto merge of #15030 : sfackler/rust/partial-cmp, r=huonw
I ended up altering the semantics of Json's PartialOrd implementation.
It used to be the case that Null < Null, but I can't think of any reason
for an ordering other than the default one so I just switched it over to
using the derived implementation.

This also fixes broken `PartialOrd` implementations for `Vec` and
`TreeMap`.

# Note
This isn't ready to merge yet since libcore tests are broken as you end up with 2 versions of `Option`. The rest should be reviewable though.

RFC: 0028-partial-cmp
2014-06-30 05:36:25 +00:00
Steven Fackler
55cae0a094 Implement RFC#28: Add PartialOrd::partial_cmp
I ended up altering the semantics of Json's PartialOrd implementation.
It used to be the case that Null < Null, but I can't think of any reason
for an ordering other than the default one so I just switched it over to
using the derived implementation.

This also fixes broken `PartialOrd` implementations for `Vec` and
`TreeMap`.

RFC: 0028-partial-cmp
2014-06-29 21:42:09 -07:00
bors
e25eb6b223 auto merge of #15256 : erickt/rust/optimizations, r=alexcrichton
The bug #11084 causes `option::collect` and `result::collect` about twice as slower as it should because llvm is having some trouble optimizing away the scan closure. This gets rid of it so now those functions perform equivalent to a hand written version.

This also adds an impl of `Default` for `Rc` along the way.
2014-06-30 03:46:25 +00:00
bors
9ae48286a9 auto merge of #15254 : alex/rust/patch-1, r=alexcrichton
This makes the docs ever-so-slightly easier to read.
2014-06-30 01:56:26 +00:00
Steve Klabnik
572234ceac it -> Cargo
It wasn't clear if we needed to install Hello World or Cargo.
2014-06-29 21:51:41 -04:00
bors
bb5695b95c auto merge of #15245 : sfackler/rust/coretest, r=alexcrichton
Libcore's test infrastructure is complicated by the fact that many lang
items are defined in the crate. The current approach (realcore/realstd
imports) is hacky and hard to work with (tests inside of core::cmp
haven't been run for months!).

Moving tests to a separate crate does mean that they can only test the
public API of libcore, but I don't feel that that is too much of an
issue. The only tests that I had to get rid of were some checking the
various numeric formatters, but those are also exercised through normal
format! calls in other tests.
2014-06-29 23:36:43 +00:00
Steven Fackler
1ed646eaf7 Extract tests from libcore to a separate crate
Libcore's test infrastructure is complicated by the fact that many lang
items are defined in the crate. The current approach (realcore/realstd
imports) is hacky and hard to work with (tests inside of core::cmp
haven't been run for months!).

Moving tests to a separate crate does mean that they can only test the
public API of libcore, but I don't feel that that is too much of an
issue. The only tests that I had to get rid of were some checking the
various numeric formatters, but those are also exercised through normal
format! calls in other tests.
2014-06-29 15:57:21 -07:00
bors
a490871a6c auto merge of #15252 : alexcrichton/rust/issue-15231, r=pcwalton
When cloning a stream, the data is already guaranteed to be in a consistent
state, so there's no need to perform a zeroing. This prevents segfaults as seen
in #15231

Closes #15231
2014-06-29 21:41:45 +00:00
bors
ff94f867d2 auto merge of #15234 : pcwalton/rust/integer-fallback-and-casts, r=alexcrichton
This will break code that looks like:

    let mut x = 0;
    while ... {
        x += 1;
    }
    println!("{}", x);

Change that code to:

    let mut x = 0i;
    while ... {
        x += 1;
    }
    println!("{}", x);

Closes #15201.

[breaking-change]

r? @alexcrichton
2014-06-29 19:46:46 +00:00
Erick Tryzelaar
ab1bd3adf6 core: optimize {option,result}::collect
The bug #11084 causes these collect functions to run about
twice as slow as they should because llvm is having trouble
optimizing away the closure for some reason. This patch works
around that performance bug by using a simple adapter iterator
explicitly for capturing if the outer iterator returns an
error.
2014-06-29 12:32:24 -07:00
Erick Tryzelaar
1ea9991921 alloc: impl Default for Rc 2014-06-29 12:32:24 -07:00
Erick Tryzelaar
2317840c14 collections: minor cleanup 2014-06-29 12:29:36 -07:00
Patrick Walton
a5bb0a3a45 librustc: Remove the fallback to int for integers and f64 for
floating point numbers for real.

This will break code that looks like:

    let mut x = 0;
    while ... {
        x += 1;
    }
    println!("{}", x);

Change that code to:

    let mut x = 0i;
    while ... {
        x += 1;
    }
    println!("{}", x);

Closes #15201.

[breaking-change]
2014-06-29 11:47:58 -07:00
Alex Gaynor
c420f448b3 Wrap two code examples in backticks
This makes the docs ever-so-slightly easier to read.
2014-06-29 11:11:03 -07:00
bors
cc5663ad55 auto merge of #15246 : Sawyer47/rust/rand-doc-fix, r=alexcrichton
Documentation didn't match with parameter name.
Changes name of parameter in docs and function to 'amount'.
2014-06-29 17:51:39 +00:00
Alex Crichton
ca7fb82e0b rustuv: Don't zero-out data on clones
When cloning a stream, the data is already guaranteed to be in a consistent
state, so there's no need to perform a zeroing. This prevents segfaults as seen
in #15231

Closes #15231
2014-06-29 09:38:07 -07:00
bors
bd9563aa38 auto merge of #15249 : aochagavia/rust/rand, r=huonw 2014-06-29 13:11:36 +00:00
bors
b569c77148 auto merge of #14904 : huonw/rust/cstr-remove-withref, r=alexcrichton 2014-06-29 11:21:39 +00:00
Huon Wilson
569f13a521 c_str: move .unwrap & document it more clearly.
This should be called rarely, but it was placed first in the list of
methods, making it very tempting to call.
2014-06-29 21:15:26 +10:00
Huon Wilson
d4d4bc4fe9 c_str: replace .with_ref with .as_ptr throughout the codebase. 2014-06-29 21:15:26 +10:00
Huon Wilson
2c9aada10c c_str: add .as_ptr & .as_mut_ptr to replace .with_[mut_]ref.
These forms return the pointer directly, rather than the added
indirection, indentation, and inefficiencies of the closures in
`.with_ref` and `.with_mut_ref`. The two closure functions are
deprecated.

Replace

    foo(c_str.with_ref(|p| p))

    c_str.with_ref(|p| {
        foo(p);
        bar(p);
    })

with

    foo(c_str.as_ptr())

    let p = c_str.as_ptr();
    foo(p);
    bar(p);

This change does mean that one has to be careful to avoid writing `let p
= x.to_c_str().as_ptr();` since the `CString` will be freed at the end
of the statement. Previously, `with_ref` was used (and `as_ptr` avoided)
for this reason, but Rust has strongly moved away from closures to more
RAII-style code, and most uses of `.with_ref` where in the form
`.with_ref(|p| p)` anyway, that is, they were exactly `.as_ptr`.

[breaking-change]
2014-06-29 21:15:26 +10:00
Piotr Jawniak
ba46c8bf66 rand: Small fix in parameter name
Documentation didn't match with parameter name.
Changes name of parameter in docs and function to 'amount'.
2014-06-29 12:09:22 +02:00
Adolfo Ochagavía
96fdf4dae5 Impl Rand for tuples of arity 11 and 12 2014-06-29 11:44:25 +02:00
bors
6a3695d54f auto merge of #15241 : arjantop/rust/maybeownedvector-improvements, r=alexcrichton 2014-06-29 00:31:30 +00:00
bors
1e6b69977a auto merge of #15210 : luqmana/rust/windoc, r=alexcrichton
Getting rust to build on windows can be a bit annoying in setting up all the toolchains and whatnot. The whole process is made much easier by using msys2 so let's document that prominently right on the README.
2014-06-28 22:06:35 +00:00
bors
fe8bc17801 auto merge of #15208 : alexcrichton/rust/snapshots, r=pcwalton
This change registers new snapshots, allowing `*T` to be removed from the language. This is a large breaking change, and it is recommended that if compiler errors are seen that any FFI calls are audited to determine whether they should be actually taking `*mut T`.
2014-06-28 20:11:34 +00:00
Alex Crichton
0dfc90ab15 Rename all raw pointers as necessary 2014-06-28 11:53:58 -07:00
Arjan Topolovec
8fce20c2cb Implementation of common traits for MaybeOwnedVector 2014-06-28 20:28:04 +02:00
bors
de337f3ddf auto merge of #15191 : pcwalton/rust/variance-in-trait-matching, r=huonw
I believe that #5781 got fixed by the DST work. It duplicated the
variance inference work in #12828. Therefore, all that is left in #5781
is adding a test.

Closes #5781.

r? @huonw
2014-06-28 18:21:34 +00:00
Patrick Walton
05e3248a79 librustc: Match trait self types exactly.
This can break code that looked like:

    impl Foo for Box<Any> {
        fn f(&self) { ... }
    }

    let x: Box<Any + Send> = ...;
    x.f();

Change such code to:

    impl Foo for Box<Any> {
        fn f(&self) { ... }
    }

    let x: Box<Any> = ...;
    x.f();

That is, upcast before calling methods.

This is a conservative solution to #5781. A more proper treatment (see
the xfail'd `trait-contravariant-self.rs`) would take variance into
account. This change fixes the soundness hole.

Some library changes had to be made to make this work. In particular,
`Box<Any>` is no longer showable, and only `Box<Any+Send>` is showable.
Eventually, this restriction can be lifted; for now, it does not prove
too onerous, because `Any` is only used for propagating the result of
task failure.

This patch also adds a test for the variance inference work in #12828,
which accidentally landed as part of DST.

Closes #5781.

[breaking-change]
2014-06-28 11:18:37 -07:00
bors
b47f2226a2 auto merge of #15214 : tbu-/rust/pr_doc_vecinsert, r=huonw 2014-06-28 14:31:37 +00:00
Tobias Bucher
a208842b9d Add remark and an example about the bounds of Vec::insert 2014-06-28 12:29:24 +02:00
bors
e6d6c8beaa auto merge of #15235 : Sawyer47/rust/issue-12552, r=huonw
Closes #12552
2014-06-28 09:16:35 +00:00
Piotr Jawniak
5be84098b5 Add test for issue #12552
Closes #12552
2014-06-28 09:30:44 +02:00
bors
0ddf6f4b7c auto merge of #15233 : jbclements/rust/match-var-hygiene-etc, r=cmr
This PR includes two big things and a bunch of little ones.

1) It enables hygiene for variables bound by 'match' expressions.
2) It fixes a bug discovered indirectly (#15221), wherein fold traversal failed to visit nonterminal nodes.
3) It fixes a small bug in the macro tutorial.

It also adds tests for the first two, and makes a bunch of small comment improvements and cleanup.
2014-06-28 05:21:34 +00:00
John Clements
04ced031ad comments only 2014-06-27 22:14:22 -07:00
John Clements
e3361bcbc2 adjust fold to fold over interpolated items/exprs/etc.
Closes #15221
2014-06-27 22:14:13 -07:00
John Clements
2f73b7874e looks like a cut-n-paste error in unused code 2014-06-27 22:11:11 -07:00
John Clements
764c2fe2d5 simplified test case 2014-06-27 22:11:11 -07:00
John Clements
268f6c56c2 removed incomplete comment
as written, I don't believe this comment was helpful; I think it's
better just to steer the reader toward a general understanding of
hygiene.
2014-06-27 22:11:11 -07:00
John Clements
351a5fd2b4 added unit and standalone test for 15221, extra debugging output 2014-06-27 22:10:43 -07:00