treat mir::ConstantKind::Val correctly in check_static_ptr

This commit is contained in:
b-naber 2022-02-09 11:43:04 +01:00
parent 5e0fab6da5
commit c612ef8f48
2 changed files with 4 additions and 37 deletions

View file

@ -2522,7 +2522,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));