Commit Graph

31602 Commits

Author SHA1 Message Date
bors
38cb37de72 auto merge of #16493 : kballard/rust/fix_drop_field_order, r=pnkfelix
When a struct implements Drop, its fields should still drop in
declaration order (just as they do when the struct does not implement
Drop).

Fixes #16492.
2014-08-15 22:36:15 +00:00
Kevin Ballard
b517b42891 Fix the order in which struct fields drop
When a struct implements Drop, its fields should still drop in
declaration order (just as they do when the struct does not implement
Drop).

Fixes #16492.
2014-08-15 13:36:25 -07:00
bors
2da5018838 auto merge of #16517 : dotdash/rust/for_trunc, r=pcwalton
The discriminant for Option values is either 0 or 1, so we can just
truncate the value to an i1, which ends up as a no-op for Options
containing pointers.
2014-08-15 20:31:16 +00:00
Daniel Micay
48edb32a3f mark &T params without UnsafeCell<U> as readonly
These are already marked as `noalias` due to the immutability guarantee
(see 4c2d4cd3de), but more information can
be bubbled up to the caller via `readonly`.
2014-08-15 14:23:00 -04:00
bors
02f9fd87ec auto merge of #16511 : luqmana/rust/sbnt, r=pcwalton
Fixes #15397.
Fixes #7261.
Fixes #6573.
2014-08-15 15:46:17 +00:00
Andrew Poelstra
b586582481 Derive Clone for std::time::Duration
This is needed to derive Clone for types containing Durations.
2014-08-15 07:50:02 -07:00
Björn Steinbrink
f1f67b2848 Fix builds with LLVM < 3.6 2014-08-15 16:36:05 +02:00
bors
cafa47506d auto merge of #16497 : michaelwoerister/rust/no_debug_attribute, r=pcwalton
Fixes #15332.
2014-08-15 14:06:17 +00:00
Michael Woerister
910dd2635c debuginfo: Add a "no_debug" attribute that allows to exclude functions from debuginfo generation. 2014-08-15 15:35:43 +02:00
Björn Steinbrink
a5590b3c75 Properly canonicalize crate paths specified via --extern
Crates that are resolved normally have their path canonicalized and all
symlinks resolved. This does currently not happen for paths specified
using the --extern option to rustc, which can lead to rustc thinking
that it encountered two different versions of a crate, when it's
actually the same version found through different paths.

To fix this, we must store the canonical path for crates found via
--extern and also use the canonical path when comparing paths.

Fixes #16496
2014-08-15 14:40:09 +02:00
bors
406de8d5dd auto merge of #16500 : jackheizer/rust/export-name, r=alexcrichton 2014-08-15 12:11:16 +00:00
Björn Steinbrink
6c5d97a5da Generate slightly better unoptimized code for for-loops
The discriminant for Option values is either 0 or 1, so we can just
truncate the value to an i1, which ends up as a no-op for Options
containing pointers.
2014-08-15 13:12:48 +02:00
bors
1d12b6d444 auto merge of #16494 : pnkfelix/rust/fsk-quotstx-followup, r=alexcrichton
Followup to PR #16477: a run-pass regression test for Issue #15750.
2014-08-15 10:26:18 +00:00
bors
36db3866c0 auto merge of #16424 : pcwalton/rust/where-clauses, r=nikomatsakis
These `where` clauses are accepted everywhere generics are currently
accepted and desugar during type collection to the type parameter bounds
we have today.

A new keyword, `where`, has been added. Therefore, this is a breaking
change. Change uses of `where` to other identifiers.

[breaking-change]

r? @nikomatsakis (or whoever)
2014-08-15 06:26:23 +00:00
Steven Fackler
89a0060997 std::io::util cleanup + fixes
* Fix `LimitReader`'s `Buffer::consume` impl to avoid limit underflow
* Make `MultiWriter` fail fast instead of always running through each
    `Writer`. This may or may not be what we want, but it at least
    doesn't throw any errors encountered in later `Writer`s into oblivion.
