Commit Graph

34488 Commits

Author SHA1 Message Date
Steve Klabnik
d7b29a6ccd Make note that examples need a main()
Fixes #19199
2014-11-25 11:18:39 -05:00
bors
48ca6d1840 auto merge of #19174 : tomjakubowski/rust/rustdoc-assoc-types, r=alexcrichton
Render associated types on traits and impls, and qualified paths in types.

r? @alexcrichton
2014-11-25 13:46:45 +00:00
bors
2264049577 auto merge of #19172 : alfie/rust/impl-traitless, r=steveklabnik
An example of how implementations work without traits would be handy
2014-11-25 11:46:39 +00:00
bors
f6cb58caee auto merge of #19149 : alexcrichton/rust/issue-19091, r=aturon
This change applies the conventions to unwrap listed in [RFC 430][rfc] to rename
non-failing `unwrap` methods to `into_inner`. This is a breaking change, but all
`unwrap` methods are retained as `#[deprecated]` for the near future. To update
code rename `unwrap` method calls to `into_inner`.

[rfc]: https://github.com/rust-lang/rfcs/pull/430
[breaking-change]

cc #19091
2014-11-25 09:21:45 +00:00
bors
0c1d853fba auto merge of #18966 : huonw/rust/iter2slice, r=aturon
A slice iterator is isomorphic to a slice, just with a slightly
different form: storing start and end pointers rather than start pointer
and length. This patch reflects this by making converting between them
as easy as `iter.as_slice()` (or even `iter[]` if the shorter lifetime
is ok). That is, `slice.iter().as_slice() == slice`.

r? @aturon
2014-11-25 06:51:38 +00:00
Huon Wilson
b86a7808c7 Add methods to go from a slice iterators to a slice.
A slice iterator is isomorphic to a slice, just with a slightly
different form: storing start and end pointers rather than start pointer
and length. This patch reflects this by making converting between them
as easy as `iter.as_slice()` (or even `iter[]` if the shorter lifetime
is ok). That is, `slice.iter().as_slice() == slice`.
2014-11-25 17:10:32 +11:00
bors
5f9741e62d auto merge of #19285 : alexcrichton/rust/issue-19280, r=aturon
It turns out that rustrt::at_exit() doesn't actually occur after all pthread
threads have exited (nor does atexit()), so there's not actually a known point
at which we can deallocate these keys. It's not super critical that we do so,
however, because we're about to exit anyway!

Closes #19280
2014-11-25 01:06:41 +00:00
Alex Crichton
a4b1ac5447 std: Leak all statically allocated TLS keys
It turns out that rustrt::at_exit() doesn't actually occur after all pthread
threads have exited (nor does atexit()), so there's not actually a known point
at which we can deallocate these keys. It's not super critical that we do so,
however, because we're about to exit anyway!

