fn force_impl_for(
        &self,
        well_known: chalk_rust_ir::WellKnownTrait,
        ty: &chalk_ir::TyData<RustInterner<'tcx>>,
    ) -> Option<bool> {
        use chalk_ir::TyData::*;
        match well_known {
            chalk_rust_ir::WellKnownTrait::SizedTrait => match ty {
                Apply(apply) => match apply.name {
                    chalk_ir::TypeName::Struct(chalk_ir::StructId(rust_def_id)) => {
                        use rustc_middle::traits::ChalkRustDefId::*;
                        match rust_def_id {
                            Never | Array | RawPtr | FnDef(_) | Ref(_) => Some(true),

                            Adt(adt_def_id) => {
                                let adt_def = self.tcx.adt_def(adt_def_id);
                                match adt_def.adt_kind() {
                                    ty::AdtKind::Struct | ty::AdtKind::Union => None,
                                    ty::AdtKind::Enum => {
                                        let constraint = self.tcx.adt_sized_constraint(adt_def_id);
                                        if constraint.0.len() > 0 {
                                            unimplemented!()
                                        } else {
                                            Some(true)
                                        }
                                    }
                                }
                            }

                            Str | Slice => Some(false),

                            Trait(_) | Impl(_) | AssocTy(_) => panic!(),
                        }
                    }
                    _ => None,
                },
                Dyn(_) | Alias(_) | Placeholder(_) | Function(_) | InferenceVar(_)
                | BoundVar(_) => None,
            },
            chalk_rust_ir::WellKnownTrait::CopyTrait
            | chalk_rust_ir::WellKnownTrait::CloneTrait => match ty {
                Apply(apply) => match apply.name {
                    chalk_ir::TypeName::Struct(chalk_ir::StructId(rust_def_id)) => {
                        use rustc_middle::traits::ChalkRustDefId::*;
                        match rust_def_id {
                            Never | RawPtr | Ref(_) | Str | Slice => Some(false),
                            FnDef(_) | Array => Some(true),
                            Adt(adt_def_id) => {
                                let adt_def = self.tcx.adt_def(adt_def_id);
                                match adt_def.adt_kind() {
                                    ty::AdtKind::Struct | ty::AdtKind::Union => None,
                                    ty::AdtKind::Enum => {
                                        let constraint = self.tcx.adt_sized_constraint(adt_def_id);
                                        if constraint.0.len() > 0 {
                                            unimplemented!()
                                        } else {
                                            Some(true)
                                        }
                                    }
                                }
                            }
                            Trait(_) | Impl(_) | AssocTy(_) => panic!(),
                        }
                    }
                    _ => None,
                },
                Dyn(_) | Alias(_) | Placeholder(_) | Function(_) | InferenceVar(_)
                | BoundVar(_) => None,
            },
            chalk_rust_ir::WellKnownTrait::DropTrait => None,
        }
    }
/// Since Chalk can't handle all Rust types currently, we have to handle
/// some specially for now. Over time, these `Some` returns will change to
/// `None` and eventually this function will be removed.
Since Chalk can't handle all Rust types currently, we have to handle
some specially for now. Over time, these `Some` returns will change to
`None` and eventually this function will be removed.
Since Chalk can ' t handle all Rust types currently we have to handle some specially for now . Over time these ` Some ` returns will change to ` None ` and eventually this function will be removed .
fn force_impl_for(
        &self,
        well_known: chalk_rust_ir::WellKnownTrait,
        ty: &chalk_ir::TyData<RustInterner<'tcx>>,
    ) -> Option<bool> {
        use chalk_ir::TyData::*;
        match well_known {
            chalk_rust_ir::WellKnownTrait::SizedTrait => match ty {
                Apply(apply) => match apply.name {
                    chalk_ir::TypeName::Struct(chalk_ir::StructId(rust_def_id)) => {
                        use rustc_middle::traits::ChalkRustDefId::*;
                        match rust_def_id {
                            Never | Array | RawPtr | FnDef(_) | Ref(_) => Some(true),
                            Adt(adt_def_id) => {
                                let adt_def = self.tcx.adt_def(adt_def_id);
                                match adt_def.adt_kind() {
                                    ty::AdtKind::Struct | ty::AdtKind::Union => None,
                                    ty::AdtKind::Enum => {
                                        let constraint = self.tcx.adt_sized_constraint(adt_def_id);
                                        if constraint.0.len() > 0 {
                                            unimplemented!()
                                        } else {
                                            Some(true)
                                        }
                                    }
                                }
                            }
                            Str | Slice => Some(false),
                            Trait(_) | Impl(_) | AssocTy(_) => panic!(),
                        }
                    }
                    _ => None,
                },
                Dyn(_) | Alias(_) | Placeholder(_) | Function(_) | InferenceVar(_)
                | BoundVar(_) => None,
            },
            chalk_rust_ir::WellKnownTrait::CopyTrait
            | chalk_rust_ir::WellKnownTrait::CloneTrait => match ty {
                Apply(apply) => match apply.name {
                    chalk_ir::TypeName::Struct(chalk_ir::StructId(rust_def_id)) => {
                        use rustc_middle::traits::ChalkRustDefId::*;
                        match rust_def_id {
                            Never | RawPtr | Ref(_) | Str | Slice => Some(false),
                            FnDef(_) | Array => Some(true),
                            Adt(adt_def_id) => {
                                let adt_def = self.tcx.adt_def(adt_def_id);
                                match adt_def.adt_kind() {
                                    ty::AdtKind::Struct | ty::AdtKind::Union => None,
                                    ty::AdtKind::Enum => {
                                        let constraint = self.tcx.adt_sized_constraint(adt_def_id);
                                        if constraint.0.len() > 0 {
                                            unimplemented!()
                                        } else {
                                            Some(true)
                                        }
                                    }
                                }
                            }
                            Trait(_) | Impl(_) | AssocTy(_) => panic!(),
                        }
                    }
                    _ => None,
                },
                Dyn(_) | Alias(_) | Placeholder(_) | Function(_) | InferenceVar(_)
                | BoundVar(_) => None,
            },
            chalk_rust_ir::WellKnownTrait::DropTrait => None,
        }
    }
