Commit Graph

30270 Commits

Author SHA1 Message Date
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
Luqman Aden
e11503f6d2 librustc: Allow coercions through arrays. 2014-06-29 00:56:40 -07: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
John Clements
e100d26d1d undo helpful attempt to spell-check
Yes, that word is spelled \'memoization\'
2014-06-27 22:08:58 -07:00
John Clements
ee1ee7f463 make tests hygienic...
... and possibly totally pointless. Specifically, fixing
these to make their macros hygienic may mean that they no
longer test the thing that they were supposed to test.
2014-06-27 22:08:57 -07:00
John Clements
235ca1801e remove trailing whitespace 2014-06-27 22:08:57 -07:00
John Clements
4b46c700f4 hygiene for match-bound vars now implemented
Closes #9384
2014-06-27 22:08:57 -07:00
John Clements
7bad96e742 improve match test case to include guard 2014-06-27 22:08:51 -07:00
John Clements
47eec97cda remove unnecessary abstraction 2014-06-27 21:41:17 -07:00
John Clements
977b380cd2 cleanup and shiny new more-functional interface 2014-06-27 21:41:17 -07:00
John Clements
a18a63185c WIP match hygiene, compiles 2014-06-27 21:41:17 -07:00
John Clements
84e8143c4f get rid of needless wrapper function 2014-06-27 21:41:16 -07:00
John Clements
c956f76c3c replaced ignore-pretty with no-pretty-expanded
Per @acrichto's suggestion, use the more narrowly focused exclusion.
2014-06-27 21:41:16 -07:00
John Clements
4b833e24c3 make fold_attribute part of Folder trait 2014-06-27 21:41:16 -07:00
John Clements
b8c5e46505 working on hygiene 2014-06-27 21:41:10 -07:00
bors
afdfe40aa0 auto merge of #15226 : luqmana/rust/abol, r=pcwalton
This was causing a ton of leaks in macro expansion.
2014-06-27 21:11:31 +00:00
Luqman Aden
04e64c0c91 librustc: Schedule cleanups properly when coercing to a &Trait. 2014-06-27 17:05:24 -04:00
Alex Crichton
aa1163b92d Update to 0.11.0 2014-06-27 12:50:16 -07:00
Alex Crichton
d2ff9d804a Update AUTHORS.txt 2014-06-27 12:47:03 -07:00
Alex Crichton
1fefa5b514 Updated release notes for 0.11.0 2014-06-27 12:47:03 -07:00
bors
abdf71cf73 auto merge of #15212 : huonw/rust/struct-paren-lint, r=alexcrichton
rustc: update the unnecessary parens lint for struct literals.

Things like `match X { x: 1 } { ... }` now need to be written with
parentheses, so the lint should avoid warning in cases like that.
2014-06-27 17:56:26 +00:00
bors
d0983872ef auto merge of #15213 : Sawyer47/rust/issue-11677, r=huonw
This code used to cause an ICE

Closes #11677
2014-06-27 13:11:24 +00:00
bors
b66c59ee5a auto merge of #15211 : steveklabnik/rust/guide_skeleton, r=huonw
This diff will look better once bors takes care of https://github.com/rust-lang/rust/pull/15183

@brson and I talked about it, and, if I commit this skeleton, I can submit PRs for each portion, without doing this silly "builds on previous PRs" stuff, and it shouldn't cause conflicts.

This lays out what I think the guide should cover, and in what order.  I haven't picked a cohesive project yet that shows all this off, but I think this progression of concepts is appropriate.
2014-06-27 11:26:25 +00:00
bors
17021944be auto merge of #15166 : zookoatleastauthoritycom/rust/13570-add-see-below-to-a-reference-to-a-new-concept-2, r=huonw
This is the same patch as submitted to https://github.com/rust-lang/rust/issues/13570 and https://github.com/rust-lang/rust/pull/14124, but with @pnkfelix's comment (https://github.com/rust-lang/rust/pull/14124#issuecomment-42797536) addressed, and with reflow as a separate commit. I'm submitting it in case @steveklabnik hasn't yet merged a rewrite of the tutorial (https://github.com/rust-lang/rust/issues/13570#issuecomment-46864789), in which case this patch might as well be merged into the old tutorial.
2014-06-27 09:41:27 +00:00