Closes #19280
2014-11-24 15:24:29 -08:00
bors
5acb97ae76 auto merge of #19021 : roysc/rust/emacs-pr, r=brson
"_" should keep the default syntax class (symbol, not word). This
allows, e.g., `forward-word' to behave in the familiar way, jumping to
underscores within a function or variable name.
2014-11-24 23:06:45 +00:00
bors
7222ba9650 auto merge of #18818 : steveklabnik/rust/tcp_doc, r=alexcrichton
This suggests that you must call it, which is normally not what you want to do.

See here: http://www.reddit.com/r/rust/comments/2lpw9k/rust_irc_example_looking_for_feedback/clxnxxc?context=4
2014-11-24 21:02:33 +00:00
Steve Klabnik
534fd3a983 Don't call drop in tcpstream docs
This suggests that you must call it, which is normally not what you want to do.
2014-11-24 15:22:55 -05:00
bors
54c628cb84 auto merge of #19258 : nick29581/rust/dxr-minor, r=brson
r?
2014-11-24 16:07:00 +00:00
bors
377d7524a8 auto merge of #19250 : kmcallister/rust/atomicoption, r=alexcrichton
Fixes #19247.
2014-11-24 13:56:36 +00:00
Tom Jakubowski
de94f0affb rustdoc: render ast::QPath
Fix #18594
2014-11-24 05:23:10 -08:00
Tom Jakubowski
dd4c7c00d8 rustdoc: Render associated types on traits and impls 2014-11-24 05:23:10 -08:00
bors
4334d3c196 auto merge of #19248 : japaric/rust/str, r=alexcrichton
Just like we do with AsSlice

This comes in handy when dealing with iterator-centric APIs (`IntoIterator`!) and you want to receive an `Iterator<S> where S: Str` argument. Without this PR, e.g. you can't receive `&["a", "b"].iter()` instead you'll have to type `&["a", "b"].iter().map(|&x| x)` (A similar thing happens with `&[String]`).

r? @aturon 

Full disclaimer: I haven't run `make`/`make check` yet (All my cores are busy)
2014-11-24 11:56:34 +00:00
bors
bad1062caa auto merge of #19094 : alexcrichton/rust/rm-std-local-data, r=aturon
This commit removes the `std::local_data` module in favor of a new `std::thread_local`
module providing thread local storage. The module provides two variants of TLS:
one which owns its contents and one which is based on scoped references. Each
implementation has pros and cons listed in the documentation.

Both flavors have accessors through a function called `with` which yield a
reference to a closure provided. Both flavors also panic if a reference cannot
be yielded and provide a function to test whether an access would panic or not.
This is an implementation of [RFC 461][rfc] and full details can be found in
that RFC.

This is a breaking change due to the removal of the `std::local_data` module.
All users can migrate to the new tls system like so:

    thread_local!(static FOO: Rc<RefCell<Option<T>>> = Rc::new(RefCell::new(None)))

The old `local_data` module inherently contained the `Rc<RefCell<Option<T>>>` as
an implementation detail which must now be explicitly stated by users.

[rfc]: https://github.com/rust-lang/rfcs/pull/461
[breaking-change]
2014-11-24 09:56:34 +00:00
bors
f5b92b4b7a auto merge of #19236 : csouth3/rust/master, r=Gankro
Whilst browsing the source for BinaryHeap, I saw a FIXME for implementing into_iter.  I think, since the BinaryHeap is represented internally using just a Vec, just calling into_iter() on the BinaryHeap's data should be sufficient to do what we want here.  If this actually isn't the right approach (e.g., I should write a struct MoveItems and appropriate implementation for BinaryHeap instead), let me know and I'll happily rework this.

Both of the tests that I have added pass.  This is my first contribution to Rust, so please let me know any ways I can improve this PR!
2014-11-24 07:51:32 +00:00
Alex Crichton
a9c1152c4b std: Add a new top-level thread_local module
This commit removes the `std::local_data` module in favor of a new
`std::thread_local` module providing thread local storage. The module provides
two variants of TLS: one which owns its contents and one which is based on
scoped references. Each implementation has pros and cons listed in the
documentation.

Both flavors have accessors through a function called `with` which yield a
reference to a closure provided. Both flavors also panic if a reference cannot
be yielded and provide a function to test whether an access would panic or not.
This is an implementation of [RFC 461][rfc] and full details can be found in
that RFC.

This is a breaking change due to the removal of the `std::local_data` module.
All users can migrate to the new thread local system like so:

    thread_local!(static FOO: Rc<RefCell<Option<T>>> = Rc::new(RefCell::new(None)))

The old `local_data` module inherently contained the `Rc<RefCell<Option<T>>>` as
an implementation detail which must now be explicitly stated by users.

[rfc]: https://github.com/rust-lang/rfcs/pull/461
[breaking-change]
2014-11-23 23:37:16 -08:00
bors
c637cab853 auto merge of #19223 : reem/rust/any-typeid-unstable, r=aturon
It is likely going to be removed and replaced
with an associated static.
2014-11-24 02:56:35 +00:00
Nick Cameron
bbe1a9b9c1 save-analysis: two minor bugs 2014-11-24 14:10:16 +13:00
bors
395901393c auto merge of #19192 : nodakai/rust/generalize-strvector, r=alexcrichton
A single impl supports all of `[T]`, `Vec<T>` and `CVec<T>`.

Once `Iterable` is implemented, we will prefer it to `SlicePrelude`.
But the `with_capacity()` part might become tricky.
2014-11-24 00:46:30 +00:00
Chase Southwood
3f8e2690be Implement into_iter() for BinaryHeap. 2014-11-23 18:05:41 -06:00
Alex Crichton
f1f6c1286f Rename unwrap functions to into_inner
This change applies the conventions to unwrap listed in [RFC 430][rfc] to rename
non-failing `unwrap` methods to `into_inner`. This is a breaking change, but all
`unwrap` methods are retained as `#[deprecated]` for the near future. To update
code rename `unwrap` method calls to `into_inner`.

