]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agogenerate ClosureSubsts from SubstsRef
csmoe [Thu, 26 Sep 2019 17:30:44 +0000 (17:30 +0000)]
generate ClosureSubsts from SubstsRef

4 years agoremove ClosureSubsts with SubstsRef
csmoe [Thu, 26 Sep 2019 16:11:23 +0000 (16:11 +0000)]
remove ClosureSubsts with SubstsRef

4 years agoclean ClosureSubsts in rustc::ty
csmoe [Thu, 26 Sep 2019 16:09:51 +0000 (16:09 +0000)]
clean ClosureSubsts in rustc::ty

4 years agointroduce from_ref helper for replacement
csmoe [Thu, 26 Sep 2019 14:23:13 +0000 (22:23 +0800)]
introduce from_ref helper for replacement

4 years agoAuto merge of #64546 - weiznich:bugfix/rfc-2451-rerebalance-tests, r=nikomatsakis
bors [Sun, 29 Sep 2019 09:52:58 +0000 (09:52 +0000)]
Auto merge of #64546 - weiznich:bugfix/rfc-2451-rerebalance-tests, r=nikomatsakis

Bugfix/rfc 2451 rerebalance tests

r? @nikomatsakis

Fixes #64412
Depends/Contains on #64414

cc #55437 and #63599

4 years agoAuto merge of #64886 - Centril:rollup-30dqh8j, r=Centril
bors [Sun, 29 Sep 2019 06:08:50 +0000 (06:08 +0000)]
Auto merge of #64886 - Centril:rollup-30dqh8j, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #63492 (Remove redundancy from the implementation of C variadics.)
 - #64589 (Differentiate AArch64 bare-metal targets between hf and non-hf.)
 - #64799 (Fix double panic when printing query stack during an ICE)
 - #64824 (No StableHasherResult everywhere)
 - #64884 (Add pkg-config to dependency list if building for Linux on Linux)

Failed merges:

r? @ghost

4 years agoRollup merge of #64884 - jakevossen5:master, r=Mark-Simulacrum
Mazdak Farrokhzad [Sun, 29 Sep 2019 02:36:04 +0000 (04:36 +0200)]
Rollup merge of #64884 - jakevossen5:master, r=Mark-Simulacrum

Add pkg-config to dependency list if building for Linux on Linux

I got this message when building from source on Ubuntu:

```
It looks like you're compiling on Linux and also targeting Linux. Currently this
requires the `pkg-config` utility to find OpenSSL but unfortunately `pkg-config`
could not be found. If you have OpenSSL installed you can likely fix this by
installing `pkg-config`.
```

I feel like it would be a better experience to show this in the dependencies instead of having to run into this issue.

4 years agoRollup merge of #64824 - Mark-Simulacrum:no-stable-hasher-result-everywhere, r=michae...
Mazdak Farrokhzad [Sun, 29 Sep 2019 02:36:02 +0000 (04:36 +0200)]
Rollup merge of #64824 - Mark-Simulacrum:no-stable-hasher-result-everywhere, r=michaelwoerister

No StableHasherResult everywhere

This removes the generic parameter on `StableHasher`, instead moving it to the call to `finish`. This has the side-effect of making all `HashStable` impls nicer, since we no longer need the verbose `<W: StableHasherResult>` that previously existed -- often forcing line wrapping.

This is done for two reasons:
 * we should avoid false "generic" dependency on the result of StableHasher
     * we don't need to codegen two/three copies of all the HashStable impls when they're transitively used to produce a fingerprint, u64, or u128. I haven't measured, but this might actually make our artifacts somewhat smaller too.
 * Easier to understand/read/write code -- the result of the stable hasher is irrelevant when writing a hash impl.

4 years agoRollup merge of #64799 - Aaron1011:fix/double-panic, r=Mark-Simulacrum
Mazdak Farrokhzad [Sun, 29 Sep 2019 02:36:01 +0000 (04:36 +0200)]
Rollup merge of #64799 - Aaron1011:fix/double-panic, r=Mark-Simulacrum

Fix double panic when printing query stack during an ICE

On the latest nightly, any call to `bug` or `span_bug` will result in two panics - the first one as a normal result of calling `bug` / `span_bug`, and the second as a result of trying to print the query stack from the panic handler. This is caused by the query-printing code attempting to acquire a lock on `HandlerInnder`, which is still being held by `bug`.

This PR moves the actual panic out of `HandlerInner`, into `Handler`. This allows us to release the lock on `HandlerInner` before triggering the panic, ensuring that the panic handler will be able to acquire the lock if necessary.

4 years agoRollup merge of #64589 - andre-richter:aarch64_bare_metal, r=Amanieu
Mazdak Farrokhzad [Sun, 29 Sep 2019 02:35:59 +0000 (04:35 +0200)]
Rollup merge of #64589 - andre-richter:aarch64_bare_metal, r=Amanieu

Differentiate AArch64 bare-metal targets between hf and non-hf.

CC @parched, kindly request you to review.

