summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
2022-12-11Bump the const eval step limitOli Scherer-4/+4
2022-11-15Use `nominal_obligations_without_const` in wf for FnDefDeadbeef-0/+5
2022-10-23Add normalize hack backMichael Goulet-0/+31
2022-10-20Do not suggest trivially false const predicatesMichael Goulet-28/+0
2022-10-14Rollup merge of #102938 - c410-f3r:here-we-go-again, r=petrochenkovDylan DPC-0/+21
Move some tests to more reasonable directories r? ``@petrochenkov``
2022-10-13Move some tests to more reasonable directoriesCaio-0/+21
2022-10-12Rollup merge of #102187 - b-naber:inline-const-source-info, r=eholkDylan DPC-0/+67
Use correct location for type tests in promoted constants Previously we forgot to remap the location in a type test collected when visiting the body of a promoted constant back to the usage location, causing an ICE when trying to get span information for that type test. Fixes https://github.com/rust-lang/rust/issues/102117
2022-10-10Rollup merge of #102275 - Urgau:stabilize-half_open_range_patterns, r=cjgillotYuki Okushi-1/+1
Stabilize `half_open_range_patterns` This PR stabilize `feature(half_open_range_patterns)`: ``` Allows using `..=X` as a pattern. ``` And adds a new `feature(half_open_range_patterns_in_slices)` for the slice part, https://github.com/rust-lang/rust/pull/102275#issuecomment-1267422806. The FCP was completed in https://github.com/rust-lang/rust/issues/67264.
2022-10-08Auto merge of #102315 - RalfJung:assert_unsafe_precondition, r=thomccbors-5/+5
add a few more assert_unsafe_precondition Add debug-assertion checking for `ptr.read()`, `ptr.write(_)`, and `unreachable_unchecked.` This is quite useful for [cargo-careful](https://github.com/RalfJung/cargo-careful).
2022-10-08Split slice part of feature(half_open_range_patterns) to [...]_in_slicesUrgau-1/+1
2022-10-07make const_err a hard errorRalf Jung-4743/+1156
2022-10-07add a few more assert_unsafe_preconditionRalf Jung-5/+5
2022-10-07Rollup merge of #102720 - lyming2007:issue-102397-fix, r=compiler-errorsMatthias Krüger-1/+1
do not reverse the expected type and found type for ObligationCauseCo… …de of IfExpressionWithNoElse this will fix #102397
2022-10-05do not reverse the expected type and found type for ObligationCauseCode of ↵Yiming Lei-1/+1
IfExpressionWithNoElse this will fix #102397
2022-10-05Rollup merge of #101061 - RalfJung:panic-on-uninit, r=oli-obkDylan DPC-15/+18
panic-on-uninit: adjust checks to 0x01-filling Now that `mem::uninitiailized` actually fills memory with `0x01` (https://github.com/rust-lang/rust/pull/99182), we can make it panic in a few less cases without risking a lot more UB -- which hopefully slightly improves compatibility with some old code, and which might increase the chance that we can check inside arrays in the future. We detect almost all of these with our lint, so authors of such code should still be warned -- but if this happens deep inside a dependency, the panic can be quite interruptive, so it might be better not to do it when there is no risk of LLVM UB. Therefore, adjust the `might_permit_raw_init` logic to care primarily about LLVM UB. To my knowledge, it actually covers all cases of LLVM UB now. Fixes https://github.com/rust-lang/rust/issues/66151 Cc ``@5225225``
2022-10-05change might_permit_raw_init to fully detect LLVM UB, but not more than thatRalf Jung-15/+18
2022-10-04Only allow ~const bounds for traits with #[const_trait]Oli Scherer-5/+6
2022-10-02Add a known-bug test for #102498Michael Goulet-0/+39
2022-10-01bless ui testsMaybe Waffle-329/+329
2022-09-28Rollup merge of #102232 - Urgau:stabilize-bench_black_box, r=TaKO8KiYuki Okushi-2/+0
Stabilize bench_black_box This PR stabilize `feature(bench_black_box)`. ```rust pub fn black_box<T>(dummy: T) -> T; ``` The FCP was completed in https://github.com/rust-lang/rust/issues/64102. `@rustbot` label +T-libs-api -T-libs
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-27Stabilize bench_black_boxUrgau-2/+0
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-26Auto merge of #102184 - chenyukang:fix-102087-add-binding-sugg, r=nagisabors-0/+5
Suggest Default::default() when binding isn't initialized Fixes #102087
2022-09-26make invalid_value lint a bit smarter around enumsRalf Jung-8/+8
2022-09-26Rollup merge of #102197 - Nilstrieb:const-new-🌲, r=Mark-Simulacrumfee1-dead-2/+0
Stabilize const `BTree{Map,Set}::new` The FCP was completed in #71835. Since `len` and `is_empty` are not const stable yet, this also creates a new feature for them since they previously used the same `const_btree_new` feature.
2022-09-26fix #102087, Suggest Default::default() when binding isn't initializedyukang-0/+5
2022-09-24Note the type when unable to drop values in compile timeDeadbeef-91/+91
2022-09-23Add regression test for issue #100878inquisitivecrystal-0/+8
2022-09-23Stabilize const `BTree{Map,Set}::new`Nilstrieb-2/+0
Since `len` and `is_empty` are not const stable yet, this also creates a new feature for them since they previously used the same `const_btree_new` feature.
2022-09-23add testb-naber-0/+67
2022-09-21Make error messages great again (and fix clippy and add test)Deadbeef-31/+46
2022-09-17bless tests againDeadbeef-70/+42
2022-09-16Bless ui tests after typeck code changeDeadbeef-74/+49
2022-09-16bless testsDeadbeef-75/+94
2022-09-13Use tcx.hir() utils for spans in MIR building.Camille GILLOT-1/+1
This corrects the `span_with_body` in the case of closures, which was incorrectly shortened to the `def_span`.
2022-09-09The `<*const T>::guaranteed_*` methods now return an option for the unknown caseOli Scherer-31/+19
2022-09-04Make `const_eval_select` a real intrinsicDeadbeef-40/+0
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-30Rollup merge of #101101 - RalfJung:read-pointer-as-bytes, r=oli-obkDylan DPC-20/+299
interpret: make read-pointer-as-bytes a CTFE-only error with extra information Next step in the reaction to https://github.com/rust-lang/rust/issues/99923. Also teaches Miri to implicitly strip provenance in more situations when transmuting pointers to integers, which fixes https://github.com/rust-lang/miri/issues/2456. Pointer-to-int transmutation during CTFE now produces a message like this: ``` = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported ``` r? ``@oli-obk``
2022-08-29Rollup merge of #101131 - RalfJung:ctfe-no-needs-rfc, r=oli-obkMatthias Krüger-2/+5
CTFE: exposing pointers and calling extern fn is just impossible The remaining "needs RFC" errors are just needlessly confusing, I think -- time to get rid of that error variant. They are anyway only reachable with miri-unleashed (if at all). r? `@oli-obk`
2022-08-29Rollup merge of #100897 - RalfJung:const-not-to-mutable, r=lcnrMatthias Krüger-10/+10
extra sanity check against consts pointing to mutable memory This should be both unreachable and redundant (since we already ensure that validation only reads from read-only memory, when validating consts), but I feel like we cannot be paranoid enough here, and also if this ever fails it'll be a nicer error than the "cannot read from mutable memory" error.
2022-08-28entirely get rid of NeedsRfc CTFE errorsRalf Jung-0/+3
2022-08-28CTFE: exposing pointers and calling extern fn doesn't need an RFC, it is ↵Ralf Jung-2/+2
just impossible
2022-08-28Rollup merge of #101038 - RalfJung:interning-alignment, r=oli-obkMatthias Krüger-0/+17
no alignment check during interning This should fix https://github.com/rust-lang/rust/issues/101034 r? `@oli-obk` Unfortunately we don't have a self-contained testcase for this problem. I am not sure how it can be triggered...
2022-08-27adjust testsRalf Jung-20/+299
2022-08-27Rollup merge of #96240 - fee1-dead-contrib:stabilize_const_offset_from, ↵Yuki Okushi-4/+1
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-391/+262
initialized Scalar
2022-08-26add a testRalf Jung-0/+17