* Prevent `IterReader`'s `Reader::read` impl from returning EOF if given
    an empty buffer.

[breaking-change]
2014-08-14 23:14:56 -07:00
Luqman Aden
28882c44ef librustc: Fix trans for functional record update when discarding the result. 2014-08-14 22:45:57 -04:00
bors
bf0a925dcd auto merge of #16486 : kballard/rust/vim_conceal, r=chris
We shouldn't be setting conceallevel in the syntax file. Besides not
being able to undo this if we switch to another syntax later, it also
interferes with embedding rust in other filetypes (such as markdown).

Instead, set it in the ftplugin, where it belongs.
2014-08-15 02:36:14 +00:00
Luqman Aden
7e30ba8fc9 librustc: Don't create scratch for the base expr in function record update. 2014-08-14 22:16:35 -04:00
bors
6b5ec40d45 auto merge of #16435 : vadimcn/rust/windows, r=pcwalton
Using "win32" to mean "Windows" is confusing, especially now, that Rust supports win64 builds.
Let's call spade a spade.
2014-08-15 00:46:19 +00:00
bors
dbb0cee682 auto merge of #16474 : MatejLach/rust/cargorun_fix, r=steveklabnik
This fixes #16451.

While moving things around, I also removed a bunch of unnecessary whitespace, however I can put it back in if that's undesired. 

Thanks.
2014-08-14 23:01:17 +00:00
Patrick Walton
604af3f6c0 librustc: Implement simple where clauses.
These `where` clauses are accepted everywhere generics are currently
accepted and desugar during type collection to the type parameter bounds
we have today.

A new keyword, `where`, has been added. Therefore, this is a breaking
change. Change uses of `where` to other identifiers.

[breaking-change]
2014-08-14 14:14:26 -07:00
bors
f8e0ede921 auto merge of #16468 : pcwalton/rust/as-renaming-import, r=alexcrichton
The old syntax will be removed after a snapshot.

RFC #47.

Issue #16461.

r? @brson
2014-08-14 21:01:19 +00:00
Patrick Walton
1c16accfc2 libsyntax: Accept use foo as bar; in lieu of use bar as foo;
The old syntax will be removed after a snapshot.

RFC #47.

Issue #16461.
2014-08-14 13:24:50 -07:00
Jack Heizer
614bfbe577 Add export_name to the attribute whitelist and a description in the rust manual 2014-08-14 12:29:07 -07:00
bors
a8c8e3f80f auto merge of #16286 : pcwalton/rust/associated-items-groundwork, r=nikomatsakis
methods.

This paves the way to associated items by introducing an extra level of
abstraction ("impl-or-trait item") between traits/implementations and
methods. This new abstraction is encoded in the metadata and used
throughout the compiler where appropriate.

There are no functional changes; this is purely a refactoring.

r? @nick29581
2014-08-14 19:11:18 +00:00
Patrick Walton
9907fa4acc librustc: Stop assuming that implementations and traits only contain
methods.

This paves the way to associated items by introducing an extra level of
abstraction ("impl-or-trait item") between traits/implementations and
methods. This new abstraction is encoded in the metadata and used
throughout the compiler where appropriate.

There are no functional changes; this is purely a refactoring.
2014-08-14 11:40:22 -07:00
bors
404978ea72 auto merge of #16122 : pcwalton/rust/lifetimes-in-unboxed-closures, r=pnkfelix
This patch primarily does two things: (1) it prevents lifetimes from
leaking out of unboxed closures; (2) it allows unboxed closure type
notation, call notation, and construction notation to construct closures
matching any of the three traits.

This breaks code that looked like:

    let mut f;
    {
        let x = &5i;
        f = |&mut:| *x + 10;
    }

Change this code to avoid having a reference escape. For example:

    {
        let x = &5i;
        let mut f; // <-- move here to avoid dangling reference
        f = |&mut:| *x + 10;
    }

