Commit Graph

39235 Commits

Author SHA1 Message Date
Alex Crichton
754db0f7ac rollup merge of #22436: nikomatsakis/issue-22246-bound-lifetimes-of-assoc-types
Take 2. This PR includes a bunch of refactoring that was part of an experimental branch implementing [implied bounds]. That particular idea isn't ready to go yet, but the refactoring proved useful for fixing #22246. The implied bounds branch also exposed #22110 so a simple fix for that is included here. I still think some more refactoring would be a good idea here -- in particular I think most of the code in wf.rs is kind of duplicating the logic in implicator and should go, but I decided to post this PR and call it a day before diving into that. I'll write a bit more details about the solutions I adopted in the various bugs. I patched the two issues I was concerned about, which was the handling of supertraits and HRTB (the latter turned out to be fine, so I added a comment explaining why.)

r? @pnkfelix (for now, anyway)
cc @aturon

[implied bounds]: http://smallcultfollowing.com/babysteps/blog/2014/07/06/implied-bounds/
2015-02-18 14:31:58 -08:00
Alex Crichton
31166ecf79 rollup merge of #22395: brson/readme-cleanup
Just a few things to make the README ever more perfect.

r? @steveklabnik
2015-02-18 14:31:57 -08:00
Alex Crichton
c07ec507e2 rollup merge of #22287: Ryman/purge_carthographers
This overlaps with #22276 (I left make check running overnight) but covers a number of additional cases and has a few rewrites where the clones are not even necessary.

This also implements `RandomAccessIterator` for `iter::Cloned`

cc @steveklabnik, you may want to glance at this before #22281 gets the bors treatment
2015-02-18 14:31:55 -08:00
Niko Matsakis
9f8b9d6847 Update tests to use #[feature(rustc_attrs)] 2015-02-18 17:31:42 -05:00
Niko Matsakis
cc61f9c1d5 Minor unused imports etc. 2015-02-18 17:31:26 -05:00
Alex Crichton
c5fddd81ab rollup merge of #22118: fhahn/separate-parse-fail-2
After making `rustc` fail on errors at a stop point, like `-Z parse-only`, in #22117, the files in this PR also fail during the parse stage and should be moved as well. Sorry for spliting this move up in two PRs.
2015-02-18 14:31:23 -08:00
Alex Crichton
fa30c4f147 rollup merge of #21886: dotdash/fast_slice_iter
The data pointer used in the slice is never null, using assume() to tell
LLVM about it gets rid of various unneeded null checks when iterating
over the slice.

Since the snapshot compiler is still using an older LLVM version, omit
the call in stage0, because compile times explode otherwise.

Benchmarks from #18193
````
running 5 tests
test _range    ... bench:     33329 ns/iter (+/- 417)
test assembly  ... bench:     33299 ns/iter (+/- 58)
test enumerate ... bench:     33318 ns/iter (+/- 83)
test iter      ... bench:     33311 ns/iter (+/- 130)
test position  ... bench:     33300 ns/iter (+/- 47)

test result: ok. 0 passed; 0 failed; 0 ignored; 5 measured
````

Fixes #18193
2015-02-18 14:31:21 -08:00
Niko Matsakis
f5491e63b4 Stabilize Send/Sync. 2015-02-18 17:30:14 -05:00
Niko Matsakis
74199c24d0 Try to write some basic docs. 2015-02-18 17:30:02 -05:00
Alex Crichton
1860ee521a std: Implement CString-related RFCs
This commit is an implementation of [RFC 592][r592] and [RFC 840][r840]. These
two RFCs tweak the behavior of `CString` and add a new `CStr` unsized slice type
to the module.

[r592]: https://github.com/rust-lang/rfcs/blob/master/text/0592-c-str-deref.md
[r840]: https://github.com/rust-lang/rfcs/blob/master/text/0840-no-panic-in-c-string.md

The new `CStr` type is only constructable via two methods:

1. By `deref`'ing from a `CString`
2. Unsafely via `CStr::from_ptr`

The purpose of `CStr` is to be an unsized type which is a thin pointer to a
`libc::c_char` (currently it is a fat pointer slice due to implementation
limitations). Strings from C can be safely represented with a `CStr` and an
appropriate lifetime as well. Consumers of `&CString` should now consume `&CStr`
instead to allow producers to pass in C-originating strings instead of just
Rust-allocated strings.

