summary refs log tree commit diff
path: root/src/test/ui/consts/const-eval
AgeCommit message (Collapse)AuthorLines
2020-04-22adjust testsRalf Jung-4/+2
2020-04-19Fix some tests failing in `--pass check` modeVadim Petrochenkov-1/+1
2020-04-17Auto merge of #71049 - eddyb:const-err, r=oli-obkbors-50/+6
Add `ConstKind::Error` and convert `ErrorHandled::Reported` to it. By replicating the `ty::Error` approach to encoding "an error has occurred", all of the mechanisms that skip redundant/downstream errors are engaged and help out (see the reduction in test output). This PR also adds `ErrorHandled::Linted` for the lint case because using `ErrorHandled::Reported` *without* having emitted an error that is *guaranteed* to stop compilation, is incorrect now. r? @oli-obk cc @rust-lang/wg-const-eval @varkor @yodaldevoid
2020-04-16ty: convert `ErrorHandled::Reported` to `ConstKind::Error`.Eduard-Mihai Burtescu-50/+6
2020-04-16test fast path offset reportingRalf Jung-2/+112
2020-04-16switch back to 'bytes'Ralf Jung-1/+1
2020-04-15reword Miri validity errors: undefined -> uninitializedRalf Jung-3/+3
2020-04-14typeck: workaround WF hole in `to_const`.Eduard-Mihai Burtescu-2/+20
2020-04-11rustc: Add a warning count upon completionRoccoDev-7/+21
2020-04-05add testRalf Jung-0/+14
2020-04-05add testRalf Jung-0/+10
2020-03-31const backtrace: do not skip first frameRalf Jung-0/+1
2020-03-30bless testsRalf Jung-1/+1
2020-03-24bless; add test for mutating a staticRalf Jung-1/+1
2020-03-24Rollup merge of #70087 - ecstatic-morse:remove-const-eval-loop-detector, ↵Mazdak Farrokhzad-35/+7
r=RalfJung Remove const eval loop detector Now that there is a configurable instruction limit for CTFE (see #67260), we can replace the loop detector with something much simpler. See #66946 for more discussion about this. Although the instruction limit is nightly-only, the only practical way to reach the default limit uses nightly-only features as well (although CTFE will still execute code using such features inside an array initializer on stable). This will at the very least require a crater run, since it will result in an error wherever the "long running const eval" warning appeared before. We may need to increase the default for `const_eval_limit` to work around this. Resolves #54384 cc #49980 r? @oli-obk cc @RalfJung
2020-03-23Evaluate repeat expression lengths as late as possibleOliver Scherer-27/+53
2020-03-22Rename `TimeLimitReached` -> `StepLimitReached`Dylan MacKenzie-2/+2
2020-03-18Rollup merge of #69839 - RalfJung:miri-error-cleanup, r=oli-obkMazdak Farrokhzad-29/+29
Miri error reform Some time ago we started moving Miri errors into a few distinct categories, but we never classified all the old errors. That's what this PR does. ~~This is on top of https://github.com/rust-lang/rust/pull/69762; [relative diff](https://github.com/RalfJung/rust/compare/validity-errors...RalfJung:miri-error-cleanup).~~ r? @oli-obk Fixes https://github.com/rust-lang/const-eval/issues/4
2020-03-17Update const-eval testsDylan MacKenzie-35/+7
2020-03-13Auto merge of #67502 - Mark-Simulacrum:opt-catch, r=Mark-Simulacrumbors-2/+0
Optimize catch_unwind to match C++ try/catch This refactors the implementation of catching unwinds to allow LLVM to inline the "try" closure directly into the happy path, avoiding indirection. This means that the catch_unwind implementation is (after this PR) zero-cost unless a panic is thrown. https://rust.godbolt.org/z/cZcUSB is an example of the current codegen in a simple case. Notably, the codegen is *exactly the same* if `-Cpanic=abort` is passed, which is clearly not great. This PR, on the other hand, generates the following assembly: ```asm # -Cpanic=unwind: push rbx mov ebx,0x2a call QWORD PTR [rip+0x1c53c] # <happy> mov eax,ebx pop rbx ret mov rdi,rax call QWORD PTR [rip+0x1c537] # cleanup function call call QWORD PTR [rip+0x1c539] # <unfortunate> mov ebx,0xd mov eax,ebx pop rbx ret # -Cpanic=abort: push rax call QWORD PTR [rip+0x20a1] # <happy> mov eax,0x2a pop rcx ret ``` Fixes #64224, and resolves #64222.
2020-03-14Rollup merge of #69960 - RalfJung:abort, r=oli-obkYuki Okushi-1/+1
miri engine: fix treatment of abort intrinsic I screwed up in https://github.com/rust-lang/rust/pull/69830 and added `abort` to the wrong block of intrinsics, namely the one that actually has a return place. So that branch was never actually reached. r? @oli-obk
2020-03-13bless testsRalf Jung-1/+1
2020-03-12Move some more tests to `check-pass`LeSeulArtichaut-3/+6
2020-03-12Move some const-eval `build-pass` tests to `check-pass`LeSeulArtichaut-20/+20
2020-03-11make error message less confusingRalf Jung-22/+22
2020-03-11generalize InvalidNullPointerUsage to InvalidIntPointerUsageRalf Jung-3/+3
2020-03-11fmt, tweak messages and blessRalf Jung-26/+26
2020-03-08fix some cases of unexpected exceptions leaving validationRalf Jung-24/+44
2020-03-08fix type size mismatch on 32bitRalf Jung-20/+19
2020-03-06please tidyRalf Jung-13/+14
2020-03-06better error messages for invalid boxes (and a few more tests)Ralf Jung-17/+39
2020-03-06test some more kinds of enums with uninhabited variantsRalf Jung-11/+77
2020-03-06test that we validate boxesRalf Jung-4/+49
2020-03-06const validation ub tests: use transmute instead of unionsRalf Jung-221/+165
2020-03-06miri value visitor: detect primitives by type, not layoutRalf Jung-2/+2
2020-03-05Remove eh_unwind_resume lang itemAmanieu d'Antras-2/+0
2020-03-02Auto merge of #69257 - RalfJung:layout-visitor, r=eddybbors-25/+25
Adjust Miri value visitor, and doc-comment layout components I realized that I still didn't have quite the right intuition for how our `LayoutDetails` work, so I had to adjust the Miri value visitor to the things I understood better now. I also added some doc-comments to `LayoutDetails` as a hopefully canonical place to note such things. The main visitor change is that we *first* look at all the fields (according to `FieldPlacement`), and *then* check the variants and handle `Multiple` appropriately. I did not quite realize how orthogonal "fields" and "variants" are. I also moved the check for the scalar ABI to *after* checking all the fields; this leads to better (more type-driven) error messages. And it looks like we can finally remove that magic hack for `ty::Generator`. :D r? @oli-obk for the Miri/visitor changes and @eddyb for the layout docs The Miri PR is at: https://github.com/rust-lang/miri/pull/1178
2020-02-26miri: validity visitor comments and path printing improvementsRalf Jung-2/+2
2020-02-19avoid excessive number of revisionsRalf Jung-73/+1
2020-02-18better lint namesRalf Jung-32/+32
2020-02-18more English grammarRalf Jung-7/+7
2020-02-18miri value visitor: fix some wrong assumptions about layout; improve error ↵Ralf Jung-20/+20
messages
2020-02-15more revisions and use them for another testRalf Jung-3/+75
2020-02-15fix tests, and use variants to test debug and release builds togetherRalf Jung-163/+246
2020-02-09--bless --compare-mode=nllMatthias Prechtl-14/+14
2020-02-06rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros.Eduard-Mihai Burtescu-16/+16
2020-02-06rustc: rename -Zexternal-macro-backtrace to -Zmacro-backtrace.Eduard-Mihai Burtescu-16/+16
2020-01-24Normalise notes with the/isvarkor-14/+14
2020-01-18Fix some tests failing in `--pass check` modeVadim Petrochenkov-21/+23
2020-01-16Rollup merge of #68096 - varkor:diagnostic-cleanup, r=CentrilDylan DPC-2/+2
Clean up some diagnostics by making them more consistent In general: - Diagnostic should start with a lowercase letter. - Diagnostics should not end with a full stop. - Ellipses contain three dots. - Backticks should encode Rust code. I also reworded a couple of messages to make them read more clearly. It might be sensible to create a style guide for diagnostics, so these informal conventions are written down somewhere, after which we could audit the existing diagnostics. r? @Centril