Commit graph

70144 commits

Author SHA1 Message Date
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
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
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
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
Esteban Küber
5eb5e91d7b Use multiline text for crate conflict diagnostics 2017-11-22 18:45:32 -08:00
Esteban Küber
b450aff186 Add test to new branches 2017-11-22 18:36:17 -08:00
Corey Farwell
2178e3a1b9 Clarify stdin behavior of Command::output.
Fixes #44929.
2017-11-22 20:47:31 -05:00
Corey Farwell
e1b479cff9 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-22 19:56:48 -05:00
bors
6af4515de6 Auto merge of #45721 - nikomatsakis:hir-tree, r=arielb1
add -Zunpretty=hir-tree

This uses the debug impls to dump the raw HIR. Particularly useful when
learning how the compiler works.

cc @qmx
2017-11-23 00:52:15 +00:00
Andy Russell
794ada06e7
add reachable_only to save-analysis config 2017-11-22 16:09:43 -05:00
steveklabnik
cdc6b84157 Amend RELEASES for 1.22.1
and fix the date for 1.22.0
2017-11-22 14:04:41 -05:00
Niko Matsakis
79bf7db319 add some tests for the interaction with existential impl trait 2017-11-22 13:45:42 -05:00
Niko Matsakis
d3e0c33dbe modify inherent impls test to indicate TypeckTables do not change
I also added some comments explaining what is going on. In short, the
changes in question do not, in fact, affect the`TypeckTables` in any
semantic way. However, altering the order of lowering can cause it
appear to affect the `TypeckTables`: if we lower generics before the
body, then the `HirId` for things in the body will be affected. In
this case, we are now lowering the generics etc
*after* the body, so the hash no longer changes. This seems good.
2017-11-22 12:44:10 -05:00
Niko Matsakis
78ccbba3e2 add debug log with result of writeback 2017-11-22 12:44:10 -05:00
Taylor Cramer
91b7920c09 Implement in-band lifetime bindings 2017-11-22 12:44:09 -05:00
bors
45594d5dec Auto merge of #46035 - oli-obk:use_suggestions, r=petrochenkov
Add structured suggestions for various "use" suggestions

r? @petrochenkov
2017-11-22 16:14:13 +00:00
bors
1dc0b573e7 Auto merge of #45198 - oli-obk:fmt_args, r=sfackler
Prevent fmt::Arguments from being shared across threads

Fixes #45197

This is a **breaking change**! Without doing this it's very easy to create race conditions.

There's probably a way to do this without breaking valid use cases, but it would require quite an overhaul of the formatting machinery.
2017-11-22 12:34:56 +00:00
bors
3755fe9555 Auto merge of #44781 - QuietMisdreavus:doc-include, r=GuillaumeGomez
rustdoc: include external files in documentation (RFC 1990)

Part of https://github.com/rust-lang/rfcs/pull/1990 (needs work on the error reporting, which i'm deferring to after this initial PR)

cc #44732

Also fixes #42760, because the prep work for the error reporting made it easy to fix that at the same time.
2017-11-22 09:58:07 +00:00
Niko Matsakis
c52e51dfb7 normalize types in ADT constructor
Fixes #45940
2017-11-22 03:51:56 -05:00
Niko Matsakis
10b8faccd0 handle the active field index in unions 2017-11-22 03:51:55 -05:00
Niko Matsakis
b3a10db03e avoid early return 2017-11-22 03:51:55 -05:00
Niko Matsakis
b588edc413 only normalize operand types when in an ADT constructor 2017-11-22 03:51:55 -05:00
Paul Daniel Faria
527a5dd251 Normalize LvalueTy for ops and format code to satisfy tidy check 2017-11-22 03:51:55 -05:00
Paul Daniel Faria
47c6db09ee Remove attributes and test comments accidentally left behind, add in span_mirbugs 2017-11-22 03:51:54 -05:00
Paul Daniel Faria
fe32df9adb Fix failing test 2017-11-22 03:51:54 -05:00
Paul Daniel Faria
19c17360d9 Check rvalue aggregates during check_stmt in tycheck, add initial, (not passing) test 2017-11-22 03:51:54 -05:00
Santiago Pastorino
4fecccbd2e Make RegionVid use newtype_index!
Closes #45843
2017-11-22 03:51:54 -05:00
bors
96e9cee77f Auto merge of #46040 - zilbuz:mir-misc, r=nikomatsakis
MIR-borrowck: Some minor fixes

- Remove parens when printing dereference (fix #45185)
- Change argument type of `autoderef` to `bool`
- Change argument type of `field_index` to `Field`
2017-11-22 07:27:54 +00:00
Mazdak
bc18d99232 Box::leak: update unstable issue number (46179). 2017-11-22 07:21:30 +01:00
Oliver Middleton
fb094642e1 Add missing Debug impls to std_unicode
Also adds #![deny(missing_debug_implementations)] so they don't get
missed again.
2017-11-22 00:49:28 +00:00
bors
d6d09e0b4d Auto merge of #45879 - nikomatsakis:nll-kill-cyclic-closures, r=arielb1
move closure kind, signature into `ClosureSubsts`

Instead of using side-tables, store the closure-kind and signature in the substitutions themselves. This has two key effects:

- It means that the closure's type changes as inference finds out more things, which is very nice.
    - As a result, it avoids the need for the `freshen_closure_like` code (though we still use it for generators).
- It avoids cyclic closures calls.
    - These were never meant to be supported, precisely because they make a lot of the fancy inference that we do much more complicated. However, due to an oversight, it was previously possible -- if challenging -- to create a setup where a closure *directly* called itself (see e.g. #21410).

We have to see what the effect of this change is, though. Needs a crater run. Marking as [WIP] until that has been assessed.

r? @arielb1
2017-11-21 22:52:19 +00:00
QuietMisdreavus
52ee203d65 make with_unsugared_doc preserve is_sugared_doc 2017-11-21 15:46:49 -06:00
QuietMisdreavus
f9f3611f5c allow loading external files in documentation
Partial implementation of https://github.com/rust-lang/rfcs/pull/1990
(needs error reporting work)

cc #44732
2017-11-21 15:46:49 -06:00
Virgil Palanciuc
a2d63d65da Add test for #44953 2017-11-21 22:29:35 +02:00
bors
63739ab7b2 Auto merge of #46166 - kennytm:rollup, r=kennytm
Rollup of 11 pull requests

- Successful merges: #45987, #46031, #46050, #46052, #46103, #46120, #46134, #46141, #46148, #46155, #46157
- Failed merges:
2017-11-21 17:14:05 +00:00