Commit Graph

64809 Commits

Author SHA1 Message Date
Inokentiy Babushkin
bd4fe45405
External spans: Added a test for #38875.
A bug has been discovered and fixed in the process.
2017-06-13 14:46:35 +02:00
Inokentiy Babushkin
d11973ae2a
External spans: added lazy source loading elsewhere
* In other places where the `src` member of a file map is accessed, we
  now load and possibly work with external source as well.
2017-06-12 21:47:39 +02:00
Inokentiy Babushkin
271133b03e
External spans: address review.
* The lazy loading mechanism has been moved to a more appropriate place.
* Return values from the functions invoked there are properly used.
* Documentation has gotten some minor improvements.
* Possibly some larger restructuring will need to take place still.
2017-06-12 15:37:26 +02:00
Inokentiy Babushkin
afe841587d
External spans: fixed unit tests and addressed review. 2017-06-11 16:45:51 +02:00
Inokentiy Babushkin
634cd2ce73
Updated UI tests to include rendered external spans. 2017-06-11 15:09:49 +02:00
Inokentiy Babushkin
9a8bbe9da9
Added hash verification to external source loading. 2017-06-11 13:48:54 +02:00
Inokentiy Babushkin
a5b8851e22
Added consumption logic for external sources in FileMap
We now fetch source lines from the `external_src` member as a secondary
fallback if no regular source is present, that is, if the file map
belongs to an external crate and the source has been fetched from disk.
2017-06-11 13:31:40 +02:00
Inokentiy Babushkin
c04aa4ed0c
Improved lazy external source loading and inserted calls. 2017-06-11 11:47:00 +02:00
Inokentiy Babushkin
c2c31b2db3
Added external crates' sources to FileMap.
They are now handled in their own member to prevent mutating access to
the `src` member. This way, we can safely load external sources, while
keeping the mutation of local source strings off-limits.
2017-06-10 21:08:32 +02:00
Inokentiy Babushkin
dd8f7cd126
Moved FileMap construction to it's own constructor.
The rationale is that BOM stripping is needed for lazy source loading
for external crates, and duplication can be avoided by moving the
corresponding functionality to libsyntax_pos.
2017-06-10 16:09:51 +02:00
Inokentiy Babushkin
3d2cff0c94
Added source hashes to FileMap
We can use these to perform lazy loading of source files belonging to
external crates. That way we will be able to show the source code of
external spans that have been translated.
2017-06-10 13:39:39 +02:00
Inokentiy Babushkin
70fa1fbea7
Added a StableHasherResult impl for u128. 2017-06-10 12:21:24 +02:00
bors
60ac9f467c Auto merge of #42573 - frewsxcv:rollup, r=frewsxcv
Rollup of 5 pull requests

- Successful merges: #42307, #42385, #42531, #42551, #42558
- Failed merges:
2017-06-09 23:19:49 +00:00
Corey Farwell
3be7f8bfed Rollup merge of #42558 - xfq:patch-1, r=steveklabnik
Update TRPL link in README.md
2017-06-09 18:29:29 -04:00
Corey Farwell
ad1a83863f Rollup merge of #42551 - tshepang:better-cell-replace-docs, r=steveklabnik
doc: a more complete explanation, and a better example
2017-06-09 18:29:28 -04:00
Corey Farwell
19ba908ac0 Rollup merge of #42531 - mmatyas:aarch64_compile-test_fix, r=nagisa
Ignore variadic FFI test on AArch64

I've cross compiled Rust to `aarch64-linux-gnu`, and tried to run the compile-fail tests, but `variadic-ffi.rs` fails with the following error:

```
The ABI `"stdcall"` is not supported for the current target [E0570]
```

The test seems to be ignored on (32-bit) ARM, so I turned it off for AArch64 too.
2017-06-09 18:29:27 -04:00
Corey Farwell
1fcb6d86dc Rollup merge of #42385 - Manishearth:its-a-vec, r=steveklabnik
Vec<T> is pronounced 'vec'

I've never heard it pronounced "vector". Is this an outdated recommendation?

(or have I been doing it wrong all this time)

r? @steveklabnik
2017-06-09 18:29:26 -04:00
Corey Farwell
9163f338f9 Rollup merge of #42307 - clarcharr:js-license, r=frewsxcv
Make rustdoc.js use license comments.

This will ensure that JS minifiers and the like will preserve the license statement even after minimisation.
2017-06-09 18:29:25 -04:00
bors
3d5b8c6266 Auto merge of #42278 - gentoo90:gdb-pretty-printers, r=michaelwoerister
Fix GDB pretty-printer for tuples and pointers

Names of children should not be the same, because GDB uses them to distinguish the children.

|Before|After|
|---|---|
|![tuples_before](https://cloud.githubusercontent.com/assets/1297574/26527639/5d6cf10e-43a0-11e7-9498-abfcddb08055.png)|![tuples_after](https://cloud.githubusercontent.com/assets/1297574/26527655/9699233a-43a0-11e7-83c6-f58f713b51a0.png)|

`main.rs`
```rust
enum Test {
    Zero,
    One(i32),
    Two(i32, String),
    Three(i32, String, Vec<String>),
}

fn main() {
    let tuple = (1, 2, "Asdfgh");
    let zero = Test::Zero;
    let one = Test::One(10);
    let two = Test::Two(42, "Qwerty".to_owned());
    let three = Test::Three(9000,
                            "Zxcvbn".to_owned(),
                            vec!["lorem".to_owned(), "ipsum".to_owned(), "dolor".to_owned()]);
    println!(""); // breakpoint here
}
```

`launch.json`
```json
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "gdb",
            "request": "launch",
            "gdbpath": "rust-gdb",
            "name": "Launch Program",
            "valuesFormatting": "prettyPrinters", //this requires plugin Native Debug >= 0.20.0
            "target": "./target/debug/test_pretty_printers",
            "cwd": "${workspaceRoot}"
        }
    ]
}
```
2017-06-09 18:17:15 +00:00
gentoo90
63076ddbb8 Add compat_str() which works with unicode in both Python 2 and 3
GDB can be built with Python 2 or with Python 3
2017-06-09 19:09:02 +03:00
gentoo90
d7c0d7569b Pretty-printers tests: gdbr -> gdb 2017-06-09 18:51:28 +03: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
Fuqiao Xue
09ac478c5c Update TRPL link in README.md 2017-06-09 13:37:22 +08: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
Tshepang Lekhonkhobe
c288864ed0 doc: a more complete explanation, and a better example 2017-06-08 22:52:54 +02: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
Mátyás Mustoha
70e48b12e9 Ignore variadic FFI test on AArch64 2017-06-08 12:03:08 +02: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
Clar Charr
dd23fda9bd Make rustdoc.js use license comments. 2017-06-07 22:44:53 -04: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