Commit Graph

34625 Commits

Author SHA1 Message Date
Steve Klabnik
4ce3ba484b Improve documentation for unreachable
Fixes #18876
2014-11-25 15:04:27 -05:00
Steven Fackler
79d9bebf49 Fix xcrate enum namespacing
Closes #19293
2014-11-25 11:02:47 -08:00
Steve Klabnik
55853c532f We now support 64 bit Windows.
Fixes #18844
2014-11-25 11:43:05 -05:00
Steve Klabnik
8369a607ed add slice patterns to the guide
Fixes #19177.
2014-11-25 11:37:20 -05:00
Steve Klabnik
72beb1f885 Extra note about struct matching order
Fixes #19178
2014-11-25 11:31:49 -05:00
Jorge Aparicio
3293ab14e2 Deprecate MaybeOwned[Vector] in favor of Cow 2014-11-25 11:22:23 -05:00
Daniel Micay
c9816be35a vec: add missing out-of-memory check
Closes #19305
2014-11-25 11:19:20 -05:00
Steve Klabnik
d7b29a6ccd Make note that examples need a main()
Fixes #19199
2014-11-25 11:18:39 -05:00
Steve Klabnik
71b8b04f48 Make note about cross-borrowing.
Fixes #19302.
2014-11-25 10:57:17 -05:00
bors
0e06f71747 auto merge of #18234 : pnkfelix/rust/fsk-type-fragments-for-needsdrop-2, r=nikomatsakis
Code to fragment paths into pieces based on subparts being moved around, e.g. moving `x.1` out of a tuple `(A,B,C)` leaves behind the fragments `x.0: A` and `x.2: C`.  Further discussion in borrowck/doc.rs.

Includes differentiation between assigned_fragments and moved_fragments, support for all-but-one array fragments, and instrumentation to print out the moved/assigned/unmmoved/parents for each function, factored out into a separate submodule.

These fragments can then be used by `trans` to inject stack-local dynamic drop flags.  (They also can be hooked up with dataflow to reduce the expected number of injected flags.)
2014-11-25 15:48:05 +00:00
Felix S. Klock II
5fbe0cac7c First tests making use of the new fn move-fragments instrumentation.
The tests use new "//~| ERROR" follow syntax.

Includes a test for moves involving array elements.  It was easier
than i realized to get something naive off the ground here.
2014-11-25 15:26:16 +01:00
Felix S. Klock II
c9a1c376fc Added fragments.rs: compute drop obligations remaining post moves.
Includes differentiation between assigned_fragments and
moved_fragments, support for all-but-one array fragments, and
instrumentation to print out the moved/assigned/unmmoved/parents for
each function, factored out into separate submodule.
2014-11-25 15:26:16 +01:00
Felix S. Klock II
21fe017ab0 Check other fields are consistent in LoanPath::common. 2014-11-25 15:26:16 +01:00
Felix S. Klock II
09d67fd777 Track what drop obligations are established on match arms.
This is accomplished by:

1. Add `MatchMode` enum to `expr_use_visitor`.

2. Computing the match mode for each pattern via a pre-pass, and then
   passing the mode along when visiting the pattern in
   expr_use_visitor.

3. Adding a `fn matched_pat` callback to expr_use_visitor, which is
   called on interior struct and enum nodes of the pattern (as opposed
   to `fn consume_pat`, which is only invoked for identifiers at the
   leaves of the pattern), and invoking it accordingly.

Of particular interest are the `cat_downcast` instances established
when matching enum variants.
2014-11-25 15:26:16 +01:00
Felix S. Klock II
6f7cb8c618 Override LoanPath Eq impl to enforce invariant: eq lp's always have eq types. 2014-11-25 15:26:16 +01:00
Felix S. Klock II
1217b829e8 MemCategorizationContext::pat_ty(BindByRef) yields type of borrowed val now.
This is to fix a problem where I could not reliably map attach the
type for each loan-path to the loan-path itself because the same
loan-path was ending up associated with two different types, because
the cmt's had diverged in their interpretation of the path.
2014-11-25 15:26:16 +01:00
Felix S. Klock II
91b88c54c2 Add ty to LoanPath.
To make this clean, refactored old `LoanPath` enum into a
`LoanPath` struct with a `ty::t` and a newly-added `LoanPathVariant` enum.

This enabled me to get rid of the ugly and fragile `LoanPath::to_type`
method, and I can probably also get rid of other stuff that was
supporting it, maybe.
2014-11-25 15:26:15 +01:00
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