Commit Graph

74369 Commits

Author SHA1 Message Date
bjorn3 6ceb1637b2 Move some functions out of rustc_codegen_llvm and fix metadata_only backend 2018-07-07 10:47:22 +02:00
bors 599d2c01e0 Auto merge of #52037 - lqd:skipping-regionless-types, r=nikomatsakis
NLL Liveness: Skip regionless types when visiting free regions

The tuple-stress benchmark exercises the liveness constraint generation code for types which do not have regions

Closes #52027
2018-07-07 07:06:14 +00:00
jD91mZM2 c007a78d23
Add is_unnamed 2018-07-07 06:52:03 +02:00
jD91mZM2 abac5e722f
Revert unification of interfaces 2018-07-07 06:50:55 +02:00
Pramod Bisht 63c3fddc96 removed redundant header file import in rustllvm.h 2018-07-07 09:37:41 +05:30
Pramod Bisht d5f443d81d Addresses #52049 2018-07-07 09:32:41 +05:30
csmoe f5f97b37a7 update tests 2018-07-07 11:57:04 +08:00
bors 4f0ca9248f Auto merge of #52123 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 9 pull requests

Successful merges:

 - #51901 (Rc: remove unused allocation and fix segfault in Weak::new())
 - #52058 (Use of unimplemented!() causing ICE with NLL)
 - #52067 (Visit the mir basic blocks in reverse-postfix order)
 - #52083 (Dont run ast borrowck on mir mode)
 - #52099 (fix typo in stable `--edition` error message)
 - #52103 (Stabilize rc_downcast)
 - #52104 (Remove unnecessary feature gate.)
 - #52117 (Dedupe filetime)
 - #52120 (ARM: expose the "mclass" target feature)

Failed merges:

r? @ghost
2018-07-07 03:55:28 +00:00
Mark Rousskov cd7ddae695
Rollup merge of #52120 - japaric:mclass, r=alexcrichton
ARM: expose the "mclass" target feature

This let us differentiate, in conditional compilation context, between ARM Cortex-M targets, like
the `thumbv*` targets, and other ARM targets, like the ARM Cortex-A Linux targets.

r? @alexcrichton
cc @gnzlbg
cc rust-lang-nursery/stdsimd#437
2018-07-06 21:29:20 -06:00
Mark Rousskov 4784883e52
Rollup merge of #52117 - Eijebong:filetime, r=alexcrichton
Dedupe filetime
2018-07-06 21:29:19 -06:00
Mark Rousskov f69baa92e4
Rollup merge of #52104 - tmccombs:repr_trans_stable, r=Mark-Simulacrum
Remove unnecessary feature gate.

To fix a warning.
2018-07-06 21:29:18 -06:00
Mark Rousskov e3823388a8
Rollup merge of #52103 - tmccombs:rc_downcast, r=Mark-Simulacrum
Stabilize rc_downcast

Fixes #44608
2018-07-06 21:29:17 -06:00
Mark Rousskov 9672933639
Rollup merge of #52099 - zackmdavis:and_the_case_of_the_typ, r=oli-obk
fix typo in stable `--edition` error message

(diff is self-explanatory)
2018-07-06 21:29:16 -06:00
Mark Rousskov 54a440b469
Rollup merge of #52083 - spastorino:dont-run-ast-borrowck-on-mir-mode, r=nikomatsakis
Dont run ast borrowck on mir mode

r? @nikomatsakis
2018-07-06 21:29:14 -06:00
Mark Rousskov ec6bba319b
Rollup merge of #52067 - csmoe:issue-51167, r=nikomatsakis
Visit the mir basic blocks in reverse-postfix order

cc #51167
r? @nikomatsakis
2018-07-06 21:29:13 -06:00
Mark Rousskov b71b92199c
Rollup merge of #52058 - davidtwco:issue-51345, r=nikomatsakis
Use of unimplemented!() causing ICE with NLL

Fixes #51345.

r? @nikomatsakis
2018-07-06 21:29:12 -06:00
Mark Rousskov 9b3ec57c16
Rollup merge of #51901 - rust-lang:weak-unboxing, r=alexcrichton
Rc: remove unused allocation and fix segfault in Weak::new()

Same as https://github.com/rust-lang/rust/pull/50357 did for `Arc`.

Fixes https://github.com/rust-lang/rust/issues/48493
2018-07-06 21:29:11 -06:00
csmoe b9c6dba5c4 extend where clauses 2018-07-07 11:02:47 +08:00
bors 99b0ddb88a Auto merge of #51656 - soc:topic/fix-home-dir, r=SimonSapin
Deprecate `std::env::home_dir` and fix incorrect documentation

Compare `std::env::home_dir`s claim:

> Returns the value of the 'HOME' environment variable if it is set and not equal to the empty string.

... with its actual behavior:

```
std::env::set_var("HOME", "");
println!("{:?}", std::env::var_os("HOME")); // Some("")
println!("{:?}", std::env::home_dir());     // Some("")
```

The implementation is incorrect in two cases:
- `$HOME` is set, but empty.
- An entry for the user exists in `/etc/passwd`, but it's `pw_dir` is empty.

In both cases Rust considers an empty string to be a valid home directory. This contradicts the documentation, and is wrong in general.
2018-07-07 01:51:08 +00:00
Meade Kincke f629eb3595 General fixes and cleanup. 2018-07-07 01:09:09 +01:00
Meade Kincke 75bc0649b8 Omitted the walk in visit_expr() 2018-07-07 01:09:09 +01:00
Simon Sapin 67202b8b68 Fix is_dangling import when Arc is #[cfg]’ed out 2018-07-07 01:44:57 +02:00
Simon Sapin 5717d99d1b Add some unit tests for dangling Weak references 2018-07-07 01:41:30 +02:00
Simon Sapin 21526c5403 Add a test for Weak::new() not crashing for uninhabited types 2018-07-07 01:41:30 +02:00
Simon Sapin 41730b7e2e Rc: remove unused allocation from Weak::new()
Same as https://github.com/rust-lang/rust/pull/50357
2018-07-07 01:41:30 +02:00
Simon Sapin 6e2c49ff0e Use an aligned dangling pointer in Weak::new, rather than address 1 2018-07-07 01:41:30 +02:00
bors a178cba9f1 Auto merge of #52021 - nikomatsakis:nll-region-errors, r=estebank
refactor and cleanup region errors for NLL

This is a WIP commit. It simplifies some of the code from https://github.com/rust-lang/rust/pull/51536 and extends a few more steps towards the errors that @davidtwco and I were shooting for. These are intended as a replacement for the general "unable to infer lifetime" messages -- one that is actually actionable. We're certainly not there yet, but the overall shape hopefully gets a bit clearer.

I'm thinking about trying to open up an internals thread to sketch out the overall plan and perhaps discuss how to get the wording right, which special cases to handle, etc.

r? @estebank
cc @davidtwco
2018-07-06 23:36:16 +00:00
Jorge Aparicio b7047bb89f ARM: expose the "mclass" target feature 2018-07-06 18:28:38 -05:00
Simon Ochsenreither 0afc16a039 Deprecate `std::env::home_dir` and fix incorrect documentation 2018-07-07 01:28:37 +02:00
Bastien Orivel 933c299443 Dedupe filetime 2018-07-06 22:52:40 +02:00
bors e06c875442 Auto merge of #51757 - nielx:fix/haiku-fixes, r=nagisa
Haiku: several smaller fixes to build and run rust on Haiku

This PR combines three small patches that help Rust build and run on the Haiku platform. These patches do not intend to impact other platforms.
2018-07-06 20:05:23 +00:00
Matt Brubeck cdff2f3b30 impl Clone for Box<CStr>, Box<OsStr>, Box<Path>
Implements #51908.
2018-07-06 12:57:47 -07:00
bors 3ea16c3493 Auto merge of #52018 - flip1995:rfc2103, r=oli-obk
Implementation of tool lints.

Tracking issue: #44690
2018-07-06 18:03:46 +00:00
bors 062a416dd4 Auto merge of #52010 - toidiu:ak-crossCrateOutlives, r=nikomatsakis
Fix: infer outlives requirements across crates

Fixes https://github.com/rust-lang/rust/issues/51858
2018-07-06 16:01:25 +00:00
csmoe 88f475c808 suggests with whole macro call 2018-07-06 22:31:55 +08:00
bors 50302821c4 Auto merge of #51894 - mikhail-m1:8636, r=nikomatsakis
fix for issue #8636

