Commit Graph

29991 Commits

Author SHA1 Message Date
Tom Jakubowski
94bace795d rustdoc: show default type parameters in generics
fix #12291
2014-06-21 05:03:33 -07:00
Conrad Kleinespel
8bcfabaeac replace reference to ~"string" with box "string" 2014-06-21 12:31:10 +02:00
bors
0ae4b97c09 auto merge of #15029 : aturon/rust/stability-index, r=brson
This commit makes several changes to the stability index infrastructure:

* Stability levels are now inherited lexically, i.e., each item's
  stability level becomes the default for any nested items.

* The computed stability level for an item is stored as part of the
  metadata. When using an item from an external crate, this data is
  looked up and cached.

* The stability lint works from the computed stability level, rather
  than manual stability attribute annotations. However, the lint still
  checks only a limited set of item uses (e.g., it does not check every
  component of a path on import). This will be addressed in a later PR,
  as part of issue #8962.

* The stability lint only applies to items originating from external
  crates, since the stability index is intended as a promise to
  downstream crates.

* The "experimental" lint is now _allow_ by default. This is because
  almost all existing crates have been marked "experimental", pending
  library stabilization. With inheritance in place, this would generate
  a massive explosion of warnings for every Rust program.

  The lint should be changed back to deny-by-default after library
  stabilization is complete.

* The "deprecated" lint still warns by default.

The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.

Closes #13540.
2014-06-21 04:01:25 +00:00
bors
b1646cbfd9 auto merge of #14731 : jakub-/rust/pattern-matching-refactor, r=alexcrichton
This PR is changing the error messages for non-exhaustive pattern matching to include a more accurate witness, i.e. a pattern that is not covered by any of the ones provided by the user. Example:

```rust
fn main() {
	match (true, (Some("foo"), [true, true]), Some(42u)) {
		(false, _, _) => (),
		(true, (None, [true, _]), None) => (),
		(true, (None, [false, _]), Some(1u)) => ()
	}
}
```

```sh
/tmp/witness.rs:2:2: 6:3 error: non-exhaustive patterns: (true, (core::option::Some(_), _), _) not covered
/tmp/witness.rs:2 	match (true, (Some("foo"), [true, true]), Some(42u)) {
/tmp/witness.rs:3 		(false, _, _) => (),
/tmp/witness.rs:4 		(true, (None, [true, _]), None) => (),
/tmp/witness.rs:5 		(true, (None, [false, _]), Some(1u)) => ()
/tmp/witness.rs:6 	}
```

As part of that, I refactored some of the relevant code and carried over the changes to fixed vectors from the previous PR.

I'm putting it out there for now but the tests will be red.
2014-06-21 02:11:22 +00:00
Patrick Walton
ae067477fb libsyntax: Stop parsing + with no bounds after it.
This will break code that looks like `Box<Trait+>`. Change that code to
`Box<Trait>` instead.

Closes #14925.

[breaking-change]
2014-06-20 15:46:58 -07:00
bors
2563481ca9 auto merge of #14988 : pcwalton/rust/unsafe-destructor-feature-gate, r=alexcrichton
Closes #8142.

This is not the semantics we want long-term. You can continue to use
`#[unsafe_destructor]`, but you'll need to add
`#![feature(unsafe_destructor)]` to the crate attributes.

[breaking-change]

r? @alexcrichton
2014-06-20 21:31:22 +00:00
Patrick Walton
dcbf4ec2a1 librustc: Put #[unsafe_destructor] behind a feature gate.
Closes #8142.

This is not the semantics we want long-term. You can continue to use
`#[unsafe_destructor]`, but you'll need to add
`#![feature(unsafe_destructor)]` to the crate attributes.

[breaking-change]
2014-06-20 14:24:31 -07:00
Jakub Wieczorek
a88819adbe Ignore issue-14393 on Windows 2014-06-20 23:07:22 +02:00
bors
43d1938260 auto merge of #15056 : alexcrichton/rust/issue-15043, r=kballard
The parser already has special logic for parsing `>` tokens from `>>`, and this
commit extends the logic to the acquiring a `>` from the `>=` and `>>=` tokens
as well.

