Commit Graph

39949 Commits

Author SHA1 Message Date
Manish Goregaokar
c7392be968 Rollup merge of #23468 - sfackler:stdio-panic, r=alexcrichton
Nothing inside of the read/write interface itself can panic, so any
poison must have been the result of user code which the lock isn't
protecting.

This seems safe to me, but if we don't want to go this route we should update the docs to indicate that these methods can panic.

r? @alexcrichton
2015-03-19 08:24:36 +05:30
Manish Goregaokar
05354e8522 Rollup merge of #23462 - alexcrichton:stabilize-cloned, r=aturon
This commit stabilizes the `cloned` iterator after tweaking the signature to
require that the iterator is over `&T` instead of `U: Deref<T>`. This method has
had time to bake for awhile now and it's not clear whether the `Deref` bound is
worth it. Additionally, there aren't clear conventions on when to bound and/or
implement the `Deref` trait, so for now the conservative route is to require
references instead of `U: Deref<T>`.

To change this signature to using `Deref` would technically be a
backwards-incompatible change, but it is doubtful that any code will actually
break in practice.
2015-03-19 08:24:36 +05:30
Manish Goregaokar
48df3fb678 Rollup merge of #23457 - nagisa:get-set-resources, r=alexcrichton
Hopefully didn’t miss or mess up anything.

~~EDIT: ah, as usual, just didn’t bother running build before pushing a submit request button. Build pending.~~
2015-03-19 08:24:35 +05:30
bors
12cb7c6a28 Auto merge of #23482 - alexcrichton:snapshots, r=aturon 2015-03-19 00:17:00 +00:00
Alex Crichton
fccf5a0005 Register new snapshots 2015-03-18 16:32:32 -07:00
bors
94a95067e0 Auto merge of #23473 - Manishearth:rollup, r=Manishearth 2015-03-18 17:32:13 +00:00
Manish Goregaokar
2a106d68f4 Rollup merge of #23428 - Manishearth:ast-doc, r=huon
I often have to run `ast-json` or look into the pretty-printer source to figure out what the fields of an AST enum mean. I've tried to document most of what I know (and some semi-obvious stuff).

r? @steveklabnik

f? @eddyb
2015-03-18 22:21:09 +05:30
Manish Goregaokar
e245e65ef8 Rollup merge of #23455 - Ryman:trim_matches_doc, r=steveklabnik 2015-03-18 22:21:08 +05:30
Manish Goregaokar
c341fe9f8c Rollup merge of #23450 - alexcrichton:fix-sockaddr-storage, r=brson
The alignment field is actually a \"pointer sized\" type instead of always i64,
requiring that the size of the padding field is also calculated slightly
differently.

Closes #23425
2015-03-18 22:21:08 +05:30
Manish Goregaokar
51bc2f1f37 Rollup merge of #23443 - meqif:ipv6addr-new-documentation-fix, r=steveklabnik
Very minor fix: in `std::net::Ipv6Addr::new`, the documentation had an incomplete representation of the resulting address, missing the last two groups.
2015-03-18 22:21:07 +05:30
Manish Goregaokar
dda42204be Rollup merge of #23392 - WiSaGaN:bugfix/fix_deprecate_link, r=Manishearth
Since module `std::sync::mpsc` is stable now, fix the deprecated link `comm` with `sync::mpsc`.
2015-03-18 22:21:07 +05:30
Manish Goregaokar
a7eca31d80 Rollup merge of #23467 - andersk:loop-labeled-break-value, r=sanxiyn
Closes #23451.
2015-03-18 22:21:07 +05:30
Manish Goregaokar
181441cf66 Rollup merge of #23461 - alexcrichton:feat-char-at, r=aturon
This commit clarifies some of the unstable features in the `str` module by
moving them out of the blanket `core` and `collections` features.

The following methods were moved to the `str_char` feature which generally
encompasses decoding specific characters from a `str` and dealing with the
result. It is unclear if any of these methods need to be stabilized for 1.0 and
the most conservative route for now is to continue providing them but to leave
them as unstable under a more specific name.

* `is_char_boundary`
* `char_at`
* `char_range_at`
* `char_at_reverse`
* `char_range_at_reverse`
* `slice_shift_char`

The following methods were moved into the generic `unicode` feature as they are
specifically enabled by the `unicode` crate itself.