~~Note: This change breaks code that uses the target `aarch64-unknown-none` for the sake of clearer naming as discussed in the links posted below. A search on github reveals that code using `aarch64-unknown-none` is almost exclusively forked from our embedded WG's OS tutorials repo at https://github.com/rust-embedded/rust-raspi3-OS-tutorials, for which the target was originally created.~~

~~I will adapt this repo to the new target name asap once this PR would go upstream. The minor annoyance for the forks to break temporarily should be acceptable for the sake of introducing a better differentiation now before it is too late.
Also, the break would only happen upon updating the toolchain, giving the user a good hint at what has happened.~~

---------- Patch commit message:
Following up on [1] and [2], this PR adds differntiation for aarch64 bare-metal
targets between versions with and without floating point enabled.

This streamlines the target naming with other existing ARM targets and provides
the user clear indication if he is getting float or non-float for his bare-metal
target.

[1] https://github.com/rust-lang/rust/pull/60135#issuecomment-485851356
[2] https://github.com/rust-embedded/wg/issues/230

Closes: rust-embedded/wg#230
4 years agoRollup merge of #63492 - eddyb:cvarargs, r=nagisa,matthewjasper
Mazdak Farrokhzad [Sun, 29 Sep 2019 02:35:58 +0000 (04:35 +0200)]
Rollup merge of #63492 - eddyb:cvarargs, r=nagisa,matthewjasper

Remove redundancy from the implementation of C variadics.

This cleanup was first described in https://github.com/rust-lang/rust/issues/44930#issuecomment-497163539:

* AST doesn't track `c_variadic: bool` anymore, relying solely on a trailing `CVarArgs` type in fn signatures
* HIR doesn't have a `CVarArgs` anymore, relying solely on `c_variadic: bool`
  * same for `ty::FnSig` (see tests for diagnostics improvements from that)
  * `{hir,mir}::Body` have one extra argument than the signature when `c_variadic == true`
  * `rustc_typeck` and `rustc_mir::{build,borrowck}` need to give that argument the right type (which no longer uses a lifetime parameter, but a function-internal scope)
* `rustc_target::abi::call` doesn't need special hacks anymore (since it never sees the `VaListImpl` now, it's all inside the body)

r? @nagisa / @rkruppe cc @dlrobertson @oli-obk

4 years agoAuto merge of #64470 - ecstatic-morse:split-promotion-and-validation, r=eddyb,oli-obk
bors [Sun, 29 Sep 2019 02:33:15 +0000 (02:33 +0000)]
Auto merge of #64470 - ecstatic-morse:split-promotion-and-validation, r=eddyb,oli-obk

Implement dataflow-based const validation

