Commit Graph

34603 Commits

Author SHA1 Message Date
Niko Matsakis
21d5d139fc Add tests for the parsing of + and the error messages if people get it wrong.
Fixes #18772.
2014-11-26 11:42:06 -05:00
Niko Matsakis
1479a909bb Fix odd example where bounds were permitted and then ignored 2014-11-26 11:42:06 -05:00
Niko Matsakis
bc2356558d Fix rustdoc 2014-11-26 11:42:06 -05:00
Niko Matsakis
c4a3be6bd1 Rote changes due to the fact that ast paths no longer carry this extraneous bounds. 2014-11-26 11:42:06 -05:00
Niko Matsakis
f4e29e7e9a Fixup various places that were doing &T+'a and do &(T+'a) 2014-11-26 11:42:06 -05:00
Niko Matsakis
74a1041a4d Implement the new parsing rules for types in the parser, modifying the AST appropriately. 2014-11-26 11:42:05 -05:00
Corey Farwell
ce238d752b Unpublicize reexports, unprefix JSON type aliases
The type aliases json::JsonString and json::JsonObject were originally
prefixed with 'json' to prevent collisions with (at the time) the enums
json::String and json::Object respectively. Now that enum namespacing
has landed, this 'json' prefix is redundant and can be removed:

json::JsonArray -> json::Array
json::JsonObject -> json::Object

In addition, this commit also unpublicizes all of the re-exports in this
JSON module, as a part of #19253

[breaking-change]
2014-11-26 11:19:54 -05:00
bors
930f87774d auto merge of #19262 : murarth/rust/module-path-fix, r=jakub-
Closes #18859
2014-11-26 15:07:23 +00:00
Michael Woerister
7608d06027 debuginfo: Add script that allows to conveniently start LLDB in "rust-mode" 2014-11-26 15:58:17 +01:00
Michael Woerister
f19e6d71cd Add -Z print-sysroot commandline option to rustc. 2014-11-26 15:58:17 +01:00
Andrew Paseltiner
b7520f595f fix errors in the guide
- `s/(left|right) hand/\1-hand/`
- `s/parenthesis/parentheses/`
- `s/unicode/Unicode/`
- `s/validly-encoded/validly encoded/`
2014-11-26 08:41:40 -05:00
bors
8fb027e398 auto merge of #19252 : japaric/rust/cow, r=aturon
- Add `IntoCow` trait, and put it in the prelude
- Add `is_owned`/`is_borrowed` methods to `Cow`
- Add `CowString`/`CowVec` type aliases (to `Cow<'_, String, str>`/`Cow<'_, Vec, [T]>` respectively)
- `Cow` implements: `Show`, `Hash`, `[Partial]{Eq,Ord}`
- `impl BorrowFrom<Cow<'a, T, B>> for B`

[breaking-change]s:

- `IntoMaybeOwned` has been removed from the prelude
- libcollections: `SendStr` is now an alias to `CowString<'static>` (it was aliased to `MaybeOwned<'static>`)
- libgraphviz:
  - `LabelText` variants now wrap `CowString` instead of `MaybeOwned`
  - `Nodes` and `Edges` are now type aliases to `CowVec` (they were aliased to `MaybeOwnedVec`)
- libstd/path: `Display::as_maybe_owned` has been renamed to `Display::as_cow` and now returns a `CowString`
- These functions now accept/return `Cow` instead of `MaybeOwned[Vector]`:
  - libregex: `Replacer::reg_replace`
  - libcollections: `str::from_utf8_lossy`
  - libgraphviz: `Id::new`, `Id::name`, `LabelText::pre_escaped_content`
  - libstd: `TaskBuilder::named`

r? @aturon
2014-11-26 12:02:16 +00:00
bors
61af402789 auto merge of #19169 : aturon/rust/fds, r=alexcrichton
This PR adds some internal infrastructure to allow the private `std::sys` module to access internal representation details of `std::io`.

It then exposes those details in two new, platform-specific API surfaces: `std::os::unix` and `std::os::windows`.

To start with, these will provide the ability to extract file descriptors, HANDLEs, SOCKETs, and so on from `std::io` types.

More functionality, and more specific platforms (e.g. `std::os::linux`) will be added over time.