* `nfd_chars`
* `nfkd_chars`
* `nfc_chars`
* `graphemes`
* `grapheme_indices`
* `width`
2015-03-18 22:21:06 +05:30
Steven Fackler
a51cd61164 Add a test 2015-03-18 09:03:17 -07:00
Manish Goregaokar
a5828ff7b0 Address huon's comments 2015-03-18 18:06:10 +05:30
Manish Goregaokar
13881df1b2 Clarify Expr 2015-03-18 17:54:57 +05:30
Manish Goregaokar
edf65c43f6 ast: Document Item and ForeignItem 2015-03-18 17:54:57 +05:30
Manish Goregaokar
084f3bcfd4 ast: Document Lit 2015-03-18 17:54:57 +05:30
Manish Goregaokar
b08d5eee6a ast: Document Pat and Block 2015-03-18 17:54:57 +05:30
Manish Goregaokar
1debe9d112 ast: Document paths and where clauses 2015-03-18 17:54:57 +05:30
Manish Goregaokar
c42067c9e9 ast: Document Expr_, UnOp, and BinOp 2015-03-18 17:54:57 +05:30
Simonas Kazlauskas
2d701e6b19 Add {get,set}rlimit and getrusage to libc 2015-03-18 13:10:29 +02:00
bors
46f649c479 Auto merge of #22838 - petrochenkov:bytelit, r=alexcrichton
This patch changes the type of byte string literals from `&[u8]` to `&[u8; N]`.
It also implements some necessary traits (`IntoBytes`, `Seek`, `Read`, `BufRead`) for fixed-size arrays (also related to #21725) and adds test for #17233, which seems to be resolved.

Fixes #18465
[breaking-change]
2015-03-18 08:27:22 +00:00
Vadim Petrochenkov
dccd17d23e Remove the newly introduced trait impls for fixed-size arrays and use &b"..."[..] instead. 2015-03-18 09:16:08 +03:00
Steven Fackler
2e8e8ab564 Ignore stdio mutex poison state
Nothing inside of the read/write interface itself can panic, so any
poison must have been the result of user code which the lock isn't
protecting.
2015-03-17 23:05:44 -07:00
bors
f9a7bc58f8 Auto merge of #23290 - nrc:pub_priv_mod, r=nikomatsakis
Closes #22261

r? @nikomatsakis 

(+ a new test coming soon...)
2015-03-18 05:55:19 +00:00
Anders Kaseorg
7364022e7a Infer type ! for a loop that can only break out of other loops
Closes #23451.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-03-18 01:29:23 -04:00
Nick Cameron
46aa621452 Fix private module loophole in the 'private type in public item' check 2015-03-18 16:47:24 +13:00
bors
c10918905f Auto merge of #23452 - nikomatsakis:unsafety-subtyping, r=nrc
Safe fns are no longer subtypes of unsafe fns, but you can coerce from one to the other.

This is a [breaking-change] in that impl fns must now be declared `unsafe` if the trait is declared `unsafe`. In some rare cases, the subtyping change may also direct affect you, but no such cases were encountered in practice.

Fixes #23449.

r? @nrc
2015-03-18 03:22:12 +00:00
Alex Crichton
7c333e99bf std: Stabilize IteratorExt::cloned
This commit stabilizes the `cloned` iterator after tweaking the signature to
require that the iterator is over `&T` instead of `U: Deref<T>`. This method has
had time to bake for awhile now and it's not clear whether the `Deref` bound is
worth it. Additionally, there aren't clear conventions on when to bound and/or
implement the `Deref` trait, so for now the conservative route is to require
references instead of `U: Deref<T>`.

To change this signature to using `Deref` would technically be a
backwards-incompatible change, but it is doubtful that any code will actually
break in practice.
2015-03-17 18:05:58 -07:00
Alex Crichton
aa88da6317 std: Tweak some unstable features of str
This commit clarifies some of the unstable features in the `str` module by
moving them out of the blanket `core` and `collections` features.

The following methods were moved to the `str_char` feature which generally
encompasses decoding specific characters from a `str` and dealing with the
result. It is unclear if any of these methods need to be stabilized for 1.0 and
the most conservative route for now is to continue providing them but to leave
them as unstable under a more specific name.

* `is_char_boundary`
* `char_at`
* `char_range_at`
* `char_at_reverse`
* `char_range_at_reverse`
* `slice_shift_char`

The following methods were moved into the generic `unicode` feature as they are
specifically enabled by the `unicode` crate itself.

* `nfd_chars`
* `nfkd_chars`
* `nfc_chars`
* `graphemes`
* `grapheme_indices`
* `width`
2015-03-17 18:03:03 -07:00
bors
1ae32decb8 Auto merge of #23438 - nikomatsakis:issue-23435-default-methods-with-where-clauses, r=nrc
Fixes #23435
2015-03-18 00:51:03 +00:00
Vadim Petrochenkov
d2cccd07bc Fix byte string literal patterns in match 2015-03-18 00:40:59 +03:00
Vadim Petrochenkov
3c31794d31 Avoid metadata bloat by using trait FixedSizeArray 2015-03-18 00:40:59 +03:00
Vadim Petrochenkov
b98255cbd2 Add and fix more tests 2015-03-18 00:40:59 +03:00
Vadim Petrochenkov
1e9bef916f Fixed-size byte string literals (RFC 339) 2015-03-18 00:40:59 +03:00
Niko Matsakis
0947f4076d Move unsafety out of the subtyping relation and into coercion. 2015-03-17 17:29:07 -04:00
bors
ea8b82e90c Auto merge of #23376 - eddyb:die-tydesc-die, r=nikomatsakis
Final remnant of reflection is gone. Also, virtual `Trait` destructors are no longer tied to `Box`.
That means they can be used to drop any instance of the type (used in libarena to replace TyDesc).

This is [breaking-change] for direct users of intrinsics:
* use `intrinsics::type_name::<T>()` instead of `(*intrinsics::get_tydesc::<T>()).name`
* the only way to get the destructor is from a trait object's vtable (see libarena changes)

r? @pcwalton f? @dotdash
2015-03-17 21:23:02 +00:00
Kevin Butler
34c48db837 Fix documentation for StrExt::trim_matches 2015-03-17 20:37:20 +00:00
Niko Matsakis
1b0f0ad280 Extract out mts into combine using tys_with_variance 2015-03-17 15:57:30 -04:00
Eduard Burtescu
e256b7f049 Replace TyDesc and its uses with trait vtables and a type_name intrinsic. 2015-03-17 21:00:23 +02:00
Eduard Burtescu
3e98ab560a rustc_trans: use the drop glue of T instead of Box<T> in Trait's vtable, be it &Trait or Box<Trait>. 2015-03-17 21:00:21 +02:00
Alex Crichton
71982c2124 libc: Fix definition of sockaddr_storage on 32-bit linux
The alignment field is actually a "pointer sized" type instead of always i64,
requiring that the size of the padding field is also calculated slightly
differently.

Closes #23425
2015-03-17 10:33:13 -07:00
bors
bfac337daa Auto merge of #23330 - alexcrichton:thread-sleep, r=aturon
This function is the current replacement for `std::old_io::timer` which will
soon be deprecated. This function is unstable and has its own feature gate as it
does not yet have an RFC nor has it existed for very long.
2015-03-17 17:15:54 +00:00
Alex Crichton
04cf534411 std: Implement thread::sleep
This function is the current replacement for `std::old_io::timer` which will
soon be deprecated. This function is unstable and has its own feature gate as it
does not yet have an RFC nor has it existed for very long.
2015-03-17 09:34:42 -07:00
Ricardo Martins
730defc9d1 Fix IPv6 address format in documentation
Very minor fix: in `std::net::Ipv6Addr::new`, the documentation had an incomplete representation of the resulting address, missing the last two groups.
2015-03-17 14:56:27 +00:00
bors
c64d671671 Auto merge of #23423 - nikomatsakis:issue-18737-trait-subtyping, r=nrc
This upcast coercion currently never requires vtable changes. It should be generalized. 

This is a [breaking-change] -- if you have an impl on an object type like `impl SomeTrait`, then this will no longer be applicable to object types like `SomeTrait+Send`. In the standard library, this primarily affected `Any`, and this PR adds impls for `Any+Send` as to keep the API the same in practice. An alternate workaround is to use UFCS form or standalone fns. For more details, see <https://github.com/rust-lang/rust/issues/18737#issuecomment-78450798>.

r? @nrc
2015-03-17 13:29:48 +00:00
Niko Matsakis
277b4f035a Fix soundness hole when unsizing boxes. 2015-03-17 08:34:25 -04:00
Niko Matsakis
5f5ed62298 Remove subtyping for object types and replace with an *upcast* coercion.
This upcast coercion currently preserves the vtable for the object, but
eventually it can be used to create a derived vtable. The upcast
coercion is not introduced into method dispatch; see comment on #18737
for information about why. Fixes #18737.
2015-03-17 08:34:25 -04:00
Niko Matsakis
bd2096c497 Only test predicates if this is a default method, as a simple optimization. 2015-03-17 07:36:42 -04:00