about summary refs log tree commit diff
path: root/src/test/ui/consts/const-eval
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-7807/+0
2022-12-27Fix ui constant tests for big-endian platformsUlrich Weigand-778/+1647
A number of tests under ui/const-ptr and ui/consts are currently failing on big-endian platforms as the binary encoding of some constants is hard-coded in the stderr test files. Fix this by providing a normalize-stderr-test rule that strips out the raw bytes hex dump, so the comparison can be done in an endianness-independent manner. Note that in most cases, this means the tests are now also independent of word size, so the 32bit and 64bit cases can be re-unified. To keep tests that verify the details of those raw bytes dumps, a new test case raw-bytes.rs performs the tests where the hex dumps were stripped out a second time, but only on little- endian platforms. In addition, src/test/ui/const-ptr/forbidden_slices.rs exposes an endian-specific difference in this diagnostic output: constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean depending on which byte of D0 is not a boolean value (0 or 1). Fixed this by choosing a value of D0 that differs from 0 or 1 in all bytes. Fixes part of https://github.com/rust-lang/rust/issues/105383.
2022-12-15Reuse the ctfe error emitting logic for the future incompat lintOli Scherer-36/+32
2022-12-15Always report alignment failures in future incompat summariesOli Scherer-0/+36
2022-12-15Make alignment checks a future incompat lintOli Scherer-18/+22
2022-12-15adjust testsRalf Jung-134/+174
2022-12-06Bless 32 bit testsOli Scherer-5/+10
2022-12-06Change CTFE backtraces to use `note` instead of `label` to preserve their orderOli Scherer-32/+61
labels are reordered within the file in which they are reported, which can mess up the stack trace
2022-12-06Remove now-redundant file/line info from const backtracesOli Scherer-14/+14
2022-12-05Tweak "the following other types implement trait"Esteban Küber-16/+6
When *any* of the suggested impls is an exact match, *only* show the exact matches. This is particularly relevant for integer types. fix fmt
2022-11-25Add a test for scalar pair layout validationOli Scherer-3/+32
2022-11-25Print a trace through types to show how to get to the problematic typeOli Scherer-0/+10
2022-11-23Bump the const eval step limitOli Scherer-4/+4
2022-11-16fix #104390, fix ICE in in_operand for ty erroryukang-0/+75
2022-11-16cleanup and dedupe CTFE and Miri error reportingRalf Jung-107/+147
2022-11-15Auto merge of #101168 - jachris:dataflow-const-prop, r=oli-obkbors-6/+6
Add new MIR constant propagation based on dataflow analysis The current constant propagation in `rustc_mir_transform/src/const_prop.rs` fails to handle many cases that would be expected from a constant propagation optimization. For example: ```rust let x = if true { 0 } else { 0 }; ``` This pull request adds a new constant propagation MIR optimization pass based on the existing dataflow analysis framework. Since most of the analysis is not unique to constant propagation, a generic framework has been extracted. It works on top of the existing framework and could be reused for other optimzations. Closes #80038. Closes #81605. ## Todo ### Essential - [x] [Writes to inactive enum variants](https://github.com/rust-lang/rust/pull/101168#pullrequestreview-1089493974). Resolved by rejecting the registration of places with downcast projections for now. Could be improved by flooding other variants if mutable access to a variant is observed. - [X] Handle [`StatementKind::CopyNonOverlapping`](https://github.com/rust-lang/rust/pull/101168#discussion_r957774914). Resolved by flooding the destination. - [x] Handle `UnsafeCell` / `!Freeze` correctly. - [X] Overflow propagation of `CheckedBinaryOp`: Decided to not propagate if overflow flag is `true` (`false` will still be propagated) - [x] More documentation in general. - [x] Arguments for correctness, documentation of necessary assumptions. - [x] Better performance, or alternatively, require `-Zmir-opt-level=3` for now. ### Extra - [x] Add explicit unreachability, i.e. upgrading the lattice from $\mathbb{P} \to \mathbb{V}$ to $\set{\bot} \cup (\mathbb{P} \to \mathbb{V})$. - [x] Use storage statements to improve precision. - [ ] Consider opening issue for duplicate diagnostics: https://github.com/rust-lang/rust/pull/101168#issuecomment-1276609950 - [ ] Flood moved-from places with $\bot$ (requires some changes for places with tracked projections). - [ ] Add downcast projections back in. - [ ] [Algebraic simplifications](https://github.com/rust-lang/rust/pull/101168#discussion_r957967878) (possibly with a shared API; done by old const prop). - [ ] Propagation through slices / arrays. - [ ] Find other optimizations that are done by old `const_prop.rs`, but not by this one.
2022-11-12Require -Zmir-opt-level >= 3 for nowJannis Christopher Köhl-17/+3
2022-11-09Rollup merge of #103307 - b4den:master, r=estebankManish Goregaokar-14/+14
Add context to compiler error message Changed `creates a temporary which is freed while still in use` to `creates a temporary value which is freed while still in use`.
2022-11-07Update issue-50814.rs test resultJannis Christopher Köhl-9/+23
2022-10-20Do not suggest trivially false const predicatesMichael Goulet-20/+0
2022-10-20Update tests to match error message changesb4den-14/+14
2022-10-07make const_err a hard errorRalf Jung-3039/+560
2022-10-01bless ui testsMaybe Waffle-216/+216
2022-09-27Rollup merge of #102281 - RalfJung:invalid-enums, r=cjgillotMatthias Krüger-44/+45
make invalid_value lint a bit smarter around enums Fixes https://github.com/rust-lang/rust/issues/102043
2022-09-27also query type_uninhabited_fromRalf Jung-36/+37
2022-09-26Rollup merge of #102181 - inquisitivecrystal:issue-100878-test, ↵Matthias Krüger-0/+8
r=Mark-Simulacrum Add regression test This adds a regression test for issue #100878. Closes #100878.
2022-09-26make invalid_value lint a bit smarter around enumsRalf Jung-8/+8
2022-09-24Note the type when unable to drop values in compile timeDeadbeef-18/+18
2022-09-23Add regression test for issue #100878inquisitivecrystal-0/+8
2022-09-16bless testsDeadbeef-4/+4
2022-08-31Fix a bunch of typoDezhi Wu-1/+1
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-27adjust testsRalf Jung-0/+216
2022-08-27Rollup merge of #96240 - fee1-dead-contrib:stabilize_const_offset_from, ↵Yuki Okushi-1/+0
r=Mark-Simulacrum Stabilize `const_ptr_offset_from`. Stabilization has been completed [here](https://github.com/rust-lang/rust/issues/92980#issuecomment-1065644848) with a FCP. Closes #92980.
2022-08-26make read_immediate error immediately on uninit, so ImmTy can carry ↵Ralf Jung-372/+252
initialized Scalar
2022-08-25Stabilize `const_ptr_offset_from`.Deadbeef-1/+0
Stabilization has been completed [here](https://github.com/rust-lang/rust/issues/92980#issuecomment-1065644848) with a FCP.
2022-08-06make NOP dyn casts not require anything about the vtableRalf Jung-20/+38
2022-07-26bless tests, remove nonexistent E0395Deadbeef-10/+41
2022-07-22Rollup merge of #99393 - ↵Dylan DPC-2/+2
Logarithmus:feature/99255-omit-const-generic-suffixes, r=petrochenkov feat: omit suffixes in const generics (e.g. `1_i32`) Closes #99255
2022-07-20bless some testsRalf Jung-52/+39
2022-07-20make use of symbolic vtables in interpreterRalf Jung-160/+175
2022-07-19Mention first and last macro in backtraceMichael Goulet-38/+38
2022-07-19feat: omit suffixes in const generics (e.g. `1_i32`)Artur Sinila-2/+2
Closes #99255
2022-07-09Partially stabilize const_slice_from_raw_partsKonrad Borowski-1/+0
This doesn't stabilize methods working on mutable pointers.
2022-07-06blessRalf Jung-4/+4
2022-07-05Rollup merge of #98860 - RalfJung:dangling-int-ptr, r=davidtwcoMatthias Krüger-6/+6
adjust dangling-int-ptr error message based on suggestions by `@saethlin` in https://github.com/rust-lang/miri/issues/2163 Fixes https://github.com/rust-lang/miri/issues/2163 I also did a bit of refactoring on this, so we have a helper method to create a `Pointer` with `None` provenance.
2022-07-05adjust dangling-int-ptr error messageRalf Jung-6/+6
2022-07-05Rollup merge of #98624 - davidtwco:translation-on-lints, r=compiler-errorsDylan DPC-2/+2
lints: mostly translatable diagnostics As lints are created slightly differently than other diagnostics, intended to try make them translatable first and then look into the applicability of diagnostic structs but ended up just making most of the diagnostics in the crate translatable (which will still be useful if I do make a lot of them structs later anyway). r? ``@compiler-errors``
2022-07-01Shorten def_span for more items.Camille GILLOT-1041/+614
2022-06-30lint: port non-fmt-panic diagnosticsDavid Wood-2/+2
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-29interpret: adjust error from constructing an invalid valueRalf Jung-132/+132