Closes #18897
2014-11-26 08:42:09 +00:00
bors
8d7b3199d9 auto merge of #19212 : steveklabnik/rust/doc_format_specifiers, r=alexcrichton
Fixes #19209
2014-11-26 06:42:06 +00:00
Chase Southwood
d48886cc88 Make BinaryHeap's Items iterator implement DoubleEnded and ExactSize 2014-11-25 21:41:23 -06:00
Steve Klabnik
f38e4e6d97 /** -> ///
This is considered good convention.
2014-11-25 21:24:16 -05:00
Steve Klabnik
7dadb14fb2 remove deprecated stuff from std::fmt docs
Fixes #19209
2014-11-25 21:19:28 -05:00
Aaron Turon
b299c2b57d Fallout from stabilization 2014-11-25 17:41:54 -08:00
Aaron Turon
a86f72d9a2 libs: stabilize iter module
This is an initial pass at stabilizing the `iter` module. The module is
fairly large, but is also pretty polished, so most of the stabilization
leaves things as they are.

Some changes:

* Due to the new object safety rules, various traits needs to be split
  into object-safe traits and extension traits. This includes `Iterator`
  itself. While splitting up the traits adds some complexity, it will
  also increase flexbility: once we have automatic impls of `Trait` for
  trait objects over `Trait`, then things like the iterator adapters
  will all work with trait objects.

* Iterator adapters that use up the entire iterator now take it by
  value, which makes the semantics more clear and helps catch bugs. Due
  to the splitting of Iterator, this does not affect trait objects. If
  the underlying iterator is still desired for some reason, `by_ref` can
  be used. (Note: this change had no fallout in the Rust distro except
  for the useless mut lint.)

* In general, extension traits new and old are following an [in-progress
  convention](https://github.com/rust-lang/rfcs/pull/445). As such, they
  are marked `unstable`.

* As usual, anything involving closures is `unstable` pending unboxed
  closures.

* A few of the more esoteric/underdeveloped iterator forms (like
  `RandomAccessIterator` and `MutableDoubleEndedIterator`, along with
  various unfolds) are left experimental for now.

* The `order` submodule is left `experimental` because it will hopefully
  be replaced by generalized comparison traits.

* "Leaf" iterators (like `Repeat` and `Counter`) are uniformly
  constructed by free fns at the module level. That's because the types
  are not otherwise of any significance (if we had `impl Trait`, you
  wouldn't want to define a type at all).

Closes #17701

Due to renamings and splitting of traits, this is a:

[breaking-change]
2014-11-25 17:41:25 -08:00
Steven Fackler
945b4edd67 Allow mutable access to wrapped internal type in Buffered*
This is necessary to e.g. set a timeout on the underlying stream.
2014-11-25 17:39:53 -08:00
Richard Diamond
ce507c6c22 Don't forget the tests. 2014-11-25 19:05:28 -06:00
Huon Wilson
4653ad0205 Make syntax::owned_slice a Box<[T]> wrapper.
This makes it correct (e.g. avoiding null pointers) and safe.
2014-11-26 11:55:39 +11:00
Ulysse Carion
6cb03baffa Fix formatting of the pointers guide. 2014-11-25 16:32:53 -08:00
Richard Diamond
f17faf49be Never generate multiple extern {} blocks in mklldeps.py. 2014-11-25 17:53:05 -06:00
Richard Diamond
80d520fcf2 Don't use the same llvmdeps.rs for every host. 2014-11-25 17:28:49 -06:00
bors
eedfc07796 auto merge of #19011 : ricky26/rust/trait_supertraits, r=nikomatsakis
It looks like currently kinds required by traits are not propagated when they are wrapped in a TyTrait. Additionally, in SelectionContext::builtin_bound, no attempt is made to check whether the target trait or its supertraits require the kind specified.

This PR alters SelectionContext::builtin_bound to examine all supertraits in the target trait's bounds recursively for required kinds.

Alternatively, the kinds could be added to the TyTrait upon creation (by just setting its builtin_bounds to the union of the bounds requested in this instance and the bounds required by the trait), this option may have less overhead during compilation but information is lost about which kinds were explicitly requested for this instance (vs those specified by traits/supertraits) would be lost.
2014-11-25 22:36:59 +00:00
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
689ef2dabf auto merge of #19255 : aturon/rust/merge-sync, r=alexcrichton,alexcrichton
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.

r? @alexcrichton
2014-11-25 20:32:20 +00:00
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