This PR adds a separate, dataflow-enabled pass that checks the bodies of `const`s, `static`s and `const fn`s for [const safety](https://github.com/rust-rfcs/const-eval/blob/master/const.md). This is based on my work in #63860, which tried to integrate into the existing pass in [`qualify_consts.rs`](https://github.com/rust-lang/rust/blob/master/src/librustc_mir/transform/qualify_consts.rs). However, the resulting pass was even more unwieldy than the original. Unlike its predecessor, this PR is designed to be combined with #63812 to replace the existing pass completely.

The new checker lives in [`librustc_mir/transform/check_consts`](https://github.com/ecstatic-morse/rust/tree/split-promotion-and-validation/src/librustc_mir/transform/check_consts).

[`qualifs.rs`](https://github.com/ecstatic-morse/rust/blob/split-promotion-and-validation/src/librustc_mir/transform/check_consts/qualifs.rs) contains small modifications to the existing `Qualif` trait and its implementors, but is mostly unchanged except for the removal of `IsNotPromotable` and `IsNotImplicitlyPromotable`, which are only necessary for promotion.

[`resolver.rs`](https://github.com/ecstatic-morse/rust/blob/split-promotion-and-validation/src/librustc_mir/transform/check_consts/resolver.rs) contains the dataflow analysis used to propagate qualifs between locals.

Finally, [`validation.rs`](https://github.com/ecstatic-morse/rust/blob/split-promotion-and-validation/src/librustc_mir/transform/check_consts/validation.rs) contains a refactored version of the existing [`Visitor`](https://github.com/rust-lang/rust/blob/ca3766e2e58f462a20922e42c821a37eaf0e13db/src/librustc_mir/transform/qualify_consts.rs#L1024) in `qualfy_consts.rs`. All errors have been associated with a `struct` to make [comparison with the existing pass](https://github.com/ecstatic-morse/rust/blob/1c19f2d540ca0a964900449d79a5d5181b43146d/src/librustc_mir/transform/qualify_consts.rs#L1006) simple.

The existing validation logic in [`qualify_consts`](https://github.com/rust-lang/rust/blob/master/src/librustc_mir/transform/qualify_consts.rs) has been modified to allow it to run in parallel with the new validator. If [`use_new_validator`](https://github.com/rust-lang/rust/pull/64470/files#diff-c2552a106550d05b69d5e07612f0f812R950) is not set, the old validation will be responsible for actually generating the errors, but those errors can be compared with the ones from the new validator.

4 years agoAuto merge of #64883 - Centril:rollup-uehjt63, r=Centril
bors [Sat, 28 Sep 2019 22:42:58 +0000 (22:42 +0000)]
Auto merge of #64883 - Centril:rollup-uehjt63, r=Centril

Rollup of 10 pull requests

Successful merges:

 - #64131 (data_structures: Add deterministic FxHashMap and FxHashSet wrappers)
 - #64387 (Fix redundant semicolon lint interaction with proc macro attributes)
 - #64678 (added more context for duplicate lang item errors (fixes #60561))
 - #64763 (Add E0734 and its long explanation)
 - #64793 (Fix format macro expansions spans to be macro-generated)
 - #64837 (Improve wording in documentation of MaybeUninit)
 - #64852 (Print ParamTy span when accessing a field (#52082))
 - #64875 (Upgrade async/await to "used" keywords.)
 - #64876 (Fix typo in intrinsics op safety)
 - #64880 (Slice docs: fix typo)

Failed merges:

r? @ghost

4 years agolinux -> Linux
= [Sat, 28 Sep 2019 20:18:29 +0000 (14:18 -0600)]
linux -> Linux

4 years agoadd pkg-config to dependencies
= [Sat, 28 Sep 2019 20:17:09 +0000 (14:17 -0600)]
add pkg-config to dependencies

4 years agoRollup merge of #64880 - llogiq:slice-docs, r=Centril
Mazdak Farrokhzad [Sat, 28 Sep 2019 20:12:11 +0000 (22:12 +0200)]
Rollup merge of #64880 - llogiq:slice-docs, r=Centril

Slice docs: fix typo

With #64703, I introduced a typo. Here is the fix. Sorry for the inconvenience.

4 years agoRollup merge of #64876 - vertexclique:vcq/fix-fn-name-intrinsic-op-unsafety, r=varkor
Mazdak Farrokhzad [Sat, 28 Sep 2019 20:12:10 +0000 (22:12 +0200)]
Rollup merge of #64876 - vertexclique:vcq/fix-fn-name-intrinsic-op-unsafety, r=varkor

Fix typo in intrinsics op safety

Title pretty much sums up.

4 years agoRollup merge of #64875 - ehuss:async-await-reserved, r=estebank
Mazdak Farrokhzad [Sat, 28 Sep 2019 20:12:08 +0000 (22:12 +0200)]
Rollup merge of #64875 - ehuss:async-await-reserved, r=estebank

Upgrade async/await to "used" keywords.

AFAIK, this only affects error messages, removing the word "reserved".

Closes #64853

4 years agoRollup merge of #64852 - Baranowski:param_note_52082, r=estebank
Mazdak Farrokhzad [Sat, 28 Sep 2019 20:12:07 +0000 (22:12 +0200)]
Rollup merge of #64852 - Baranowski:param_note_52082, r=estebank

Print ParamTy span when accessing a field (#52082)

4 years agoRollup merge of #64837 - nliberg:patch-2, r=Centril
Mazdak Farrokhzad [Sat, 28 Sep 2019 20:12:06 +0000 (22:12 +0200)]
Rollup merge of #64837 - nliberg:patch-2, r=Centril

Improve wording in documentation of MaybeUninit

Changes

> variables are properly initialized **at** their respective type

into

> variables are properly initialized **as** their respective type

4 years agoRollup merge of #64793 - immunant:format_spans, r=matthewjasper
Mazdak Farrokhzad [Sat, 28 Sep 2019 20:12:04 +0000 (22:12 +0200)]
Rollup merge of #64793 - immunant:format_spans, r=matthewjasper

Fix format macro expansions spans to be macro-generated

New Exprs generated as part of the format macro expansion should get the macro
expansion span with an expansion context, rather than the span of the format string
which does not.

4 years agoRollup merge of #64763 - GuillaumeGomez:long-err-explanation-E0734, r=estebank
Mazdak Farrokhzad [Sat, 28 Sep 2019 20:12:02 +0000 (22:12 +0200)]
Rollup merge of #64763 - GuillaumeGomez:long-err-explanation-E0734, r=estebank

Add E0734 and its long explanation

Part of https://github.com/rust-lang/rust/issues/61137

4 years agoRollup merge of #64678 - tomtau:fix/no-std-error, r=matthewjasper
Mazdak Farrokhzad [Sat, 28 Sep 2019 20:12:01 +0000 (22:12 +0200)]
Rollup merge of #64678 - tomtau:fix/no-std-error, r=matthewjasper

added more context for duplicate lang item errors (fixes #60561)

Some more information about #60561 -- these errors are pretty common when one works in restrictive environments with `no_std` or customized `std`, but they don't provide much context for debugging, as any transitive dependency could have brought in `std` crate. With that, currently, one needs to use something like `cargo tree` and investigate transitive dependencies one by one.

It'll be more helpful to know at least the crate that uses `std` (which `cargo tree` doesn't show) to pin down this investigation when debugging.

I'm not sure what the best way to get this context is inside rustc internals (I'm new to them). I found that `all_crate_nums` query returns the crates in some dependency order, so printing out the name of the preceding crate seems to do the trick. But I welcome suggestions if this can be done in a better way.

4 years agoRollup merge of #64387 - nathanwhit:redundant-semi-fix, r=varkor
Mazdak Farrokhzad [Sat, 28 Sep 2019 20:11:59 +0000 (22:11 +0200)]
Rollup merge of #64387 - nathanwhit:redundant-semi-fix, r=varkor

Fix redundant semicolon lint interaction with proc macro attributes

Fixes #63967 and fixes #63947, both of which were caused by the lint's changes to the parser interacting poorly with proc macro attributes and causing span information to be lost

r? @varkor

4 years agoRollup merge of #64131 - shivan1b:deterministic-fxhashmap, r=Mark-Simulacrum
Mazdak Farrokhzad [Sat, 28 Sep 2019 20:11:58 +0000 (22:11 +0200)]
Rollup merge of #64131 - shivan1b:deterministic-fxhashmap, r=Mark-Simulacrum

data_structures: Add deterministic FxHashMap and FxHashSet wrappers

StableMap
A wrapper for FxHashMap that allows to `insert`, `remove`, `get`, `get_mut` and convert a hashmap into a sorted vector using the method `into_sorted_vector` but no iteration support.

StableSet
A wrapper for FxHashSet that allows to `insert`, `remove`, `get` and convert a hashset into a sorted vector using the method `into_sorted_vector` but no iteration support.

Addresses issue #63713

4 years agoSlice docs: fix typo
Andre Bogus [Sat, 28 Sep 2019 19:02:51 +0000 (21:02 +0200)]
Slice docs: fix typo

4 years agoFix typo in intrinsics op safety
Mahmut Bulut [Sat, 28 Sep 2019 16:24:05 +0000 (18:24 +0200)]
Fix typo in intrinsics op safety

4 years agoUpgrade async/await to "used" keywords.
Eric Huss [Sat, 28 Sep 2019 16:15:06 +0000 (09:15 -0700)]
Upgrade async/await to "used" keywords.

4 years agoAuto merge of #64419 - wesleywiser:const_prop_use_ecx, r=oli-obk
bors [Sat, 28 Sep 2019 15:54:12 +0000 (15:54 +0000)]
Auto merge of #64419 - wesleywiser:const_prop_use_ecx, r=oli-obk

Deduplicate some code between miri and const prop

r? @oli-obk

4 years agoSwitch over all StableHash impls to new format
Mark Rousskov [Thu, 26 Sep 2019 22:54:39 +0000 (18:54 -0400)]
Switch over all StableHash impls to new format

4 years agoStableHasher does not need to be generic over the Result type
Mark Rousskov [Thu, 26 Sep 2019 22:28:02 +0000 (18:28 -0400)]
StableHasher does not need to be generic over the Result type

4 years agorustc_codegen_ssa: remove redundant `va_list_ref` field from `FunctionCx`.
Eduard-Mihai Burtescu [Mon, 12 Aug 2019 12:27:31 +0000 (15:27 +0300)]
rustc_codegen_ssa: remove redundant `va_list_ref` field from `FunctionCx`.

4 years agorustc: rely on c_variadic == true instead of CVarArgs in HIR/Ty fn signatures.
Eduard-Mihai Burtescu [Sat, 10 Aug 2019 11:38:17 +0000 (14:38 +0300)]
rustc: rely on c_variadic == true instead of CVarArgs in HIR/Ty fn signatures.

4 years agorustc: don't store a lifetime in hir::TyKind::CVarArgs.
Eduard-Mihai Burtescu [Sun, 11 Aug 2019 15:34:31 +0000 (18:34 +0300)]
rustc: don't store a lifetime in hir::TyKind::CVarArgs.

4 years agosyntax: don't keep a redundant c_variadic flag in the AST.
Eduard-Mihai Burtescu [Sat, 10 Aug 2019 10:29:39 +0000 (13:29 +0300)]
syntax: don't keep a redundant c_variadic flag in the AST.

4 years agoRename `sty` to `kind`
Dylan MacKenzie [Sat, 28 Sep 2019 14:20:06 +0000 (07:20 -0700)]
Rename `sty` to `kind`

Picks up changes made in #64513

4 years agoBless miri unleashed output
Dylan MacKenzie [Wed, 25 Sep 2019 22:18:26 +0000 (15:18 -0700)]
Bless miri unleashed output

4 years agoRevert "Use conservative, type-based qualifcation for statics"
Dylan MacKenzie [Wed, 25 Sep 2019 21:56:50 +0000 (14:56 -0700)]
Revert "Use conservative, type-based qualifcation for statics"

This reverts commit ac7a343cef8287427a98b9210cdb1a772486be10.

4 years agoCorrect `IndirectlyMutableLocals` docs
Dylan MacKenzie [Wed, 25 Sep 2019 20:25:06 +0000 (13:25 -0700)]
Correct `IndirectlyMutableLocals` docs

4 years agoMask results from flow-sensitive resolver with `in_any_value_of_ty`
Dylan MacKenzie [Wed, 25 Sep 2019 19:53:28 +0000 (12:53 -0700)]
Mask results from flow-sensitive resolver with `in_any_value_of_ty`

We relied previously on the caller (e.g. `Q::in_operand`) to ignore
`Local`s that were indirectly mutable (and thus assumed to be
qualified). However, it's much clearer (and more efficient) to do this
in the resolver itself.

This does not yet remove the masking done in `Q::in_operand` and others
for safety's sake, although I believe that should now be possible.

4 years agoAdd description for every module in `check_consts`
Dylan MacKenzie [Wed, 25 Sep 2019 19:30:25 +0000 (12:30 -0700)]
Add description for every module in `check_consts`

4 years agoShare `IndirectlyMutableLocals` results via reference
Dylan MacKenzie [Wed, 25 Sep 2019 19:02:56 +0000 (12:02 -0700)]
Share `IndirectlyMutableLocals` results via reference

4 years agoRequire `fmt::Debug` to implement `NonConstOp`
Dylan MacKenzie [Wed, 25 Sep 2019 18:58:12 +0000 (11:58 -0700)]
Require `fmt::Debug` to implement `NonConstOp`

4 years agoUse conservative, type-based qualifcation for statics
Dylan MacKenzie [Wed, 25 Sep 2019 18:56:31 +0000 (11:56 -0700)]
Use conservative, type-based qualifcation for statics

4 years agoReturn a `bool` from `in_any_value_of_ty`
Dylan MacKenzie [Wed, 25 Sep 2019 18:52:12 +0000 (11:52 -0700)]
Return a `bool` from `in_any_value_of_ty`

The `Option` was only used for the promotion qualifiers, so we can use a
simpler API for validation.

4 years agoGive usage instructions `IndirectlyMutableLocals` docs
Dylan MacKenzie [Wed, 25 Sep 2019 18:47:56 +0000 (11:47 -0700)]
Give usage instructions `IndirectlyMutableLocals` docs

4 years agoTrigger ICE on nightly if validators disagree
Dylan MacKenzie [Tue, 24 Sep 2019 04:33:58 +0000 (21:33 -0700)]
Trigger ICE on nightly if validators disagree

Also adds an unstable flag to disable the ICE
(`-Zsuppress-const-validation-back-compat-ice`) so that nightly users do
not have to revert to a previous nightly if their code causes
disagreement between the validators.

4 years agoExplain why `visit_terminator` does nothing for `IndirectlyMutableLocals`
Dylan MacKenzie [Fri, 20 Sep 2019 16:31:44 +0000 (09:31 -0700)]
Explain why `visit_terminator` does nothing for `IndirectlyMutableLocals`

4 years agoMove non-const ops into their own module
Dylan MacKenzie [Fri, 20 Sep 2019 16:00:18 +0000 (09:00 -0700)]
Move non-const ops into their own module

4 years agoRemember to replace ICE with some form of warning
Dylan MacKenzie [Fri, 20 Sep 2019 15:50:39 +0000 (08:50 -0700)]
Remember to replace ICE with some form of warning

4 years agoAdd rationale for `suppress_errors` flag
Dylan MacKenzie [Fri, 20 Sep 2019 15:49:46 +0000 (08:49 -0700)]
Add rationale for `suppress_errors` flag

4 years agoCorrect list of miri-supported operations
Dylan MacKenzie [Fri, 20 Sep 2019 15:48:47 +0000 (08:48 -0700)]
Correct list of miri-supported operations

Heap allocations are out, indirect `fn` calls are in!

4 years agoFix tests broken by more consistent miri unleashed warnings
Dylan MacKenzie [Tue, 17 Sep 2019 23:25:42 +0000 (16:25 -0700)]
Fix tests broken by more consistent miri unleashed warnings

4 years agoRun new validator in compare mode
Dylan MacKenzie [Tue, 17 Sep 2019 23:25:41 +0000 (16:25 -0700)]
Run new validator in compare mode

4 years agoAdd dataflow-based const validation
Dylan MacKenzie [Tue, 17 Sep 2019 23:25:40 +0000 (16:25 -0700)]
Add dataflow-based const validation

4 years agoPass current qualification state in a separate parameter
Dylan MacKenzie [Tue, 17 Sep 2019 23:25:39 +0000 (16:25 -0700)]
Pass current qualification state in a separate parameter

4 years agoControl whether a `Qualif` is cleared on move
Dylan MacKenzie [Tue, 17 Sep 2019 23:25:38 +0000 (16:25 -0700)]
Control whether a `Qualif` is cleared on move

4 years agoRemove reference to `Mode::NonConstFn` in qualifs
Dylan MacKenzie [Tue, 17 Sep 2019 23:25:37 +0000 (16:25 -0700)]
Remove reference to `Mode::NonConstFn` in qualifs

This should have no effect on behavior since the validator is never run
in const contexts.

4 years agoAdd requisite imports and bitset to hold qualifs
Dylan MacKenzie [Tue, 17 Sep 2019 23:25:35 +0000 (16:25 -0700)]
Add requisite imports and bitset to hold qualifs

4 years agoMake new qualifs public
Dylan MacKenzie [Tue, 17 Sep 2019 23:25:34 +0000 (16:25 -0700)]
Make new qualifs public

4 years agoRemove unnecessary method
Dylan MacKenzie [Tue, 17 Sep 2019 23:25:33 +0000 (16:25 -0700)]
Remove unnecessary method

4 years agoCopy `Qualif` to start work on new const validator
Dylan MacKenzie [Tue, 17 Sep 2019 23:25:32 +0000 (16:25 -0700)]
Copy `Qualif` to start work on new const validator

This is an exact copy of the `Qualif` trait from `qualify_consts.rs` and
its first two implementers, `HasMutInterior` and `NeedsDrop`.

4 years agoDon't treat locals as mutably borrowed after they're dropped
Dylan MacKenzie [Tue, 17 Sep 2019 23:25:31 +0000 (16:25 -0700)]
Don't treat locals as mutably borrowed after they're dropped

4 years agoAdd analysis to determine if a local is indirectly mutable
Dylan MacKenzie [Tue, 17 Sep 2019 23:25:30 +0000 (16:25 -0700)]
Add analysis to determine if a local is indirectly mutable

This adds a dataflow analysis that determines if a reference to a given
`Local` or part of a `Local` that would allow mutation exists before a
point in the CFG. If no such reference exists, we know for sure that
that `Local` cannot have been mutated via an indirect assignment or
function call.

4 years agoAdd additional `const` tests
Dylan MacKenzie [Tue, 17 Sep 2019 23:25:26 +0000 (16:25 -0700)]
Add additional `const` tests

4 years agoSilence "skipping const checks" if outside a const context
Dylan MacKenzie [Tue, 17 Sep 2019 23:25:25 +0000 (16:25 -0700)]
Silence "skipping const checks" if outside a const context

4 years agoRefactor into ban_nonexisting_field method
Wojciech Baranowski [Sat, 28 Sep 2019 12:26:00 +0000 (15:26 +0300)]
Refactor into ban_nonexisting_field method

4 years agoAuto merge of #64455 - GuillaumeGomez:long-error-explanation-E0531, r=Centril
bors [Sat, 28 Sep 2019 12:06:44 +0000 (12:06 +0000)]
Auto merge of #64455 - GuillaumeGomez:long-error-explanation-E0531, r=Centril

Add Long error explanation for E0531

Part of #61137.

4 years agoFix lint-exceeding-bitshifts ui tests
Wesley Wiser [Sat, 28 Sep 2019 00:09:52 +0000 (20:09 -0400)]
Fix lint-exceeding-bitshifts ui tests

4 years agoAllow reading non-mutable statics in const prop
Wesley Wiser [Wed, 25 Sep 2019 02:08:22 +0000 (22:08 -0400)]
Allow reading non-mutable statics in const prop

4 years agoImplement CRs
Wojciech Baranowski [Sat, 28 Sep 2019 11:39:19 +0000 (14:39 +0300)]
Implement CRs

4 years agoImprove wording in documentation of MaybeUninit
Nils Liberg [Fri, 27 Sep 2019 11:54:05 +0000 (13:54 +0200)]
Improve wording in documentation of MaybeUninit

4 years agodata_structures: Add deterministic FxHashMap and FxHashSet wrappers
Shivani Bhardwaj [Tue, 3 Sep 2019 10:12:54 +0000 (15:42 +0530)]
data_structures: Add deterministic FxHashMap and FxHashSet wrappers

StableMap
A wrapper for FxHashMap that allows to insert, remove, get and get_mut
but no iteration support.

StableSet
A wrapper for FxHashSet that allows to insert, remove, get and create a
sorted vector from a hashset but no iteration support.

4 years agoAuto merge of #64864 - Centril:rollup-pxz6tw3, r=Centril
bors [Sat, 28 Sep 2019 03:38:48 +0000 (03:38 +0000)]
Auto merge of #64864 - Centril:rollup-pxz6tw3, r=Centril

Rollup of 14 pull requests

Successful merges:

 - #64703 (Docs: slice elements are equidistant)
 - #64745 (Include message on tests that should panic but do not)
 - #64781 (Remove stray references to the old global tcx)
 - #64794 (Remove unused DepTrackingMap)
 - #64802 (Account for tail expressions when pointing at return type)
 - #64809 (hir: Disallow `target_feature` on constants)
 - #64815 (Fix div_duration() marked as stable by mistake)
 - #64818 (update rtpSpawn's parameters type(It's prototype has been updated in libc))
 - #64830 (Thou shallt not `.abort_if_errors()`)
 - #64836 (Stabilize map_get_key_value feature)
 - #64845 (pin.rs: fix links to primitives in documentation)
 - #64847 (Upgrade env_logger to 0.7)
 - #64851 (Add mailmap entry for Dustin Bensing by request)
 - #64859 (check_match: improve diagnostics for `let A = 2;` with `const A: i32 = 3`)

Failed merges:

r? @ghost

4 years agoRollup merge of #64859 - Centril:const-def-here-new-var, r=estebank
Mazdak Farrokhzad [Sat, 28 Sep 2019 03:38:00 +0000 (05:38 +0200)]
Rollup merge of #64859 - Centril:const-def-here-new-var, r=estebank

check_match: improve diagnostics for `let A = 2;` with `const A: i32 = 3`

For example:

```
error[E0005]: refutable pattern in local binding: `std::i32::MIN..=1i32` and `3i32..=std::i32::MAX` not covered
  --> $DIR/const-pat-non-exaustive-let-new-var.rs:2:9
   |
LL |     let A = 3;
   |         ^
   |         |
   |         interpreted as a constant pattern, not a new variable
   |         help: introduce a variable instead: `a_var`
...
LL |     const A: i32 = 2;
   |     ----------------- constant defined here
```

r? @estebank
cc @matthiaskrgr @rpjohnst

4 years agoRollup merge of #64851 - Mark-Simulacrum:mailmap-update, r=varkor
Mazdak Farrokhzad [Sat, 28 Sep 2019 03:37:58 +0000 (05:37 +0200)]
Rollup merge of #64851 - Mark-Simulacrum:mailmap-update, r=varkor

Add mailmap entry for Dustin Bensing by request

This should deduplicate entries from @pythoneer between the stdarch submodule and this repo itself on thanks.rust-lang.org.

4 years agoRollup merge of #64847 - mati865:env_logger, r=alexcrichton
Mazdak Farrokhzad [Sat, 28 Sep 2019 03:37:57 +0000 (05:37 +0200)]
Rollup merge of #64847 - mati865:env_logger, r=alexcrichton

Upgrade env_logger to 0.7

`./x.py test` passed locally.

4 years agoRollup merge of #64845 - rusty-snake:patch-1, r=jonas-schievink
Mazdak Farrokhzad [Sat, 28 Sep 2019 03:37:56 +0000 (05:37 +0200)]
Rollup merge of #64845 - rusty-snake:patch-1, r=jonas-schievink

pin.rs: fix links to primitives in documentation

4 years agoRollup merge of #64836 - lzutao:stabilize-map_get_key_value, r=SimonSapin
Mazdak Farrokhzad [Sat, 28 Sep 2019 03:37:54 +0000 (05:37 +0200)]
Rollup merge of #64836 - lzutao:stabilize-map_get_key_value, r=SimonSapin

Stabilize map_get_key_value feature

FCP done in https://github.com/rust-lang/rust/issues/49347#issuecomment-521728031
r? @SimonSapin
Closes #49347

4 years agoRollup merge of #64830 - Centril:thou-shallt-not-abort, r=estebank
Mazdak Farrokhzad [Sat, 28 Sep 2019 03:37:52 +0000 (05:37 +0200)]
Rollup merge of #64830 - Centril:thou-shallt-not-abort, r=estebank

Thou shallt not `.abort_if_errors()`

r? @estebank

4 years agoRollup merge of #64818 - Wind-River:master, r=alexcrichton
Mazdak Farrokhzad [Sat, 28 Sep 2019 03:37:51 +0000 (05:37 +0200)]
Rollup merge of #64818 - Wind-River:master, r=alexcrichton

update rtpSpawn's parameters type(It's prototype has been updated in libc)

r? @alexcrichton

4 years agoRollup merge of #64815 - JMS55:patch-1, r=jonas-schievink
Mazdak Farrokhzad [Sat, 28 Sep 2019 03:37:49 +0000 (05:37 +0200)]
Rollup merge of #64815 - JMS55:patch-1, r=jonas-schievink

Fix div_duration() marked as stable by mistake

4 years agoRollup merge of #64809 - davidtwco:issue-64768-target-feature-const, r=varkor
Mazdak Farrokhzad [Sat, 28 Sep 2019 03:37:47 +0000 (05:37 +0200)]
Rollup merge of #64809 - davidtwco:issue-64768-target-feature-const, r=varkor

hir: Disallow `target_feature` on constants

Fixes #64768.

This PR fixes an ICE when `#[target_feature]` is applied to constants by disallowing this with the same error as when `#[target_feature]` is applied to other places it shouldn't be.

I couldn't see anything in the [RFC](https://github.com/rust-lang/rfcs/blob/master/text/2045-target-feature.md) that suggested that `#[target_feature]` should be applicable to constants or any tests that suggested it should, though I might have missed something - if this is desirable in future, it remains possible to remove this error (but for the time being, I think this error is better than an ICE).

I also added some extra cases to the test for other places where `#[target_feature]` should not be permitted.

cc @gnzlbg

4 years agoRollup merge of #64802 - estebank:walk-parents-iterator, r=matthewjasper
Mazdak Farrokhzad [Sat, 28 Sep 2019 03:37:46 +0000 (05:37 +0200)]
Rollup merge of #64802 - estebank:walk-parents-iterator, r=matthewjasper

Account for tail expressions when pointing at return type

When there's a type mismatch we make an effort to check if it was
caused by a function's return type. This logic now makes sure to
only point at the return type if the error happens in a tail
expression.

Turn `walk_parent_nodes` method into an iterator.

CC #39968, CC #40799.

4 years agoRollup merge of #64794 - Mark-Simulacrum:rm-dep-track-map, r=estebank
Mazdak Farrokhzad [Sat, 28 Sep 2019 03:37:44 +0000 (05:37 +0200)]
Rollup merge of #64794 - Mark-Simulacrum:rm-dep-track-map, r=estebank

Remove unused DepTrackingMap

Deletes some related code (MemoizationMap trait, etc.)

I believe this became unused with red/green incremental introduction, but am uncertain.

4 years agoRollup merge of #64781 - Mark-Simulacrum:no-global-tcx, r=eddyb
Mazdak Farrokhzad [Sat, 28 Sep 2019 03:37:43 +0000 (05:37 +0200)]
Rollup merge of #64781 - Mark-Simulacrum:no-global-tcx, r=eddyb

Remove stray references to the old global tcx

4 years agoRollup merge of #64745 - kennethbgoodin:should-panic-msg, r=varkor
Mazdak Farrokhzad [Sat, 28 Sep 2019 03:37:42 +0000 (05:37 +0200)]
Rollup merge of #64745 - kennethbgoodin:should-panic-msg, r=varkor

Include message on tests that should panic but do not

As per issue #60790 includes a message for tests marked `#[should_panic]` that do not panic as expected.

Fixes #60790.

4 years agoRollup merge of #64703 - llogiq:slices-elems-are-equidistant, r=rkruppe
Mazdak Farrokhzad [Sat, 28 Sep 2019 03:37:40 +0000 (05:37 +0200)]
Rollup merge of #64703 - llogiq:slices-elems-are-equidistant, r=rkruppe

Docs: slice elements are equidistant

Recently, someone asked why `[char]` and `str` are not interchangeable, and I explained that in a slice, the elements must be laid out equidistantly, whereas the chars in a `str` are stored compactly regardless their size. However I couldn't find this documented anywhere, so here's a small addition of this fact.

4 years agoAdd test for redundant_semicolon lint interaction with proc macro attrs
Nathan [Sat, 28 Sep 2019 02:51:25 +0000 (22:51 -0400)]
Add test for redundant_semicolon lint interaction with proc macro attrs

4 years agoImprove diagnostic for `let A = 0;`
Mazdak Farrokhzad [Sat, 28 Sep 2019 00:30:48 +0000 (02:30 +0200)]
Improve diagnostic for `let A = 0;`
where `A` is a constant, not a new variable.

4 years agoFilter out stmts made for the redundant_semicolon lint when pretty-printing
nathanwhit [Thu, 12 Sep 2019 02:05:26 +0000 (22:05 -0400)]
Filter out stmts made for the redundant_semicolon lint when pretty-printing

4 years agoIntroduce a `ConstPropMachine`
Wesley Wiser [Wed, 25 Sep 2019 01:12:59 +0000 (21:12 -0400)]
Introduce a `ConstPropMachine`

This allows us to avoid changing things directly in the miri engine just
for const prop.

4 years agoWork around for #64506
Wesley Wiser [Tue, 17 Sep 2019 09:48:38 +0000 (05:48 -0400)]
Work around for #64506

4 years agoMove Ref-from-arg checking from `step.rs` to `const_prop.rs`
Wesley Wiser [Sat, 14 Sep 2019 11:00:16 +0000 (07:00 -0400)]
Move Ref-from-arg checking from `step.rs` to `const_prop.rs`

4 years agoRespond to code review feedback and fix tidy
Wesley Wiser [Fri, 13 Sep 2019 12:40:43 +0000 (08:40 -0400)]
Respond to code review feedback and fix tidy

4 years agoDon't run the ConstProp MIR pass on generators
Wesley Wiser [Fri, 13 Sep 2019 02:03:20 +0000 (22:03 -0400)]
Don't run the ConstProp MIR pass on generators

This can cause cycles as `ConstProp` uses `layout_of` which, for
generators, uses `optimized_mir` which runs `ConstProp`.

4 years ago[const-prop] Replace `Ref` handling with use of `InterpCx`
Wesley Wiser [Wed, 11 Sep 2019 11:46:17 +0000 (07:46 -0400)]
[const-prop] Replace `Ref` handling with use of `InterpCx`

4 years ago[const-prop] Replace some `Binaryp` handling with use of `InterpCx`
Wesley Wiser [Tue, 10 Sep 2019 02:28:02 +0000 (22:28 -0400)]
[const-prop] Replace some `Binaryp` handling with use of `InterpCx`

4 years ago[const-prop] Replace `CheckedBinaryOp` handling with use of `InterpCx`
Wesley Wiser [Mon, 9 Sep 2019 01:02:54 +0000 (21:02 -0400)]
[const-prop] Replace `CheckedBinaryOp` handling with use of `InterpCx`

4 years ago[const-prop] Replace most `UnaryOp` handling with use of `InterpCx`
Wesley Wiser [Fri, 6 Sep 2019 11:48:52 +0000 (07:48 -0400)]
[const-prop] Replace most `UnaryOp` handling with use of `InterpCx`