about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
AgeCommit message (Collapse)AuthorLines
2021-12-20don't ICE on variadic function callsRalf Jung-2/+9
2021-12-20also compare ArgAttributesRalf Jung-29/+38
2021-12-20compare calling convention instead of call ABIRalf Jung-37/+9
2021-12-20const_eval machine: use original instance for replaced MIR bodiesRalf Jung-1/+11
2021-12-20CTFE eval_fn_call: use FnAbi to determine argument skipping and compatibilityRalf Jung-109/+192
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-2/+2
Remove `SymbolStr` This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences. Best reviewed one commit at a time. r? `@oli-obk`
2021-12-15miri: lift restriction on extern types being the only field in a structTomasz Miąsko-27/+11
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-2/+2
2021-12-15Auto merge of #91945 - matthiaskrgr:rollup-jszf9zp, r=matthiaskrgrbors-1/+0
Rollup of 7 pull requests Successful merges: - #90939 (Tweak errors coming from `for`-loop, `?` and `.await` desugaring) - #91859 (Iterator::cycle() — document empty iterator special case) - #91868 (Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`) - #91870 (Revert setting a default for the MACOSX_DEPLOYMENT_TARGET env var for linking) - #91881 (Stabilize `iter::zip`) - #91882 (Remove `in_band_lifetimes` from `rustc_typeck`) - #91940 (Update cargo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-14Stabilize iter::zip.PFPoitras-1/+0
2021-12-14Rollup merge of #91856 - ouz-a:master, r=oli-obkMatthias Krüger-2/+3
Looser check for overflowing_binary_op Fix for issue #91636 tight check resulted in ICE, this makes the check a little looser. It seems `eq` allows comparing of `supertype` and `subtype` if `lhs = supertype` and `rhs = subtype` but not vice versa, is this intended behavior ?
2021-12-14comment updateouz-a-1/+1
2021-12-13Remove `in_band_lifetimes` from `rustc_const_eval`LegionMammal978-83/+123
See #91867 for more information.
2021-12-14Add regression test and commentouz-a-1/+2
2021-12-13formattingouz-a-1/+1
2021-12-13Looser check for binary_op_overflowouz-a-1/+1
2021-12-12Auto merge of #91549 - fee1-dead:const_env, r=spastorinobors-4/+6
Eliminate ConstnessAnd again Closes #91489. Closes #89432. Reverts #91491. Reverts #89450. r? `@spastorino`
2021-12-12Rollup merge of #91815 - RalfJung:span, r=oli-obkMatthias Krüger-2/+2
better span for unexpected normalization failure in CTFE engine No reason to use `DUMMY_SP` here.
2021-12-12Rollup merge of #91814 - japm48:spelling-fix, r=RalfJungMatthias Krüger-2/+2
doc: fix typo in comments `dereferencable -> dereferenceable` Fixes #91802.
2021-12-12Revert "Auto merge of #91491 - spastorino:revert-91354, r=oli-obk"Deadbeef-4/+6
This reverts commit ff2439b7b9bafcfdff86b7847128014699df8442, reversing changes made to 2a9e0831d6603d87220cedd1b1293e2eb82ef55c.
2021-12-11better span for unexpected normalization failure in CTFE engineRalf Jung-2/+2
2021-12-12doc: fix typo in commentsjapm48-2/+2
dereferencable -> dereferenceable
2021-12-11Rollup merge of #90081 - woppopo:const_write_bytes, r=oli-obkMatthias Krüger-0/+24
Make `intrinsics::write_bytes` const This is required to constify `MaybeUninit::zeroed` and `(*mut T)::write_bytes`. Tracking issue: #86302
2021-12-09Remove redundant [..]sest31-1/+1
2021-12-08Rollup merge of #91551 - b-naber:const-eval-normalization-ice, r=oli-obkMatthias Krüger-11/+23
Allow for failure of subst_normalize_erasing_regions in const_eval Fixes https://github.com/rust-lang/rust/issues/72845 Using associated types that cannot be normalized previously resulted in an ICE. We now allow for normalization failure and return a "TooGeneric" error in that case. r? ```@RalfJung``` maybe?
2021-12-08Rollup merge of #91272 - FabianWolff:issue-90870-const-fn-eq, r=wesleywiserMatthias Krüger-10/+66
Print a suggestion when comparing references to primitive types in `const fn` Fixes #90870.
2021-12-05allow for failure of subst_normalize_erasing_regions in const_evalb-naber-11/+23
2021-12-05Auto merge of #91475 - ecstatic-morse:mir-pass-manager3, r=oli-obkbors-0/+4
Add a MIR pass manager (Taylor's Version) The final draft of #91386 and #77665. While the compile-time constraints in #91386 are cool, I decided on a more minimal approach for now. I want to explore phase constraints and maybe relative-ordering constraints in the future, though. This should preserve existing behavior **exactly** (please let me know if it doesn't) while making the following changes to the way we organize things today: - Each `MirPhase` now corresponds to a single MIR pass. `run_passes` is not responsible for listing the correct MIR phase. - `run_passes` no longer silently skips passes if the declared MIR phase is greater than or equal to the body's. This has bitten me multiple times. If you want this behavior, you can always branch on `body.phase` yourself. - If your pass is solely to emit errors, you can use the `MirLint` interface instead, which gets a shared reference to `Body` instead of a mutable one. By differentiating the two, I hope to make it clearer in the short term where lints belong in the pipeline. In the long term perhaps we could enforce this at compile-time? - MIR is no longer dumped for passes that aren't enabled, or for lints. I tried to check that `-Zvalidate` still works correctly, since the MIR phase is now updated as soon as the associated pass is done, instead of at the end of all the passes in `run_passes`. However, it looks like `-Zvalidate` is broken with current nightlies anyways :cry: (it spits out a bunch of errors). cc `@oli-obk` `@wesleywiser` r? rust-lang/wg-mir-opt
2021-12-03Add initial AST and MIR support for unwinding from inline assemblyAmanieu d'Antras-17/+19
2021-12-03Revert "Auto merge of #91354 - fee1-dead:const_env, r=spastorino"Santiago Pastorino-6/+4
This reverts commit 18bb8c61a975fff6424cda831ace5b0404277145, reversing changes made to d9baa361902b172be716f96619b909f340802dea.
2021-12-02Update passes with new interfaceDylan MacKenzie-0/+4
2021-12-02Auto merge of #91469 - matthiaskrgr:rollup-xom3j55, r=matthiaskrgrbors-6/+2
Rollup of 12 pull requests Successful merges: - #89954 (Fix legacy_const_generic doc arguments display) - #91321 (Handle placeholder regions in NLL type outlive constraints) - #91329 (Fix incorrect usage of `EvaluatedToOk` when evaluating `TypeOutlives`) - #91364 (Improve error message for incorrect field accesses through raw pointers) - #91387 (Clarify and tidy up explanation of E0038) - #91410 (Move `#![feature(const_precise_live_drops)]` checks earlier in the pipeline) - #91435 (Improve diagnostic for missing half of binary operator in `if` condition) - #91444 (disable tests in Miri that take too long) - #91457 (Add additional test from rust issue number 91068) - #91460 (Document how `last_os_error` should be used) - #91464 (Document file path case sensitivity) - #91466 (Improve the comments in `Symbol::interner`.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-02Rollup merge of #91410 - ecstatic-morse:const-precise-live-drops-take-2, ↵Matthias Krüger-6/+2
r=oli-obk Move `#![feature(const_precise_live_drops)]` checks earlier in the pipeline Should mitigate the issues found during MCP on #73255. Once this is done, we should clean up the queries a bit, since I think `mir_drops_elaborated_and_const_checked` can be merged back into `mir_promoted`. Fixes #90770. cc ``@rust-lang/wg-const-eval`` r? ``@nikomatsakis`` (since they reviewed #71824)
2021-12-02Reduce boilerplate around infallible foldersAlan Egerton-3/+1
2021-12-02Auto merge of #91354 - fee1-dead:const_env, r=spastorinobors-4/+6
Cleanup: Eliminate ConstnessAnd This is almost a behaviour-free change and purely a refactoring. "almost" because we appear to be using the wrong ParamEnv somewhere already, and this is now exposed by failing a test using the unstable `~const` feature. We most definitely need to review all `without_const` and at some point should probably get rid of many of them by using `TraitPredicate` instead of `TraitRef`. This is a continuation of https://github.com/rust-lang/rust/pull/90274. r? `@oli-obk` cc `@spastorino` `@ecstatic-morse`
2021-11-30Handle `DropAndReplace` in const-checkingDylan MacKenzie-6/+2
It runs before the real drop elaboration pass.
2021-11-30Rollup merge of #91368 - ecstatic-morse:mir-pass-reexport, r=cjgillotYuki Okushi-6/+2
Don't re-export `MirPass` `rust-analyzer` wants to use the `rustc_const_eval` one by default, which is weird. r? ``@cjgillot``
2021-11-30Rollup merge of #91323 - RalfJung:assert-type, r=oli-obkYuki Okushi-1/+25
CTFE: support assert_zero_valid and assert_uninit_valid This ensures the implementation of all three type-based assert_ intrinsics remains consistent in Miri. `assert_inhabited` recently got stabilized in https://github.com/rust-lang/rust/pull/90896 (meaning stable `const fn` can call it), so do the same with these other intrinsics. Cc ```@rust-lang/wg-const-eval```
2021-11-29Don't re-export `MirPass`Dylan MacKenzie-6/+2
2021-11-29CTFE: support assert_zero_valid and assert_uninit_validRalf Jung-1/+25
2021-11-29Always use const param envs for const eval.Oli Scherer-0/+4
Nothing else makes sense, and there is no "danger" in doing so, as it only does something if there are const bounds, which are unstable. This used to happen implicitly via the inferctxt before, which was much more fragile.
2021-11-29Use the constness from the param env instead of having a separate dimension ↵Oli Scherer-4/+2
for it This breaks a ~const test that will be fixed in a follow up commit of this PR
2021-11-28Rollup merge of #91251 - oli-obk:wf_sync_statics, r=matthewjasperMatthias Krüger-27/+2
Perform Sync check on static items in wf-check instead of during const checks r? `@RalfJung` This check is solely happening on the signature of the static item and not on its body, therefor it belongs into wf-checking instead of const checking.
2021-11-28Auto merge of #91230 - eggyal:fallible-type-fold, r=jackh726bors-1/+3
Make `TypeFolder::fold_*` return `Result` Implements rust-lang/compiler-team#432. Initially this is just a rebase of `@LeSeulArtichaut's` work in #85469 (abandoned; see https://github.com/rust-lang/rust/pull/85485#issuecomment-908781112). At that time, it caused a regression in performance that required some further exploration... with this rebased PR bors can hopefully report some perf analysis from which we can investigate further (if the regression is indeed still present). r? `@jackh726` cc `@nikomatsakis`
2021-11-27Miri: fix alignment check in array initializationRalf Jung-1/+5
2021-11-26Print a suggestion when comparing references to primitive types in constant ↵Fabian Wolff-10/+66
functions
2021-11-26Perform Sync check on static items in wf-check instead of during const checksOli Scherer-27/+2
2021-11-26Unwrap the results of type foldersLeSeulArtichaut-1/+3
Co-authored-by: Alan Egerton <eggyal@gmail.com>
2021-11-25Rollup merge of #91162 - RalfJung:miri-shift-truncation, r=oli-obkMatthias Krüger-1/+6
explain why CTFE/Miri perform truncation on shift offset Closes https://github.com/rust-lang/miri/issues/1920
2021-11-24DebugDeadbeef-4/+5