Commit Graph

35334 Commits

Author SHA1 Message Date
Alex Crichton
71201234d2 rollup merge of #19720: csouth3/vecmap-newtypes
Using a type alias for iterator implementations is fragile since this
exposes the implementation to users of the iterator, and any changes
could break existing code.

This commit changes the iterators of `VecMap` to use
proper new types, rather than type aliases.  However, since it is
fair-game to treat a type-alias as the aliased type, this is a:

[breaking-change].
2014-12-17 11:50:23 -08:00
bors
66c297d847 auto merge of #19800 : sfackler/rust/core-hash, r=alexcrichton
r? @alexcrichton
2014-12-17 16:43:20 +00:00
bors
2c533efd09 auto merge of #19799 : alexcrichton/rust/stop-panicking, r=huonw
Fix a panic where the compiler was looking at stale or old metadata.

See #19798, #19772, #19757, #19744, #19718, #19691.
2014-12-17 14:33:12 +00:00
bors
4e8ba4955c auto merge of #19789 : nick29581/rust/assoc-ufcs2, r=nikomatsakis
Closes #18433
2014-12-17 08:13:07 +00:00
Chase Southwood
9caa66f9c8 Implement BorrowFrom<Arc<T>> for T 2014-12-16 22:12:40 -06:00
bors
4265e86844 auto merge of #19761 : nick29581/rust/coerce-double, r=nikomatsakis
Part of #18469

[breaking-change]

A receiver will only ever get a single auto-reference. Previously arrays and strings would get two, e.g., [T] would be auto-ref'ed to &&[T]. This is usually apparent when a trait is implemented for `&[T]` and has a method takes self by reference. The usual solution is to implement the trait for `[T]` (the DST form).

r? @nikomatsakis (or anyone else, really)
2014-12-17 02:42:57 +00:00
Kevin Yap
2ba2843b49 Minor changes to Rust Language FAQ
- Change long inline code to code block
- Replace double-hyphens with en dash
- Miscellaneous rephrasings for clarity
2014-12-16 18:25:38 -08:00
Steve Klabnik
18c420ed62 Improve docs for std::vec 2014-12-16 21:20:58 -05:00
Piotr Czarnecki
59d4153457 Implement remove for RingBuf 2014-12-17 00:37:55 +01:00
Steve Klabnik
033a79203e Document std::mem 2014-12-16 18:23:55 -05:00
Philipp Gesang
c1b69c7a82
guide-ownership.md, guide-testing.md: fix typos
Signed-off-by: Philipp Gesang <phg@phi-gamma.net>
2014-12-16 23:50:42 +01:00
Clark Gaebel
c42e2f604e Small cleanups in HashMap based off of new rust features. 2014-12-16 17:45:16 -05:00
P1start
570325dd3c Use the sugary syntax to print the Fn traits in error messages 2014-12-17 09:33:09 +13:00
Sean Collins
73d395e6db Change 'if' to lowercase, so it displays better on the site 2014-12-16 13:55:34 -05:00
bors
42deaa5e42 auto merge of #19921 : FlaPer87/rust/snapshot, r=nikomatsakis
r? @nikomatsakis
2014-12-16 17:51:23 +00:00
Alex Crichton
df5404cfa8 std: Change escape_unicode to use new escapes
This changes the `escape_unicode` method on a `char` to use the new style of
unicode escapes in the language.

Closes #19811
Closes #19879
2014-12-16 08:09:37 -08:00
Felix S. Klock II
8f4e9c2357 Fix make TAGS.emacs. 2014-12-16 17:08:49 +01:00
Felix S. Klock II
375b79a0fb Followup fixes that I missed during an earlier rebase. 2014-12-16 17:07:26 +01:00
Valerii Hiora
b7ba69d4dd Fixed iOS build after oibit 2014-12-16 18:07:05 +02:00
bors
4375be65a4 auto merge of #19647 : nielsegberts/rust/master, r=pnkfelix
The names expected and actual are not used anymore in the output. It also
removes the confusion that the argument order is the opposite of junit.

