rust/src/test/ui/consts
Mazdak Farrokhzad bd8f464877
Rollup merge of #57175 - oli-obk:const_let_stabilization, r=nikomatsakis
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-12 10:54:56 +01:00
..
auxiliary Remove licenses 2018-12-25 21:08:33 -07:00
const-eval Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
min_const_fn const_let: --bless with --compare-mode=nll 2019-01-12 10:32:27 +01:00
std Tidy ♪ all ♪ the ♪ way ♪♪♪♪ with ♪ a ♪ newline ♪ missing ♪ cry ♪♪ 2018-11-10 01:11:06 +01:00
const-array-oob-arith.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-array-oob-arith.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-array-oob.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-array-oob.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-block-non-item-statement.rs Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
const-call.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-call.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-cast-different-types.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-cast-different-types.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-cast-wrong-type.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-cast-wrong-type.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-deref-ptr.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-deref-ptr.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-err-early.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-err-early.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-err-multi.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-err-multi.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-err.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-err.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-err2.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-err2.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-err4.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-err4.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-expr-addr-operator.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-fn-destructuring-arg.rs Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
const-fn-mismatch.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-fn-mismatch.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-fn-not-in-trait.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-fn-not-in-trait.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-fn-not-safe-for-const.rs Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
const-fn-not-safe-for-const.stderr Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
const-fn-stability-calls-3.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-int-conversion.nll.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-int-conversion.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-int-conversion.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-int-overflowing.nll.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-int-overflowing.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-int-overflowing.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-int-rotate.nll.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-int-rotate.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-int-rotate.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-int-sign.nll.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-int-sign.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-int-sign.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-int-unchecked.rs unchecked_{shl,shr}: extend const tests. 2018-12-31 03:36:46 +01:00
const-int-unchecked.stderr unchecked_{shl,shr}: extend const tests. 2018-12-31 03:36:46 +01:00
const-int-wrapping.nll.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-int-wrapping.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-int-wrapping.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-integer-bool-ops.rs Improve type mismatch error messages 2018-12-31 20:43:08 -05:00
const-integer-bool-ops.stderr Improve type mismatch error messages 2018-12-31 20:43:08 -05:00
const-len-underflow-separate-spans.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-len-underflow-separate-spans.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-len-underflow-subspans.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-len-underflow-subspans.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-match-check.eval1.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-match-check.eval2.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-match-check.matchck.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-match-check.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-match-pattern-arm.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-match-pattern-arm.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-nonzero.rs Update src/test/ui/consts/const-nonzero.rs 2018-12-28 17:45:49 +05:30
const-pattern-irrefutable.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-pattern-irrefutable.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-pattern-not-const-evaluable.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-prop-ice.rs Fix tidy 2018-11-09 10:11:20 +01:00
const-prop-ice.stderr Prevent ICE in const-prop array oob check 2018-11-08 20:15:13 +01:00
const-prop-ice2.rs Fix tidy 2018-11-09 10:11:20 +01:00
const-prop-ice2.stderr Add more regression tests 2018-11-08 20:18:26 +01:00
const-size_of-cycle.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-size_of-cycle.stderr Set a def_id in ParamEnv only with -Z chalk 2018-12-27 19:21:17 +01:00
const-slice-oob.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-slice-oob.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-tup-index-span.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-tup-index-span.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-type-mismatch.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-type-mismatch.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-typeid-of.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-typeid-of.stderr Remove licenses 2018-12-25 21:08:33 -07:00
const-unsized.rs Remove licenses 2018-12-25 21:08:33 -07:00
const-unsized.stderr Fix broken links to second edition TRPL. 2019-01-01 12:53:07 -05:00
const-validation-fail-55455.rs Fix wrong validation clasisfication of Option<&T>::Some values 2018-10-29 15:22:47 +01:00
const_fn_return_nested_fn_ptr.rs Don't auto-inline const fn 2018-11-17 17:50:37 +01:00
const_let_assign.rs Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
const_let_assign2.rs const fn feature gate is not needed anymore in a lot of tests 2019-01-09 10:20:44 +01:00
const_let_assign3.rs const fn feature gate is not needed anymore in a lot of tests 2019-01-09 10:20:44 +01:00
const_let_assign3.stderr const fn feature gate is not needed anymore in a lot of tests 2019-01-09 10:20:44 +01:00
const_let_eq.rs const fn feature gate is not needed anymore in a lot of tests 2019-01-09 10:20:44 +01:00
const_let_eq_float.rs Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
const_let_irrefutable.rs Fix irrefutable slice patterns in const fn 2019-01-09 11:32:56 +01:00
const_let_refutable.rs Fix irrefutable slice patterns in const fn 2019-01-09 11:32:56 +01:00
const_let_refutable.stderr Fix irrefutable slice patterns in const fn 2019-01-09 11:32:56 +01:00
const_short_circuit.rs Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
const_short_circuit.stderr Explain that lack of short circuiting support in constants is temporary 2018-12-18 09:42:46 +01:00
dangling-alloc-id-ice.rs Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
dangling-alloc-id-ice.stderr Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
dangling_raw_ptr.rs Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
dangling_raw_ptr.stderr Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
int_ptr_for_zst_slices.rs Reintroduce zst-slice reading read_bytes method on Memory 2018-11-24 11:36:32 +01:00
issue-54224.rs Reenable const_let feature gate 2018-11-30 09:44:15 +01:00
issue-54224.stderr Reenable const_let feature gate 2018-11-30 09:44:15 +01:00
issue-56164.rs Fix const_fn ICE with non-const function pointer 2018-11-30 08:43:50 +01:00
issue-56164.stderr Fix const_fn ICE with non-const function pointer 2018-11-30 08:43:50 +01:00
partial_qualif.rs Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
partial_qualif.stderr Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
projection_qualif.rs Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
projection_qualif.stderr Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
promote_const_let.nll.stderr const_let: --bless with --compare-mode=nll 2019-01-12 10:32:27 +01:00
promote_const_let.rs Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
promote_const_let.stderr Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
promote_fn_calls.rs Add missing rustc_promotable attribute to unsigned min_value and max_value 2018-11-09 17:55:24 +01:00
promote_fn_calls_std.rs Add missing rustc_promotable attribute to unsigned min_value and max_value 2018-11-09 17:55:24 +01:00
promoted-validation-55454.rs Fix wrong validation clasisfication of Option<&T>::Some values 2018-10-29 15:22:47 +01:00
promoted_regression.rs Remove a wrong multiplier on relocation offset computation 2018-12-17 16:47:26 +01:00
qualif_overwrite.rs Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
qualif_overwrite.stderr Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
qualif_overwrite_2.rs Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
qualif_overwrite_2.stderr Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
single_variant_match_ice.rs Add a test for single variant matches 2018-11-30 09:44:06 +01:00
single_variant_match_ice.stderr Add a test for single variant matches 2018-11-30 09:44:06 +01:00
static_mut_containing_mut_ref.rs Fix a recently introduces regression 2018-12-21 11:27:29 +01:00
static_mut_containing_mut_ref2.rs Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
static_mut_containing_mut_ref2.stderr Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
static_mut_containing_mut_ref3.rs Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
static_mut_containing_mut_ref3.stderr Stabilize let bindings and destructuring in constants and const fn 2019-01-09 10:20:12 +01:00
validate_never_arrays.rs Clean up array/slice of primitive validation 2018-11-24 11:36:32 +01:00
validate_never_arrays.stderr Update tests 2018-12-11 12:19:23 +00:00