Commit Graph

43592 Commits

Author SHA1 Message Date
Steve Gury
bef936111d Update iterators.md
Fix the actual off by one
2015-05-31 10:24:30 -07:00
Steve Gury
4425422bdd Fix off by one in the iterator documentation
`(1..100).map(|x| x + 1)` is actually mapping [1,100) to [2,101)
2015-05-31 07:32:21 -07:00
Mathieu David
6e2f18ef32 Add loopcounter section to the for-loop chapter
Sometimes loop counters are useful and we should show new users how it is achieved in Rust.
2015-05-31 14:03:57 +02:00
FuGangqiang
bdef7faaba trpl:add missing comma 2015-05-31 18:16:58 +08:00
bors
243e85f393 Auto merge of #25921 - eddyb:inline-calculate-offsets, r=Aatch
The `HashMap` and `HashSet` iterators use `RawTable::first_bucket_raw` which is generic and will get inlined cross-crate.
However, `first_bucket_raw` calls `calculate_offsets` and the call doesn't get inlined, despite being a simple function.
This missing `#[inline]` results in `hash_table::calculate_offsets` showing up at the top of a callgrind profile with 3 million calls (for the testcase in #25916).
2015-05-31 09:53:49 +00:00
Tshepang Lekhonkhobe
89ee223c9c doc: fix displayed message 2015-05-31 10:49:22 +02:00
Tshepang Lekhonkhobe
eb3566f239 doc: improve map_or and map_or_else 2015-05-31 10:16:49 +02:00
Eduard Burtescu
4a4315bf4b Inline hash_table::calculate_offsets, used by iterators.
The `HashMap` and `HashSet` iterators use `RawTable::first_bucket_raw` which is generic and will get inlined cross-crate.
However, `first_bucket_raw` calls `calculate_offsets` and the call doesn't get inlined, despite being a simple function.
This missing `#[inline]` results in `hash_table::calculate_offsets` showing up at the top of a callgrind profile with 3 million calls (for the testcase in #25916).
2015-05-31 11:03:46 +03:00
bors
93991f7555 Auto merge of #25914 - andars:master, r=sanxiyn
Previous:
```
    --disable-llvm-version-check     don't don't check if the LLVM version is supported, build anyway
```

New:
```
    --disable-llvm-version-check     don't check if the LLVM version is supported, build anyway
```
2015-05-31 07:29:25 +00:00
Andrew Foote
d4389c52ab remove duplicate "don't" 2015-05-30 18:13:51 -07:00
olombard
61207046de TRPL: Fix a broken link to 'borrowing' 2015-05-30 23:43:23 +02:00
bors
78c4d53871 Auto merge of #25882 - steveklabnik:gh25554, r=alexcrichton
Fixes #25554
2015-05-30 21:10:07 +00:00
frankamp
ee4b58c792 Fixes consistency in before/after example
The doc indicates that you can replace 'before' with 'after' showing the use of try!. The two examples should be equivalent, but they are not.

In the File::create we were inducing a panic before in case of error, not propagating. It is important for newbies (like myself) to understand that try! propagates failures, while unwrap can induce a panic.

The other alternative is to make the 'before' File::create also manually handle Err like the other calls. Either way it would be consistent.
2015-05-30 13:31:46 -07:00
Ulrik Sverdrup
32211e1d27 Mark Arc function get_mut and method make_unique unsafe
This is a temporary mitigation for issue #24880 which points out that
these functions are racy in a particular situation where weak pointers
exist.

To mitigate this, mark the functions unsafe until this can be fixed or
another decision is made.

This is a breaking change to unstable API, because the new version
requires an `unsafe` block. Review carefully if weak pointers may race
for any uses of this API and consider abandoning it.

[breaking-change]
2015-05-30 22:15:40 +02:00
Tshepang Lekhonkhobe
aabff227d2 doc: be more clear/explicit that we got String type 2015-05-30 21:21:56 +02:00
Michael Woerister
d136714e04 debuginfo: Create common debugger pretty printer module.
GDB and LLDB pretty printers have some common functionality
and also access some common information, such as the layout of
standard library types. So far, this information has been
duplicated in the two pretty printing python modules. This
commit introduces a common module used by both debuggers.
2015-05-30 20:06:08 +02:00
bors
ee1ba33c4c Auto merge of #25904 - benaryorg:master, r=steveklabnik
perhaps the smallest and least useful fix in the whole history of rust

I will not blame you if you do not want to merge it
2015-05-30 17:09:53 +00:00
petrochenkov
8c86f8ff8c Warn if the test suite is run on Windows in console with non-UTF-8 code page 2015-05-30 19:22:12 +03:00
benaryorg
2029799d17
fix documentation in libserialize
the object was serialized with an 'i' but the comment stated the print command
would output 'j'
2015-05-30 17:41:09 +02:00
Lorenz
babb2684d8 Extend rust reference with a section about type coercions 2015-05-30 14:26:50 +02:00
Lorenz
a2b61e16b1 Extend rust reference with a section about subtyping 2015-05-30 14:25:58 +02:00
Mikhail Zabaluev
0ad019f4e8 std::io: bump the stability tag on ErrorKind::InvalidData to 1.2.0 2015-05-30 15:09:13 +03:00
Mathieu David
5d8e085369 Proposal to explain the copy trait more clearly
As mentioned in #25893 the copy trait is not very well explained for beginners. There is no clear mention that all primitive types implement the copy trait and there are not a lot of examples. 

With this change I try to make it more visible and understandable for new users. 

I myself have struggled with this, see [my question on stackoverflow](http://stackoverflow.com/questions/30540419/why-are-booleans-copyable-even-though-the-documentation-doesnt-indicate-that). And I want to make it more transparent for others. 

I filed issue #25893 but I thought that I could give it a shot myself to relieve some of the work from the devs :)

If it is not well written or there are some changes to be made before it can be merged, let me know.

Cheers,
Mathieu
2015-05-30 11:51:25 +02:00
petrochenkov
019ab5dfec Deprecate UnsafeCell::value 2015-05-30 12:15:19 +03:00
bors
474c6e0ae4 Auto merge of #25818 - sfackler:socket-timeouts, r=alexcrichton
Closes #25619 

r? @alexcrichton
2015-05-30 04:20:20 +00:00
Steven Fackler
b5c6c7ed40 Loosen timeout restrictions 2015-05-29 19:09:29 -07:00
bors
a0f028da07 Auto merge of #25817 - XMPPwocky:once_cleanedup, r=alexcrichton
Closes #24443.
2015-05-30 01:12:35 +00:00
bors
b77d60adb0 Auto merge of #25888 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #25788, #25861, #25864, #25865, #25866, #25873, #25876, #25883, #25886
- Failed merges:
2015-05-29 21:00:26 +00:00
Steve Klabnik
ed19a6e034 Rollup merge of #25886 - nhowell:patch-1, r=steveklabnik
r? @steveklabnik
2015-05-29 15:24:47 -04:00
Steve Klabnik
253fb5bd8b Rollup merge of #25883 - steveklabnik:gh25417, r=alexcrichton
Fixes #25417
2015-05-29 15:24:47 -04:00
Steve Klabnik
697834f485 Rollup merge of #25876 - tshepang:patch-3, r=steveklabnik 2015-05-29 15:24:47 -04:00
Steve Klabnik
c0a41b9999 Rollup merge of #25873 - nham:update_E0015, r=Aatch
The E0397 explanation, as I've written it, isn't really an explanation, but I'm not sure what to put here. I will happily take suggestions.

Partially addresses https://github.com/rust-lang/rust/issues/25851
2015-05-29 15:24:47 -04:00
Steve Klabnik
c2a5d31f30 Rollup merge of #25866 - jooert:update_guidelines, r=steveklabnik
So that rust-guidelines can be deleted and src/doc/style can prosper as the official home of the rust guidelines. 😃
2015-05-29 15:24:47 -04:00
Steve Klabnik
c7b1f37c59 Rollup merge of #25865 - azerupi:patch-2, r=alexcrichton
"workd" corrected to "world"
2015-05-29 15:24:46 -04:00
Steve Klabnik
5d2af1c724 Rollup merge of #25864 - azerupi:patch-1, r=alexcrichton
There was no opening parenthesis for this closing parenthesis...
2015-05-29 15:24:46 -04:00
Steve Klabnik
1999d759f7 Rollup merge of #25861 - tringenbach:master, r=steveklabnik
This adds an example from mem::swap, and provides some suggested uses of this
function.

This is my attempt to summarize the answers to a question I asked on reddit http://www.reddit.com/r/rust/comments/37jcul/what_is_forget_for/ and add the answers to the documentation so that no one else has to google or ask the question again.
2015-05-29 15:24:46 -04:00
Steve Klabnik
e9e2a11a6a Rollup merge of #25788 - maxjacobson:add-missing-space-to-glossary, r=steveklabnik
r? @steveklabnik
2015-05-29 15:24:46 -04:00
bors
996fb8d001 Auto merge of #25494 - alexcrichton:stdio-from-raw, r=aturon
This commit implements a number of standard traits for the standard library's
process I/O handles. The `FromRaw{Fd,Handle}` traits are now implemented for the
`Stdio` type and the `AsRaw{Fd,Handle}` traits are now implemented for the
`Child{Stdout,Stdin,Stderr}` types.

The stability markers for these implementations mention that they are stable for
1.1 as I will nominate this commit for cherry-picking to beta.
2015-05-29 19:24:40 +00:00
Mikhail Zabaluev
1d67cef6d2 std::io: New ErrorKind value InvalidData
This takes the cases from InvalidInput where a data format error
was encountered. This is different from the documented semantics
of InvalidInput, which more likely indicate a programming error.
2015-05-29 22:23:46 +03:00
Nathaniel Theis
103e79d26a Implement RFC 771: std::iter::once 2015-05-29 12:02:13 -07:00
Tim Ringenbach
8746b1ac6f Improve mem::forget documentation
This adds an example from mem::swap, and provides some suggested uses of this
function.

Change wording on comment on forget line to be more specific as to why we
need to call forget.

This breaks the examples up into three pieces. The last piece isn't
compiling for some reason.
2015-05-29 13:29:42 -05:00
Nick Howell
81a413bb01 trpl: eight sections, not seven 2015-05-29 14:29:35 -04:00
bors
84254948c2 Auto merge of #25880 - nikomatsakis:const-fn-feature-gate-calls, r=alexcrichton
The previous feature gate assumed we would not define any (stable) const fns. But then @eddyb went and cleaned up the code. So this now extends the feature-gate to prohibit calls; but calls inside of macros are considered ok.

r? @alexcrichton
2015-05-29 17:38:40 +00:00
Steve Klabnik
5e941877fe Add syntax for multiple lifetimes
Fixes #25417
2015-05-29 12:52:02 -04:00
Steve Klabnik
b218470b4d Make note about $ more prominent.
Fixes #25554
2015-05-29 12:20:32 -04:00
Niko Matsakis
808b411244 New tests for cross-crate usages of const fn and so forth 2015-05-29 11:52:59 -04:00
Steven Fackler
494901a8b4 Fix windows recvfrom definition 2015-05-29 08:32:22 -07:00
Steven Fackler
39abcef0a7 Skip timeout upper bound check on windows 2015-05-29 08:32:22 -07:00
bors
2d447e40e2 Auto merge of #25857 - killercup:patch-14, r=steveklabnik
Thanks to @cers who reported this in killercup/trpl-ebook#14!

r? @steveklabnik
2015-05-29 14:53:59 +00:00
Niko Matsakis
2c5e784d6f add const_fn features 2015-05-29 09:42:54 -04:00