Commit Graph

41913 Commits

Author SHA1 Message Date
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
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
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
bors
2f613bfaeb Auto merge of #24902 - bombless:configure, r=pnkfelix
Closes #24840
2015-04-30 15:16:24 +00:00
York Xiang
98b7aaf3ef Mention --enable-optimize for --enable-debug 2015-04-30 21:39:52 +08:00
bors
f9ecc6e888 Auto merge of #24892 - robinst:issue-24407-E0010, r=pnkfelix
Part of #24407.
2015-04-30 12:01:44 +00:00
Michael Sproul
63e63218a1 Add long diagnostics for enum repr errors. 2015-04-30 20:24:30 +10: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
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
Alex Crichton
dd12c8b46f rollup merge of #24931: jooert/patch-1
Since #24783, the style guidelines recommend that unit tests should live in a submodule `tests` rather than `test` to not clash with the possible use of libtest. This is especially important for benchmark tests as they require libtest. Fixes #24923.
2015-04-29 15:45:51 -07:00
Alex Crichton
416e4127e9 rollup merge of #24930: nrc/save-fn 2015-04-29 15:45:50 -07:00
Alex Crichton
62bd19fff2 rollup merge of #24929: tamird/unstub-some-tests
r? @alexcrichton
2015-04-29 15:45:49 -07:00
Alex Crichton
b9b1312f53 rollup merge of #24926: frewsxcv/patch-20 2015-04-29 15:45:49 -07:00
Alex Crichton
7510bfebb6 rollup merge of #24917: zecozephyr/nullptropt 2015-04-29 15:45:47 -07:00
Alex Crichton
fa661286db rollup merge of #24911: GBGamer/patch-4 2015-04-29 15:45:46 -07:00
Alex Crichton
0eaa811f4c rollup merge of #24908: inrustwetrust/once_memory_ordering
`call_once` guarantees that there is a happens-before relationship between its closure and code following it via the sequentially consistent atomic store/loads of `self.cnt`.
2015-04-29 15:45:45 -07:00
Alex Crichton
b0f920ace4 rollup merge of #24904: steveklabnik/remove_std_net_warning
This is served by stability markers.
2015-04-29 15:45:45 -07:00
Alex Crichton
91dfc38979 rollup merge of #24903: pnkfelix/fsk-enum-swapindrop
rename `schedule_drop_{enum,adt}_contents`.

addresses review nit from #24765 (it was my mistake for not doing this earlier before it landed).
2015-04-29 15:45:44 -07:00
Alex Crichton
4ff558cdba rollup merge of #24894: bguiz/diagnostic-E0267
This error indicates that a constant references itself.
All constants need to resolve to a value in an acyclic manner.

For example, neither of the following can be sensibly compiled:

```
const X: u32 = X;
```

