Commit Graph

91619 Commits

Author SHA1 Message Date
ljedrz
16fd0f47aa hir: remove NodeId from Entry & simplify Map 2019-04-24 19:51:25 +02:00
bors
cee58fdc12 Auto merge of - cuviper:llvm-rebuild-sha, r=Mark-Simulacrum
Use the existing LLVM GitInfo for checking rebuilds

Fixes 
2019-03-31 01:22:07 +00:00
bors
b0fcfa7d61 Auto merge of - Centril:rollup, r=Centril
Rollup of 3 pull requests

Successful merges:

 -  (doc: use correct body font URLs)
 -  (Changed reference style in dbg macro docs.)
 -  (Add book.toml with title to unstable-book doc)

Failed merges:

r? @ghost
2019-03-30 22:15:05 +00:00
Mazdak Farrokhzad
7da27b261a
Rollup merge of - gruberb:add-title-for-unstable-book, r=frewsxcv
Add book.toml with title to unstable-book doc

Adding a title to the unstable book based on https://github.com/rust-lang/rust/issues/59554
2019-03-30 23:14:43 +01:00
Mazdak Farrokhzad
c6f0ad1719
Rollup merge of - DevQps:dbg-macro-docs, r=Centril
Changed reference style in dbg macro docs.

# Description

A continuation of Pull Request  :
- Fixed method of referencing and adjusted the references as suggested by @lzutao
2019-03-30 23:14:42 +01:00
Mazdak Farrokhzad
8a19973eed
Rollup merge of - benesch:docs-font, r=GuillaumeGomez
doc: use correct body font URLs

The CSS for the docs homepage (docs.rust-lang.org) was using the wrong
URL for the body font, resulting in the fallback serif font being used,
instead of the desired Source Serif Pro fonts.

(It's worth noting that the CSS for rustdoc's API generation got these URLs right.)
2019-03-30 23:14:40 +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 - 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 ()
- Add cargo:rustc-link-arg to pass custom linker arguments ()
- Testsuite: remove some unnecessary is_nightly checks. ()
- cargo metadata: Don't show `null` deps. ()
- Some fingerprint cleanup. ()
- Fix fingerprint for canceled build script. ()
- Canonicalize default target if it ends with `.json` ()
- Fix setting `panic=unwind` compiling lib a extra time. ()
- Always nicely show errors from crates.io if possible ()
- Testsuite: Make `cwd()` relative to project root. ()
- Allow `cargo fix` if gitignore matches root working dir. ()
- Remove redundant imports ()
- Handle backcompat hazard with `toml` crate ()
- Fix spurious error in dirty_both_lib_and_test. ()
- Update toml requirement from 0.4.2 to 0.5.0 ()
- Reuse std::env::consts::EXE_SUFFIX ()
- Proptest 0.9.1 ()
- Don't need extern crate in 2018 ()
- Release a jobserver token while locking a file ()
- Minor doc fix for publish command synopsis ()
- Stricter package change detection. ()
- Fix resolving yanked crates when using a local registry. ()
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 - Centril:rollup, r=Centril
Rollup of 5 pull requests

Successful merges:

 -  (rustc(codegen): uncache `def_symbol_name` prefix from `symbol_name`.)
 -  (Fix invalid DWARF for enums when using ThinLTO)
 -  (skip dyn keyword lint under macros)
 -  (Fix infinite recursion)
 -  (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 - 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 - GuillaumeGomez:rustdoc-infinite-recursion, r=eddyb
Fix infinite recursion

Temporary fix for .

r? @eddyb
2019-03-30 14:14:56 +01:00
Mazdak Farrokhzad
c9dca36a36
Rollup merge of - 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 
2019-03-30 14:14:55 +01:00
Mazdak Farrokhzad
ae2551825d
Rollup merge of - 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 - 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,  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
Guillaume Gomez
29885ff291 Fix infinite recursion 2019-03-30 11:24:41 +01:00
bors
6c49da4544 Auto merge of - Centril:rollup, r=Centril
Rollup of 10 pull requests

Successful merges:

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

Failed merges:

r? @ghost
2019-03-30 08:32:13 +00:00
Mazdak Farrokhzad
62a78c4fcf
Rollup merge of - 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 - 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 - 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 - DevQps:improve-dbg-macro-docs, r=Centril
Improve the dbg! macro docs

# Description

As stated has been discussed in  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 
2019-03-30 07:51:43 +01:00
Mazdak Farrokhzad
11e1b3e46a
Rollup merge of - 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 
Fix 

Cc 
2019-03-30 07:51:41 +01:00
Mazdak Farrokhzad
1b1b8640de
Rollup merge of - 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 - 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 - estebank:borrow-sugg-shorthand-field, r=davidtwco
Account for short-hand field syntax when suggesting borrow

Fix .
2019-03-30 07:51:37 +01:00
Mazdak Farrokhzad
c28704c2a8
Rollup merge of - 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 - davidtwco:finally-rfc-2008-variants, r=petrochenkov,QuietMisdreavus
RFC 2008: Enum Variants

Part of . 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 - 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 - bjorn3:misc_cg_ssa_refactor, r=eddyb
Misc refactorings to rustc_codegen_ssa

Unlike  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
Matt Brubeck
b6fb3e3411 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-29 11:50:41 -07:00
Laurenz
9e4ec7a568 Collapse blanket impls in the same way as normal impls 2019-03-29 19:47:19 +01:00
Esteban Küber
ddfa47f4b4 Fix incorrect code 2019-03-29 11:12:54 -07:00
bors
e782d790f1 Auto merge of - Centril:rollup, r=Centril
Rollup of 9 pull requests

Successful merges:

 -  (Update books)
 -  (Update jemalloc-sys to version 0.3.0)
 -  (Update rustfmt to 1.2.0)
 -  (Fix error in Rust 2018 + no_core environment)
 -  (Better diagnostic for binary operation on BoxedValues)
 -  (Do not emit incorrect borrow suggestion involving macros and fix overlapping multiline spans)
 -  (Update stdsimd)
 -  (Visit `ImplItem` in `dead_code` lint)
 -  (Rename `type_parameters` to `generics` and so on)

Failed merges:

 -  (Update cargo)

r? @ghost
2019-03-29 18:09:51 +00:00
bjorn3
35705dee7e Use ExactSizeIterator + TrustedLen instead of num_cases arg for switch 2019-03-29 17:23:52 +01:00
bjorn3
56842b2154 Add a method for emiting a switch. 2019-03-29 17:17:14 +01:00
bjorn3
b2e61946fa Remove inline_asm_call from cg_ssa
`count_insn` is no longer called for inline asm, because it is private to builder.rs
2019-03-29 17:17:13 +01:00
bjorn3
b71c429007 Remove type_variadic_func and typ_array from cg_ssa 2019-03-29 17:17:13 +01:00
bjorn3
0e166bb217 Remove a lot of methods from *TypeMethods 2019-03-29 17:17:13 +01:00
bjorn3
b0ee1f7f99 Remove scalar_lltypes from cg_ssa 2019-03-29 17:17:13 +01:00
bjorn3
7de0b1de19 Move get_param and set_value_name 2019-03-29 17:17:13 +01:00
bjorn3
bcab49720e Remove a lot of methods from BuilderMethods 2019-03-29 17:17:12 +01:00
bjorn3
794ecd965a [WIP] Make some debug info methods take &mut FunctionDebugContext
declare_local still takes &FunctionDebugContext, because of borrowck errors
2019-03-29 17:17:12 +01:00