summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
2020-03-09Added 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-09Fix #69191Felix S. Klock II-0/+31
2020-02-27lit_to_const: gracefully bubble up type errors.Mazdak Farrokhzad-0/+26
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-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.
2020-01-13Add additional regression testAaron Hill-0/+20
2020-01-12Turn off const propagation of ref takingWesley Wiser-0/+77
Fixes #67529 Fixes #67640 Fixes #67641 Fixes #67862
2020-01-12Add backticks in appropriate placesvarkor-1/+1
2020-01-12Diagnostics should not end with a full stopvarkor-2/+2
2020-01-12Diagnostics should start lowercasevarkor-1/+1
2020-01-11Auto merge of #67000 - spastorino:remove-promoted-from-place, r=oli-obkbors-114/+184
Promote references to constants instead of statics r? @oli-obk
2020-01-11Rollup merge of #68114 - ecstatic-morse:fix-feature-gating, r=CentrilMazdak Farrokhzad-31/+27
Don't require `allow_internal_unstable` unless `staged_api` is enabled. #63770 changed `qualify_min_const_fn` to require `allow_internal_unstable` for *all* crates that used an unstable feature, regardless of whether `staged_api` was enabled or the `fn` that used that feature was stably const. In practice, this meant that every crate in the ecosystem that wanted to use nightly features added `#![feature(const_fn)]`, which skips `qualify_min_const_fn` entirely. After this PR, crates that do not have `#![feature(staged_api)]` will only need to enable the feature they are interested in. For example, `#![feature(const_if_match)]` will be enough to enable `if` and `match` in constants. Crates with `staged_api` (e.g., `libstd`) require `#[allow_internal_unstable]` to be added to a function if it uses nightly features unless that function is also marked `#[rustc_const_unstable]`. This prevents proliferation of `#[allow_internal_unstable]` into functions that are not callable in a `const` context on stable. r? @oli-obk (author of #63770) cc @Centril
2020-01-11Rollup merge of #68079 - varkor:E0013-clarify, r=CentrilMazdak Farrokhzad-2/+6
Clarify suggestion for E0013 Fixes https://github.com/rust-lang/rust/issues/68038.
2020-01-10Remove unnecessary `const_fn` feature gatesDylan MacKenzie-31/+27
This flag opts out of the min-const-fn checks entirely, which is usually not what we want. The few cases where the flag is still necessary have been annotated.
2020-01-11Rollup merge of #68014 - estebank:unify-e0599, r=cramertjYuki Okushi-1/+1
Unify output of "variant not found" errors Fix #49566.
2020-01-10Clarify suggestion for E0013varkor-2/+6
2020-01-10Errors in promoteds may only cause lints not hard errorsOliver Scherer-162/+136
2020-01-10Promoteds also need param envs.Oliver Scherer-1/+1
This also allows us to use the `const_eval` query again without causing cycles
2020-01-10Promote `Ref`s to constants instead of staticSantiago Pastorino-27/+123
2020-01-10Rollup merge of #68073 - Centril:fix-68062, r=estebankMazdak Farrokhzad-0/+41
expect `fn` after `const unsafe` / `const extern` Fixes #68062 r? @estebank @petrochenkov cc @Aaron1011
2020-01-09expect `fn` after `const unsafe` / `const extern`Mazdak Farrokhzad-0/+41
2020-01-09Update testsVadim Petrochenkov-11/+64
2020-01-08Remove `-Z continue-parse-after-error`Vadim Petrochenkov-1/+1
2020-01-08Unify output of "variant not found" errorsEsteban Küber-1/+1
2020-01-05Add backticks to various diagnosticsvarkor-3/+3
2020-01-04Rollup merge of #67709 - petrochenkov:nodedup2, r=CentrilDylan DPC-1/+1
Introduce an option for disabling deduplication of diagnostics With the intent of using it in UI tests (https://github.com/rust-lang/rust/pull/67122). The option is boolean (`-Z deduplicate-diagnostics=yes/no`) and can be specified multiple times with later values overriding earlier values (`-Z deduplicate-diagnostics=no -Z deduplicate-diagnostics=yes` == `-Z deduplicate-diagnostics=yes`), so it can be set in a hierarchical way, e.g. UI testing infra may disable the deduplication by default with specific tests being able to enable it back.
2020-01-03Introduce an option for disabling deduplication of diagnosticsVadim Petrochenkov-1/+1
2020-01-02Revert `const_err` lint checking of castsWesley Wiser-27/+11
Reverts part of #67676