Oli Scherer
e96ce20b34
s/generator/coroutine/
2023-10-20 21:14:01 +00:00
bors
75a5dd05bc
Auto merge of #115524 - RalfJung:misalign, r=wesleywiser
...
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-14 00:57:09 +00:00
bors
8fa7bdf191
Auto merge of #115670 - Zoxc:outline-panic-macro-1, r=Mark-Simulacrum
...
Partially outline code inside the panic! macro
This outlines code inside the panic! macro in some cases. This is split out from https://github.com/rust-lang/rust/pull/115562 to exclude changes to rustc.
2023-10-01 05:56:47 +00:00
Ralf Jung
a993a8bf3f
const-eval: make misalignment a hard error
2023-09-26 15:32:55 +02:00
Ralf Jung
da08a3f40c
interpret: more consistently use ImmTy in operators and casts
2023-09-20 21:57:54 +02:00
John Kåre Alsaker
6a02baaa3d
Partially outline code inside the panic! macro
2023-09-08 14:05:57 +02:00
Ralf Jung
807e5b8022
avoid return in tail position
...
Co-authored-by: fee1-dead <ent3rm4n@gmail.com >
2023-08-20 15:52:40 +02:00
Ralf Jung
ac3bca24b7
interpret: have assert_* intrinsics call the panic machinery instead of a direct abort
2023-08-20 15:52:40 +02:00
Ralf Jung
410bd45ff2
const-eval: ensure we never const-execute a function marked rustc_do_not_const_check
2023-08-19 14:33:31 +02:00
Ralf Jung
7d5886504c
rename deref_operand → deref_pointer and some Miri helper functions
2023-08-01 13:40:29 +02:00
Ralf Jung
77ff1b83cd
interpret: make read functions generic over operand type
2023-07-25 22:33:59 +02:00
David Tolnay
5bbf0a8306
Revert "Auto merge of #113166 - moulins:ref-niches-initial, r=oli-obk"
...
This reverts commit 557359f925 , reversing
changes made to 1e6c09a803 .
2023-07-21 22:35:57 -07:00
Moulins
39cfe70e4f
CTFE: move target_{i, u}size_{min, max) to rustc_abi::TargetDataLayout
2023-07-21 03:31:47 +02:00
Moulins
76c49aead6
support non-null pointer niches in CTFE
2023-07-21 03:31:45 +02:00
Mahdi Dibaiee
e55583c4b8
refactor(rustc_middle): Substs -> GenericArg
2023-07-14 13:27:35 +01:00
Ralf Jung
dd453a6a99
miri: protect Move() function arguments during the call
2023-07-11 21:59:01 +02:00
Nilstrieb
70b6a74c3c
Add enum for can_access_statics boolean
...
`/*can_access_statics:*/ false` is one of the ways to do this, but not
the one I like.
2023-06-24 20:40:40 +00:00
Deadbeef
4f83717cf7
Use translatable diagnostics in rustc_const_eval
2023-06-01 14:45:18 +00:00
Oli Scherer
05eae08233
Remove const eval limit and implement an exponential backoff lint instead
2023-05-31 10:24:17 +00:00
Tomasz Miąsko
67f455afe1
Suppress "erroneous constant used" for constants tainted by errors
...
When constant evaluation fails because its MIR is tainted by errors,
suppress note indicating that erroneous constant was used, since those
errors have to be fixed regardless of the constant being used or not.
2023-05-15 00:00:00 +00:00
Ralf Jung
586d17d330
share BinOp::Offset between CTFE and Miri
2023-04-28 16:00:08 +02:00
Scott McMurray
05a665f21a
Lower intrinsics::offset to mir::BinOp::Offset
...
They're semantically the same, so this means the backends don't need to handle the intrinsic and means fewer MIR basic blocks in pointer arithmetic code.
2023-04-25 19:23:45 -07:00
Camille GILLOT
b275d2c30b
Remove WithOptconstParam.
2023-04-20 17:48:32 +00:00
Gary Guo
5e6ed132fa
Add UnwindAction::Unreachable
...
This also makes eval machine's `StackPopUnwind`
redundant so that is replaced.
2023-04-06 09:34:16 +01:00
Gary Guo
daeb844e0c
Refactor unwind from Option to a new enum
2023-04-06 09:34:16 +01:00
Ben Kimock
8ccf53332e
A MIR transform that checks pointers are aligned
2023-03-23 18:23:06 -04:00
Oli Scherer
f066d6785d
Detect uninhabited types early in const eval.
2023-03-21 11:09:27 +00:00
Oli Scherer
83dec62b26
Add a layout argument to enforce_validity.
...
This is in preparation of checking the validity only of certain types.
2023-03-21 08:52:31 +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
Maybe Waffle
fd649a3cc5
Replace enum ==s with matches where it makes sense
2023-01-30 12:26:26 +00: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
3dca58e249
rustc_const_eval: remove ref patterns (+some pattern matching imps)
2023-01-17 07:48:19 +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
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
Rageking8
58110572fb
fix dupe word typos
2022-12-05 16:42:36 +08: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