[rfc]: https://github.com/rust-lang/rfcs/pull/430
[breaking-change]

Closes #13159
cc #19091
2014-11-23 15:26:53 -08:00
bors
2eed1ddbea auto merge of #19246 : frewsxcv/rust/json-cleanup, r=jakub-
Was looking through the JSON code and cleaned parts of it up
2014-11-23 22:36:33 +00:00
bors
4e5259503c auto merge of #19242 : jakub-/rust/roll-up, r=jakub- 2014-11-23 20:26:58 +00:00
Jakub Bukaj
d6b023a467 Fixes to the roll-up 2014-11-23 15:23:39 -05:00
Jakub Bukaj
69a217f37c rollup merge of #19239: jauhien/fix-libdir
A fix for a windows problem pointed by @retep998 in the PR #16552.
2014-11-23 14:12:03 -05:00
Jakub Bukaj
593af6213f rollup merge of #19234: P1start/rustdoc-misc
This PR:

- makes rustdoc colour trait methods like other functions in search results;
- makes rustdoc display `extern crate` statements with the new `as` syntax instead of the old `=` syntax;
- changes rustdoc to list constants and statics in a way that is more similar to functions and modules and show their full definition and documentation on their own page, fixing #19046:

  ![Constant listing](https://i.imgur.com/L4ZTOCN.png)

  ![Constant page](https://i.imgur.com/RcjZfCv.png)
2014-11-23 14:12:01 -05:00
Jakub Bukaj
e9fcfe6a91 rollup merge of #19232: nicholasbishop/bishop_fix_result_typo 2014-11-23 14:12:00 -05:00
Jakub Bukaj
34ab1544e2 rollup merge of #19230: nick29581/dxr-values
r?
2014-11-23 14:11:59 -05:00
Jakub Bukaj
11700cb1d4 rollup merge of #19225: reem/any-unnecessary-transmute-copy
transmute_copy is no longer needed and is just slow.
2014-11-23 14:11:58 -05:00
Jakub Bukaj
4dbd6574b0 rollup merge of #19215: aochagavia/pretty
Closes https://github.com/rust-lang/rust/issues/19077

I would appreciate any guidance on how to write a test for this. I saw some examples in `test/pretty`, but there are different ways to test... With or without `.pp` files, with a `pp-exact` comment, etc.
2014-11-23 14:11:57 -05:00
Jakub Bukaj
3594c588bb rollup merge of #19211: aochagavia/tuple-index
This breaks code like

```
let t = (42i, 42i);
... t.0::<int> ...;
```

Change this code to not contain an unused type parameter. For example:

```
let t = (42i, 42i);
... t.0 ...;
```

Closes https://github.com/rust-lang/rust/issues/19096

[breaking-change]

r? @aturon
2014-11-23 14:11:56 -05:00
Jakub Bukaj
5ad1512850 rollup merge of #19210: petrochenkov/master
Now `std:#️⃣:hash("abcd")` works.
2014-11-23 14:11:55 -05:00
Jakub Bukaj
072015ee3d rollup merge of #19205: jashank/docs-fix
Catch a missed triple-slash in the docs for `std::os::args()`. Passes `make check`. (I've also eyeballed the rest of `libstd` with the aid of some funky regexes and haven't found anything similar.)
2014-11-23 14:11:54 -05:00
Jakub Bukaj
9d721180f2 rollup merge of #19204: mcpherrinm/master
The old name was sensible when this module was PriorityQueue but isn't
anymore.
2014-11-23 14:11:53 -05:00
Jakub Bukaj
7b2122b966 rollup merge of #19198: alexcrichton/snapshots
Primarily including the libnative removal
2014-11-23 14:11:52 -05:00
Jakub Bukaj
b21b48062f rollup merge of #19194: aturon/stab-ascii
This is an initial API stabilization pass for `std::ascii`. Aside from
some renaming to match conversion conventions, and deprecations in favor
of using iterators directly, almost nothing is changed here. However,
the static case conversion tables that were previously public are now private.

The stabilization of the (rather large!) set of extension traits is left
to a follow-up pass, because we hope to land some more general machinery
that will provide the same functionality without custom traits.

[breaking-change]
2014-11-23 14:11:51 -05:00
Jakub Bukaj
77d1f0b83b rollup merge of #19193: scialex/rc-counts
These functions allow you to see how many weak and strong references
there are to an `Arc`, `Rc`, or an `rc::Weak`. Due to the design of
`Arc` it is not possible to get the number of weak references of an
arbitrary `arc::Weak`. Look in `arc.rs` for a more in-depth explanation.

On `arc::Arc` and `arc::Weak` these operations are wait-free and atomic.

This sort of information is useful for creating dynamically cleared caches for use in OS development, for example holding pages of files in memory until the address space is needed for something else.
2014-11-23 14:11:50 -05:00
Jakub Bukaj
1e5de8cf3c rollup merge of #19184: Gekkio/fix-binary-format-char
This small piece of documentation was missed in the format character change
in 4af3494bb0.
2014-11-23 14:11:49 -05:00
Jakub Bukaj
ab8d811ebd rollup merge of #19166: richo/lldb-cleanups
While poking at rust in lldb I found a few nits to clean up.
2014-11-23 14:11:48 -05:00
Jakub Bukaj
f90471e4e3 rollup merge of #19161: jmesmon/mk-fixes
This is a collection of misc issues I've run into while adding bindir & libdir support that aren't really bindir & libdir specific.

While I continue to fiddle with bindir and libdir bugs, I figured these might be useful for others to have merged.
2014-11-23 14:11:47 -05:00
Keegan McAllister
26c93433da Require <T: Send> for AtomicOption
Fixes #19247.
2014-11-23 10:47:08 -08:00
Jorge Aparicio
02720a4a16 DSTify Str + impl Str for &S where S: Str 2014-11-23 13:21:24 -05:00
Corey Farwell
02355b8726 Clean up some logic/formatting in JSON module 2014-11-23 12:08:11 -05:00
bors
220b99b148 auto merge of #19150 : Manishearth/rust/find-doc, r=Gankro
It's useful to know this (opens up a bunch of other opportunities especially whilst parsing)
2014-11-23 15:46:56 +00:00
Jauhien Piatlicki
6ffb7f0132 fix for PR#16552 implementation on windows: CFG_LIBDIR should be always set in configure variables 2014-11-23 15:36:42 +01:00
bors
e197a2b0ac auto merge of #18140 : JelteF/rust-1/guide-fix, r=cmr
The reason given didn't make any sense when I read it when reading through the docs. I think this is more clear. Please let me know it is also more correct.
2014-11-23 13:51:47 +00:00
Jelte Fennema
17f9de387a Fix the reason for calling a file lib.rs 2014-11-23 14:43:22 +01:00