Commit Graph

35347 Commits

Author SHA1 Message Date
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
Jorge Aparicio
556d971f83 Remove internal uses of marker::NoCopy 2014-12-15 15:33:37 -05:00
Alex Crichton
c9ea7c9a58 serialize: Change some FnOnce bounds to FnMut
Relax some of the bounds on the decoder methods back to FnMut to help accomodate
some more flavorful variants of decoders which may need to run the closure more
than once when it, for example, attempts to find the first successful enum to
decode.

This a breaking change due to the bounds for the trait switching, and clients
will need to update from `FnOnce` to `FnMut` as well as likely making the local
function binding mutable in order to call the function.

[breaking-change]
2014-12-15 12:20:47 -08:00
bors
92e9e70d15 auto merge of #19882 : steveklabnik/rust/fix_download, r=nikomatsakis
Thank you, @Ap0ph1s.
2014-12-15 19:12:44 +00:00
bors
1b97cd338b auto merge of #19785 : brson/rust/rollup, r=brson 2014-12-15 15:33:11 +00:00
Niko Matsakis
1718cd6ee0 Remove all shadowed lifetimes. 2014-12-15 10:23:48 -05:00
Niko Matsakis
b60de4bfc2 Emit warning when lifetime names are shadowed.
This is not technically a [breaking-change], but it will be soon, so
you should update your code. Typically, shadowing is accidental, and
the shadowing lifetime can simply be removed. This frequently occurs
in constructor patterns:

```rust
// Old:
impl<'a> SomeStruct<'a> { fn new<'a>(..) -> SomeStruct<'a> { ... } }

// Should be:
impl<'a> SomeStruct<'a> { fn new(..) -> SomeStruct<'a> { ... } }
```

Otherwise, you should rename the inner lifetime to something
else. Note though that lifetime elision frequently applies:

```rust
// Old
impl<'a> SomeStruct<'a> {
    fn get<'a>(x: &'a self) -> &'a T { &self.field }
}

// Should be:
impl<'a> SomeStruct<'a> {
    fn get(x: &self) -> &T { &self.field }
}
``
2014-12-15 10:23:48 -05:00
Steve Klabnik
bd776b5090 Fix windows download links
Thank you, @Ap0ph1s.
2014-12-15 09:55:56 -05:00
Brian Anderson
1cb7e9fc63 rollup merge of #19814: jbranchaud/fix-a-typo-in-ownership-guide 2014-12-15 06:45:37 -08:00
Brian Anderson
f0bf34de9f rollup merge of #19812: frewsxcv/expansion-include-enum
In preparation for [removing the `std::cmp::Ordering` reexport](https://github.com/rust-lang/rust/issues/19253), this needs to be done to prevent errors like:

```
note: in expansion of #[deriving]
note: expansion site
error: unresolved name `std::cmp::Equal`
#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Show)]
                                             ^~~