Bug #7330 is relevant.
2014-12-16 14:50:58 +00:00
Flavio Percoco
8a5698834e Create a snapshot on top of 1b97cd3 2014-12-16 14:39:18 +01:00
Felix S. Klock II
7d4e7f0795 AST refactor: make the place in ExprBox an option.
This is to allow us to migrate away from UnUniq in a followup commit,
and thus unify the code paths related to all forms of `box`.
2014-12-16 14:30:30 +01:00
bors
59287b0170 auto merge of #19782 : gereeter/rust/cleanup-btree-node, r=Gankro
Before:
```
test btree::map::bench::find_rand_100                      ... bench:        12 ns/iter (+/- 0)
test btree::map::bench::find_rand_10_000                   ... bench:        13 ns/iter (+/- 1)
test btree::map::bench::find_seq_100                       ... bench:        11 ns/iter (+/- 0)
test btree::map::bench::find_seq_10_000                    ... bench:        11 ns/iter (+/- 1)
test btree::map::bench::insert_rand_100                    ... bench:       106 ns/iter (+/- 1)
test btree::map::bench::insert_rand_10_000                 ... bench:       326 ns/iter (+/- 8)
test btree::map::bench::insert_seq_100                     ... bench:       198 ns/iter (+/- 1)
test btree::map::bench::insert_seq_10_000                  ... bench:       312 ns/iter (+/- 3)
test btree::map::bench::iter_1000                          ... bench:     16563 ns/iter (+/- 173)
test btree::map::bench::iter_100000                        ... bench:   1686508 ns/iter (+/- 108592)
test btree::map::bench::iter_20                            ... bench:       365 ns/iter (+/- 25)
```

After:
```
test btree::map::bench::find_rand_100                      ... bench:        12 ns/iter (+/- 0)
test btree::map::bench::find_rand_10_000                   ... bench:        12 ns/iter (+/- 0)
test btree::map::bench::find_seq_100                       ... bench:        11 ns/iter (+/- 0)
test btree::map::bench::find_seq_10_000                    ... bench:        11 ns/iter (+/- 0)
test btree::map::bench::insert_rand_100                    ... bench:        89 ns/iter (+/- 1)
test btree::map::bench::insert_rand_10_000                 ... bench:       121 ns/iter (+/- 3)
test btree::map::bench::insert_seq_100                     ... bench:       149 ns/iter (+/- 0)
test btree::map::bench::insert_seq_10_000                  ... bench:       228 ns/iter (+/- 1)
test btree::map::bench::iter_1000                          ... bench:     16965 ns/iter (+/- 220)
test btree::map::bench::iter_100000                        ... bench:   1687836 ns/iter (+/- 18746)
test btree::map::bench::iter_20                            ... bench:       366 ns/iter (+/- 21)
```
2014-12-16 11:02:56 +00:00
Flavio Percoco
127dac4990 Don't make unboxed closures implicitly copiable
The fix just checks if the bound is `Copy` and returns an `Err` if so.

Closes: #19817
2014-12-16 11:44:10 +01:00
bors
41f5907fa6 auto merge of #19777 : nikomatsakis/rust/warn-on-shadowing, r=acrichto
per rfc 459
cc https://github.com/rust-lang/rust/issues/19390

One question is: should we start by warning, and only switch to hard error later? I think we discussed something like this in the meeting. 

r? @alexcrichton
2014-12-16 08:42:40 +00:00
mdinger
3a073e3127 Tuple test no longer needed. Is already in run-pass tests 2014-12-16 02:42:25 -05:00
Steven Fackler
24a8ef63ff Move hash module from collections to core 2014-12-15 22:48:54 -08:00
bors
cdd8b5b5ea auto merge of #19478 : nick29581/rust/assoc-ice-test, r=nikomatsakis
closes #19121

r?

