Commit Graph

49108 Commits

Author SHA1 Message Date
Steve Klabnik
723ead6c9c Mention that structs can contain &mut Ts
Fixes #30254
2016-01-04 14:06:54 -05:00
bors
191ff2d8fd Auto merge of #30651 - nagisa:mir-fix-equality-checks, r=eddyb
This is not a fix to checks themselves per se (though we still use `Eq` MIR test instead of calling `PartialEq::eq`), but rather how we handle items we encounter in pattern position.

Previously we would just call `PartialEq` with the constant and the matchee, but now we essentially inline the constant instead. E.g. these two snippets are functionally equivalent at MIR level:

```
match val { Some(42) => true, _ => false }
```
and
```
const SECRET: Option<u8> = Some(42);
match val { SECRET => true, _ => false }
```

This approach also allows for more optimizations of matches. I.e. It can now exploit `SwitchInt` to switch on number inside a `Some` regardless of whether the value being an item or not.

This is based on @tsion’s already approved PR so I could reuse the file for more tests.

r? @eddyb
cc @nikomatsakis @tsion
2016-01-04 03:07:59 +00:00
bors
99e59dec5a Auto merge of #29732 - nathansizemore:master, r=steveklabnik 2016-01-04 00:27:40 +00:00
bors
8f11a9ef4e Auto merge of #30677 - diwic:master, r=bluss
Obviously we can't remove the character one past the end of the String. And we can't today either - we'll just panic at char_at() instead - but if we're going to keep that assertion, we should at least have a correct assertion.
2016-01-03 21:00:46 +00:00
bors
cae9267d47 Auto merge of #29949 - fhahn:issue-21659-show-relevant-trait-impls, r=arielb1
This PR for #21659 uses `DefId.for_each_relevant_impl()` to show other possible implementations in the "trait not implemented" message.
2016-01-03 19:14:20 +00:00
Florian Hahn
a8d60708ec Refactor candidate selection 2016-01-03 00:11:48 +01:00
diwic
8b398ed823 Fix off-by-one in String::remove
Obviously we can't remove the character one past the end of the String. And we can't today either - we'll just panic at char_at() instead - but if we're going to keep that assertion, we should at least have a correct assertion.
2016-01-02 22:36:50 +01:00
Florian Hahn
25e4389866 Use for_each_impl 2016-01-02 19:47:41 +01:00
Florian Hahn
ba24fbd404 Manually check trait implementations 2016-01-02 19:47:02 +01:00
Florian Hahn
6093ea8039 Add more tests 2016-01-02 19:46:31 +01:00
Florian Hahn
2c52cb424a Limit displaying relevant trait impls to 4 2016-01-02 19:46:31 +01:00
bors
4744472fe0 Auto merge of #30264 - GuillaumeGomez:patch-5, r=Manishearth
r? @Manishearth

Also: should I merged both commits? Not sure if it's really useful to keep the first one.
2016-01-02 16:56:15 +00:00
bors
44f020883e Auto merge of #30675 - jimmantooth:master, r=apasel422 2016-01-02 13:58:57 +00:00
James Mantooth
877d55c1e0 Grammar fixes 2016-01-02 01:26:22 -06:00
Nathan
3e9d5fea48 Adjusted heading and created dedicated section in std::io docs 2016-01-02 00:27:16 -05:00
Nathan
66e842b6de Links and punctionaction fixes. 2016-01-02 00:25:42 -05:00
Nathan
7f36a18df8 Added platform notes to std::fs public functions. 2016-01-02 00:25:42 -05:00
Guillaume Gomez
55955f5a45 Add E0463 error explanation 2016-01-02 02:39:45 +01:00
bors
d4b67cd7cc Auto merge of #30672 - nagisa:to-degrad-stab, r=sfackler
f64 methods have been stable since rust 1.0, but f32 never got stabilised.

I suggest backporting this to beta as well (needs changing stablilisation version then).

r? @aturon

Fixes https://github.com/rust-lang/rfcs/issues/1438
2016-01-01 22:42:04 +00:00
Simonas Kazlauskas
c921abf9c0 Stabilise f32::to_{degrees,radians} to match f64
f64 methods have been stable since rust 1.0, but f32 never got stabilised.
2016-01-02 00:07:16 +02:00
Florian Hahn
335298e7b6 Show similar trait implementations if no matching impl is found
closes #21659
2016-01-01 17:50:43 +01:00
bors
5446139387 Auto merge of #30670 - emoon:fs-copy-comment, r=steveklabnik
When looking in the documentation I often scan the examples the first thing I do. In these 3 cases it's not obvious which direction the operation happens by adding this comment it makes it more obvious.

