treat literals in ExprKind::StaticRef as mir::ConstantKind::Val
This commit is contained in:
parent
1b14fd3b10
commit
d92df974fe
6 changed files with 30 additions and 21 deletions
|
@ -2534,7 +2534,7 @@ pub enum ConstantKind<'tcx> {
|
|||
|
||||
impl<'tcx> Constant<'tcx> {
|
||||
pub fn check_static_ptr(&self, tcx: TyCtxt<'_>) -> Option<DefId> {
|
||||
match self.literal.const_for_ty()?.val().try_to_scalar() {
|
||||
match self.literal.try_to_scalar() {
|
||||
Some(Scalar::Ptr(ptr, _size)) => match tcx.global_alloc(ptr.provenance) {
|
||||
GlobalAlloc::Static(def_id) => {
|
||||
assert!(!tcx.is_thread_local_static(def_id));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue