Matthias Krüger
31d7e514ab
Rollup merge of #108047 - oli-obk:machine->🞋, r=RalfJung
...
Use `target` instead of `machine` for mir interpreter integer handling.
The naming of `machine` only makes sense from a mir interpreter internals perspective, but outside users talk about the `target` platform. As per https://github.com/rust-lang/rust/pull/108029#issuecomment-1429791015
r? `@RalfJung`
2023-02-15 21:30:57 +01:00
bors
2d14db321b
Auto merge of #108006 - cjgillot:def-impl, r=oli-obk
...
Avoid accessing HIR when it can be avoided
Experiment to see if it helps some incremental cases.
Will be rebased once https://github.com/rust-lang/rust/pull/107942 gets merged.
r? `@ghost`
2023-02-15 16:14:10 +00:00
Oli Scherer
38b7cdf393
Use target instead of machine for mir interpreter integer handling.
...
The naming of `machine` only makes sense from a mir interpreter internals perspective, but outside users talk about the `target` platform
2023-02-15 08:56:18 +00:00
Camille GILLOT
03dff82d59
Add of_trait to DefKind::Impl.
2023-02-14 19:55:44 +00:00
Oli Scherer
936bf29d4c
s/eval_usize/eval_target_usize/ for clarity
2023-02-14 08:51:19 +00:00
Nicholas Nethercote
7a72560154
Reduce direct mk_ty usage.
...
We use more specific `mk_*` functions in most places, might as well use
them as much as possible.
2023-02-13 09:32:48 +11:00
Nicholas Nethercote
afbe167fbb
Avoid some tls::with calls.
...
These are in places where a `tcx` is easily obtained.
2023-02-09 15:28:04 +11:00
Maybe Waffle
fd649a3cc5
Replace enum ==s with matches where it makes sense
2023-01-30 12:26:26 +00:00
bors
3cdd0197e7
Auto merge of #106227 - bryangarza:ctfe-limit, r=oli-obk
...
Use stable metric for const eval limit instead of current terminator-based logic
This patch adds a `MirPass` that inserts a new MIR instruction `ConstEvalCounter` to any loops and function calls in the CFG. This instruction is used during Const Eval to count against the `const_eval_limit`, and emit the `StepLimitReached` error, replacing the current logic which uses Terminators only.
The new method of counting loops and function calls should be more stable across compiler versions (i.e., not cause crates that compiled successfully before, to no longer compile when changes to the MIR generation/optimization are made).
Also see: #103877
2023-01-29 04:11:27 +00:00
Camille GILLOT
1974b6b68d
Introduce GeneratorWitnessMIR.
2023-01-27 18:58:44 +00:00
Kyle Matsuda
c2414dfaa4
change fn_sig query to use EarlyBinder; remove bound_fn_sig query; add EarlyBinder to fn_sig in metadata
2023-01-26 20:28:25 -07:00
Kyle Matsuda
e982971ff2
replace usages of fn_sig query with bound_fn_sig
2023-01-26 20:15:36 -07:00
Bryan Garza
7618163a1c
Add comments and remove unnecessary code
2023-01-23 23:56:22 +00:00
Bryan Garza
172662dede
Add back Machine::before_terminator(...) method
...
Added it back because it's used by Miri, but in the compiler itself, it
will not do anything (just return `Ok(())`.
2023-01-23 23:56:22 +00:00
Bryan Garza
eea42733ac
Replace terminator-based const eval limit
...
- Remove logic that limits const eval based on terminators, and use the
stable metric instead (back edges + fn calls)
- Add unstable flag `tiny-const-eval-limit` to add UI tests that do not
have to go up to the regular 2M step limit
2023-01-23 23:56:22 +00:00
Bryan Garza
b763f9094f
Remove debugging-related code
2023-01-23 23:56:22 +00:00
Bryan Garza
360db516cc
Create stable metric to measure long computation in Const Eval
...
This patch adds a `MirPass` that tracks the number of back-edges and
function calls in the CFG, adds a new MIR instruction to increment a
counter every time they are encountered during Const Eval, and emit a
warning if a configured limit is breached.
2023-01-23 23:56:22 +00:00
bors
56ee85274e
Auto merge of #106090 - WaffleLapkin:dereffffffffff, r=Nilstrieb
...
Remove some `ref` patterns from the compiler
Previous PR: https://github.com/rust-lang/rust/pull/105368
r? `@Nilstrieb`
2023-01-20 04:52:28 +00:00
Scott McMurray
925dc37313
Stop using BREAK & CONTINUE in compiler
...
Switching them to `Break(())` and `Continue(())` instead.
libs-api would like to remove these constants, so stop using them in compiler to make the removal PR later smaller.
2023-01-17 23:17:51 -08:00
Maybe Waffle
6a28fb42a8
Remove double spaces after dots in comments
2023-01-17 08:09:33 +00:00
Maybe Waffle
98f30e833a
Undo questionable changes
2023-01-17 07:48:19 +00:00
Maybe Waffle
3dca58e249
rustc_const_eval: remove ref patterns (+some pattern matching imps)
2023-01-17 07:48:19 +00:00
Deadbeef
6e63f7be54
attempt to make a minimal example work
2023-01-12 02:28:37 +00:00
Ralf Jung
5a06b1e67c
simplify alignment_check_failed a bit
2022-12-15 16:48:30 +00:00
Oli Scherer
b05c790fd6
Reuse the ctfe error emitting logic for the future incompat lint
2022-12-15 16:48:24 +00:00
Oli Scherer
dec05e9c73
Factor decorate closure out into a method
2022-12-15 16:25:50 +00:00
Oli Scherer
d9d92ed7da
Move alignment failure error reporting to machine
2022-12-15 16:07:35 +00:00
Oli Scherer
d66824dbc4
Make alignment checks a future incompat lint
2022-12-15 16:07:28 +00:00
Ralf Jung
fa83763491
always check alignment during CTFE
2022-12-15 15:36:11 +00:00
Michael Goulet
96cb18e864
Combine identical alias arms
2022-12-13 17:48:55 +00:00
Michael Goulet
61adaf8187
Combine projection and opaque into alias
2022-12-13 17:48:55 +00:00
KaDiWa
9bc69925cb
compiler: remove unnecessary imports and qualified paths
2022-12-10 18:45:34 +01:00
Oli Scherer
99348a5330
Change CTFE backtraces to use note instead of label to preserve their order
...
labels are reordered within the file in which they are reported, which can mess up the stack trace
2022-12-06 18:59:46 +00:00
Rageking8
58110572fb
fix dupe word typos
2022-12-05 16:42:36 +08:00
Ralf Jung
60d5d65a4d
interpret: get rid of run() function
2022-11-27 15:20:26 +01:00
Matthias Krüger
820a41580e
Rollup merge of #104564 - RalfJung:either, r=oli-obk
...
interpret: use Either over Result when it is not representing an error condition
r? `@oli-obk`
2022-11-20 18:21:48 +01:00
Lukas Markeffsky
3d7e9c4b7f
Revert "don't call align_offset during const eval, ever"
...
This reverts commit f3a577bfae376c0222e934911865ed14cddd1539.
2022-11-19 16:58:02 +01:00
Lukas Markeffsky
9e5d497b67
fix const align_offset implementation
2022-11-19 16:57:58 +01:00
Lukas Markeffsky
60f352fd7d
replace potential ICE with graceful error (no_core only)
2022-11-19 16:47:42 +01:00
Lukas Markeffsky
a906f6cb69
don't call align_offset during const eval, ever
2022-11-19 16:47:42 +01:00
Lukas Markeffsky
211743b2c8
make const align_offset useful
2022-11-19 16:36:08 +01:00
Lukas Markeffsky
f770fecfe1
unify inherent impls of CompileTimeEvalContext
2022-11-19 16:36:08 +01:00
Ralf Jung
4101889786
interpret: use Either over Result when it is not representing an error condition
2022-11-18 10:18:32 +01:00
Ralf Jung
1115ec601a
cleanup and dedupe CTFE and Miri error reporting
2022-11-16 10:13:29 +01:00
Ralf Jung
c78021709a
add is_sized method on Abi and Layout, and use it
2022-11-13 12:23:53 +01:00
Guillaume Gomez
2414a4c31a
Rollup merge of #103625 - WaffleLapkin:no_tyctxt_dogs_allowed, r=compiler-errors
...
Accept `TyCtxt` instead of `TyCtxtAt` in `Ty::is_*` functions
Functions in answer:
- `Ty::is_freeze`
- `Ty::is_sized`
- `Ty::is_unpin`
- `Ty::is_copy_modulo_regions`
This allows to remove a lot of useless `.at(DUMMY_SP)`, making the code a bit nicer :3
r? `@compiler-errors`
2022-10-29 14:18:03 +02:00
bors
5237c4d83d
Auto merge of #102674 - CastilloDel:master, r=oli-obk
...
Remove allow(rustc::potential_query_instability) in rustc_const_eval
The use of FxHashMap has been replaced with FxIndexMap.
Related to #84447
2022-10-28 12:52:17 +00:00
Maybe Waffle
a17ccfa621
Accept TyCtxt instead of TyCtxtAt in Ty::is_* functions
...
Functions in answer:
- `Ty::is_freeze`
- `Ty::is_sized`
- `Ty::is_unpin`
- `Ty::is_copy_modulo_regions`
2022-10-27 15:06:08 +04:00
Michael Goulet
ab36a2fe16
Revert "Unify tcx.constness and param env constness checks"
...
This reverts commit bef8681a18 .
This reverts commit c646c4d403 .
2022-10-20 03:44:12 +00:00
CastilloDel
c3a1ca6be7
Remove allow(rustc::potential_query_instability) in rustc_const_eval
...
The use of FxHashMap has been replaced with FxIndexMap. For
more information see https://github.com/rust-lang/rust/issues/84447
2022-10-18 17:44:01 +02:00