r? @nikomatsakis

Fix #8636

also fixes #42291
2018-07-06 12:54:45 +00:00
Michael Woerister 4a269642c9 Remove CrossLangLto::NoLink which does not have a use case anymore. 2018-07-06 14:08:40 +02:00
Michael Woerister 72df804d8e When doing linker-plugin based LTO, write LLVM bitcode obj-files
instead of embedding the bitcode into the regular object file.
2018-07-06 13:58:25 +02:00
bors ded86ccc2c Auto merge of #51677 - nrc:update, r=kennytm
Update RLS and Rustfmt

r? @Mark-Simulacrum
2018-07-06 10:55:02 +00:00
csmoe a6d4d2b945 refactor 2018-07-06 18:44:42 +08:00
Niko Matsakis 6d0644c65a
tweak comment 2018-07-06 06:33:38 -04:00
bors 0072c95aff Auto merge of #51953 - japaric:atomic-load-store, r=alexcrichton
enable Atomic*.{load,store} for ARMv6-M / MSP430

closes #45085

as proposed in https://github.com/rust-lang/rust/issues/45085#issuecomment-384825434

this commit adds an `atomic_cas` target option and extends the `#[cfg(target_has_atomic)]`
attribute to enable a subset of the `Atomic*` API on architectures that don't support atomic CAS
natively, like MSP430 and ARMv6-M.

r? @alexcrichton
2018-07-06 08:59:22 +00:00
Nick Cameron 7717705c35 Update RLS, Rustfmt, Cargo, and Clippy 2018-07-06 20:58:21 +12:00
Thayne McCombs 15a196ec36 Remove unnecessary feature gate.
To fix a warning.
2018-07-06 01:06:17 -06:00
Thayne McCombs 7fbc3895e3 Stabilize rc_downcast
Fixes #44608
2018-07-06 01:00:40 -06:00
bors 4d9fa2326e Auto merge of #52088 - kennytm:rollup, r=kennytm
Rollup of 14 pull requests

Successful merges:

 - #51619 (rust: add initial changes to support powerpc64le musl)
 - #51793 (Fix variant background color on hover in search results)
 - #52005 (Update LLVM to bring in a wasm codegen fix)
 - #52016 (Deduplicate error reports for statics)
 - #52019 ([cross-lang-lto] Allow the linker to choose the LTO-plugin (which is useful when using LLD))
 - #52030 (Any docs preposition change)
 - #52031 (Strenghten synchronization in `Arc::is_unique`)
 - #52033 ([Gardening] Update outdated comments: ByVal -> Scalar)
 - #52055 (Include VS 2017 in error message.)
 - #52063 (Add a link to the rustc docs)
 - #52073 (Add a punch card to weird expressions test)
 - #52080 (Improve dependency deduplication diagnostics)
 - #52093 (rustc: Update tracking issue for wasm_import_module)
 - #52096 (Fix typo in cell.rs)

Failed merges:
2018-07-06 06:48:12 +00:00
Niels Sascha Reedijk 90e32e2ac6 Haiku: work around the lack of setrlimit
By default, Haiku has the desired 16 MB stack, therefore in general
we do not have to spawn a new thread. The code has been written in
such a way that any changes in Haiku or in Rust will be adapted to.
2018-07-06 07:19:11 +02:00
kennytm 1a8011f617
Rollup merge of #52093 - alexcrichton:update-issue, r=kennytm
rustc: Update tracking issue for wasm_import_module

It's now https://github.com/rust-lang/rust/issues/52090
2018-07-06 13:02:06 +08:00
kennytm 3c21349e07
Rollup merge of #52055 - crlf0710:patch-3, r=Mark-Simulacrum
Include VS 2017 in error message.

Update error prompt message to indicate that VS 2017 is supported (for a while now).
2018-07-06 12:56:26 +08:00
kennytm f1a36fc29f
Rollup merge of #52080 - oli-obk:dep_dedup_diagnostics, r=kennytm
Improve dependency deduplication diagnostics

r? @kennytm

this is obviously hard to test 😆

cc #52072
2018-07-06 12:56:24 +08:00
kennytm 596d1a782d
Rollup merge of #52073 - xfix:patch-7, r=oli-obk
Add a punch card to weird expressions test
2018-07-06 12:56:23 +08:00
Zack M. Davis bbfdea28cd typo-fix stable ed'n error: "an onlyavailable" → "and only available" 2018-07-05 21:52:07 -07:00
Alex Crichton 23fbfb57cf rustc: Update tracking issue for wasm_import_module
It's now https://github.com/rust-lang/rust/issues/52090
2018-07-05 21:27:27 -07:00
Jorge Aparicio f9145d01e1 update run-pass test 2018-07-05 20:18:19 -05:00
kennytm 6d35505b9b
Rollup merge of #52033 - zachrwolfe:outdated_value_comment, r=oli-obk
[Gardening] Update outdated comments: ByVal -> Scalar

ByVal enum cases in mir::interpret::value were renamed to Scalar a while ago but comments still refer to the old names.
2018-07-06 08:49:25 +08:00
kennytm b87b22e53c
Rollup merge of #52031 - RalfJung:arc, r=sfackler
Strenghten synchronization in `Arc::is_unique`

Previously, `is_unique` would not synchronize at all with a `drop` that returned
early because it was not the last reference, leading to a data race.

Fixes #51780

Unfortunately I have no idea how to add a test for this.

Cc @jhjourdan
2018-07-06 08:49:23 +08:00
kennytm 7ce7bf0e37
Rollup merge of #52030 - bowbahdoe:patch-1, r=alexcrichton
Any docs preposition change

This changes the docs referring to where a user should be wary of depending on "Any" trait impls from warning about relying on them "outside" of their code to warning about relying on them "inside" of their code.
2018-07-06 08:49:22 +08:00
kennytm ffc453abf7
Rollup merge of #52019 - michaelwoerister:cross-lto-auto-plugin, r=alexcrichton
[cross-lang-lto] Allow the linker to choose the LTO-plugin (which is useful when using LLD)

This PR allows for not specifying an LTO-linker plugin but still let `rustc` invoke the linker with the correct plugin arguments. This is useful when using LLD which does not need the `-plugin` argument. Since LLD is the best linker for this scenario anyway, this change should improve ergonomics quite a bit.

r? @alexcrichton
2018-07-06 08:49:20 +08:00
kennytm a4846aebd8
Rollup merge of #52016 - oli-obk:dedup_static_errors, r=estebank
Deduplicate error reports for statics

fixes #51970
2018-07-06 08:49:19 +08:00
kennytm 1568b5e6d7
Rollup merge of #52005 - alexcrichton:update-llvm-for-wasm, r=kennytm
Update LLVM to bring in a wasm codegen fix

Closes #51986
2018-07-06 08:49:18 +08:00
bors a8403e1cda Auto merge of #51861 - GuillaumeGomez:prevent-some-markdown-short-doc, r=QuietMisdreavus
Prevent some markdown transformation on short docblocks

Before:

<img width="1440" alt="screen shot 2018-06-28 at 01 46 01" src="https://user-images.githubusercontent.com/3050060/42005762-7d533bbe-7a76-11e8-8361-027886803399.png">

After:

<img width="1440" alt="screen shot 2018-06-28 at 01 46 02" src="https://user-images.githubusercontent.com/3050060/42005768-81bd59a0-7a76-11e8-819b-9b4be72579d6.png">

This is only performed on short doc blocks, not on plain ones. Not all transformations are prevented (you still have a few like urls, code blocks, etc...).

cc @nical

r? @QuietMisdreavus
2018-07-06 00:36:34 +00:00
Marco A L Barbosa f969b61bd6 Update musl to 1.1.19 and add patch to fix tls issue 2018-07-05 20:17:57 -03:00
kennytm 6650d7f1a2
Rollup merge of #51793 - GuillaumeGomez:search-result-hover, r=QuietMisdreavus
Fix variant background color on hover in search results

Fixes #51792.

<img width="1440" alt="screen shot 2018-06-26 at 00 37 24" src="https://user-images.githubusercontent.com/3050060/41879313-60ecf3be-78d9-11e8-9986-21af529ab758.png">

r? @QuietMisdreavus
2018-07-06 07:07:11 +08:00
kennytm 185fb7b77c
Rollup merge of #51619 - mksully22:ppc64le_rust, r=alexcrichton
rust: add initial changes to support powerpc64le musl

