Commit Graph

35690 Commits

Author SHA1 Message Date
Eduard Burtescu
e0d44386d3 rustc: use Ty instead of passing ty::sty around. 2014-12-20 07:04:42 +02:00
Eduard Burtescu
d5267d5845 Remove feature(import_shadowing) from all crates. 2014-12-20 06:37:14 +02:00
Nick Cameron
2e86929a4a Allow use of [_ ; n] syntax for fixed length and repeating arrays.
This does NOT break any existing programs because the `[_, ..n]` syntax is also supported.
2014-12-20 15:23:29 +13:00
bors
1c2df5cc3c auto merge of #19640 : aliblong/rust/power_of_two_reform, r=Gankro
The `is_power_of_two()` method of the `UnsignedInt` trait currently returns `true` for `self == 0`. Zero is not a power of two, assuming an integral exponent `k >= 0`. I've therefore moved this functionality to the new method `is_power_of_two_or_zero()` and reformed `is_power_of_two()` to return false for `self == 0`.

To illustrate the usefulness of the existence of both functions, consider `HashMap`. Its capacity must be zero or a power of two; conversely, it also requires a (non-zero) power of two for key and val alignment.

Also, added a small amount of documentation regarding #18604.
2014-12-20 01:12:19 +00:00
Barosl Lee
314ed2df09 Drop the Match prefix from the MatchSource variants 2014-12-20 09:17:14 +09:00
Barosl Lee
7023bea22c Print a friendly error for the if-let construct without an else block
Fixes #19991.
2014-12-20 09:17:14 +09:00
Barosl Lee
39f249067a Implement Deref for Box
Fixes #18624.
2014-12-20 08:58:33 +09:00
Aaron Liblong
f6328b60da Reform power_of_two methods for perf increase & semantic change to consider 0 not a power of 2.
Vec panics when attempting to reserve capacity > int::MAX (uint::MAX / 2).
2014-12-19 18:21:24 -05:00
Alex Crichton
a71686f4ea std: Second pass stabilization of Result<T, E>
This commit, like the second pass of `Option`, largely just stablizes the
existing functionality after renaming a few iterators.

The specific actions taken were:

* The `Ok` and `Err` variants were marked `#[stable]` as the stability
  inheritance was since removed.
* The `as_mut` method is now stable.
* The `map` method is now stable
* The `map_err` method is now stable
* The `iter`, `iter_mut`, and `into_iter` methods now returned structures named
  after the method of iteration. The methods are also now all stable.
* The `and_then` method is now stable.
* The `or_else` method is now stable.
* The `unwrap` family of functions are now all stable: `unwrap_or`,
  `unwrap_or_else`, `unwrap`, and `unwrap_err`.