r? @steveklabnik
2016-01-01 16:38:40 +00:00
bors
88e819f478 Auto merge of #30663 - apasel422:ll, r=bluss
CC #30642

r? @Gankro
2016-01-01 13:51:38 +00:00
Simonas Kazlauskas
add7410af6 Fix equality checks in matches 2016-01-01 14:55:57 +02:00
Daniel Collin
9a7e2329f2 Added comment in which direction operation happens 2016-01-01 10:09:24 +01:00
bors
bfb4212ee2 Auto merge of #30648 - tshepang:missing-graves, r=steveklabnik 2016-01-01 00:38:43 +00:00
bors
9c53c9234b Auto merge of #30645 - tshepang:grammar, r=steveklabnik 2015-12-31 22:44:02 +00:00
bors
b9075d6f53 Auto merge of #30616 - arcnmx:cstr-asref, r=aturon
Are trait impls still insta-stable? Considering that this design has been around for a long time on `String` and `OsString` it probably doesn't matter much...

The `From` impl is a bit strange to me. It's stolen from `OsString` but I'm not really sure about it... `String` just impls `From<&str>` instead, would that make more sense?
2015-12-31 20:52:17 +00:00
Andrew Paseltiner
c9fd3d4f91 Make LinkedList and its read-only iterators covariant
CC #30642
2015-12-31 15:22:22 -05:00
arcnmx
53878e7546 CStr impl stability 2015-12-31 14:21:40 -05:00
arcnmx
965556d162 impl From<&CStr> for CString 2015-12-31 14:15:27 -05:00
bors
7d9543345c Auto merge of #28469 - DenisKolodin:master, r=steveklabnik 2015-12-31 18:57:27 +00:00
bors
53cd573bc8 Auto merge of #30660 - nagisa:rollup, r=steveklabnik
- Successful merges: #30365, #30565, #30590, #30630
- Failed merges:
2015-12-31 17:05:34 +00:00
Simonas Kazlauskas
7448f4861a Rollup merge of #30630 - tsion:mir-closure-args, r=nagisa
Previously, all references to closure arguments went to the argument before the one they should (e.g. to `arg1` when it was supposed to go to `arg2`). This was because the MIR builder did not account for the implicit arguments that come before the explicit arguments, and closures have one implicit argument - the struct containing the captures.

This is my test code and a diff of the MIR generated for the closure:

```rust
let a = 2i32;
let _f = |b: i32| -> i32 { a + b }:
```

```diff
--- old	2015-12-29 23:16:32.027926372 -0600
+++ new	2015-12-29 23:16:42.975400757 -0600
@@ -1,22 +1,22 @@
 fn(arg0: &[closure@closure-args.rs:8:14: 8:39 a:&i32], arg1: i32) -> i32 {
     let var0: i32; // b
     let tmp0: ();
     let tmp1: i32;
     let tmp2: i32;

     bb0: {
-        var0 = arg0;
+        var0 = arg1;
         tmp1 = (*(*arg0).0);
         tmp2 = var0;
         ReturnPointer = Add(tmp1, tmp2);
         goto -> bb1;
     }

     bb1: {
         return;
     }

     bb2: {
         diverge;
     }
 }
```

