Use ECX for ty consts#192
Conversation
f6415f5 to
c4467f1
Compare
| ty::ConstKind::Value(val) => { | ||
| let val = vir::with_vcx(|vcx| vcx.tcx().valtree_to_const_val(val)); | ||
| Self::encode_const_val_ty(deps, val, ty) | ||
| // TODO: Exchange DUMMY_SP here and below with an actual Span. Otherwise opaque functions will always start with const_1_0 |
There was a problem hiding this comment.
This is not great -- is it the case that when we request an encoding we should have a span? Maybe at the same place we get the context from?
There was a problem hiding this comment.
The place where this gets called is args_ty.rs which doesn't have access to the span. Is there a way to get the span?
There was a problem hiding this comment.
Can this lead to name clases (in particular due to macro expansion), or is it just a cosmetic issue? If it's the latter, then you can make the inputs be optional so the span part of the identifier is just not emitted.
There was a problem hiding this comment.
Maybe @JonasAlaif knows more about this but from what I understand, the fresh function will always add a auto-incrementing ID as well? So I guess it should just be cosmetic?
This PR combines the control flows for mir consts and ty val consts by using the ECX for the latter as well. This PR also removes the use of arbitrary values for string consts completely (instead, each const leads to one fresh function).
Because of the unavailability of span in args_ty.rs, ty consts currently use a dummy span, meaning that the fresh constant functions will always start with
const_1_0