Repository: rust-lang/rust
File: compiler/rustc_const_eval/src/const_eval/type_info.rs (Rust)

Code before:

                            variant
                        }
                        ty::RawPtr(ty, mutability) => {
                            let (variant, variant_place) = downcast(sym::Pointer)?;
                            let pointer_place =
                                self.project_field(&variant_place, FieldIdx::ZERO)?;

                            self.write_pointer_type_info(pointer_place, *ty, *mutability)?;

                            variant
                        }
                        ty::Dynamic(predicates, region) => {
                            let (variant, variant_place) = downcast(sym::DynTrait)?;
                            let dyn_place = self.project_field(&variant_place, FieldIdx::ZERO)?;
                            self.write_dyn_trait_type_info(dyn_place, *predicates, *region)?;
                            variant
                        }
                        ty::FnPtr(binder, signature) => {
                            let (variant, variant_place) = downcast(sym::FnPtr)?;
                            let fn_ptr_place =
                                self.project_field(&variant_place, FieldIdx::ZERO)?;
                            self.write_fn_ptr_type_info(
                                fn_ptr_place,
                                binder.skip_binder().output(),
                                signature.safety.is_unsafe(),
                                signature.c_variadic,
                                (!signature.abi.is_rustic_abi()).then_some(signature.abi.as_str()),
                                binder.skip_binder().inputs(),
                            )?;
                            variant
                        }
                        ty::Adt(_, _)
                        | ty::Foreign(_)
                        | ty::Pat(_, _)
                        | ty::FnDef(..)
                        | ty::UnsafeBinder(..)
                        | ty::Closure(..)
                        | ty::CoroutineClosure(..)
                        | ty::Coroutine(..)
                        | ty::CoroutineWitness(..)
                        | ty::Never
                        | ty::Alias(..)
                        | ty::Param(_)
                        | ty::Bound(..)
                        | ty::Placeholder(_)
                        | ty::Infer(..)
                        | ty::Error(_) => downcast(sym::Other)?.0,
                    };
                    self.write_discriminant(variant_index, &field_dest)?
                }

Review comment (suggestion):
You should exhaustively destructure `signature` so that future changes to the struct get picked up here. 

Code after:
                            let reference_place =
                                self.project_field(&variant_place, FieldIdx::ZERO)?;
                            self.write_reference_type_info(reference_place, *ty, *mutability)?;

                            variant
                        }
                        ty::RawPtr(ty, mutability) => {
                            let (variant, variant_place) =
                                self.downcast(&field_dest, sym::Pointer)?;
                            let pointer_place =
                                self.project_field(&variant_place, FieldIdx::ZERO)?;

                            self.write_pointer_type_info(pointer_place, *ty, *mutability)?;

                            variant
                        }
                        ty::Dynamic(predicates, region) => {
                            let (variant, variant_place) =
                                self.downcast(&field_dest, sym::DynTrait)?;
                            let dyn_place = self.project_field(&variant_place, FieldIdx::ZERO)?;
                            self.write_dyn_trait_type_info(dyn_place, *predicates, *region)?;
                            variant
                        }
                        ty::FnPtr(sig, fn_header) => {
                            let (variant, variant_place) =
                                self.downcast(&field_dest, sym::FnPtr)?;
                            let fn_ptr_place =
                                self.project_field(&variant_place, FieldIdx::ZERO)?;

                            // FIXME: handle lifetime bounds
                            let sig = sig.skip_binder();

                            self.write_fn_ptr_type_info(fn_ptr_place, &sig, fn_header)?;
                            variant
                        }
                        ty::Foreign(_)
                        | ty::Pat(_, _)
                        | ty::FnDef(..)
                        | ty::UnsafeBinder(..)
                        | ty::Closure(..)
                        | ty::CoroutineClosure(..)
                        | ty::Coroutine(..)
                        | ty::CoroutineWitness(..)
                        | ty::Never
                        | ty::Alias(..)
                        | ty::Param(_)
                        | ty::Bound(..)
                        | ty::Placeholder(_)
                        | ty::Infer(..)
                        | ty::Error(_) => self.downcast(&field_dest, sym::Other)?.0,
                    };