summary refs log tree commit diff
path: root/src/test/ui/consts/const-eval
AgeCommit message (Collapse)AuthorLines
2019-06-29Rollup merge of #61755 - Centril:compiletest-force-check, r=petrochenkovMazdak Farrokhzad-30/+36
Add `--pass $mode` to compiletest through `./x.py` Adds a flag `--pass $mode` to compiletest, which is exposed through `./x.py`. When `--pass $mode` is passed, `{check,build,compile,run}-pass` tests will be forced to run under the given `$mode` unless the directive `// ignore-pass` exists in the test file. The modes are explained in https://github.com/rust-lang/rust/pull/61778: - `check` has the same effect as `cargo check` - `build` or `compile` have the same effect as `cargo build` - `run` has the same effect as `cargo run` On my machine, `./x.py -i test src/test/run-pass --stage 1 --pass check` takes 38 seconds whereas it takes 2 min 7 seconds without `--pass check`. cc https://github.com/rust-lang/rust/issues/61712 r? @petrochenkov
2019-06-24Auto merge of #62081 - RalfJung:miri-pointer-checks, r=oli-obkbors-3/+3
Refactor miri pointer checks Centralize bounds, alignment and NULL checking for memory accesses in one function: `memory.check_ptr_access`. That function also takes care of converting a `Scalar` to a `Pointer`, should that be needed. Not all accesses need that though: if the access has size 0, `None` is returned. Everyone accessing memory based on a `Scalar` should use this method to get the `Pointer` they need. All operations on the `Allocation` work on `Pointer` inputs and expect all the checks to have happened (and will ICE if the bounds are violated). The operations on `Memory` work on `Scalar` inputs and do the checks themselves. The only other public method to check pointers is `memory.ptr_may_be_null`, which is needed in a few places. No need for `check_align` or similar methods. That makes the public API surface much easier to use and harder to mis-use. This should be largely no-functional-change, except that ZST accesses to a "true" pointer that is dangling or out-of-bounds are now considered UB. This is to be conservative wrt. whatever LLVM might be doing. While I am at it, this also removes the assumption that the vtable part of a `dyn Trait`-fat-pointer is a `Pointer` (as opposed to a pointer cast to an integer, stored as raw bits). r? @oli-obk
2019-06-24promoted_errors: warn -> deny.Mazdak Farrokhzad-30/+36
2019-06-23Auto merge of #61778 - petrochenkov:pass, r=Mark-Simulacrumbors-2/+0
compiletest: Introduce `// {check,build,run}-pass` pass modes Pass UI tests now have three modes ``` // check-pass // build-pass // run-pass ``` mirroring equivalent well-known `cargo` commands. `// check-pass` will compile the test skipping codegen (which is expensive and isn't supposed to fail in most cases). `// build-pass` will compile and link the test without running it. `// run-pass` will compile, link and run the test. Tests without a "pass" annotation are still considered "fail" tests. Most UI tests would probably want to switch to `check-pass`. Tests validating codegen would probably want to run the generated code as well and use `run-pass`. `build-pass` should probably be rare (linking tests?). https://github.com/rust-lang/rust/pull/61755 will provide a way to run the tests with any mode, e.g. bump `check-pass` tests to `run-pass` to satisfy especially suspicious people, and be able to make sure that codegen doesn't breaks in some entirely unexpected way. Tests marked with any mode are expected to pass with any other mode, if that's not the case for some legitimate reason, then the test should be made a "fail" test rather than a "pass" test. Perhaps some secondary CI can verify this invariant, but that's not super urgent. `// compile-pass` still works and is equivalent to `build-pass`. Why is `// compile-pass` bad - 1) it gives an impression that the test is only compiled, but not linked, 2) it doesn't mirror a cargo command. It can be removed some time in the future in a separate PR. cc https://github.com/rust-lang/rust/issues/61712
2019-06-23comment tweaks, better validation errors, update UI testsRalf Jung-3/+3
2019-06-17Make use of `ptr::null(_mut)` instead of casting zeroLzu Tao-1/+1
2019-06-16compiletest: Validate pass modes harderVadim Petrochenkov-2/+0
2019-06-13Create fewer basic blocks in match MIR loweringMatthew Jasper-3/+10
2019-06-06Bless test outputWesley Wiser-0/+12
2019-05-29Update ui test suite to use dynmemoryruins-17/+17
2019-05-12Remove feature(nll) when compare mode is sufficientMatthew Jasper-2/+0
2019-05-07compiletest: only use `make_exe_name` for tests that end up being executed.Eduard-Mihai Burtescu-2/+0
2019-04-22Update ui testsvarkor-2/+2
2019-04-22Remove double trailing newlinesvarkor-7/+0
2019-04-22update tests for migrate mode by defaultMatthew Jasper-260/+93
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-7/+7
2019-04-11Reword tracking issue noteEsteban Küber-6/+6
2019-04-10Tweak unstable diagnostic outputEsteban Küber-8/+15
2019-03-23Deduplicate const eval error spans for better outputEsteban Küber-6/+2
2019-03-23Swap const evaluation lint spans to point at problem in primary spanEsteban Küber-182/+210
2019-03-11Update NLL testsVadim Petrochenkov-14/+14
2019-03-11Update testsVadim Petrochenkov-71/+71
2019-02-23Rollup merge of #58658 - pmccarter:align_msg, r=matthewjasperMazdak Farrokhzad-6/+8
Add expected/provided byte alignments to validation error message Fixes #58617
2019-02-22#58658 bless after line split for tidyPatrick McCarter-5/+5
2019-02-22tidy line length override #58617Patrick McCarter-0/+1
2019-02-22Change byte align message wording #58617Patrick McCarter-2/+2
2019-02-22Invalid byte alignment expected/provided in message #58617Patrick McCarter-5/+6
2019-02-22Switch from error patterns to `//~ ERROR` markers.Felix S. Klock II-8/+11
AFAICT, we do not have the same const-eval issues that we used to when rust-lang/rust#23926 was filed. (Probably because of the switch to miri for const-evaluation.)
2019-01-22Rollup merge of #57813 - RalfJung:validation-range-printing, r=oli-obkMazdak Farrokhzad-3/+18
fix validation range printing when encountering undef
2019-01-21fix validation range printing when encountering undefRalf Jung-3/+18
2019-01-21Declare some unconst operations as unsafe in const fnOliver Scherer-12/+12
2019-01-09Stabilize `let` bindings and destructuring in constants and const fnOliver Scherer-22/+13
2018-12-25Remove licensesMark Rousskov-899/+179
2018-12-20Auto merge of #54125 - varkor:less-conservative-uninhabitedness-check, ↵bors-21/+15
r=nikomatsakis Less conservative uninhabitedness check Extends the uninhabitedness check to structs, non-empty enums, tuples and arrays. Pulled out of #47291 and #50262. Fixes https://github.com/rust-lang/rust/issues/54586. r? @nikomatsakis
2018-12-18Auto merge of #56160 - oli-obk:const_fn_let, r=nikomatsakisbors-11/+16
Fix various aspects around `let` bindings inside const functions * forbid `let` bindings in const contexts that use short circuiting operators * harden analysis code against derefs of mutable references Initially this PR was about stabilizing `let` bindings, but too many flaws were exposed that need some more testing on nightly
2018-12-11Fix some misbehaving testsvarkor-3/+3
2018-12-11Update ub-uninhabit testsvarkor-5/+5
2018-12-11Use unions for uninhabitedness checking rather than mem::transmutevarkor-25/+17
2018-12-11Update const eval uninhabited messagesvarkor-5/+7
2018-12-08Fixed nll stderr file.Alexander Regueiro-1/+1
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-4/+4
2018-12-04Update testsOliver Scherer-0/+1
2018-11-30Reenable `const_let` feature gateOliver Scherer-17/+37
2018-11-30Allow `let` bindings everywhereOliver Scherer-43/+28
2018-11-26Auto merge of #56070 - oli-obk:const_let, r=eddybbors-15/+77
Allow assignments in const contexts fixes https://github.com/rust-lang/rust/issues/54098 fixes https://github.com/rust-lang/rust/issues/51251 fixes https://github.com/rust-lang/rust/issues/52613
2018-11-20Explain missing error in testOliver Scherer-1/+4
2018-11-19we now do proper validation on scalarsRalf Jung-13/+13
2018-11-19Make const_eval_raw query return just an AllocIdRalf Jung-16/+22
2018-11-19Also catch static mutation at evaluation timeOliver Scherer-17/+45
2018-11-19Rollup merge of #56059 - alexcrichton:fix-tests, r=sfacklerkennytm-0/+27
Increase `Duration` approximate equal threshold to 1us Previously this threshold when testing was 100ns, but the Windows documentation states: > which is a high resolution (<1us) time stamp which presumably means that we could have up to 1us resolution, which means that 100ns doesn't capture "equivalent" time intervals due to various bits of rounding here and there. It's hoped that this.. Closes #56034