I believe this is enough to consider unboxed closures essentially
implemented. Further issues (for example, higher-rank lifetimes) should
be filed as followups.

Closes #14449.

[breaking-change]

r? @pnkfelix
2014-08-14 16:36:19 +00:00
Patrick Walton
8d27232141 librustc: Tie up loose ends in unboxed closures.
This patch primarily does two things: (1) it prevents lifetimes from
leaking out of unboxed closures; (2) it allows unboxed closure type
notation, call notation, and construction notation to construct closures
matching any of the three traits.

This breaks code that looked like:

    let mut f;
    {
        let x = &5i;
        f = |&mut:| *x + 10;
    }

Change this code to avoid having a reference escape. For example:

    {
        let x = &5i;
        let mut f; // <-- move here to avoid dangling reference
        f = |&mut:| *x + 10;
    }

I believe this is enough to consider unboxed closures essentially
implemented. Further issues (for example, higher-rank lifetimes) should
be filed as followups.

Closes #14449.

[breaking-change]
2014-08-14 08:53:25 -07:00
bors
56b86aaf35 auto merge of #16484 : dotdash/rust/empty_struct_wrapper_arg, r=luqmana
Fixes #16441.
2014-08-14 14:51:19 +00:00
bors
e99eeb574e auto merge of #16470 : liigo/rust/rename-private-cmp-macros, r=brson
eq_impl! => partial_eq_impl!
totaleq_impl! => eq_impl!
ord_impl! => partial_ord_impl!
totalord_impl! => ord_impl!
2014-08-14 13:01:18 +00:00
bors
320c35ee34 auto merge of #16444 : steveklabnik/rust/fix_boxes_in_manual, r=brson
Fixes #16439
2014-08-14 11:16:19 +00:00
Jonas Hietala
0f40cf1f59 Add a test for complex divide by zero. 2014-08-14 13:07:35 +02:00
Felix S. Klock II
43c326ef6b Followup to PR #16477: a run-pass regression test for Issue #15750. 2014-08-14 11:55:47 +02:00
bors
32098bbb0d auto merge of #16440 : bheesham/rust/master, r=brson
* `rust.md`: changes for consistency

  * `guide-ffi.md`: wrapped inline code

NOTE: This is a duplicate of #16375. I completely messed up that fork, so I made a new fork.
2014-08-14 09:31:19 +00:00
Vadim Chugunov
88c27e099f Make it pass the pretty-printer test. 2014-08-14 01:55:51 -07:00
bors
259e806db6 auto merge of #16428 : mdinger/rust/sort_attributes, r=cmr
Targetting at fixing most of #16414.

