about summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
2020-03-08test discriminant of enum with uninhabited variantBastian Kauschke-0/+11
2020-03-08Rollup merge of #69646 - RalfJung:layout-visitor, r=eddybMazdak Farrokhzad-228/+305
Miri visitor: detect primitive types based on type, not layout (also, more tests) I also converted the union-based transmutes to use `mem::transmute` for increased readability. r? @eddyb @oli-obk
2020-03-08prevent potential promotion in const_discriminantBastian Kauschke-3/+5
2020-03-08constify `mem::discriminant`Bastian Kauschke-0/+22
2020-03-08fix type size mismatch on 32bitRalf Jung-20/+19
2020-03-08Rollup merge of #69561 - JohnTitor:clean-up-unstable-book, r=Mark-SimulacrumMazdak Farrokhzad-1/+0
Clean up unstable book - #58402's feature was renamed to `tidy_test_never_used_anywhere_else` and it is now used for tidy only - `read_initializer` link is wrong and the doc should be auto-generated so removed - Add dummy doc for `link_cfg` - Stop generating `compiler_builtins_lib` doc in favor of b8ccc0f8a60ac16fdc00f4b2e36e1a5db8b78295 - Make `rustc_attrs` tracking issue "None"
2020-03-07Rollup merge of #69773 - matthiaskrgr:typos, r=petrochenkovMazdak Farrokhzad-1/+1
fix various typos
2020-03-06please tidyRalf Jung-13/+14
2020-03-06better error messages for invalid boxes (and a few more tests)Ralf Jung-17/+39
2020-03-06test some more kinds of enums with uninhabited variantsRalf Jung-11/+77
2020-03-06test that we validate boxesRalf Jung-4/+49
2020-03-06const validation ub tests: use transmute instead of unionsRalf Jung-221/+165
2020-03-06miri value visitor: detect primitives by type, not layoutRalf Jung-5/+5
2020-03-06Auto merge of #69753 - pnkfelix:issue-69191-ice-on-uninhabited-enum-field, r=olibors-0/+91
Do not ICE when matching an uninhabited enum's field Fix #69191
2020-03-06fix various typosMatthias Krüger-1/+1
2020-03-06Added oli's multivariant test case (alpha renaming the enum name itself).Felix S. Klock II-3/+63
(And added Ralf's suggested test.) Added my own three-variant multi-variant as well.
2020-03-05Fix #69191Felix S. Klock II-0/+31
2020-03-05Remove eh_unwind_resume lang itemAmanieu d'Antras-2/+0
2020-03-05Bumped version number for const_eval_limit in active.rsChristoph Schmidler-3/+27
and renamed 'recursion_limit' in limits.rs to simple 'limit' because it does handle other limits too.
2020-03-05Opt out of CTFE if the 'const_eval_limit' is set to 0Christoph Schmidler-1/+9
2020-03-05Add a new test to reach const_limit setting, although with wrong WARNINGs yetChristoph Schmidler-20/+35
rename feature to const_eval_limit
2020-03-05Disable CTFE if const_limit was set to 0, otherwise use the value set, which ↵Christoph Schmidler-1/+33
defaults to 1_000_000
2020-03-05Prepare const_limit feature gate and attributeChristoph Schmidler-0/+24
2020-03-03Auto merge of #69506 - Centril:stmt-semi-none, r=petrochenkovbors-0/+2
encode `;` stmt without expr as `StmtKind::Empty` Instead of encoding `;` statements without a an expression as a tuple in AST, encode it as `ast::StmtKind::Empty`. r? @petrochenkov
2020-03-02Auto merge of #69257 - RalfJung:layout-visitor, r=eddybbors-28/+28
Adjust Miri value visitor, and doc-comment layout components I realized that I still didn't have quite the right intuition for how our `LayoutDetails` work, so I had to adjust the Miri value visitor to the things I understood better now. I also added some doc-comments to `LayoutDetails` as a hopefully canonical place to note such things. The main visitor change is that we *first* look at all the fields (according to `FieldPlacement`), and *then* check the variants and handle `Multiple` appropriately. I did not quite realize how orthogonal "fields" and "variants" are. I also moved the check for the scalar ABI to *after* checking all the fields; this leads to better (more type-driven) error messages. And it looks like we can finally remove that magic hack for `ty::Generator`. :D r? @oli-obk for the Miri/visitor changes and @eddyb for the layout docs The Miri PR is at: https://github.com/rust-lang/miri/pull/1178
2020-03-01encode `;` stmt w/o expr as `StmtKind::Empty`Mazdak Farrokhzad-0/+2
2020-03-01Make `rustc_attrs` tracking issue NoneYuki Okushi-1/+0
2020-02-28Add more context to E0599 errorsEsteban Küber-2/+2
Point at the intermediary unfullfilled trait bounds.
2020-02-26miri: validity visitor comments and path printing improvementsRalf Jung-2/+2
2020-02-22Rollup merge of #69339 - wesleywiser:test_for_69312, r=CentrilDylan DPC-0/+10
Add test for #69312 This bug was fixed by #67501. Closes #69312
2020-02-22Rollup merge of #68984 - ecstatic-morse:const-u8-is-ascii, r=sfacklerDylan DPC-0/+6
Make `u8::is_ascii` a stable `const fn` `char::is_ascii` was already stabilized as `const fn` in #55278, so there is no reason for `u8::is_ascii` to go through an unstable period. cc @rust-lang/libs
2020-02-22Stabilize const for integer {to,from}_{be,le,ne}_bytes methodsTrevor Spiteri-2/+0
All of these functions can be implemented simply and naturally as const functions, e.g. u32::from_le_bytes can be implemented as (bytes[0] as u32) | (bytes[1] as u32) << 8 | (bytes[2] as u32) << 16 | (bytes[3] as u32) << 24 So stabilizing the constness will not expose that internally they are implemented using transmute which is not const in stable.
2020-02-21Auto merge of #69330 - Centril:literally-melting-ice, r=eddybbors-0/+26
`lit_to_const`: gracefully bubble up type errors. Fixes https://github.com/rust-lang/rust/issues/69310 which was injected by https://github.com/rust-lang/rust/pull/68118. r? @pnkfelix @varkor @eddyb cc @skinny121
2020-02-20Add test for #69312Wesley Wiser-0/+10
This bug was fixed by #67501. Closes #69312
2020-02-20lit_to_const: gracefully bubble up type errors.Mazdak Farrokhzad-0/+26
2020-02-20Rollup merge of #69185 - RalfJung:const-prop-lints, r=oli-obkMazdak Farrokhzad-304/+518
Unify and improve const-prop lints Add a single helper method for all lints emitted by const-prop, and make that lint different from the CTFE `const_err` lint. Also consistently check overflow on *arithmetic*, not on the assertion, to make behavior the same for debug and release builds. See [this summary comment](https://github.com/rust-lang/rust/pull/69185#issuecomment-587924754) for details and the latest status. In terms of lint formatting, I went for what seems to be the better style: have a general message above the code, and then a specific message at the span: ``` error: this arithmetic operation will overflow --> $DIR/const-err2.rs:21:18 | LL | let a_i128 = -std::i128::MIN; | ^^^^^^^^^^^^^^^ attempt to negate with overflow ``` We could also just have the specific message above and no text at the span if that is preferred. I also converted some of the existing tests to use compiletest revisions, so that the same test can check a bunch of different compile flags. Fixes https://github.com/rust-lang/rust/issues/69020. Helps with https://github.com/rust-lang/rust/issues/69021: debug/release are now consistent, but the assoc-const test in that issue still fails (there is a FIXME in the PR for this). The reason seems to be that const-prop notices the assoc const in `T::N << 42` and does not even bother calling `const_prop` on that operation. Has no effect on https://github.com/rust-lang/rust/issues/61821; the duplication there has entirely different reasons.
2020-02-20Rollup merge of #68978 - ecstatic-morse:const-int-pow, r=oli-obkDylan DPC-0/+37
Make integer exponentiation methods unstably const cc #53718 This makes the following inherent methods on integer primitives into unstable `const fn`: - `pow` - `checked_pow` - `wrapping_pow` - `overflowing_pow` - `saturating_pow` - `next_power_of_two` - `checked_next_power_of_two` - `wrapping_next_power_of_two` Only two changes were made to the implementation of these methods. First, I had to switch from the `?` operator, which is not yet implemented in a const context, to a `try_opt` macro. Second, `next_power_of_two` was using `ops::Add::add` (see the first commit) to "get overflow checks", so I switched to `#[rustc_inherit_overflow_checks]`. I'm not quite sure why the attribute wasn't used in the first place.
2020-02-19avoid excessive number of revisionsRalf Jung-154/+4
2020-02-18better lint namesRalf Jung-55/+55
2020-02-18Rollup merge of #69192 - JohnTitor:add-tests, r=CentrilDylan DPC-0/+45
Add more regression tests Closes #39618 Closes #51798 Closes #62894 Closes #63952 Closes #68653 r? @Centril
2020-02-18more English grammarRalf Jung-7/+7
2020-02-18miri value visitor: fix some wrong assumptions about layout; improve error ↵Ralf Jung-23/+23
messages
2020-02-16Add test for issue-63952Yuki Okushi-0/+45
2020-02-15expand assoc-const test a bit, just to be sureRalf Jung-18/+110
2020-02-15add test for issue 69020Ralf Jung-0/+57
2020-02-15more revisions and use them for another testRalf Jung-11/+130
2020-02-15fix tests, and use variants to test debug and release builds togetherRalf Jung-297/+393
2020-02-15Rollup merge of #69166 - JohnTitor:ice-const-enum, r=matthewjasperDylan DPC-0/+15
Check `has_typeck_tables` before calling `typeck_tables_of` Fixes #68684 r? @matthewjasper
2020-02-14Update testsMatthew Jasper-29/+38
2020-02-14Check `has_typeck_tables` before calling `typeck_tables_of`Yuki Okushi-0/+15