Commit Graph

69063 Commits

Author SHA1 Message Date
Michael Woerister
c13e35eb2e Take crate-type into account when computing symbol export list. 2017-10-31 12:42:03 +01:00
bors
6713736275 Auto merge of #45551 - michaelwoerister:fix-hir-depnodes-and-ich, r=nikomatsakis
incr.comp.: Fix two problems with HIR hashing.

Fixes https://github.com/rust-lang/rust/issues/45469.

This PR fixes two small problems:
* Overflow checks are always enabled in a constant context, so we need to hash spans of potentially overflowing operations. (Eventually I'd like to handle spans differently so we don't have to make HIR hashing know so much about things like this.)
* The HIR map collector had a bug where it would assign the `DepNode::Hir` instead of the corresponding `DepNode::HirBody` in some nested contexts.

r? @nikomatsakis
2017-10-31 05:03:25 +00:00
bors
f57c55d54d Auto merge of #45550 - kennytm:update-xsv, r=BurntSushi
cargotest: Update xsv.

This fixes a flaky test which caused spurious failures in #45348 and #45380.
2017-10-31 00:53:12 +00:00
bors
2d3b96691e Auto merge of #45497 - mikhail-m1:dump-mir-graphviz, r=nikomatsakis
add graphvis DOT files to dump mir directory

r? @nikomatsakis
2017-10-30 21:22:40 +00:00
Niko Matsakis
b2c2ba4eb5
tweak the description
"in addition to" sounds better than "additionally to"
2017-10-30 10:22:35 -04:00
bors
f0fe716dbc Auto merge of #45626 - wesleywiser:doc_update_1, r=Mark-Simulacrum
Add link to stablized version of an intrinsic
2017-10-30 08:52:40 +00:00
bors
86d1178320 Auto merge of #45603 - joshleeb:iss42106, r=estebank
Fix duplicate display of error E0502

Ref. Repeated "mutable/immutable borrow" error messages #42106.

This PR modifies the return type of [`report_error_if_loan_conflicts_with_restriction`](0f0f5db465/src/librustc_borrowck/borrowck/check_loans.rs (L398-L403)) so the result can be checked in [`report_error_if_loans_conflict`](0f0f5db465/src/librustc_borrowck/borrowck/check_loans.rs (L377-L396)). This is done to prevent displaying a duplicate of the error message E0502 which is referenced in #42106.

The output of compiling:

```rust
fn do_something<T>(collection: &mut Vec<T>) {
    let _a = &collection;
    collection.swap(1, 2);
}

fn main() {}
```

is now

```bash
$ rustc src/test/compile-fail/issue-42106.rs
error[E0502]: cannot borrow `*collection` as mutable because `collection` is also borrowed as immutable
  --> src/test/compile-fail/issue-42106.rs:13:5
   |
12 |     let _a = &collection;
   |               ---------- immutable borrow occurs here
13 |     collection.swap(1, 2);
   |     ^^^^^^^^^^ mutable borrow occurs here
14 | }
   | - immutable borrow ends here

error: aborting due to 2 previous errors
```

r? @estebank
2017-10-30 06:17:39 +00:00
Wesley Wiser
9ca825e292 Add link to stablized version of an intrinsic 2017-10-29 22:53:07 -04:00
bors
875ec8d597 Auto merge of #45618 - kennytm:update-cargo, r=alexcrichton
Update cargo.

Brings in rust-lang/cargo#4672, unbreaks nightly on macOS APFS.

Fixes #45607.

r? @alexcrichton
2017-10-30 02:33:52 +00:00
Josh Leeb-du Toit
cf10bcfe48 Move issue-42106 test from compile-fail to ui 2017-10-30 11:28:44 +11:00
bors
dae6868637 Auto merge of #45424 - petrochenkov:grlint, r=oli-obk
Add several lints into `unused` lint group

Also a couple of obsolete (not reported) lints are removed.

r? @oli-obk
2017-10-29 23:59:07 +00:00
Josh Leeb-du Toit
37f2382435 Refactor if block to use idiomatic matches 2017-10-30 09:58:09 +11:00
bors
90ef3372e8 Auto merge of #45597 - DSpeckhals:rustfmt-update, r=nrc
tools: Update rustfmt and re-enable testing

This allows rustfmt and the RLS to test and compile again.
2017-10-29 21:25:12 +00:00
Josh Leeb-du Toit
014e61094a Refactor matches to use Result::err 2017-10-30 08:21:56 +11:00
Dustin Speckhals
e3bf19d8d4 Update rustfmt again 2017-10-29 15:16:02 -04:00
Vadim Petrochenkov
bf0cdb52f2 Add several lints into unused lint group
Remove a couple of obsolete lints
2017-10-29 22:14:23 +03:00
bors
2d3afa6833 Auto merge of #45616 - fhartwig:ptr-docs, r=dtolnay
Fix references to zero_memory and copy_memory in ptr docs

