Commit Graph

99783 Commits

Author SHA1 Message Date
Andre Bogus
e77dfa27ca Slice docs: fix typo 2019-09-28 21:02:51 +02:00
Esteban Küber
c861e24e72 clean up 2019-09-28 09:56:28 -07:00
Esteban Küber
ae51953e80 review comments 2019-09-28 09:56:28 -07:00
Esteban Küber
8a167edbca Point at enclosing match when expecting () in arm
When encountering code like the following:

```rust
fn main() {
    match 3 {
        4 => 1,
        3 => {
            println!("Yep it maches.");
            2
        }
        _ => 2
    }
    println!("Bye!")
}
```

point at the enclosing `match` expression and suggest ignoring the
returned value:

```
error[E0308]: mismatched types
  --> $DIR/match-needing-semi.rs:8:13
   |
LL | /     match 3 {
LL | |         4 => 1,
LL | |         3 => {
LL | |             2
   | |             ^ expected (), found integer
LL | |         }
LL | |         _ => 2
LL | |     }
   | |     -- help: consider using a semicolon here
   | |_____|
   |       expected this to be `()`
   |
   = note: expected type `()`
              found type `{integer}
```

Fix #40799.
2019-09-28 09:56:28 -07:00
Mahmut Bulut
c666bd5570
Fix typo in intrinsics op safety 2019-09-28 18:24:05 +02:00
Eric Huss
f6ceccea93 Upgrade async/await to "used" keywords. 2019-09-28 09:15:06 -07:00
bors
488381ce9e Auto merge of #64419 - wesleywiser:const_prop_use_ecx, r=oli-obk
Deduplicate some code between miri and const prop

r? @oli-obk
2019-09-28 15:54:12 +00:00
Mark Rousskov
14a5aefb01 Switch over all StableHash impls to new format 2019-09-28 11:47:36 -04:00
Mark Rousskov
f60e58e575 StableHasher does not need to be generic over the Result type 2019-09-28 11:47:15 -04:00
Eduard-Mihai Burtescu
057f23d3dd rustc_codegen_ssa: remove redundant va_list_ref field from FunctionCx. 2019-09-28 17:39:00 +03:00
Eduard-Mihai Burtescu
a88d181a02 rustc: rely on c_variadic == true instead of CVarArgs in HIR/Ty fn signatures. 2019-09-28 17:39:00 +03:00
Eduard-Mihai Burtescu
7683d1c3aa rustc: don't store a lifetime in hir::TyKind::CVarArgs. 2019-09-28 17:39:00 +03:00
Eduard-Mihai Burtescu
8a9d775888 syntax: don't keep a redundant c_variadic flag in the AST. 2019-09-28 17:38:59 +03:00
Dylan MacKenzie
0bf1a80b32 Rename sty to kind
Picks up changes made in #64513
2019-09-28 07:20:12 -07:00
Dylan MacKenzie
ff4158abf2 Bless miri unleashed output 2019-09-28 07:06:52 -07:00
Dylan MacKenzie
f2e7faf153 Revert "Use conservative, type-based qualifcation for statics"
This reverts commit ac7a343cef8287427a98b9210cdb1a772486be10.
2019-09-28 07:06:52 -07:00
Dylan MacKenzie
8bfe82bfad Correct IndirectlyMutableLocals docs 2019-09-28 07:06:52 -07:00
Dylan MacKenzie
a302055caa 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.
2019-09-28 07:06:52 -07:00
Dylan MacKenzie
ff6faabda7 Add description for every module in check_consts 2019-09-28 07:06:52 -07:00
Dylan MacKenzie
713ec152fc Share IndirectlyMutableLocals results via reference 2019-09-28 07:06:52 -07:00
Dylan MacKenzie
1a14d17c4d Require fmt::Debug to implement NonConstOp 2019-09-28 07:06:52 -07:00
Dylan MacKenzie
dcecefcb71 Use conservative, type-based qualifcation for statics 2019-09-28 07:06:52 -07:00
Dylan MacKenzie
2f5ea633d4 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.
2019-09-28 07:06:52 -07:00
Dylan MacKenzie
406ac2e14b Give usage instructions IndirectlyMutableLocals docs 2019-09-28 07:06:52 -07:00
Dylan MacKenzie
bc7928a507 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.
2019-09-28 07:06:52 -07:00
Dylan MacKenzie
93ee7791b6 Explain why visit_terminator does nothing for IndirectlyMutableLocals 2019-09-28 07:06:52 -07:00
Dylan MacKenzie
b3e59bb291 Move non-const ops into their own module 2019-09-28 07:06:52 -07:00
Dylan MacKenzie
e296436ee0 Remember to replace ICE with some form of warning 2019-09-28 07:06:52 -07:00
Dylan MacKenzie
f2ff425622 Add rationale for suppress_errors flag 2019-09-28 07:06:52 -07:00
Dylan MacKenzie
27bd84916c Correct list of miri-supported operations
Heap allocations are out, indirect `fn` calls are in!
2019-09-28 07:06:52 -07:00
Dylan MacKenzie
670c84dde3 Fix tests broken by more consistent miri unleashed warnings 2019-09-28 07:06:52 -07:00
Dylan MacKenzie
c990243922 Run new validator in compare mode 2019-09-28 07:06:52 -07:00
Dylan MacKenzie
fc92d3b820 Add dataflow-based const validation 2019-09-28 07:06:52 -07:00
Dylan MacKenzie
3698d04fef Pass current qualification state in a separate parameter 2019-09-28 07:06:52 -07:00
Dylan MacKenzie
908dcb80b7 Control whether a Qualif is cleared on move 2019-09-28 07:06:51 -07:00
Dylan MacKenzie
3758e383a6 Remove reference to Mode::NonConstFn in qualifs
This should have no effect on behavior since the validator is never run
in const contexts.
2019-09-28 07:06:51 -07:00
Dylan MacKenzie
48d3843be6 Add requisite imports and bitset to hold qualifs 2019-09-28 07:06:51 -07:00
Dylan MacKenzie
c2e121da08 Make new qualifs public 2019-09-28 07:06:51 -07:00
Dylan MacKenzie
3a5442a891 Remove unnecessary method 2019-09-28 07:06:51 -07:00
Dylan MacKenzie
eec93ca08c 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`.
2019-09-28 07:06:51 -07:00
Dylan MacKenzie
83a3e04ed0 Don't treat locals as mutably borrowed after they're dropped 2019-09-28 07:06:51 -07:00
Dylan MacKenzie
e81297d990 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.
2019-09-28 07:06:51 -07:00
Dylan MacKenzie
457c3aa672 Add additional const tests 2019-09-28 07:06:51 -07:00
Dylan MacKenzie
717c64e188 Silence "skipping const checks" if outside a const context 2019-09-28 07:06:51 -07:00
Wojciech Baranowski
9ad99c30cb Refactor into ban_nonexisting_field method 2019-09-28 15:49:51 +03:00
bors
18f00b9496 Auto merge of #64455 - GuillaumeGomez:long-error-explanation-E0531, r=Centril
Add Long error explanation for E0531

Part of #61137.
2019-09-28 12:06:44 +00:00
Wesley Wiser
ba2d6c42fc Fix lint-exceeding-bitshifts ui tests 2019-09-28 07:51:38 -04:00
Wesley Wiser
a99f255015 Allow reading non-mutable statics in const prop 2019-09-28 07:51:38 -04:00
Wojciech Baranowski
f3744a1b3d Implement CRs 2019-09-28 14:39:19 +03:00
Nils Liberg
fd505d7fd5 Improve wording in documentation of MaybeUninit 2019-09-28 11:49:45 +02:00