Commit Graph

33517 Commits

Author SHA1 Message Date
Alex Crichton
8e9f8f924c collections: impl Deref for Vec/String
This commit adds the following impls:

    impl<T> Deref<[T]> for Vec<T>
    impl<T> DerefMut<[T]> for Vec<T>
    impl Deref<str> for String

This commit also removes all duplicated inherent methods from vectors and
strings as implementations will now silently call through to the slice
implementation. Some breakage occurred at std and beneath due to inherent
methods removed in favor of those in the slice traits and std doesn't use its
own prelude,

cc #18424
2014-10-29 18:48:30 -07:00
bors
dd7113609c auto merge of #18375 : steveklabnik/rust/gh17969, r=alexcrichton
Fixes #17969
2014-10-29 15:17:01 +00:00
bors
3bc545373d auto merge of #18365 : bjz/rust/token, r=alexcrichton
[breaking-change]

(for syntax-extensions)

- Token variant identifiers have been converted to PascalCase for consistency with Rust coding standards
- Some free-functions in `syntax::token` have been converted to methods on `syntax::token::Token`:
    - `can_begin_expr`         -> `Token::can_begin_expr`
    - `close_delimiter_for`    -> `Token::get_close_delimiter`
    - `is_lit`                 -> `Token::is_lit`
    - `is_ident`               -> `Token::is_ident`
    - `is_path`                -> `Token::is_path`
    - `is_plain_ident`         -> `Token::is_plain_ident`
    - `is_lifetime`            -> `Token::is_lifetime`
    - `is_mutability`          -> `Token::is_mutability`
    - `to_binop`               -> `Token::to_binop`
    - `is_keyword`             -> `Token::is_keyword`
    - `is_any_keyword`         -> `Token:is_any_keyword`
    - `is_strict_keyword`      -> `Token::is_strict_keyword`
    - `is_reserved_keyword`    -> `Token::is_reserved_keyword`
    - `mtwt_token_eq`          -> `Token::mtwt_eq`
- `token::Ident` now takes an enum instead of a boolean for clarity
- `token::{to_string, binop_to_string}` were moved to `pprust::{token_to_string, binop_to_string}`
2014-10-29 10:22:01 +00:00
bors
124508dea1 auto merge of #18340 : chastell/rust/guide_closures_fixes, r=steveklabnik
Some minor wording fixes to the Closures chapter; my brain tripped a few times when reading it, so I tried to come up with something a bit smoother. I’m not a native speaker, so please do review this critically.
2014-10-29 06:36:57 +00:00
bors
1effc9e141 auto merge of #18410 : thestinger/rust/revert-parallel, r=alexcrichton
This reverts commit c245c5bbad.

Parallel code generation generates invalid code for librand, which is
caught by recent versions of binutils.
2014-10-29 02:26:59 +00:00
Daniel Micay
79723a3e30 Revert "enable parallel codegen by default"
This reverts commit c245c5bbad.

Parallel code generation generates invalid code for librand, which is
caught by recent versions of binutils.
2014-10-28 20:14:00 -04:00
bors
1652a1f2c6 auto merge of #17603 : jakub-/rust/ty_bot, r=nikomatsakis
We now instead use a fresh variable for expressions that diverge.

Closes #14973.
Closes #13847.

[Work in progress]

cc @nikomatsakis
2014-10-28 22:11:56 +00:00
bors
98bbccf2c7 auto merge of #18291 : japaric/rust/dstify, r=aturon
This PR changes the signature of several methods from `foo(self, ...)` to `foo(&self, ...)`/`foo(&mut self, ...)`, but there is no breakage of the usage of these methods due to the autoref nature of `method.call()`s. This PR also removes the lifetime parameter from some traits (`Trait<'a>` -> `Trait`). These changes break any use of the extension traits for generic programming, but those traits are not meant to be used for generic programming in the first place. In the whole rust distribution there was only one misuse of a extension trait as a bound, which got corrected (the bound was unnecessary and got removed) as part of this PR.

I've kept the commits as small and self-contained as possible for reviewing sake, but I can squash them when the review is over.

See this [table] to get an idea of what's left to be done. I've already DSTified [`Show`][show] and I'm working on `Hash`, but bootstrapping those changes seem to require a more recent snapshot (#18259 does the trick)

r? @aturon 
cc #16918 