Fixes #45606
2017-10-29 18:44:16 +00:00
kennytm
30828c58e7
Update cargo.
Brings in rust-lang/cargo#4672, unbreaks nightly on macOS APFS.
2017-10-30 01:32:08 +08:00
Dustin Speckhals
d284815f72 Merge branch 'master' into rustfmt-update 2017-10-29 13:27:06 -04:00
bors
690ff04594 Auto merge of #45611 - Manishearth:lint-generics, r=petrochenkov
Add generics to LateContext

Fixes clippy breakage from https://github.com/rust-lang/rust/pull/44766 as discussed in https://github.com/rust-lang-nursery/rust-clippy/pull/2140#issuecomment-336973875

r? @nikomatsakis
2017-10-29 15:22:38 +00:00
Florian Hartwig
9e966ad3dc Fix references to zero_memory and copy_memory in ptr docs 2017-10-29 15:40:09 +01:00
Manish Goregaokar
84f1fc951d
Update clippy 2017-10-29 05:27:36 -04:00
bors
7d475a28df Auto merge of #45295 - Technius:docs/process, r=steveklabnik
Improve std::process module docs

Addresses part of #29370

I've changed the first `cat` example to a "Hello World" example involving echo, and I've also added another example showing how to pipe output. I'm still working on the module-level description.

For now, I'd like feedback on the examples.

r? @steveklabnik
2017-10-29 06:24:20 +00:00
Bryan Tan
84ab6aec43 Add no_run to process examples involving unix commands 2017-10-28 20:27:05 -07:00
bors
1fdcf52df4 Auto merge of #45554 - integer32llc:update-book, r=steveklabnik
Update the book for a fix to the print button

Fixes #45552.

Brings in recent improvements in the text that we've made recently as well.

r? @steveklabnik
2017-10-29 02:16:24 +00:00
Josh Leeb-du Toit
975ff7b7a0 Add test for fix duplicate display of E0502 2017-10-29 12:14:14 +11:00
Josh Leeb-du Toit
5086657b42 Fix duplicate display of error E0502 2017-10-29 12:14:13 +11:00
Carol (Nichols || Goulding)
c285a4e8f7 Update the book for a fix to the print button
Fixes #45552.
2017-10-28 20:44:38 -04:00
bors
49edcbd32a Auto merge of #45580 - kennytm:sdkmanager, r=alexcrichton
ci: Upgrade Android SDK/NDK and refactor to use sdkmanager/avdmanager.

* SDK tools is upgraded to 27.0.0.

* Stopped using the deprecated `android` tool, instead use the recommended `sdkmanager` and `avdmanager`.

