Commit Graph

45081 Commits

Author SHA1 Message Date
bors 4d52d7c857 Auto merge of #27032 - Gankro:tarpl, r=aturon,acrichto,arielb,pnkfelix,nrc,nmatsakis,huonw
I've been baking this out of tree for long enough. This is currently about ~2/5ths the size of TRPL. Time to get it in tree so it can be more widely maintained and scrutinized. I've preserved the whole gruesome history including various rewrites. I can definitely squash these a fair amount if desired. Some random people submitted minor fixes though, so they're mixed in.

Edit: forgot to link to rendered http://cglab.ca/~abeinges/blah/turpl/_book/

Edit2:

To streamline the review process, I'm going to break this into sections that need official "domain expert" approval:

# Summary

* [ ] references.md -- very important, needs work

* [x] Meet Safe and Unsafe: reviewed by @aturon
* [x] Data Layout: reviewed by @arielb1 
* [x] Ownership: reviewed by @aturon ( and sorta @nikomatsakis ) -- significantly updated, may need re-r
* [x] Coversions:  reviewed by @nrc 
* [x] Uninitialized Memory: reviewed by @pnkfelix 
* [x] Ownership-Oriented Resource Management: reviewed by @aturon
* [x] Unwinding: reviewed by @alexcrichton 
* [x] Concurrency: reviewed by @aturon
* [x] Implementing Vec:  r? @huonw
2015-07-30 00:56:01 +00:00
Alexis Beingessner ddb029034b fix example code 2015-07-29 17:19:42 -07:00
Alexis Beingessner 4c48ffa53e add warning about reference section 2015-07-29 15:55:19 -07:00
bors 186707893b Auto merge of #27383 - Manishearth:rollup, r=Manishearth
- Successful merges: #26778, #27232, #27352, #27369, #27373
- Failed merges:
2015-07-29 21:29:03 +00:00
Manish Goregaokar b904b452c6 Rollup merge of #27373 - alexcrichton:fix-wait-timeout-ms, r=brson
The API we're calling requires us to pass an absolute point in time as an
argument (`pthread_cond_timedwait`) so we call `gettimeofday` ahead of time to
then add the specified duration to. Unfortuantely the current "add the duration"
logic forgot to take into account the current time's sub-second precision (e.g.
the `tv_usec` field was ignored), causing sub-second duration waits to return
spuriously.
2015-07-30 01:43:54 +05:30
Manish Goregaokar 35d95515f3 Rollup merge of #27369 - brson:realstd, r=alexcrichton
Since most lang items are actually defined in core, these hack reexports don't actually
do anything useful.
2015-07-30 01:43:53 +05:30
Manish Goregaokar c9a34d2092 Rollup merge of #27352 - nagisa:illegal-to-invalid-docs, r=steveklabnik
r? @steveklabnik
2015-07-30 01:43:53 +05:30
Manish Goregaokar 6b564a663b Rollup merge of #27232 - Dangthrimble:master, r=steveklabnik
Added definitions for 'Expression', 'Expression-Oriented Language' and 'Statement' to glossary.
Sorted the definitions alphabetically.

r? @steveklabnik
2015-07-30 01:43:53 +05:30
Manish Goregaokar 56bb9ed805 Rollup merge of #26778 - jawline:master, r=pnkfelix
Print the error message and then what is expected by the repeat count so the output makes more sense when there is an error in the const expression
2015-07-30 01:43:52 +05:30
bors 823f4fcf22 Auto merge of #27368 - alexcrichton:deprecate-net-methods, r=aturon
These methods are all covered by [RFC 1158] and are currently all available on
stable Rust via the [`net2` crate][net2] on crates.io. This commit does not
touch the timeout related functions as they're still waiting on `Duration` which
is unstable anyway, so punting in favor of the `net2` crate wouldn't buy much.

[RFC 1158]: https://github.com/rust-lang/rfcs/pull/1158
[net2]: http://crates.io/crates/net2
2015-07-29 19:50:52 +00:00
bors 523ee8d37c Auto merge of #27353 - arielb1:parenthetical-error, r=steveklabnik
This also calls the right API, which e.g. prevents a suggestion
for #![feature(unboxed_closures)] on stable.

