Test and assert that we do not reveal a static item's memory AllocId#116571
Test and assert that we do not reveal a static item's memory AllocId#116571oli-obk wants to merge 1 commit intorust-lang:masterfrom
Conversation
|
There's one more thing we could do but I don't know how hard it is... we could make sure to not call |
| tcx: TyCtxt<'tcx>, | ||
| key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>, | ||
| ) -> ::rustc_middle::mir::interpret::EvalToConstValueResult<'tcx> { | ||
| assert!( |
There was a problem hiding this comment.
| assert!( | |
| // This shouldn't be used for statics, since statics are conceptually places, | |
| // not values -- so what we do here could break pointer identity. | |
| assert!( |
|
This is related to the changes in #116835, right? Though there you said that we cannot yet assert that we don't use the query on statics, and here actually that passes CI, including Miri CI? I am confused. |
|
The "eval to const value" path (where I added the assert) invokes the "eval to alloc" code path where we cannot, because that is also used by |
|
Ah, okay. So what's your plan with this PR? I'm fine with landing it after adding the comment suggested above, but you also have other PRs touching the same area and changing how we handle alloc IDs around statics. |
|
Yea this becomes obsolte if we manage to land the other PRs. I'll make sure to carry over your comment change to the asserts I'm adding elsewhere |
r? @RalfJung
as per #116564 (comment)