* NDK is upgrade to r15c.

    The r15 series [dropped support for android-9](https://github.com/android-ndk/ndk/wiki/Changelog-r15) (2.3 / Gingerbread), the minimal supported version is now android-14 (4.0 / Ice Cream Sandwich).

r? @alexcrichton

(WIP, haven't confirmed if the change really works yet)
2017-10-28 23:40:31 +00:00
kennytm
c46b04cbdd
ci: Upgrade Android SDK/NDK and refactor to use sdkmanager/avdmanager.
* SDK tools is upgraded to 27.0.0.
   - Refactored to use `sdkmanager`/`avdmanager` instead of the deprecated
     `android` tool.

* The Java version used by Android SDK is downgraded to OpenJDK-8, in order
  to download the SDK through HTTPS.

* NDK is upgrade to r15c.
   - Dropped support for android-9 (2.3 / Gingerbread), the minimal
     supported version is now android-14 (4.0 / Ice Cream Sandwich).
   - Changed the default Android compiler from GCC to clang.
   - For details of change introduced by NDK r15, see
     https://github.com/android-ndk/ndk/wiki/Changelog-r15.
2017-10-29 05:58:00 +08:00
Manish Goregaokar
b2df63b393 Add generics field to LateContext 2017-10-28 17:28:14 -04:00
bors
269cf5026c Auto merge of #45540 - virgil-palanciuc:master, r=estebank
Avoid repetition on “use of unstable library feature 'rustc_private'”

This PR fixes the error by only emitting it when the span contains a real file (is not inside a macro) - and making sure it's emitted only once per span.
The first check was needed because spans-within-macros seem to differ a lot and "fixing" them to the real location is not trivial (and the method that does this is private to another module). It also feels like there always will be an error on import, with the real file name, so not sure there's a point to re-emit the same error at macro use.

Fix #44953.
2017-10-28 21:01:07 +00:00
Virgil Palanciuc
bb0049bcd2 fixed tidy error 2017-10-28 22:38:15 +03:00
Dustin Speckhals
1156455d42 Update rustfmt
This allows rustfmt and the RLS to test and compile again.
2017-10-28 13:46:43 -04:00
Virgil Palanciuc
304c8b1eda implemented code review 2017-10-28 20:39:00 +03:00
bors
2e6a1a9fb4 Auto merge of #45489 - oli-obk:json_diagnostics, r=petrochenkov
Fix a quadradic duplication in json for multi-suggestions

r? @petrochenkov
2017-10-28 16:15:17 +00:00
bors
dce604a8fe Auto merge of #44295 - plietar:extern-types, r=arielb1
Implement RFC 1861: Extern types

A few notes :

- Type parameters are not supported. This was an unresolved question from the RFC. It is not clear how useful this feature is, and how variance should be treated. This can be added in a future PR.

- `size_of_val` / `align_of_val` can be called with extern types, and respectively return 0 and 1. This differs from the RFC, which specified that they should panic, but after discussion with @eddyb on IRC this seems like a better solution.
If/when a `DynSized` trait is added, this will be disallowed statically.

- Auto traits are not implemented by default, since the contents of extern types is unknown. This means extern types are `!Sync`, `!Send` and `!Freeze`. This seems like the correct behaviour to me.
Manual `unsafe impl Sync for Foo` is still possible.

- This PR allows extern type to be used as the tail of a struct, as described by the RFC :
```rust
extern {
    type OpaqueTail;
}

#[repr(C)]
struct FfiStruct {
    data: u8,
    more_data: u32,
    tail: OpaqueTail,
}
```

However this is undesirable, as the alignment of `tail` is unknown (the current PR assumes an alignment of 1). Unfortunately we can't prevent it in the general case as the tail could be a type parameter :
```rust
#[repr(C)]
struct FfiStruct<T: ?Sized> {
    data: u8,
    more_data: u32,
    tail: T,
}
```

Adding a `DynSized` trait would solve this as well, by requiring tail fields to be bound by it.

- Despite being unsized, pointers to extern types are thin and can be casted from/to integers. However it is not possible to write a `null<T>() -> *const T` function which works with extern types, as I've explained here : https://github.com/rust-lang/rust/issues/43467#issuecomment-321678621

- Trait objects cannot be built from extern types. I intend to support it eventually, although how this interacts with `DynSized`/`size_of_val` is still unclear.

- The definition of `c_void` is unmodified
2017-10-28 13:34:12 +00:00
bors
7da9a5e178 Auto merge of #45589 - kennytm:rollup, r=kennytm
Rollup of 7 pull requests

- Successful merges: #45421, #45449, #45505, #45535, #45549, #45574, #45585
- Failed merges:
2017-10-28 09:42:38 +00:00
kennytm
0b02377614 Rollup merge of #45585 - frewsxcv:frewsxcv-diagnostic, r=kennytm
Remove 'future Rust version' code block in diagnostic text.

Fixes https://github.com/rust-lang/rust/issues/43780.
2017-10-28 15:56:25 +08:00
kennytm
65f1df594a Rollup merge of #45574 - nzig:on_unimplemented_example, r=steveklabnik
Fixed rustc_on_unimplemented example in Unstable Book

I saw [this](https://doc.rust-lang.org/beta/unstable-book/language-features/on-unimplemented.html) example and it seemed wrong. This fixes the example to emit an error message that makes more sense.
2017-10-28 15:56:24 +08:00
kennytm
55c4849ca4 Rollup merge of #45549 - steveklabnik:remove-just, r=QuietMisdreavus
Remove 'just' in diagnostics

This is better writing
2017-10-28 15:56:23 +08:00
kennytm
a03d0181c5 Rollup merge of #45535 - topecongiro:bootstrap-exit-code, r=kennytm
Return 0 as an exit status when no subcommand is given to bootstrap

Running `./x.py` emits usage and error messages when no subcommand is given:
```
Usage: x.py <subcommand> [options] [<paths>...]

Subcommands:
    build       Compile either the compiler or libraries
    test        Build and run some test suites
    bench       Build and run some benchmarks
    doc         Build documentation
    clean       Clean out build directories
    dist        Build distribution artifacts
    install     Install distribution artifacts

To learn more about a subcommand, run `./x.py <subcommand> -h`

failed to run: /home/topecongiro/rust/build/bootstrap/debug/bootstrap
```
IMHO the last line is unnecessary. This PR removes it by changing the return code of `bootstrap` to 0 when no sub command is given.
2017-10-28 15:56:22 +08:00
kennytm
0a916a43e9 Rollup merge of #45505 - spk:use-expect-instead-unwrap, r=kennytm
Use expect for current_dir on librustc/session mod

Reference bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=871638

Like described on the reference bug report:

~~~
$ mkdir dir
$ cd dir
$ rm -rf ../dir
$ RUST_BACKTRACE=1 rustc -C target-cpu=help
error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 2, message: "No such file or directory" } }', src/libcore/result.rs:837
stack backtrace:
   1:     0x7f7d23970dda - <unknown>
   2:     0x7f7d2398305f - <unknown>
   3:     0x7f7d2397f8a5 - <unknown>
   4:     0x7f7d2397ffc7 - std::panicking::rust_panic_with_hook::h109e116a3a861224
   5:     0x7f7d2397fe54 - <unknown>
   6:     0x7f7d2397fd79 - std::panicking::begin_panic_fmt::h26713cea9bce3ab0
   7:     0x7f7d2397fd07 - rust_begin_unwind
   8:     0x7f7d239cb41d - core::panicking::panic_fmt::hcfbb59eeb7f27f75
   9:     0x7f7d20be63d3 - <unknown>
  10:     0x7f7d20d6ebcc - rustc::session::build_session_::h7a3559f2373a5d05
  11:     0x7f7d20d6dd7e - rustc::session::build_session_with_codemap::h68bc7bcd2f34eee4
  12:     0x7f7d20d6d72c - rustc::session::build_session::h437fda3c327a8bde
  13:     0x7f7d23d26030 - <rustc_driver::RustcDefaultCalls as rustc_driver::CompilerCalls<'a>>::no_input::h8047df7741757d1c
  14:     0x7f7d23d21d27 - rustc_driver::run_compiler::hafe7bbfedf95a825
  15:     0x7f7d23c57378 - <unknown>
  16:     0x7f7d2398ae0a - __rust_maybe_catch_panic
  17:     0x7f7d23c76fa8 - <unknown>
  18:     0x7f7d2397eb74 - <unknown>
  19:     0x7f7d1ed4f493 - start_thread
  20:     0x7f7d23645afe - __clone
  21:                0x0 - <unknown>
~~~

With this patch this will give instead:

~~~
error: Current directory is invalid: No such file or directory (os error 2)
~~~
2017-10-28 15:56:21 +08:00
kennytm
71b876bca0 Rollup merge of #45449 - frewsxcv:frewsxcv-udp-nonblocking, r=sfackler
Improve docs for UdpSocket::set_nonblocking.

Closes https://github.com/rust-lang/rust/issues/44050.
2017-10-28 15:56:20 +08:00
kennytm
b644339a16 Rollup merge of #45421 - QuietMisdreavus:update-pulldown, r=steveklabnik
rustdoc: update pulldown + fix spurious rendering difference around footnotes

fixes #45420
2017-10-28 15:56:19 +08:00
bors
75277c72c0 Auto merge of #45566 - cuviper:option-checking, r=alexcrichton
configure.py: fix --disable-option-checking and extra config paths

- indexing 'option-checking' out of `known_args` had a type error
- when option checking is disabled, don't error on duplicate args, just take the last
- add config.toml stubs for datadir, infodir, and localstatedir (which were already accepted, but broken)

---

This fixes a regression from 1.21 to beta, when the configure script was rewritten in python.
2017-10-28 07:08:52 +00:00
bors
c1a0b6d9eb Auto merge of #45503 - thombles:tk/i44339-v5, r=petrochenkov
Improve diagnostics when list of tokens has incorrect separators

Make `parse_seq_to_before_tokens` more resilient to error conditions. Where possible it is better if it can consume up to the final bracket before returning. This change improves the diagnostics in a couple of situations:

```
struct S(pub () ()); // omitted separator
use std::{foo. bar}; // used a similar but wrong separator
```

Fixes #44339
r? @petrochenkov
2017-10-28 03:02:17 +00:00
Corey Farwell
b1681271e5 Remove 'future Rust version' code block in diagnostic text.
Fixes https://github.com/rust-lang/rust/issues/43780.
2017-10-27 22:49:56 -04:00
Paul Liétar
1e9e3191ab Move type_has_metadata to trans_utils 2017-10-27 23:36:18 +02:00
Paul Liétar
5341d64f66 fix rebase 2017-10-27 23:01:34 +02:00