Fixes #26970 

r? @steveklabnik
2015-07-29 18:10:48 +00:00
Alex Crichton 43b2c4781e std: Fix sub-second Condvar::wait_timeout_ms
The API we're calling requires us to pass an absolute point in time as an
argument (`pthread_cond_timedwait`) so we call `gettimeofday` ahead of time to
then add the specified duration to. Unfortuantely the current "add the duration"
logic forgot to take into account the current time's sub-second precision (e.g.
the `tv_usec` field was ignored), causing sub-second duration waits to return
spuriously.
2015-07-29 10:24:40 -07:00
bors 090ad6fde7 Auto merge of #27346 - dotdash:closure_dbg, r=michaelwoerister
Closure variables represent the closure environment, not the closure
function, so the identifier used to ensure that the debuginfo is unique
for each kind of closure needs to be based on the closure upvars and not
the function signature.
2015-07-29 16:28:59 +00:00
bors ddbce1107b Auto merge of #27380 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #27102, #27286, #27313, #27325, #27326, #27327, #27341, #27342, #27343, #27345, #27350, #27355, #27374, #27375, #27379
- Failed merges:
2015-07-29 14:47:23 +00:00
Steve Klabnik 5944303339 Rollup merge of #27379 - jeehoonkang:master, r=steveklabnik
As described in the module documentation, the memory orderings in Rust
are the same with that of LLVM.  However, the documentation for the
memory orderings enum says the memory orderings are the same of that of
C++.  Note that they differ in that C++'s support the consume reads,
while LLVM's does not.  Hence this commit fixes the bug in the
documentation for the enum.
2015-07-29 10:30:37 -04:00
Steve Klabnik d1f5199d95 Rollup merge of #27375 - niconii:vec-docs, r=Gankro
Noticed that syntax like `vec![0; 5]` is never mentioned in `Vec<T>`'s docs, nor used in any of its methods' docs, so I figured I should add a mention of it. Also noticed `vec!(1, 2)` being used in one spot while I was at it, so I fixed that as well for consistency's sake.

r? @steveklabnik
2015-07-29 10:30:36 -04:00
Steve Klabnik 89c0be547e Rollup merge of #27374 - dhuseby:fixing_configure_bsd, r=alexcrichton
FreeBSD uses ash, not bash.  The double bracket operators [[ and ]] are not supported.
2015-07-29 10:30:36 -04:00
Steve Klabnik 5aa76509da Rollup merge of #27355 - krumelmonster:patch-1, r=alexcrichton
Minor change in the book
2015-07-29 10:30:36 -04:00
Steve Klabnik d3dc1e56f1 Rollup merge of #27350 - GuillaumeGomez:patch-1, r=Manishearth
cc #26970.