Closes #15043
2014-06-20 17:06:19 +00:00
Alex Crichton
f0c730b819 syntax: Parse GT tokens from >= and >>=
The parser already has special logic for parsing `>` tokens from `>>`, and this
commit extends the logic to the acquiring a `>` from the `>=` and `>>=` tokens
as well.

Closes #15043
2014-06-20 09:53:12 -07:00
Jakub Wieczorek
abce42afa3 Address review comments 2014-06-20 17:41:19 +02:00
Jakub Wieczorek
76f7eeef52 Fix #14393
String patterns should have a single constructor of arity 0.
2014-06-20 17:08:57 +02:00
Jakub Wieczorek
9dca26cf92 Add unreachability detection for missized patterns of fixed size vectors
Fixed #13482
2014-06-20 17:08:57 +02:00
Jakub Wieczorek
1e68d57682 Add support for fixed size vectors in let/arg patterns
Fixes #7784
2014-06-20 17:08:57 +02:00
Jakub Wieczorek
34407dcdbb Provide a witness pattern for non-exhaustive patterns
Fixed #4321
2014-06-20 17:08:57 +02:00
Jakub Wieczorek
f5e513b2b2 Check pattern refutability the same way exhaustiveness is checked 2014-06-20 17:08:57 +02:00
bors
6750eb5a05 auto merge of #15050 : kaseyc/rust/impl_eq_for_bitv_bitvset, r=alexcrichton 2014-06-20 12:56:19 +00:00
bors
311890ccfe auto merge of #15048 : brson/rust/toc-margin, r=alexcrichton
There is no space between the TOC and the succeeding para.

See http://doc.rust-lang.org/guide-pointers.html for example.
2014-06-20 11:01:33 +00:00
bors
b09985e702 auto merge of #15047 : brson/rust/taskdocs, r=huonw
This corrects some misinformation.
2014-06-20 09:16:22 +00:00
bors
30476141cf auto merge of #15044 : alexcrichton/rust/speed-up-select, r=kballard
This was erroneously disabled as part of 065e121f and it hasn't been turned on
since. This was a 3x perf improvement in a test of mine.
2014-06-20 07:31:28 +00:00
bors
75eb50da22 auto merge of #14993 : alxgnon/rust/taskpooldocfix, r=alexcrichton
TaskPool is the only item in the std::sync doc that doesn't have a summary. This fixes that problem.
2014-06-20 05:46:23 +00:00
Kasey Carrothers
e1038819c2 Implement Eq for Bitv and BitvSet 2014-06-19 21:13:39 -07:00
Alexandre Gagnon
af520e133c std::sync::TaskPool: Improve module documentation
The struct and module doc comments are reformulated. The `execute`
method's documentation are put up to date, and failure information
is added. A test is also added to address the possible failure.
2014-06-19 23:17:49 -04:00
bors
a7a18dee72 auto merge of #15041 : brson/rust/docindex, r=alexcrichton
Splits 'extern resources' into 'external documentation and 'community',
adds rustforrubyists.com, rustbyexample.com, stackoverflow.com.
2014-06-20 03:16:26 +00:00
bors
282705c784 auto merge of #15039 : huonw/rust/rustdoc-testharnesss, r=alexcrichton
```test_harness
    #[test]
    fn foo() {}
    ```

will now compile and run the tests, rather than just ignoring & stripping them (i.e. it is as if `--test` was passed).

Also, the specific example in https://github.com/rust-lang/rust/issues/12242 was fixed (but that issue is broader than that example).
2014-06-20 01:31:28 +00:00
Brian Anderson
cb89880e6d std: Update std::task docs to reflect modern times
This corrects some misinformation.
2014-06-19 17:18:21 -07:00
Brian Anderson
e698a397a8 doc: Fix margins around tables of contents
There is no space between the TOC and the succeeding para.
2014-06-19 16:14:49 -07:00
Huon Wilson
cb6219f396 testing guide: update to use test_harness & fix problems.
rustdoc now supports compiling things with `--test` so the examples in
this guide can be compiled & tested properly (revealing a few issues &
out-dated behaviours).

Also, reword an example to be clearer, cc #12242.
2014-06-20 07:59:27 +10:00
Alex Crichton
41706269c8 sync: Enable the fast path of select()
This was erroneously disabled as part of 065e121f and it hasn't been turned on
since. This was a 3x perf improvement in a test of mine.
2014-06-19 13:42:23 -07:00
bors
40ca89e525 auto merge of #15037 : zzmp/rust/doc/hotkeys, r=alexcrichton
Continuing from #15012, this makes four changes to the `rustdoc` static files.

