about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
AgeCommit message (Collapse)AuthorLines
2023-09-21rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::ConstRalf Jung-16/+16
2023-09-21try to avoid some layout_of callsRalf Jung-35/+34
2023-09-20stronger consistency check in ImmTy::from_immediateRalf Jung-3/+11
2023-09-20interpret: less debug-printing of typesRalf Jung-39/+29
2023-09-20interpret: more consistently use ImmTy in operators and castsRalf Jung-115/+124
2023-09-20the Const::eval_bits methods don't need to be given the TyRalf Jung-1/+1
2023-09-19adjust constValue::Slice to work for arbitrary slice typesRalf Jung-27/+38
2023-09-19move ConstValue into mirRalf Jung-31/+27
this way we have mir::ConstValue and ty::ValTree as reasonably parallel
2023-09-18Auto merge of #115748 - RalfJung:post-mono, r=oli-obkbors-93/+39
move required_consts check to general post-mono-check function This factors some code that is common between the interpreter and the codegen backends into shared helper functions. Also as a side-effect the interpreter now uses the same `eval` functions as everyone else to get the evaluated MIR constants. Also this is in preparation for another post-mono check that will be needed for (the current hackfix for) https://github.com/rust-lang/rust/issues/115709: ensuring that all locals are dynamically sized. I didn't expect this to change diagnostics, but it's just cycle errors that change. r? `@oli-obk`
2023-09-15make interpreter type Debug impl independent of Ty debug implRalf Jung-4/+17
2023-09-14don't point at const usage site for resolution-time errorsRalf Jung-19/+2
also share the code that emits the actual error
2023-09-14move required_consts check to general post-mono-check functionRalf Jung-79/+42
2023-09-14Auto merge of #115804 - RalfJung:valtree-to-const-val, r=oli-obkbors-51/+52
consistently pass ty::Const through valtrees Some drive-by things extracted from https://github.com/rust-lang/rust/pull/115748.
2023-09-14don't force all slice-typed ConstValue to be ConstValue::SliceRalf Jung-36/+29
2023-09-14valtree_to_const_value: add fast-path for Scalar tuples/structsRalf Jung-1/+16
2023-09-14make it more clear which functions create fresh AllocIdRalf Jung-10/+7
2023-09-14cleanup op_to_const a bit; rename ConstValue::ByRef → IndirectRalf Jung-27/+14
2023-09-14use AllocId instead of Allocation in ConstValue::ByRefRalf Jung-12/+12
2023-09-14a bit of cleanup in valtree_to_const_valueRalf Jung-51/+37
2023-09-13Auto merge of #115820 - matthiaskrgr:rollup-kyglvpu, r=matthiaskrgrbors-55/+11
Rollup of 6 pull requests Successful merges: - #115736 (Remove `verbose_generic_activity_with_arg`) - #115771 (cleanup leftovers of const_err lint) - #115798 (add helper method for finding the one non-1-ZST field) - #115812 (Merge settings.css into rustdoc.css) - #115815 (fix: return early when has tainted in mir pass) - #115816 (Disabled socketpair for Vita) r? `@ghost` `@rustbot` modify labels: rollup
2023-09-13Rollup merge of #115798 - RalfJung:non_1zst_field, r=wesleywiserMatthias Krüger-32/+7
add helper method for finding the one non-1-ZST field
2023-09-13Rollup merge of #115771 - RalfJung:no-more-const-err-lint, r=oli-obkMatthias Krüger-23/+4
cleanup leftovers of const_err lint Some code / comments seem to not have been updated when const_err was turned into a hard error, so we can do a bit of cleanup here. r? `@oli-obk`
2023-09-12Introduce Machine::POST_MONO_CHECKS.Camille GILLOT-4/+9
2023-09-12add helper method for finding the one non-1-ZST fieldRalf Jung-32/+7
2023-09-12cleanup leftovers of const_err lintRalf Jung-23/+4
2023-09-12Auto merge of #115705 - cjgillot:const-prop-aggregate, r=oli-obkbors-5/+6
Read from non-scalar constants and statics in dataflow const-prop DataflowConstProp is designed to handle scalar values. When MIR features an assignment from a non-scalar constant, we need to manually decompose it into the custom state space. This PR tweaks interpreter callbacks to allow reusing `eval_mir_constant` without having a stack frame to get a span from. r? `@oli-obk` cc `@jachris`
2023-09-11Use write_immediate.Camille GILLOT-2/+2
2023-09-11Remove cur_span hook.Camille GILLOT-12/+3
2023-09-11Inline callback.Camille GILLOT-0/+1
2023-09-11Return ImmTy in discriminant_for_variant.Camille GILLOT-5/+6
2023-09-11Support non-scalar constants.Camille GILLOT-3/+11
2023-09-09handle/hack for arbitrary-self dyn receiversRalf Jung-32/+44
2023-09-09implement and test ABI compatibility for transparent wrappers around NPO typesRalf Jung-14/+27
2023-09-09implement and test fn ptr ABI compatibility rulesRalf Jung-2/+7
2023-09-09give extra context to ABI mismatch errorsRalf Jung-23/+26
2023-09-09interpret: change ABI-compat test to be type-based, so the test is ↵Ralf Jung-50/+125
consistent across targets
2023-09-08Partially outline code inside the panic! macroJohn Kåre Alsaker-4/+4
2023-09-08Auto merge of #115372 - RalfJung:abi-assert-eq, r=davidtwcobors-66/+12
add rustc_abi(assert_eq) to test some guaranteed or at least highly expected ABI compatibility guarantees This new repr(transparent) test is super useful, it would have found https://github.com/rust-lang/rust/issues/115336 and found https://github.com/rust-lang/rust/issues/115404, https://github.com/rust-lang/rust/issues/115481, https://github.com/rust-lang/rust/issues/115509.
2023-09-08turns out Layout has some more things to worry about -- move ABI comparison ↵Ralf Jung-6/+2
into helper function like is_bool, and some special magic extra fields
2023-09-08accept some differences for rustc_abi(assert_eq), so that we can test more ↵Ralf Jung-60/+10
things to be compatible
2023-09-08Auto merge of #115608 - RalfJung:fn-arg-validity, r=oli-obkbors-0/+7
miri: catch function calls where the argument is caller-invalid / the return value callee-invalid When doing a type-changing copy, we must validate the data both at the old and new type. Fixes https://github.com/rust-lang/miri/issues/3017
2023-09-06miri: catch function calls where the argument is caller-invalid / the return ↵Ralf Jung-0/+7
value callee-invalid
2023-09-06still accept references to u8 slices and str in packed fieldsRalf Jung-2/+8
2023-09-05fix detecting references to packed unsized fieldsRalf Jung-1/+3
2023-09-05Refactor how MIR represents composite debuginfo.Camille GILLOT-32/+26
2023-09-04interpret: make MemPlace, Place, Operand types private to the interpreterRalf Jung-225/+306
2023-08-31miri ABI check: fix handling of 1-ZST; don't accept sign differencesRalf Jung-24/+23
2023-08-30miri function ABI check: specifically look for repr(transparent)Ralf Jung-71/+102
2023-08-30interpret: make sure we accept transparent newtypes as ABI-compatibleRalf Jung-16/+36
also we were missing the case for Vector arguments, so handle those as well
2023-08-30storage_live: avoid computing the layout unless necessaryRalf Jung-14/+65