Initial changes to support rustc building on ppc64le with musl. A PR was also submitted to libc component https://github.com/rust-lang/libc/pull/1023 to add changes to libc musl definitions.

A PR was submitted on Alpine https://github.com/alpinelinux/aports/pull/4549 with equivalent temporary patches for building on Alpine for now.

As a verification test a github project was put together to build ppc64le versions of rustc, rust-stdlib, and cargo on Alpine, https://github.com/mksully22/ppc64le_alpine_rust_1.26.2
2018-07-06 07:07:10 +08:00
bors 00f49728e0 Auto merge of #51732 - GuillaumeGomez:cmd-line-lint-rustdoc, r=QuietMisdreavus
Add command line lint manipulation in rustdoc

Fixes #50082.

r? @QuietMisdreavus
2018-07-05 22:28:53 +00:00
Jorge Aparicio 0ed32313a2 #[cfg(target_has_atomic_cas)] -> #[cfg(target_has_atomic = "cas")] 2018-07-05 16:52:46 -05:00
Jorge Aparicio bbf688a84d enable Atomic*.{load,store} for ARMv6-M / MSP430
closes #45085

this commit adds an `atomic_cas` target option and an unstable `#[cfg(target_has_atomic_cas)]`
attribute to enable a subset of the `Atomic*` API on architectures that don't support atomic CAS
natively, like MSP430 and ARMv6-M.
2018-07-05 16:44:29 -05:00
Josh Stone 557736befc Update scalar pairs per review comments 2018-07-05 14:22:09 -07:00
Eduard-Mihai Burtescu ce94518ed3 rustc_codegen_llvm: replace the first argument early in FnType::new_vtable. 2018-07-06 00:17:13 +03:00
bors 2d5a295d51 Auto merge of #51917 - alexcrichton:update, r=Mark-Simulacrum
Update crates in `Cargo.lock`

This is a "hopefully routine" update of our crates.io-based crates in
`Cargo.lock`, and let's see how it fares on CI...
2018-07-05 20:25:00 +00:00
Santiago Pastorino 25266c1840
Do not run AST borrowck when -Zborrowck=mir 2018-07-05 16:57:32 -03:00
Guillaume Gomez e221be89e0 Add command line lint manipulation in rustdoc 2018-07-05 21:07:51 +02:00
bors 478226cc2a Auto merge of #51599 - GuillaumeGomez:reduce-search-index, r=QuietMisdreavus
reduce search-index size

Reduce size of `search-index.js` of around 16%:

Going from `2996785` bytes to `2545583`.

r? @QuietMisdreavus
2018-07-05 18:21:25 +00:00
Guillaume Gomez 92cda8c7da Whitelist lints 2018-07-05 20:06:33 +02:00
Oliver Schneider f352e98ddc Address review comments 2018-07-05 19:30:06 +02:00
Oliver Schneider f1e3a5a24b Only display difference of features, not all features 2018-07-05 19:02:43 +02:00
Josh Stone e578976560 Store scalar pair bools as i8 in memory
We represent `bool` as `i1` in a `ScalarPair`, unlike other aggregates,
to optimize IR for checked operators and the like.  With this patch, we
still do so when the pair is an immediate value, but we use the `i8`
memory type when the value is loaded or stored as an LLVM aggregate.

So `(bool, bool)` looks like an `{ i1, i1 }` immediate, but `{ i8, i8 }`
in memory.  When a pair is a direct function argument, `PassMode::Pair`,
it is still passed using the immediate `i1` type, but as a return value
it will use the `i8` memory type.  Also, `bool`-like` enum tags will now
use scalar pairs when possible, where they were previously excluded due
to optimization issues.
2018-07-05 09:59:52 -07:00
Oliver Schneider 82a1328740 Vertical list of tools to check 2018-07-05 18:48:56 +02:00
Alex Crichton d825115978 Update Cargo.lock dependencies
Run `cargo update` and let's see how far we can get!
2018-07-05 09:30:27 -07:00
Val Markovic dc425e2e64
Clarifying how the alignment of the struct works
The docs were not specifying how to compute the alignment of the struct, so I had to spend some time trying to figure out how that works. Found the answer [on this page](http://camlorn.net/posts/April%202017/rust-struct-field-reordering.html):

> The total size of this struct is 5, but the most-aligned field is b with alignment 2, so we round up to 6 and give the struct an alignment of 2 bytes.
2018-07-05 09:24:03 -07:00
Guillaume Gomez 1ff7f04120 Fix rustdoc run failures by shutting down definitely some lints 2018-07-05 17:18:45 +02:00
bors 94eb176055 Auto merge of #52012 - oli-obk:clippy, r=kennytm
Update the clippy submodule
2018-07-05 11:44:08 +00:00
Oliver Schneider d5dbeda9ef Update the clippy submodule 2018-07-05 13:42:12 +02:00
csmoe ff83ef0c24 merge wellformed(wc)s 2018-07-05 18:49:02 +08:00
csmoe dabd3f6935 split IntoWellFormedGoal 2018-07-05 18:47:00 +08:00
csmoe 329d03ac1f update test 2018-07-05 18:47:00 +08:00
csmoe e2f3577131 wellformed wc 2018-07-05 18:46:43 +08:00
Mikhail Modin f247a3e490 fix for issue #8636 2018-07-05 11:34:10 +01:00
Konrad Borowski 0ce01776ba Add a punch card to weird expressions test 2018-07-05 12:31:09 +02:00
bors 69b9e1e8f9 Auto merge of #51967 - varkor:const-body-break-continue, r=estebank
Fix various issues with control-flow statements inside anonymous constants

Fixes #51761.
Fixes #51963 (and the host of other reported issues there).
(Might be easiest to review per commit, as they should be standalone.)

r? @estebank
2018-07-05 09:40:08 +00:00
csmoe e7e8c72fdd update test 2018-07-05 17:38:44 +08:00
bors 6fc21e5576 Auto merge of #51936 - japaric:rust-lld, r=alexcrichton
rename rustc's lld to rust-lld

to not shadow the system installed LLD when linking with LLD.

Before:

- `-C linker=lld -Z linker-flavor=ld.lld` uses rustc's LLD
- It's not possible to use a system installed LLD that's named `lld`

With this commit:

- `-C linker=rust-lld -Z linker-flavor=ld.lld` uses rustc's LLD
- `-C linker=lld -Z linker-flavor=ld.lld` uses the system installed LLD

we don't offer guarantees about the availability of LLD in the rustc sysroot so we can rename the tool as long as we don't break the wasm32-unknown-unknown target which depends on it.

r? @alexcrichton we discussed this before
2018-07-05 06:44:16 +00:00
Jorge Aparicio 31ed5c7a01 in the second copy lld is already named rust-lld 2018-07-04 23:10:10 -05:00
bors c865d3934c Auto merge of #51938 - zackmdavis:and_the_case_of_the_leaking_desugar, r=estebank
in which we plug the crack where `?`-desugaring leaked into errors

Most of the time, it's not a problem that the types of the arm bodies in
a desugared-from-`?` match are different (that is, specifically: in `x?`
where x is a `Result<A, B>`, the `Ok` arm body is an `A`, whereas the
`Err` arm diverges to return a `Result<A, B>`), because they're being
assigned to different places. But in tail position, the types do need to
match, and our error message was explicitly referring to "match arms",
which is confusing when there's no `match` in the sweetly sugared
source.

It is not without some misgivings that we pollute the clarity-of-purpose
of `note_error_origin` with the suggestion to wrap with `Ok` (the other
branches are pointing out the odd-arm-out in the HIR that is the origin
of the error; the new branch that issues the `Ok` suggestion is serving
a different purpose), but it's the natural place to do it given that
we're already matching on `ObligationCauseCode::MatchExpressionArm {
arm_span, source }` there.

Resolves #51632.
2018-07-05 02:35:25 +00:00
Santiago Pastorino 0e31e2fa9b
Remove rustc_mir_borrowck attribute and use rustc_mir instead 2018-07-04 23:10:28 -03:00
csmoe 37228fe632 reverse_postorder 2018-07-05 09:46:10 +08:00
Benjamin Peterson 70a6aeac0d Remove obsolete documentation from FufillmentContext::select comment.
The `only_new_obligations` parameter has not existed since 43756934d2.
2018-07-04 18:25:04 -07:00
bors b51ca20ce5 Auto merge of #51964 - matthewjasper:unused-mut-mir-generation, r=nikomatsakis
[NLL] Fix various unused mut errors

Closes #51801
Closes #50897
Closes #51830
Closes #51904
cc #51918 - keeping this one open in case there are any more issues

This PR contains multiple changes. List of changes with examples of what they fix:

* Change mir generation so that the parameter variable doesn't get a name when a `ref` pattern is used as an argument
```rust
fn f(ref y: i32) {} // doesn't trigger lint
```
* Change mir generation so that by-move closure captures don't get first moved into a temporary.
```rust
let mut x = 0; // doesn't trigger lint
move || {
    x = 1;
};
```
* Treat generator upvars the same as closure upvars
```rust
let mut x = 0; // This mut is now necessary and is not linted against.
move || {
    x = 1;
    yield;
};
```

r? @nikomatsakis
2018-07-05 00:22:14 +00:00
Dylan MacKenzie cf5eaa75bb Move `Eq + Hash + Clone` bounds to `Machine` 2018-07-04 14:36:07 -07:00
Dylan MacKenzie c395044a50 Shorten error message and add link to test
Implements @bjorn3's suggestions.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie 0d0e021b1c Derive Eq and Hash for types used in Miri's evaluator 2018-07-04 14:36:07 -07:00
Dylan MacKenzie b3b04b8cc6 Avoid overflow in step counter
This removes the `usize` argument to `inc_step_counter`. Now, the step
counter increments by exactly one for every terminator evaluated. After
`STEPS_UNTIL_DETECTOR_ENABLED` steps elapse, the detector is run every
`DETECTOR_SNAPSHOT_PERIOD` steps. The step counter is only kept modulo
this period.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie 647ba29b90 Explain reason behind error span
We can't expand the span of the error reliably according to @oli-obk, so
just mention why it points to this particular expression.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie d36302da53 Add a UI test for #50637
This test relies on the fact that restrictions on expressions in `const
fn` do not apply when computing array lengths. It is more difficult to
statically analyze than the simple `loop{}` mentioned in #50637.

This test should be updated to ignore the warning after #49980 is resolved.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie 10f217159b Rename `bloom` to `hashes` 2018-07-04 14:36:07 -07:00
Dylan MacKenzie c6aea935cf Enable loop detector in step loop
The detector runs every `DETECTOR_SNAPSHOT_PERIOD` steps. Since the
number of steps can increase by more than 1 (I'd like to remove this),
the detector may fail if the step counter is incremented past the
scheduled detection point during the loop.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie f7e9d2ac3e Add an `InfiniteLoop` variant to `EvalErrorKind` 2018-07-04 14:36:07 -07:00
Dylan MacKenzie 0f1c61cb7f Improve correctness of `Frame` and `Memory` equality
Incorporate a subset of the suggestions from @oli-obk. More to come.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie 788c5f3c8b Revert "Refactor EvalContext stack and heap into inner struct"
This reverts commit 59d21c526c036d7097d05edd6dffdad9c5b1cb62, and uses
tuple to store the mutable parts of an EvalContext (which now includes
`Machine`). This requires that `Machine` be `Clone`.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie 7f9b01a0fc Add miri infinite loop detection
Use the approach suggested by @oli-obk, a table holding `EvalState`
hashes and a table holding full `EvalState` objects. When a hash
collision is observed, the state is cloned and put into the full
table. If the collision was not spurious, it will be detected during the
next iteration of the infinite loop.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie 6c0f502fe6 Implement Clone, Eq and Hash for the heap and stack
I use a pattern binding in each custom impl, so that adding fields to
`Memory` or `Frame` will cause a compiler error instead of causing e.g.
`PartialEq` to become invalid. This may be too cute.

This adds several requirements to `Machine::MemoryData`. These can be
removed if we don't want this associated type to be part of the equality
of `Memory`.
2018-07-04 14:36:07 -07:00
Dylan MacKenzie db025c14ec Refactor EvalContext stack and heap into inner struct
Change surrounding code to use accessor methods to refer to these fields.
Similar changes have not yet been made in tools/miri
2018-07-04 14:36:07 -07:00
David Wood f90eada1c9
Improve comments. 2018-07-04 21:48:25 +01:00
David Wood aeb1682894
Ensure that borrows wind up unactivated. 2018-07-04 21:35:38 +01:00
bors afaa406465 Auto merge of #51803 - lucasem:rustdoc-code-hash-escape, r=GuillaumeGomez
rustdoc codeblock hash escape

So that docstring text such as the following (in a code block) can be created ergonomically:

```rust
let s = "
    foo
    # bar
    baz
