Commit graph

34658 commits

Author SHA1 Message Date
Felix S. Klock II
d6c8f3b726 Add LpDowncast, LoanPath variant tracking downcasts in match arms.
`LpDowncast` carries the `DefId` of the variant itself.  To support
this, added the enum variant `DefId` to the `cat_downcast` variant in
`mem_categorization::categorization`.

(updated to fix mem_categorization to handle downcast of enum
struct-variants properly.)
2014-11-25 15:25:55 +01: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
Alexis Beingessner
b1e720fb7e Make HashMap::take not corrupt the map. Fixes #19292 2014-11-25 08:41:55 -05:00
Pascal Hertleif
96880be0e3 Change 'Failure' to 'Panic' in Bug Report Docs 2014-11-25 13:20:47 +01: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
Niko Matsakis
4671f7f07c Stop indenting error messages. It throws off M-x next-error in emacs and seems to serve little purpose. 2014-11-25 06:45:27 -05:00
Adolfo Ochagavía
080e625dae Add tests for issue 19244 2014-11-25 11:12:15 +01:00
Adolfo Ochagavía
fbde11297f Allow constant struct fields and tuple indexing 2014-11-25 10:25:14 +01: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
Chase Southwood
2a6f197bf4 Implement union, intersection, and difference functions for TrieSet. 2014-11-25 02:15:28 -06: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
36372b929e std: Export BinarySearchResult
At the same time remove the `pub use` of the variants in favor of accessing
through the enum type itself. This is a breaking change as the `Found` and
`NotFound` variants must now be imported through `BinarySearchResult` instead of
just `std::slice`.

[breaking-change]
Closes #19272
2014-11-24 15:54:14 -08: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
Ben S
3b9dfd6af0 Clean up FileType enum following enum namespacing
All of the enum components had a redundant 'Type' specifier: TypeSymlink, TypeDirectory, TypeFile. This change removes them, replacing them with a namespace: FileType::Symlink, FileType::Directory, and FileType::RegularFile.

RegularFile is used instead of just File, as File by itself could be mistakenly thought of as referring to the struct.

[breaking-change]
2014-11-24 23:01:15 +00:00
Steve Klabnik
ba9e02f862 remove the generation of grammar from the reference 2014-11-24 17:23:55 -05: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
Aaron Turon
985acfdb67 Merge libsync into libstd
This patch merges the `libsync` crate into `libstd`, undoing part of the
facade. This is in preparation for ultimately merging `librustrt`, as
well as the upcoming rewrite of `sync`.

Because this removes the `libsync` crate, it is a:

[breaking-change]

However, all uses of `libsync` should be able to reroute through
`std::sync` and `std::comm` instead.
2014-11-24 10:51:39 -08:00
Tom Jakubowski
59d13820c4 rustdoc: Render Sized? on traits and generics
Both `trait Foo for Sized?` and `<Sized? T>` are handled correctly.

Fix #18515
2014-11-24 10:39:26 -08:00
Murarth
6a5fc50782 Added test for module_path! fix 2014-11-24 10:07:19 -07:00
Murarth
a95c71e0ac Fixed "::::" appearing in module_path!() 2014-11-24 10:07:19 -07: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
Felix S. Klock II
e31fc9dd4f Add node_to_user_string, node_to_string variant that drops id from output. 2014-11-24 13:19:26 +01:00
Felix S. Klock II
f5b795dc82 compiletest: extend syntax with support for choosing same line as previous line. 2014-11-24 13:19:26 +01: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
Alexis Beingessner
865c2dba30 add MoveItems to RingBuf, fixes #19085 2014-11-23 17:24:00 -05: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