Sorts these alphabetically:
* [Crate-only attributes](http://doc.rust-lang.org/rust.html#crate-only-attributes)
* [Function-only attributes](http://doc.rust-lang.org/rust.html#function-only-attributes)
* [Miscellaneous attributes](http://doc.rust-lang.org/rust.html#miscellaneous-attributes)
* [Lint check attributes](http://doc.rust-lang.org/rust.html#lint-check-attributes)
* [Built-in Traits](http://doc.rust-lang.org/rust.html#built-in-traits)
* [Types](http://doc.rust-lang.org/rust.html#types)
* [Deriving](http://doc.rust-lang.org/rust.html#deriving)
* [Compiler Features](http://doc.rust-lang.org/rust.html#compiler-features)

Doesn't modify these:
* [Operators](http://doc.rust-lang.org/rust.html#operators): An alternative sorting is unclear.
* [Marker types](http://doc.rust-lang.org/rust.html#marker-types): Could be sorted but uncertain how. See below.
* [Stability](http://doc.rust-lang.org/rust.html#stability): Already sorted by stability

---

[Marker types](http://doc.rust-lang.org/rust.html#marker-types) has an extra newline above `fail_` which may throw off formatting (see #16412) or it may be for some other reason. If the newline is just a typo, I can just remove it and format this alphabetically like so:
```rust
// Sorted alphabetically
a_bread
b_bread
c_bread
fail_
fail_bounds_check
a_type
b_type
c_type
```

Marker types is listed as likely to become out of date so I don't know if this is worth doing anyway.

[EDIT] modified `Marker types` now and tried to update the language items list.
2014-08-14 07:41:20 +00:00
bors
385c39a77b auto merge of #16332 : brson/rust/slicestab, r=aturon
This implements some of the recommendations from https://github.com/rust-lang/meeting-minutes/blob/master/Meeting-API-review-2014-08-06.md.

Explanation in commits.
2014-08-14 05:36:25 +00:00
bors
9d45d63d0d auto merge of #15929 : pcwalton/rust/by-ref-closures, r=alexcrichton
by-reference upvars.

This partially implements RFC 38. A snapshot will be needed to turn this
on, because stage0 cannot yet parse the keyword.

Part of #12831.

r? @alexcrichton
2014-08-14 03:46:22 +00:00
bors
aa98b25c4f auto merge of #16477 : pnkfelix/rust/fsk-quotstx, r=brson
quote_expr macro: embed Ident using special encoding that retains hygiene state.

Fix #15750, #15962
2014-08-14 01:56:26 +00:00
Patrick Walton
a63003fe1a librustc: Parse, but do not fully turn on, the ref keyword for
by-reference upvars.

This partially implements RFC 38. A snapshot will be needed to turn this
on, because stage0 cannot yet parse the keyword.

Part of #12381.
2014-08-13 18:09:14 -07:00
Brian Anderson
fce442e75c Fix test fallout 2014-08-13 17:11:21 -07:00
Kevin Ballard
05e45b9e36 vim: Stop setting conceallevel in the syntax file
We shouldn't be setting conceallevel in the syntax file. Besides not
being able to undo this if we switch to another syntax later, it also
interferes with embedding rust in other filetypes (such as markdown).

Instead, set it in the ftplugin, where it belongs.
2014-08-13 16:52:26 -07:00
bors
28b5e4588f auto merge of #15934 : brson/rust/dur, r=aturon
Currently, the Timer methods take an integer number of ms. This is considered a bug because a) types, b) some timers have ns precision.

This plucks the `Duration` type from [rust-chrono](https://github.com/lifthrasiir/rust-chrono), plops it into `std::time`,  and replaces the arguments to `sleep`, `oneshot`, and `periodic` timers with it. It leaves the old methods intact as `sleep_ms`, `oneshot_ms`, and `periodic_ms`, for convenience.

Closes https://github.com/rust-lang/rust/issues/11189.

cc @lifthrasiir @aturon @kballard @alexcrichton
2014-08-13 23:11:28 +00:00
Brian Anderson
c3b9d5df62 Address some review feedback 2014-08-13 15:27:40 -07:00
Brian Anderson
bc450b17e3 core: Change the argument order on splitn and rsplitn for strs.
This makes it consistent with the same functions for slices,
and allows the search closure to be specified last.

[breaking-change]
2014-08-13 15:27:37 -07:00
Brian Anderson
4e1024f8d3 core: Put stability attributes all over the slice module
Much of this is as discussed[1]. Many things are marked

[1]: https://github.com/rust-lang/meeting-minutes/blob/master/Meeting-API-review-2014-08-06.md
2014-08-13 15:27:34 -07:00
Brian Anderson
075256a070 Fix test fallout 2014-08-13 15:26:48 -07:00
Björn Steinbrink
4df0430da0 Fix handling of ignored arguments in FFI wrappers for rust functions
Fixes #16441.
2014-08-14 00:18:38 +02:00
mdinger
c69f7a9234 Sort Marker types and add missing language items 2014-08-13 18:11:10 -04:00
bors
0f09f51c61 auto merge of #16438 : phi-gamma/rust/doc-fixes, r=brson
Fixes wording in the *runtime*, *testing* and *unsafe* guides.
2014-08-13 21:26:28 +00:00