Commit Graph

91751 Commits

Author SHA1 Message Date
Fabian Drinck
c244c411e4 Handle glob import in redundancy check 2019-03-30 22:37:02 +01:00
Fabian Drinck
df80eae985 Change message to present tense 2019-03-30 22:37:02 +01:00
Fabian Drinck
8fb0549151 Fix doc tests 2019-03-30 22:37:02 +01:00
Fabian Drinck
a97aeb41d4 Fix more tests 2019-03-30 22:37:02 +01:00
Fabian Drinck
4a619aa126 Add glob import to redundancy test 2019-03-30 22:37:02 +01:00
Fabian Drinck
0f3b1c0358 Fix tests 2019-03-30 22:37:02 +01:00
Fabian Drinck
6e7b45e12b Replace REDUNDANT_IMPORT with UNUSED_IMPORTS 2019-03-30 22:37:02 +01:00
Fabian Drinck
f9272364bf Edit ui tests 2019-03-30 22:37:02 +01:00
Fabian Drinck
fef3f5c88d Remove redundant import 2019-03-30 22:37:02 +01:00
Fabian Drinck
8919894c51 Distinguish between imported and defined items 2019-03-30 22:37:02 +01:00
Fabian Drinck
d04e83fe2c Bless tests 2019-03-30 22:37:02 +01:00
Fabian Drinck
2245d10fac Improve warning 2019-03-30 22:37:02 +01:00
Fabian Drinck
2cebbe2599 Edit comments 2019-03-30 22:37:02 +01:00
Fabian Drinck
541c4999a9 Remove redundant imports 2019-03-30 22:37:02 +01:00
Fabian Drinck
29d68edc6e Add lint for redundant imports
Co-authored-by: Stephan Schauerte <stephan.schauerte@gmail.com>
2019-03-30 22:37:02 +01:00
Bastian Gruber
aea5bf55f0 Add book.toml with title to unstable-book doc 2019-03-30 19:46:43 +01:00
Josh Stone
49b65e683d Don't ignore git for LLVM info 2019-03-30 11:14:02 -07:00
Josh Stone
105692c3ad Use a single llvm_info variable 2019-03-30 11:11:32 -07:00
bors
befeeb7c08 Auto merge of #59516 - ehuss:update-cargo, r=alexcrichton
Update cargo

Update cargo

