Commit Graph

34471 Commits

Author SHA1 Message Date
Steve Klabnik
a1d983aa16 Document liballoc::rc
This commit introduces a bunch of documentation, fixes some consistency
issues, and just basically brings Rc<T> and Weak<T> up to snuff.
2014-11-25 15:49:51 -05:00
bors
377d7524a8 auto merge of #19250 : kmcallister/rust/atomicoption, r=alexcrichton
Fixes #19247.
2014-11-24 13:56:36 +00: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
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
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
NODA, Kai
ef3b88c5f9 libcollection: generalize StrVector to AsSlice<Str>.
The impl for [T] also works as impl for slices in general.
By generalizing the impl of StrVector for Vec<Str> to that for
AsSlice<Str>, it becomes much more generic.

Once Iterable is implemented, we will prefer it to AsSlice.
But the with_capacity() part might become tricky.

Signed-off-by: NODA, Kai <nodakai@gmail.com>
2014-11-23 20:05:58 +08:00
Adolfo Ochagavía
40e1f8f8f1 Add test 2014-11-23 12:59:25 +01:00
bors
22513fed35 auto merge of #19158 : jakub-/rust/issue-14091, r=alexcrichton
Closes #14091.
Closes #19195.
2014-11-23 11:51:50 +00:00
Adolfo Ochagavía
35316972ff Remove type parameters from ExprField and ExprTupField 2014-11-23 12:17:43 +01:00
Adolfo Ochagavía
9a857b4472 libsyntax: Forbid type parameters in tuple indices
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]
2014-11-23 12:17:30 +01:00
bors
5ff10d5a23 auto merge of #19157 : aturon/rust/cow-doc, r=alexcrichton
This commit makes `Cow` more usable by allowing it to be applied to
unsized types (as was intended) and providing some basic `ToOwned`
implementations on slice types. It also corrects the documentation for
`Cow` to no longer mention `DerefMut`, and adds an example.

Closes #19123
2014-11-23 09:51:49 +00:00
bors
f5212e3cd7 auto merge of #18856 : ruud-v-a/rust/fatptrs, r=cmr
This merges the `trt_field_*`, `fn_field_*` and `slice_elt_*` constants into two `fat_ptr_*` constants. This resolves the first part of #18590.
2014-11-23 07:51:51 +00:00
bors
641e2a110d auto merge of #19152 : alexcrichton/rust/issue-17863, r=aturon
This commit is an implementation of [RFC 240][rfc] when applied to the standard
library. It primarily deprecates the entirety of `string::raw`, `vec::raw`,
`slice::raw`, and `str::raw` in favor of associated functions, methods, and
other free functions. The detailed renaming is:

* slice::raw::buf_as_slice => slice::from_raw_buf
* slice::raw::mut_buf_as_slice => slice::from_raw_mut_buf
* slice::shift_ptr => deprecated with no replacement
* slice::pop_ptr => deprecated with no replacement
* str::raw::from_utf8 => str::from_utf8_unchecked
* str::raw::c_str_to_static_slice => str::from_c_str
* str::raw::slice_bytes => deprecated for slice_unchecked (slight semantic diff)
* str::raw::slice_unchecked => str.slice_unchecked
* string::raw::from_parts => String::from_raw_parts
* string::raw::from_buf_len => String::from_raw_buf_len
* string::raw::from_buf => String::from_raw_buf
* string::raw::from_utf8 => String::from_utf8_unchecked
* vec::raw::from_buf => Vec::from_raw_buf

All previous functions exist in their `#[deprecated]` form, and the deprecation
messages indicate how to migrate to the newer variants.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0240-unsafe-api-location.md
[breaking-change]

Closes #17863
2014-11-23 05:46:52 +00:00
P1start
55af4aff56 Change how rustdoc shows constants and statics to be more similar to other items
Fixes #19046.
2014-11-23 17:18:35 +13:00
P1start
6b5655cb84 Make rustdoc display extern crate statements correctly 2014-11-23 17:18:35 +13:00
P1start
2f0249b3a8 Highlight trait methods in rustdoc’s search results 2014-11-23 17:18:27 +13:00
Nicholas Bishop
b637a867a5 Fix typo in Result documentation 2014-11-22 22:13:00 -05:00
bors
529f8bcd8b auto merge of #19146 : gereeter/rust/reference-borrow, r=aturon
This should be a more general version of #19131.
2014-11-23 02:36:46 +00:00
Nick Cameron
34c76646b5 save-analysis: add values for types 2014-11-23 15:02:58 +13:00
Nick Cameron
e83785c51f save-analysis: emit a type for enum variants 2014-11-23 15:02:58 +13:00