about summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
2020-02-13ast_validation: tweak diagnostic outputMazdak Farrokhzad-15/+19
2020-02-13parser: fuse free `fn` parsing together.Mazdak Farrokhzad-38/+25
2020-02-12Rollup merge of #69002 - RalfJung:miri-op-overflow, r=oli-obk,wesleywiserDylan DPC-13/+92
miri: improve and simplify overflow detection This simplifies the overflow detection for signed binary operators, and adds overflow detection to unary operators so that const-prop doesn't have to crudely hand-roll that. It also fixes some bugs in the operator implementation that however, I think, were not observable. r? @oli-obk @wesleywiser
2020-02-12Rollup merge of #68937 - ecstatic-morse:unchecked-intrinsics-test, r=RalfJungYuki Okushi-41/+119
Test failure of unchecked arithmetic intrinsics in const eval Test that the unchecked arithmetic intrinsics that were made unstably const in #68809 emit an error during const-eval if given invalid input. Addresses [this comment](https://github.com/rust-lang/rust/pull/68809#discussion_r375753066). r? @RalfJung
2020-02-11Test failure of unchecked arithmetic intrinsics in const evalDylan MacKenzie-41/+119
2020-02-11Rollup merge of #66498 - bjorn3:less_feature_flags, r=Dylan-DPCDylan DPC-1/+1
Remove unused feature gates I think many of the remaining unstable things can be easily be replaced with stable things. I have kept the `#![feature(nll)]` even though it is only necessary in `libstd`, to make regressions of it harder.
2020-02-11Auto merge of #68929 - matprec:consistent-issue-references, r=Dylan-DPCbors-179/+179
Make issue references consistent Fixes https://github.com/rust-lang/rust/issues/62976 cc https://github.com/rust-lang/rust/pull/63008 r? @varkor because you reviewed the original pr
2020-02-10Rollup merge of #68986 - ecstatic-morse:const-ascii-ctype, r=CentrilDylan DPC-0/+55
Make ASCII ctype functions unstably const Makes the following inherent methods on `u8` and `char` unstable `const fn`: * `is_ascii_alphabetic` * `is_ascii_uppercase` * `is_ascii_lowercase` * `is_ascii_alphanumeric` * `is_ascii_digit` * `is_ascii_hexdigit` * `is_ascii_punctuation` * `is_ascii_graphic` * `is_ascii_whitespace` * `is_ascii_control` cc #68983
2020-02-10some more tests for i128 oveflow behaviorRalf Jung-13/+66
2020-02-10add test that checks overflows on arithmetic operatorsRalf Jung-0/+26
2020-02-09--bless --compare-mode=nllMatthias Prechtl-179/+179
2020-02-08Test ASCII ctype methods in a const contextDylan MacKenzie-0/+55
2020-02-08Test `u8::is_ascii` alongside `char::is_ascii`Dylan MacKenzie-0/+6
2020-02-08Test integer exponentiation in a const contextDylan MacKenzie-0/+37
2020-02-08Test `NonZeroU8::new` in a const contextDylan MacKenzie-1/+10
2020-02-07Fix testbjorn3-1/+1
2020-02-06rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros.Eduard-Mihai Burtescu-28/+34
2020-02-06rustc: rename -Zexternal-macro-backtrace to -Zmacro-backtrace.Eduard-Mihai Burtescu-28/+28
2020-02-05Rollup merge of #68809 - ecstatic-morse:const-int-functions, r=oli-obkDylan DPC-0/+130
Make more arithmetic functions unstably const This is a smaller version of #66884 (thanks @9999years) that constifies many of the arithmetic functions on integer primitives from #53718 that were blocked on #49146. This makes the following things unstably const. - `feature = const_int_unchecked_arith` - `intrinsics::unchecked_add` - `intrinsics::unchecked_sub` - `intrinsics::unchecked_mul` - `intrinsics::unchecked_div` - `intrinsics::unchecked_rem` - `feature = const_checked_int_methods` - `checked_add` - `checked_sub` - `checked_mul` - `checked_div` (Uses `intrinsics::unchecked_div` internally) - `checked_rem` (Uses `intrinsics::unchecked_rem` internally) - `checked_neg` - `checked_shl` - `checked_shr` - `checked_abs` - `feature = const_saturating_int_methods` - `saturating_mul` - `saturating_neg` (Uses `intrinsics::unchecked_sub` internally) - `saturating_abs` (Uses `intrinsics::unchecked_sub` internally) - `feature = const_wrapping_int_methods` - `wrapping_div` - `wrapping_rem` - `feature = const_overflowing_int_methods` - `overflowing_div` - `overflowing_rem` - `feature = const_euclidean_int_methods` - `checked_div_euclid` - `checked_rem_euclid` - `wrapping_div_euclid` - `wrapping_rem_euclid` - `overflowing_div_euclid` - `overflowing_rem_euclid` Exponentiation and operations on the `NonZero` types are left to a later PR. r? @oli-obk cc @rust-lang/wg-const-eval @rust-lang/libs
2020-02-04Fix testDylan MacKenzie-160/+124
2020-02-04Add tests for newly const arithmetic fnsDylan MacKenzie-0/+166
Co-Authored-By: 9999years <rbt@sent.as>
2020-02-04Auto merge of #68377 - estebank:fn-obligations-spans, r=oli-obkbors-2/+2
Tweak obligation error output - Point at arguments or output when fn obligations come from them, or ident when they don't - Point at `Sized` bound (fix #47990) - When object unsafe trait uses itself in associated item suggest using `Self` (fix #66424, fix #33375, partially address #38376, cc #61525) - Point at reason in object unsafe trait with `Self` in supertraits or `where`-clause (cc #40533, cc #68377) - On implicit type parameter `Sized` obligations, suggest `?Sized` (fix #57744, fix #46683)
2020-02-02Account for `?Sized` type parameter boundsEsteban Küber-2/+2
2020-02-01Update existing tests for or-patternsMatthew Jasper-24/+12
2020-01-31Auto merge of #68080 - varkor:declared-here, r=petrochenkovbors-24/+24
Address inconsistency in using "is" with "declared here" "is" was generally used for NLL diagnostics, but not other diagnostics. Using "is" makes the diagnostics sound more natural and readable, so it seems sensible to commit to them throughout. r? @Centril
2020-01-28Rollup merge of #68563 - Aaron1011:fix/fn-sig-closure, r=varkorYuki Okushi-0/+26
Don't call `tcx.fn_sig` on closures Fixes #68542
2020-01-27Rollup merge of #68370 - Aaron1011:const-extern-test, r=RalfJungPietro Albini-0/+44
Ensure that we error when calling "const extern fn" with wrong convention See #64926
2020-01-27Don't call `tcx.fn_sig` on closuresAaron Hill-0/+26
Fixes #68542
2020-01-26Ensure that we error when calling "const extern fn" with wrong conventionAaron Hill-0/+44
See #64926
2020-01-24Do not ICE on multipart suggestions touching multiple filesEsteban Küber-1/+1
When encountering a multipart suggestion with spans belonging to different contexts, skip that suggestion.
2020-01-24Normalise notes with the/isvarkor-24/+24
2020-01-21Rollup merge of #68297 - Aaron1011:fix/new-const-prop-bounds, r=oli-obkYuki Okushi-0/+43
Filter and test predicates using `normalize_and_test_predicates` for const-prop Fixes #68264 Previously, I attempted to use `substitute_normalize_and_test_predicates` to detect unsatisfiable bounds. Unfortunately, since const-prop runs in a generic environment (we don't have any of the function's generic parameters substituted), this could lead to cycle errors when attempting to normalize predicates. This check is replaced with a more precise check. We now only call `normalize_and_test_predicates` on predicates that have the possibility of being proved unsatisfiable - that is, predicates that don't depend on anything local to the function (e.g. generic parameters). This ensures that we don't hit cycle errors when we normalize said predicates, while still ensuring that we detect unsatisfiable predicates. I haven't been able to come up with a minimization of the Diesel issue - however, I've verified that it compiles successfully.
2020-01-21Rollup merge of #68290 - petrochenkov:passcheck, r=oli-obkYuki Okushi-25/+28
Fix some tests failing in `--pass check` mode Warnings reported at codegen or linking time either have to be converted to errors (preferable), or the tests for them need to be marked with `// ignore-pass` (as a last resort). https://github.com/rust-lang/rust/commit/ecd5852194f43511443f134aebf0462b58c8e197 turned them from errors to warnings, but that shouldn't be necessary because it's still clear from the `.stderr` output that the errors are lints and not hard-coded.
2020-01-20Rollup merge of #68335 - RalfJung:drop-in-place, r=Mark-SimulacrumDylan DPC-3/+3
Remove real_drop_in_place In https://github.com/rust-lang/rust/commit/af9b057156f610df3528a502c668cfed99ce8a1a, I added `real_drop_in_place` because Stacked Borrows at the time couldn't handle transmuting of mutable references to raw pointers and back. Stacked Borrows 2, however, doesn't have any issue with these transmutes, so it is time to remove this hack again.
2020-01-18slice_patterns: remove gates in testsMazdak Farrokhzad-1/+0
2020-01-18Auto merge of #68170 - wesleywiser:stop_const_prop_ref_taking, r=oli-obkbors-0/+77
Turn off const propagation of ref taking Fixes #67529 Fixes #67640 Fixes #67641 Fixes #67862 r? @oli-obk
2020-01-18adjust ui testsRalf Jung-3/+3
2020-01-17Rollup merge of #68256 - estebank:bad-sugg-span, r=petrochenkovTyler Mandry-1/+1
Do not ICE on malformed suggestion spans Under the assumption that suggestions are by their very nature always "best effort", it is ok if we don't display them instead of having an ICE. The underlying issue of the malformed span being _created_ is left unaddressed. Fix #67567. r? @petrochenkov
2020-01-18Fix some tests failing in `--pass check` modeVadim Petrochenkov-25/+28
2020-01-17Add @weiznich's regression testAaron Hill-0/+43
2020-01-16review commentsEsteban Küber-1/+1
2020-01-16Do not ICE on malformed suggestion spansEsteban Küber-1/+1
2020-01-16Array repeat expression lengths must be monomorphic at MIR building timeOliver Scherer-0/+25
2020-01-16Rollup merge of #68096 - varkor:diagnostic-cleanup, r=CentrilDylan DPC-4/+4
Clean up some diagnostics by making them more consistent In general: - Diagnostic should start with a lowercase letter. - Diagnostics should not end with a full stop. - Ellipses contain three dots. - Backticks should encode Rust code. I also reworded a couple of messages to make them read more clearly. It might be sensible to create a style guide for diagnostics, so these informal conventions are written down somewhere, after which we could audit the existing diagnostics. r? @Centril
2020-01-15Auto merge of #67603 - oli-obk:no_mut_static_ref_from_const, r=RalfJungbors-0/+5
Promoteds can contain raw pointers, but these must still only point to immutable allocations fixes #67601 r? @RalfJung cc @wesleywiser in order to not change behaviour in this PR, const prop uses the constant rules for interning, but at least there's an explicit mode for it now that we can think about this in the future
2020-01-15Rollup merge of #68219 - oli-obk:fix_miri, r=RalfJung,wesleywiserYuki Okushi-4/+30
Untangle ZST validation from integer validation and generalize it to all zsts cc @RalfJung r? @wesleywiser
2020-01-15Rollup merge of #67914 - Aaron1011:fix/const-prop-impossible, ↵Yuki Okushi-0/+20
r=matthewjasper,oli-obk Don't run const propagation on items with inconsistent bounds Fixes #67696 Using `#![feature(trivial_bounds)]`, it's possible to write functions with unsatisfiable 'where' clauses, making them uncallable. However, the user can act as if these 'where' clauses are true inside the body of the function, leading to code that would normally be impossible to write. Since const propgation can run even without any user-written calls to a function, we need to explcitly check for these uncallable functions.
2020-01-15Promoteds can contain raw pointers, but these must still only point to ↵Oliver Scherer-0/+5
immutable allocations
2020-01-15Add testsOliver Scherer-4/+30
2020-01-14perf: eagerly convert literals to consts, this avoids creating loads on ↵Ben Lewis-1/+1
unevaluated consts which requires a lot of unnecessary work to evaluate them further down the line.