A new constructor was added to `CString`, `new`, which takes `T: IntoBytes`
instead of separate `from_slice` and `from_vec` methods (both have been
deprecated in favor of `new`). The `new` method returns a `Result` instead of
panicking.  The error variant contains the relevant information about where the
error happened and bytes (if present). Conversions are provided to the
`io::Error` and `old_io::IoError` types via the `FromError` trait which
translate to `InvalidInput`.

This is a breaking change due to the modification of existing `#[unstable]` APIs
and new deprecation, and more detailed information can be found in the two RFCs.
Notable breakage includes:

* All construction of `CString` now needs to use `new` and handle the outgoing
  `Result`.
* Usage of `CString` as a byte slice now explicitly needs a `.as_bytes()` call.
* The `as_slice*` methods have been removed in favor of just having the
  `as_bytes*` methods.

Closes #22469
Closes #22470
[breaking-change]
2015-02-18 14:15:43 -08:00
Niko Matsakis
d622235b30 Add deprecated versions of the old markers and integrate them back into the variance analysis. 2015-02-18 17:14:27 -05:00
Brian Anderson
c273571bfd Remove mention of wiki from README 2015-02-18 13:48:46 -08:00
Brian Anderson
7430e58e65 Address review feedback 2015-02-18 13:46:55 -08:00
Brian Anderson
73cc4ed4da README: Simplify markdown 2015-02-18 13:46:55 -08:00
Brian Anderson
aaabdbfe04 README: Add one sentence about what Rust is.
Most people don't know what Rust is.
2015-02-18 13:46:55 -08:00
Brian Anderson
46189559a9 README: Add a link to #rust 2015-02-18 13:46:55 -08:00
Brian Anderson
9265e13867 README: Make the wiki links more useful.
The page we want them to find is 'getting started developing'.
2015-02-18 13:46:55 -08:00
Brian Anderson
21ed20baf9 README: Give a hint about how to build Cargo from source.
Just a hint.
2015-02-18 13:46:55 -08:00
Brian Anderson
4acc483106 Simplify README by not talking about the source tarball option
I believe that few enough people build from source tarballs that
we don't have to talk about it explicitly.
2015-02-18 13:46:55 -08:00
Niko Matsakis
a2393e665d WIP -- improve documentation on the phantom traits 2015-02-18 16:38:39 -05:00
Tshepang Lekhonkhobe
ac3a39015c rustbook: no-longer-used feature gate 2015-02-18 23:27:32 +02:00
Tshepang Lekhonkhobe
2f735f52c9 unused imports 2015-02-18 23:25:58 +02:00
Tshepang Lekhonkhobe
55f625a96b os.getcwd renamed to env::current_dir 2015-02-18 23:24:28 +02:00
Junseok Lee
8e0e87fc32 revised pointer example 2015-02-18 13:22:59 -08:00
Niko Matsakis
9bb3b3772d Add rustc_attrs feature to test. 2015-02-18 15:24:20 -05:00
Niko Matsakis
a994a99ec4 Always prefer where-clauses over impls in trait selection. Fixes #22110. 2015-02-18 15:23:34 -05:00
Niko Matsakis
2939e483fd Extend the implicator so it produces general obligations and also so
that it produces "outlives" relations for associated types. Add
several tests relating to #22246.
2015-02-18 15:23:34 -05:00
Niko Matsakis
5511add742 traits: break apart the "full normalization" code used for normalizing
parameter environments so that it can be used elsewhere.
2015-02-18 15:23:34 -05:00
Niko Matsakis
7134ad4d64 Move tcx from Typer into ClosureTyper 2015-02-18 15:23:34 -05:00
Niko Matsakis
e84a719e37 Misc. cleanup in regionck: Remove a one-variant enum for some reason. 2015-02-18 15:23:34 -05:00
Niko Matsakis
48c70d6863 Replace assert_no_late_bound_regions with
`no_late_bound_regions().unwrap()`, which allows us to write code that
doesn't necessarily *fail* when there are higher-ranked trait bounds.
2015-02-18 15:23:34 -05:00
Niko Matsakis
92d65ab2e9 Rename various things to "implications" 2015-02-18 15:23:33 -05:00
Niko Matsakis
df92fe3c96 Rename regionmanip to implicator. 2015-02-18 15:23:33 -05:00
Niko Matsakis
811c48fe22 For now, accept the i, u, is, and us suffixes, but warn when
they are used without a feature-gate. This is both kinder to existing
code and should make it easier to land this PR, since we don't
have to catch EVERY SINGLE SUFFIX.
2015-02-18 15:08:40 -05:00
Simonas Kazlauskas
a36fc2d66c Fix inconsistent spacing of collapse all button 2015-02-18 21:38:32 +02:00
Simonas Kazlauskas
204e2bd442 Style all docblock links properly
Fixes #22493
2015-02-18 21:37:48 +02:00
Alexis
66613e26b9 make FromIterator use IntoIterator
This breaks all implementors of FromIterator, as they must now accept IntoIterator instead of Iterator. The fix for this is generally trivial (change the bound, and maybe call into_iter() on the argument to get the old argument).

