]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #15265 : omasanori/rust/udp, r=alexcrichton
bors [Wed, 2 Jul 2014 09:21:39 +0000 (09:21 +0000)]
auto merge of #15265 : omasanori/rust/udp, r=alexcrichton

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`.

What do you think? If this makes sense, should I provide `recvfrom` and `sendto` deprecated methods just calling new methods for compatibility?

10 years agoauto merge of #15257 : erickt/rust/hashmap, r=alexcrichton
bors [Wed, 2 Jul 2014 07:31:41 +0000 (07:31 +0000)]
auto merge of #15257 : erickt/rust/hashmap, r=alexcrichton

While `HashMap::new` and `HashMap::with_capacity` were being initialized with a random `SipHasher`, it turns out that `HashMap::from_iter` was just using the default instance of `SipHasher`, which wasn't randomized. This closes that bug, and also inlines some important methods.

10 years agoauto merge of #15085 : brson/rust/stridx, r=alexcrichton
bors [Wed, 2 Jul 2014 05:41:30 +0000 (05:41 +0000)]
auto merge of #15085 : brson/rust/stridx, r=alexcrichton

Being able to index into the bytes of a string encourages
poor UTF-8 hygiene. To get a view of `&[u8]` from either
a `String` or `&str` slice, use the `as_bytes()` method.

Closes #12710.

[breaking-change]

If the diffstat is any indication this shouldn't have a huge impact but it will have some. Most changes in the `str` and `path` module. A lot of the existing usages were in tests where ascii is expected. There are a number of other legit uses where the characters are known to be ascii.

10 years agoauto merge of #15069 : luqmana/rust/cia, r=pcwalton
bors [Wed, 2 Jul 2014 03:56:29 +0000 (03:56 +0000)]
auto merge of #15069 : luqmana/rust/cia, r=pcwalton

Fixes #11205.

10 years agorustc: Remove `&str` indexing from the language.
Brian Anderson [Fri, 20 Jun 2014 01:22:33 +0000 (18:22 -0700)]
rustc: Remove `&str` indexing from the language.

Being able to index into the bytes of a string encourages
poor UTF-8 hygiene. To get a view of `&[u8]` from either
a `String` or `&str` slice, use the `as_bytes()` method.

Closes #12710.

[breaking-change]

10 years agoauto merge of #15229 : steveklabnik/rust/if, r=cmr
bors [Wed, 2 Jul 2014 02:11:31 +0000 (02:11 +0000)]
auto merge of #15229 : steveklabnik/rust/if, r=cmr

Whew. So much here! Feedback very welcome.

This is the first part where we actually start learning things. I'd like to think I struck a good balance of explaining enough details, without getting too bogged down, and without being confusing... but of course I'd think that. :wink:

As I mention in the commit comment, We probably want to move the guessing game to the rust-lang org, rather than just having it on my GitHub. Or, I could put the code inline. I think it'd be neat to have it as a project, so people can pull it down with Cargo. Until we make that decision, I'll just leave this here.

10 years agoGuide: variable bindings.
Steve Klabnik [Fri, 27 Jun 2014 22:51:04 +0000 (18:51 -0400)]
Guide: variable bindings.

Whew! Who knew there was so much to say about variables.

We probably want to move the guessing game to the rust-lang org, rather than
just having it on my GitHub. Or, I could put the code inline. I think it'd be
neat to have it as a project, so people can pull it down with Cargo. Until we
make that decision, I'll just leave this here.

10 years agoauto merge of #15295 : TeXitoi/rust/relicense-shootout-mandelbrot, r=brson
bors [Wed, 2 Jul 2014 00:21:36 +0000 (00:21 +0000)]
auto merge of #15295 : TeXitoi/rust/relicense-shootout-mandelbrot, r=brson

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

@brson OK?

10 years agoAdd `recvfrom` and `sendto`.
OGINO Masanori [Mon, 30 Jun 2014 23:34:18 +0000 (08:34 +0900)]
Add `recvfrom` and `sendto`.

We leave them for compatibility, but mark them as deprecated.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
10 years agoRename recvfrom -> recv_from, sendto -> send_to.
OGINO Masanori [Mon, 30 Jun 2014 03:08:27 +0000 (12:08 +0900)]
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>
10 years agoauto merge of #15292 : alxgnon/rust/vim_syntax_cleanup, r=cmr
bors [Tue, 1 Jul 2014 21:26:33 +0000 (21:26 +0000)]
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.

10 years agoauto merge of #15251 : AlisdairO/rust/master, r=alexcrichton
bors [Tue, 1 Jul 2014 19:37:17 +0000 (19:37 +0000)]
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.

10 years agoauto merge of #15308 : brson/rust/intro, r=alexcrichton
bors [Tue, 1 Jul 2014 17:51:41 +0000 (17:51 +0000)]
auto merge of #15308 : brson/rust/intro, r=alexcrichton

This was asked on HN, and it's easy to clarify.

10 years agodoc: Clarify that an error is a compiler error
Brian Anderson [Tue, 1 Jul 2014 17:46:29 +0000 (10:46 -0700)]
doc: Clarify that an error is a compiler error

This was asked on HN, and it's easy to clarify.

10 years agoImprove rustdocs for Rc, add examples
Alisdair Owens [Sun, 29 Jun 2014 15:33:42 +0000 (16:33 +0100)]
Improve rustdocs for Rc, add examples

10 years agoRe-arrange TOC.
Steve Klabnik [Fri, 27 Jun 2014 21:31:28 +0000 (17:31 -0400)]
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.

10 years agoauto merge of #15301 : jasonthompson/rust/docs/str2, r=alexcrichton
bors [Tue, 1 Jul 2014 14:41:48 +0000 (14:41 +0000)]
auto merge of #15301 : jasonthompson/rust/docs/str2, r=alexcrichton

10 years agoAdd examples for from_utf8_owned, from_char, from_chars, from_byte
Jason Thompson [Mon, 30 Jun 2014 18:53:04 +0000 (14:53 -0400)]
Add examples for from_utf8_owned, from_char, from_chars, from_byte

10 years agostd: move the hash docstring over to std::hash.
Erick Tryzelaar [Tue, 1 Jul 2014 14:29:16 +0000 (07:29 -0700)]
std: move the hash docstring over to std::hash.

10 years agoauto merge of #15289 : aturon/rust/libstd-stability, r=alexcrichton
bors [Tue, 1 Jul 2014 10:11:34 +0000 (10:11 +0000)]
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.

10 years agoauto merge of #15288 : brson/rust/cleanslice, r=alexcrichton
bors [Tue, 1 Jul 2014 08:21:33 +0000 (08:21 +0000)]
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.

10 years agorelicense shootout-mandelbrot.rs
Guillaume Pinot [Tue, 1 Jul 2014 08:00:27 +0000 (10:00 +0200)]
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

10 years agoauto merge of #15263 : aturon/rust/rustdoc-stability-index, r=alexcrichton
bors [Tue, 1 Jul 2014 06:31:35 +0000 (06:31 +0000)]
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.

10 years agolibstd: set baseline stability levels.
Aaron Turon [Tue, 1 Jul 2014 00:22:40 +0000 (17:22 -0700)]
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.

10 years agorustdoc: incorporate stability index throughout
Aaron Turon [Thu, 26 Jun 2014 18:37:39 +0000 (11:37 -0700)]
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.

10 years agoVim syntax file types and traits cleanup
Alexandre Gagnon [Tue, 1 Jul 2014 04:52:51 +0000 (00:52 -0400)]
Vim syntax file types and traits cleanup

10 years agoauto merge of #15281 : alexcrichton/rust/show-for-show, r=kballard
bors [Tue, 1 Jul 2014 04:41:32 +0000 (04:41 +0000)]
auto merge of #15281 : alexcrichton/rust/show-for-show, r=kballard

This makes printing a `Show` trait object much easier.

10 years agoauto merge of #15242 : pcwalton/rust/self-in-trait-methods, r=alexcrichton
bors [Tue, 1 Jul 2014 02:51:33 +0000 (02:51 +0000)]
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

10 years agolibrustc: Permit by-value-self methods to be invoked on objects
Patrick Walton [Sat, 28 Jun 2014 19:55:17 +0000 (12:55 -0700)]
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.

10 years agoauto merge of #15271 : jasonthompson/rust/docs/str, r=huonw
bors [Tue, 1 Jul 2014 01:01:36 +0000 (01:01 +0000)]
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?

10 years agoauto merge of #15247 : smenardpw/rust/patch-1, r=alexcrichton
bors [Mon, 30 Jun 2014 23:06:35 +0000 (23:06 +0000)]
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.

10 years agocore: Remove the unnecessary 'traits' module from 'slice'
Brian Anderson [Mon, 30 Jun 2014 22:43:13 +0000 (15:43 -0700)]
core: Remove the unnecessary 'traits' module from 'slice'

This is only breaking for code that references the empty `slice::traits`
module.

[breaking-change]

10 years agocore: Reorganize slice module.
Brian Anderson [Mon, 30 Jun 2014 20:58:53 +0000 (13:58 -0700)]
core: Reorganize slice module.

This is just moving things around so they are defined in a logical order.

10 years agoauto merge of #15238 : aochagavia/rust/json, r=alexcrichton
bors [Mon, 30 Jun 2014 21:16:32 +0000 (21:16 +0000)]
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]

10 years agoImplement ToJson for all tuples
Adolfo Ochagavía [Sun, 29 Jun 2014 09:33:45 +0000 (11:33 +0200)]
Implement ToJson for all tuples

10 years agoFix issues in librustdoc
Adolfo Ochagavía [Sat, 28 Jun 2014 17:28:29 +0000 (19:28 +0200)]
Fix issues in librustdoc

10 years agoFix issue with tests
Adolfo Ochagavía [Sat, 28 Jun 2014 15:27:29 +0000 (17:27 +0200)]
Fix issue with tests

10 years agoFix issues in libtest
Adolfo Ochagavía [Sat, 28 Jun 2014 14:37:28 +0000 (16:37 +0200)]
Fix issues in libtest

10 years agoFix JSON documentation
Adolfo Ochagavía [Sat, 28 Jun 2014 13:59:45 +0000 (15:59 +0200)]
Fix JSON documentation

Fixed some errors, removed some code examples and added usage of the
`encode` and `decode` functions.

10 years agoImplement FromStr for Json
Adolfo Ochagavía [Sat, 28 Jun 2014 13:39:49 +0000 (15:39 +0200)]
Implement FromStr for Json

10 years agoAdd `encode` and `decode` shortcut functions
Adolfo Ochagavía [Sat, 28 Jun 2014 13:33:37 +0000 (15:33 +0200)]
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]

10 years agoRemoved unnecessary Box
Adolfo Ochagavía [Sat, 28 Jun 2014 12:41:40 +0000 (14:41 +0200)]
Removed unnecessary Box

10 years agoJSON cleanup
Adolfo Ochagavía [Sat, 28 Jun 2014 12:34:58 +0000 (14:34 +0200)]
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

10 years agoAdd `impl Show for &Show`
Alex Crichton [Mon, 30 Jun 2014 19:33:37 +0000 (12:33 -0700)]
Add `impl Show for &Show`

This makes printing a `Show` trait object much easier.

10 years agoauto merge of #14613 : schmee/rust/utf16-iterator, r=huonw
bors [Mon, 30 Jun 2014 19:26:35 +0000 (19:26 +0000)]
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

10 years agoAdd `utf16_units`
John Schmidt [Sat, 31 May 2014 11:02:29 +0000 (13:02 +0200)]
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]

10 years agoauto merge of #15275 : sfackler/rust/distcheck, r=alexcrichton
bors [Mon, 30 Jun 2014 16:36:33 +0000 (16:36 +0000)]
auto merge of #15275 : sfackler/rust/distcheck, r=alexcrichton

libcoretest wasn't being included which broke the verification of the
tarball.

10 years agoadd example for from_byte() documenation
Jason Thompson [Mon, 30 Jun 2014 10:38:47 +0000 (06:38 -0400)]
add example for from_byte() documenation

10 years agoFix distcheck
Steven Fackler [Mon, 30 Jun 2014 16:13:09 +0000 (09:13 -0700)]
Fix distcheck

libcoretest wasn't being included which broke the verification of the
tarball.

10 years agoauto merge of #15267 : ruud-v-a/rust/patch-1, r=huonw
bors [Mon, 30 Jun 2014 14:06:31 +0000 (14:06 +0000)]
auto merge of #15267 : ruud-v-a/rust/patch-1, r=huonw

[This commit](https://github.com/rust-lang/rust/commit/25fe2cadb10db1a54cefbd1520708d4397874bc3#diff-04c6e90faac2675aa89e2176d2eec7d8R57) forgot to remove one line.

10 years agostd: micro optimize Hash{Map,Set}::{new,with_capacity}
Erick Tryzelaar [Mon, 23 Jun 2014 23:48:09 +0000 (19:48 -0400)]
std: micro optimize Hash{Map,Set}::{new,with_capacity}

10 years agostd: make sure HashMap from_iter uses random initialization by default
Erick Tryzelaar [Mon, 23 Jun 2014 23:15:40 +0000 (19:15 -0400)]
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.

10 years agoauto merge of #15259 : steveklabnik/rust/patch-3, r=alexcrichton
bors [Mon, 30 Jun 2014 12:16:30 +0000 (12:16 +0000)]
auto merge of #15259 : steveklabnik/rust/patch-3, r=alexcrichton

It wasn't clear if we needed to install Hello World or Cargo.

10 years agoauto merge of #15262 : zecozephyr/rust/15620, r=luqmana
bors [Mon, 30 Jun 2014 10:26:28 +0000 (10:26 +0000)]
auto merge of #15262 : zecozephyr/rust/15620, r=luqmana

Fixes #15260

10 years agofix typo in readme
Ruud van Asseldonk [Mon, 30 Jun 2014 09:17:25 +0000 (11:17 +0200)]
fix typo in readme

10 years agoauto merge of #15237 : zzmp/rust/feat/markdown-in-crate-documentation, r=huonw
bors [Mon, 30 Jun 2014 07:31:29 +0000 (07:31 +0000)]
auto merge of #15237 : zzmp/rust/feat/markdown-in-crate-documentation, r=huonw

This makes the `in-header`, `markdown-before-content`, and `markdown-after-content` options available to `rustdoc` when generating documentation for any crate.

Before, these options were only available when creating documentation *from* markdown. Now, they are available when generating documentation from source.

This also updates the `rustdoc -h` output to reflect these changes. It does not update the `man rustdoc` page, nor does it update the documentation in [the `rustdoc` manual](http://doc.rust-lang.org/rustdoc.html).

10 years agoAllow external html in rustdoc for crates.
zzmp [Sat, 28 Jun 2014 10:35:25 +0000 (03:35 -0700)]
Allow external html in rustdoc for crates.

Updated documentation to reflect md->html.
Modularized external file loading.

10 years agoLittle typo fix
smenardpw [Sun, 29 Jun 2014 07:55:14 +0000 (09:55 +0200)]
Little typo fix

- ./hello_world which is not recognized on Windows fixed.
- .exe extension added.
- Little rewriting.

10 years agolibrustc: Don't ICE on binding same field multiple times in struct
Jonathan Bailey [Mon, 30 Jun 2014 05:29:33 +0000 (22:29 -0700)]
librustc: Don't ICE on binding same field multiple times in struct
pattern.

10 years agoauto merge of #15030 : sfackler/rust/partial-cmp, r=huonw
bors [Mon, 30 Jun 2014 05:36:25 +0000 (05:36 +0000)]
auto merge of #15030 : sfackler/rust/partial-cmp, r=huonw

I ended up altering the semantics of Json's PartialOrd implementation.
It used to be the case that Null < Null, but I can't think of any reason
for an ordering other than the default one so I just switched it over to
using the derived implementation.

This also fixes broken `PartialOrd` implementations for `Vec` and
`TreeMap`.

# Note
This isn't ready to merge yet since libcore tests are broken as you end up with 2 versions of `Option`. The rest should be reviewable though.

RFC: 0028-partial-cmp

10 years agoImplement RFC#28: Add PartialOrd::partial_cmp
Steven Fackler [Wed, 18 Jun 2014 06:25:51 +0000 (23:25 -0700)]
Implement RFC#28: Add PartialOrd::partial_cmp

I ended up altering the semantics of Json's PartialOrd implementation.
It used to be the case that Null < Null, but I can't think of any reason
for an ordering other than the default one so I just switched it over to
using the derived implementation.

This also fixes broken `PartialOrd` implementations for `Vec` and
`TreeMap`.

RFC: 0028-partial-cmp

10 years agoauto merge of #15256 : erickt/rust/optimizations, r=alexcrichton
bors [Mon, 30 Jun 2014 03:46:25 +0000 (03:46 +0000)]
auto merge of #15256 : erickt/rust/optimizations, r=alexcrichton

The bug #11084 causes `option::collect` and `result::collect` about twice as slower as it should because llvm is having some trouble optimizing away the scan closure. This gets rid of it so now those functions perform equivalent to a hand written version.

This also adds an impl of `Default` for `Rc` along the way.

10 years agoauto merge of #15254 : alex/rust/patch-1, r=alexcrichton
bors [Mon, 30 Jun 2014 01:56:26 +0000 (01:56 +0000)]
auto merge of #15254 : alex/rust/patch-1, r=alexcrichton

This makes the docs ever-so-slightly easier to read.

10 years agoit -> Cargo
Steve Klabnik [Mon, 30 Jun 2014 01:51:41 +0000 (21:51 -0400)]
it -> Cargo

It wasn't clear if we needed to install Hello World or Cargo.

10 years agoauto merge of #15245 : sfackler/rust/coretest, r=alexcrichton
bors [Sun, 29 Jun 2014 23:36:43 +0000 (23:36 +0000)]
auto merge of #15245 : sfackler/rust/coretest, r=alexcrichton

Libcore's test infrastructure is complicated by the fact that many lang
items are defined in the crate. The current approach (realcore/realstd
imports) is hacky and hard to work with (tests inside of core::cmp
haven't been run for months!).

Moving tests to a separate crate does mean that they can only test the
public API of libcore, but I don't feel that that is too much of an
issue. The only tests that I had to get rid of were some checking the
various numeric formatters, but those are also exercised through normal
format! calls in other tests.

10 years agoExtract tests from libcore to a separate crate
Steven Fackler [Sat, 28 Jun 2014 20:57:36 +0000 (13:57 -0700)]
Extract tests from libcore to a separate crate

Libcore's test infrastructure is complicated by the fact that many lang
items are defined in the crate. The current approach (realcore/realstd
imports) is hacky and hard to work with (tests inside of core::cmp
haven't been run for months!).

Moving tests to a separate crate does mean that they can only test the
public API of libcore, but I don't feel that that is too much of an
issue. The only tests that I had to get rid of were some checking the
various numeric formatters, but those are also exercised through normal
format! calls in other tests.

10 years agoauto merge of #15252 : alexcrichton/rust/issue-15231, r=pcwalton
bors [Sun, 29 Jun 2014 21:41:45 +0000 (21:41 +0000)]
auto merge of #15252 : alexcrichton/rust/issue-15231, r=pcwalton

When cloning a stream, the data is already guaranteed to be in a consistent
state, so there's no need to perform a zeroing. This prevents segfaults as seen
in #15231

Closes #15231

10 years agoauto merge of #15234 : pcwalton/rust/integer-fallback-and-casts, r=alexcrichton
bors [Sun, 29 Jun 2014 19:46:46 +0000 (19:46 +0000)]
auto merge of #15234 : pcwalton/rust/integer-fallback-and-casts, r=alexcrichton

This will break code that looks like:

    let mut x = 0;
    while ... {
        x += 1;
    }
    println!("{}", x);

Change that code to:

    let mut x = 0i;
    while ... {
        x += 1;
    }
    println!("{}", x);

Closes #15201.

[breaking-change]

r? @alexcrichton

10 years agocore: optimize {option,result}::collect
Erick Tryzelaar [Mon, 23 Jun 2014 23:27:54 +0000 (19:27 -0400)]
core: optimize {option,result}::collect

The bug #11084 causes these collect functions to run about
twice as slow as they should because llvm is having trouble
optimizing away the closure for some reason. This patch works
around that performance bug by using a simple adapter iterator
explicitly for capturing if the outer iterator returns an
error.

10 years agoalloc: impl Default for Rc
Erick Tryzelaar [Mon, 23 Jun 2014 23:09:19 +0000 (19:09 -0400)]
alloc: impl Default for Rc

10 years agocollections: minor cleanup
Erick Tryzelaar [Mon, 23 Jun 2014 23:01:03 +0000 (19:01 -0400)]
collections: minor cleanup

10 years agolibrustc: Remove the fallback to `int` for integers and `f64` for
Patrick Walton [Fri, 27 Jun 2014 19:30:25 +0000 (12:30 -0700)]
librustc: Remove the fallback to `int` for integers and `f64` for
floating point numbers for real.

This will break code that looks like:

    let mut x = 0;
    while ... {
        x += 1;
    }
    println!("{}", x);

Change that code to:

    let mut x = 0i;
    while ... {
        x += 1;
    }
    println!("{}", x);

Closes #15201.

[breaking-change]

10 years agoWrap two code examples in backticks
Alex Gaynor [Sun, 29 Jun 2014 18:11:03 +0000 (11:11 -0700)]
Wrap two code examples in backticks

This makes the docs ever-so-slightly easier to read.

10 years agoauto merge of #15246 : Sawyer47/rust/rand-doc-fix, r=alexcrichton
bors [Sun, 29 Jun 2014 17:51:39 +0000 (17:51 +0000)]
auto merge of #15246 : Sawyer47/rust/rand-doc-fix, r=alexcrichton

Documentation didn't match with parameter name.
Changes name of parameter in docs and function to 'amount'.

10 years agorustuv: Don't zero-out data on clones
Alex Crichton [Sun, 29 Jun 2014 16:38:07 +0000 (09:38 -0700)]
rustuv: Don't zero-out data on clones

When cloning a stream, the data is already guaranteed to be in a consistent
state, so there's no need to perform a zeroing. This prevents segfaults as seen
in #15231

Closes #15231

10 years agoauto merge of #15249 : aochagavia/rust/rand, r=huonw
bors [Sun, 29 Jun 2014 13:11:36 +0000 (13:11 +0000)]
auto merge of #15249 : aochagavia/rust/rand, r=huonw

10 years agoauto merge of #14904 : huonw/rust/cstr-remove-withref, r=alexcrichton
bors [Sun, 29 Jun 2014 11:21:39 +0000 (11:21 +0000)]
auto merge of #14904 : huonw/rust/cstr-remove-withref, r=alexcrichton

10 years agoc_str: move `.unwrap` & document it more clearly.
Huon Wilson [Sat, 14 Jun 2014 22:42:55 +0000 (08:42 +1000)]
c_str: move `.unwrap` & document it more clearly.

This should be called rarely, but it was placed first in the list of
methods, making it very tempting to call.

10 years agoc_str: replace .with_ref with .as_ptr throughout the codebase.
Huon Wilson [Sat, 14 Jun 2014 12:50:07 +0000 (22:50 +1000)]
c_str: replace .with_ref with .as_ptr throughout the codebase.

10 years agoc_str: add `.as_ptr` & `.as_mut_ptr` to replace `.with_[mut_]ref`.
Huon Wilson [Sat, 14 Jun 2014 12:46:50 +0000 (22:46 +1000)]
c_str: add `.as_ptr` & `.as_mut_ptr` to replace `.with_[mut_]ref`.

These forms return the pointer directly, rather than the added
indirection, indentation, and inefficiencies of the closures in
`.with_ref` and `.with_mut_ref`. The two closure functions are
deprecated.

Replace

    foo(c_str.with_ref(|p| p))

    c_str.with_ref(|p| {
        foo(p);
        bar(p);
    })

with

    foo(c_str.as_ptr())

    let p = c_str.as_ptr();
    foo(p);
    bar(p);

This change does mean that one has to be careful to avoid writing `let p
= x.to_c_str().as_ptr();` since the `CString` will be freed at the end
of the statement. Previously, `with_ref` was used (and `as_ptr` avoided)
for this reason, but Rust has strongly moved away from closures to more
RAII-style code, and most uses of `.with_ref` where in the form
`.with_ref(|p| p)` anyway, that is, they were exactly `.as_ptr`.

[breaking-change]

10 years agorand: Small fix in parameter name
Piotr Jawniak [Sun, 29 Jun 2014 07:32:19 +0000 (09:32 +0200)]
rand: Small fix in parameter name

Documentation didn't match with parameter name.
Changes name of parameter in docs and function to 'amount'.

10 years agoImpl Rand for tuples of arity 11 and 12
Adolfo Ochagavía [Sun, 29 Jun 2014 09:44:25 +0000 (11:44 +0200)]
Impl Rand for tuples of arity 11 and 12

10 years agolibrustc: Allow coercions through arrays.
Luqman Aden [Sat, 21 Jun 2014 04:16:14 +0000 (00:16 -0400)]
librustc: Allow coercions through arrays.

10 years agoauto merge of #15241 : arjantop/rust/maybeownedvector-improvements, r=alexcrichton
bors [Sun, 29 Jun 2014 00:31:30 +0000 (00:31 +0000)]
auto merge of #15241 : arjantop/rust/maybeownedvector-improvements, r=alexcrichton

10 years agoauto merge of #15210 : luqmana/rust/windoc, r=alexcrichton
bors [Sat, 28 Jun 2014 22:06:35 +0000 (22:06 +0000)]
auto merge of #15210 : luqmana/rust/windoc, r=alexcrichton

Getting rust to build on windows can be a bit annoying in setting up all the toolchains and whatnot. The whole process is made much easier by using msys2 so let's document that prominently right on the README.

10 years agoauto merge of #15208 : alexcrichton/rust/snapshots, r=pcwalton
bors [Sat, 28 Jun 2014 20:11:34 +0000 (20:11 +0000)]
auto merge of #15208 : alexcrichton/rust/snapshots, r=pcwalton

This change registers new snapshots, allowing `*T` to be removed from the language. This is a large breaking change, and it is recommended that if compiler errors are seen that any FFI calls are audited to determine whether they should be actually taking `*mut T`.

10 years agoRename all raw pointers as necessary
Alex Crichton [Wed, 25 Jun 2014 19:47:34 +0000 (12:47 -0700)]
Rename all raw pointers as necessary

10 years agoImplementation of common traits for MaybeOwnedVector
Arjan Topolovec [Sat, 28 Jun 2014 18:20:49 +0000 (20:20 +0200)]
Implementation of common traits for MaybeOwnedVector

10 years agoauto merge of #15191 : pcwalton/rust/variance-in-trait-matching, r=huonw
bors [Sat, 28 Jun 2014 18:21:34 +0000 (18:21 +0000)]
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

10 years agolibrustc: Match trait self types exactly.
Patrick Walton [Thu, 26 Jun 2014 01:18:13 +0000 (18:18 -0700)]
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]

10 years agoauto merge of #15214 : tbu-/rust/pr_doc_vecinsert, r=huonw
bors [Sat, 28 Jun 2014 14:31:37 +0000 (14:31 +0000)]
auto merge of #15214 : tbu-/rust/pr_doc_vecinsert, r=huonw

10 years agoAdd remark and an example about the bounds of `Vec::insert`
Tobias Bucher [Fri, 27 Jun 2014 08:51:56 +0000 (10:51 +0200)]
Add remark and an example about the bounds of `Vec::insert`

10 years agoauto merge of #15235 : Sawyer47/rust/issue-12552, r=huonw
bors [Sat, 28 Jun 2014 09:16:35 +0000 (09:16 +0000)]
auto merge of #15235 : Sawyer47/rust/issue-12552, r=huonw

Closes #12552

10 years agoAdd test for issue #12552
Piotr Jawniak [Sat, 28 Jun 2014 07:29:24 +0000 (09:29 +0200)]
Add test for issue #12552

Closes #12552

10 years agoauto merge of #15233 : jbclements/rust/match-var-hygiene-etc, r=cmr
bors [Sat, 28 Jun 2014 05:21:34 +0000 (05:21 +0000)]
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.

10 years agocomments only
John Clements [Fri, 27 Jun 2014 23:11:18 +0000 (16:11 -0700)]
comments only

10 years agoadjust fold to fold over interpolated items/exprs/etc.
John Clements [Fri, 27 Jun 2014 23:10:23 +0000 (16:10 -0700)]
adjust fold to fold over interpolated items/exprs/etc.

Closes #15221

10 years agolooks like a cut-n-paste error in unused code
John Clements [Fri, 27 Jun 2014 23:07:25 +0000 (16:07 -0700)]
looks like a cut-n-paste error in unused code

10 years agosimplified test case
John Clements [Fri, 27 Jun 2014 21:41:32 +0000 (14:41 -0700)]
simplified test case

10 years agoremoved incomplete comment
John Clements [Fri, 27 Jun 2014 21:12:13 +0000 (14:12 -0700)]
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.