Commit graph

70187 commits

Author SHA1 Message Date
kennytm
2cac14e2f9 Rollup merge of #46201 - davidalber:eprint-in-fmt-doc, r=frewsxcv
Adding `eprint*!` to the list of macros in the `format!` family

The `eprint!` and `eprintln!` macros were added in 7612727. The `std::fmt` documentation does not mention these macros next to `print!` and `println!` in the [Related macros](https://doc.rust-lang.org/std/fmt/#related-macros) section, and I did not find evidence that this omission was deliberate. This PR adds such documentation.

The first modification is to add `eprint!` and `eprintln!` to the list of related macros in the `format!` family. This is how it appears with this change:

![image](https://user-images.githubusercontent.com/933552/33159527-67056caa-cfc8-11e7-8b7d-4224ef2fce4e.png)

The second modification adds a sub-section for `eprint!` and `eprintln!`. Here is how the new section appears:

![image](https://user-images.githubusercontent.com/933552/33159541-97d03bee-cfc8-11e7-8b95-4d3632b5ab7b.png)
2017-11-26 15:01:34 +08:00
bors
2f84fb5cc1 Auto merge of #46033 - sinkuu:const-enum-match-check, r=arielb1
Do match-check for consts

Fixes #43195 (ICE caused by building MIR that contains non-exausitive match)
2017-11-26 04:26:19 +00:00
bors
693bb0dae2 Auto merge of #45947 - estebank:match_default_bindings-arg-hint, r=arielb1
Be more obvious when suggesting dereference

Include `&` span when suggesting dereference on a span that is already a reference:

```
error: non-reference pattern used to match a reference (see issue #42640)
  --> dont-suggest-dereference-on-arg.rs:16:19
   |
16 |         .filter(|&(ref a, _)| foo(a))
   |                  ^^^^^^^^^^^ help: consider using: `&&(ref k, _)`
   |
   = help: add #![feature(match_default_bindings)] to the crate attributes to enable
```

Fix #45925.
2017-11-26 01:05:56 +00:00
bors
128b40fadc Auto merge of #45367 - alexcrichton:simd-llvm-changes, r=eddyb
rustc: Add support for some more x86 SIMD ops

This commit adds compiler support for two basic operations needed for binding
SIMD on x86 platforms:

* First, a `nontemporal_store` intrinsic was added for the `_mm_stream_ps`, seen
  in rust-lang-nursery/stdsimd#114. This was relatively straightforward and is
  quite similar to the volatile store intrinsic.

* Next, and much more intrusively, a new type to the backend was added. The
  `x86_mmx` type is used in LLVM for a 64-bit vector register and is used in
  various intrinsics like `_mm_abs_pi8` as seen in rust-lang-nursery/stdsimd#74.
  This new type was added as a new layout option as well as having support added
  to the trans backend. The type is enabled with the `#[repr(x86_mmx)]`
  attribute which is intended to just be an implementation detail of SIMD in
  Rust.

I'm not 100% certain about how the `x86_mmx` type was added, so any extra eyes
or thoughts on that would be greatly appreciated!
2017-11-25 22:38:47 +00:00
Alex Crichton
fe53a8106d rustc: Add support for some more x86 SIMD ops
This commit adds compiler support for two basic operations needed for binding
SIMD on x86 platforms:

* First, a `nontemporal_store` intrinsic was added for the `_mm_stream_ps`, seen
  in rust-lang-nursery/stdsimd#114. This was relatively straightforward and is
  quite similar to the volatile store intrinsic.

* Next, and much more intrusively, a new type to the backend was added. The
  `x86_mmx` type is used in LLVM for a 64-bit vector register and is used in
  various intrinsics like `_mm_abs_pi8` as seen in rust-lang-nursery/stdsimd#74.
  This new type was added as a new layout option as well as having support added
  to the trans backend. The type is enabled with the `#[repr(x86_mmx)]`
  attribute which is intended to just be an implementation detail of SIMD in
  Rust.

I'm not 100% certain about how the `x86_mmx` type was added, so any extra eyes
or thoughts on that would be greatly appreciated!
2017-11-25 11:03:13 -08:00
bors
e97ba83287 Auto merge of #46115 - alexcrichton:add-wasm-target, r=kennytm
rustbuild: Enable WebAssembly backend by default

This commit alters how we compile LLVM by default enabling the WebAssembly
backend. This then also adds the wasm32-unknown-unknown target to get compiled
on the `cross` builder and distributed through rustup. Tests are not yet enabled
for this target but that should hopefully be coming soon!
2017-11-25 19:00:45 +00:00
Esteban Küber
15dfd7eb61 Fix test 2017-11-25 10:15:36 -08:00
Alex Crichton
48996f9e75 rustbuild: Enable WebAssembly backend by default
This commit alters how we compile LLVM by default enabling the WebAssembly
backend. This then also adds the wasm32-unknown-unknown target to get compiled
on the `cross` builder and distributed through rustup. Tests are not yet enabled
for this target but that should hopefully be coming soon!
2017-11-25 06:44:35 -08:00
bors
2f47a9eb80 Auto merge of #46191 - eddyb:better-late-than-never, r=nikomatsakis
rustc: don't mark lifetimes as early-bound in the presence of impl Trait.

This hack from the original implementation shouldn't be needed anymore, thanks to @cramertj.

r? @nikomatsakis
2017-11-25 14:28:20 +00:00
Shotaro Yamada
62cb74af3c Conform names 2017-11-25 23:27:16 +09:00
bors
cc6b88ccb2 Auto merge of #46129 - kennytm:fix-46098-rustdoc-reexport-extern-type, r=GuillaumeGomez
Properly handle reexport of foreign items.

Handles `pub use` of `extern { fn, static, type }`. Also plug in some more `match` arms where handling `extern type` is reasonable.

Fixed #46098.
2017-11-25 08:38:42 +00:00
bors
59bf09d4d4 Auto merge of #46117 - SimonSapin:min-align, r=alexcrichton
allocators: don’t assume MIN_ALIGN for small sizes

See individual commit messages.
2017-11-25 06:16:19 +00:00
bors
ca8ef26293 Auto merge of #46081 - GuillaumeGomez:fix-path-search, r=QuietMisdreavus
Fix path search

Fixes #46015.

r? @QuietMisdreavus
2017-11-25 02:43:48 +00:00
bors
db162922f7 Auto merge of #46008 - alexcrichton:update-llvm, r=Mark-Simulacrum
rustbuild: Update LLVM and enable ThinLTO

This commit updates LLVM to fix #45511 (https://reviews.llvm.org/D39981) and
also reenables ThinLTO for libtest now that we shouldn't hit #45768. This also
opportunistically enables ThinLTO for libstd which was previously blocked
(#45661) on test failures related to debuginfo with a presumed cause of #45511.

Closes #45511
2017-11-25 00:17:03 +00:00
Alex Crichton
95e9609b9d std: Flag Windows TLS dtor symbol as #[used]
Turns out ThinLTO was internalizing this symbol and eliminating it. Worse yet if
you compiled with LTO turns out no TLS destructors would run on Windows! The
`#[used]` annotation should be a more bulletproof implementation (in the face of
LTO) of preserving this symbol all the way through in LLVM and ensuring it makes
it all the way to the linker which will take care of it.
2017-11-24 14:28:12 -08:00
bors
a550f2d3b3 Auto merge of #46111 - michaelwoerister:promote-green, r=nikomatsakis
incr.comp.: Make sure we don't lose unused green results from the query cache.

In its current implementation, the query result cache works by bulk-writing the results of all cacheable queries into a monolithic binary file on disk. Prior to this PR, we would potentially lose query results during this process because only results that had already been loaded into memory were serialized. In contrast, results that were not needed during the given compilation session were not serialized again.

This PR will do one pass over all green `DepNodes` that represent a cacheable query and execute the corresponding query in order to make sure that the query result gets loaded into memory before cache serialization.

In the future we might want to look into a serialization format the can be updated in-place so that we don't have to load unchanged results just for immediately storing them again.

r? @nikomatsakis
2017-11-24 21:50:09 +00:00
Esteban Küber
2461b7a264 Use get_parent_node instead of using spans 2017-11-24 08:26:45 -08:00
Esteban Küber
7c2526a9d7 Be more obvious when suggesting dereference
Include enclosing span when suggesting dereference on a span that is
already a reference:

```
error: non-reference pattern used to match a reference (see issue #42640)
  --> dont-suggest-dereference-on-arg.rs:16:19
   |
16 |         .filter(|&(ref a, _)| foo(a))
   |                  ^^^^^^^^^^^ help: consider using: `&&(ref k, _)`
   |
   = help: add #![feature(match_default_bindings)] to the crate attributes to enable
```
2017-11-24 08:26:01 -08:00
bors
5f44c653cf Auto merge of #46093 - scottmcm:lower-128-mir, r=nagisa
Add a MIR pass to lower 128-bit operators to lang item calls

Runs only with `-Z lower_128bit_ops` since it's not hooked into targets yet.

This isn't really useful on its own, but the declarations for the lang items need to be in the compiler before compiler-builtins can be updated to define them, so this is part 1 of at least 3.

cc https://github.com/rust-lang/rust/issues/45676 @est31 @nagisa
2017-11-24 15:11:11 +00:00
Alex Crichton
47498dea09 rustbuild: Update LLVM and enable ThinLTO
This commit updates LLVM to fix #45511 (https://reviews.llvm.org/D39981) and
also reenables ThinLTO for libtest now that we shouldn't hit #45768. This also
opportunistically enables ThinLTO for libstd which was previously blocked
(#45661) on test failures related to debuginfo with a presumed cause of #45511.

Closes #45511
2017-11-24 06:55:38 -08:00
bors
71da1c21eb Auto merge of #46116 - oli-obk:json_ui, r=nikomatsakis
Check //~ERROR comments in ui tests

r? @nikomatsakis

cc #44844 @Phlosioneer @estebank @petrochenkov

this depends on https://github.com/rust-lang/rust/pull/46052 getting merged first (the commits are included in here)

The relevant changes of this PR are c2f0af7 and 979269b
2017-11-24 12:38:11 +00:00
Oliver Schneider
8937d6a6cf
Merge cfail and ui tests into ui tests 2017-11-24 11:32:35 +01:00
bors
85d50ce1c7 Auto merge of #46012 - Gankro:float-conv-transmute, r=sfackler
Make float::from_bits transmute

See commit message for details.

See also this discussion here: https://github.com/rust-lang/rust/issues/40470#issuecomment-343803381

(may require libs team discussion before merging)
2017-11-24 10:06:09 +00:00
Oliver Schneider
36066d8925
UI tests extract the regular output from the 'rendered' field in json 2017-11-24 08:06:43 +01:00
Oliver Schneider
f7361a8870
This method of once-diagnostics doesn't allow nesting 2017-11-24 08:06:43 +01:00
Oliver Schneider
7e07fd3e8d
Simplify an Iterator::fold to Iterator::any 2017-11-24 08:06:43 +01:00
Shotaro Yamada
852f915e5f Use visit_body 2017-11-24 15:36:41 +09:00
Shotaro Yamada
0af387cd05 Querify 2017-11-24 15:36:41 +09:00
bors
eb44c89641 Auto merge of #45946 - estebank:crate-conflict-diag, r=arielb1
Use multiline text for crate conflict diagnostics

After:
```
error[E0464]: multiple matching crates for `libc`
 --> /checkout/src/rustc/dlmalloc_shim/../../dlmalloc/src/linux.rs:1:1
  |
1 | extern crate libc;
  | ^^^^^^^^^^^^^^^^^^
  |
  = note: candidates:
          crate `libc`: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-658d35794c10b003.rlib
          crate `libc`: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-f32a17a3111b01aa.rlib
```
Before:
```
error[E0464]: multiple matching crates for `libc`
 --> /checkout/src/rustc/dlmalloc_shim/../../dlmalloc/src/linux.rs:1:1
  |
1 | extern crate libc;
  | ^^^^^^^^^^^^^^^^^^
  |
  = note: candidates:
  = note: path: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-658d35794c10b003.rlib
  = note: crate name: libc
  = note: path: /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-f32a17a3111b01aa.rlib
  = note: crate name: libc
```
2017-11-24 04:03:36 +00:00
Shotaro Yamada
efa7b12a78 Add test 2017-11-24 13:00:56 +09:00
Shotaro Yamada
1473101123 Do match-check before const MIR generation 2017-11-24 13:00:56 +09:00
Shotaro Yamada
d602c2efff Visit const expressions in check match 2017-11-24 13:00:55 +09:00
bors
93426613a7 Auto merge of #45942 - Menschenkindlein:master, r=estebank
Add hints for the case of confusing enum with its variants

A solution for https://github.com/rust-lang/rust/issues/43871. When one uses an enum in a place that accepts variants (e.g., `Option(result)` instead of `Some(result)`), suggest one of this enum's variants.

cc @estebank
2017-11-24 01:44:19 +00:00
Alexis Beingessner
439576fd7b Make float::from_bits transmute (and update the documentation to reflect this).
The current implementation/documentation was made to avoid sNaN because of
potential safety issues implied by old/bad LLVM documentation. These issues
aren't real, so we can just make the implementation transmute (as permitted
by the existing documentation of this method).

Also the documentation didn't actually match the behaviour: it said we may
change sNaNs, but in fact we canonicalized *all* NaNs.

Also an example in the documentation was wrong: it said we *always* change
sNaNs, when the documentation was explicitly written to indicate it was
implementation-defined.

This makes to_bits and from_bits perfectly roundtrip cross-platform, except
for one caveat: although the 2008 edition of IEEE-754 specifies how to
interpet the signaling bit, earlier editions didn't. This lead to some platforms
picking the opposite interpretation, so all signaling NaNs on x86/ARM are quiet
on MIPS, and vice-versa.

NaN-boxing is a fairly important optimization, while we don't even guarantee
that float operations properly preserve signalingness. As such, this seems like
the more natural strategy to take (as opposed to trying to mangle the signaling
bit on a per-platform basis).

This implementation is also, of course, faster.
2017-11-23 16:55:52 -05:00
bors
bbd7932a66 Auto merge of #46225 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 5 pull requests

- Successful merges: #45635, #46177, #46190, #46218, #46220
- Failed merges:
2017-11-23 21:48:30 +00:00
Guillaume Gomez
e6968dfa0d Rollup merge of #46220 - rust-lang:frewsxcv-issue-44929, r=kennytm
Clarify stdin behavior of `Command::output`.

Fixes #44929.
2017-11-23 21:51:13 +01:00
Guillaume Gomez
f7373b1e1e Rollup merge of #46218 - rust-lang:frewsxcv-rename-slice-swap-param, r=kennytm
Rename param in `[T]::swap_with_slice` from `src` to `other`.

The idea of ‘source’ and ‘destination’ aren’t very applicable for this
operation since both slices can both be considered sources and
destinations.
2017-11-23 21:51:12 +01:00
Guillaume Gomez
808079aa2e Rollup merge of #46190 - steveklabnik:fix-releases, r=aturon
Amend RELEASES for 1.22.1

and fix the date for 1.22.0
2017-11-23 21:51:11 +01:00
Guillaume Gomez
a3e809d713 Rollup merge of #46177 - ollie27:std_unicode_debug, r=estebank
Add missing Debug impls to std_unicode

Also adds `#![deny(missing_debug_implementations)]` so they don't get missed again.

cc #31869
2017-11-23 21:51:10 +01:00
Guillaume Gomez
48db4e64f1 Rollup merge of #45635 - virgil-palanciuc:master, r=kennytm
Add test for #44953

Added the requested test - trying to see if it passes; my local build fails, but not sure why - the nightly shows this output, but in my build the compilation error changed.

Fixes #44953.
2017-11-23 21:51:09 +01:00
bors
246a6d19c9 Auto merge of #45881 - Centril:box-leak, r=alexcrichton
Add Box::leak<'a>(Box<T>) -> &'a mut T where T: 'a

Adds:

```rust
impl<T: ?Sized> Box<T> {
    pub fn leak<'a>(b: Box<T>) -> &'a mut T where T: 'a {
        unsafe { &mut *Box::into_raw(b) }
    }
}
```

which is useful for when you just want to put some stuff on the heap and then have a reference to it for the remainder of the program.

r? @sfackler
cc @durka
2017-11-23 19:18:15 +00:00
Maxim Zholobak
a3686c685a Use for_each_child_stable in find_module 2017-11-23 21:09:49 +02:00
bors
0916bbc000 Auto merge of #46087 - vramana:fix-46003, r=arielb1
Fix borrowck compiler errors for upvars contain "spurious" dereferences

Fixes #46003
2017-11-23 14:48:14 +00:00
Ramana Venkata
d059b57c78 Fix borrowck compiler errors for upvars contain "spurious" dereferences
Fixes #46003
2017-11-23 19:27:13 +05:30
Maxim Zholobak
39f848efb0 Add module population and case of enum in place of expression 2017-11-23 15:10:23 +02:00
bors
b9b82fde7c Auto merge of #46054 - nikomatsakis:nll-master-to-rust-master-1, r=arielb1
typeck aggregate rvalues in MIR type checker

This branch is an attempt to land content by @spastorino and @Nashenas88 that was initially landed on nll-master while we waited for https://github.com/rust-lang/rust/pull/45825 to land.

The biggest change it contains is that it extends the MIR type-checker to also type-check MIR aggregate rvalues (at least partially). Specifically, it checks that the operands provided for each field have the right type.

It does not yet check that their well-formedness predicates are met. That is https://github.com/rust-lang/rust/issues/45827. It also does not check other kinds of rvalues (that is https://github.com/rust-lang/rust/issues/45959). @spastorino is working on those issues now.

r? @arielb1
2017-11-23 10:46:02 +00:00
bors
247d98ec37 Auto merge of #46051 - cramertj:in-band-lifetimes, r=nikomatsakis
Implement in-band lifetime bindings

TODO (perhaps in a future PR): Should we ban explicit instantiation of generics with in-band lifetimes, or is it uncontroversial to just append them to the end of the lifetimes list?

Fixes #46042, cc #44524.

r? @nikomatsakis
2017-11-23 08:20:33 +00:00
bors
a6031a2ccf Auto merge of #46024 - estebank:no-variant, r=petrochenkov
Use the proper term when using non-existing variant

When using a non-existing variant, function or associated item, refer to
the proper term, instead of defaulting to "associated item" in
diagnostics.

Fix #28972.

```
error[E0599]: no variant named `Quux` found for type `Foo` in the current scope
 --> file.rs:7:9
  |
7 |         Foo::Quux(..) =>(),
  |         ^^^^^^^^^^^^^
```
2017-11-23 05:53:08 +00:00
David Alber
2f51f671c4 Adding eprint*! to the list of macros in the format! family 2017-11-22 20:44:05 -08:00
bors
10ef344d8c Auto merge of #46011 - euclio:reachability-redux, r=nrc
Allow filtering analysis by reachability

Fixes #43521.
Fixes https://github.com/nrc/rls-analysis/issues/79.

This PR allows a user to filter items present in the save-analysis data by setting the `reachable_only` config option. This option is intended for use by the new rustdoc. The PR isn't quite finished, because it's dependent on a new release of rls-data, but I want to make sure that the approach is valid.

https://github.com/nrc/rls-analysis/issues/79 mentions that `pub use` might need to be handled, but my thinking is that the consumer of the analysis data would be able to infer which imports are `pub use`, and which items are only reachable through `pub use`, so that doesn't need to be handled here.

r? @nrc
2017-11-23 03:22:55 +00:00