Users of FromIterator should be unaffected because Iterators are IntoIterator.

[breaking-change]
2015-02-18 14:01:47 -05:00
Alexis
4a9d190423 make Extend use IntoIterator
This breaks all implementors of Extend, as they must now accept IntoIterator instead of Iterator. The fix for this is generally trivial (change the bound, and maybe call into_iter() on the argument to get the old argument).

Users of Extend should be unaffected because Iterators are IntoIterator.

[breaking-change]
2015-02-18 14:01:47 -05:00
Aaron Turon
5fa9de16df Implement RFC 580
This commit implements RFC 580 by renaming:

* DList -> LinkedList
* Bitv -> BitVec
* BitvSet -> BitSet
* RingBuf -> VecDeque

More details are in [the
RFC](https://github.com/rust-lang/rfcs/pull/580)

[breaking-change]
2015-02-18 14:01:46 -05:00
Alex Crichton
f83e23ad7c std: Stabilize the hash module
This commit is an implementation of [RFC 823][rfc] which is another pass over
the `std::hash` module for stabilization. The contents of the module were not
entirely marked stable, but some portions which remained quite similar to the
previous incarnation are now marked `#[stable]`. Specifically:

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0823-hash-simplification.md

* `std::hash` is now stable (the name)
* `Hash` is now stable
* `Hash::hash` is now stable
* `Hasher` is now stable
* `SipHasher` is now stable
* `SipHasher::new` and `new_with_keys` are now stable
* `Hasher for SipHasher` is now stable
* Many `Hash` implementations are now stable

All other portions of the `hash` module remain `#[unstable]` as they are less
commonly used and were recently redesigned.

This commit is a breaking change due to the modifications to the `std::hash` API
and more details can be found on the [RFC][rfc].

Closes #22467
[breaking-change]
2015-02-18 08:26:20 -08:00
Niko Matsakis
e8cb11c7e3 Missing test. 2015-02-18 10:38:25 -05:00
Niko Matsakis
d179bb56b0 Add regression test for #20533. Fixes #20533. 2015-02-18 10:38:25 -05:00
Niko Matsakis
df76442c99 Fallout: Accepter trait needs phantomdata. This seems like it should
be migrated to an associated type anyway.
2015-02-18 10:38:25 -05:00
Niko Matsakis
6f2a1c9467 Fallout: add phantomdata to hash 2015-02-18 10:38:25 -05:00
Niko Matsakis
ae7c534d04 Fallout: port hashmap to use Unique 2015-02-18 10:38:25 -05:00
Niko Matsakis
9e0bb528a4 Fallout: add phantomdata for 'a in path 2015-02-18 10:38:25 -05:00
Niko Matsakis
1ed5842829 Fallout: extend thread with phantomdata for 'a lifetime 2015-02-18 10:26:49 -05:00
Niko Matsakis
62b517772a Fallout: add phantom data to the type inferencer 2015-02-18 10:25:29 -05:00
Niko Matsakis
199b992e63 Fallout: add phantom data to librand 2015-02-18 10:25:28 -05:00
Niko Matsakis
2953710d26 Fallout: port libflate to new Unique API 2015-02-18 10:25:28 -05:00