Commit Graph

39217 Commits

Author SHA1 Message Date
Keegan McAllister
f051e13238 Fix references to doc.rs throughout the code 2015-02-18 19:54:45 -08:00
Keegan McAllister
ac6cab0887 borrowck/README.md: Fix display of code on GitHub 2015-02-18 19:54:45 -08:00
Keegan McAllister
160cf962e7 borrowck/README.md: Remove SCOPE (mostly unused)
Only one case is used in the text.  All of them are pretty straightforward, so
I don't think the code needs an explicit link to the README.
2015-02-18 19:54:38 -08:00
Darrell Hamilton
a6b47c0efa Fixes "Code of Conduct" Link
Replaces the markdown link delimiters for the "Code of Conduct" link with the appropriate delimiters for using a link id

r? @steveklabnik
2015-02-18 20:53:00 -07:00
Keegan McAllister
0c1fc1ca7b borrowck/README.md: Clarify MUTABILITY and ALIASABLE 2015-02-18 18:07:03 -08:00
Alex Crichton
cb29c468f3 Fix from niko for cfail tests 2015-02-18 18:01:03 -08:00
Keegan McAllister
bb22c100db borrowck/README.md: Remove most references to &const 2015-02-18 17:59:47 -08:00
Alex Crichton
b8d35deda3 rollup merge of #22517: brson/relnotes
p=1 please
2015-02-18 17:58:01 -08:00
Alex Crichton
b7c0813eb7 Round 4 test fixes and rebase conflicts 2015-02-18 17:57:35 -08:00
Brian Anderson
c4bb064b3a Update AUTHORS.txt and RELEASES.md 2015-02-18 17:02:34 -08:00
Niko Matsakis
63f51ee90c Exempt phantom fns from the object safety check 2015-02-18 16:38:17 -08:00
Alex Crichton
d6e939a2df Round 3 test fixes and conflicts 2015-02-18 16:34:04 -08:00
Adam Jacob
cec404a066 Add documentation for else if to trpl
Adds an example of `else if` to the If section of The Rust Programming
Language.

r? @steveklabnik
2015-02-18 16:26:39 -08:00
bors
22992358bc Auto merge of #22436 - nikomatsakis:issue-22246-bound-lifetimes-of-assoc-types, r=nikomatsakis
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 23:58:38 +00:00
Alex Crichton
1506b34e0c rollup merge of #22286: nikomatsakis/variance-4b
Conflicts:
	src/librustc/middle/infer/combine.rs
	src/librustc_typeck/check/wf.rs
2015-02-18 15:52:01 -08:00
Alex Crichton
3e7a04cb3c Round 2 test fixes and conflicts 2015-02-18 15:48:45 -08:00
Alex Crichton
231eeaa35b rollup merge of #22502: nikomatsakis/deprecate-bracket-bracket
Conflicts:
	src/libcollections/slice.rs
	src/libcollections/str.rs
	src/librustc/middle/lang_items.rs
	src/librustc_back/rpath.rs
	src/librustc_typeck/check/regionck.rs
	src/libstd/ffi/os_str.rs
	src/libsyntax/diagnostic.rs
	src/libsyntax/parse/parser.rs
	src/libsyntax/util/interner.rs
	src/test/run-pass/regions-refcell.rs
2015-02-18 15:48:40 -08:00
Alex Crichton
2cdbd288ac rollup merge of #22210: aturon/stab-final-borrow
Conflicts:
	src/libcollections/btree/map.rs
	src/libcollections/str.rs
	src/libcollections/vec.rs
	src/libcore/borrow.rs
	src/libcore/hash/mod.rs
	src/libstd/collections/hash/map.rs
	src/libstd/collections/hash/set.rs
2015-02-18 15:34:48 -08:00
Alex Crichton
365bd9a9e3 Round 1 fixes and rebase conflicts 2015-02-18 15:27:42 -08:00
Aaron Turon
a99e698628 Stabilize std::borrow
This commit stabilizes `std::borrow`, making the following modifications
to catch up the API with language changes:

* It renames `BorrowFrom` to `Borrow`, as was originally intended (but
  blocked for technical reasons), and reorders the parameters
  accordingly.

* It moves the type parameter of `ToOwned` to an associated type. This
  is somewhat less flexible, in that each borrowed type must have a
  unique owned type, but leads to a significant simplification for
  `Cow`. Flexibility can be regained by using newtyped slices, which is
  advisable for other reasons anyway.

* It removes the owned type parameter from `Cow`, making the type much
  less verbose.

* Deprecates the `is_owned` and `is_borrowed` predicates in favor of
  direct matching.

The above API changes are relatively minor; the basic functionality
remains the same, and essentially the whole module is now marked
`#[stable]`.

[breaking-change]
2015-02-18 15:23:58 -08:00
Niko Matsakis
9ea84aeed4 Replace all uses of &foo[] with &foo[..] en masse. 2015-02-18 17:36:03 -05:00
Niko Matsakis
64cd30e0ca Declare &foo[] to be obsolete syntax. Modify the obsolete mechanism to
support warnings.
2015-02-18 17:35:50 -05:00
Alex Crichton
b64dfff326 rollup merge of #22498: nagisa/style-fixes 2015-02-18 14:35:03 -08:00
Alex Crichton
5250a82f79 rollup merge of #22497: nikomatsakis/suffixes
Conflicts:
	src/librustc_trans/trans/tvec.rs
2015-02-18 14:35:01 -08:00
Alex Crichton
5a32b4a34f rollup merge of #22491: Gankro/into_iter
Conflicts:
	src/libcollections/bit.rs
	src/libcollections/linked_list.rs
	src/libcollections/vec_deque.rs
	src/libstd/sys/common/wtf8.rs
2015-02-18 14:34:08 -08:00
Alex Crichton
9aee389b6e rollup merge of #22485: pnkfelix/fsk-int-uint-audit
cc #22240
2015-02-18 14:32:14 -08:00
Alex Crichton
b90e40718f rollup merge of #22484: riginding/master 2015-02-18 14:32:12 -08:00
Alex Crichton
f3657170b1 rollup merge of #22482: alexcrichton/cstr-changes
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:32:10 -08:00
Alex Crichton
9774b7e64b rollup merge of #22480: alexcrichton/hashv3
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 14:32:03 -08:00
Alex Crichton
261364d45d rollup merge of #22452: nikomatsakis/issue-22040-18956-Self
The big change here is that we update the object-safety rules to prohibit references to `Self` in the supertrait listing. See #22040 for the motivation. The other change is to handle the interaction of defaults that reference `Self` and object types (where `Self` is erased). We force users to give an explicit type in that scenario.

r? @aturon
2015-02-18 14:32:02 -08:00
Alex Crichton
d8753a0ec3 rollup merge of #22438: dotdash/iter_vec_loop
No need to create a bunch of blocks and a stack allocated temporary just
to build a simple loop.
2015-02-18 14:32:01 -08:00
Alex Crichton
386d329ac5 rollup merge of #22437: dotdash/fix_array_type
In trans_slice_vec we currently use arrayalloca, which gives us a
pointer to the element type with enough memory allocated for the
requested number of elements.  This works, but everywhere else we use
the [n x T] type for fixed size arrays and so we have to bitcast the
pointer here. Let's directly use the proper type for the allocation and
remove some code duplication along the way.
2015-02-18 14:31:59 -08:00
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