Commit Graph

8580 Commits

Author SHA1 Message Date
Flavio Percoco
fb803a8570 Require types to opt-in Sync 2014-12-26 17:26:32 +01:00
bors
f673e9841f auto merge of #20167 : michaelwoerister/rust/for-loop-var, r=alexcrichton
... really this time `:)`

I went for the simpler fix after all since it turned out to become a bit too complicated to extract the current iteration value from its containing `Option` with the different memory layouts it can have. It's also what we already do for match bindings.

I also extended the new test case to include the "simple identifier" case.

Fixes #20127, fixes #19732
2014-12-25 14:21:47 +00:00
bors
7e11b22713 auto merge of #20117 : lfairy/rust/rename-include-bin, r=alexcrichton
According to [RFC 344][], methods that return `&[u8]` should have names ending in `bytes`. Though `include_bin!` is a macro not a method, it seems reasonable to follow the convention anyway.

We keep the old name around for now, but trigger a deprecation warning when it is used.

[RFC 344]: https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md

[breaking-change]
2014-12-24 20:47:12 +00:00
bors
14597f980a auto merge of #19813 : barosl/rust/autoderef-type-inference-ice, r=pnkfelix
`check::autoderef()` returns a `ty_err` when it fails to infer the type. `probe::probe()` should respect this failure and fail together to prevent further corruption.

Fixes #19692.
Fixes #19583.
Fixes #19297.
2014-12-24 18:37:07 +00:00
bors
29ad8539b9 auto merge of #20060 : Aatch/rust/enum-repr, r=alexcrichton
The previous behaviour of using the smallest type possible caused LLVM
to treat padding too conservatively, causing poor codegen. This commit
changes the behaviour to use an alignment-sized integer as the
discriminant. This keeps types the same size, but helps LLVM understand
the data structure a little better, resulting in better codegen.
2014-12-24 16:21:23 +00:00
bors
e64a8193b0 auto merge of #19858 : nick29581/rust/ranges, r=aturon
Closes #19794

r? @aturon for the first patch
r? @nikomatsakis for the rest
2014-12-24 06:31:13 +00:00
Nick Cameron
e82215d4e2 Review changes 2014-12-24 09:24:59 +13:00
Nick Cameron
e840e49b21 Tests 2014-12-24 09:12:46 +13:00
Eduard Burtescu
adabf4e63d rustc_typeck: don't expect rvalues to have unsized types. 2014-12-23 13:30:36 +02:00
Michael Woerister
875a30c492 debuginfo: Add test case for destructured for-loop variable. 2014-12-23 11:07:32 +01:00
Michael Woerister
6f88258f1d debuginfo: Create debuginfo for for-loop variables again. 2014-12-23 10:45:16 +01:00
Chris Wong
85c1a4b1ba Rename include_bin! to include_bytes!
According to [RFC 344][], methods that return `&[u8]` should have names
ending in `bytes`. Though `include_bin!` is a macro not a method, it
seems reasonable to follow the convention anyway.

We keep the old name around for now, but trigger a deprecation warning
when it is used.

[RFC 344]: https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md

[breaking-change]
2014-12-23 22:06:32 +13:00
James Miller
b473311ad8 Make alignment-forcing case work the same on 64 and 32-bit platforms 2014-12-23 20:44:06 +13:00
bors
62fb41c32b auto merge of #20145 : alexcrichton/rust/rollup, r=alexcrichton 2014-12-23 02:41:48 +00:00
James Miller
fe7adfe631 Add enum size cases to type-sizes test 2014-12-23 12:31:13 +13:00
James Miller
f1a3ff047e Use type-alignment-sized integer for discriminant types
The previous behaviour of using the smallest type possible caused LLVM
to treat padding too conservatively, causing poor codegen. This commit
changes the behaviour to use an type-alignment-sized integer as the
discriminant. This keeps types the same size, but helps LLVM understand
the data structure a little better, resulting in better codegen.
2014-12-23 12:29:52 +13:00
Alex Crichton
0a07db438b rollup merge of #19964: pnkfelix/everybody-loops-pprint
Conflicts:
	src/librustc/session/config.rs
	src/librustc_driver/lib.rs
	src/librustc_driver/pretty.rs