```
const X: u32 = Y;
const Y: u32 = X;
```
2015-04-29 15:45:43 -07:00
Alex Crichton
783b4bbf69 rollup merge of #24886: GBGamer/master
These are useful when you want to catch the signals, like when you're making a kernel, or if you just don't want the overhead. (I don't know if there are any of the second kind of people, I don't think it's a good idea, but hey, choice is good).
2015-04-29 15:45:42 -07:00
Alex Crichton
8daf961a63 rollup merge of #24881: chris-morgan/issue-24872
Fixes #24872.
2015-04-29 15:45:41 -07:00
Alex Crichton
a24e036126 rollup merge of #24871: mbrubeck/doc-edit
r? @steveklabnik
2015-04-29 15:45:40 -07:00
Alex Crichton
18a0269d9d rollup merge of #24870: tshepang/reference-fix-brackets
Also, remove the other brackets, because they make the whole sentence look awkward.
2015-04-29 15:45:39 -07:00
Alex Crichton
256023a284 rollup merge of #24862: barometz/intro-push-err-fix
The error in the Brief Introduction shows the problematic line as "x.push(4)", while the example code uses a vector of strings.
2015-04-29 15:45:38 -07:00
Alex Crichton
41ee6df261 rollup merge of #24846: dotdash/fast_cttz8
Currently, LLVM lowers a cttz8 on x86_64 to these instructions:

```asm
    movzbl      %dil, %eax
    bsfl        %eax, %eax
    movl        $32, %ecx
    cmovnel     %eax, %ecx
    cmpl        $32, %ecx
    movl        $8, %eax
    cmovnel     %ecx, %eax
```

To improve the codegen, we can zero extend the 8 bit integer, then set
bit 8 and perform a cttz operation on the extended value. That way
there's no conditional operation involved at all.

This was discovered by  this benchmark: https://github.com/Kimundi/long_strings_without_repeats

Timings on my box with the current nightly:
```
running 4 tests
test bench_cpp_naive_big     ... bench:   5479222 ns/iter (+/- 254222)
test bench_noop_big          ... bench:    571405 ns/iter (+/- 111950)
test bench_rust_naive_big    ... bench:   7798102 ns/iter (+/- 148841)
test bench_rust_unsafe_big   ... bench:   6606488 ns/iter (+/- 67529)
```

Timings with the patch applied:
```
running 4 tests
test bench_cpp_naive_big     ... bench:   5470944 ns/iter (+/- 7109)
test bench_noop_big          ... bench:    568944 ns/iter (+/- 6895)
test bench_rust_naive_big    ... bench:   6795901 ns/iter (+/- 43806)
test bench_rust_unsafe_big   ... bench:   5584879 ns/iter (+/- 5291)
```
2015-04-29 15:45:37 -07:00
Alex Crichton
dfb60802c5 rollup merge of #24833: tari/rfc888
Closes #24118, implementing RFC 888.
2015-04-29 15:45:36 -07:00
Alex Crichton
3434469b51 rollup merge of #24762: nrc/mod-debug-2
Closes #20780

r? @michaelwoerister

I'm sure this could be done better with deeper knowledge of debuginfo, but this seems like a good start.
2015-04-29 15:45:35 -07:00
Alex Crichton
e14af089a4 rollup merge of #24711: alexcrichton/fs2.1
This commit is an implementation of [RFC 1044][rfc] which adds additional
surface area to the `std::fs` module. All new APIs are `#[unstable]` behind
assorted feature names for each one.

[rfc]: https://github.com/rust-lang/rfcs/pull/1044

The new APIs added are:

* `fs::canonicalize` - bindings to `realpath` on unix and
  `GetFinalPathNameByHandle` on windows.
* `fs::symlink_metadata` - similar to `lstat` on unix
* `fs::FileType` and accessor methods as `is_{file,dir,symlink}`
* `fs::Metadata::file_type` - accessor for the raw file type
* `fs::DirEntry::metadata` - acquisition of metadata which is free on Windows
  but requires a syscall on unix.
* `fs::DirEntry::file_type` - access the file type which may not require a
  syscall on most platforms.
* `fs::DirEntry::file_name` - access just the file name without leading
  components.
* `fs::PathExt::symlink_metadata` - convenience method for the top-level
  function.
* `fs::PathExt::canonicalize` - convenience method for the top-level
  function.
* `fs::PathExt::read_link` - convenience method for the top-level
  function.
* `fs::PathExt::read_dir` - convenience method for the top-level
  function.
* `std::os::raw` - type definitions for raw OS/C types available on all
  platforms.
* `std::os::$platform` - new modules have been added for all currently supported
  platforms (e.g. those more specific than just `unix`).
* `std::os::$platform::raw` - platform-specific type definitions. These modules
  are populated with the bare essentials necessary for lowing I/O types into
  their raw representations, and currently largely consist of the `stat`
  definition for unix platforms.

This commit also deprecates `Metadata::{modified, accessed}` in favor of
inspecting the raw representations via the lowering methods of `Metadata`.

Closes https://github.com/rust-lang/rust/issues/24796
2015-04-29 15:45:34 -07:00
Alex Crichton
b164f66172 rollup merge of #24610: nagisa/offset-docs 2015-04-29 15:45:34 -07:00
tynopex
3abba10e4f Update process.rs
Make whitespace consistent
2015-04-29 18:21:23 -04:00
Tamir Duberstein
8cdfc8feaf Re-enable tests on Android
Addresses part of #10381.
2015-04-29 14:34:45 -07:00
Tamir Duberstein
97fe4e6331 Re-enable test on Android
Closes #9116.
2015-04-29 14:34:45 -07:00
Tamir Duberstein
0270189057 Reference the correct issue
The problem here is that this test doesn't even compile for Android.

See #24958.
2015-04-29 14:34:44 -07:00