about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
AgeCommit message (Collapse)AuthorLines
2022-06-05Allow ptr_from_addr_cast to failRalf Jung-6/+7
2022-06-05reduce code duplicationRalf Jung-13/+12
2022-06-05interpret: better control over whether we read data with provenance, and ↵Ralf Jung-18/+46
implicit provenance stripping where possible
2022-06-04use precise spans for recursive const evaluationRalf Jung-3/+4
2022-06-04const_prop_lint: ensure we have up-to-date cur_span()Ralf Jung-1/+4
2022-06-04Move statement_index increment out of statement() functionRalf Jung-9/+9
That function is called by const_prop, where updating the index like that is totally meaningless.
2022-06-04tweak some bug!sRalf Jung-6/+6
2022-06-03Rollup merge of #97663 - RalfJung:keine-halben-sachen, r=oli-obkDylan DPC-3/+3
take back half-baked noaliasing check in Assignment Doing an aliasing check in `copy_op` does not make a ton of sense. We have to eventually do something in the `Assignment` statement handling instead.
2022-06-02take back half-baked noaliasing check in AssignmentRalf Jung-3/+3
2022-06-02commentRalf Jung-1/+1
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2022-06-02add cast kind of from_exposed_addr (int-to-ptr casts)Ralf Jung-21/+34
2022-06-02Rollup merge of #97626 - RalfJung:expose, r=tmiaskoYuki Okushi-5/+5
rename PointerAddress → PointerExposeAddress `PointerAddress` sounds a bit too much like `ptr.addr()`, but this corresponds to `ptr.expose_addr()`. r? `@tmiasko`
2022-06-01rename PointerAddress → PointerExposeAddressRalf Jung-5/+5
2022-06-01Rollup merge of #97216 - RalfJung:null-ptr-check, r=oli-obkYuki Okushi-0/+4
Ensure we never consider the null pointer dereferencable This replaces the checks that are being removed in https://github.com/rust-lang/rust/pull/97188. Those checks were too early and hence incorrect.
2022-05-31Add a pointer to address cast kindTomasz Miąsko-36/+30
A pointer to address cast are often special-cased. Introduce a dedicated cast kind to make them easy distinguishable.
2022-05-30Rollup merge of #97395 - RalfJung:call-abi, r=oli-obkMichael Goulet-1/+8
Miri call ABI check: ensure type size+align stay the same We should almost certainly not accept calls where caller and callee disagree on the size or alignment of the type. The checks we do *almost* imply that, except that `ScalarPair` types can have `repr(align)` and thus differ in size/align even when they are pairs of the same primitive type. r? ``@oli-obk``
2022-05-30Auto merge of #97025 - ouz-a:mini-derefer-generator, r=davidtwcobors-1/+10
Add validation layer for Derefer _Follow up work to #96549 #96116 #95857 #95649_ This adds validation for Derefer making sure it is always the first projection. r? rust-lang/mir-opt
2022-05-30validate derefer, run derefer inside generatorouz-a-1/+10
2022-05-30Auto merge of #96964 - oli-obk:const_trait_mvp, r=compiler-errorsbors-24/+16
Replace `#[default_method_body_is_const]` with `#[const_trait]` pulled out of #96077 related issues: #67792 and #92158 cc `@fee1-dead` This is groundwork to only allowing `impl const Trait` for traits that are marked with `#[const_trait]`. This is necessary to prevent adding a new default method from becoming a breaking change (as it could be a non-const fn).
2022-05-30Reduce the scope of a mutable variableOli Scherer-7/+2
2022-05-30Add a helper function for checking whether a default function in a trait can ↵Oli Scherer-11/+8
be treated as `const`
2022-05-30Remove `#[default..]` and add `#[const_trait]`Deadbeef-12/+12
2022-05-28Fix TyKind lint, make consts no longer fn, etcMichael Goulet-5/+5
2022-05-28Initial fixes on top of type interner commitMichael Goulet-4/+4
2022-05-28Move things to rustc_type_irWilco Kusee-3/+3
2022-05-27Auto merge of #96046 - oli-obk:const_typeck, r=cjgillotbors-8/+4
Move various checks to typeck so them failing causes the typeck result to get tainted Fixes #69487 fixes #79047 cc `@RalfJung` this gets rid of the `Transmute` invalid program error variant
2022-05-26clippy::complexity fixesMatthias Krüger-7/+3
clone_on_copy useless_format bind_instead_of_map filter_map_identity useless_conversion map_flatten unnecessary_unwrap
2022-05-25Miri call ABI check: ensure type size+align stay the sameRalf Jung-1/+8
2022-05-24Remove outdated commentOli Scherer-4/+0
2022-05-24Add the transmute and asm checks to typeck as deferred checksOli Scherer-4/+4
2022-05-24Add flag for stricter checks on uninit/zeroed5225225-3/+11
2022-05-23Refactor call terminator to always hold a destination placeJakob Degen-53/+66
2022-05-22Lifetime variance fixes for rustcMichael Goulet-4/+4
2022-05-22Auto merge of #97177 - oli-obk:const-stability, r=davidtwcobors-28/+31
Implement proper stability check for const impl Trait, fall back to unstable const when undeclared Continuation of #93960 `@jhpratt` it looks to me like the test was simply not testing for the failure you were looking for? Your checks actually do the right thing for const traits?
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-10/+9
2022-05-20Ensure we never consider the null pointer dereferencableRalf Jung-0/+4
2022-05-20Rollup merge of #97188 - carbotaniuman:remove-null-assert, r=RalfJungGuillaume Gomez-8/+1
Remove unneeded null pointer asserts in ptr2int casts This removes an assert that a pointer with address 0 has no provenance. This change is needed to support permissive provenance work in Miri, and seems justified by `ptr.with_addr(0)` working and a discussion on Zulip regarding LLVM semantics. r? `@RalfJung`
2022-05-20Rollup merge of #97185 - RalfJung:number-validity, r=oli-obkGuillaume Gomez-15/+33
interpret/validity: separately control checking numbers for being init and non-ptr This lets Miri control this in a more fine-grained way. r? `@oli-obk`
2022-05-19Remove unneeded assertscarbotaniuman-8/+1
2022-05-19fmtRalf Jung-2/+1
2022-05-19interpret/validity: separately control checking numbers for being init and ↵Ralf Jung-15/+34
non-ptr
2022-05-19Proper const stability check, default to unstableJacob Pratt-19/+35
Rather than deferring to const eval for checking if a trait is const, we now check up-front. This allows the error to be emitted earlier, notably at the same time as other stability checks. Also included in this commit is a change of the default const stability level to UNstable. Previously, an item that was `const` but did not explicitly state it was unstable was implicitly stable.
2022-05-19Add and use stability helper methodsJacob Pratt-2/+2
This avoids an ambiguity (when reading) where `.level.is_stable()` is not immediately clear whether it is general stability or const stability.
2022-05-19Fall back to being const-unstable when undeclaredJacob Pratt-19/+6
2022-05-18Auto merge of #97019 - b-naber:transition-to-valtrees-pt1, r=oli-obkbors-81/+236
Transition to valtrees pt1 Compartmentalising https://github.com/rust-lang/rust/pull/96591 as much as possible. r? `@oli-obk`
2022-05-18Rollup merge of #97116 - RalfJung:ref-validity, r=oli-obkYuki Okushi-6/+11
interpret/validity: reject references to uninhabited types According to https://doc.rust-lang.org/reference/behavior-considered-undefined.html, this is definitely UB. And we can check this without actually looking up anything in memory, we just need the reference value and its type, making this a great candidate for a validity invariant IMO and my favorite resolution of https://github.com/rust-lang/unsafe-code-guidelines/issues/77. With this PR, Miri with `-Zmiri-check-number-validity` implements all my preferred options for what the validity invariants of our types could be. :) CTFE has been doing recursive checking anyway, so this is backwards compatible but might change the error output. I will submit a PR with the new Miri tests soon. r? `@oli-obk`
2022-05-17interpret/validity: reject references to uninhabited typesRalf Jung-6/+11
2022-05-17Auto merge of #97111 - JohnTitor:rollup-x3vjf6u, r=JohnTitorbors-1/+4
Rollup of 7 pull requests Successful merges: - #96329 (Add a couple tests for #90887 fixes) - #97009 (Allow `unused_macro_rules` in path tests) - #97075 (Add regression test for #81804) - #97079 (Change `Successors` to `impl Iterator<Item = BasicBlock>`) - #97080 (remove the `RelateResultCompare` trait) - #97093 (Migrate `maybe_recover_from_bad_type_plus` diagnostic) - #97102 (Update function pointer call error message) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-05-17Auto merge of #97012 - oli-obk:🦀_intrinsics, r=davidtwcobors-10/+4
Add a query for checking whether a function is an intrinsic. work towards #93145 This will reduce churn when we add more ways to declare intrinsics r? `@scottmcm`
2022-05-17Update function pointer call error messagembartlett21-1/+4
It now uses the type of context. (issue 97082)