2014-12-22 12:53:23 -08:00
Alex Crichton
de11710d80 rollup merge of #19891: nikomatsakis/unique-fn-types-3
Conflicts:
	src/libcore/str.rs
	src/librustc_trans/trans/closure.rs
	src/librustc_typeck/collect.rs
	src/libstd/path/posix.rs
	src/libstd/path/windows.rs
2014-12-22 12:51:23 -08:00
Alex Crichton
459f3b2cfa rollup merge of #20056: MrFloya/iter_rename
Conflicts:
	src/libcollections/bit.rs
	src/libcore/str.rs
2014-12-22 12:49:57 -08:00
Alex Crichton
55cf032f43 rollup merge of #20124: klutzy/pprust-asm 2014-12-22 12:48:07 -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
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
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
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
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
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
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
f450695183 Revert "debuginfo: Add test case for destructured for-loop variable."
This reverts commit 87c5927b79.
2014-12-22 08:25:11 -08: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
Alex Crichton
082bfde412 Fallout of std::str stabilization 2014-12-21 23:31:42 -08:00
klutzy
023572b957 pprust: Fix asm options 2014-12-22 13:37:10 +09:00
Alex Crichton
fb7c08876e Test fixes and rebase conflicts 2014-12-21 13:49:04 -08:00
Alex Crichton
b084cda4e9 rollup merge of #20100: alexcrichton/issue-20091
Instead, just pass everything through as a Vec<u8> to get worried about later.

Closes #20091
2014-12-21 09:27:38 -08:00
Alex Crichton
a666105b4c std: Don't parse argv as a String
Instead, just pass everything through as a Vec<u8> to get worried about later.

Closes #20091
2014-12-21 09:27:38 -08:00
Alex Crichton
40e1f7c6ba rollup merge of #20080: seanmonstar/new-show-syntax
First step of #20013. This will allow (after a snapshot) to change all the debug strings from `{}` to `{:?}`.

r? @alexcrichton
2014-12-21 09:27:37 -08:00
Alex Crichton
e1d09766ad rollup merge of #20059: nick29581/self-impl
r? @sfackler

closes #20000
2014-12-21 09:27:35 -08:00
Alex Crichton
bc1d818b83 rollup merge of #20057: nick29581/array-syntax
This does NOT break any existing programs because the `[_, ..n]` syntax is also supported.

Part of #19999

r? @nikomatsakis
2014-12-21 09:27:35 -08:00
Alex Crichton
eb47e1e446 rollup merge of #20039: barosl/if-let-friendly-error
Fixes #19991.
2014-12-21 09:27:34 -08:00
Alex Crichton
a3dfaa62fe rollup merge of #20027: michaelwoerister/for-loop-var
Back when for-loop iteration variables were just de-sugared into `let` bindings, debuginfo for them was created like for any other `let` binding. When the implementation approach for for-loops changed, we ceased having debuginfo for the iteration variable. This PR fixes this omission and adds a more prominent test case for it.

Also contains some minor, general cleanup of the debuginfo module.

Fixes #19732
2014-12-21 09:27:34 -08:00
Alex Crichton
fc40812b0f rollup merge of #20006: alexcrichton/no-more-empty-modules
This commit modifies rustdoc to not require these empty modules to be public in
the standard library. The modules still remain as a location to attach
documentation to, but the modules themselves are now private (don't have to
commit to an API). The documentation for the standard library now shows all of
the primitive types on the main index page.
2014-12-21 09:27:33 -08:00
Alex Crichton
1d34d93d11 rollup merge of #19977: pnkfelix/add-test-for-issue-19811
Add regression test for Issue 19811.

