Commit Graph

64778 Commits

Author SHA1 Message Date
Georg Brandl 2366c464a7 Add dedicated docstrings to Sum/Product impl of Result
(and fix a minor grammar typo below)
2017-06-12 10:50:28 +02:00
bors 5fe923d434 Auto merge of #42507 - ibabushkin:external-span-trans, r=eddyb
Fix translation of external spans

Previously, I noticed that spans from external crates don't generate any output. This limitation is problematic if analysis is performed on one or more external crates, as is the case with [rust-semverver](https://github.com/ibabushkin/rust-semverver). This change should address this behaviour, with the potential drawback that a minor performance hit is to be expected, as spans from potentially large crates have to be translated now.
2017-06-09 12:49:49 +00:00
bors a7ac71b978 Auto merge of #42521 - alexcrichton:enosys, r=cuviper
std: Handle ENOSYS when calling `pipe2`

Should help fix an accidental regression from #39386.
2017-06-09 10:28:12 +00:00
bors 19193d6390 Auto merge of #42504 - michaelwoerister:hash-dep-nodes-prep, r=nikomatsakis
Some preparatory refactorings for hash-based DepNodes

This PR collects some changes that turn out to be necessary for implementing `DepNodes` based on stable hashes (see #42294). The commits are self-contained and mostly straightforward.

The most interesting change here is the introduction of `DefIndices` for things that are not part of the AST: Some pieces of crate metadata now have a `DefIndex` too.

cc @eddyb
r? @nikomatsakis
2017-06-09 08:03:14 +00:00
bors 2416e222ec Auto merge of #42027 - mjkillough:typedef_assoc_items, r=QuietMisdreavus
Document direct implementations on type aliases.

This improves #32077, but is not a complete fix.

For a type alias `type NewType = AliasedType`, it will include any `impl NewType` and `impl
Trait for NewType` blocks in the documentation for `NewType`.

A complete fix would include the implementations from the aliased type in the type alias' documentation, so that users have a complete picture of methods that are available on the alias. However, to do this properly would require a fix for #14072, as the alias may affect the type parameters of the type alias, making the documentation difficult to understand. (That is, for `type Result = std::result::Result<(), ()>` we would ideally show documentation for `impl Result<(), ()>`, rather than generic documentation for `impl<T, E> Result<T, E>`).

I think this improvement is worthwhile, as it exposes implementations which are not currently documented by rustdoc. The documentation for the implementations on the aliased type are still accessible by clicking through to the docs for that type. (Although perhaps it's now less obvious to the user that they should click-through to get there).
2017-06-09 04:09:39 +00:00
Michael Killough 2da350168d Document direct implementations on type aliases.
This improves #32077, but is not a complete fix. For a type alias `type
NewType = AliasedType`, it will include any `impl NewType` and `impl
Trait for NewType` blocks in the documentation for `NewType`.

A complete fix would include the implementations from the aliased type
in the type alias' documentation, so that users have a complete
picture of methods that are available on the alias. However, to do this
properly would require a fix for #14072, as the alias may affect the
type parameters of the type alias, making the documentation difficult to
understand. (That is, for `type Result = std::result::Result<(), ()>` we
would ideally show documentation for `impl Result<(), ()>`, rather than
generic documentation for `impl<T, E> Result<T, E>`).

I think this improvement is worthwhile, as it exposes implementations
which are not currently documented by rustdoc. The documentation for the
implementations on the aliased type are still accessible by clicking
through to the docs for that type. (Although perhaps it's now less
obvious to the user that they should click-through to get there).
2017-06-09 10:57:08 +09:00
bors 9454dd5d2d Auto merge of #42491 - RalfJung:bootstrap-help, r=alexcrichton
bootstrap: improve 'build --help' by explaining what exactly the last example does

I recently found myself confused about what exactly gets built how often when I run which command; I think this would have helped me.

One thing I did not touch, but I feel could also be improved, is the wording just above: "For a quick build with a usable compile, you can pass".  I am not a native speaker, but this sounds odd to me. Do you mean "For a quick build of a usable compiler" (but then it should say where the usable compiler is produced)? Or do you mean "For a quick build testing if the compiler is usable"? I can reword this, but I'd like to make sure I understand the intent of the message.

What about
```
    For a quick build of a usable compiler, you can pass:

        ./x.py build --stage 1 src/libtest

    This will first build everything once (like --stage 0 without further
    arguments would), and then use the compiler built in stage 0 to build
    src/libtest and its dependencies.
    Once this is done, build/$ARCH/stage1 contains a usable compiler.
```
However, I am not sure this is actually true. In particular, why even bother building the libstd in stage 1? AFAIK that ends up in `build/*/stage1-std`, not in `build/*/stage1` (which is filled from `build/*/stage0-*`).
2017-06-08 22:21:29 +00:00
bors 148e917148 Auto merge of #42487 - alexcrichton:smaller-personality, r=vadimcn
std: Avoid panics in rust_eh_personality

This commit removes a few calls to panic and/or assert in `rust_eh_personality`.
This function definitely can't itself panic (that'd probably segfault or do
something else weird) and I was also noticing that a `pub extern fn foo() {}`
cdylib was abnormally large. Turns out all that size was the panicking machinery
brought in by the personality function!

The change here is to return a `Result` internally so we can bubble up the fatal
error, eventually translating to the appropriate error code for the libunwind
ABI.
2017-06-08 19:52:53 +00:00
Alex Crichton 44e6406f9a std: Handle ENOSYS when calling `pipe2`
Should help fix an accidental regression from #39386.
2017-06-08 07:31:05 -07:00
Alex Crichton 52805d233b std: Avoid panics in rust_eh_personality
This commit removes a few calls to panic and/or assert in `rust_eh_personality`.
This function definitely can't itself panic (that'd probably segfault or do
something else weird) and I was also noticing that a `pub extern fn foo() {}`
cdylib was abnormally large. Turns out all that size was the panicking machinery
brought in by the personality function!

The change here is to return a `Result` internally so we can bubble up the fatal
error, eventually translating to the appropriate error code for the libunwind
ABI.
2017-06-08 07:06:43 -07:00
bors ae3d3878ef Auto merge of #42500 - hsivonen:neon, r=japaric
Change `llvm.neon.*` to `llvm.arm.neon.*` in the mapping for platform intrinsics

This avoids linker errors when using platform intrinsics on 32-bit ARM with
NEON.

Fixes rust-lang-nursery/simd#10.

I don't have an explanation why the old code might have worked when the `simd` crate was written, since the new LLVM intrinsic naming seems to have existed as early as 2012. Maybe LLVM accepted two naming schemes for a few years and dropped the `llvm.neon.*` version recently? I don't know.

Also, I don't know how to write a unit test for this.
2017-06-08 13:52:13 +00:00
bors c799b37d54 Auto merge of #42489 - eddyb:untyped-stmts, r=nikomatsakis
Statements do not have types.

Past refactors accidentally left in some dead type-checking code - nothing reads the always-`()` types.

r? @nikomatsakis
2017-06-08 11:18:45 +00:00
bors f09576c4a4 Auto merge of #42443 - tommyip:better_closure_msg, r=nikomatsakis
Better closure error message

Use tracked data introduced in #42196 to provide a better closure
error message by showing why a closure implements `FnOnce`.

```
error[E0525]: expected a closure that implements the `Fn` trait, but
this closure only implements `FnOnce`
 --> $DIR/issue_26046.rs:4:19
  |
4 |       let closure = move || {
  |  ___________________^
5 | |         vec
6 | |     };
  | |_____^
  |
note: closure is `FnOnce` because it moves the variable `vec` out of
its environment
 --> $DIR/issue_26046.rs:5:9
  |
5 |         vec
  |         ^^^

error: aborting due to previous error(s)
```

Fixes #26046

r? @nikomatsakis
cc @doomrobo
2017-06-08 08:37:48 +00:00
bors 76eea743b4 Auto merge of #42481 - brson:wingnu, r=alexcrichton
Fix setting PATH during linkage on windows-gnu

This makes the behavior almost exactly the same as before the VS2017 patch, except that on MSVC builds the host bin path is no longer added to PATH. I am not sure that's actually necessary on any platform.

r? @alexcrichton

Fixes https://github.com/rust-lang/rust/issues/42422
2017-06-08 06:02:04 +00:00
Ralf Jung 7359c791b5 bootstrap: further clarify build --help 2017-06-07 22:08:48 -07:00
bors e1fa8de0fb Auto merge of #42522 - frewsxcv:rollup, r=frewsxcv
Rollup of 5 pull requests

- Successful merges: #42470, #42490, #42497, #42510, #42512
- Failed merges:
2017-06-08 03:46:16 +00:00
Corey Farwell 13ae42fb20 Rollup merge of #42512 - Keruspe:master, r=alexcrichton
update git2

Fixes build with libressl
2017-06-07 21:58:46 -04:00
Corey Farwell a04eefb66a Rollup merge of #42510 - mbrubeck:docs, r=QuietMisdreavus
Update step_by docs to say iterator instead of range

None
2017-06-07 21:58:45 -04:00
Corey Farwell aa536f4be3 Rollup merge of #42497 - qnighy:just-use-try-in-three-places, r=eddyb
Replace some matches with try.

This patch just replaces `match`es with `?` in the compiler, which I came across when I'm reading the parser.
2017-06-07 21:58:45 -04:00
Corey Farwell 3ce88c7c8d Rollup merge of #42490 - gaurikholkar:master, r=eddyb
Changing error message from `contains interior mutability` to `may contain interior mutability`

Fixes #40313 . I have changed the message from `contains interior mutability` to `may contain interior mutability` for the following example
```
use std::cell::Cell;
use std::panic::catch_unwind;
fn main() {
    let mut x = Cell::new(22);
    catch_unwind(|| { x.set(23); });
}
```
which has been added as a ui test.

Also, the message [here](https://github.com/gaurikholkar/rust/blob/master/src/librustc_mir/transform/qualify_consts.rs#L666) and it's respective `compile-fail` test have been modified.

cc @nikomatsakis  @Mark-Simulacrum  @eddyb
2017-06-07 21:58:44 -04:00
Corey Farwell 0362891073 Rollup merge of #42470 - frewsxcv:frewsxcv/ffi-cstr-doc-examples, r=QuietMisdreavus
Add doc examples for `CString` methods.

None
2017-06-07 21:58:43 -04:00
bors d8d5592596 Auto merge of #40706 - irfanhudda:doc-next-power-of-two, r=alexcrichton
Improve documentation of next_power_of_two

Clarify overflow behavior of `next_power_of_two`.

Related Issue: #18604
2017-06-08 01:07:08 +00:00
bors 03eb7109c7 Auto merge of #42447 - alexcrichton:update-cargo, r=petrochenkov
Update Cargo

Brings in some perf improvements!
2017-06-07 22:48:15 +00:00
Tommy Ip 345b8332bd Cover all cases in closure errors 2017-06-07 21:26:28 +01:00
Marc-Antoine Perennou 95bc0d6c79 update git2
Fixes build with libressl

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2017-06-07 21:42:31 +02:00
Matt Brubeck b6193f3c00 Update docs to say iterator instead of range 2017-06-07 09:24:35 -07:00
bors f062832b20 Auto merge of #42378 - steveklabnik:rustdoc-docs, r=frewsxcv
The Rustdoc book

A work-in-progress start for docs for rustdoc.

This doesn't actually generate the docs yet; I wanted to open this PR to get feedback on this approach, the chapters headings themselves, and to see if anyone wanted to help fill in the ones that aren't done yet.

Start of #42322.

/cc @rust-lang/dev-tools @rust-lang/docs
2017-06-07 15:16:46 +00:00
Alex Crichton 453080f13e Update Cargo
Brings in some perf improvements!
2017-06-07 07:57:59 -07:00
Inokentiy Babushkin 9a054f2002
Fix translation of external spans. 2017-06-07 16:31:05 +02:00
bors a69cc85909 Auto merge of #42486 - eddyb:issue-39882, r=nikomatsakis
rustc_trans: do not store pair fields if they are ZSTs.

Should help with #39882 even if it's not a complete fix AFAICT.
2017-06-07 12:34:13 +00:00
Michael Woerister 8b36d3308e Allocate DefIndices for global crate metadata.
This allows for treating global crate metadata the same as regular metadata with regard to incr. comp.
2017-06-07 12:11:40 +02:00
bors 37b1f6c4f1 Auto merge of #42482 - eddyb:issue-42467, r=nikomatsakis
rustc: T: 'empty always holds for all types.

Fixes #42467 by special-casing `ReEmpty` to always hold, even for parameters.
The reason this is the case is that `ReEmpty` is the result of inferring a region variable with no constraints attached to it, so there is no lifetime a type would contain which would be strictly shorter.

r? @nikomatsakis
2017-06-07 10:09:11 +00:00
gaurikholkar 980a5b0529 indentation fixes 2017-06-07 02:35:45 -07:00
Henri Sivonen 0fb8414f14 Change `llvm.neon.*` to `llvm.arm.neon.*` in the mapping for platform intrinsics
This avoids linker errors when using platform intrinsics on 32-bit ARM with
NEON.

Fixes rust-lang-nursery/simd#10.
2017-06-07 11:23:10 +03:00
bors 89fceaa5b0 Auto merge of #42480 - eddyb:issue-42463, r=nikomatsakis
rustc_typeck: do not overlap a borrow of TypeckTables with method lookup.

If trait selection is reached, it could potentially request a closure signature, which will have to borrow the `TypeckTables` of the current function, and so those tables *should not* be mutably borrowed.

Fixes #42463.
r? @nikomatsakis
2017-06-07 07:52:12 +00:00
bors f73f675a86 Auto merge of #42494 - frewsxcv:rollup, r=frewsxcv
Rollup of 7 pull requests

- Successful merges: #42409, #42415, #42429, #42438, #42466, #42469, #42485
- Failed merges:
2017-06-07 04:24:15 +00:00
Masaki Hara ab72611d8f
Replace some matches with try. 2017-06-07 12:15:39 +09:00
Corey Farwell 24f48d030e Rollup merge of #42485 - Mark-Simulacrum:skip-no-doc, r=alexcrichton
Skip printing for skipped doc tests.

Followup to https://github.com/rust-lang/rust/pull/42437 to further reduce noise.

r? @alexcrichton
2017-06-06 22:36:37 -04:00
Corey Farwell 7f8467eaaf Rollup merge of #42469 - citizen428:document-assert-macros, r=steveklabnik
Doc changes for assert macros

See #29381
2017-06-06 22:36:36 -04:00
Corey Farwell bedead25fe Rollup merge of #42466 - wesleywiser:fix_42407, r=arielb1
syntax_pos::Symbol should not implement Sync

Fixes #42407
2017-06-06 22:36:35 -04:00
Corey Farwell 9e8c94c5d7 Rollup merge of #42438 - king6cong:master, r=alexcrichton
doc rewording
2017-06-06 22:36:34 -04:00
Corey Farwell b472b66454 Rollup merge of #42429 - venkatagiri:llvm_config, r=alexcrichton
rustc_llvm: re-run build script if config.toml changes

closes #35199
2017-06-06 22:36:34 -04:00
Corey Farwell 915b19d7c3 Rollup merge of #42415 - stephen-lazaro:Issue29094, r=arielb1
Remove 'elided' from lifetime resolution error

Removes 'elided' from lifetime resolution errors
Removes 'elided' from relevant error messaging tests

This PR resolves https://github.com/rust-lang/rust/issues/29094

r? @Mark-Simulacrum
2017-06-06 22:36:33 -04:00
Corey Farwell e702b75b00 Rollup merge of #42409 - bjorn3:patch-3, r=frewsxcv
Better docs

Working on more doc improvements

Edit: done for today
2017-06-06 22:36:32 -04:00
bors 21d0f91444 Auto merge of #42133 - cuviper:stdio-from, r=alexcrichton
Add conversions from File and Child* handles to Stdio

`Stdio` now implements `From<ChildStdin>`, `From<ChildStdout>`,
`From<ChildStderr>`, and `From<File>`.

The `Command::stdin`/`stdout`/`stderr` methods now take any type that
implements `Into<Stdio>`.

This makes it much easier to write shell-like command chains, piping to
one another and redirecting to and from files.  Otherwise one would need
to use the unsafe and OS-specific `from_raw_fd` or `from_raw_handle`.
2017-06-07 02:11:20 +00:00
Josh Stone 9debe91675 Add conversions from File and Child* handles to Stdio
`Stdio` now implements `From<ChildStdin>`, `From<ChildStdout>`,
`From<ChildStderr>`, and `From<File>`.

The `Command::stdin`/`stdout`/`stderr` methods now take any type that
implements `Into<Stdio>`.

This makes it much easier to write shell-like command chains, piping to
one another and redirecting to and from files.  Otherwise one would need
to use the unsafe and OS-specific `from_raw_fd` or `from_raw_handle`.
2017-06-06 15:42:55 -07:00
Brian Anderson e8689c7de7 Fix setting PATH during linkage on windows-gnu 2017-06-06 14:51:17 -07:00
Ralf Jung e37cfc7dd2 bootstrap: improve 'build --help' by explaining what exactly the last example does 2017-06-06 14:26:56 -07:00
bors 76242aebb9 Auto merge of #42361 - GuillaumeGomez:error-codes, r=arielb1
Add E0602

Part of #42229.

cc @Susurrus
2017-06-06 20:46:10 +00:00
gaurikholkar bc7eb3bd3a Changing error message for interior mutability, adding ui test 2017-06-07 01:38:05 +05:30