This won't actually pass until https://github.com/rust-lang/rust/pull/19391 lands
2014-12-16 06:22:40 +00:00
Aaron Friel
4ecad89636 Add probe and var for file
Was testing rustup on a very minimal Debian installation and got errors during the install process (error occurred in `install.sh` of the Rust nightly.)

Noticed that Rustup was downloading the i686 nightly instead of x86-64. Installing `file` fixed the problem, and this patch adds the probe to ensure file is installed before attempting to use it.

There may still be an issue with the i686 installation, I did not investigate further.
2014-12-15 22:45:12 -06:00
Nick Cameron
98c4d4b7f4 Test for associated types ICE
closes #19121
2014-12-16 17:20:28 +13:00
Nick Cameron
769aa0a7b3 Remove the double auto-ref on arrays/strings as receivers
Part of #18469

[breaking-change]

A receiver will only ever get a single auto-reference. Previously arrays and strings would get two, e.g., [T] would be auto-ref'ed to &&[T]. This is usually apparent when a trait is implemented for `&[T]` and has a method takes self by reference. The usual solution is to implement the trait for `[T]` (the DST form).
2014-12-16 17:05:33 +13:00
Alex Crichton
9021f61ef7 std: Second pass stabilization of default
This commit performs a second pass stabilization of the `std::default` module.
The module was already marked `#[stable]`, and the inheritance of `#[stable]`
was removed since this attribute was applied. This commit adds the `#[stable]`
attribute to the trait definition and one method name, along with all
implementations found in the standard distribution.
2014-12-15 20:04:52 -08:00
Alex Crichton
23bae856b7 std: Second-pass stabilization of mem
This commit takes a second pass through the `std::mem` module for stabilization.
The only remaining non-stable items in this module were `forget`, `transmute`,
`copy_lifetime`, and `copy_lifetime_mut`.

The `forget` and `transmute` intrinsics themselves were marked `#[stable]` to
propgate into the `core::mem` module so they would be marked stable.

The `copy_lifetime` functions were left `unstable`, but `Sized?` annotations
were added to the parameters to allow more general use with DSTs.

The `size_of_val`, `min_align_of_val`, and `align_of_val` functions would like
to grow `Sized?` bounds, but this is a backwards compatible change that
currently ICEs the compiler, so this change was not made at this time.

Finally, the module itself was declared `#![stable]` in this pass.
2014-12-15 19:46:44 -08:00
Brian Koropoff
0a1798dd1e Fix pretty printing of HRTB syntax 2014-12-15 18:26:06 -08:00
Brian Koropoff
3925b4d5c9 Add regression test for #19791 2014-12-15 18:26:05 -08:00
Brian Koropoff
13e7f9c0a7 Handle higher-rank lifetimes when generating type IDs
Normalize late-bound regions in bare functions, stack closures,
and traits and include them in the generated hash.

Closes #19791
2014-12-15 18:26:05 -08:00
bors
b497f05008 auto merge of #19747 : alexcrichton/rust/slice-one-trait, r=brson
This commit collapses the various prelude traits for slices into just one trait:

* SlicePrelude/SliceAllocPrelude => SliceExt
* CloneSlicePrelude/CloneSliceAllocPrelude => CloneSliceExt
* OrdSlicePrelude/OrdSliceAllocPrelude => OrdSliceExt
* PartialEqSlicePrelude => PartialEqSliceExt
2014-12-16 01:32:33 +00:00
Chase Southwood
341cf405e5 Use wrapper structs for HashSet's iterators.
Using a type alias for iterator implementations is fragile since this
exposes the implementation to users of the iterator, and any changes
could break existing code.

This commit changes the iterators of `HashSet` to use
proper new types, rather than type aliases.  However, since it is
fair-game to treat a type-alias as the aliased type, this is a:

[breaking-change].
2014-12-15 19:31:07 -06:00
Chase Southwood
85fe141fb7 Use wrapper structs for HashMap's iterators.
Using a type alias for iterator implementations is fragile since this
exposes the implementation to users of the iterator, and any changes
could break existing code.