(If you're wondering where this text MIR output comes from, it's from another branch of mine waiting on https://github.com/rust-lang/rust/pull/30602 to get merged.)
2015-12-31 18:52:20 +02:00
Simonas Kazlauskas
1aa4abdb3b Rollup merge of #30590 - nagisa:mir-constval-function, r=luqmana
This moves back (essentially reverts #30265) into MIR-specific translation code, but keeps the
funcition split out, since it is expected to eventually become recursive.

Fixes https://github.com/rust-lang/rust/issues/29572

cc @oli-obk
2015-12-31 18:52:20 +02:00
Simonas Kazlauskas
23d24ff667 Rollup merge of #30565 - michaelwoerister:opaque_encoder, r=brson
This PR changes the `emit_opaque` and `read_opaque` methods in the RBML library to use a space-efficient binary encoder that does not emit any tags and uses the LEB128 variable-length integer format for all numbers it emits.

The space savings are nice, albeit a bit underwhelming, especially for dynamic libraries where metadata is already compressed.

| RLIBs        |  NEW   |   OLD     |
|--------------|--------|-----------|
|libstd        | 8.8 MB |  10.5 MB  |
|libcore       |15.6 MB |   19.7 MB |
|libcollections| 3.7 MB |    4.8 MB |
|librustc      |34.0 MB |   37.8 MB |
|libsyntax     |28.3 MB |   32.1 MB |

| SOs           |     NEW   |    OLD |
|---------------|-----------|--------|
| libstd        |  4.8 MB   | 5.1 MB |
| librustc      |  8.6 MB   | 9.2 MB |
| libsyntax     |  7.8 MB   | 8.4 MB |

At least this should make up for the size increase caused recently by also storing MIR in crate metadata.

Can this be a breaking change for anyone?
cc @rust-lang/compiler
2015-12-31 18:52:20 +02:00
Simonas Kazlauskas
ad3371aedb Rollup merge of #30365 - tamird:update-valgrind, r=pnkfelix
Since `darwin` is really `apple-darwin`, the valgrind-rpass tests were not actually being run with valgrind on mac before. Also, the `HOST` check was completely wrong.

r? @alexcrichton
2015-12-31 18:52:19 +02:00
bors
3b6a851db5 Auto merge of #30644 - tshepang:typo, r=steveklabnik 2015-12-31 15:12:07 +00:00
bors
8aee5826f9 Auto merge of #30593 - steveklabnik:small_rc_refactoring, r=Gankro
This hairy conditional doesn't need to be so. It _does_ need to be a
thin pointer, otherwise, it will fail to compile, so let's pull that out
into a temporary for future readers of the source.

/cc @nrc @SimonSapin @Gankro @durka , who brought this up on IRC
2015-12-31 11:42:16 +00:00
bors
7f3201d131 Auto merge of #30641 - tsion:match-range, r=eddyb
The previous version using `PartialOrd::le` was broken since it passed `T` arguments where `&T` was expected.

It makes sense to use primitive comparisons since range patterns can only be used with chars and numeric types.

r? @eddyb
2015-12-31 09:40:02 +00:00
bors
f73c0a82ec Auto merge of #30598 - est31:macro_export_help_note, r=Manishearth
The current help message is too much about "normal" macros to be used
as general message. Keep it for normal macros, and add custom help and
error messages for macro definitions.
2015-12-31 06:16:12 +00:00
bors
19a351c776 Auto merge of #30586 - nagisa:mir-cast, r=arielb1
I think that should pretty much conclude all of https://github.com/rust-lang/rust/issues/29576.
2015-12-31 03:01:00 +00:00
bors
5892852168 Auto merge of #30585 - Ms2ger:ExplicitSelfCategory, r=brson 2015-12-31 01:12:38 +00:00
bors
2370d461a6 Auto merge of #30375 - aaronkeen:issue_28777, r=eddyb
RESTRICTION_STMT_EXPR restriction to allow subsequent expressions to
contain braces.

https://github.com/rust-lang/rust/issues/28777
2015-12-30 23:20:12 +00:00
Dave Huseby
0bd29f8461 Merge pull request #30643 from dhuseby/snaps_2015-12-18-3391630
Fixes #30521 and #30627 by adding new snapshots
edunham uploaded the snapshots.
2015-12-30 14:33:33 -08:00
bors
682cfc5187 Auto merge of #30467 - shahn:master, r=brson
This adds a constructor for a Weak that can never be upgraded. These are
mostly useless, but for example are required when deserializing.
2015-12-30 19:37:53 +00:00
Tshepang Lekhonkhobe
c779e7b782 doc: missed these in a4da9ac 2015-12-30 21:01:42 +02:00
Tshepang Lekhonkhobe
2a7b6834d2 doc: fix grammar 2015-12-30 19:54:06 +02:00
Tshepang Lekhonkhobe
7097baf6ad doc: fix typo 2015-12-30 19:31:28 +02:00
Steve Klabnik
2cff12e0d6 Small refactoring to make this code more clear
This hairy conditional doesn't need to be so. It _does_ need to be a
thin pointer, otherwise, it will fail to compile, so let's pull that out
into a temporary for future readers of the source.

Also, after a discussion with @pnkfelix and @gankro, we don't need these
null checks anymore, as zero-on-drop has been gone for a while now.
2015-12-30 12:06:28 -05:00