(Thanks for @emk for providing this.)

Fix #19811.
2014-12-21 09:26:44 -08:00
Corey Farwell
98af642f5c Remove a ton of public reexports
Remove most of the public reexports mentioned in #19253

These are all leftovers from the enum namespacing transition

In particular:

* src/libstd/num/strconv.rs
 * ExponentFormat
 * SignificantDigits
 * SignFormat
* src/libstd/path/windows.rs
 * PathPrefix
* src/libstd/sys/windows/timer.rs
 * Req
* src/libcollections/str.rs
 * MaybeOwned
* src/libstd/collections/hash/map.rs
 * Entry
* src/libstd/collections/hash/table.rs
 * BucketState
* src/libstd/dynamic_lib.rs
 * Rtld
* src/libstd/io/net/ip.rs
 * IpAddr
* src/libstd/os.rs
 * MemoryMapKind
 * MapOption
 * MapError
* src/libstd/sys/common/net.rs
 * SocketStatus
 * InAddr
* src/libstd/sys/unix/timer.rs
 * Req

[breaking-change]
2014-12-21 09:26:41 -08:00
bors
c141f223d4 auto merge of #19953 : sanxiyn/rust/privacy-span, r=alexcrichton
Fix #19062.
2014-12-21 13:22:48 +00:00
Barosl Lee
c9010bff6c Fix error message on invalid field names for a struct variant
Fixes #19922.
2014-12-21 10:20:54 +09:00
bors
8a33de89c4 auto merge of #20073 : nikomatsakis/rust/generalized-where-clause-parser, r=nikomatsakis
This is the same branch as #20002 but with the pretty-printing test fixed.
2014-12-20 16:12:37 +00:00
Alexis Beingessner
9c5101542d Conventions and cleanup for Bitv and BitvSet
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-20 09:10:02 -05:00
bors
f8f2c7a953 auto merge of #19900 : alexcrichton/rust/compiler-flags, r=cmr
This commit shuffles around some CLI flags of the compiler to some more stable
locations with some renamings. The changes made were:

* The `-v` flag has been repurposes as the "verbose" flag. The version flag has
  been renamed to `-V`.
* The `-h` screen has been split into two parts. Most top-level options (not
  all) show with `-h`, and the remaining options (generally obscure) can be
  shown with `--help -v` which is a "verbose help screen"
* The `-V` flag (version flag now) has lost its argument as it is now requested
  with `rustc -vV` "verbose version".
* The `--emit` option has had its `ir` and `bc` variants renamed to `llvm-ir`
  and `llvm-bc` to emphasize that they are LLVM's IR/bytecode.
* The `--emit` option has grown a new variant, `dep-info`, which subsumes the
  `--dep-info` CLI argument. The `--dep-info` flag is now deprecated.
* The `--parse-only`, `--no-trans`, `--no-analysis`, and `--pretty` flags have
  moved behind the `-Z` family of flags.
* The `--debuginfo` and `--opt-level` flags were moved behind the top-level `-C`
  flag.
* The `--print-file-name` and `--print-crate-name` flags were moved behind one
  global `--print` flag which now accepts one of `crate-name`, `file-names`, or
  `sysroot`. This global `--print` flag is intended to serve as a mechanism for
  learning various metadata about the compiler itself.
* The top-level `--pretty` flag was moved to a number of `-Z` options.

No warnings are currently enabled to allow tools like Cargo to have time to
migrate to the new flags before spraying warnings to all users.

cc https://github.com/rust-lang/rust/issues/19051
2014-12-20 13:52:27 +00:00
Niko Matsakis
acd31db229 patch up pretty-printing test 2014-12-20 08:41:33 -05:00
Jared Roesch
d87b308b67 Add support for multiple region bounds in where clauses 2014-12-20 03:54:39 -08:00