about summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
2020-11-10Rollup merge of #78669 - sasurau4:test/check-pass-consts, r=jyn514Jonas Schievink-4/+4
Use check-pass instead of build-pass in some consts ui test suits Helps with #62277 Changed tests modified by https://github.com/rust-lang/rust/pull/57175 because of the stabilization `#![feature(const_let)]`. They should be compile-fail because the feature gate checking disallow the feature before stabilization. So the feature gate checking have nothing to do with codegen according to https://rustc-dev-guide.rust-lang.org/feature-gate-ck.html.
2020-11-10use check-pass instead of build-pass in consts ui test suitsDaiki Ihara-4/+4
2020-11-09Add `#[cfg(panic = "...")]`David Hewitt-3/+3
2020-11-05update dangling-alloc-id-ice testVishnunarayan K I-15/+2
2020-11-04make intern_const_alloc_recursive return error fix #78655Vishnunarayan K I-0/+40
2020-10-26move &mut-in-const check from interning to validationRalf Jung-3/+5
2020-10-26move UnsafeCell-in-const check from interning to validationRalf Jung-6/+11
2020-10-25Rollup merge of #78208 - liketechnik:issue-69399, r=oli-obkYuki Okushi-10/+10
replace `#[allow_internal_unstable]` with `#[rustc_allow_const_fn_unstable]` for `const fn`s `#[allow_internal_unstable]` is currently used to side-step feature gate and stability checks. While it was originally only meant to be used only on macros, its use was expanded to `const fn`s. This pr adds stricter checks for the usage of `#[allow_internal_unstable]` (only on macros) and introduces the `#[rustc_allow_const_fn_unstable]` attribute for usage on `const fn`s. This pr does not change any of the functionality associated with the use of `#[allow_internal_unstable]` on macros or the usage of `#[rustc_allow_const_fn_unstable]` (instead of `#[allow_internal_unstable]`) on `const fn`s (see https://github.com/rust-lang/rust/issues/69399#issuecomment-712911540). Note: The check for `#[rustc_allow_const_fn_unstable]` currently only validates that the attribute is used on a function, because I don't know how I would check if the function is a `const fn` at the place of the check. I therefore openend this as a 'draft pull request'. Closes rust-lang/rust#69399 r? @oli-obk
2020-10-25Auto merge of #77526 - RalfJung:dont-promote-unions, r=lcnrbors-1/+16
stop promoting union field accesses in 'const' Turns out that promotion of union field accesses is the only difference between "promotion in `const`/`static` bodies" and "explicit promotion". So if we can remove this, we have finally achieved what I thought to already be the case -- that the bodies of `const`/`static` initializers behave the same as explicit promotion contexts. The reason we do not want to promote union field accesses is that they can introduce UB, i.e., they can go wrong. We want to [minimize the ways promoteds can fail to evaluate](https://github.com/rust-lang/const-eval/issues/53). Also this change makes things more consistent overall, removing a special case that was added without much consideration (as far as I can tell). Cc `@rust-lang/wg-const-eval`
2020-10-24Rollup merge of #78072 - Nadrieril:cleanup-constant-matching, r=varkorJonas Schievink-0/+98
Cleanup constant matching in exhaustiveness checking This supercedes https://github.com/rust-lang/rust/pull/77390. I made the `Opaque` constructor work. I have opened two issues https://github.com/rust-lang/rust/issues/78071 and https://github.com/rust-lang/rust/issues/78057 from the discussion we had on the previous PR. They are not regressions nor directly related to the current PR so I thought we'd deal with them separately. I left a FIXME somewhere because I didn't know how to compare string constants for equality. There might even be some unicode things that need to happen there. In the meantime I preserved previous behavior. EDIT: I accidentally fixed #78071
2020-10-22Add test for const panic!(CONST).Mara Bos-17/+45
2020-10-22Rollup merge of #78172 - wesleywiser:close_77062, r=oli-obkYuki Okushi-0/+5
Add test case for #77062 Closes #77062
2020-10-22Rollup merge of #77420 - ecstatic-morse:const-checking-raw-mut-ref, r=davidtwcoYuki Okushi-25/+17
Unify const-checking structured errors for `&mut` and `&raw mut` Resolves #77414 as well as a FIXME.
2020-10-21switch allow_internal_unstable const fns to rustc_allow_const_fn_unstableFlorian Warzecha-10/+10
2020-10-21Add a test for #53708Nadrieril-0/+11
This issue was accidentally fixed recently, probably by #70743
2020-10-20Add test case for #77062Wesley Wiser-0/+5
Closes #77062
2020-10-18Add some testsNadrieril-0/+87
2020-10-18we can test std and core panic macros togetherRalf Jung-70/+90
2020-10-17Suggest minimal subset features in `incomplete_features` lintYuki Okushi-0/+1
2020-10-05Remove `fn` from feature nameDylan MacKenzie-3/+3
2020-10-05Make `min_const_fn` `impl Trait` test into a gate testDylan MacKenzie-2/+4
2020-10-05Bless test outuptDylan MacKenzie-11/+10
2020-10-04But whateverecstatic-morse-0/+1
2020-10-04stop promoting union field accesses in 'const'Ralf Jung-1/+16
2020-10-03Ensure that the const-eval engine handles `#[unwind(aborts)]`Dylan MacKenzie-0/+33
2020-10-03Add check-pass test for `#[unwind(aborts)]` on a `const fn`Dylan MacKenzie-0/+17
2020-10-01Bless testsDylan MacKenzie-25/+17
2020-10-01Regression test for case in #77361Dylan MacKenzie-0/+16
2020-10-01Auto merge of #77354 - ecstatic-morse:const-checking-moar-errors, r=oli-obkbors-132/+289
Overhaul const-checking diagnostics The primary purpose of this PR was to remove `NonConstOp::STOPS_CONST_CHECKING`, which causes any additional errors found by the const-checker to be silenced. I used this flag to preserve diagnostic parity with `qualify_min_const_fn.rs`, which has since been removed. However, simply removing the flag caused a deluge of errors in some cases, since an error would be emitted any time a local or temporary had a wrong type. To remedy this, I added an alternative system (`DiagnosticImportance`) to silence additional error messages that were likely to distract the user from the underlying issue. When an error of the highest importance occurs, all less important errors are silenced. When no error of the highest importance occurs, all less important errors are emitted after checking is complete. Following the suggestions from the important error is usually enough to fix the less important errors, so this should lead to better UX most of the time. There's also some unrelated diagnostics improvements in this PR isolated in their own commits. Splitting them out would be possible, but a bit of a pain. This isn't as tidy as some of my other PRs, but it should *only* affect diagnostics, never whether or not something passes const-checking. Note that there are a few trivial exceptions to this, like banning `Yield` in all const-contexts, not just `const fn`. As always, meant to be reviewed commit-by-commit. r? `@oli-obk`
2020-09-30Remove E0019, use E0015 for inline assembly in a constDylan MacKenzie-3/+3
2020-09-29Bless testsDylan MacKenzie-15/+55
2020-09-29Bless outputDylan MacKenzie-15/+95
2020-09-29Bless testsDylan MacKenzie-78/+38
2020-09-29Bless mut testsDylan MacKenzie-105/+173
2020-09-29Fix "unstable in stable" errorDylan MacKenzie-3/+12
The "otherwise" note is printed before the suggestion currently.
2020-09-29Liveness analysis for everybodyTomasz Miąsko-2/+3
Perform liveness analysis for every body instead of limiting it to fns.
2020-09-29Auto merge of #76754 - varkor:diagnostic-cleanup-ii, r=ecstatic-morsebors-97/+97
Clean up diagnostics for arithmetic operation errors Plus a small tweak to a range pattern error message.
2020-09-27Remove feature gate test for `rustc_allow_const_fn_ptr`Dylan MacKenzie-47/+0
2020-09-27Mark `min_const_fn_fn_ptr` test as gate testDylan MacKenzie-2/+4
2020-09-27Bless testsDylan MacKenzie-40/+85
2020-09-27Update tests with new feature gateDylan MacKenzie-23/+29
2020-09-26Make invalid integer operation messages consistentvarkor-97/+97
2020-09-26Rollup merge of #77122 - ecstatic-morse:const-fn-arithmetic, r=RalfJung,oli-obkRalf Jung-75/+107
Add `#![feature(const_fn_floating_point_arithmetic)]` cc #76618 This is a template for splitting up `const_fn` into granular feature gates. I think this will make it easier, both for us and for users, to track stabilization of each individual feature. We don't *have* to do this, however. We could also keep stabilizing things out from under `const_fn`. cc @rust-lang/wg-const-eval r? @oli-obk
2020-09-26Auto merge of #70743 - oli-obk:eager_const_to_pat_conversion, r=eddybbors-172/+32
Fully destructure constants into patterns r? `@varkor` as discussed in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/constants.20in.20patterns/near/192789924 we should probably crater it once reviewed
2020-09-25Move from {{closure}}#0 syntax to {closure#0} for (def) path componentsmarmeladema-7/+7
2020-09-25Use proper issue for `const_fn_floating_point_arithmetic`Dylan MacKenzie-6/+6
2020-09-25Move const fn floating point test out of `min_const_fn`Dylan MacKenzie-62/+94
2020-09-25Bless testsDylan MacKenzie-24/+24
2020-09-25Rollup merge of #77136 - ecstatic-morse:issue-77134, r=oli-obkJonas Schievink-38/+38
Suggest `const_mut_refs`, not `const_fn` for mutable references in `const fn` Resolves #77134. Prior to #76850, most uses of `&mut` in `const fn` ~~required~~ involved two feature gates, `const_mut_refs` and `const_fn`. The first allowed all mutable borrows of locals. The second allowed only locals, arguments and return values whose types contained `&mut`. I switched the second check to the `const_mut_refs` gate. However, I forgot update the error message with the new suggestion. Alternatively, we could revert to having two different feature gates for this. OP's code never borrows anything mutably, so it didn't need `const_mut_refs` in the past, only `const_fn`. I'd prefer to keep everything under a single gate, however. r? @oli-obk
2020-09-24Use correct type in diagnostics againOliver Scherer-5/+5