Ralf Jung
8b3435c10f
fix detecting references to packed unsized fields
2023-09-05 22:29:51 +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
efc759238d
miri ABI check: fix handling of 1-ZST; don't accept sign differences
2023-08-31 17:27:23 +02:00
Ralf Jung
c37bd09d88
miri function ABI check: specifically look for repr(transparent)
2023-08-30 17:07:25 +02:00
Ralf Jung
1e95aa0c49
interpret: make sure we accept transparent newtypes as ABI-compatible
...
also we were missing the case for Vector arguments, so handle those as well
2023-08-30 17:04:54 +02:00
Ralf Jung
6d1ce9bd13
storage_live: avoid computing the layout unless necessary
2023-08-30 13:46:55 +02:00
Ralf Jung
f87e91de7d
unify passing of sized and unsized function arguments :-)
2023-08-30 13:46:55 +02:00
Ralf Jung
7cdeff266c
a bit of meta-related cleanup on Projectable
2023-08-30 13:46:55 +02:00
Ralf Jung
a09df43d9f
move marking-locals-live out of push_stack_frame, so it happens with argument passing
...
this entirely avoids even creating unsized locals in Immediate::Uninitialized state
2023-08-30 13:46:54 +02:00
Ralf Jung
bdd5855b8e
interpret: fix projecting into an unsized field of a local
...
new invariant: Place::Local never refers to something unsized
2023-08-30 13:43:34 +02:00
Matthias Krüger
23f86255ef
Rollup merge of #115272 - RalfJung:miri-error-print, r=saethlin
...
miri/diagnostics: don't forget to print_backtrace when ICEing on unexpected errors
This should fix the missing output encountered [here](https://github.com/rust-lang/rust/issues/115145#issuecomment-1694334410 ).
r? `@saethlin`
2023-08-30 07:18:11 +02:00
Ralf Jung
b2ebf1c23f
const_eval and codegen: audit uses of is_zst
2023-08-29 09:03:46 +02:00
bors
191dc54dbf
Auto merge of #115182 - RalfJung:abi-compat-sign, r=b-naber
...
miri ABI compatibility check: accept u32 and i32
If only the sign differs, then surely these types are compatible. (We do still check that `arg_ext` is the same, just in case.)
Also I made it so that the ABI check must *imply* that size and alignment are the same, but it doesn't actively check that itself. With how crazy ABI constraints get, having equal size and align really shouldn't be used as a signal for anything I think...
2023-08-28 22:56:10 +00:00
Matthias Krüger
88b476c388
Rollup merge of #115164 - RalfJung:no-in-place-packed, r=b-naber
...
MIR validation: reject in-place argument/return for packed fields
As discussed [here](https://rust-lang.zulipchat.com/#narrow/stream/136281-t-opsem/topic/Packed.20fields.20and.20in-place.20function.20argument.2Freturn.20passing ).
2023-08-28 19:53:54 +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
bors
296c7a683c
Auto merge of #115184 - saethlin:local-allocated-spans, r=RalfJung
...
Record allocation spans inside force_allocation
This expands https://github.com/rust-lang/miri/pull/2940 to cover locals
r? `@RalfJung`
2023-08-25 17:03:33 +00:00
Ben Kimock
8ecdefb3db
Add a doc comment for the new hook
...
Co-authored-by: Ralf Jung <post@ralfj.de>
2023-08-25 11:58:31 -04:00
Ben Kimock
ec21d584ee
Record allocation spans inside force_allocation
2023-08-25 11:16:52 -04:00
bors
25ed43ddf3
Auto merge of #115138 - cjgillot:dse-move-packed, r=compiler-errors
...
Do not convert copies of packed projections to moves.
This code path was introduced in https://github.com/rust-lang/rust/pull/113758
After seeing https://rust-lang.zulipchat.com/#narrow/stream/136281-t-opsem/topic/Packed.20fields.20and.20in-place.20function.20argument.2Freturn.20passing , this may be UB, so should be disallowed.
This should not appear in normally-built MIR, which introduces temporary copies for packed projections.
2023-08-25 13:27:21 +00:00
Ralf Jung
5194060ded
miri ABI compatibility check: accept u32 and i32
2023-08-24 21:02:21 +02:00
Camille GILLOT
15a68610dd
Only check packed ADT.
2023-08-24 15:42:55 +00:00
Ralf Jung
4c53783f3c
when terminating during unwinding, show the reason why
2023-08-24 13:28:26 +02:00
Ralf Jung
739144fc5b
MIR validation: reject in-place argument/return for packed fields
2023-08-24 11:38:19 +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
788fd44a3b
interpret/miri: call panic_cannot_unwind lang item instead of hard-coding the same message
2023-08-20 15:52:40 +02:00
Ralf Jung
818ec8e23a
give some unwind-related terminators a more clear name
2023-08-20 15:52:38 +02:00
bors
ff55fa3026
Auto merge of #113124 - nbdd0121:eh_frame, r=cjgillot
...
Add MIR validation for unwind out from nounwind functions + fixes to make validation pass
`@Nilstrieb` This is the MIR validation you asked in https://github.com/rust-lang/rust/pull/112403#discussion_r1222739722 .
Two passes need to be fixed to get the validation to pass:
* `RemoveNoopLandingPads` currently unconditionally introduce a resume block (even there is none to begin with!), changed to not do that
* Generator state transform introduces a `assert` which may unwind, and its drop elaboration also introduces many new `UnwindAction`s, so in this case run the AbortUnwindingCalls after the transformation.
I believe this PR should also fix Rust-for-Linux/linux#1016 , cc `@ojeda`
r? `@Nilstrieb`
2023-08-20 09:58:52 +00: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
Gary Guo
eb4d6d9ff7
Add missing instantiation of generator ty in validator
2023-08-18 16:40:10 +01:00
Gary Guo
56b933763e
Add MIR validation for unwind out from nounwind functions
2023-08-18 13:51:42 +01:00
Camille GILLOT
933b618360
Revert "Implement references VarDebugInfo."
...
This reverts commit 2ec0071913
.
2023-08-17 17:02:04 +00:00
Camille GILLOT
388f6a6413
Make TerminatorEdge plural.
2023-08-16 18:12:18 +00:00
Camille GILLOT
5173d85043
Allow apply_terminator_effect to customize edges.
2023-08-16 18:12:17 +00:00
Deadbeef
f441fa08da
Remove constness from ImplSource::Param
2023-08-14 02:17:30 +00:00
bors
e3590fccfb
Auto merge of #114637 - matthiaskrgr:rollup-544y8p5, r=matthiaskrgr
...
Rollup of 11 pull requests
Successful merges:
- #106425 (Make ExitStatus implement Default)
- #113480 (add aarch64-unknown-teeos target)
- #113586 (Mention style for new syntax in tracking issue template)
- #113593 (CFI: Fix error compiling core with LLVM CFI enabled)
- #114612 (update llvm-wrapper include to silence deprecation warning)
- #114613 (Prevent constant rebuilds of `rustc-main` (and thus everything else))
- #114615 (interpret: remove incomplete protection against invalid where clauses)
- #114628 (Allowing re-implementation of mir_drops_elaborated query)
- #114629 (tests: Uncomment now valid GAT code behind FIXME)
- #114630 (Migrate GUI colors test to original CSS color format)
- #114631 (add provisional cache test for new solver)
r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-08 22:00:40 +00:00
Matthias Krüger
5c5ae6c5f3
Rollup merge of #114615 - RalfJung:interpret-invalid-where, r=lcnr
...
interpret: remove incomplete protection against invalid where clauses
Cc https://github.com/rust-lang/rust/issues/97477 , https://github.com/rust-lang/project-const-generics/issues/37
r? ``@lcnr``
2023-08-08 21:44:45 +02:00
bors
f88a8b71ce
Auto merge of #114545 - fee1-dead-contrib:lower-impl-effect, r=oli-obk
...
correctly lower `impl const` to bind to host effect param
r? `@oli-obk`
2023-08-08 19:23:41 +00:00
Ralf Jung
a7132bf387
interpret: remove incomplete protection against invalid where clauses
2023-08-08 10:35:22 +02:00
bors
6d55184d05
Auto merge of #114520 - RalfJung:unsized-valtrees, r=oli-obk
...
simplify handling of valtrees for unsized types
2023-08-08 07:48:01 +00:00
Matthias Krüger
cbe2522652
Rollup merge of #114382 - scottmcm:compare-bytes-intrinsic, r=cjgillot
...
Add a new `compare_bytes` intrinsic instead of calling `memcmp` directly
As discussed in #113435 , this lets the backends be the place that can have the "don't call the function if n == 0" logic, if it's needed for the target. (I didn't actually *add* those checks, though, since as I understood it we didn't actually need them on known targets?)
Doing this also let me make it `const` (unstable), which I don't think `extern "C" fn memcmp` can be.
cc `@RalfJung` `@Amanieu`
2023-08-07 05:29:12 +02:00
Scott McMurray
502af03445
Add a new compare_bytes
intrinsic instead of calling memcmp
directly
2023-08-06 15:47:40 -07:00
Matthias Krüger
74dce18639
Rollup merge of #114542 - RalfJung:const-prop-nonsense, r=compiler-errors
...
interpret: use ConstPropNonsense for more const-prop induced issues
2023-08-07 00:06:06 +02:00
Ralf Jung
997ec63fb1
simplify handling of valtrees for unsized types
2023-08-06 21:25:49 +02:00
Ralf Jung
b6e3bc23ef
remove an unnecessary special case in valtree_into_mplace
2023-08-06 21:25:49 +02:00
Matthias Krüger
13de583583
Rollup merge of #114505 - ouz-a:cleanup_mir, r=RalfJung
...
Add documentation to has_deref
Documentation of `has_deref` needed some polish to be more clear about where it should be used and what's it's purpose.
cc https://github.com/rust-lang/rust/issues/114401
r? `@RalfJung`
2023-08-06 17:26:29 +02:00
ouz-a
6df546281b
cleanup misinformation regarding has_deref
2023-08-06 17:29:09 +03:00
Deadbeef
92f4c59e48
lower impl const to bind to host effect param
2023-08-06 13:34:53 +00:00
Ralf Jung
efd54ccf5a
interpret: use ConstPropNonsense for more const-prop induced issues
2023-08-06 15:20:03 +02:00
Ralf Jung
3345077b42
interpret: add mplace_to_ref helper method
2023-08-04 15:00:57 +02:00