Commit Graph

30788 Commits

Author SHA1 Message Date
OGINO Masanori
55f5a1ef59 Add recvfrom and sendto.
We leave them for compatibility, but mark them as deprecated.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-07-02 08:21:43 +09:00
OGINO Masanori
dfdce47988 Rename recvfrom -> recv_from, sendto -> send_to.
POSIX has recvfrom(2) and sendto(2), but their name seem not to be
suitable with Rust. We already renamed getpeername(2) and
getsockname(2), so I think it makes sense.

Alternatively, `receive_from` would be fine. However, we have `.recv()`
so I chose `recv_from`.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-07-02 08:21:42 +09:00
Patrick Walton
454b9d2d1f librustc: Fix expr_use_visitor (and, transitively, the borrow check)
with overloaded calls.

This enforces the mutability and borrow restrictions around overloaded
calls.

Closes #14774.

[breaking-change]
2014-07-01 14:32:57 -07:00
bors
44ec28cfac auto merge of #15292 : alxgnon/rust/vim_syntax_cleanup, r=cmr
- Fix a couple mistakes:
  - `Ordering` is an enum, not a trait.
  - `Container` is now named `Collection`.
  - Add missing `CheckedDiv`.
  - Remove obsolete `OwnedVector`.
- Reorganize some lines to match [prelude's arrangement](http://doc.rust-lang.org/std/prelude/#reexports), making mistakes easier to spot in the future.
2014-07-01 21:26:33 +00:00
bors
6d60956e58 auto merge of #15251 : AlisdairO/rust/master, r=alexcrichton
I've seen quite a bit of confusion around regarding the use of Rc, so I thought I'd take a stab at adding some examples.
2014-07-01 19:37:17 +00:00
Patrick Walton
8b272238f1 test: Add tests for issue #12223, "drop allowed while active borrows
still in scope".

This issue was fixed by PR #12828 and #5781. All that was left was to
add tests.

Closes #12223.
2014-07-01 11:47:21 -07:00
bors
efebeec6ca auto merge of #15308 : brson/rust/intro, r=alexcrichton
This was asked on HN, and it's easy to clarify.
2014-07-01 17:51:41 +00:00
Brian Anderson
d89577b5a2 doc: Clarify that an error is a compiler error
This was asked on HN, and it's easy to clarify.
2014-07-01 10:46:31 -07:00
Alisdair Owens
88008b3ad5 Improve rustdocs for Rc, add examples 2014-07-01 17:58:40 +01:00
Steve Klabnik
c90950ea60 Re-arrange TOC.
I'm going to move testing to be right AFTER the guessing game. I wanted it
to be borderline TDD, but I think that, since the first example is just one
file, it might be a bit overkill.

I'm doing this in its own commit to hopefully avoid merge conflicts.
2014-07-01 12:53:15 -04:00
bors
14c0b3ab42 auto merge of #15301 : jasonthompson/rust/docs/str2, r=alexcrichton 2014-07-01 14:41:48 +00:00
Jason Thompson
7e9bb8be77 Add examples for from_utf8_owned, from_char, from_chars, from_byte 2014-07-01 10:31:32 -04:00
Erick Tryzelaar
d90b71cff6 std: move the hash docstring over to std::hash. 2014-07-01 07:29:16 -07:00
bors
3deb2c1aa6 auto merge of #15289 : aturon/rust/libstd-stability, r=alexcrichton
Earlier commits have established a baseline of `experimental` stability
for all crates under the facade (so their contents are considered
experimental within libstd). Since `experimental` is `allow` by
default, we should use the same baseline stability for libstd itself.

This commit adds `experimental` tags to all of the modules defined in
`std`, and `unstable` to `std` itself.
2014-07-01 10:11:34 +00:00
bors
6ab7b6652e auto merge of #15288 : brson/rust/cleanslice, r=alexcrichton
This does two things:

* Reorganizes the declaration order to be more readable, less random.
* Removes the `slice::traits` module, a public module that does nothing but declare impls of `cmp` traits.
2014-07-01 08:21:33 +00:00
Guillaume Pinot
c9dcf8ce32 relicense shootout-mandelbrot.rs
Part of #14248

Main authors:
- @Ryman: OK
- @TeXitoi: OK
- @pcwalton: OK

Minor authors:
- @brson: OK
- @alexcrichton: OK
- @kballard: OK

Remark: @tedhorst was a main contributor, but its contribution
disapear with @pcwalton rewrite at af4ea11
2014-07-01 10:00:27 +02:00
bors
721b4cb5c5 auto merge of #15263 : aturon/rust/rustdoc-stability-index, r=alexcrichton
This commit hooks rustdoc into the stability index infrastructure in two
ways:

1. It looks up stability levels via the index, rather than by manual
attributes.

2. It adds stability level information throughout rustdoc output, rather
than just at the top header. In particular, a stability color (with
mouseover text) appears next to essentially every item that appears
in rustdoc's HTML output.

Along the way, the stability index code has been lightly refactored.
2014-07-01 06:31:35 +00:00
Aaron Turon
f7bb31a47a libstd: set baseline stability levels.
Earlier commits have established a baseline of `experimental` stability
for all crates under the facade (so their contents are considered
experimental within libstd). Since `experimental` is `allow` by
default, we should use the same baseline stability for libstd itself.

This commit adds `experimental` tags to all of the modules defined in
`std`, and `unstable` to `std` itself.
2014-06-30 22:49:18 -07:00
Aaron Turon
256df5e3df rustdoc: incorporate stability index throughout
This commit hooks rustdoc into the stability index infrastructure in two
ways:

1. It looks up stability levels via the index, rather than by manual
attributes.

2. It adds stability level information throughout rustdoc output, rather
than just at the top header. In particular, a stability color (with
mouseover text) appears next to essentially every item that appears
in rustdoc's HTML output.

Along the way, the stability index code has been lightly refactored.
2014-06-30 22:36:24 -07:00
Alexandre Gagnon
d6c988a669 Vim syntax file types and traits cleanup 2014-07-01 00:52:51 -04:00
bors
d968340671 auto merge of #15281 : alexcrichton/rust/show-for-show, r=kballard
This makes printing a `Show` trait object much easier.
2014-07-01 04:41:32 +00:00
bors
5cef1243a2 auto merge of #15242 : pcwalton/rust/self-in-trait-methods, r=alexcrichton
I can't believe this worked! I believe that the way the ABI and
immediates work mean that this Just Works.

Closes #10672.

r? @alexcrichton
2014-07-01 02:51:33 +00:00
Patrick Walton
68ead460f9 librustc: Permit by-value-self methods to be invoked on objects
referenced by boxes.

This is done by creating a shim function that handles the cleanup of the
box properly.

Closes #10672.
2014-06-30 18:43:31 -07:00
bors
90ab2f8b61 auto merge of #15271 : jasonthompson/rust/docs/str, r=huonw
I'm working on adding examples to the API documentation. Should future pull requests include examples for more than one function? Or is this about the right size for a pull request?
2014-07-01 01:01:36 +00:00
bors
db29e1b960 auto merge of #15247 : smenardpw/rust/patch-1, r=alexcrichton
./hello_world is not recognized on Windows.
We can type either hello_world or hello_world.exe to run the executable. I chose "hello_world.exe", which seems more conventional on Windows.
2014-06-30 23:06:35 +00:00
Brian Anderson
fa5bc6f1bd core: Remove the unnecessary 'traits' module from 'slice'
This is only breaking for code that references the empty `slice::traits`
module.

[breaking-change]
2014-06-30 15:44:36 -07:00
Brian Anderson
16a9258797 core: Reorganize slice module.
This is just moving things around so they are defined in a logical order.
2014-06-30 15:40:32 -07:00
bors
8bc286f998 auto merge of #15238 : aochagavia/rust/json, r=alexcrichton
### Breaking changes:

* **Removed unnecessary `box` from enum variant (`Object(Box<Object>)` becomes `Object(Object)`)**
* **Deprecated `Encoder::str_encode`**

### Other changes:

* Tried to make the code more idiomatic
* Renamed the `wr` field of the `Encoder` and `PrettyEncoder` structs to `writer`
* Replaced some `from_utf8` by `from_utf8_owned` to avoid unnecessary allocations
* Removed unnecessary `unsafe` code
* Added `encode` and `decode` shortcut functions
* Implemented `FromStr` for `Json`
* Implemented `ToJson` for tuples of arity up to 12
* Fixed some details in the documentation

### Questions

* ~~The `encode` shortcut function does the same as the `Encoder::str_encode` function. It seems wrong to me that two functions do exactly the same. Should we deprecate `Encoder::str_encode`?~~
* ~~Do we really want the ToJson trait for tuples? At the moment we have it for (), (A, B), (A, B, C). I would like to remove them.~~
* ~~We are using `String` as key in the `TreeMap` representing a `Json` object. It would be better to use `&str`, but this would require to annotate lots of lifetimes. Is there any easy solution for this?~~
* There is a lot of duplicated code (`PrettyEncoder` copies about 50 lines from `Encoder`). In an OO language this could be solved very elegantly by using inheritance and overriding. What can we do here to reduce the amount of boilerplate?

[breaking-change]
2014-06-30 21:16:32 +00:00
Adolfo Ochagavía
c3cf3b3fb1 Implement ToJson for all tuples 2014-06-30 21:35:50 +02:00
Adolfo Ochagavía
035914edcf Fix issues in librustdoc 2014-06-30 21:35:49 +02:00
Adolfo Ochagavía
fb96cbba41 Fix issue with tests 2014-06-30 21:35:49 +02:00
Adolfo Ochagavía
903759e611 Fix issues in libtest 2014-06-30 21:35:48 +02:00
Adolfo Ochagavía
2f16d9ef00 Fix JSON documentation
Fixed some errors, removed some code examples and added usage of the
`encode` and `decode` functions.
2014-06-30 21:35:47 +02:00
Adolfo Ochagavía
954c3234a0 Implement FromStr for Json 2014-06-30 21:35:47 +02:00
Adolfo Ochagavía
6ae5e92cc2 Add encode and decode shortcut functions
Now you can just use `json::encode` and `json::decode`, which is very
practical

**Deprecated `Encoder::str_encode` in favor of `json::encode`**

[breaking-change]
2014-06-30 21:35:46 +02:00
Adolfo Ochagavía
1e55dce0e4 Removed unnecessary Box 2014-06-30 21:35:46 +02:00
Adolfo Ochagavía
4c65a86571 JSON cleanup
* Tried to make the code more idiomatic
* Renamed the `wr` field of the `Encoder` and `PrettyEncoder` structs to `writer`
* Replaced some `from_utf8` by `from_utf8_owned` to avoid unnecessary allocations
* Removed unnecessary `unsafe` code
2014-06-30 21:35:45 +02:00
Alex Crichton
8bdc4b54a4 Add impl Show for &Show
This makes printing a `Show` trait object much easier.
2014-06-30 12:33:37 -07:00
bors
a345c54334 auto merge of #14613 : schmee/rust/utf16-iterator, r=huonw
Closes #14358.

~~The tests are not yet moved to `utf16_iter`, so this probably won't compile. I'm submitting this PR anyway so it can be reviewed and since it was mentioned in #14611.~~ EDIT: Tests now use `utf16_iter`.

This deprecates `.to_utf16`. `x.to_utf16()` should be replaced by either `x.utf16_iter().collect::<Vec<u16>>()` (the type annotation may be optional), or just `x.utf16_iter()` directly, if it can be used in an iterator context.

[breaking-change]

cc @huonw
2014-06-30 19:26:35 +00:00
John Schmidt
3d84b4be3d Add utf16_units
This deprecates `.to_utf16`. `x.to_utf16()` should be replaced by either
`x.utf16_units().collect::<Vec<u16>>()` (the type annotation may be optional), or
just `x.utf16_units()` directly, if it can be used in an iterator context.

Closes #14358

[breaking-change]
2014-06-30 18:50:32 +02:00
bors
94343da1bd auto merge of #15275 : sfackler/rust/distcheck, r=alexcrichton
libcoretest wasn't being included which broke the verification of the
tarball.
2014-06-30 16:36:33 +00:00
Jason Thompson
0bfcfcffa7 add example for from_byte() documenation 2014-06-30 12:30:05 -04:00
Steven Fackler
21dba11fec Fix distcheck
libcoretest wasn't being included which broke the verification of the
tarball.
2014-06-30 09:13:09 -07:00
Alex Crichton
8dff029f9d Updated release notes for 0.11.0 2014-06-30 07:25:58 -07:00
bors
04da31e64c auto merge of #15267 : ruud-v-a/rust/patch-1, r=huonw
[This commit](25fe2cadb1 (diff-04c6e90faac2675aa89e2176d2eec7d8R57)) forgot to remove one line.
2014-06-30 14:06:31 +00:00
Erick Tryzelaar
c1ff089c27 std: micro optimize Hash{Map,Set}::{new,with_capacity} 2014-06-30 06:57:05 -07:00
Erick Tryzelaar
8284ef63a5 std: make sure HashMap from_iter uses random initialization by default
It turns out that HashMap's from_iter implementation was being
initialized without the sip keys being randomized. This adds
a custom default hasher that should avoid this potential vulnerability.
2014-06-30 06:57:05 -07:00
bors
566b57f3de auto merge of #15259 : steveklabnik/rust/patch-3, r=alexcrichton
It wasn't clear if we needed to install Hello World or Cargo.
2014-06-30 12:16:30 +00:00
bors
287dcb77b3 auto merge of #15262 : zecozephyr/rust/15620, r=luqmana
Fixes #15260
2014-06-30 10:26:28 +00:00
Ruud van Asseldonk
9df25449f2 fix typo in readme 2014-06-30 11:17:25 +02:00