about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret
AgeCommit message (Collapse)AuthorLines
2023-11-01Rollup merge of #117373 - saethlin:avoid-ice-lint, r=compiler-errorsMatthias Krüger-8/+4
Avoid the path trimming ICE lint in error reporting Types or really anything in MIR should never be formatted without path trimming disabled, because its formatting often tries to construct trimmed paths. In this case, the lint turns a nice error report into an irrelevant ICE.
2023-11-01Avoid the path trimming ICE lint in error reportingBen Kimock-8/+4
2023-10-31Support enum variants in offset_of!George Bateman-1/+1
2023-10-30Rollup merge of #117317 - RalfJung:track-caller, r=oli-obkGuillaume Gomez-140/+48
share some track_caller logic between interpret and codegen Also move the code that implements the track_caller intrinsics out of the core interpreter engine -- it's just a helper creating a const-allocation, doesn't need to be part of the interpreter core.
2023-10-28share the track_caller handling within a mir::BodyRalf Jung-29/+11
2023-10-28interpret: call caller_location logic the same way codegen does, and share ↵Ralf Jung-140/+66
some code
2023-10-25Rename has_provance and tweaks comments.Camille GILLOT-1/+4
2023-10-25Take an AllocId in intern_const_alloc_for_constprop.Camille GILLOT-2/+1
2023-10-25Move provenance checks out of interning method.Camille GILLOT-13/+3
2023-10-25Directly intern values instead of copying them.Camille GILLOT-1/+47
2023-10-25Evaluate computed values to constants.Camille GILLOT-7/+18
2023-10-24Rollup merge of #117081 - GoodDaisy:master, r=wesleywiserMatthias Krüger-1/+1
fix typos in comments
2023-10-23Rollup merge of #116859 - Nilstrieb:more-more-funny-pretty-printers, r=oli-obkMatthias Krüger-4/+5
Make `ty::print::Printer` take `&mut self` instead of `self` based on #116815 This simplifies the code by removing all the `self` assignments and makes the flow of data clearer - always into the printer. Especially in v0 mangling, which already used `&mut self` in some places, it gets a lot more uniform.
2023-10-23fix typos in commentsGoodDaisy-1/+1
2023-10-23Ensure that `eval_to_allocation_raw` isn't called on static items from miriOli Scherer-9/+6
2023-10-23Pull mplace validation logic out into an interpreter methodOli Scherer-1/+1
2023-10-21Make `ty::print::Printer` take `&mut self` instead of `self`Nilstrieb-4/+5
This simplifies the code by removing all the `self` assignments and makes the flow of data clearer - always into the printer. Especially in v0 mangling, which already used `&mut self` in some places, it gets a lot more uniform.
2023-10-20s/generator/coroutine/Oli Scherer-9/+9
2023-10-20s/Generator/Coroutine/Oli Scherer-17/+17
2023-10-20Adjust importsMichael Goulet-3/+3
2023-10-19Auto merge of #115214 - Urgau:rfc-3127-trim-paths, r=compiler-errorsbors-1/+9
Implement rustc part of RFC 3127 trim-paths This PR implements (or at least tries to) [RFC 3127 trim-paths](https://github.com/rust-lang/rust/issues/111540), the rustc part. That is `-Zremap-path-scope` with all of it's components/scopes. `@rustbot` label: +F-trim-paths
2023-10-19Rollup merge of #116650 - RalfJung:miri-intptrcast, r=oli-obkMatthias Krüger-0/+10
add some comments and some cleanup around Miri intptrcast `@saethlin` maybe this helps a bit?
2023-10-17[RFC 3127 - Trim Paths]: Condition remapped filepath on remap scopesUrgau-1/+9
2023-10-16Auto merge of #114330 - RalfJung:dagling-ptr-deref, r=oli-obkbors-311/+297
don't UB on dangling ptr deref, instead check inbounds on projections This implements https://github.com/rust-lang/reference/pull/1387 in Miri. See that PR for what the change is about. Detecting dangling references in `let x = &...;` is now done by validity checking only, so some tests need to have validity checking enabled. There is no longer inherently a "nodangle" check in evaluating the expression `&*ptr` (aside from the aliasing model). r? `@oli-obk` Based on: - https://github.com/rust-lang/reference/pull/1387 - https://github.com/rust-lang/rust/pull/115524
2023-10-16Auto merge of #116724 - RalfJung:alloc-bytes, r=oli-obkbors-11/+0
interpret: clean up AllocBytes Fixes https://github.com/rust-lang/miri/issues/2836 Nothing has moved here in half a year, so let's just remove these unused stubs -- they need a proper re-design anyway. r? `@oli-obk`
2023-10-15separate bounds-check from alignment checkRalf Jung-112/+76
2023-10-15more precise error for 'based on misaligned pointer' caseRalf Jung-14/+24
2023-10-15avoid computing misalignment if we won't act on itRalf Jung-6/+11
2023-10-15place evaluation: require the original pointer to be aligned if an access ↵Ralf Jung-200/+170
happens
2023-10-15avoid re-checking the offset while iterating an array/sliceRalf Jung-15/+54
2023-10-15don't UB on dangling ptr deref, instead check inbounds on projectionsRalf Jung-51/+49
2023-10-15Auto merge of #116688 - compiler-errors:rustfmt-up, r=WaffleLapkin,Nilstriebbors-1/+3
Format all the let-chains in compiler crates Since rust-lang/rustfmt#5910 has landed, soon we will have support for formatting let-chains (as soon as rustfmt syncs and beta gets bumped). This PR applies the changes [from master rustfmt to rust-lang/rust eagerly](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/out.20formatting.20of.20prs/near/374997516), so that the next beta bump does not have to deal with a 200+ file diff and can remain concerned with other things like `cfg(bootstrap)` -- #113637 was a pain to land, for example, because of let-else. I will also add this commit to the ignore list after it has landed. The commands that were run -- I'm not great at bash-foo, but this applies rustfmt to every compiler crate, and then reverts the two crates that should probably be formatted out-of-tree. ``` ~/rustfmt $ ls -1d ~/rust/compiler/* | xargs -I@ cargo run --bin rustfmt -- `@/src/lib.rs` --config-path ~/rust --edition=2021 # format all of the compiler crates ~/rust $ git checkout HEAD -- compiler/rustc_codegen_{gcc,cranelift} # revert changes to cg-gcc and cg-clif ``` cc `@rust-lang/rustfmt` r? `@WaffleLapkin` or `@Nilstrieb` who said they may be able to review this purely mechanical PR :> cc `@Mark-Simulacrum` and `@petrochenkov,` who had some thoughts on the order of operations with big formatting changes in https://github.com/rust-lang/rust/pull/95262#issue-1178993801. I think the situation has changed since then, given that let-chains support exists on master rustfmt now, and I'm fairly confident that this formatting PR should land even if *bootstrap* rustfmt doesn't yet format let-chains in order to lessen the burden of the next beta bump.
2023-10-14Rollup merge of #116576 - eduardosm:const-eval-wasm-target-features, r=RalfJungGuillaume Gomez-4/+6
const-eval: allow calling functions with targat features disabled at compile time in WASM This is not unsafe on WASM, see https://github.com/rust-lang/rust/pull/84988 r? `@RalfJung` Fixes https://github.com/rust-lang/rust/issues/116516
2023-10-14const-eval: allow calling functions with targat features disabled at compile ↵Eduardo Sánchez Muñoz-4/+6
time in WASM This is not unsafe on WASM, see https://github.com/rust-lang/rust/pull/84988
2023-10-14interpret: clean up AllocBytesRalf Jung-11/+0
2023-10-14Auto merge of #115524 - RalfJung:misalign, r=wesleywiserbors-44/+21
const-eval: make misalignment a hard error It's been a future-incompat error (showing up in cargo's reports) since https://github.com/rust-lang/rust/pull/104616, Rust 1.68, released in March. That should be long enough. The question for the lang team is simply -- should we move ahead with this, making const-eval alignment failures a hard error? (It turns out some of them accidentally already were hard errors since #104616. But not all so this is still a breaking change. Crater found no regression.)
2023-10-13Format all the let chains in compilerMichael Goulet-1/+3
2023-10-13add some comments and some cleanup around Miri intptrcastRalf Jung-0/+10
2023-10-09float-to-float casts also have non-deterministic NaN resultsRalf Jung-7/+29
2023-10-09ensure unary minus propagates NaN payloads exactlyRalf Jung-0/+1
2023-10-08miri: make NaN generation non-deterministicRalf Jung-5/+24
2023-10-06Rollup merge of #116277 - RalfJung:post-mono, r=oli-obkJubilee-13/+20
dont call mir.post_mono_checks in codegen It seems like all tests are still passing when I remove this... let's see what CI says.
2023-10-03Auto merge of #116376 - matthiaskrgr:rollup-b3d14gq, r=matthiaskrgrbors-20/+30
Rollup of 5 pull requests Successful merges: - #115863 (Add check_unused_messages in tidy) - #116210 (Ensure that `~const` trait bounds on associated functions are in const traits or impls) - #116358 (Rename both of the `Match` relations) - #116371 (Remove unused features from `rustc_llvm`.) - #116374 (Print normalized ty) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-03print normalized tyouz-a-20/+30
2023-10-02change is_subtype to relate_typesouz-a-2/+2
2023-10-02Add docs, remove code, change subtyper codeouz-a-4/+2
2023-10-02subtyping_projectionsouz-a-0/+4
2023-09-30dont call mir.post_mono_checks in codegenRalf Jung-13/+20
2023-09-28Skip reinterning if nothing changedOli Scherer-1/+3
2023-09-28Strip `OpaqueCast` during `RevealAll`.Oli Scherer-1/+1