fn force_impl_for ( & self , well_known : chalk_rust_ir :: WellKnownTrait , ty : & chalk_ir :: TyData < RustInterner < ' tcx > > , ) -> Option < bool > { use chalk_ir :: TyData :: * ; match well_known { chalk_rust_ir :: WellKnownTrait :: SizedTrait => match ty { Apply ( apply ) => match apply . name { chalk_ir :: TypeName :: Struct ( chalk_ir :: StructId ( rust_def_id ) ) => { use rustc_middle :: traits :: ChalkRustDefId :: * ; match rust_def_id { Never | Array | RawPtr | FnDef ( _ ) | Ref ( _ ) => Some ( true ) , Adt ( adt_def_id ) => { let adt_def = self . tcx . adt_def ( adt_def_id ) ; match adt_def . adt_kind ( ) { ty :: AdtKind :: Struct | ty :: AdtKind :: Union => None , ty :: AdtKind :: Enum => { let constraint = self . tcx . adt_sized_constraint ( adt_def_id ) ; if constraint . 0 . len ( ) > 0 { unimplemented ! ( ) } else { Some ( true ) } } } } Str | Slice => Some ( false ) , Trait ( _ ) | Impl ( _ ) | AssocTy ( _ ) => panic ! ( ) , } } _ => None , } , Dyn ( _ ) | Alias ( _ ) | Placeholder ( _ ) | Function ( _ ) | InferenceVar ( _ ) | BoundVar ( _ ) => None , } , chalk_rust_ir :: WellKnownTrait :: CopyTrait | chalk_rust_ir :: WellKnownTrait :: CloneTrait => match ty { Apply ( apply ) => match apply . name { chalk_ir :: TypeName :: Struct ( chalk_ir :: StructId ( rust_def_id ) ) => { use rustc_middle :: traits :: ChalkRustDefId :: * ; match rust_def_id { Never | RawPtr | Ref ( _ ) | Str | Slice => Some ( false ) , FnDef ( _ ) | Array => Some ( true ) , Adt ( adt_def_id ) => { let adt_def = self . tcx . adt_def ( adt_def_id ) ; match adt_def . adt_kind ( ) { ty :: AdtKind :: Struct | ty :: AdtKind :: Union => None , ty :: AdtKind :: Enum => { let constraint = self . tcx . adt_sized_constraint ( adt_def_id ) ; if constraint . 0 . len ( ) > 0 { unimplemented ! ( ) } else { Some ( true ) } } } } Trait ( _ ) | Impl ( _ ) | AssocTy ( _ ) => panic ! ( ) , } } _ => None , } , Dyn ( _ ) | Alias ( _ ) | Placeholder ( _ ) | Function ( _ ) | InferenceVar ( _ ) | BoundVar ( _ ) => None , } , chalk_rust_ir :: WellKnownTrait :: DropTrait => None , } }
Since Chalk can't handle all Rust types currently, we have to handle
some specially for now.
Since Chalk can ' t handle all Rust types currently we have to handle some specially for now .
&self
well_known
chalk_rust_ir::WellKnownTrait
ty
&chalk_ir::TyData<RustInterner<'tcx>>