Commit Graph

41987 Commits

Author SHA1 Message Date
Manish Goregaokar
ede7a6dc8f Give access to field attributes in ext::deriving 2015-05-01 07:02:13 +05:30
Aaron Turon
a5762625a1 Add downcasting to std::error::Error
This commit brings the `Error` trait in line with the [Error interoperation
RFC](https://github.com/rust-lang/rfcs/pull/201) by adding downcasting,
which has long been intended. This change means that for any `Error`
trait objects that are `'static`, you can downcast to concrete error
types.

To make this work, it is necessary for `Error` to inherit from
`Reflect` (which is currently used to mark concrete types as "permitted
for reflection, aka downcasting"). This is a breaking change: it means
that impls like

```rust
impl<T> Error for MyErrorType<T> { ... }
```

must change to something like

```rust
impl<T: Reflect> Error for MyErrorType<T> { ... }
```

except that `Reflect` is currently unstable (and should remain so for
the time being). For now, code can instead bound by `Any`:

```rust
impl<T: Any> Error for MyErrorType<T> { ... }
```

which *is* stable and has `Reflect` as a super trait. The downside is
that this imposes a `'static` constraint, but that only
constrains *when* `Error` is implemented -- it does not actually
constrain the types that can implement `Error`.

[breaking-change]
2015-04-30 18:20:22 -07:00
Brian Anderson
d69cf2940e doc: current_dir returns a PathBuf, not a Path 2015-04-30 18:14:41 -07:00
bors
c634ec2e88 Auto merge of #24989 - alexcrichton:rustdoc-associated-constant, r=brson
Associated constants were now showing up for traits and would panic if they were
found on an inherent impl. This commit unblocks the nighly builders.
2015-04-30 23:40:27 +00:00
Alex Crichton
5c8ca26ad7 std: Always check for EDEADLK in rwlocks on unix
Apparently implementations are allowed to return EDEADLK instead of blocking
forever, in which case this can lead to unsafety in the `RwLock` primitive
exposed by the standard library. A debug-build of the standard library would
have caught this error (due to the debug assert), but we don't ship debug
builds right now.

This commit adds explicit checks for the EDEADLK error code and triggers a panic
to ensure the call does not succeed.

Closes #25012
2015-04-30 16:37:41 -07:00
Alex Crichton
4288a08e9a std: Favor cfg! over #[cfg] in unix rwlocks 2015-04-30 16:37:26 -07:00
Corey Farwell
ded5781cb9 Remove unnecessary 'mut' qualifier on doc-comment var
The variable doesn't need to be mutable.
2015-04-30 19:20:59 -04:00
Huon Wilson
7ba5f166b4 Mark the {min,max}_value functions on integers #[inline].
These compile down to `mov $CONSTANT, register; ret`, but the lack of
`#[inline]` meant they have a full `call ...` when used from external
crates.
2015-05-01 09:15:10 +10:00
Steve Klabnik
1e40360af9 Clarify intention wrt integers
Fixes #24767
2015-04-30 17:43:46 -04:00
bors
8a60e5667f Auto merge of #24978 - jooert:test-24446, r=alexcrichton
Closes #24446.
2015-04-30 20:51:03 +00:00
Steve Klabnik
585c7e2a0a Fix broken links in the book. 2015-04-30 16:00:44 -04:00
Steve Klabnik
8c38dfd537 Describe (a,) vs (a) in docs
Fixes #24730
2015-04-30 15:10:58 -04:00
bors
e962870420 Auto merge of #24975 - michaelsproul:enum-diagnostics, r=pnkfelix
Explanations for E0079, E0080, E0081, E0082, E0083 and E0084 as part of #24407.

All the errors concern the use of `#[repr(X)]` with enum types.

I also updated the short description for E0079 so that it takes sign into account.
2015-04-30 18:59:11 +00:00
Steve Klabnik
0b06fd70c8 Fix code sample, remove unstable code
Fixes #24977
2015-04-30 14:17:56 -04:00
Steve Klabnik
91e5481218 Fix two issues with TRPL: unsized types
First, a link was broken.

Second, the wording was a bit unclear, so I fixed it up.

Fixes #24852
2015-04-30 13:41:26 -04:00
Ariel Ben-Yehuda
30a5448d25 address review comments 2015-04-30 20:35:10 +03:00
bors
2568a4d8c5 Auto merge of #24924 - carols10cents:grammar-improvements, r=pnkfelix
I'm interested in helping out with #16676 but more in the grammar than the reference-- here's my first chunk, more to come!! 🎉 

I did pull a bit *out* of the reference, though, that was more relevant to the grammar but wasn't moved over as part of #24729.

I'm looking at, e.g. https://github.com/rust-lang/rust/blob/master/src/libsyntax/ast.rs, as the source of truth, please let me know if I should be checking against something else instead/in addition.

r? @steveklabnik
2015-04-30 17:07:14 +00:00
Alex Crichton
543b910f9b rustdoc: Fix rendering associated constants
Associated constants were now showing up for traits and would panic if they were
found on an inherent impl. This commit unblocks the nighly builders.
2015-04-30 09:37:13 -07:00
Sébastien Marie
27bcd2ebc7 remove denied unused import: pid_t in raw
- unbreak the build under openbsd
- while here, apply same modification to dragonfly, freebsd, ios (pid_t
  imported, but not used in raw.rs)
2015-04-30 17:26:53 +02:00
bors
2f613bfaeb Auto merge of #24902 - bombless:configure, r=pnkfelix
Closes #24840
2015-04-30 15:16:24 +00:00
Valerii Hiora
e50df770cc Fixed iOS build 2015-04-30 16:44:48 +03:00
York Xiang
98b7aaf3ef Mention --enable-optimize for --enable-debug 2015-04-30 21:39:52 +08:00
Poga Po
8a20b994ea remove newline within link tag 2015-04-30 21:28:49 +08:00
Ariel Ben-Yehuda
7ae4a8e9f3 Use hash-tables in trait selection
Puts implementations in bins hashed by the fast-reject key, and
only looks up the relevant impls, reducing O(n^2)-ishness

Before: 688.92user 5.08system 8:56.70elapsed 129%CPU (0avgtext+0avgdata 1208164maxresident)k, LLVM 379.142s
After: 637.78user 5.11system 8:17.48elapsed 129%CPU (0avgtext+0avgdata 1201448maxresident)k LLVM 375.552s

Performance increase is +7%-ish
2015-04-30 15:10:52 +03:00
Ariel Ben-Yehuda
bd1f73420a Stop using Rc in TraitRef and TraitDef
The former stopped making sense when we started interning substs and made
TraitRef a 2-word copy type, and I'm moving the latter into an arena as
they live as long as the type context.
2015-04-30 15:09:11 +03:00
bors
f9ecc6e888 Auto merge of #24892 - robinst:issue-24407-E0010, r=pnkfelix
Part of #24407.
2015-04-30 12:01:44 +00:00
Johannes Oertel
3e83f2bc78 Add regression test for #22468
Closes #22468.
2015-04-30 12:24:56 +02:00
Michael Sproul
63e63218a1 Add long diagnostics for enum repr errors. 2015-04-30 20:24:30 +10:00
Johannes Oertel
19717cbf46 Add regression test for #24446
Closes #24446.
2015-04-30 12:16:21 +02:00
bors
42bfeec53c Auto merge of #24842 - GBGamer:patch-3, r=steveklabnik
They now use the currently working syntax.

Also, I added two examples.
2015-04-30 10:13:05 +00:00
bors
b594036069 Auto merge of #24970 - Hech:master, r=steveklabnik 2015-04-30 07:12:25 +00:00
bors
f0bd14f7b1 Auto merge of #24960 - tynopex:patch-doc, r=alexcrichton
- Removed misleading comments about now-defunct CreatePipe
- Actually use std::process::Child in it's example
- Minor cleanups
2015-04-30 04:44:47 +00:00
Carol Nichols
2fdd1b0198 Remove priv from tests that aren't testing deprecated priv 2015-04-29 22:53:22 -04:00
Carol Nichols
31b7001b49 Remove mention of 'priv'; visibility is either PUB or nothing 2015-04-29 22:47:10 -04:00
Carol Nichols
899d4180ef Remove lingering mention of 'priv' in the reference 2015-04-29 22:43:26 -04:00
bors
ac5f595d0a Auto merge of #24884 - michaelsproul:extended-errors, r=nrc
I've been working on improving the diagnostic registration system so that it can:

* Check uniqueness of error codes *across the whole compiler*. The current method using `errorck.py` is prone to failure as it relies on simple text search - I found that it breaks when referencing an error's ident within a string (e.g. `"See also E0303"`).
* Provide JSON output of error metadata, to eventually facilitate HTML output, as well as tracking of which errors need descriptions. The current schema is:

```
<error code>: {
    "description": <long description>,
    "use_site": {
        "filename": <filename where error is used>,
        "line": <line in file where error is used>
    }
}
```

[Here's][metadata-dump] a pretty-printed sample dump for `librustc`.

One thing to note is that I had to move the diagnostics arrays out of the diagnostics modules. I really wanted to be able to capture error usage information, which only becomes available as a crate is compiled. Hence all invocations of `__build_diagnostics_array!` have been moved to the ends of their respective `lib.rs` files. I tried to avoid moving the array by making a plugin that expands to nothing but couldn't invoke it in item position and gave up on hackily generating a fake item. I also briefly considered using a lint, but it seemed like it would impossible to get access to the data stored in the thread-local storage.

The next step will be to generate a web page that lists each error with its rendered description and use site. Simple mapping and filtering of the metadata files also allows us to work out which error numbers are absent, which errors are unused and which need descriptions.

[metadata-dump]: https://gist.github.com/michaelsproul/3246846ff1bea71bd049
2015-04-30 02:03:27 +00:00
Robin Stocker
95ad630187 Add error explanation for E0010 2015-04-30 11:21:04 +10:00
Hech
f8b63e867d docs: link fix 2015-04-29 17:30:46 -07:00
bors
5449f5d29e Auto merge of #24967 - alexcrichton:rollup, r=alexcrichton 2015-04-30 00:07:10 +00:00
Alex Crichton
1b34c099a6 Test fixes and rebase conflicts 2015-04-29 17:05:20 -07:00
Michael Sproul
d27230bb6d Add metadata output to the diagnostics system.
Diagnostic errors are now checked for uniqueness across the compiler and
error metadata is written to JSON files.
2015-04-30 08:59:53 +10:00
Alex Crichton
2edb6438cb rollup merge of #24921: tamird/bitflags-associated-const
Conflicts:
	src/librustc/lib.rs
2015-04-29 15:49:07 -07:00
Alex Crichton
cc04cd4bb1 rollup merge of #24873: alexcrichton/fix-windows-stdio
Conflicts:
	src/libstd/sys/windows/fs2.rs
2015-04-29 15:48:38 -07:00
Alex Crichton
873a4e366d rollup merge of #24962: tamird/unignore-android-tests
r? @alexcrichton I've tested these locally, so they should all be good to go.
2015-04-29 15:45:58 -07:00
Alex Crichton
bc4b1932ca rollup merge of #24961: nham/net_docs_cleanup
Changes made include adding missing punctuation, adding missing words, and converting uses of "Gets" to "Returns" in libstd/net/addr.rs to make it more consistent with the other documentation.

Fixes #24925.
2015-04-29 15:45:57 -07:00
Alex Crichton
2c28348374 rollup merge of #24953: tamird/android-pie
This is OK to do given:
  - PIE is supported on Android starting with API 16.
  - The bots are running API 18.
  - API < 16 now has a 12.5% market share[0] as of 2015-04-29.

Closes #17437.

[0] https://developer.android.com/about/dashboards/index.html

r? @alexcrichton
2015-04-29 15:45:56 -07:00
Alex Crichton
50b3dce47e rollup merge of #24952: pnkfelix/put-back-missing-dash-g-in-24687-test
Add `-g` (to testcase) that I should have included in PR #24932.

Note it is safe, with respect to autobuilds, to land before #24945.

(In other words, landing this sooner won't break things for anyone any
worse than they were already broken, since there are *other* tests
that also add `-g` to their flags via `compile-flags: -g`.)
2015-04-29 15:45:55 -07:00
Alex Crichton
5d85d8d800 rollup merge of #24945: pnkfelix/fixes-for-dash-g-handling
Fixes for -g handling

First:
 * decouples our handling of `-g` for the test suite from our handling of `-g` for the rest of the compiler/stdlib building.
 * Namely, if you do `--enable-debug` or `--enable-debuginfo`, that should only affect `rustc` and the standard library crates; the tests should all continue to compile without `-g` unless:
   * you pass `--enable-debuginfo-tests`, or
   * the test itself requests the `-g` option (e.g. via a `// compile-flags: -g` embedded comment).

Second:
 * Makes `rustc` more flexible in that it now accepts multiple occurrences of `-g -g`
 * (as a drive-by, I gave `-O` the same treatment: multiple occurrences of `-O` are treated as synonymous as a single occurrence of `-O`.

Fix #24937
2015-04-29 15:45:54 -07:00
Alex Crichton
373d6202cf rollup merge of #24935: pnkfelix/lint-repr-c-drop
Lint: warn when mixing `#[repr(C)]` with Drop

Fix #24585
2015-04-29 15:45:53 -07:00
Alex Crichton
0cca57712d rollup merge of #24933: oli-obk/patch-1
compiler plugins are hosted unter "compiler-plugins.html" not "plugins.html"
2015-04-29 15:45:52 -07:00