about summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-27978/+0
2023-01-09Rollup merge of #106047 - uweigand:s390x-test-bigendian-ui, r=oli-obkfee1-dead-855/+1680
Fix ui constant tests for big-endian platforms 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 a combination of two types of changes: - Where possible (i.e. where the particular value of a constant does not affect the purpose of the test), choose constant values that have the same encoding on big- and little-endian platforms. - Where this is not possible, provide a normalize-stderr-test rule that transforms the printed big-endian encoding of such constants into the corresponding little-endian form. Fixes part of https://github.com/rust-lang/rust/issues/105383.
2023-01-07Auto merge of #105323 - cjgillot:simplify-const-prop, r=davidtwcobors-12/+0
Perform SimplifyLocals before ConstProp. MIR before `ConstProp` may have a lot of dead writes, this makes `ConstProp` do unnecessary work. r? `@ghost`
2023-01-06use smaller spans for missing lifetime/generic argsTakayuki Maeda-1/+1
fix rustdoc ui test
2022-12-27Fix ui constant tests for big-endian platformsUlrich Weigand-855/+1680
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-25Move SimplifyLocals before ConstProp.Camille GILLOT-12/+0
2022-12-24Auto merge of #105085 - oli-obk:stop_promoting_all_the_things, r=RalfJungbors-0/+413
Stop promoting all the things fixes #91009 r? `@RalfJung`
2022-12-22Rollup merge of #105847 - compiler-errors:issue-104396, r=oli-obkMatthias Krüger-0/+47
Ensure param-env is const before calling `eval_to_valtree` Other queries call `ParamEnv::with_const` *inside* of the query itself (e.g. `const_eval_global_id_for_typeck`), so this could alternatively be moved into the provider of `eval_to_valtree` instead. I don't have a particularly strong opinion, though *theoretically* caching is better if we make the query keys more constrained. I'm not exactly sure how this is an effect of the `-Zmir-opt-level=3` flag. Maybe something about the inliner causes us to inline an unevaluated const into a body where it can be evaluated, but where it has not yet been normalized. This seems likely, since we're inlining `from_fn_1::<{ N / 2 }, _>` in `from_fn_2`, which means that we will need to evaluate that constant during the const prop pass after inlining. Fixes #104396
2022-12-21Auto merge of #105613 - Nilstrieb:rename-assert_uninit_valid, r=RalfJungbors-3/+3
Rename `assert_uninit_valid` intrinsic It's not about "uninit" anymore but about "filling with 0x01 bytes" so the name should at least try to reflect that. This is actually not fully correct though, as it does still panic for all uninit with `-Zstrict-init-checks`. I'm not sure what the best way is to deal with that not causing confusion. I guess we could just remove the flag? I don't think having it makes a lot of sense anymore with the direction that we have chose to go. It could be relevant again if #100423 lands so removing it may be a bit over eager. r? `@RalfJung`
2022-12-17Ensure param-env is const before calling eval_to_valtreeMichael Goulet-0/+47
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-208/+186
2022-12-15always check alignment during CTFERalf Jung-12/+42
2022-12-13Rename `assert_uninit_valid` intrinsicNilstrieb-3/+3
It's not about "uninit" anymore but about "filling with 0x01 bytes" so the name should at least try to reflect that.
2022-12-13Make some diagnostics not depend on the source of what they reference being ↵Oli Scherer-153/+26
available
2022-12-07Make -Zsimulate-remapped-rust-src-base reproducible on CIOli Scherer-6/+6
2022-12-07Avoid remapping paths back to `$SRC_DIR` in CIOli Scherer-6/+6
2022-12-06Filter out precise alloc ids from diagnosticsOli Scherer-2/+3
2022-12-06Bless 32 bit testsOli Scherer-5/+10
2022-12-06Properly indent messagesOli Scherer-5/+7
2022-12-06Change CTFE backtraces to use `note` instead of `label` to preserve their orderOli Scherer-367/+1007
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-214/+214
2022-12-06Start emitting labels even if their pointed to file is not available locallyOli Scherer-0/+49
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-12-02Rollup merge of #104614 - Nilstrieb:type-ascribe!, r=TaKO8KiMatthias Krüger-2/+2
Add `type_ascribe!` macro as placeholder syntax for type ascription This makes it still possible to test the internal semantics of type ascription even once the `:`-syntax is removed from the parser. The macro now gets used in a bunch of UI tests that test the semantics and not syntax of type ascription. I might have forgotten a few tests but this should hopefully be most of them. The remaining ones will certainly be found once type ascription is removed from the parser altogether. Part of #101728
2022-12-01rustc_ast_lowering: Stop lowering imports into multiple itemsVadim Petrochenkov-2/+2
Lower them into a single item with multiple resolutions instead. This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
2022-12-01More testsOli Scherer-1/+160
2022-12-01Extend tests to cover runtime promotion cases, tooOli Scherer-6/+106
2022-11-30Close accidental promotion check holeOli Scherer-8/+93
2022-11-30Add reproduction testsOli Scherer-0/+69
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-24Rollup merge of #104782 - oli-obk:const_eval_limit_bump, r=pnkfelixMatthias Krüger-4/+4
Bump the const eval step limit fixes https://github.com/rust-lang/rust/issues/103814 https://github.com/rust-lang/rust/pull/103877 has too much of an impact to beta backport. So let's just increase the limit, avoiding the immediate breakage. r? ``@pnkfelix``
2022-11-24make `error_reported` check for delayed bugsBoxy-0/+16
2022-11-23Bump the const eval step limitOli Scherer-4/+4
2022-11-21Do not check transmute if has non region inferhi-rustin-0/+19
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-11-19Use `type_ascribe!` in many UI testsNilstrieb-2/+2
Use it in all UI tests that are about the semantics and not the syntax of type ascription.
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-278/+405
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-12Partially revert 74d53abJannis Christopher Köhl-3/+3
2022-11-12Require -Zmir-opt-level >= 3 for nowJannis Christopher Köhl-20/+6
2022-11-11Don't ICE with inline const errors during MIR buildMichael Goulet-0/+21
2022-11-10Don't ICE when encountering ConstKind::Error in RequiredConstsVisitorMichael Goulet-0/+14
2022-11-09Rollup merge of #103307 - b4den:master, r=estebankManish Goregaokar-80/+80
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-09Rollup merge of #104125 - ink-feather-org:const_cmp_tuples, r=fee1-deadDylan DPC-11/+8
Const Compare for Tuples Makes the impls for Tuples of ~const `PartialEq` types also `PartialEq`, impls for Tuples of ~const `PartialOrd` types also `PartialOrd`, for Tuples of ~const `Ord` types also `Ord`. behind the `#![feature(const_cmp)]` gate. ~~Do not merge before #104113 is merged because I want to use this feature to clean up the new test that I added there.~~ r? ``@fee1-dead``
2022-11-09Cleanup fn trait ref testonestacked-11/+8
2022-11-09Auto merge of #104180 - fee1-dead-contrib:fix-wf-fndef, r=oli-obkbors-0/+5
Use `nominal_obligations_without_const` in wf for FnDef Fixes #104155.