bors [Fri, 31 Aug 2018 14:06:14 +0000 (14:06 +0000)]
Auto merge of #53699 - oli-obk:promotion_stability_hole, r=nikomatsakis
Fix promotion stability hole in old borrowck
r? @nikomatsakis
I screwed up the promotion stability checks. Big time. They were basically nonexistant. We had tests for it. I also screwed up said tests. This is in stable already :(
Basically stability checks of promotion only worked if you tried to use a const fn defined in the same crate.
bors [Fri, 31 Aug 2018 03:35:33 +0000 (03:35 +0000)]
Auto merge of #53832 - pietroalbini:rollup, r=pietroalbini
Rollup of 20 pull requests
Successful merges:
- #51760 (Add another PartialEq example)
- #53113 (Add example for Cow)
- #53129 (remove `let x = baz` which was obscuring the real error)
- #53389 (document effect of join on memory ordering)
- #53472 (Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.)
- #53476 (Add partialeq implementation for TryFromIntError type)
- #53513 (Force-inline `shallow_resolve` at its hottest call site.)
- #53655 (set applicability)
- #53702 (Fix stabilisation version for macro_vis_matcher.)
- #53727 (Do not suggest dereferencing in macro)
- #53732 (save-analysis: Differentiate foreign functions and statics.)
- #53740 (add llvm-readobj to llvm-tools-preview)
- #53743 (fix a typo: taget_env -> target_env)
- #53747 (Rustdoc fixes)
- #53753 (expand keep-stage --help text)
- #53756 (Fix typo in comment)
- #53768 (move file-extension based .gitignore down to src/)
- #53785 (Fix a comment in src/libcore/slice/mod.rs)
- #53786 (Replace usages of 'bad_style' with 'nonstandard_style'.)
- #53806 (Fix UI issues on Implementations on Foreign types)
bors [Fri, 31 Aug 2018 01:18:42 +0000 (01:18 +0000)]
Auto merge of #53779 - RalfJung:miri-refactor, r=oli-obk
Miri refactor: Final round
Tying up some loose ends that I noticed in the previous PRs -- and finally getting argument passing into a shape where @eddyb says it is "okay", which is a big improvement over the previous verdict that I cannot quote in public. ;)
Also move a bunch of useful helpers to construct `Scalar` from miri to here.
bors [Thu, 30 Aug 2018 22:54:34 +0000 (22:54 +0000)]
Auto merge of #53828 - alexcrichton:dist-llvm-shared, r=japaric
rustbuild: Distribute libLLVM.so with rustc
A recent change (#53245) started to build LLVM with ThinLTO enabled and to
ensure that compile times are kept down it builds LLVM dynamically by default to
ensure that all the various LLVM tools aren't redoing all that optimization
work. This means, however, that all LLVM tools depend on LLVM's dynamic library
by default.
While the LLVM tools and LLDB components were updated to include the shared
library we accidentally forgot about LLD, included with the main rustc
component. LLD also links dynamically to LLVM and ships a non-working binary
right now because of this!
This commit updates our distribution to ship the LLVM dynamic library with the
compiler libraries. While not technically needed for rustc itself to operate
(right now) it may be needed for LLD, and otherwise it serves as a good basis
for the other LLVM tools components to work with as well.
Pietro Albini [Thu, 30 Aug 2018 18:15:44 +0000 (20:15 +0200)]
Rollup merge of #53768 - RalfJung:gitignore, r=nikomatsakis
move file-extension based .gitignore down to src/
Currently, it for example ignores `*.rlib` files in the repository root -- which I think is wrong; I sometimes get these files when I call rustc directly and I do want them cleaned up, not ignored. No such files are created during the normal build process.
Pietro Albini [Thu, 30 Aug 2018 18:15:39 +0000 (20:15 +0200)]
Rollup merge of #53743 - oconnor663:target_env, r=kennytm
fix a typo: taget_env -> target_env
This typo was introduced in https://github.com/rust-lang/rust/pull/47334. A couple tests bitrotted as a result, so we fix those too, and move them to a more sensible place.
Is there some lint we could turn on that would've caught this? It's a drag that cfg typos can silently pass through the compiler.
Pietro Albini [Thu, 30 Aug 2018 18:15:38 +0000 (20:15 +0200)]
Rollup merge of #53740 - japaric:readobj, r=alexcrichton
add llvm-readobj to llvm-tools-preview
Similar to readelf but supports more object formats (it seems). Particularly useful to inspect in detail sections (e.g. their flags) and symbols (e.g. their types).
Users ask this question in [ruRust](https://gitter.im/ruRust/general) chat time to time and it is not obvious to add `ToOwned<Owned=Target>` to requirements of generic params.
bors [Thu, 30 Aug 2018 17:29:13 +0000 (17:29 +0000)]
Auto merge of #53803 - pietroalbini:fix-manifest-2, r=alexcrichton
Fix manifests for broken tools: take 2
This is a follow up of #53715, to avoid stripping unavailable components from the extensions list. This time I also figured out how to test the changes, so the produced manifest is correct.
Along with the fix I added a README with instructions on how to test the tool, and a new `BUILD_MANIFEST_DISABLE_SIGNING` env var to avoid dealing with gpg while testing the tool. I chose an env var instead of a flag because it's more difficult to have it slip in by accident on CI, and there is also another protection that panics if that env var is set on CI, just to be sure we don't release unsigned artifacts.
r? @alexcrichton
cc https://github.com/rust-lang-nursery/rustup.rs/issues/1486
Alex Crichton [Thu, 30 Aug 2018 16:43:15 +0000 (09:43 -0700)]
rustbuild: Distribute libLLVM.so with rustc
A recent change (#53245) started to build LLVM with ThinLTO enabled and to
ensure that compile times are kept down it builds LLVM dynamically by default to
ensure that all the various LLVM tools aren't redoing all that optimization
work. This means, however, that all LLVM tools depend on LLVM's dynamic library
by default.
While the LLVM tools and LLDB components were updated to include the shared
library we accidentally forgot about LLD, included with the main rustc
component. LLD also links dynamically to LLVM and ships a non-working binary
right now because of this!
This commit updates our distribution to ship the LLVM dynamic library with the
compiler libraries. While not technically needed for rustc itself to operate
(right now) it may be needed for LLD, and otherwise it serves as a good basis
for the other LLVM tools components to work with as well.
bors [Thu, 30 Aug 2018 03:30:23 +0000 (03:30 +0000)]
Auto merge of #53685 - alexcrichton:more-keywords, r=varkor
Generalize `async_idents` to all new keywords
This commit generalizes the existing `async_idents` lint to easily encompass
other identifiers that will be keywords in future editions. The new lint is
called `keyword_idents` and the old `async_idents` lint is registered as renamed
to this new lint.
As a proof of concept the `try` keyword was added to this list as it looks to be
listed as a keyword in the 2018 edition only. The `await` keyword was not added
as it's not listed as a keyword yet.
bors [Wed, 29 Aug 2018 20:08:16 +0000 (20:08 +0000)]
Auto merge of #53564 - MaloJaffre:vecdeque, r=gnzlbg
Reoptimize VecDeque::append
~Unfortunately, I don't know if these changes fix the unsoundness mentioned in #53529, so it is stil a WIP.
This is also completely untested.
The VecDeque code contains other unsound code: one example : [reading unitialized memory](https://play.rust-lang.org/?gist=6ff47551769af61fd8adc45c44010887&version=nightly&mode=release&edition=2015) (detected by MIRI), so I think this code will need a bigger refactor to make it clearer and safer.~
Note: this is based on #53571.
r? @SimonSapin Cc: #53529 #52553 @YorickPeterse @jonas-schievink @Pazzaz @shepmaster.
Alex Crichton [Fri, 24 Aug 2018 20:48:20 +0000 (13:48 -0700)]
Generalize `async_idents` to all new keywords
This commit generalizes the existing `async_idents` lint to easily encompass
other identifiers that will be keywords in future editions. The new lint is
called `keyword_idents` and the old `async_idents` lint is registered as renamed
to this new lint.
As a proof of concept the `try` keyword was added to this list as it looks to be
listed as a keyword in the 2018 edition only. The `await` keyword was not added
as it's not listed as a keyword yet.
bors [Wed, 29 Aug 2018 08:42:20 +0000 (08:42 +0000)]
Auto merge of #53711 - arielb1:macro-table, r=michaelwoerister
create a valid DefIdTable for proc macro crates
At least the incremental compilation code, and a few other places in the
compiler, require the CrateMetadata for a loaded target crate to contain a
valid DefIdTable for the DefIds in the target.
Previously, the CrateMetadata for a proc macro contained the crate's
"host" DefIdTable, which is of course incompatible with the "target"
DefIdTable, causing ICEs. This creates a DefIdTable that properly refers
to the "proc macro" DefIds.
bors [Wed, 29 Aug 2018 06:24:30 +0000 (06:24 +0000)]
Auto merge of #53684 - alexcrichton:suggest-remove, r=oli-obk
rustc: Suggest removing `extern crate` in 2018
This commit updates the `unused_extern_crates` lint to make automatic
suggestions about removing `extern crate` annotations in the 2018 edition. This
ended up being a little easier than originally though due to what's likely been
fixed issues in the resolver!
bors [Wed, 29 Aug 2018 02:08:02 +0000 (02:08 +0000)]
Auto merge of #53642 - alexcrichton:fix-target-cpu-native, r=arielb1
Fix warnings about the `native` target-cpu
This fixes a regression from #53031 where specifying `-C target-cpu=native` is
printing a lot of warnings from LLVM about `native` being an unknown CPU. It
turns out that `native` is indeed an unknown CPU and we have to perform a
mapping to an actual CPU name, but this mapping is only performed in one
location rather than all locations we inform LLVM about the target CPU.
This commit centralizes the mapping of `native` to LLVM's value of the native
CPU, ensuring that all locations we inform LLVM about the `target-cpu` it's
never `native`.
bors [Wed, 29 Aug 2018 00:02:37 +0000 (00:02 +0000)]
Auto merge of #53671 - RalfJung:miri-refactor, r=oli-obk
Miri engine cleanup
* Unify the two maps in memory to store the allocation and its kind together.
* Share the handling of statics between CTFE and miri: The miri engine always
uses "lazy" `AllocType::Static` when encountering a static. Acessing that
static invokes CTFE (no matter the machine). The machine only has any
influence when writing to a static, which CTFE outright rejects (but miri
makes a copy-on-write).
* Add an `AllocId` to by-ref consts so miri can use them as operands without
making copies.
* Move responsibilities around for the `eval_fn_call` machine hook: The hook
just has to find the MIR (or entirely take care of everything); pushing the
new stack frame is taken care of by the miri engine.
* Expose the intrinsics and lang items implemented by CTFE so miri does not
have to reimplement them.
* Allow Machine to hook into foreign statics (used by miri to get rid of some other hacks).
* Clean up function calling.
* Switch const sanity check to work on operands, not mplaces.
* Move const_eval out of rustc_mir::interpret, to make sure that it does not access private implementation details.
In particular, we can finally make `eval_operand` take `&self`. :-)
Should be merged after https://github.com/rust-lang/rust/pull/53609, across which I will rebase.
Alex Crichton [Thu, 23 Aug 2018 18:03:22 +0000 (11:03 -0700)]
Fix warnings about the `native` target-cpu
This fixes a regression from #53031 where specifying `-C target-cpu=native` is
printing a lot of warnings from LLVM about `native` being an unknown CPU. It
turns out that `native` is indeed an unknown CPU and we have to perform a
mapping to an actual CPU name, but this mapping is only performed in one
location rather than all locations we inform LLVM about the target CPU.
This commit centralizes the mapping of `native` to LLVM's value of the native
CPU, ensuring that all locations we inform LLVM about the `target-cpu` it's
never `native`.
bors [Tue, 28 Aug 2018 16:23:27 +0000 (16:23 +0000)]
Auto merge of #53679 - japaric:cortex-r, r=alexcrichton
add more Cortex-R targets
This expands on PR #53663 to complete the set of Cortex-R targets and builds
rust-std components for them.
r? @alexcrichton
each extra rust-std component (there's 4 of them) takes about 3 minutes to build
on my local machine. In terms of stability (LLVM codegen bugs) these new targets
should be as stable as the Cortex-M ones (e.g. `thumbv7m-none-eabi`).
If the extra build time is too much we can leave the rust-std components out for
now
bors [Tue, 28 Aug 2018 13:12:16 +0000 (13:12 +0000)]
Auto merge of #53493 - matthewjasper:hair-spans, r=nikomatsakis
Use smaller span for adjustments on block expressions
When returning a mutable reference don't use the entire body of the function as the span for the adjustments at the end.
The error [in this case](https://github.com/rust-lang/rust/compare/master...matthewjasper:hair-spans?expand=1#diff-ecef8b1f15622fb48a803c9b61605c78) is worse, but neither error message is really what we want. I have some ideas on how to get a better error message that will have to wait for a future PR.
bors [Tue, 28 Aug 2018 06:44:12 +0000 (06:44 +0000)]
Auto merge of #53616 - varkor:hir-map-rename, r=nikomatsakis
Restructure hir::map::Node and hir::map::Entry
- Moves `hir::map::Node` to `hir::Node` and removes the `Node*` prefix from its variants.
- Changes `hir::map::Entry` to a struct `hir::map::Entry`.
- Removes the `Node*` prefix from each of `AnnNode`s variants.
bors [Tue, 28 Aug 2018 03:22:21 +0000 (03:22 +0000)]
Auto merge of #53404 - oconnor663:current_dir_behavior, r=alexcrichton
document the platform-specific behavior of Command::current_dir
See also https://github.com/rust-lang/rust/issues/37868.
Here's my initial wording:
> Note that if the program path is relative (e.g. `"./script.sh"`), the interaction between that path and `current_dir` varies across platforms. Windows currently ignores `current_dir` when locating the program, but Unix-like systems interpret the program path relative to `current_dir`. These implementation details aren't considered stable, and it's recommended to call `canonicalize` to get an absolute program path instead of using relative paths and `current_dir` together.
I'd like to get feedback on:
- _Should_ we consider those details stable? It might be disruptive to change them, regardless of what I can get away with claiming in docs :)
- Is `canonicalize` an appropriate recommendation? As discussed in #37868 above, there are reasons it's not called automatically in the `Command` implementation.
bors [Tue, 28 Aug 2018 01:04:05 +0000 (01:04 +0000)]
Auto merge of #53272 - mark-i-m:anon_param_error_now, r=nikomatsakis
Warn on anon params in 2015 edition
cc #41686 https://github.com/rust-lang/rfcs/pull/2522
cc @Centril @nikomatsakis
TODO:
- [x] Make sure the tests pass.
- [x] Make sure there is rustfix-able suggestion. Current plan is to just suggest `_ : Foo`
- [x] Add a rustfix ui test.
EDIT: It seems I already did the last two in #48309
bors [Mon, 27 Aug 2018 22:56:15 +0000 (22:56 +0000)]
Auto merge of #53227 - nivkner:pin_move, r=RalfJung
move the Pin API into its own module for centralized documentation
This implements the change proposed by @withoutboats in #49150, as suggested by @RalfJung in the review of #53104,
along with the documentation that was originally in it, that was deemed more appropriate in module-level documentation.