";
```

Such code in a docstring hide the <code>&nbsp;&nbsp;&nbsp;&nbsp;# bar</code> line.

Previously, using two consecutive hashes <code>&nbsp;&nbsp;&nbsp;&nbsp;## bar</code> would turn the line into _shown_ `# bar`, losing the leading whitespace. A line of code like <code>&nbsp;&nbsp;&nbsp;&nbsp;# bar</code> (such as in the example above) **could not be represented** in the docstring text.

This commit makes the two consecutive hashes not also trim the leading whitespace — the two hashes simply **escape** into a single hash and do not hide the line, leaving the rest of that line unaffected. The new docstring text to achieve the above code block is:

```rust
/// ```
/// let s = "
///     foo
///     ## bar
///     baz
/// ";
/// ```
```
2018-07-04 20:21:01 +00:00
David Wood 7eba13f451
Correctly handle an activation from dead code. 2018-07-04 20:08:15 +01:00
bors 4af9132a02 Auto merge of #51611 - QuietMisdreavus:slippery-macros, r=ollie27
rustdoc: import cross-crate macros alongside everything else

The thrilling conclusion of the cross-crate macro saga in rustdoc! After https://github.com/rust-lang/rust/pull/51425 made sure we saw all the namespaces of an import (and prevented us from losing the `vec!` macro in std's documentation), here is the PR to handle cross-crate macro re-exports at the same time as everything else. This way, attributes like `#[doc(hidden)]` and `#[doc(no_inline)]` can be used to control how the documentation for these macros is seen, rather than rustdoc inlining every macro every time.

Fixes https://github.com/rust-lang/rust/issues/50647
2018-07-04 18:15:14 +00:00
Lucas Morales ff2ff2b2b8
rustdoc book on codeblock hash escaping 2018-07-04 12:41:45 -04:00
bors 0ad8f9e5b1 Auto merge of #51395 - SimonSapin:repr-transparent, r=SimonSapin
Add #[repr(transparent)] to some libcore types

* `UnsafeCell`
* `Cell`
* `NonZero*`
* `NonNull`
* `Unique`

CC https://github.com/rust-lang/rust/issues/43036
2018-07-04 16:21:42 +00:00
CrLF0710 30063ae2a5
Shorten the line
Shorten the line to make tidy happy.
2018-07-04 23:36:51 +08:00
CrLF0710 1dae60ea4c
Include VS 2017 in error message.
Update error prompt message to indicate that VS 2017 is supported (for a while now).
2018-07-04 22:49:35 +08:00
bors eded1aa14c Auto merge of #51870 - nnethercote:reuse-DefsUsesVisitor, r=nikomatsakis
Reuse the `DefsUsesVisitor` in `simulate_block()`.

This avoids a bunch of allocations for the bitsets within it,
speeding up a number of NLL benchmarks, the best by 1%.

r? @nikomatsakis
2018-07-04 14:12:14 +00:00
flip1995 c3949009ad
Improving span of unknown lint tool error message 2018-07-04 14:28:44 +02:00
bors a22bcd8aab Auto merge of #51935 - cramertj:unpin-references, r=withoutboats
Unpin references

I also considered adding an impl for raw pointers as well, but that makes it easy to accidentally have unsound owning-collections that might otherwise be able to project pinned-ness (e.g. `Box`).

cc @RalfJung

r? @withoutboats
2018-07-04 11:32:40 +00:00
flip1995 a9634fcd01
Unstable book documentation of tool lints 2018-07-04 12:16:46 +02:00
flip1995 dddb8d2eba
Implementation of tool lints 2018-07-04 12:16:46 +02:00
flip1995 ed29e86c39
Tests for tool_lints 2018-07-04 12:16:45 +02:00
bors 8dd715ee5e Auto merge of #51895 - nikomatsakis:move-self-trait-predicate-to-items, r=scalexm
Move self trait predicate to items

This is a "reimagination" of @tmandry's PR #50183. The main effect is described in this comment from one of the commits:

---

Before we had the following results for `predicates_of`:

