Commit Graph

35737 Commits

Author SHA1 Message Date
Alex Crichton
e5800dd454 rollup merge of #20134: jbranchaud/add-doctest-for-btreemap-entry
This is an updated version of #19711. The merge and subsequent rebase on that branch were more trouble than they were worth, so I am just resubmitting the relevant change here.

If this PR is accepted, then #19711 can be closed.

/cc @Gankro
2014-12-22 12:48:12 -08:00
Alex Crichton
48d1bb3602 rollup merge of #20129: nagisa/man-fixes
This pull request updates the rustc manual page to represent current state of rustc option handling better. Moved the apparently deprecated options (#19900) to their own section and added all the new codegen options.

A bit unrelatedly, I also updated description of `-O` and `-g` flags to point to the new codegen options rather than old, deprecated ones.

Fixes #20111.
2014-12-22 12:48:10 -08:00
Alex Crichton
2cc9baccc7 rollup merge of #20125: csouth3/hashset-bitops
Now that #19448 has landed in a snapshot, we can add proper by-value operator overloads for `HashSet`.  The behavior of these operator overloads is consistent with rust-lang/rfcs#235.
2014-12-22 12:48:09 -08:00
Alex Crichton
55cf032f43 rollup merge of #20124: klutzy/pprust-asm 2014-12-22 12:48:07 -08:00
Alex Crichton
941361b395 rollup merge of #20102: tshepang/patch-4
That sentence made it look like there was no option for using 'mut'
2014-12-22 12:47:52 -08:00
Alex Crichton
d3f3ae3aa2 rollup merge of #20084: barosl/struct-variant-field-err
Fixes #19922.
2014-12-22 12:47:34 -08:00
Alex Crichton
4baeacef5a rollup merge of #20075: skade/remove-notrust
Internally refactor all mentions of `notrust` to the
positive statement `rust`.

[breaking-change] Change remaining `notrust` markers to
the thing they actually represent, e.g. `sh` or `plain`.

This supersedes #19693 .
2014-12-22 12:47:31 -08:00
Alex Crichton
7311b6347d rollup merge of #20053: csouth3/misc-stab
This pull request:

*Renames `BinaryHeap::top` to `BinaryHeap::peek`
*Stabilizes `front/back/front_mut/back_mut` in `DList` and `RingBuf`
*Stabilizes `swap` in `RingBuf`

in accordance with rust-lang/rfcs#509.

Note that this PR does not address `Bitv::{get,set}` or HashMap's iterators, nor does it move `std::vec` to `std::collections::vec`, all of which still need to be done.

Because of the method renaming, this is a [breaking-change].
2014-12-22 12:47:11 -08:00
Alex Crichton
b04bc5cc49 rollup merge of #20033: alexcrichton/deprecate-serialise
This commit completes the deprecation story for the in-tree serialization
library. The compiler will now emit a warning whenever it encounters
`deriving(Encodable)` or `deriving(Decodable)`, and the library itself is now
marked `#[unstable]` for when feature staging is enabled.

All users of serialization can migrate to the `rustc-serialize` crate on
crates.io which provides the exact same interface as the libserialize library
in-tree. The new deriving modes are named `RustcEncodable` and `RustcDecodable`
and require `extern crate "rustc-serialize" as rustc_serialize` at the crate
root in order to expand correctly.

To migrate all crates, add the following to your `Cargo.toml`:

    [dependencies]
    rustc-serialize = "0.1.1"

And then add the following to your crate root:

    extern crate "rustc-serialize" as rustc_serialize;

Finally, rename `Encodable` and `Decodable` deriving modes to `RustcEncodable`
and `RustcDecodable`.

[breaking-change]
2014-12-22 12:46:31 -08:00
Alex Crichton
9b99436152 rollup merge of #19741: alexcrichton/stabilize-str
This commit starts out by consolidating all `str` extension traits into one
`StrExt` trait to be included in the prelude. This means that
`UnicodeStrPrelude`, `StrPrelude`, and `StrAllocating` have all been merged into
one `StrExt` exported by the standard library. Some functionality is currently
duplicated with the `StrExt` present in libcore.

This commit also currently avoids any methods which require any form of pattern
to operate. These functions will be stabilized via a separate RFC.

Next, stability of methods and structures are as follows:

Stable

* from_utf8_unchecked
* CowString - after moving to std::string
* StrExt::as_bytes
* StrExt::as_ptr
* StrExt::bytes/Bytes - also made a struct instead of a typedef
* StrExt::char_indices/CharIndices - CharOffsets was renamed
* StrExt::chars/Chars
* StrExt::is_empty
* StrExt::len
* StrExt::lines/Lines
* StrExt::lines_any/LinesAny
* StrExt::slice_unchecked
* StrExt::trim
* StrExt::trim_left
* StrExt::trim_right
* StrExt::words/Words - also made a struct instead of a typedef

Unstable

* from_utf8 - the error type was changed to a `Result`, but the error type has
              yet to prove itself
* from_c_str - this function will be handled by the c_str RFC
* FromStr - this trait will have an associated error type eventually
* StrExt::escape_default - needs iterators at least, unsure if it should make
                           the cut
* StrExt::escape_unicode - needs iterators at least, unsure if it should make
                           the cut
* StrExt::slice_chars - this function has yet to prove itself
* StrExt::slice_shift_char - awaiting conventions about slicing and shifting
* StrExt::graphemes/Graphemes - this functionality may only be in libunicode
* StrExt::grapheme_indices/GraphemeIndices - this functionality may only be in
                                             libunicode
* StrExt::width - this functionality may only be in libunicode
* StrExt::utf16_units - this functionality may only be in libunicode
* StrExt::nfd_chars - this functionality may only be in libunicode
* StrExt::nfkd_chars - this functionality may only be in libunicode
* StrExt::nfc_chars - this functionality may only be in libunicode
* StrExt::nfkc_chars - this functionality may only be in libunicode
* StrExt::is_char_boundary - naming is uncertain with container conventions
* StrExt::char_range_at - naming is uncertain with container conventions
* StrExt::char_range_at_reverse - naming is uncertain with container conventions
* StrExt::char_at - naming is uncertain with container conventions
* StrExt::char_at_reverse - naming is uncertain with container conventions
* StrVector::concat - this functionality may be replaced with iterators, but
                      it's not certain at this time
* StrVector::connect - as with concat, may be deprecated in favor of iterators

Deprecated

* StrAllocating and UnicodeStrPrelude have been merged into StrExit
* eq_slice - compiler implementation detail
* from_str - use the inherent parse() method
* is_utf8 - call from_utf8 instead
* replace - call the method instead
* truncate_utf16_at_nul - this is an implementation detail of windows and does
                          not need to be exposed.
* utf8_char_width - moved to libunicode
* utf16_items - moved to libunicode
* is_utf16 - moved to libunicode
* Utf16Items - moved to libunicode
* Utf16Item - moved to libunicode
* Utf16Encoder - moved to libunicode
* AnyLines - renamed to LinesAny and made a struct
* SendStr - use CowString<'static> instead
* str::raw - all functionality is deprecated
* StrExt::into_string - call to_string() instead
* StrExt::repeat - use iterators instead
* StrExt::char_len - use .chars().count() instead
* StrExt::is_alphanumeric - use .chars().all(..)
* StrExt::is_whitespace - use .chars().all(..)

Pending deprecation -- while slicing syntax is being worked out, these methods
are all #[unstable]

* Str - while currently used for generic programming, this trait will be
        replaced with one of [], deref coercions, or a generic conversion trait.
* StrExt::slice - use slicing syntax instead
* StrExt::slice_to - use slicing syntax instead
* StrExt::slice_from - use slicing syntax instead
* StrExt::lev_distance - deprecated with no replacement

Awaiting stabilization due to patterns and/or matching

* StrExt::contains
* StrExt::contains_char
* StrExt::split
* StrExt::splitn
* StrExt::split_terminator
* StrExt::rsplitn
* StrExt::match_indices
* StrExt::split_str
* StrExt::starts_with
* StrExt::ends_with
* StrExt::trim_chars
* StrExt::trim_left_chars
* StrExt::trim_right_chars
* StrExt::find
* StrExt::rfind
* StrExt::find_str
* StrExt::subslice_offset
2014-12-22 12:45:54 -08:00
Alex Crichton
2f55a9db0d rollup merge of #19216: Gankro/bitv
Part of #18424

This commit changes the semantics of `reserve` and `capacity` for Bitv and BitvSet to match conventions. It also introduces the notion of `reserve_index` and `reserve_index_exact` for collections with maximum-index-based capacity semantics.

Deprecates free function constructors in favour of functions on Bitv itself.

Changes `Bitv::pop` to return an Option rather than panicking.

Deprecates and renames several methods in favour of conventions.

Marks several blessed methods as unstable.

This commit also substantially refactors Bitv and BitvSet's implementations. The new implementation is simpler, cleaner, better documented, and more robust against overflows. It also reduces coupling between Bitv and BitvSet. Tests have been seperated into seperate submodules.

Fixes #16958

[breaking-change]
2014-12-22 12:45:52 -08:00
Chris Morgan
7f0d2e8a2b RFC 248? I think you meant RFC 438.
There ain’t an RFC 248, while 438 looks to be what is being referred to:
https://github.com/rust-lang/rfcs/blob/master/text/0438-precedence-of-plus.md
2014-12-22 11:50:15 -08:00
Corey Farwell
02feaf2a80 Remove cmp::Ordering::* public reexport
Part of #19253

I would have removed this public reexport in #19842, but #19812 hadn't merged (and snapshotted) at the time

In #19407, I changed the codebase to stop utilizing this reexport

[breaking-change]
2014-12-22 11:28:23 -08:00
Alexis Beingessner
20d7a5fc3c Make bitv's APIs match RFC + fixup 2014-12-22 14:11:43 -05:00
Felix S. Klock II
34d43788e5 fix run-make/ tests now flowgraph printing has moved to the unstable --xpretty option. 2014-12-22 19:41:19 +01:00
jbranchaud
e8fcbfb959 Add a doctest for the btreemap's entry method.
Make some updates to the entry doctest.
2014-12-22 12:13:06 -06:00
Simonas Kazlauskas
faa00949d9 Update man page with the new options
This pull request updates the rustc manual page to represent post-#19900
state of rustc options better.

A bit unrelatedly, --help output is changed to fix some issues too:
  * -g and -O descriptions were changed from deprected flags to the new
    codegen flags.
  * dep-info value was moved from crate-type to emit flag.

Fixes #20111
Fixes #20131
2014-12-22 19:32:20 +02:00
Niko Matsakis
763152b995 Tweak region-related error messages that changed slightly due to coercion
changes, and also stop printing semi-useless inference by-products.
2014-12-22 12:27:08 -05:00
Niko Matsakis
2c76ced954 Correct merge failure around imports in str.rs. 2014-12-22 12:27:08 -05:00
Niko Matsakis
2e2906522d Address nit. 2014-12-22 12:27:08 -05:00
Niko Matsakis
69a1d0e610 Change print out to include the path to the fn, a bit ad-hoc for now . 2014-12-22 12:27:08 -05:00
Niko Matsakis
41ef2d85a1 Various simple tests for fn item type vs fn pointer type and for coercions between them. 2014-12-22 12:27:08 -05:00
Niko Matsakis
8fe9e4dff6 Insert coercions to fn pointer types required for the new types
post-unboxed-closure-conversion. This requires a fair amount of
annoying coercions because all the `map` etc types are defined
generically over the `F`, so the automatic coercions don't propagate;
this is compounded by the need to use `let` and not `as` due to
stage0. That said, this pattern is to a large extent temporary and
unusual.
2014-12-22 12:27:07 -05:00
Niko Matsakis
7f6177e646 Fix fallout from changes. In cases where stage0 compiler is needed, we
cannot use an `as` expression to coerce, so I used a one-off function
instead (this is a no-op in stage0, but in stage1+ it triggers
coercion from the fn pointer to the fn item type).
2014-12-22 12:27:07 -05:00
Niko Matsakis
211782fef5 Perform coercions on LHS assignments. 2014-12-22 12:27:07 -05:00
Niko Matsakis
39be95c16b Insert FIXME links to issue #19925: fn item types should be zero-sized. 2014-12-22 12:27:07 -05:00
Niko Matsakis
fad1423d1e Adjust metadata for new fields and enum variants. Yawn. 2014-12-22 12:27:07 -05:00
Niko Matsakis
2a43b352f7 Rote changes that don't care to distinguish between a fn pointer and a fn item. 2014-12-22 12:27:07 -05:00
Niko Matsakis
f46099575a Make ty_bare_fn carry an optional def-id indicating whether it is the
type of a fn item or a fn pointer, which are now differentiated.
Introduce coercion from fn item to fn pointer.
2014-12-22 12:27:07 -05:00
Maya Nitu
98ed882511 Removed unused context-switching assembly code. 2014-12-22 19:12:35 +02:00
bors
2f3cff6956 auto merge of #20132 : alexcrichton/rust/revert-20027, r=sfackler
The introduced issue https://github.com/rust-lang/rust/issues/20127 seems serious enough that we may want to enqueue a reversion for now. Feel free to beat me with a fix though @michaelwoerister!
2014-12-22 17:11:37 +00:00
Florian Wilkens
22050e3ed4 Added missing renames:
libcollections:
    AbsEntries -> AbsIter, Entries -> Iter, MoveEntries -> IntoIter, MutEntries -> IterMut
    DifferenceItems -> Difference, SymDifferenceItems -> SymmetricDifference, IntersectionItems -> Intersection, UnionItems -> Union

libstd/hash/{table, map}:
    Entries -> Iter, MoveItems -> IntoIter, MutEntries -> IterMut

Also a [breaking-change].
2014-12-22 17:45:34 +01:00
Alex Crichton
c5aaa8cc05 Revert "debuginfo: Create debuginfo for for-loop variables again."
This reverts commit b048114718.
2014-12-22 08:25:44 -08:00
Alex Crichton
8e2d952c68 Revert "debuginfo: Clean the debuginfo module up a bit."
This reverts commit 34a6fcf195.
2014-12-22 08:25:34 -08:00
Alex Crichton
f450695183 Revert "debuginfo: Add test case for destructured for-loop variable."
This reverts commit 87c5927b79.
2014-12-22 08:25:11 -08:00
Niko Matsakis
8c8cb997a5 Introduce a tcx() helper method to cleanup this mess. 2014-12-22 10:07:06 -05:00
Felix S. Klock II
bf2f84bfe3 Add an unstable --xpretty _ option to rustc. Moved flowgraph
and `everybody_loops` options to `--xpretty`.
2014-12-22 16:06:22 +01:00
Felix S. Klock II
41def27bda Add --pretty everybody_loops option.
This prints out a transformed version of the input source code where
every function body is replaced with `loop { }`.

All such bodies are (1.) trivial and (2.) guaranteed to pass the
type-checker in a valid compiler; therefore they make very nice input
to start with when narrowing down a bug exposed by a large test input
(such as librustc itself).
2014-12-22 16:06:22 +01:00
Felix S. Klock II
e711e2d89b Add -Z unstable-options debugging flag, which can then be used to
extend the `rustc` command line interface with options that we do not
want to commit to making part of the long-term public interface for
`rustc`.
2014-12-22 16:06:14 +01:00
Florian Wilkens
f8cfd2480b Renaming of the Iter types as in RFC #344
libcore: slice::Items -> slice::Iter, slice::MutItems -> slice::IterMut
libcollections: *::Items -> *::Iter, *::MoveItems -> *::IntoIter, *::MutItems -> *::IterMut

This is of course a [breaking-change].
2014-12-22 12:58:55 +01:00
Rolf Timmermans
0a7ef3f6cc Add myself to authors. 2014-12-22 10:49:47 +01:00
Rolf Timmermans
82f411d8a4 Remove unnecessary deref(). 2014-12-22 10:49:47 +01:00
Rolf Timmermans
903f5c4360 Avoid allocations. 2014-12-22 10:49:47 +01:00
Rolf Timmermans
fc30518be9 Escape control characters in JSON output. 2014-12-22 10:49:46 +01:00
Alex Crichton
a76a802768 serialize: Fully deprecate the library
This commit completes the deprecation story for the in-tree serialization
library. The compiler will now emit a warning whenever it encounters
`deriving(Encodable)` or `deriving(Decodable)`, and the library itself is now
marked `#[unstable]` for when feature staging is enabled.

All users of serialization can migrate to the `rustc-serialize` crate on
crates.io which provides the exact same interface as the libserialize library
in-tree. The new deriving modes are named `RustcEncodable` and `RustcDecodable`
and require `extern crate "rustc-serialize" as rustc_serialize` at the crate
root in order to expand correctly.

To migrate all crates, add the following to your `Cargo.toml`:

    [dependencies]
    rustc-serialize = "0.1.1"

And then add the following to your crate root:

    extern crate "rustc-serialize" as rustc_serialize;

Finally, rename `Encodable` and `Decodable` deriving modes to `RustcEncodable`
and `RustcDecodable`.

[breaking-change]
2014-12-22 00:14:56 -08:00
Alex Crichton
082bfde412 Fallout of std::str stabilization 2014-12-21 23:31:42 -08:00
Chase Southwood
db3989c3db Implement BitOps for HashSet 2014-12-21 22:38:37 -06:00
klutzy
023572b957 pprust: Fix asm options 2014-12-22 13:37:10 +09:00
Chase Southwood
abf492d44f Misc Stabilization for collections
This commit:

*Renames `BinaryHeap::top` to `BinaryHeap::peek`
*Stabilizes `front/back/front_mut/back_mut` in `DList` and `RingBuf`
*Stabilizes `swap` in `RingBuf`

Because of the method renaming, this is a [breaking-change].
2014-12-21 22:32:16 -06:00
Alex Crichton
4908017d59 std: Stabilize the std::str module
This commit starts out by consolidating all `str` extension traits into one
`StrExt` trait to be included in the prelude. This means that
`UnicodeStrPrelude`, `StrPrelude`, and `StrAllocating` have all been merged into
one `StrExt` exported by the standard library. Some functionality is currently
duplicated with the `StrExt` present in libcore.

This commit also currently avoids any methods which require any form of pattern
to operate. These functions will be stabilized via a separate RFC.

Next, stability of methods and structures are as follows:

Stable

* from_utf8_unchecked
* CowString - after moving to std::string
* StrExt::as_bytes
* StrExt::as_ptr
* StrExt::bytes/Bytes - also made a struct instead of a typedef
* StrExt::char_indices/CharIndices - CharOffsets was renamed
* StrExt::chars/Chars
* StrExt::is_empty
* StrExt::len
* StrExt::lines/Lines
* StrExt::lines_any/LinesAny
* StrExt::slice_unchecked
* StrExt::trim
* StrExt::trim_left
* StrExt::trim_right
* StrExt::words/Words - also made a struct instead of a typedef

Unstable

* from_utf8 - the error type was changed to a `Result`, but the error type has
              yet to prove itself
* from_c_str - this function will be handled by the c_str RFC
* FromStr - this trait will have an associated error type eventually
* StrExt::escape_default - needs iterators at least, unsure if it should make
                           the cut
* StrExt::escape_unicode - needs iterators at least, unsure if it should make
                           the cut
* StrExt::slice_chars - this function has yet to prove itself
* StrExt::slice_shift_char - awaiting conventions about slicing and shifting
* StrExt::graphemes/Graphemes - this functionality may only be in libunicode
* StrExt::grapheme_indices/GraphemeIndices - this functionality may only be in
                                             libunicode
* StrExt::width - this functionality may only be in libunicode
* StrExt::utf16_units - this functionality may only be in libunicode
* StrExt::nfd_chars - this functionality may only be in libunicode
* StrExt::nfkd_chars - this functionality may only be in libunicode
* StrExt::nfc_chars - this functionality may only be in libunicode
* StrExt::nfkc_chars - this functionality may only be in libunicode
* StrExt::is_char_boundary - naming is uncertain with container conventions
* StrExt::char_range_at - naming is uncertain with container conventions
* StrExt::char_range_at_reverse - naming is uncertain with container conventions
* StrExt::char_at - naming is uncertain with container conventions
* StrExt::char_at_reverse - naming is uncertain with container conventions
* StrVector::concat - this functionality may be replaced with iterators, but
                      it's not certain at this time
* StrVector::connect - as with concat, may be deprecated in favor of iterators

Deprecated

* StrAllocating and UnicodeStrPrelude have been merged into StrExit
* eq_slice - compiler implementation detail
* from_str - use the inherent parse() method
* is_utf8 - call from_utf8 instead
* replace - call the method instead
* truncate_utf16_at_nul - this is an implementation detail of windows and does
                          not need to be exposed.
* utf8_char_width - moved to libunicode
* utf16_items - moved to libunicode
* is_utf16 - moved to libunicode
* Utf16Items - moved to libunicode
* Utf16Item - moved to libunicode
* Utf16Encoder - moved to libunicode
* AnyLines - renamed to LinesAny and made a struct
* SendStr - use CowString<'static> instead
* str::raw - all functionality is deprecated
* StrExt::into_string - call to_string() instead
* StrExt::repeat - use iterators instead
* StrExt::char_len - use .chars().count() instead
* StrExt::is_alphanumeric - use .chars().all(..)
* StrExt::is_whitespace - use .chars().all(..)

Pending deprecation -- while slicing syntax is being worked out, these methods
are all #[unstable]

* Str - while currently used for generic programming, this trait will be
        replaced with one of [], deref coercions, or a generic conversion trait.
* StrExt::slice - use slicing syntax instead
* StrExt::slice_to - use slicing syntax instead
* StrExt::slice_from - use slicing syntax instead
* StrExt::lev_distance - deprecated with no replacement

Awaiting stabilization due to patterns and/or matching

* StrExt::contains
* StrExt::contains_char
* StrExt::split
* StrExt::splitn
* StrExt::split_terminator
* StrExt::rsplitn
* StrExt::match_indices
* StrExt::split_str
* StrExt::starts_with
* StrExt::ends_with
* StrExt::trim_chars
* StrExt::trim_left_chars
* StrExt::trim_right_chars
* StrExt::find
* StrExt::rfind
* StrExt::find_str
* StrExt::subslice_offset
2014-12-21 19:09:55 -08:00