Ralf Jung
e00120906e
handle/hack for arbitrary-self dyn receivers
2023-09-09 15:38:23 +02:00
Ralf Jung
a38a3bfc6d
implement and test ABI compatibility for transparent wrappers around NPO types
2023-09-09 15:36:44 +02:00
Ralf Jung
b5bab2b1cc
implement and test fn ptr ABI compatibility rules
2023-09-09 15:36:44 +02:00
Ralf Jung
f993ddc079
give extra context to ABI mismatch errors
2023-09-09 15:36:44 +02:00
Ralf Jung
897a65804d
interpret: change ABI-compat test to be type-based, so the test is consistent across targets
2023-09-09 15:36:44 +02:00
bors
cd71a37f32
Auto merge of #115372 - RalfJung:abi-assert-eq, r=davidtwco
...
add rustc_abi(assert_eq) to test some guaranteed or at least highly expected ABI compatibility guarantees
This new repr(transparent) test is super useful, it would have found https://github.com/rust-lang/rust/issues/115336 and found https://github.com/rust-lang/rust/issues/115404 , https://github.com/rust-lang/rust/issues/115481 , https://github.com/rust-lang/rust/issues/115509 .
2023-09-08 11:56:08 +00:00
Ralf Jung
b0cf4c28ea
turns out Layout has some more things to worry about -- move ABI comparison into helper function
...
like is_bool, and some special magic extra fields
2023-09-08 09:14:07 +02:00
Ralf Jung
c3e14edd8b
accept some differences for rustc_abi(assert_eq), so that we can test more things to be compatible
2023-09-08 08:59:55 +02:00
bors
3d249706aa
Auto merge of #115608 - RalfJung:fn-arg-validity, r=oli-obk
...
miri: catch function calls where the argument is caller-invalid / the return value callee-invalid
When doing a type-changing copy, we must validate the data both at the old and new type.
Fixes https://github.com/rust-lang/miri/issues/3017
2023-09-08 04:10:14 +00:00
Ralf Jung
73d8dcb803
miri: catch function calls where the argument is caller-invalid / the return value callee-invalid
2023-09-06 16:36:00 +02:00
Camille GILLOT
26c48e6f95
Refactor how MIR represents composite debuginfo.
2023-09-05 17:20:07 +00: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