about summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
2019-10-11Make <*const/mut T>::offset_from `const fn`Oliver Scherer-0/+164
2019-10-09Suggest `if let` on `let` refutable bindingEsteban Küber-0/+42
2019-10-09Move test next to likeminded onesOliver Scherer-0/+20
2019-10-07Auto merge of #64906 - Aaron1011:feature/extern-const-fn, r=Centrilbors-0/+229
Add support for `const unsafe? extern fn` This works just as you might expect - an `const extern fn` is a `const fn` that is callable from foreign code. Currently, panicking is not allowed in `const`s. When https://github.com/rust-lang/rfcs/pull/2345 (https://github.com/rust-lang/rust/issues/51999) is stabilized, then panicking in an `const extern fn` will produce a compile-time error when invoked at compile time, and an abort when invoked at runtime. Since this is extending the language (we're allowing the `const` keyword in a new context), I believe that this will need an FCP. However, it's a very minor change, so I didn't think that filing an RFC was necessary. This will allow libc (and other FFI crates) to make many functions `const`, without having to give up on making them `extern` as well. Tracking issue: https://github.com/rust-lang/rust/issues/64926.
2019-10-05Rollup merge of #65151 - tmandry:revert-emscripten-upgrade, r=tmandryTyler Mandry-0/+1
Revert #63649 - "Upgrade Emscripten targets to use upstream LLVM backend" This change caused the runtime of the linux-asmjs builder to nearly double from 2+ hours to about 4 hours, which happens to be the bors timeout. (It made it in barely under 4 hours when it was merged.) This is causing timeouts on all new changes. This reverts commit 7870050796e5904a0fc85ecbe6fa6dde1cfe0c91, reversing changes made to 2e7244807a7878f6eca3eb7d97ae9b413aa49014.
2019-10-05Rollup merge of #65066 - ↵Tyler Mandry-11/+22
wesleywiser:fix_const_prop_ice_on_polymorphic_promoted_mir, r=oli-obk [const-prop] Fix ICE when trying to eval polymorphic promoted MIR Fixes #64908 r? @oli-obk cc @nikomatsakis @pnkfelix
2019-10-05Revert "Auto merge of #63649 - tlively:emscripten-upstream-upgrade, ↵Tyler Mandry-0/+1
r=alexcrichton" This reverts commit 7870050796e5904a0fc85ecbe6fa6dde1cfe0c91, reversing changes made to 2e7244807a7878f6eca3eb7d97ae9b413aa49014.
2019-10-04Auto merge of #63649 - tlively:emscripten-upstream-upgrade, r=alexcrichtonbors-1/+0
Upgrade Emscripten targets to use upstream LLVM backend - Refactors the Emscripten target spec to share code with other wasm targets. - Replaces the incorrect wasm32 C call ABI with the old asmjs version, which is correct for both wasm32 and JS. - Updates the varargs ABI used by Emscripten and deletes the old one. - Removes the obsolete wasm32-experimental-emscripten target. - Temporarily makes Emscripten targets use panic=abort by default because supporting unwinding will require an LLVM patch.
2019-10-04[const-prop] Fix ICE when trying to eval polymorphic promoted MIRWesley Wiser-11/+22
2019-10-04make is_power_of_two a const functionTrevor Spiteri-0/+11
2019-10-04Upgrade Emscripten targets to use upstream LLVM backendThomas Lively-1/+0
- Refactors the Emscripten target spec to share code with other wasm targets. - Replaces the incorrect wasm32 C call ABI with the old asmjs version, which is correct for both wasm32 and JS. - Updates the varargs ABI used by Emscripten and deletes the old one. - Removes the obsolete wasm32-experimental-emscripten target. - Temporarily makes Emscripten targets use panic=abort by default because supporting unwinding will require an LLVM patch.
2019-10-04Rollup merge of #64749 - matthewjasper:liveness-opt, r=nikomatsakisMazdak Farrokhzad-29/+0
Fix most remaining Polonius test differences This fixes most of the Polonius test differences and also avoids overflow in issue-38591.rs. r? @nikomatsakis
2019-10-02Calculate liveness for the same locals with and without -ZpoloniusMatthew Jasper-29/+0
This fixes some test differences and also avoids overflow in issue-38591.rs.
2019-10-02Rollup merge of #64991 - wesleywiser:fix_too_eager_const_prop, r=oli-obkMazdak Farrokhzad-0/+23
[const-prop] Correctly handle locals that can't be propagated `const_prop()` now handles writing the Rvalue into the Place in the stack frame for us. So if we're not supposed to propagate that value, we need to clear it. r? @oli-obk Fixes #64970
2019-10-02[const-prop] Correctly handle locals that can't be propagatedWesley Wiser-0/+23
`const_prop()` now handles writing the Rvalue into the Place in the stack frame for us. So if we're not supported to propagate that value, we need to clear it.
2019-10-02Add support for 'extern const fn'Aaron Hill-0/+229
This works just as you might expect - an 'extern const fn' is a 'const fn' that is callable from foreign code. Currently, panicking is not allowed in consts. When RFC 2345 is stabilized, then panicking in an 'extern const fn' will produce a compile-time error when invoked at compile time, and an abort when invoked at runtime. Since this is extending the language (we're allowing the `const` keyword in a new context), I believe that this will need an FCP. However, it's a very minor change, so I didn't think that filing an RFC was necessary. This will allow libc (and other FFI crates) to make many functions `const`, without having to give up on making them `extern` as well.
2019-10-01Add test cases for #64945Dylan MacKenzie-0/+61
This also tests that `&&[]` no longer causes an ICE in this PR (although the test fails the borrow checker). This could be more complete.
2019-09-30Rollup merge of #64921 - JohnTitor:add-test-enum, r=varkorTyler Mandry-0/+25
Add test for issue-64662 Closes #64662 r? @varkor
2019-09-30Rollup merge of #64377 - GuillaumeGomez:E0493, r=estebankTyler Mandry-2/+4
Add long error explanation for E0493 Part of #61137.
2019-10-01Add test for issue-64662Yuki Okushi-0/+25
2019-09-30update testsGuillaume Gomez-2/+4
2019-09-29Auto merge of #64470 - ecstatic-morse:split-promotion-and-validation, ↵bors-258/+111
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.
2019-09-28Auto merge of #64419 - wesleywiser:const_prop_use_ecx, r=oli-obkbors-2/+29
Deduplicate some code between miri and const prop r? @oli-obk
2019-09-28Bless miri unleashed outputDylan MacKenzie-12/+5
2019-09-28Fix tests broken by more consistent miri unleashed warningsDylan MacKenzie-242/+82
2019-09-28Add additional `const` testsDylan MacKenzie-0/+46
2019-09-28Silence "skipping const checks" if outside a const contextDylan MacKenzie-29/+3
2019-09-28Improve diagnostic for `let A = 0;`Mazdak Farrokhzad-3/+21
where `A` is a constant, not a new variable.
2019-09-27Respond to code review feedback and fix tidyWesley Wiser-0/+18
2019-09-27[const-prop] Replace `eval_place()` with use of `InterpCx`Wesley Wiser-2/+11
2019-09-26Adjust & --bless tests due to no longer downgrading NLL errors on 2015.Mazdak Farrokhzad-380/+9
2019-09-25Rollup merge of #64738 - gnzlbg:miri_norm_abi, r=oli-obkMazdak Farrokhzad-0/+53
Add const-eval support for SIMD types, insert, and extract This adds initial support for constant-evaluation of Abi::Vector types. r? @oli-obk
2019-09-25Remove fail testsgnzlbg-201/+0
2019-09-25Clean testsgnzlbg-11/+31
2019-09-25Test errorsgnzlbg-60/+181
2019-09-25Refactorgnzlbg-0/+24
2019-09-25Allow simd_insert and simd_extract in const_fngnzlbg-290/+2
2019-09-24Add some more testsgnzlbg-27/+296
2019-09-24Move tests to SIMD subdirectorygnzlbg-8/+8
2019-09-24Add a fail testgnzlbg-0/+36
2019-09-24Add const-eval support for SIMD types, insert, and extractgnzlbg-0/+72
2019-09-24Stabilize `str::len`, `[T]::len`, `is_empty` and `str::as_bytes` as const fnOliver Scherer-7/+15
2019-09-21remove featuregnzlbg-84/+255
2019-09-20Allow using fn pointers in const fn behind const_fn_ptr gategnzlbg-0/+128
2019-09-19Rollup merge of #63448 - RalfJung:miri-discriminant, r=eddybMazdak Farrokhzad-0/+182
fix Miri discriminant handling This can be reviewed commit-by-commit fairly well. The Miri side is at https://github.com/rust-lang/miri/pull/903. Fixes https://github.com/rust-lang/rust/issues/62138 r? @eddyb @oli-obk
2019-09-17Get rid of special const intrinsic query in favour of `const_eval`Oliver Scherer-0/+5
2019-09-16Rollup merge of #64028 - Centril:stabilize-alloc-new-2, r=alexcrichtonMazdak Farrokhzad-10/+3
Stabilize `Vec::new` and `String::new` as `const fn`s Closes https://github.com/rust-lang/rust/issues/64022. r? @oli-obk
2019-09-16Const-stabilize `Vec::new`.Mazdak Farrokhzad-10/+3
2019-09-16add testRalf Jung-0/+182
2019-09-15all memory behind a constant must be immutableRalf Jung-0/+47