This commit changes the keys and values iterators of `HashMap` to use
proper new types, rather than type aliases.  However, since it is
fair-game to treat a type-alias as the aliased type, this is a:

[breaking-change].
2014-12-15 19:28:45 -06:00
Chase Southwood
a81c3ab468 Use wrapper structs for BTreeSet's iterators.
Using a type alias for iterator implementations is fragile since this
exposes the implementation to users of the iterator, and any changes
could break existing code.

This commit changes the iterators of `BTreeSet` to use
proper new types, rather than type aliases.  However, since it is
fair-game to treat a type-alias as the aliased type, this is a:

[breaking-change].
2014-12-15 19:28:24 -06:00
Chase Southwood
765806ef1e Use wrapper structs for BTreeMap's iterators.
Using a type alias for iterator implementations is fragile since this
exposes the implementation to users of the iterator, and any changes
could break existing code.

This commit changes the keys and values iterators of `BTreeMap` to use
proper new types, rather than type aliases.  However, since it is
fair-game to treat a type-alias as the aliased type, this is a:

[breaking-change].
2014-12-15 19:26:28 -06:00
Nick Cameron
743d6a4132 Review changes 2014-12-16 13:50:24 +13:00
Nick Cameron
65616644af Path types to associated types with form T::A
Closes #18433
2014-12-16 13:50:24 +13:00
jbranchaud
a9dbb7908d Add a doctest for the string Add function. 2014-12-15 16:40:27 -06:00
bors
0669a432a2 auto merge of #19448 : japaric/rust/binops-by-value, r=nikomatsakis
- The following operator traits now take their arguments by value: `Add`, `Sub`, `Mul`, `Div`, `Rem`, `BitAnd`, `BitOr`, `BitXor`, `Shl`, `Shr`. This breaks all existing implementations of these traits.

- The binary operation `a OP b` now "desugars" to `OpTrait::op_method(a, b)` and consumes both arguments.

- `String` and `Vec` addition have been changed to reuse the LHS owned value, and to avoid internal cloning. Only the following asymmetric operations are available: `String + &str` and `Vec<T> + &[T]`, which are now a short-hand for the "append" operation.

[breaking-change]

---

This passes `make check` locally. I haven't touch the unary operators in this PR, but converting them to by value should be very similar to this PR. I can work on them after this gets the thumbs up.

@nikomatsakis r? the compiler changes
@aturon r? the library changes. I think the only controversial bit is the semantic change of the `Vec`/`String` `Add` implementation.
cc #19148
2014-12-15 22:11:44 +00:00
Jacob Edelman
72608eba43 Fixed a small spelling mistake 2014-12-15 17:07:49 -05:00
Felix S. Klock II
d6d0bb2030 Added -Z print-region-graph debugging option; produces graphviz
visualization of region inference constraint graph.

Optionally uses environment variables `RUST_REGION_GRAPH=<path_template>`
and `RUST_REGION_GRAPH_NODE=<node-id>` to select which file to output
to and which AST node to print.

Note that in some cases of method AST's, the identification of AST
node is based on the id for the *body* of the method; this is largely
due to having the body node-id already available at the relevant point
in the control-flow of rustc in its current incarnation. Ideally we
would handle identifying AST's by name in addition to node-id,
e.g. the same way that the pretty-printer supports path suffixes as
well as node-ids for identifying subtrees to print.
2014-12-15 22:43:09 +01:00
Felix S. Klock II
a5e0624a32 libgraphviz: extend API with flags to indicate options like "do not include labels". 2014-12-15 22:34:09 +01:00
Felix S. Klock II
c500b63e71 libgraphviz: add label and escaped ctors taking any str::IntoMaybeOwned. 2014-12-15 22:34:05 +01:00
Jorge Aparicio
c3778fae6f libstd: add a dummy field to OsRng to avoid out of module construction 2014-12-15 15:35:34 -05:00