about summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
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
2019-01-05Rollup merge of #57249 - frewsxcv:frewsxcv-second-edition, r=KodrAuskennytm-4/+4
Fix broken links to second edition TRPL. Fixes https://github.com/rust-lang/rust/issues/57104. Remove `second-edition/` from TRPL hyperlinks.
2019-01-01Fix broken links to second edition TRPL.Corey Farwell-4/+4
Fixes https://github.com/rust-lang/rust/issues/57104.
2018-12-31Improve type mismatch error messagesYuning Zhang-16/+16
Replace "integral variable" with "integer" and replace "floating-point variable" with "floating-point number" to make the message less confusing.
2018-12-31unchecked_{shl,shr}: extend const tests.Mazdak Farrokhzad-15/+428
2018-12-28Update src/test/ui/consts/const-nonzero.rsOliver Scherer-1/+1
Co-Authored-By: Dylan-DPC <dylan.dpc@gmail.com>
2018-12-28Make the getter for NonZero types into a const fndylan_DPC-0/+9
2018-12-27Set a `def_id` in `ParamEnv` only with `-Z chalk`scalexm-1/+1
2018-12-25Remove licensesMark Rousskov-1639/+429
2018-12-23Rollup merge of #57067 - Centril:stabilize-min_const_unsafe_fn, r=oli-obkMazdak Farrokhzad-146/+75
Stabilize min_const_unsafe_fn in 1.33 Fixes #55607 r? @oli-obk
2018-12-23Rollup merge of #56916 - oli-obk:static_mut_beta_regression, r=davidtwcoMazdak Farrokhzad-0/+49
Fix mutable references in `static mut` fixes #56903
2018-12-23stabilize min_const_unsafe_fn -- revert const-size_of-cycle changesMazdak Farrokhzad-0/+4
2018-12-23stabilize min_const_unsafe_fn --bless tests.Mazdak Farrokhzad-16/+12
2018-12-23stabilize min_const_unsafe_fn in 1.33.Mazdak Farrokhzad-139/+68
2018-12-23Rollup merge of #57039 - davidtwco:migrate-warning-wording, r=pnkfelixkennytm-6/+4
Update migrate warning wording. This PR modifies the wording of the warning for backwards-incompatible changes in migrate mode. The warning messages are changed to be lowercase and not include line-breaks in order to be consistent with other compiler diagnostics.
2018-12-23Rollup merge of #56919 - oli-obk:null_ref_array_tuple, r=RalfJungkennytm-0/+9
Remove a wrong multiplier on relocation offset computation r? @RalfJung fixes #56800
2018-12-22Update migrate warning wording.David Wood-6/+4
This commit modifies the wording of the warning for backwards-incompatible changes in migrate mode. The warning messages are changed to be lowercase and not include line-breaks in order to be consistent with other compiler diagnostics.
2018-12-21Update tests to changes on masterOliver Scherer-2/+10
2018-12-21Also test projectionsOliver Scherer-1/+18
2018-12-21Fix a recently introduces regressionOliver Scherer-0/+24
2018-12-20Auto merge of #54125 - varkor:less-conservative-uninhabitedness-check, ↵bors-22/+16
r=nikomatsakis Less conservative uninhabitedness check Extends the uninhabitedness check to structs, non-empty enums, tuples and arrays. Pulled out of #47291 and #50262. Fixes https://github.com/rust-lang/rust/issues/54586. r? @nikomatsakis
2018-12-18Auto merge of #56160 - oli-obk:const_fn_let, r=nikomatsakisbors-37/+898
Fix various aspects around `let` bindings inside const functions * forbid `let` bindings in const contexts that use short circuiting operators * harden analysis code against derefs of mutable references Initially this PR was about stabilizing `let` bindings, but too many flaws were exposed that need some more testing on nightly
2018-12-18Explain that lack of short circuiting support in constants is temporaryOliver Scherer-2/+2
2018-12-18Properly worded diagnostic messageOliver Scherer-2/+2
2018-12-17Remove a wrong multiplier on relocation offset computationOliver Scherer-0/+9
2018-12-11Update testsvarkor-1/+1
2018-12-11Fix some misbehaving testsvarkor-3/+3
2018-12-11Update ub-uninhabit testsvarkor-5/+5
2018-12-11Use unions for uninhabitedness checking rather than mem::transmutevarkor-25/+17
2018-12-11Update const eval uninhabited messagesvarkor-5/+7
2018-12-11Make `const unsafe fn` bodies `unsafe`Oliver Scherer-98/+26
2018-12-08Fixed nll stderr file.Alexander Regueiro-1/+1
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-6/+6
2018-12-06Auto merge of #56557 - pietroalbini:rollup, r=pietroalbinibors-21/+21
Rollup of 11 pull requests Successful merges: - #56315 (Rustdoc inline macro reexport) - #56332 ([rustdoc] Specific crate search) - #56362 (Stabilise exhaustive integer patterns) - #56426 (libsyntax_pos: A few tweaks) - #56441 (rustbuild: Fix issues with compiler docs) - #56446 (pass the parameter environment to `traits::find_associated_item`) - #56500 (cleanup: remove static lifetimes from consts) - #56525 (Avoid extra copy and syscall in std::env::current_exe) - #56528 (Remove unused dependency (rustc_lint -> rustc_mir)) - #56548 (Optimized string FromIterator + Extend impls) - #56553 (Don't print the profiling summary to stdout when -Zprofile-json is set) Failed merges: r? @ghost
2018-12-06Auto merge of #55635 - oli-obk:min_const_unsafe_fn, r=nikomatsakisbors-36/+337
Allow calling `const unsafe fn` in `const fn` behind a feature gate cc #55607 r? @Centril
2018-12-06Rollup merge of #56362 - varkor:stabilise-exhaustive-integer-patterns, ↵Pietro Albini-21/+21
r=nikomatsakis Stabilise exhaustive integer patterns This is dependent on the FCP for https://github.com/rust-lang/rfcs/pull/2591 being completed, but that should happen tomorrow, so there's little harm in opening this PR early. Closes #50907.
2018-12-04Intrinsic checks are just needed for `qualify_min_const_fn`Oliver Scherer-0/+8
2018-12-04Add and update testsOliver Scherer-31/+52
2018-12-04Emit feature gate suggestionOliver Scherer-15/+15
2018-12-04Make sure the initialization of constrained int range newtypes is unsafeOliver Scherer-0/+136
2018-12-04Add test for dereferencing raw pointers and immediately referencing againOliver Scherer-3/+22
2018-12-04Allow calling `const unsafe fn` in `const fn` behind a feature gateOliver Scherer-7/+124
2018-12-04Update testsOliver Scherer-2/+3
2018-11-30Update existing tests with more precise error messagesvarkor-21/+21
2018-11-30Test float assign opsOliver Scherer-0/+279