about summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
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
2022-08-25Do not include `const_ptr_sub_ptr` in this stabilizationDeadbeef-0/+1
2022-08-25Stabilize `const_ptr_offset_from`.Deadbeef-4/+0
Stabilization has been completed [here](https://github.com/rust-lang/rust/issues/92980#issuecomment-1065644848) with a FCP.
2022-08-23extra sanity check against consts pointing to mutable memoryRalf Jung-10/+10
2022-08-23Rollup merge of #100861 - RalfJung:const-ice, r=oli-obkMatthias Krüger-0/+20
fix ICE with extra-const-ub-checks Fixes https://github.com/rust-lang/rust/issues/100771
2022-08-22bless ui testsNilstrieb-1/+1
2022-08-21fix ICE with extra-const-ub-checksRalf Jung-0/+20
2022-08-21Adjust messages, address some nitsMichael Goulet-2/+2
2022-08-20Rollup merge of #100507 - cameron1024:suggest-lazy, r=compiler-errorsMatthias Krüger-0/+3
suggest `once_cell::Lazy` for non-const statics Addresses https://github.com/rust-lang/rust/issues/100410 Some questions: - removing the `if` seems to include too many cases (e.g. calls to non-const functions inside a `const fn`), but this code excludes the following case: ```rust const FOO: Foo = non_const_fn(); ``` Should we suggest `once_cell` in this case as well? - The original issue mentions suggesting `AtomicI32` instead of `Mutex<i32>`, should this PR address that as well?
2022-08-19Rollup merge of #100208 - RalfJung:dyn-upcast-nop, r=petrochenkovDylan DPC-20/+38
make NOP dyn casts not require anything about the vtable As suggested [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/dyn-upcasting.20stabilization/near/292151439). This matches what the codegen backends already do, and what Miri did do until https://github.com/rust-lang/rust/pull/99420 when I made it super extra paranoid.
2022-08-18Reword "Required because of the requirements on the impl of ..."Andy Wang-6/+6
2022-08-14suggest lazy-static for non-const staticscameron-0/+3
2022-08-13`assert_{inhabited,zero_valid,uninit_valid}` intrinsics are safeTomasz Miąsko-6/+6
Those intrinsics either panic or do nothing. They are safe.
2022-08-12Rollup merge of #100229 - RalfJung:extra-const-ub-checks, r=lcnrDylan DPC-0/+116
add -Zextra-const-ub-checks to enable more UB checking in const-eval Cc https://github.com/rust-lang/rust/issues/99923 r? `@oli-obk`
2022-08-09compare with-flag to without-flagRalf Jung-19/+21
2022-08-07Fail gracefully when const pattern is not structural match.Camille GILLOT-0/+41
2022-08-07add -Zextra-const-ub-checks to enable more UB checking in const-evalRalf Jung-0/+114
2022-08-06make NOP dyn casts not require anything about the vtableRalf Jung-20/+38
2022-08-03Warn about dead tuple struct fieldsFabian Wolff-6/+8
2022-07-28Remove guess_head_span.Camille GILLOT-3/+3
2022-07-27Rollup merge of #99651 - compiler-errors:fn-and-raw-ptr-in-const-generics, ↵Guillaume Gomez-4/+17
r=oli-obk Deeply deny fn and raw ptrs in const generics I think this is right -- just because we wrap a fn ptr in a wrapper type does not mean we should allow it in a const parameter. We now reject both of these in the same way: ``` #![feature(adt_const_params)] #[derive(Eq, PartialEq)] struct Wrapper(); fn foo<const W: Wrapper>() {} fn foo2<const F: fn()>() {} ``` This does regress one test (`src/test/ui/consts/refs_check_const_eq-issue-88384.stderr`), but I'm not sure it should've passed in the first place. cc: ``@b-naber`` who introduced that test^ fixes #99641
2022-07-26Fix diagnostics for unfulfilled obligationsDeadbeef-10/+0
2022-07-26bless tests, remove nonexistent E0395Deadbeef-43/+83
2022-07-25Deeply deny fn and raw ptrs in const genericsMichael Goulet-4/+17
2022-07-24interpret, ptr_offset_from: refactor and test too-far-apart checkRalf Jung-18/+99
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-166/+181
2022-07-19Mention first and last macro in backtraceMichael Goulet-49/+49
2022-07-19feat: omit suffixes in const generics (e.g. `1_i32`)Artur Sinila-2/+2
Closes #99255
2022-07-15Auto merge of #98203 - kckeiks:gather-body-owners-in-hir-item-queries, ↵bors-6/+6
r=cjgillot gather body owners Issue #96341
2022-07-13add array tests, cleanup, tidy, and blessRalf Jung-3/+3
2022-07-13remove untagged_union feature gateRalf Jung-16/+18
2022-07-09Partially stabilize const_slice_from_raw_partsKonrad Borowski-2/+0
This doesn't stabilize methods working on mutable pointers.
2022-07-09Rollup merge of #98980 - RalfJung:const-prop-ice, r=oli-obkDylan DPC-0/+18
fix ICE in ConstProp Fixes https://github.com/rust-lang/rust/issues/96169
2022-07-08Auto merge of #98816 - estebank:implicit-sized, r=oli-obkbors-1/+1
Track implicit `Sized` obligations in type params When we evaluate `ty::GenericPredicates` we introduce the implicit `Sized` predicate of type params, but we do so with only the `Predicate` its `Span` as context, we don't have an `Obligation` or `ObligationCauseCode` we could influence. To try and carry this information through, we add a new field to `ty::GenericPredicates` that tracks both which predicates come from a type param and whether that param has any bounds already (to use in suggestions). We also suggest adding a `?Sized` bound if appropriate on E0599. Address part of #98539.
2022-07-07Tweak wording and spansEsteban Küber-3/+3
2022-07-07On partial uninit error point at where we need initEsteban Küber-3/+5
When a binding is declared without a value, borrowck verifies that all codepaths have *one* assignment to them to initialize them fully. If there are any cases where a condition can be met that leaves the binding uninitialized or we attempt to initialize a field of an unitialized binding, we emit E0381. We now look at all the statements that initialize the binding, and use them to explore branching code paths that *don't* and point at them. If we find *no* potential places where an assignment to the binding might be missing, we display the spans of all the existing initializers to provide some context.
2022-07-07Track implicit `Sized` obligations in type paramsEsteban Küber-1/+1
Suggest adding a `?Sized` bound if appropriate on E0599 by inspecting the HIR Generics. (Fix #98539)
2022-07-06update testMiguel Guarniz-6/+6
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-06blessRalf Jung-7/+7
2022-07-06fix ICE in ConstPropRalf Jung-0/+18
2022-07-05add testRalf Jung-0/+15