- Change the placeholder text of the search bar to `Click or press 'S' to search, '?' for more options...` to make keyboard hotkeys more apparent (capitalizing the `S` to match the help text).
- Change the `main.js` file to use browser-normalized key codes (`e.which`, from `jQuery`), instead of `e.keyCode`.
- Change the key code for `?` to be the correct `191` instead of `188`, so that the hotkey works to bring up search information.
- Change the search information to display `tab` and `shift+tab` instead of `up` and `down`, as those do not yet work outside of Firefox (see #15011). Also, adjust the height so it does not cut off the help text.

<s>I've also opened up #15038 about the non-functional `up` and `down` functionality, although this does nothing to fix it.</s>
2014-06-19 19:21:26 +00:00
Brian Anderson
792d5b742c doc: Add disclaimers about versions of external docs 2014-06-19 11:45:16 -07:00
Brian Anderson
05641413a7 Update the external links in the doc index
Splits 'extern resources' into 'external documentation and 'community',
adds rustforrubyists.com and rustbyexample.com, stackoverflow.com.
2014-06-19 10:52:02 -07:00
bors
22d62fc8e1 auto merge of #15033 : Sawyer47/rust/old-test, r=alexcrichton
This test was added long time ago and marked as ignored.
The same test was added later in #8485 as run-fail/issue-3907.rs,
but the old one was not deleted.
2014-06-19 17:26:26 +00:00
Zach Pomerantz
677e6ed603 (doc) Properly doc hotkeys in generated docs.
Updated search bar to match help text.
Used correct, normalized hotkeys in search.
Updated shortcut menu with working shortcuts (tabs).
Changed height of search help.
2014-06-19 09:56:59 -07:00
Huon Wilson
11bdeea767 rustdoc: add the ability to run tests with --test.
This adds the `test_harness` directive that runs a code block using the
test runner, to allow for `#[test]` items to be demonstrated and still
tested (currently they are just stripped and not even compiled, let
alone run).
2014-06-19 23:11:18 +10:00
Huon Wilson
a17b0421d3 rustdoc: refactor code block language info into a struct.
Fields have names, unlike an anonymous tuple.
2014-06-19 22:45:20 +10:00
bors
bb06790c37 auto merge of #14830 : luqmana/rust/cmtrttcbctto, r=nikomatsakis
Fixes #14399.
2014-06-19 09:26:24 +00:00
Aaron Turon
6008f2c982 Add stability inheritance
This commit makes several changes to the stability index infrastructure:

* Stability levels are now inherited lexically, i.e., each item's
  stability level becomes the default for any nested items.

* The computed stability level for an item is stored as part of the
  metadata. When using an item from an external crate, this data is
  looked up and cached.

* The stability lint works from the computed stability level, rather
  than manual stability attribute annotations. However, the lint still
  checks only a limited set of item uses (e.g., it does not check every
  component of a path on import). This will be addressed in a later PR,
  as part of issue #8962.

* The stability lint only applies to items originating from external
  crates, since the stability index is intended as a promise to
  downstream crates.

* The "experimental" lint is now _allow_ by default. This is because
  almost all existing crates have been marked "experimental", pending
  library stabilization. With inheritance in place, this would generate
  a massive explosion of warnings for every Rust program.

  The lint should be changed back to deny-by-default after library
  stabilization is complete.

* The "deprecated" lint still warns by default.

The net result: we can begin tracking stability index for the standard
libraries as we stabilize, without impacting most clients.

Closes #13540.
2014-06-18 22:22:26 -07:00
bors
f8c9aec344 auto merge of #14400 : kballard/rust/lexer_crlf_handling, r=cmr
The lexer already ignores CRLF in between tokens, but it doesn't
properly handle carriage returns inside strings and doc comments. Teach
it to treat CRLF as LF inside these tokens, and to disallow carriage
returns that are not followed by linefeeds. This includes handling an
escaped CRLF inside a regular string token the same way it handles an
escaped LF.

This is technically a breaking change, as bare carriage returns are no
longer allowed, and CRLF sequences are now treated as LF inside strings
and doc comments, but it's very unlikely to actually affect any
real-world code.

This change is necessary to have Rust code compile on Windows the same
way it does on Unix. The mozilla/rust repository explicitly sets eol=lf
for Rust source files, but other Rust repositories don't. Notably,
rust-http cannot be compiled on Windows without converting the CRLF line
endings back to LF.

[breaking-change]
2014-06-19 05:21:16 +00:00
Kevin Ballard
8a8e497ae7 Handle CRLF properly in the lexer
The lexer already ignores CRLF in between tokens, but it doesn't
properly handle carriage returns inside strings and doc comments. Teach
it to treat CRLF as LF inside these tokens, and to disallow carriage
returns that are not followed by linefeeds. This includes handling an
escaped CRLF inside a regular string token the same way it handles an
escaped LF.

This is technically a breaking change, as bare carriage returns are no
longer allowed, and CRLF sequences are now treated as LF inside strings
and doc comments, but it's very unlikely to actually affect any
real-world code.

This change is necessary to have Rust code compile on Windows the same
way it does on Unix. The mozilla/rust repository explicitly sets eol=lf
for Rust source files, but other Rust repositories don't. Notably,
rust-http cannot be compiled on Windows without converting the CRLF line
endings back to LF.

[breaking-change]
2014-06-18 21:07:58 -07:00
bors
f05cd6e04e auto merge of #15014 : brson/rust/all-crates-experimental, r=cmr
This creates a stability baseline for all crates that we distribute that are not `std`. In general, all library code must start as experimental and progress in stages to become stable.
2014-06-19 03:31:18 +00:00
bors
3770c42a49 auto merge of #15025 : alexcrichton/rust/rollup, r=alexcrichton 2014-06-19 01:41:43 +00:00
Alex Crichton
2c3bf8836f Merge conflicts from the rollup
Closes #14480 (vim: Add :RustRun and associated commands)
Closes #14917 (Deprecate free-standing endian conversions in favor of methods on Int. Merge Bitwise into Int and add more bit operations.)
Closes #14981 (librustc: Use expr_ty_adjusted in trans_overloaded_call.)
Closes #14989 (std::task - Revamp TaskBuilder API)
Closes #14997 (Reject double moves out of array elements)
Closes #14998 (Vim: highlight escapes for byte literals.)
Closes #15002 (Fix FIXME #5275)
Closes #15004 (Fix #14865)
Closes #15007 (debuginfo: Add test case for issue #14411.)
Closes #15012 ((doc) Change search placeholder text.)
Closes #15013 (Update compiler-rt.)
Closes #15017 (Deprecate the bytes!() macro.)
2014-06-18 17:23:03 -07:00
Simon Sapin
72f0d45357 Revert bytes!() docstring change, and fix a typo. 2014-06-18 17:02:23 -07:00
Simon Sapin
108b8b6dc7 Deprecate the bytes!() macro.
Replace its usage with byte string literals, except in `bytes!()` tests.
Also add a new snapshot, to be able to use the new b"foo" syntax.

The src/etc/2014-06-rewrite-bytes-macros.py script automatically
rewrites `bytes!()` invocations into byte string literals.
Pass it filenames as arguments to generate a diff that you can inspect,
or `--apply` followed by filenames to apply the changes in place.
Diffs can be piped into `tip` or `pygmentize -l diff` for coloring.
2014-06-18 17:02:22 -07:00
Luqman Aden
abf7e933df Update compiler-rt to work for non-v7 arm. 2014-06-18 17:02:08 -07:00
Zach Pomerantz
ba863c8167 (doc) Change search placeholder text.
Update placeholder text to make keyboard shortcuts more apparent.
2014-06-18 17:02:06 -07:00
Michael Woerister
7cfdfa6ef6 debuginfo: Add test case for issue 14411. 2014-06-18 17:02:02 -07:00
Edward Wang
b1df9aa16f Fix #14865
Fixes a codegen bug which generates illegal non-terminated LLVM block
when there are wildcard pattern with guard and enum patterns in a match
expression. Also refactors the code a little.

Closes #14865
2014-06-18 17:01:58 -07:00
Piotr Jawniak
bde851e969 Fix FIXME #5275
Issue #5275 was closed, but there still was a FIXME for it.
2014-06-18 17:01:56 -07:00