[show]: https://github.com/japaric/rust/commits/show
[table]: https://docs.google.com/spreadsheets/d/1MZ_iSNuzsoqeS-mtLXnj9m0hBYaH5jI8k9G_Ud8FT5g/edit?usp=sharing
2014-10-28 19:56:56 +00:00
Steve Klabnik
b7e177d242 update keyword list
Fixes #17969
2014-10-28 15:55:04 -04:00
bors
3fa2b56537 auto merge of #17851 : brson/rust/rustup, r=alexcrichton
Just to have it somewhere to point to. Updating it will not
automatically update the one on static.rust-lang.org.
2014-10-28 17:47:01 +00:00
Jakub Bukaj
6d2080c448 Address review comments 2014-10-28 18:33:38 +01:00
Brian Anderson
9106546aa7 Long lines 2014-10-28 10:24:03 -07:00
Jakub Bukaj
7f523e7252 Update tests with the new error messages 2014-10-28 17:54:16 +01:00
Jakub Bukaj
cca84e9e21 Remove ty_bot from the type system
We now instead use a fresh variable for expressions that diverge.
2014-10-28 17:54:16 +01:00
bors
d1bfd6515c auto merge of #18273 : gamazeps/rust/issue18218, r=steveklabnik
Closes #18218
2014-10-28 14:36:54 +00:00
bors
58dc0a05ab auto merge of #18386 : nikomatsakis/rust/issue-18208, r=pnkfelix
Avoid O(n^2) performance by reconsidering the full set of obligations only when we are about to report an error (#18208). I found it is still important to consider the full set in order to make tests like `let x: Vec<_> = obligations.iter().collect()` work.

I think we lack the infrastructure to write a regression test for this, but when I did manual testing I found a massive reduction in type-checking time for extreme examples like those found in #18208 vs stage0.

f? @dotdash
2014-10-28 12:26:50 +00:00
Niko Matsakis
1da73ff126 Avoid O(n^2) performance by reconsidering the full set of obligations only when we are about to report an error (#18208). I found it is still important to consider the full set in order to make tests like let x: Vec<_> = obligations.iter().collect() work. 2014-10-28 08:18:21 -04:00
bors
9a778bc550 auto merge of #18254 : areski/rust/pr-fix-vec-doc-example, r=alexcrichton
- shrink_to_fit example is now more clear by asserting the capacity value
- annotation [0, mid) changed for [0, mid]
2014-10-28 10:11:51 +00:00
bors
faed6489da auto merge of #18127 : alexcrichton/rust/deriving-arc, r=aturon
This adds impls of Eq/Ord/PartialEq/PartialOrd/Show/Default to Arc<T>, and it
also removes the `Send + Sync` bound on the `Clone` impl of Arc to make it more
deriving-friendly. The `Send + Sync` requirement is still enforce on
construction, of course!
2014-10-28 08:01:52 +00:00
bors
3f37e2efac auto merge of #18192 : jmesmon/rust/platform-generic, r=alexcrichton
The goal here is to make it easier to add new platform definitions,
especially when the additions are programmatic (ie: in build scripts).
2014-10-28 05:46:53 +00:00
Alex Crichton
35ad00d2ec alloc: Make deriving more friendly with Arc
This adds impls of Eq/Ord/PartialEq/PartialOrd/Show/Default to Arc<T>, and it
also removes the `Send + Sync` bound on the `Clone` impl of Arc to make it more
deriving-friendly. The `Send + Sync` requirement is still enforce on
construction, of course!
2014-10-27 22:45:44 -07:00
Brendan Zabarauskas
665ad9c175 Move token-to-string functions into print::pprust 2014-10-28 15:55:38 +11:00
Brendan Zabarauskas
cd049591a2 Use an enum rather than a bool in token::Ident 2014-10-28 15:55:37 +11:00
Brendan Zabarauskas
fcb78d65f2 Convert some token functions into methods 2014-10-28 15:55:37 +11:00
Brendan Zabarauskas
d8b1fa0ae0 Use PascalCase for token variants 2014-10-28 15:55:37 +11:00
bors
823f805453 auto merge of #18144 : bkoropoff/rust/mighty-monomorphizin-unboxed-closures, r=nikomatsakis
This allows unboxed closures that reference free type/region parameters to be monomorphized correctly in trans.

It was necessary to make `ty_unboxed_closure` carry around a `Substs` to accomplish this.  Plumbing this through typeck revealed several areas where type/region parameters in unboxed closure types are possibly not being handled correctly.  Since my goal was just to fix trans, I decided to leave FIXME comments on areas that still need attention and seek feedback on the best way to clean them up, possibly as a follow-up PR.

Closes #16791
2014-10-28 03:26:52 +00:00
Brian Koropoff
e46af8caec Add regression test for issue #16791 2014-10-27 18:51:43 -07:00
Brian Koropoff
f0cc3a9365 Fix monomorphization of unboxed closures
This adds a `Substs` field to `ty_unboxed_closure` and plumbs basic
handling of it throughout the compiler. trans now correctly
monomorphizes captured free variables and llvm function defs.  This
fixes uses of unboxed closures which reference a free type or region
parameter from their environment in either their signature or free
variables.  Closes #16791
2014-10-27 18:51:27 -07:00
Jorge Aparicio
94ddb51c9c DSTify [T]/str extension traits
This PR changes the signature of several methods from `foo(self, ...)` to
`foo(&self, ...)`/`foo(&mut self, ...)`, but there is no breakage of the usage
of these methods due to the autoref nature of `method.call()`s. This PR also
removes the lifetime parameter from some traits (`Trait<'a>` -> `Trait`). These
changes break any use of the extension traits for generic programming, but
those traits are not meant to be used for generic programming in the first
place. In the whole rust distribution there was only one misuse of a extension
trait as a bound, which got corrected (the bound was unnecessary and got
removed) as part of this PR.

[breaking-change]
2014-10-27 20:20:08 -05:00
bors
bd7138dd69 auto merge of #18368 : alexcrichton/rust/rollup, r=alexcrichton 2014-10-27 23:02:55 +00:00
Alex Crichton
4dc06dceb2 rollup merge of #18259 : alexcrichton/snapshots 2014-10-27 15:12:48 -07:00
Alex Crichton
a33d7617c5 Test fixes and rebase conflicts from rollup 2014-10-27 15:12:48 -07:00
Alex Crichton
40811f84ef rollup merge of #18334 : csherratt/arc-encodable 2014-10-27 15:12:48 -07:00
Alex Crichton
6e9d5a6d9d rollup merge of #18366 : aochagavia/ascii 2014-10-27 15:12:48 -07:00
Alex Crichton
c5cc27f9a2 rollup merge of #18364 : cakebaker/missing_a 2014-10-27 15:12:48 -07:00
Alex Crichton
20b9897c58 rollup merge of #18362 : kevinmehall/pprint-struct-pat-shorthand 2014-10-27 15:12:47 -07:00
Alex Crichton
c381752b0e rollup merge of #18356 : jakub-/const-pattern-suptype 2014-10-27 15:12:47 -07:00
Alex Crichton
a1d719dad4 rollup merge of #18347 : cakebaker/ffi 2014-10-27 15:12:47 -07:00
Alex Crichton
15547e1d72 rollup merge of #18346 : aochagavia/closure-fields 2014-10-27 15:12:47 -07:00
Alex Crichton
cfeff3e1c7 rollup merge of #18344 : aochagavia/show-arc 2014-10-27 15:12:47 -07:00
Alex Crichton
1cc938a69a rollup merge of #18337 : bkoropoff/unboxed-imm-upvar-fixes 2014-10-27 15:12:45 -07:00
Alex Crichton
175d6a7435 rollup merge of #18332 : jbcrail/fix-comments 2014-10-27 15:12:30 -07:00
Alex Crichton
287df9e0eb rollup merge of #18329 : sfackler/memwriter-clear 2014-10-27 15:12:30 -07:00
Alex Crichton
ed7f4a8da4 rollup merge of #18327 : vadimcn/17982 2014-10-27 15:12:30 -07:00
Alex Crichton
650214b170 rollup merge of #18326 : sfackler/cfg-final 2014-10-27 15:12:30 -07:00
Alex Crichton
f1118cc084 rollup merge of #18324 : jakub-/eneedstest 2014-10-27 15:12:30 -07:00
Alex Crichton
dac3234bba rollup merge of #18321 : chastell/guide_refresh_testing_output 2014-10-27 15:12:29 -07:00
Alex Crichton
54647bd317 rollup merge of #18320 : chastell/guide_simplify_formatting 2014-10-27 15:12:29 -07:00
Alex Crichton
9dc9eccf3d rollup merge of #18316 : thestinger/raw 2014-10-27 15:12:29 -07:00
Alex Crichton
abfc2f3b8d rollup merge of #18315 : arielb1/constexpr-addr 2014-10-27 15:12:29 -07:00