22 commits in 0e35bd8af0ec72d3225c4819b330b94628f0e9d0..63231f438a2b5b84ccf319a5de22343ee0316323
2019-03-13 06:52:51 +0000 to 2019-03-27 12:26:45 +0000
- Code cleanup (rust-lang/cargo#6787)
- Add cargo:rustc-link-arg to pass custom linker arguments (rust-lang/cargo#6298)
- Testsuite: remove some unnecessary is_nightly checks. (rust-lang/cargo#6786)
- cargo metadata: Don't show `null` deps. (rust-lang/cargo#6534)
- Some fingerprint cleanup. (rust-lang/cargo#6785)
- Fix fingerprint for canceled build script. (rust-lang/cargo#6782)
- Canonicalize default target if it ends with `.json` (rust-lang/cargo#6778)
- Fix setting `panic=unwind` compiling lib a extra time. (rust-lang/cargo#6781)
- Always nicely show errors from crates.io if possible (rust-lang/cargo#6771)
- Testsuite: Make `cwd()` relative to project root. (rust-lang/cargo#6768)
- Allow `cargo fix` if gitignore matches root working dir. (rust-lang/cargo#6767)
- Remove redundant imports (rust-lang/cargo#6763)
- Handle backcompat hazard with `toml` crate (rust-lang/cargo#6761)
- Fix spurious error in dirty_both_lib_and_test. (rust-lang/cargo#6756)
- Update toml requirement from 0.4.2 to 0.5.0 (rust-lang/cargo#6760)
- Reuse std::env::consts::EXE_SUFFIX (rust-lang/cargo#6758)
- Proptest 0.9.1 (rust-lang/cargo#6753)
- Don't need extern crate in 2018 (rust-lang/cargo#6752)
- Release a jobserver token while locking a file (rust-lang/cargo#6748)
- Minor doc fix for publish command synopsis (rust-lang/cargo#6749)
- Stricter package change detection. (rust-lang/cargo#6740)
- Fix resolving yanked crates when using a local registry. (rust-lang/cargo#6742)
2019-03-30 17:22:21 +00:00
Josh Stone
975ba58f42 Use the existing LLVM GitInfo for checking rebuilds 2019-03-30 09:45:26 -07:00
Eric Huss
d2228ca2a5 Update cargo 2019-03-30 09:35:01 -07:00
bors
fc8581d742 Auto merge of #59561 - Centril:rollup, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #59343 (rustc(codegen): uncache `def_symbol_name` prefix from `symbol_name`.)
 - #59380 (Fix invalid DWARF for enums when using ThinLTO)
 - #59463 (skip dyn keyword lint under macros)
 - #59539 (Fix infinite recursion)
 - #59544 (manifest: only include miri on the nightly channel)

Failed merges:

r? @ghost
2019-03-30 14:12:12 +00:00
Christian
66e920ea5c Added a missing !. 2019-03-30 14:35:51 +01:00
Christian
33bc6ad8c0 Added an example that shows how the remainder function on floating point values is computed internally. 2019-03-30 14:26:54 +01:00
Mazdak Farrokhzad
04ffaca71a
Rollup merge of #59544 - cuviper:miri-nightly, r=Centril
manifest: only include miri on the nightly channel

miri needs to build std with xargo, which doesn't allow stable/beta:
<https://github.com/japaric/xargo/pull/204#issuecomment-374888868>

Therefore, at this time there's no point in making miri available on any
but the nightly channel.  If we get a stable way to build `std`, like
[RFC 2663], then we can re-evaluate whether to start including miri,
perhaps still as `miri-preview`.

[RFC 2663]: https://github.com/rust-lang/rfcs/pull/2663
2019-03-30 14:14:58 +01:00
Mazdak Farrokhzad
68d03c0917
Rollup merge of #59539 - GuillaumeGomez:rustdoc-infinite-recursion, r=eddyb
Fix infinite recursion

Temporary fix for #59502.

r? @eddyb
2019-03-30 14:14:56 +01:00
Mazdak Farrokhzad
c9dca36a36
Rollup merge of #59463 - pnkfelix:issue-56327-skip-dyn-keyword-lint-under-macros, r=matthewjasper
skip dyn keyword lint under macros

This PR is following my own intuition that `rustfix` should never inject bugs into working code (even if that comes at the expense of it failing to fix things that will become bugs).

Fix #56327
2019-03-30 14:14:55 +01:00
Mazdak Farrokhzad
ae2551825d
Rollup merge of #59380 - philipc:thinlto-variant, r=michaelwoerister
Fix invalid DWARF for enums when using ThinLTO

We were setting the same identifier for both the DW_TAG_structure_type
and the DW_TAG_variant_part. This becomes a problem when using ThinLTO
becauses it uses the identifier as a key for a map of types that is used
to delete duplicates based on the ODR, so one of them is deleted as a
duplicate, resulting in invalid DWARF.

The DW_TAG_variant_part isn't a standalone type, so it doesn't need
an identifier. Fix by omitting its identifier.

ODR uniquing is [enabled here](f21dee2c61/src/rustllvm/PassWrapper.cpp (L1101)).
2019-03-30 14:14:53 +01:00
Mazdak Farrokhzad
be6b4c06be
Rollup merge of #59343 - eddyb:rm-def-symbol-name, r=michaelwoerister
rustc(codegen): uncache `def_symbol_name` prefix from `symbol_name`.

The `def_symbol_name` query was an optimization to avoid recomputing the common part of a symbol name, as only the hash needs to be added to it for each symbol.

However, #57967 will add a new mangling scheme, which doesn't readily support this kind of reuse - while it's plausible, it requires a lot more effort, since you'd have to "symbolically evaluate" mangling, and keep it in a form where the backreference positions can be computed correctly in the final step.

So I want to see how much time we're actually saving with this `def_symbol_name` optimization, nowadays.

cc @michaelwoerister
2019-03-30 14:14:52 +01:00
Yuki OKUSHI
77774e4e96 Use CString 2019-03-30 21:37:02 +09:00
Guillaume Gomez
29885ff291 Fix infinite recursion 2019-03-30 11:24:41 +01:00
Yuki OKUSHI
3281248b88 Use target_mcount 2019-03-30 18:50:34 +09:00
Yuki OKUSHI
8381cbab1a Add target_mcount option 2019-03-30 18:50:19 +09:00
Christian
ea369cbc2f Added an example that shows how the remainder function on floating point values is computed internally. 2019-03-30 10:03:47 +01:00
bors
6c49da4544 Auto merge of #59550 - Centril:rollup, r=Centril
Rollup of 10 pull requests

Successful merges:

 - #59376 (RFC 2008: Enum Variants)
 - #59453 (Recover from parse error in tuple syntax)
 - #59455 (Account for short-hand field syntax when suggesting borrow)
 - #59499 (Fix broken download link in the armhf-gnu image)
 - #59512 (implement `AsRawFd` for stdio locks)
 - #59525 (Whitelist some rustc attrs)
 - #59528 (Improve the dbg! macro docs )
 - #59532 (In doc examples, don't ignore read/write results)
 - #59534 (rustdoc: collapse blanket impls in the same way as normal impls)
 - #59537 (Fix OnceWith docstring.)

Failed merges:

r? @ghost
2019-03-30 08:32:13 +00:00
Mazdak Farrokhzad
62a78c4fcf
Rollup merge of #59537 - goffrie:patch-3, r=Centril
Fix OnceWith docstring.

This was incorrectly copypasta'd from RepeatWith.
2019-03-30 07:51:47 +01:00
Mazdak Farrokhzad
ca14c56563
Rollup merge of #59534 - laurmaedje:collapse-blanket-impls, r=GuillaumeGomez
rustdoc: collapse blanket impls in the same way as normal impls

If the rustdoc setting _Auto-hide trait implementations documentation_ is activated (on by default), normal trait implementations are collapsed by default.

Blanket impls on the other hand are not collapsed. I'm not sure whether this is intended, but considering that the blanket impls for `From`, `Into`, `TryFrom`, ... are on every type, it would reduce the documentation bloat if these would also be collapsed when the setting is active.

(I'm not really familiar with the codebase and therefore just copied the code for the normal impl collapsing, but I could deduplicate it into a method, of course, too.)
2019-03-30 07:51:45 +01:00
Mazdak Farrokhzad
931151f72d
Rollup merge of #59532 - mbrubeck:docs, r=Centril
In doc examples, don't ignore read/write results

Calling `Read::read` or `Write::write` without checking the returned `usize` value is almost always an error.  Example code in the documentation should demonstrate how to use the return value correctly.  Otherwise, people might copy the example code thinking that it is okay to "fire and forget" these methods.
2019-03-30 07:51:44 +01:00
Mazdak Farrokhzad
183afcd8c8
Rollup merge of #59528 - DevQps:improve-dbg-macro-docs, r=Centril
Improve the dbg! macro docs

# Description

As stated has been discussed in #58383 the docs do not clearly state why it is useful to have the option to use `dbg!` in release builds as well. This PR should change that.

closes #58383
2019-03-30 07:51:43 +01:00
Mazdak Farrokhzad
11e1b3e46a
Rollup merge of #59525 - pnkfelix:whitelist-some-rustc-attrs, r=petrochenkov
Whitelist some rustc attrs

These rustc attrs are used within libcore, and were causing failures when one mixed incremental compilation with bootstrapping (due to a default of `-D warnings` when bootstrapping).

Fix #59523
Fix #59524

Cc #58633
2019-03-30 07:51:41 +01:00
Mazdak Farrokhzad
1b1b8640de
Rollup merge of #59512 - euclio:stdio-locks, r=sfackler
implement `AsRawFd` for stdio locks

cc https://github.com/rust-lang/rfcs/issues/2074.
2019-03-30 07:51:40 +01:00
Mazdak Farrokhzad
3de2821804
Rollup merge of #59499 - pietroalbini:fix-arm-broken-link, r=alexcrichton
Fix broken download link in the armhf-gnu image

Thanks to @johnterickson for pointing this out!

r? @alexcrichton
2019-03-30 07:51:38 +01:00
Mazdak Farrokhzad
41e64b6c5c
Rollup merge of #59455 - estebank:borrow-sugg-shorthand-field, r=davidtwco
Account for short-hand field syntax when suggesting borrow

Fix #52965.
2019-03-30 07:51:37 +01:00
Mazdak Farrokhzad
c28704c2a8
Rollup merge of #59453 - estebank:recover-tuple-parse, r=petrochenkov
Recover from parse error in tuple syntax
2019-03-30 07:51:36 +01:00
Mazdak Farrokhzad
d050a157a8
Rollup merge of #59376 - davidtwco:finally-rfc-2008-variants, r=petrochenkov,QuietMisdreavus
RFC 2008: Enum Variants

Part of #44109. See [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rfc-2008/near/132663140) for previous discussion.

r? @petrochenkov
cc @nikomatsakis
2019-03-30 07:51:34 +01:00
bors
709b72e7a7 Auto merge of #59464 - alexcrichton:wasi-pr, r=fitzgen
Add a new wasm32-unknown-wasi target

This commit adds a new wasm32-based target distributed through rustup,
supported in the standard library, and implemented in the compiler. The
`wasm32-unknown-wasi` target is intended to be a WebAssembly target
which matches the [WASI proposal recently announced][LINK]. In summary
the WASI target is an effort to define a standard set of syscalls for
WebAssembly modules, allowing WebAssembly modules to not only be
portable across architectures but also be portable across environments
implementing this standard set of system calls.

The wasi target in libstd is still somewhat bare bones. This PR does not
fill out the filesystem, networking, threads, etc. Instead it only
provides the most basic of integration with the wasi syscalls, enabling
features like:

* `Instant::now` and `SystemTime::now` work
* `env::args` is hooked up
* `env::vars` will look up environment variables
* `println!` will print to standard out
* `process::{exit, abort}` should be hooked up appropriately

None of these APIs can work natively on the `wasm32-unknown-unknown`
target, but with the assumption of the WASI set of syscalls we're able
to provide implementations of these syscalls that engines can implement.
Currently the primary engine implementing wasi is [wasmtime], but more
will surely emerge!

In terms of future development of libstd, I think this is something
we'll probably want to discuss. The purpose of the WASI target is to
provide a standardized set of syscalls, but it's *also* to provide a
standard C sysroot for compiling C/C++ programs. This means it's
intended that functions like `read` and `write` are implemented for this
target with a relatively standard definition and implementation. It's
unclear, therefore, how we want to expose file descriptors and how we'll
want to implement system primitives. For example should `std::fs::File`
have a libc-based file descriptor underneath it? The raw wasi file
descriptor? We'll see! Currently these details are all intentionally
hidden and things we can change over time.

A `WasiFd` sample struct was added to the standard library as part of
this commit, but it's not currently used. It shows how all the wasi
syscalls could be ergonomically bound in Rust, and they offer a possible
implementation of primitives like `std::fs::File` if we bind wasi file
descriptors exactly.

Apart from the standard library, there's also the matter of how this
target is integrated with respect to its C standard library. The
reference sysroot, for example, provides managment of standard unix file
descriptors and also standard APIs like `open` (as opposed to the
relative `openat` inspiration for the wasi ssycalls). Currently the
standard library relies on the C sysroot symbols for operations such as
environment management, process exit, and `read`/`write` of stdio fds.
We want these operations in Rust to be interoperable with C if they're
used in the same process. Put another way, if Rust and C are linked into
the same WebAssembly binary they should work together, but that requires
that the same C standard library is used.

We also, however, want the `wasm32-unknown-wasi` target to be
usable-by-default with the Rust compiler without requiring a separate
toolchain to get downloaded and configured. With that in mind, there's
two modes of operation for the `wasm32-unknown-wasi` target:

1. By default the C standard library is statically provided inside of
   `liblibc.rlib` distributed as part of the sysroot. This means that
   you can `rustc foo.wasm --target wasm32-unknown-unknown` and you're
   good to go, a fully workable wasi binary pops out. This is
   incompatible with linking in C code, however, which may be compiled
   against a different sysroot than the Rust code was previously
   compiled against. In this mode the default of `rust-lld` is used to
   link binaries.

2. For linking with C code, the `-C target-feature=-crt-static` flag
   needs to be passed. This takes inspiration from the musl target for
   this flag, but the idea is that you're no longer using the provided
   static C runtime, but rather one will be provided externally. This
   flag is intended to also get coupled with an external `clang`
   compiler configured with its own sysroot. Therefore you'll typically
   use this flag with `-C linker=/path/to/clang-script-wrapper`. Using
   this mode the Rust code will continue to reference standard C
   symbols, but the definition will be pulled in by the linker configured.

Alright so that's all the current state of this PR. I suspect we'll
definitely want to discuss this before landing of course! This PR is
coupled with libc changes as well which I'll be posting shortly.

[LINK]: https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/
[wasmtime]: https://github.com/cranestation/wasmtime-wasi
2019-03-30 02:34:13 +00:00
Josh Stone
b222b6fa7f manifest: only include miri on the nightly channel
miri needs to build std with xargo, which doesn't allow stable/beta:
<https://github.com/japaric/xargo/pull/204#issuecomment-374888868>

Therefore, at this time there's no point in making miri available on any
but the nightly channel.  If we get a stable way to build `std`, like
[RFC 2663], then we can re-evaluate whether to start including miri,
perhaps still as `miri-preview`.

[RFC 2663]: https://github.com/rust-lang/rfcs/pull/2663
2019-03-29 17:59:07 -07:00
Alex Crichton
ace71240d2 Add a new wasm32-unknown-wasi target
This commit adds a new wasm32-based target distributed through rustup,
supported in the standard library, and implemented in the compiler. The
`wasm32-unknown-wasi` target is intended to be a WebAssembly target
which matches the [WASI proposal recently announced.][LINK]. In summary
the WASI target is an effort to define a standard set of syscalls for
WebAssembly modules, allowing WebAssembly modules to not only be
portable across architectures but also be portable across environments
implementing this standard set of system calls.

The wasi target in libstd is still somewhat bare bones. This PR does not
fill out the filesystem, networking, threads, etc. Instead it only
provides the most basic of integration with the wasi syscalls, enabling
features like:

* `Instant::now` and `SystemTime::now` work
* `env::args` is hooked up
* `env::vars` will look up environment variables
* `println!` will print to standard out
* `process::{exit, abort}` should be hooked up appropriately

None of these APIs can work natively on the `wasm32-unknown-unknown`
target, but with the assumption of the WASI set of syscalls we're able
to provide implementations of these syscalls that engines can implement.
Currently the primary engine implementing wasi is [wasmtime], but more
will surely emerge!

In terms of future development of libstd, I think this is something
we'll probably want to discuss. The purpose of the WASI target is to
provide a standardized set of syscalls, but it's *also* to provide a
standard C sysroot for compiling C/C++ programs. This means it's
intended that functions like `read` and `write` are implemented for this
target with a relatively standard definition and implementation. It's
unclear, therefore, how we want to expose file descriptors and how we'll
want to implement system primitives. For example should `std::fs::File`
have a libc-based file descriptor underneath it? The raw wasi file
descriptor? We'll see! Currently these details are all intentionally
hidden and things we can change over time.

A `WasiFd` sample struct was added to the standard library as part of
this commit, but it's not currently used. It shows how all the wasi
syscalls could be ergonomically bound in Rust, and they offer a possible
implementation of primitives like `std::fs::File` if we bind wasi file
descriptors exactly.

Apart from the standard library, there's also the matter of how this
target is integrated with respect to its C standard library. The
reference sysroot, for example, provides managment of standard unix file
descriptors and also standard APIs like `open` (as opposed to the
relative `openat` inspiration for the wasi ssycalls). Currently the
standard library relies on the C sysroot symbols for operations such as
environment management, process exit, and `read`/`write` of stdio fds.
We want these operations in Rust to be interoperable with C if they're
used in the same process. Put another way, if Rust and C are linked into
the same WebAssembly binary they should work together, but that requires
that the same C standard library is used.

We also, however, want the `wasm32-unknown-wasi` target to be
usable-by-default with the Rust compiler without requiring a separate
toolchain to get downloaded and configured. With that in mind, there's
two modes of operation for the `wasm32-unknown-wasi` target:

1. By default the C standard library is statically provided inside of
   `liblibc.rlib` distributed as part of the sysroot. This means that
   you can `rustc foo.wasm --target wasm32-unknown-unknown` and you're
   good to go, a fully workable wasi binary pops out. This is
   incompatible with linking in C code, however, which may be compiled
   against a different sysroot than the Rust code was previously
   compiled against. In this mode the default of `rust-lld` is used to
   link binaries.

2. For linking with C code, the `-C target-feature=-crt-static` flag
   needs to be passed. This takes inspiration from the musl target for
   this flag, but the idea is that you're no longer using the provided
   static C runtime, but rather one will be provided externally. This
   flag is intended to also get coupled with an external `clang`
   compiler configured with its own sysroot. Therefore you'll typically
   use this flag with `-C linker=/path/to/clang-script-wrapper`. Using
   this mode the Rust code will continue to reference standard C
   symbols, but the definition will be pulled in by the linker configured.

Alright so that's all the current state of this PR. I suspect we'll
definitely want to discuss this before landing of course! This PR is
coupled with libc changes as well which I'll be posting shortly.

[LINK]:
[wasmtime]:
2019-03-29 15:58:17 -07:00
Geoffry Song
7ce0b67272
Fix OnceWith docstring.
This was incorrectly copypasta'd from RepeatWith.
2019-03-29 15:03:14 -07:00
bors
26714219f1 Auto merge of #58846 - bjorn3:misc_cg_ssa_refactor, r=eddyb
Misc refactorings to rustc_codegen_ssa

Unlike #56636 this doesn't split `BuilderMethods` into a lot of traits. That makes this PR twice as small and the split turned out to not be very useful anyway.

r? @eddyb
2019-03-29 21:46:15 +00:00