Commit Graph

30202 Commits

Author SHA1 Message Date
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
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
Piotr Jawniak
510372129e Add test for #11677
This code used to cause an ICE

Closes #11677
2014-06-27 11:30:51 +02:00
Steve Klabnik
afdb19b3b5 Skeleton outline of the guide. 2014-06-27 05:28:44 -04:00
Huon Wilson
64019e764f 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 16:43:05 +10:00
bors
8fe47bc3bb auto merge of #15183 : steveklabnik/rust/hello_cargo, r=huonw
Built on top of https://github.com/rust-lang/rust/pull/15181. e527192911 is the only new commit, you may want to review that separately.

I'm not sure if the car analogy is too glib.
2014-06-27 02:41:24 +00:00
Steve Klabnik
6bfbc35491 Add one more ignore.
Thanks @huonw
2014-06-26 21:57:46 -04:00
Steve Klabnik
aee263c6b0 Fix windows run instructions
Thank you, @stormbrew!
2014-06-26 20:49:27 -04:00
bors
deb6b04e91 auto merge of #15206 : omasanori/rust/use-reexported, r=alexcrichton
We use re-exported pathes (e.g. std::io::Command) and original ones
(e.g. std::io::process::Command) together in examples now. Using
re-exported ones consistently avoids confusion.
2014-06-27 00:21:24 +00:00
Luqman Aden
8b83355f14 README: Add instructions for building on windows. 2014-06-26 20:17:24 -04:00
bors
c0f231072b auto merge of #15190 : pcwalton/rust/proc-upvars, r=alexcrichton
Since procs do not have lifetime bounds, we must do this to maintain
safety.

This can break code that incorrectly captured references in procedure
types. Change such code to not do this, perhaps with a trait object
instead.

Closes #14036.

[breaking-change]

r? @alexcrichton
2014-06-26 22:21:23 +00:00
Patrick Walton
9a9908405d librustc: Ensure that proc upvars have static lifetime.
Since procs do not have lifetime bounds, we must do this to maintain
safety.

This can break code that incorrectly captured references in procedure
types. Change such code to not do this, perhaps with a trait object
instead.

A better solution would be to add higher-rank lifetime support to procs.
However, this would be a lot of work for a feature we want to remove in
favor of unboxed closures. The corresponding "real fix" is #15067.

Closes #14036.

[breaking-change]
2014-06-26 15:16:03 -07:00
OGINO Masanori
dfef422024 std::io: Use re-exported pathes in examples.
We use re-exported pathes (e.g. std::io::Command) and original ones
(e.g. std::io::process::Command) together in examples now. Using
re-exported ones consistently avoids confusion.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-06-27 07:10:33 +09:00
Steve Klabnik
e4b87077fb C macros, not C++ templates.
@cmr rightfully points out that C macros are worse, and share the
same name.
2014-06-26 16:58:20 -04:00
Steve Klabnik
15bcb2f9c6 Fix missing word and some grammar
Thanks @chris-morgan and @P1start! ❤️
2014-06-26 15:46:36 -04:00
bors
4c33a14cc5 auto merge of #14886 : alexcrichton/rust/rt-improvements, r=brson
Most of the comments are available on the Task structure itself, but this commit
is aimed at making FFI-style usage of Rust tasks a little nicer.

Primarily, this commit enables re-use of tasks across multiple invocations. The
method `run` will no longer unconditionally destroy the task itself. Rather, the
task will be internally re-usable if the closure specified did not fail. Once a
task has failed once it is considered poisoned and it can never be used again.

Along the way I tried to document shortcomings of the current method of tearing
down a task, opening a few issues as well. For now none of the behavior is a
showstopper, but it's useful to acknowledge it. Also along the way I attempted
to remove as much `unsafe` code as possible, opting for safer abstractions.
2014-06-26 19:46:25 +00:00
Steve Klabnik
546b202e0e Note that macros != templates
Good call, @chris-morgan and @cmr!
2014-06-26 15:44:29 -04:00
Steve Klabnik
8cd906811a Clarify which curly is being referred to
Thanks @chris-morgan
2014-06-26 15:41:46 -04:00
Steve Klabnik
efc2d4a476 TIL PATHEXT
Thanks @chris-morgan ❤️
2014-06-26 15:40:52 -04:00
Alex Crichton
7d756e44a9 rustrt: Reorganize task usage
Most of the comments are available on the Task structure itself, but this commit
is aimed at making FFI-style usage of Rust tasks a little nicer.

Primarily, this commit enables re-use of tasks across multiple invocations. The
method `run` will no longer unconditionally destroy the task itself. Rather, the
task will be internally re-usable if the closure specified did not fail. Once a
task has failed once it is considered poisoned and it can never be used again.

Along the way I tried to document shortcomings of the current method of tearing
down a task, opening a few issues as well. For now none of the behavior is a
showstopper, but it's useful to acknowledge it. Also along the way I attempted
to remove as much `unsafe` code as possible, opting for safer abstractions.
2014-06-26 12:40:27 -07:00