lcnr
7a90e84f4d
InterpCx store TypingEnv instead of a ParamEnv
2024-11-19 21:36:23 +01:00
lcnr
948cec0fad
move fn is_item_raw to TypingEnv
2024-11-19 18:06:20 +01:00
Ralf Jung
c4ce8c114b
make InterpResult a dedicated type to avoid accidentally discarding the error
2024-10-01 21:45:35 +02:00
Michael Goulet
c682aa162b
Reformat using the new identifier sorting from rustfmt
2024-09-22 19:11:29 -04:00
Ralf Jung
123757ae07
turn errors that should be impossible due to our static checks into ICEs
2024-09-10 10:27:30 +02:00
Ralf Jung
f76f128dc9
const-eval interning: accpt interior mutable pointers in final value (but keep rejecting mutable references)
2024-09-10 10:26:16 +02:00
Ralf Jung
b316033dd8
rename CompileTimeInterpreter -> CompileTimeMachine, CompileTimeEvalContext -> CompileTimeInterpCx
...
to match the terms used in the shared interpreter infrastructure
2024-06-13 20:30:11 +02:00
Santiago Pastorino
bac72cf7cf
Add safe/unsafe to static inside extern blocks
2024-06-04 14:19:43 -03:00
Ralf Jung
e8379c9598
interpret: get rid of 'mir lifetime everywhere
2024-05-27 08:25:57 +02:00
Ralf Jung
36d36a3e1f
interpret: the MIR is actually at lifetime 'tcx
2024-05-27 07:45:41 +02:00
Nicholas Nethercote
7a5d814a04
Remove #[macro_use] extern crate tracing from rustc_const_eval.
2024-05-23 18:02:38 +10:00
Nicholas Nethercote
4497d345a8
Remove extern crate rustc_middle from rustc_const_eval.
...
This requires exporting the interpreter macros so they can be used with
`use crate::interpret::*`.
2024-05-13 08:02:14 +10:00
Oli Scherer
126dcc618d
Use less fragile error handling
2024-04-17 09:50:44 +00:00
Oli Scherer
77fe9f0a72
Validate before reporting interning errors.
...
validation produces much higher quality errors and already handles most of the cases
2024-04-17 09:50:44 +00:00
Oli Scherer
64b75f736d
Forbid implicit nested statics in thread local statics
2024-04-02 13:00:46 +00:00
Michael Goulet
4ff8a9bd6b
Don't inherit codegen attrs from parent static
2024-03-31 22:34:00 -04:00
Matthias Krüger
4f3050b85a
Rollup merge of #121543 - onur-ozkan:clippy-args, r=oli-obk
...
various clippy fixes
We need to keep the order of the given clippy lint rules before passing them.
Since clap doesn't offer any useful interface for this purpose out of the box,
we have to handle it manually.
Additionally, this PR makes `-D` rules work as expected. Previously, lint rules were limited to `-W`. By enabling `-D`, clippy began to complain numerous lines in the tree, all of which have been resolved in this PR as well.
Fixes #121481
cc `@matthiaskrgr`
2024-03-20 05:51:22 +01:00
onur-ozkan
81d7d7aabd
resolve clippy errors
...
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-03-20 00:12:00 +03:00
Oli Scherer
3a09680671
Ensure nested statics have a HIR node to prevent various queries from ICEing
2024-03-19 09:38:15 +00:00
Oli Scherer
93888cd0a4
Move only usage of take_static_root_alloc to its definition and inline it
2024-03-14 11:40:30 +00:00
Felix S. Klock II
9c33cc62aa
placate tidy.
2024-03-13 10:51:12 -04:00
Felix S. Klock II
a8549b4152
downgrade mutable-ptr-in-final-value from hard-error to future-incompat lint to address issue 121610.
2024-03-13 10:32:39 -04:00
Oli Scherer
926bfe5078
s/mt/mutability/
2024-03-12 05:53:46 +00:00
Oli Scherer
d3514a036d
Ensure nested allocations in statics do not get deduplicated
2024-03-12 05:53:46 +00:00
Matthias Krüger
86a7fc840f
compiler: clippy::complexity fixes
2024-02-23 19:56:35 +01:00
Oli Scherer
73b38c661d
Do not allocate a second "background" alloc id for the main allocation of a static.
...
Instead we re-use the static's alloc id within the interpreter for its initializer to refer to the `Allocation` that only exists within the interpreter.
2024-02-15 10:25:18 +00:00
clubby789
4de3a3af4a
Bump indexmap
...
`swap` has been deprecated in favour of `swap_remove` - the behaviour
is the same though.
2024-02-13 21:03:34 +00:00
Oli Scherer
c94769a974
Clarify order of operations during interning
...
Co-authored-by: Ralf Jung <post@ralfj.de>
2024-02-05 22:21:40 +01:00
Oli Scherer
5d46b982c5
Document base vs nested alloc interning
2024-01-29 08:59:51 +00:00
Oli Scherer
a57a00ebf6
separately intern the outermost alloc from the rest
2024-01-29 08:59:46 +00:00
Oli Scherer
a73c44889a
Prefer external iteration now that we don't actually recurse anymore
2024-01-29 08:53:54 +00:00
Ralf Jung
2ab85e4178
reword comment
2024-01-22 09:28:00 +01:00
Ralf Jung
2f1a8e2d7a
const-eval interner: from-scratch rewrite using mutability information from provenance rather than types
2024-01-22 09:28:00 +01:00
Nicholas Nethercote
99472c7049
Remove Session methods that duplicate DiagCtxt methods.
...
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier
access.
2023-12-24 08:05:28 +11:00
Ralf Jung
cb86303342
ctfe interpreter: extend provenance so that it can track whether a pointer is immutable
2023-12-07 17:46:36 +01:00
Nicholas Nethercote
5d1d384443
Rename HandlerInner::delay_span_bug as HandlerInner::span_delayed_bug.
...
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug`
follows the pattern used everywhere else: `span_err`, `span_warning`,
etc.
2023-12-02 09:01:19 +11:00
Nilstrieb
21a870515b
Fix clippy::needless_borrow in the compiler
...
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`.
Then I had to remove a few unnecessary parens and muts that were exposed
now.
2023-11-21 20:13:40 +01:00
Camille GILLOT
72f0e0e795
Rename has_provance and tweaks comments.
2023-10-25 17:59:30 +00:00
Camille GILLOT
f08dc9be17
Take an AllocId in intern_const_alloc_for_constprop.
2023-10-25 06:46:48 +00:00
Camille GILLOT
ff6812cd20
Move provenance checks out of interning method.
2023-10-25 06:46:48 +00:00
Camille GILLOT
ebc87bf567
Directly intern values instead of copying them.
2023-10-25 06:46:48 +00:00
Ralf Jung
b131fc10ae
separate bounds-check from alignment check
2023-10-15 18:13:33 +02:00
Ralf Jung
b1ebf002c3
don't UB on dangling ptr deref, instead check inbounds on projections
2023-10-15 18:12:46 +02:00
Ralf Jung
551f481ffb
use AllocId instead of Allocation in ConstValue::ByRef
2023-09-14 07:26:24 +02:00
Ralf Jung
fa5f13775a
interpret: make MemPlace, Place, Operand types private to the interpreter
2023-09-04 17:53:38 +02:00
Ralf Jung
beeb2b13cc
miri/diagnostics: don't forget to print_backtrace when ICEing on unexpected errors
...
then also use the new helper in a few other places
2023-08-27 15:42:25 +02:00
Ralf Jung
da3f0d0eb7
make MPlaceTy non-Copy
2023-07-25 22:35:07 +02:00
Ralf Jung
77ff1b83cd
interpret: make read functions generic over operand type
2023-07-25 22:33:59 +02:00
Ralf Jung
a2bcafa500
interpret: refactor projection code to work on a common trait, and use that for visitors
2023-07-25 14:30:58 +02:00
Ralf Jung
dd453a6a99
miri: protect Move() function arguments during the call
2023-07-11 21:59:01 +02:00