```rust
trait Foo { // predicates_of: Self: Foo
  fn bar(); // predicates_of: Self: Foo (inherited from trait)
}
```

Now we have removed the `Self: Foo` from the trait. However, we still
add it to the trait ITEM. This is because when people do things like
`<T as Foo>::bar()`, they still need to prove that `T: Foo`, and
having it in the `predicates_of` seems to be the cleanest way to
ensure that happens right now (otherwise, we'd need special case code
in various places):

```rust
trait Foo { // predicates_of: []
  fn bar(); // predicates_of: Self: Foo
}
```

However, we sometimes want to get the list of *just* the predicates
truly defined on a trait item (e.g., for chalk, but also for a few
other bits of code). For that, we define `predicates_defined_on`,
which does not contain the `Self: Foo` predicate yet, and we plumb
that through metadata and so forth.

---

I'm assigning @eddyb as the main reviewer, but I thought I might delegate to scalexm for this one in any case. I also want to post an alternative that I'll leave in the comments; it occurred to me as I was writing. =)

r? @eddyb
cc @scalexm @tmandry @leodasvacas
2018-07-04 09:33:33 +00:00
Niko Matsakis 727f01700b write code to extract region names and emit new style message 2018-07-04 05:09:33 -04:00
Rémy Rakic 0190286d48 NLL Liveness: Skip regionless types when visiting free regions
The tuple-stress benchmark exercises the liveness constraint generation code for types which do not have regions
2018-07-04 08:50:12 +02:00
Nicholas Nethercote b0c78120e3 Reuse the `DefsUsesVisitor` in `simulate_block()`.
This avoids a bunch of allocations for the bitsets within it,
speeding up a number of NLL benchmarks, the best by 1%.
2018-07-04 13:05:03 +10:00
Alex Crichton ef41cf0288 Compile stage0 tools with the raw bootstrap compiler
This commit updates the stage0 build of tools to use the libraries of the stage0
compiler instead of the compiled libraries by the stage0 compiler. This should
enable us to avoid any stage0 hacks (like missing SIMD).
2018-07-03 18:06:29 -07:00
csmoe c999b253b7 add span note 2018-07-04 09:01:11 +08:00
bors a739c51d10 Auto merge of #51926 - matthewjasper:Initialization-span, r=nikomatsakis
[NLL] Use better span for initializing a variable twice

Closes #51217

When assigning to a (projection from a) local immutable local which starts initialised (everything except `let PATTERN;`):

* Point to the declaration of that local
* Make the error message refer to the local, rather than the projection.

r? @nikomatsakis
2018-07-03 23:54:25 +00:00
Niko Matsakis fa02d68eec universal_regions: rustfmt 2018-07-03 18:10:08 -04:00
Niko Matsakis 8b3ce9ca68 always create a category, even it is just "boring" 2018-07-03 18:10:08 -04:00
Niko Matsakis aae177e005 promote `error-reporting` to a module 2018-07-03 18:10:08 -04:00
Niko Matsakis 351e78de26 add `assert_crate_local` method to `ClearCrossCrate` 2018-07-03 18:10:08 -04:00
Niko Matsakis 37db94d3f2 store the `HirId` of the upvar 2018-07-03 18:10:08 -04:00
Niko Matsakis f03c0366ad add "free region helpers" 2018-07-03 18:10:08 -04:00
Niko Matsakis dddd4075b1 generalize `find_constraint_paths_between_regions` 2018-07-03 18:10:08 -04:00
Niko Matsakis 09f431fad5 simplify and cleanup error-reporting walk code 2018-07-03 18:10:08 -04:00
Niko Matsakis ea0224f5ab error_report: rustfmt 2018-07-03 18:10:08 -04:00
bors fb97bb50d1 Auto merge of #51900 - PramodBisht:51813_b, r=nikomatsakis
introduce dirty list to dataflow

@nikomatsakis my naive implementation never worked, So, I decided to implement using `work_queue` data structure. This PR also includes your commits from `nll-liveness-dirty-list` branch. Those commits should not visible once your branch is merged.

r? @nikomatsakis
2018-07-03 21:48:37 +00:00
Zach Wolfe ecaa7bc490
Update outdated comment: ByVal -> Scalar. 2018-07-03 16:09:13 -05:00
Ralf Jung f96c246869 Strenghten synchronization in `Arc::is_unique`
Previously, `is_unique` would not synchronize at all with a `drop` that returned
early because it was not the last reference, leading to a data race.

Fixes #51780
2018-07-03 22:33:17 +02:00
Ethan McCue 6f223cfc07
Any docs preposition change
This changes the docs referring to where a user should be wary of depending on "Any" trait impls from warning about relying on them "outside" of their code to warning about relying on them "inside" of their code.
2018-07-03 13:13:49 -07:00
Matthew Jasper 125c9d99e5 Fix various nll unused mut errors 2018-07-03 20:12:09 +01:00
Mike Sullivan dd069ea9f6 rust: add initial changes to support powerpc64le musl
amend powerpc64le_unknown_linux_musl.rs to fix copyright date
2018-07-03 18:18:03 +00:00
bors 739320a601 Auto merge of #51450 - estebank:inner-fn-test, r=@pnkfelix
Add lint warning for inner function marked as `#[test]`

Fix #36629.
2018-07-03 18:00:16 +00:00
QuietMisdreavus 61dc03cd63 test for renaming re-exported macros 2018-07-03 10:40:11 -05:00
Michael Woerister 65ff4141a5 Allow the linker to choose the LTO-plugin (which is useful when using LLD) 2018-07-03 16:33:11 +02:00
toidiu 3f616cb8c1 implement fix for cross crate inferrence and fix test 2018-07-03 10:13:50 -04:00
csmoe b79a83b4e4 Suggestion for print 2018-07-03 20:39:17 +08:00
bors 860d169474 Auto merge of #52014 - pietroalbini:rollup, r=pietroalbini
Rollup of 13 pull requests

Successful merges:

 - #51548 (Initialize LLVM's AMDGPU target machine, if available.)
 - #51809 (Add read_exact_at and write_all_at methods to FileExt on unix)
 - #51914 (add outlives annotations to `BTreeMap`)
 - #51958 (Show known meta items in unknown meta items error)
 - #51973 (Make Stdio handle UnwindSafe)
 - #51977 (bootstrap: tests should use rustc from config.toml)
 - #51978 (Do not suggest changes to str literal if it isn't one)
 - #51979 (Get rid of `TyImplTraitExistential`)
 - #51980 (Emit column info in debuginfo for non msvc like targets)
 - #51982 (incr.comp.: Take names of children into account when computing the ICH of a module's HIR.)
 - #51997 (add entry for cargo-metadata feature to RELEASES)
 - #52004 (toolstate: Fixed detection of changed submodule, and other fixes.)
 - #52006 ( Change --keep-stage to apply more often)

Failed merges:

r? @ghost
2018-07-03 12:26:14 +00:00
Oliver Schneider 1eeb5dcb67 Deduplicate error reports for statics 2018-07-03 12:03:47 +02:00
Pietro Albini 492518fcd5
Rollup merge of #52006 - Mark-Simulacrum:keep-stage-fix, r=alexcrichton
Change --keep-stage to apply more often

Previously, the --keep-stage argument would only function for compilers
that were depended on by future stages. For example, if trying to build
a stage 1 compiler you could --keep-stage 0 to avoid re-building the
stage 0 compiler. However, this is often not what users want in
practice.

The new implementation essentially skips builds all higher stages of the
compiler, so an argument of 1 to keep-stage will skip rebuilds of the
libraries, just linking them into the sysroot. This is unlikely to work
well in cases where metadata or similar changes have been made, but is
likely fine otherwise.

This change is somewhat untested, but since it shouldn't have any effect
except with --keep-stage, I don't see that as a large problem.

r? @alexcrichton
cc @nikomatsakis - I believe you wanted this functionality
2018-07-03 11:31:13 +02:00
Pietro Albini 6af4397e19
Rollup merge of #52004 - kennytm:toolstate-fixes, r=Mark-Simulacrum
toolstate: Fixed detection of changed submodule, and other fixes.

1. Make sure that if a submodule is updated but failed to test-pass, we'll block the merge.
2. Make sure failure on external docs (nomicon/RBE/etc) are properly checked.
3. If the commit message starts with "Update RLS" (or clippy etc), automatically run the "tools" job on the PR, so that we could know if the update failed before merging.
2018-07-03 11:31:12 +02:00
Pietro Albini b69058daa6
Rollup merge of #51982 - michaelwoerister:hash-modules-properly, r=nikomatsakis
incr.comp.: Take names of children into account when computing the ICH of a module's HIR.