There is a possible open extension to `Result::{and, and_then}` to make the
return type further generic over `FromError` (as proposed in #19078), but this
is a backwards compatible change due to the usage of default type parameters,
which makes the two functions safe to stabilize now regardless of the outcome of
that issue.
2014-12-19 13:42:55 -08:00
Michael Neumann
4c3a8f17cc load_self() needs to be public 2014-12-19 22:19:37 +01:00
Chase Southwood
d61db0c696 Implement resize for Vec
This commit adds `resize` to `Vec` in accordance with RFC 509.
2014-12-19 15:04:36 -06:00
bluss
cf350ea5eb hashset: Clean up and rename the HashSet iterators
This removes the type SetAlgebraItems and replaces it with the
structs Intersection and Difference.

Rename the existing HashSet iterators according to RFC #344:

* SetItems -> Iter
* SetMoveItems -> IntoIter
* Remaining set combination iterators renamed to Union and SymmetricDifference

[breaking-change]
2014-12-19 21:54:50 +01:00
bors
cbe9fb45bc auto merge of #19463 : kali/rust/master, r=alexcrichton
parse_ty() no longer takes a boolean parameter. quote_ty! implementation has not yet been modified accordingly. 

As a matter of fact, quote_ty! was not covered by tests. One test (called qquotes) references it, but it has been ignored for nearly one year and now need heavy refactoring.

quote_token.rs seemed like a good place to test quote_ty!, many other quote_*! macros were asserted there.
2014-12-19 20:22:17 +00:00
Barosl Lee
d9f306757d Detect type inference failure when auto-dereferencing a pointer
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.

Call stack: check::check_method_call() -> method::lookup() ->
            probe::probe() + confirm::confirm()

Fixes #19692.
Fixes #19583.
Fixes #19297.
2014-12-20 04:54:43 +09:00
Alex Crichton
117984b884 rustc: Start "stabilizing" some flags
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`, and `--no-analysis` 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.

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.
2014-12-19 11:38:24 -08:00
Kevin Yap
1919de87bb Miscellaneous changes to Rust Guide
- Various grammatical changes
- Place punctuation outside of key term quotes
- Change comment placement in 17.2 code block
- Replace double hyphens with en dashes
2014-12-19 10:23:06 -08:00
Alex Crichton
84086c464f Register new snapshots
This does not yet start the movement to rustc-serialize. That detail is left to
a future PR.
2014-12-19 08:58:10 -08:00
bors
95c2ed31ae auto merge of #19867 : japaric/rust/deriving-copy, r=acrichto
r? @alexcrichton
2014-12-19 16:02:31 +00:00
Jorge Aparicio
f975b10310 windows: remove unused import 2014-12-19 10:51:01 -05:00
Jorge Aparicio
4c6e76b7c8 libtime: use #[deriving(Copy)] 2014-12-19 10:51:01 -05:00
Jorge Aparicio
ce92437769 libtest: use #[deriving(Copy)] 2014-12-19 10:51:01 -05:00
Jorge Aparicio
64234b3541 libterm: use #[deriving(Copy)] 2014-12-19 10:51:01 -05:00
Jorge Aparicio
86f8c127dd libsyntax: use #[deriving(Copy)] 2014-12-19 10:51:00 -05:00
Jorge Aparicio
a77e8a63d5 libstd: use #[deriving(Copy)] 2014-12-19 10:51:00 -05:00
Jorge Aparicio
2df30a47e2 libserialize: use #[deriving(Copy)] 2014-12-19 10:51:00 -05:00
Jorge Aparicio
1d25271e05 librustrt: use #[deriving(Copy)] 2014-12-19 10:51:00 -05:00
Jorge Aparicio
4c007568bf librustdoc: use #[deriving(Copy)] 2014-12-19 10:51:00 -05:00
Jorge Aparicio
fa0383f38d librustc_typeck: use #[deriving(Copy)] 2014-12-19 10:51:00 -05:00
Jorge Aparicio
5e2bca9e86 librustc_trans: use #[deriving(Copy)] 2014-12-19 10:51:00 -05:00
Jorge Aparicio
463475b7fa librustc_llvm: use #[deriving(Copy)] 2014-12-19 10:51:00 -05:00
Jorge Aparicio
db45be2616 librustc_driver: use #[deriving(Copy)] 2014-12-19 10:51:00 -05:00
Jorge Aparicio
392ea799b8 librustc_borrowck: use #[deriving(Copy)] 2014-12-19 10:51:00 -05:00
Jorge Aparicio
e64a0072d6 librustc: use #[deriving(Copy)] 2014-12-19 10:51:00 -05:00
Jorge Aparicio
f2ef2cda52 libregex: use #[deriving(Copy)] 2014-12-19 10:43:24 -05:00
Jorge Aparicio
fd4a5d9ef1 librbml: use #[deriving(Copy)] 2014-12-19 10:43:24 -05:00
Jorge Aparicio
a18d090c3c librand: use #[deriving(Copy)] 2014-12-19 10:43:24 -05:00
Jorge Aparicio
e0a88a78da liblog: use #[deriving(Copy)] 2014-12-19 10:43:24 -05:00
Jorge Aparicio
c407785ac0 libgetopts: use #[deriving(Copy)] 2014-12-19 10:43:24 -05:00
Jorge Aparicio
4c62c76ef9 libfmt_macros: use #[deriving(Copy)] 2014-12-19 10:43:24 -05:00
Jorge Aparicio
30cefcbdfd libcore: use #[deriving(Copy)] 2014-12-19 10:43:23 -05:00
Jorge Aparicio
c32a48293a libcollections: use #[deriving(Copy)] 2014-12-19 10:43:23 -05:00
Clark Gaebel
525f65ebbf Add RingBuf::as_slices as per collections reform v2.
See: https://github.com/rust-lang/rfcs/pull/509

Not sure if this is allowed to land before the RFC. Either way,
it's here for review.

r? @Gankro
cc: @bfops
2014-12-19 09:41:30 -05:00
Valerii Hiora
e5d8c85507 iOS: fallout of runtime removal 2014-12-19 16:34:01 +02:00
Mathieu Poumeyrol
8920181052 ack parser.parse_ty change in quote_ty! (+ test) 2014-12-19 15:25:02 +01:00
Bheesham Persaud
611ef49f2f Took out all of the metrics stuff from tests.mk
References rust-lang/rust/#19145

	modified:   src/llvm (new commits)
2014-12-19 08:57:15 -05:00
Michael Woerister
87c5927b79 debuginfo: Add test case for destructured for-loop variable. 2014-12-19 14:46:42 +01:00
bors
bd90b936d7 auto merge of #19884 : nikomatsakis/rust/issue-19730-perfect-forwarding, r=pnkfelix
Rewrite how the HRTB algorithm matches impls against obligations. Instead of impls providing higher-ranked trait-references, impls now once again only have early-bound regions. The skolemization checks are thus moved out into trait matching itself. This allows to implement "perfect forwarding" impls like those described in #19730. This PR builds on a previous PR that was already reviewed by @pnkfelix.

r? @pnkfelix 

Fixes #19730
2014-12-19 13:22:10 +00:00
Michael Neumann
25c1bfe175 Several fixes for DragonFly (rebase) 2014-12-19 13:05:06 +01:00
Michael Woerister
34a6fcf195 debuginfo: Clean the debuginfo module up a bit. 2014-12-19 12:07:17 +01:00
Philip Munksgaard
3bb91aa28f Add a check for uninferred type parameter
This fixes #19978. The bug was introduced by 570325d, where if the type
of an Fn has not been inferred (strs[0] is "_") we slice from 1 to
0. We now explicitly check if `strs[0]` is a single element tuple.
2014-12-19 11:06:38 +01:00