r? @Manishearth
2015-07-29 10:30:36 -04:00
Steve Klabnik c0d21cfe58 Rollup merge of #27345 - killercup:patch-15, r=alexcrichton
The first paragraph of the docs of the Cursor struct ([src](ff6c6ce917/src/libstd/io/cursor.rs (L18-L21))) contains a Markdown link. In listings (like <http://doc.rust-lang.org/nightly/std/io/>), this won't get rendered:

![std__io_-_rust](https://cloud.githubusercontent.com/assets/20063/8925843/5c5281a8-350b-11e5-8c63-09a369d746b0.png)

The hotfix would be to change the link by reference:

```rust
/// A `Cursor` wraps another type and provides it with a [`Seek`][seek]
/// implementation.
///
/// [seek]: trait.Seek.html
```

to a direct link:

```rust
/// A `Cursor` wraps another type and provides it with a
/// [`Seek`](trait.Seek.html) implementation.
```

_I have not tested this as I don't have access to a machine for compiling Rust right now._

(This seems to be a more general issue, but I think I have seen this mentioned before. This PR is just to hotfix on particular occurrence. Rustdoc seems to only read the first paragraph of a doc string for the description in index pages, and _after that_ convert Markdown to HTML.)

r? @steveklabnik
2015-07-29 10:30:35 -04:00
Steve Klabnik 8b82470456 Rollup merge of #27343 - steveklabnik:fix_module, r=alexcrichton 2015-07-29 10:30:35 -04:00
Steve Klabnik 319b42821d Rollup merge of #27342 - steveklabnik:fix_links, r=alexcrichton
How embarassing 😭

r? @alexcrichton
2015-07-29 10:30:35 -04:00
Steve Klabnik 1406c196fd Rollup merge of #27341 - steveklabnik:remove_warning, r=alexcrichton
This isn't a standard header, and the other docs don't use it, so let's remove it.
2015-07-29 10:30:35 -04:00
Steve Klabnik 3c7719580c Rollup merge of #27327 - steveklabnik:fix_take, r=alexcrichton
This only reads five bytes, so don't use a ten byte buffer, that's confusing.

r? @alexcrichton
2015-07-29 10:30:34 -04:00
Steve Klabnik a368adf8e5 Rollup merge of #27326 - steveklabnik:doc_show_use, r=Gankro
In spirit with https://internals.rust-lang.org/t/should-we-keep-including-obvious-imports-in-code-examples/2217, show the feature flags we're using in examples.

(also one instance of 'use')
2015-07-29 10:30:34 -04:00
Steve Klabnik 6fec7b7854 Rollup merge of #27325 - midinastasurazz:patch-2, r=alexcrichton 2015-07-29 10:30:33 -04:00
Steve Klabnik 033b886f8c Rollup merge of #27313 - nagisa:illegal-to-invalid, r=pnkfelix
Improves diagnostics in various locations, namely:

* A few error messages that orignally were a mix of an error message and suggestion how to fix it have been split up into two messages: an error and help/hint.
* Never report “illegal”. Fixes https://github.com/rust-lang/rust/issues/27288
2015-07-29 10:30:33 -04:00
Steve Klabnik 10387d6839 Rollup merge of #27286 - lastorset:pub, r=steveklabnik
The reader could probably infer this from the current text, but for C++ programmers it's not obvious that struct fields don't automatically become public.

Apparently I wasn't the only one to be confused:

http://stackoverflow.com/questions/29157300/field-of-struct-is-private-when-importing-module

I don't think an example is necessary, but can add one if desired.

r? @steveklabnik
2015-07-29 10:30:33 -04:00
Steve Klabnik e6ed27bc24 Rollup merge of #27102 - tshepang:better-examples, r=aturon 2015-07-29 10:30:33 -04:00
Jeehoon Kang 2081aa623d Fix a documentation bug for memory orderings
As described in the module documentation, the memory orderings in Rust
are the same with that of LLVM.  However, the documentation for the
memory orderings enum says the memory orderings are the same of that of
C++.  Note that they differ in that C++'s support the consume reads,
while LLVM's does not.  Hence this commit fixes the bug in the
documentation for the enum.
2015-07-29 22:48:25 +09:00
bors ddc28298b9 Auto merge of #27365 - pcwalton:more-collections, r=aturon
This was showing up in Servo profiles.

r? @aturon
2015-07-29 13:11:29 +00:00
bors 78bf4b6ff6 Auto merge of #27360 - dhuseby:fixing_freebsd_stat_structs_and_tests, r=alexcrichton
…ebsd 10.1 x86_64 and i686
2015-07-29 11:33:20 +00:00
bors d10ff632ce Auto merge of #27358 - bluss:split-at-mut, r=aturon
Use raw pointers to avoid aliasing violation in split_at_mut

Fixes #27357
2015-07-29 09:57:50 +00:00
Blake Loring a067b4588a Modified to add 'found' to error message closes #26485 2015-07-29 10:06:50 +01:00
bors 6fcf62831e Auto merge of #27349 - arielb1:constant-at, r=alexcrichton
Fixes #27033
Fixes #27077 

r? @alexcrichton
2015-07-29 08:23:04 +00:00
bors d576ef3d7b Auto merge of #27261 - arielb1:drop-sanity-check, r=pnkfelix
This fixes multiple bugs, and as several of these are soundness issue, is a [breaking-change].

r? @pnkfelix
2015-07-29 06:47:55 +00:00
bors 4b4119d5c0 Auto merge of #27339 - alexcrichton:remove-old-rt, r=brson
These aren't really used for anything any more, so there doesn't seem to be much
reason to leave them around in the `rt` directory. There was some limiting of
threads spawned or tests when run under valgrind, but very little is run under
valgrind nowadays so there's also no real use keeping these around.
2015-07-29 05:12:33 +00:00
Nicolette Verlinden fe33e58137 Make docs for Vec::push() use vec! with square brackets 2015-07-28 23:55:12 -05:00
Nicolette Verlinden 48606e3ecd Mention vec![x; len] syntax in Vec docs 2015-07-28 23:53:25 -05:00
Dave Huseby 40eb53c409 recent changes to search for gcc/clang on freebsd and this fixes #14381 2015-07-28 21:23:19 -07:00
bors 68fc2d98d5 Auto merge of #27260 - alexcrichton:cap-lints, r=nrc
This commit is an implementation of [RFC 1193][rfc] which adds the ability to
the compiler to cap the lint level for the entire compilation session. This flag
will ensure that no lints will go above this level, and Cargo will primarily use
this flag passing `--cap-lints allow` to all upstream dependencies.

[rfc]: https://github.com/rust-lang/rfcs/pull/1193

Closes #27259
2015-07-29 02:04:38 +00:00
Alex Crichton b345437c3c rustc: Add a --cap-lints flag to the compiler
This commit is an implementation of [RFC 1193][rfc] which adds the ability to
the compiler to cap the lint level for the entire compilation session. This flag
will ensure that no lints will go above this level, and Cargo will primarily use
this flag passing `--cap-lints allow` to all upstream dependencies.

[rfc]: https://github.com/rust-lang/rfcs/pull/1193

Closes #27259
2015-07-28 18:23:09 -07:00
bors 8d432fbf10 Auto merge of #26846 - P1start:print-maybe-styled-macro, r=pnkfelix
`EmitterWriter::print_maybe_styled` was basically always used with `format!`, so this macro makes some code cleaner. It should also remove some unnecessary allocations (most `print_maybe_styled` invocations allocated a `String` previously, whereas the new macro uses `write_fmt` to write the formatted string directly to the terminal).

This probably could have been part of #26838, but it’s too late now. It’s also rebased on #26838’s branch because otherwise pretty much all of the changes in this PR would conflict with the other PR’s changes.
2015-07-29 00:28:55 +00:00
Brian Anderson 6464198508 std: Remove some old #[cfg(test) hacks
Since most lang items are actually defined in core, these hack reexports don't actually
do anything useful.
2015-07-28 16:22:05 -07:00
Alex Crichton 798ce50284 std: Deprecate extra TcpStream/UdpSocket methods
These methods are all covered by [RFC 1158] and are currently all available on
stable Rust via the [`net2` crate][net2] on crates.io. This commit does not
touch the timeout related functions as they're still waiting on `Duration` which
is unstable anyway, so punting in favor of the `net2` crate wouldn't buy much.

[RFC 1158]: https://github.com/rust-lang/rfcs/pull/1158
[net2]: http://crates.io/crates/net2

Specifically, this commit deprecates:

* TcpStream::set_nodelay
* TcpStream::set_keepalive
* UdpSocket::set_broadcast
* UdpSocket::set_multicast_loop
* UdpSocket::join_multicast
* UdpSocket::set_multicast_time_to_live
* UdpSocket::set_time_to_live
2015-07-28 16:08:05 -07:00
Simonas Kazlauskas cca0ea718d Replace illegal with invalid in most diagnostics 2015-07-29 01:59:31 +03:00
Simonas Kazlauskas ffcdf0881b Improve typeck diagnostic messages
Mostly by splitting error messages into proper pairs of errors and helps
2015-07-29 01:57:24 +03:00
Simonas Kazlauskas 77e9228b4a Improve invalid recursive types diagnostic 2015-07-29 01:57:24 +03:00
bors ba324694d6 Auto merge of #27318 - soon:E0391_explanation, r=nrc
Part of #24407
2015-07-28 22:51:53 +00:00
Alexis Beingessner b539906de1 clarify subtyping 2015-07-28 15:41:58 -07:00