about summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-23/+21
2019-04-17Rollup merge of #59646 - JohnTitor:improve-wording, r=oli-obkMazdak Farrokhzad-18/+19
const fn: Improve wording fixes #59611 This might need discussion. Feel free to close this PR if we don't need to fix.
2019-04-16Fix testsYuki OKUSHI-18/+19
2019-04-11Reword tracking issue noteEsteban Küber-12/+12
2019-04-10Tweak unstable diagnostic outputEsteban Küber-14/+27
2019-04-07Only run SIMD tests on x86Oliver Scherer-3/+9
2019-04-07Add more regression tests for accidental promotionOliver Scherer-0/+37
2019-04-07Function arguments should never get promotedOliver Scherer-0/+18
2019-04-03Improve wordingYuki OKUSHI-17/+17
2019-03-23Deduplicate const eval error spans for better outputEsteban Küber-28/+12
2019-03-23Swap const evaluation lint spans to point at problem in primary spanEsteban Küber-296/+336
2019-03-16Rollup merge of #59139 - oli-obk:unions_are_a_good_thing, r=RalfJungkennytm-0/+11
Unregress using scalar unions in constants. fixes https://github.com/rust-lang/rust/issues/59126 r? @RalfJung I also made a bunch of these invariants panic instead of report an error.
2019-03-15rustc: provide DisambiguatedDefPathData in ty::print.Eduard-Mihai Burtescu-4/+4
2019-03-15rustc: pass Option<&Substs> and Namespace around in ty::item_path.Eduard-Mihai Burtescu-1/+1
2019-03-12Unregress using scalar unions in constants.Oliver Scherer-0/+11
2019-03-11Update NLL testsVadim Petrochenkov-51/+51
2019-03-11Update testsVadim Petrochenkov-163/+163
2019-03-11Auto merge of #58784 - oli-obk:accidental_promotion, r=eddybbors-0/+18
Don't promote function calls to nonpromotable things fixes https://github.com/rust-lang/rust/issues/58767 and fixes https://github.com/rust-lang/rust/issues/58634 r? @eddyb should we additionally check the function call return type? It might be a promotable function (or any `const fn` inside a `const fn`), but its return type might contain interior mutability.
2019-03-09Rollup merge of #58750 - TimDiekmann:master, r=oli-obkMazdak Farrokhzad-0/+99
Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const
2019-03-03Add .nll.stderr outputTim-0/+39
2019-03-02Point at enum definition when match patterns are not exhaustiveEsteban Küber-0/+2
``` error[E0004]: non-exhaustive patterns: type `X` is non-empty --> file.rs:9:11 | 1 | / enum X { 2 | | A, | | - variant not covered 3 | | B, | | - variant not covered 4 | | C, | | - variant not covered 5 | | } | |_- `X` defined here ... 9 | match x { | ^ | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `B` and `C` not covered --> file.rs:11:11 | 1 | / enum X { 2 | | A, 3 | | B, 4 | | C, | | - not covered 5 | | } | |_- `X` defined here ... 11 | match x { | ^ patterns `C` not covered ``` When a match expression doesn't have patterns covering every variant, point at the enum's definition span. On a best effort basis, point at the variant(s) that are missing. This does not handle the case when the missing pattern is due to a field's enum variants: ``` enum E1 { A, B, C, } enum E2 { A(E1), B, } fn foo() { match E2::A(E1::A) { E2::A(E1::B) => {} E2::B => {} } //~^ ERROR `E2::A(E1::A)` and `E2::A(E1::C)` not handled } ``` Unify look between match with no arms and match with some missing patterns. Fix #37518.
2019-02-28Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` constTim-0/+60
Make `Unique::as_ptr` const without feature attribute as it's unstable Make `NonNull::dangling` and `NonNull::cast` const with `feature = "const_ptr_nonnull"`
2019-02-27Don't promote function calls to nonpromotable thingsOliver Scherer-0/+18
2019-02-23Rollup merge of #58658 - pmccarter:align_msg, r=matthewjasperMazdak Farrokhzad-6/+8
Add expected/provided byte alignments to validation error message Fixes #58617
2019-02-22#58658 bless after line split for tidyPatrick McCarter-5/+5
2019-02-22tidy line length override #58617Patrick McCarter-0/+1
2019-02-22Change byte align message wording #58617Patrick McCarter-2/+2
2019-02-22Invalid byte alignment expected/provided in message #58617Patrick McCarter-5/+6
2019-02-22Switch from error patterns to `//~ ERROR` markers.Felix S. Klock II-8/+11
AFAICT, we do not have the same const-eval issues that we used to when rust-lang/rust#23926 was filed. (Probably because of the switch to miri for const-evaluation.)
2019-02-17Rollup merge of #58479 - saleemjaffer:test_promote_evaluation_unused_result, ↵kennytm-0/+8
r=oli-obk compile-pass test for #53606 fixes #53606
2019-02-15compile-pass test for #53606Saleem Jaffer-0/+8
2019-02-14Add updated NLL testsvarkor-37/+108
2019-02-14Update const fn testsvarkor-61/+190
2019-01-31Add a forever unstable opt-out of const qualification checksOliver Scherer-0/+126
2019-01-25Rollup merge of #57734 - oli-obk:fixes_and_cleanups, r=pnkfelixMazdak Farrokhzad-0/+13
Fix evaluating trivial drop glue in constants ```rust struct A; impl Drop for A { fn drop(&mut self) {} } const FOO: Option<A> = None; const BAR: () = (FOO, ()).1; ``` was erroring with ``` error: any use of this value will cause an error --> src/lib.rs:9:1 | 9 | const BAR: () = (FOO, ()).1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^-^ | | | calling non-const function `std::ptr::real_drop_in_place::<(std::option::Option<A>, ())> - shim(Some((std::option::Option<A>, ())))` | = note: #[deny(const_err)] on by default error: aborting due to previous error ``` before this PR. According to godbolt this last compiled successfully in 1.27
2019-01-22Add regression testOliver Scherer-3/+11
2019-01-22Get rid of the fake stack frameOliver Scherer-0/+11
2019-01-22Auto merge of #57830 - Centril:rollup, r=Centrilbors-3/+18
Rollup of 9 pull requests Successful merges: - #57537 (Small perf improvement for fmt) - #57552 (Default images) - #57604 (Make `str` indexing generic on `SliceIndex`.) - #57667 (Fix memory leak in P::filter_map) - #57677 (const_eval: Predetermine the layout of all locals when pushing a stack frame) - #57791 (Add regression test for #54582) - #57798 (Corrected spelling inconsistency) - #57809 (Add powerpc64-unknown-freebsd) - #57813 (fix validation range printing when encountering undef) Failed merges: r? @ghost
2019-01-22Rollup merge of #57813 - RalfJung:validation-range-printing, r=oli-obkMazdak Farrokhzad-3/+18
fix validation range printing when encountering undef
2019-01-22Auto merge of #56221 - estebank:remove-dummy-checks, r=varkorbors-2/+2
Remove unnecessary dummy span checks The emitter already verifies wether a given span note or span label can be emitted to the output. If it can't, because it is a dummy span, it will be either elided for labels or emitted as an unspanned note/help when applicable.
2019-01-21fix validation range printing when encountering undefRalf Jung-3/+18
2019-01-21Declare some unconst operations as unsafe in const fnOliver Scherer-54/+82
2019-01-20Remove unnecessary dummy span checksEsteban Küber-2/+2
The emitter already verifies wether a given span note or span label can be emitted to the output. If it can't, because it is a dummy span, it will be either elided for labels or emitted as an unspanned note/help when applicable.
2019-01-18Allow evaluating trivial drop glue in constantsOliver Scherer-0/+13
2019-01-12Rollup merge of #57175 - oli-obk:const_let_stabilization, r=nikomatsakisMazdak Farrokhzad-360/+152
Stabilize `let` bindings and destructuring in constants and const fn r? @Centril This PR stabilizes the following features in constants and `const` functions: * irrefutable destructuring patterns (e.g. `const fn foo((x, y): (u8, u8)) { ... }`) * `let` bindings (e.g. `let x = 1;`) * mutable `let` bindings (e.g. `let mut x = 1;`) * assignment (e.g. `x = y`) and assignment operator (e.g. `x += y`) expressions, even where the assignment target is a projection (e.g. a struct field or index operation like `x[3] = 42`) * expression statements (e.g. `3;`) This PR does explicitly *not* stabilize: * mutable references (i.e. `&mut T`) * dereferencing mutable references * refutable patterns (e.g. `Some(x)`) * operations on `UnsafeCell` types (as that would need raw pointers and mutable references and such, not because it is explicitly forbidden. We can't explicitly forbid it as such values are OK as long as they aren't mutated.) * We are not stabilizing `let` bindings in constants that use `&&` and `||` short circuiting operations. These are treated as `&` and `|` inside `const` and `static` items right now. If we stopped treating them as `&` and `|` after stabilizing `let` bindings, we'd break code like `let mut x = false; false && { x = true; false };`. So to use `let` bindings in constants you need to change `&&` and `||` to `&` and `|` respectively.
2019-01-12const_let: --bless with --compare-mode=nllMazdak Farrokhzad-10/+19
2019-01-12Auto merge of #57234 - Centril:const-stabilizations-2, r=oli-obkbors-15/+428
Const-stabilize `const_int_ops` + `const_ip` r? @oli-obk ## Note for relnotes: This PR includes https://github.com/rust-lang/rust/pull/57105. I've added T-lang since this affects intrinsics and the operational semantics of Rust's `const fn` fragment. ## Stable APIs proposed for constification + `const_int_ops`: + `count_ones` + `count_zeros` + `leading_zeros` + `trailing_zeros` + `swap_bytes` + `from_be` + `from_le` + `to_be` + `to_le` + `const_ip` + `Ipv4Addr::new` ## Unstable APIs constified + `const_int_conversion`: + `reverse_bits`
2019-01-09Fix irrefutable slice patterns in const fnOliver Scherer-0/+25
2019-01-09const fn feature gate is not needed anymore in a lot of testsOliver Scherer-12/+13
2019-01-09Stabilize `let` bindings and destructuring in constants and const fnOliver Scherer-347/+104