```
2014-12-15 06:45:36 -08:00
Brian Anderson
e52efe262d rollup merge of #19804: kballard/vim-new-unicode-escapes 2014-12-15 06:45:36 -08:00
Brian Anderson
74fde5e10d rollup merge of #19802: jbranchaud/add-btreeset-new-doctest 2014-12-15 06:45:36 -08:00
Brian Anderson
77d2a116c4 rollup merge of #19793: tomjakubowski/metadata-const-attrs
Fix #19773

Together with #19774 (which this is rebased on):

Fix #18156, fix #19722, fix #19185

r? @alexcrichton (since this was your suggestion!)
2014-12-15 06:45:36 -08:00
Brian Anderson
53982b64f3 rollup merge of #19787: akiss77/fix-i8-c_char
On AArch64, libc::c_char is u8. There are some places in the code where i8 is assumed, which causes compilation errors.

(AArch64 is not officially supported yet, but this change does not hurt any other targets and makes the code future-proof.)
2014-12-15 06:45:35 -08:00
Brian Anderson
0b214bfee0 rollup merge of #19784: csouth3/vim-syntax-iter
Vim still incorrectly highlights just `ExactSize` as a valid trait name, but the trait has been renamed to `ExactSizeIterator`.
2014-12-15 06:45:35 -08:00
Brian Anderson
e8e8677072 rollup merge of #19779: Noctune/master
The old PartialOrd impl for raw pointers would always return Some(_), so It might as well implement Ord too.
2014-12-15 06:45:35 -08:00
Brian Anderson
5691c0f49a rollup merge of #19775: SimonSapin/gedit-new-unicode-escape 2014-12-15 06:45:35 -08:00
Brian Anderson
3673486c6d rollup merge of #19774: tomjakubowski/rustdoc-consts-statics
Build `clean::ConstantItem` values in the `inline` module and
pretty-print the AST for inlined const items.

Doc strings are still missing from inlined constants (see #19773).

Partially address #18156, #19722, #19185

Fix #15821

r? @alexcrichton
2014-12-15 06:45:34 -08:00
Brian Anderson
7afee3a1ab rollup merge of #19771: jbranchaud/add-btreeset-iter-doctests 2014-12-15 06:45:34 -08:00
Brian Anderson
e717362ce5 rollup merge of #19763: csouth3/remove-featuregates
This is a revival of #19517 (per request of @alexcrichton) now that the new snapshots have landed.  We can now remove the last feature gates for if_let, while_let, and tuple_indexing scattered throughout the test sources since these features have been added to Rust.

Closes #19473.
2014-12-15 06:45:34 -08:00
Brian Anderson
1f349f6c71 rollup merge of #19754: steveklabnik/remove_sundown 2014-12-15 06:45:33 -08:00
Brian Anderson
8404ea66d9 rollup merge of #19746: steveklabnik/gh9266
Fixes #9266
2014-12-15 06:45:33 -08:00
Brian Anderson
cb2119823d rollup merge of #19738: steveklabnik/gh19717
Fixes #19717
2014-12-15 06:45:33 -08:00
Brian Anderson
36f7f1e301 rollup merge of #19735: sethpollack/patch-1 2014-12-15 06:45:33 -08:00
Brian Anderson
42f4d636fa rollup merge of #19714: steveklabnik/gh16219
These should be properly annotated instead.

Fixes #16219.
2014-12-15 06:44:21 -08:00
Brian Anderson
6c4a2bc55f rollup merge of #19710: steveklabnik/gh15449
Fixes #15499.
2014-12-15 06:44:20 -08:00
Brian Anderson
34dfa7addb rollup merge of #19709: steveklabnik/po4a_fix
This line was declared twice, which causes the build of i10n docs to
fail.
2014-12-15 06:44:20 -08:00
Pedro Larroy
2e74291290 remove explicit if_let and tuple_indexing feature enables as they now trigger warnings 2014-12-15 15:01:26 +01:00
Seo Sanghyeon
4df66cd014 Resolve lifetimes in associated types 2014-12-15 22:31:38 +09:00
bors
ef0bc464af auto merge of #19778 : aochagavia/rust/ice, r=alexcrichton
Fixes #19734
2014-12-15 11:17:44 +00:00
Andrew Wagner
8fcc832198 Standardize some usages of "which" in docstrings
In US english, "that" is used in restrictive clauses in place of
"which", and often affects the meaning of sentences.

In UK english and many dialects, no distinction is
made.

While Rust devs want to avoid unproductive pedanticism, it is worth at
least being uniform in documentation such as:

http://doc.rust-lang.org/std/iter/index.html

and also in cases where correct usage of US english clarifies the
sentence.
2014-12-15 10:50:42 +01:00
bors
b677746b1e auto merge of #19750 : murarth/rust/rusti-support, r=brson
Makes a couple changes that support the implementation of a REPL:

* Implementation of wrapper code for LLVM ExecutionEngine API
* Fixing a change I made earlier to reset compiler state in `phase_1_[...]`
  instead of `compile_input` as the latter is not used in a REPL
2014-12-15 08:32:45 +00:00
Steven Fackler
8d6895a9c0 Free stdin on exit 2014-12-14 23:36:50 -08:00
Martin Pool
c270390f1b Fix Markdown syntax in docs for OsRng 2014-12-14 22:26:09 -08:00
Jorge Aparicio
f63784f4e2 impl Copy for NoSend/NoSync 2014-12-14 22:21:43 -05:00
Alex Crichton
7741516a8b std: Collapse SlicePrelude traits
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-14 19:03:56 -08:00
Alex Crichton
0d38cae0b9 std: Bind port early to make a test more reliable
This test would read with a timeout and then send a UDP message, expecting the
message to be received. The receiving port, however, was bound in the child
thread so it could be the case that the timeout and send happens before the
child thread runs. To remedy this we just bind the port before the child thread
runs, moving it into the child later on.

cc #19120
2014-12-14 18:58:13 -08:00
Jorge Aparicio
0a968ef199 Add test for #19129
Closes #19129
2014-12-14 21:10:51 -05:00
bors
126db549b0 auto merge of #19742 : vhbit/rust/copy-for-bitflags, r=alexcrichton 2014-12-15 00:07:35 +00:00