Fixes #40876. Red-green tracking does not make this a problem anymore. We should verify this via a perf-run though.

r? @nikomatsakis
2018-07-03 11:31:10 +02:00
Pietro Albini 45cd78a4cd
Rollup merge of #51980 - est31:columns, r=alexcrichton
Emit column info in debuginfo for non msvc like targets

Fixes #42921 everywhere except MSVC. This mimics clang behaviour.
2018-07-03 11:31:09 +02:00
Pietro Albini f91b02b769
Rollup merge of #51979 - oli-obk:lowering_cleanups4, r=nikomatsakis
Get rid of `TyImplTraitExistential`

cc @eddyb

r? @nikomatsakis
2018-07-03 11:31:07 +02:00
Pietro Albini 5195132a35
Rollup merge of #51978 - estebank:issue-48364, r=oli-obk
Do not suggest changes to str literal if it isn't one

Fix #48364.
2018-07-03 11:31:06 +02:00
Pietro Albini 47eee2497a
Rollup merge of #51977 - mnd:fix-bootstrap-test-with-local-stage0, r=simulacrum
bootstrap: tests should use rustc from config.toml

Tests should always use "rustc" and "cargo" from config.toml instead of assuming that stage0 binaries was downloaded to build directory.

Without this change `./x.py test src/bootstrap` will always try to use `build/ARCH/stage0/bin/rustc` file as compiler, but when we use local compiler to bootstrap this file does not exist.
2018-07-03 11:31:04 +02:00
Pietro Albini 0ceeb1be31
Rollup merge of #51973 - estk:master, r=abonander
Make Stdio handle UnwindSafe

Closes  #51863

This is my first compiler PR. Thanks Niko for the mentor help!

r? @nikomatsakis
2018-07-03 11:31:03 +02:00
Pietro Albini bd0fe736be
Rollup merge of #51958 - euclio:attr-refactor, r=petrochenkov
Show known meta items in unknown meta items error

This PR adds a label to E0541. It also factors built-in attribute parsing into a submodule of `attr` for ease of future refactoring.

Fixes #51469.
2018-07-03 11:31:01 +02:00
Pietro Albini 451560e96c
Rollup merge of #51914 - nikomatsakis:nll-fix-issue-issue-btreemap-annotations, r=gankro
add outlives annotations to `BTreeMap`

NLL requires these annotations, I believe because of <https://github.com/rust-lang/rust/issues/29149>.

Fixes #48224

r? @Gankro
cc @lqd
2018-07-03 11:31:00 +02:00
Pietro Albini a3fc979b6b
Rollup merge of #51809 - drrlvn:rw_exact_all_at, r=alexcrichton
Add read_exact_at and write_all_at methods to FileExt on unix

This PR adds `FileExt::read_exact_at()` and `FileExt::write_all_at()`, which are to `read_at()` and `write_at()` as `read_exact()` and `write_all()` are to `read()` and `write()`. This allows the user to not have to deal with `ErrorKind::Interrupted` and calling the functions in a loop.

I was unsure as to how to mark these new methods so I marked them `unstable`, please let me know if I should have done it differently.

I asked in Discord and was told that as this change is small it does not require an RFC.
2018-07-03 11:30:59 +02:00
Pietro Albini 7fa03fb511
Rollup merge of #51548 - DiamondLovesYou:amdgpu-target-machine, r=alexcrichton
Initialize LLVM's AMDGPU target machine, if available.

Note this isn't useful, yet. More changes will be necessary to be able to
actually codegen for this machine. As such, it is not enabled by default.

This patch is on its own for the benefit of the reviewers.
2018-07-03 11:30:57 +02:00
Michael Woerister 447f1f3f5c Avoid sorting the item_ids array the StableHash impl of hir::Mod. 2018-07-03 11:16:38 +02:00
jD91mZM2 ea6f9f9c55
Remove stability attributes on private types and leftover docs 2018-07-03 11:13:16 +02:00
bors 64f8ae08fd Auto merge of #51889 - spastorino:make-causal-tracking-lazy, r=nikomatsakis
Make causal tracking lazy

Closes #51710

r? @nikomatsakis
2018-07-03 09:08:58 +00:00
bors 8fa9bfeb15 Auto merge of #51695 - est31:stdsimd_update, r=alexcrichton
Update stdsimd

Closes #51691
2018-07-03 07:06:46 +00:00
bors 0fb6e3994f Auto merge of #51564 - SimonSapin:try-int, r=alexcrichton
Implement always-fallible TryFrom for usize/isize conversions that are infallible on some platforms

This reverts commit 837d6c7023 "Remove TryFrom impls that might become conditionally-infallible with a portability lint".

This fixes #49415 by adding (restoring) missing `TryFrom` impls for integer conversions to or from `usize` or `isize`, by making them always fallible at the type system level (that is, with `Error=TryFromIntError`) even though they happen to be infallible on some platforms (for some values of `size_of::<usize>()`).

They had been removed to allow the possibility to conditionally having some of them be infallible `From` impls instead, depending on the platforms, and have the [portability lint](https://github.com/rust-lang/rfcs/pull/1868) warn when they are used in code that is not already opting into non-portability. For example `#[allow(some_lint)] usize::from(x: u64)` would be valid on code that only targets 64-bit platforms.

This PR gives up on this possiblity for two reasons:

* Based on discussion with @aturon, it seems that the portability lint is not happening any time soon. It’s better to have the conversions be available *at all* than keep blocking them for so long. Portability-lint-gated platform-specific APIs can always be added separately later.

* For code that is fine with fallibility, the alternative would force it to opt into "non-portability" even though there would be no real portability issue.
2018-07-03 04:08:02 +00:00
toidiu 1c571fd17f test to capture that cross crate outlives requirements are not inferred 2018-07-02 22:25:49 -04:00
bors 81d5c3e783 Auto merge of #51428 - alexreg:uninitialized-statics-simplification, r=oli-obk
Removed `uninitialized_statics` field from `Memory` struct in miri

based on #51110

r? @oli-obk

CC @eddyb
2018-07-03 02:01:49 +00:00
bors 9078d3cdbc Auto merge of #51991 - oli-obk:clippy, r=kennytm
Update the clippy submodule

nth time is the charm? `x.py test src/tools/clippy` passes locally

r? @kennytm
2018-07-02 23:50:13 +00:00
Mark Rousskov 9eda4aabff Change --keep-stage to apply more
Previously, the --keep-stage argument would only function for compilers
that were depended on by future stages. For example, if trying to build
a stage 1 compiler you could --keep-stage 0 to avoid re-building the
stage 0 compiler. However, this is often not what users want in
practice.

The new implementation essentially skips builds all higher stages of the
compiler, so an argument of 1 to keep-stage will skip rebuilds of the
libraries, just linking them into the sysroot. This is unlikely to work
well in cases where metadata or similar changes have been made, but is
likely fine otherwise.

This change is somewhat untested, but since it shouldn't have any effect
except with --keep-stage, I don't see that as a large problem.
2018-07-02 16:12:56 -06:00
kennytm 20231d774b
Fixed detection of test-fail for doctests. 2018-07-03 05:53:18 +08:00
kennytm d91457495b
Fix the tool's path in toolstate verification.
This ensure we do block the tools when they are broken during an update.
2018-07-03 05:22:35 +08:00
Alex Crichton c4f6f908bb Update LLVM to bring in a wasm codegen fix
Closes #51986
2018-07-02 13:55:58 -07:00
Mark Rousskov f5570d0ef6 Make explicit that assemble is not run from CLI 2018-07-02 14:46:40 -06:00
Pramod Bisht 09df6a0aba Address #51813 2018-07-03 02:00:05 +05:30
bors c8df60a146 Auto merge of #51944 - MajorBreakfast:generic-future-obj, r=cramertj
Make custom trait object for `Future` generic

- `TaskObj` -> `FutureObj<'static, ()>`
- The `impl From<...> for FutureObj<'a, T>` impls are impossible because of the type parameter `T`. The impl has to live in libstd, but `FutureObj<'a, T>` is from libcore. Therefore `Into<FutureObj<'a, T>>` was implemented instead. Edit: This didn‘t compile without warnings. I am now using non-generic Form impls.

See https://github.com/rust-lang-nursery/futures-rs/issues/1058

r? @cramertj

Edit: Added lifetime
2018-07-02 20:12:00 +00:00
Evan Simmons 9797665b28 Make Stdio handle UnwindSafe 2018-07-02 12:54:30 -07:00
varkor adf4ef7b98 Use LitToConstError rather than bool for errors 2018-07-02 19:44:27 +01:00
varkor 4d66b65850 Fix issue-50585 test 2018-07-02 19:44:27 +01:00
varkor 90eee7dff2 Remove early error abort 2018-07-02 19:44:27 +01:00
varkor 0195714836 Fix ICEs with match/return expressions inside array lengths 2018-07-02 19:44:27 +01:00
varkor 30fde04780 Clean up error messages regarding break/continue inside consts 2018-07-02 19:44:27 +01:00
varkor b00050f4cf Add more safeguards to "missing binding mode" errors 2018-07-02 19:44:27 +01:00
varkor 998141f8ef Fix another return-const ICE 2018-07-02 19:43:16 +01:00
varkor 7ad1c62d38 Fix an ICE using break and continue as array lengths 2018-07-02 19:43:16 +01:00
varkor c6bbee802a Fix a bug with return in anonymous consts 2018-07-02 19:43:16 +01:00
bors 9363342be9 Auto merge of #51896 - nikomatsakis:nll-liveness-dirty-list, r=Zoxc
introduce dirty list to liveness, eliminate `ins` vector

At least in my measurements, this seems to knock much of the liveness computation off the profile.

r? @Zoxc
cc @nnethercote
2018-07-02 18:09:20 +00:00
Josef Reinhard Brandl e666c2bd07 Implemented `UnsafeFutureObj` on `Box` 2018-07-02 19:21:32 +02:00
Josef Reinhard Brandl ae408947de Implement `UnsafeFutureObj` for `&mut Future` 2018-07-02 19:07:59 +02:00
Oliver Schneider 239a0ffeee Update the clippy submodule 2018-07-02 19:07:35 +02:00
Josef Reinhard Brandl 5fde8b9237 Remove unnecessary `PhantomData` field 2018-07-02 18:57:58 +02:00
Josef Reinhard Brandl cb2c7570db Add explanation for custom trait object 2018-07-02 18:55:42 +02:00
Nikolai Merinov ddc1d29442 bootstrap: tests should use rustc from config.toml
Tests should always use "rustc" and "cargo" from config.toml instead
of assuming that stage0 binaries was downloaded to build directory.
2018-07-02 21:28:58 +05:00
est31 56e46255b3 Add some more additional functions to the shim
They are all needed now due to the stdsimd update.
2018-07-02 18:23:57 +02:00
Alexander Regueiro 6660c25045 Updated miri submodule. 2018-07-02 17:18:38 +01:00
Josef Reinhard Brandl 9eee0d2288 Fix naming convention issue 2018-07-02 18:16:36 +02:00
bors b58b721921 Auto merge of #51321 - zackmdavis:hiridification_generations, r=eddyb
HirId-ification, continued

Another incremental step towards the vision of #50928 (previously: #50929).

r? @michaelwoerister
2018-07-02 16:04:54 +00:00
Niko Matsakis 59f2edbf1a add outlives annotations to `BTreeMap`
nll requires these annotations, I believe because of
https://github.com/rust-lang/rust/issues/29149
2018-07-02 11:49:33 -04:00
Niko Matsakis 78ea95258d improve comments 2018-07-02 11:40:49 -04:00
Niko Matsakis 90ea49b891 introduce `predicates_defined_on` for traits
This new query returns only the predicates *directly defined* on an
item (in contrast to the more common `predicates_of`, which returns
the predicates that must be proven to reference an item). These two
sets are almost always identical except for traits, where
`predicates_of` includes an artificial `Self: Trait<...>` predicate
(basically saying that you cannot use a trait item without proving
that the trait is implemented for the type parameters).

This new query is only used in chalk lowering, where this artificial
`Self: Trait` predicate is problematic. We encode it in metadata but
only where needed since it is kind of repetitive with existing
information.

Co-authored-by: Tyler Mandry <tmandry@gmail.com>
2018-07-02 11:33:24 -04:00
Niko Matsakis 327093007a add `is_trait(DefId)` helper to `TyCtxt`
Co-authored-by: Tyler Mandry <tmandry@gmail.com>
2018-07-02 10:38:37 -04:00
Niko Matsakis 7bbbed9046 drive-by nits and debug
Co-authored-by: Tyler Mandry <tmandry@gmail.com>
2018-07-02 10:38:35 -04:00
Niko Matsakis c9d4f0615f use `ty::TraitRef::identity` where possible
Co-authored-by: Tyler Mandry <tmandry@gmail.com>
2018-07-02 10:38:33 -04:00
Niko Matsakis 5c15163cb9 prove defaults meet WF requirements, not that they are WF
If we have

```rust
struct Foo<T: Copy = String> { .. }
```

the old code would have proven that `String: Copy` was WF -- this,
incidentally, also proved that `String: Copy`. The new code just
proves `String: Copy` directly.

Co-authored-by: Tyler Mandry <tmandry@gmail.com>
2018-07-02 10:38:30 -04:00
Dror Levin 73166f751b Fill in tracking issue number for read_exact_at/write_all_at 2018-07-02 17:38:15 +03:00
Michael Woerister 79d8d087a3 incr.comp.: Take names of children into account when computing the ICH of a module's HIR. 2018-07-02 16:21:34 +02:00
Alexander Regueiro ea806e7815 Removed `uninitialized_statics` field from `Memory` struct in miri.
Refactored code accordingly.
2018-07-02 15:18:36 +01:00
bors 4faaf7e335 Auto merge of #51122 - oli-obk:clippy, r=Mark-Simulacrum
Did you mean to block nightlies on clippy?

Discussion: https://gitter.im/rust-lang/WG-clippy?at=5b073b6597a0361fb760cdc2

r? @alexcrichton

did I forget anything?

cc @nrc @Manishearth
2018-07-02 14:04:26 +00:00
Josef Reinhard Brandl 4e617291c2 Make `drop` method for `PinMut`'s `UnsafeFutureObj` impl empty 2018-07-02 13:59:40 +02:00
Josef Reinhard Brandl dd3b0337ff Improve doc comments for `FutureObj` 2018-07-02 13:59:40 +02:00
Josef Reinhard Brandl 042928f0f5 `UnsafeFutureObj` impl for `PinMut` 2018-07-02 13:59:40 +02:00
Josef Reinhard Brandl d8bf222367 Add lifetime to `FutureObj` 2018-07-02 13:59:40 +02:00
Josef Reinhard Brandl 9f70e7fe3c Use `From` impls for `FutureObj<()>` 2018-07-02 13:59:39 +02:00
Josef Reinhard Brandl 3d43f828f5 Make custom trait object for `Future` generic 2018-07-02 13:59:39 +02:00
bors e75e78256f Auto merge of #51645 - marco-c:error_when_incremental_and_profile, r=michaelwoerister
Raise an error if gcov profiling and incremental compilation are both enabled

Fixes #50203.
2018-07-02 11:58:45 +00:00
Oliver Schneider 78adefd15d Clippy tool also has only a single LICENSE file 2018-07-02 13:57:29 +02:00
est31 563dacd648 Update stdsimd 2018-07-02 12:53:46 +02:00
est31 3779a4cb74 Emit column info in debuginfo for non msvc like targets 2018-07-02 12:16:05 +02:00
Oliver Schneider 75a6fde6a4 Update rustdoc 2018-07-02 10:37:49 +02:00
Oliver Schneider 6d114399f8 Make sure clippy does not duplicate depenencies 2018-07-02 10:36:07 +02:00
bors a96c88e80f Auto merge of #51893 - nnethercote:BTreeMap-clone-noalloc, r=nnethercote
Make `BTreeMap::clone()` not allocate when cloning an empty tree.

r? @Gankro

CC @porglezomp
2018-07-02 08:28:12 +00:00
Oliver Schneider 6e5b9c1472 Get rid of `TyImplTraitExistential` 2018-07-02 09:17:38 +02:00
bors a53bd20fae Auto merge of #51931 - cramertj:rm-libbacktrace, r=alexcrichton
Use in-tree libbacktrace on Fuchsia

cc @abarth

r? @alexcrichton
(welcome back! 😄 )
2018-07-02 06:32:16 +00:00
Zack M. Davis f23d90a147 add FIXMEs pleading for post-@ edit of commentary on mem_categorization
(The present author fears not being knowledgeable enough to rewrite the
comments unilaterally; merely calling it out is a lazy half-measure, but
at least doesn't actively make things worse the way an ill-informed
rewrite would.)
2018-07-01 22:27:29 -07:00
Zack M. Davis 735d1bd5e6 use HirId in middle::mem_categorization::cmt_, and consequences of that
For the HirIdification initiative #50928.
2018-07-01 22:27:29 -07:00
bors 45935640f0 Auto merge of #51866 - zackmdavis:hir_making_each_day_of_the_year, r=petrochenkov
add modifier keyword spans to hir::Visibility; improve unreachable-pub, private-no-mangle lint suggestions

#50455 pointed out that the unreachable-pub suggestion for brace-grouped `use`s was bogus; #50476 partially ameliorated this by marking the suggestion as `Applicability::MaybeIncorrect`, but this is the actual fix.

Meanwhile, another application of having spans available in `hir::Visibility` is found in the private-no-mangle lints, where we can now issue a suggestion to use `pub` if the item has a more restricted visibility marker (this seems much less likely to come up in practice than not having any visibility keyword at all, but thoroughness is a virtue). While we're there, we can also add a helpful note if the item does have a `pub` (but triggered the lint presumably because enclosing modules were private).

![hir_vis](https://user-images.githubusercontent.com/1076988/42018064-ca830290-7a65-11e8-9c4c-48bc846f861f.png)

r? @nrc
cc @Manishearth
2018-07-02 03:18:49 +00:00
Esteban Küber e89db3030d Do not suggest changes to str literal if it isn't one 2018-07-01 20:03:35 -07:00
Nicholas Nethercote f46f05bae8 Make `BTreeMap::clone()` not allocate when cloning an empty tree. 2018-07-02 13:03:31 +10:00
bors 5df43114bc Auto merge of #51864 - est31:libc_update, r=alexcrichton
Update liblibc

This updates the libc submodule
2018-07-02 01:16:13 +00:00
Santiago Pastorino 71f25b408d
Run rustfmt 2018-07-01 20:46:07 -03:00
Santiago Pastorino 0957ede502
Make causal tracking lazy 2018-07-01 20:46:07 -03:00
Santiago Pastorino 24f91e8782
Move find_use stuff to it's own file 2018-07-01 20:46:07 -03:00
Santiago Pastorino b2d16f3b96
let add_element return by itself 2018-07-01 20:46:07 -03:00
bors c697a56d01 Auto merge of #51110 - alexreg:new-static-eval-rules, r=eddyb
Loosened rules involving statics mentioning other statics

Before this PR, trying to mention a static in any way other than taking a reference to it caused a compile-time error. So, while

```rust
static A: u32 = 42;
static B: &u32 = &A;
```

compiles successfully,

```rust
static A: u32 = 42;
static B: u32 = A; // error
```

and

```rust
static A: u32 = 42;
static B: u32 = *&A; // error
```

are not possible to express in Rust. On the other hand, introducing an intermediate `const fn` can presently allow one to do just that:

```rust
static A: u32 = 42;
static B: u32 = foo(&A); // success!

const fn foo(a: &u32) -> u32 {
    *a
}
```

Preventing `const fn` from allowing to work around the ban on reading from statics would cripple `const fn` almost into uselessness.
Additionally, the limitation for reading from statics comes from the old const evaluator(s) and is not shared by `miri`.

This PR loosens the rules around use of statics to allow statics to evaluate other statics by value, allowing all of the above examples to compile and run successfully.
Reads from extern (foreign) statics are however still disallowed by miri, because there is no compile-time value to be read.

```rust
extern static A: u32;

static B: u32 = A; // error
```

This opens up a new avenue of potential issues, as a static can now not just refer to other statics or read from other statics, but even contain references that point into itself.
While it might seem like this could cause subtle bugs like allowing a static to be initialized by its own value, this is inherently impossible in miri.
Reading from a static causes the `const_eval` query for that static to be invoked. Calling the `const_eval` query for a static while already inside the `const_eval` query of said static will cause cycle errors.
It is not possible to accidentally create a bug in miri that would enable initializing a static with itself, because the memory of the static *does not exist* while being initialized.
The memory is not uninitialized, it is not there. Thus any change that would accidentally allow reading from a not yet initialized static would cause ICEs.

Tests have been modified according to the new rules, and new tests have been added for writing to `static mut`s within definitions of statics (which needs to fail), and incremental compilation with complex/interlinking static definitions.
Note that incremental compilation did not need to be adjusted, because all of this was already possible before with workarounds (like intermediate `const fn`s) and the encoding/decoding already supports all the possible cases.

r? @eddyb
2018-07-01 23:00:27 +00:00
bors a7a60dc7f8 Auto merge of #51969 - pietroalbini:rollup, r=pietroalbini
Rollup of 7 pull requests

Successful merges:

 - #51511 (Stabilize Iterator::flatten in 1.29, fixes #48213.)
 - #51853 (Fix some doc links)
 - #51890 (Fix inconsequential typo in GlobalAlloc doc example)
 - #51920 (use literal span for concrete type suggestion)
 - #51921 (improve the error message when `#[panic_implementation]` is missing)
 - #51922 (rename the llvm-tools component to llvm-tools-preview and tweak its image)
 - #51961 (Fix typo in /src/librustc_resolve/lib.rs)

Failed merges:

r? @ghost
2018-07-01 20:48:57 +00:00
Pietro Albini 3e95491be7
Rollup merge of #51961 - 11Takanori:fix-typo, r=petrochenkov
Fix typo in /src/librustc_resolve/lib.rs

absoluate -> absolute
2018-07-01 21:18:51 +02:00
Pietro Albini c78bfa33dd
Rollup merge of #51922 - japaric:llvm-tools-preview, r=alexcrichton
rename the llvm-tools component to llvm-tools-preview and tweak its image

as per https://github.com/rust-lang/rust/issues/49584#issuecomment-401217483

r? @alexcrichton or @Mark-Simulacrum
2018-07-01 21:18:50 +02:00
Pietro Albini 87b714b619
Rollup merge of #51921 - japaric:panic-impl-error, r=nagisa
improve the error message when `#[panic_implementation]` is missing

closes #51341

r? @nagisa
cc @phil-opp
2018-07-01 21:18:49 +02:00
Pietro Albini 3f5d2fd850
Rollup merge of #51920 - euclio:concrete-type-suggestion, r=estebank
use literal span for concrete type suggestion

Fixes #51874.

r? @estebank
2018-07-01 21:18:47 +02:00
Pietro Albini 255c26b4f7
Rollup merge of #51890 - Ixrec:patch-3, r=alexcrichton
Fix inconsequential typo in GlobalAlloc doc example
2018-07-01 21:18:46 +02:00
Pietro Albini 1e50629772
Rollup merge of #51853 - MajorBreakfast:fix-doc-links, r=cramertj
Fix some doc links

The futures crate CI always fails because of these intra doc links. I hope that this will fix this issue.

r? @steveklabnik
@cramertj

Edit: I added @steveklabnik as reviewer because this PR also adjusts a link in `src/libstd/error.rs`
2018-07-01 21:18:45 +02:00
Pietro Albini 0f8343830b
Rollup merge of #51511 - Centril:feature/stabilize_iterator_flatten, r=SimonSapin
Stabilize Iterator::flatten in 1.29, fixes #48213.

This PR stabilizes [`Iterator::flatten`](https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.flatten) in *version 1.29* (1.28 goes to beta in 10 days, I don't think there's enough time to land it in that time, but let's see...).

Tracking issue is:  #48213.

cc @bluss re. itertools.
r? @SimonSapin
ping @pietroalbini -- let's do a crater run when this passes CI :)
2018-07-01 21:18:43 +02:00
bors a2be769fd5 Auto merge of #51833 - wesleywiser:faster_large_constant_arrays, r=oli-obk
Speed up compilation of large constant arrays

This is a different approach to #51672 as suggested by @oli-obk. Rather
than write each repeated value one-by-one, we write the first one and
then copy its value directly into the remaining memory.

With this change, the [toy program](c2f4744d2d/src/test/run-pass/mir_heavy_promoted.rs) goes from 63 seconds to 19 seconds on my machine.

Edit: Inlining `Size::bytes()` saves an additional 6 seconds dropping the total time to 13 seconds on my machine.

Edit2: Now down to 2.8 seconds.

r? @oli-obk

cc @nnethercote @eddyb
2018-07-01 18:43:41 +00:00