@@ -168,41 +168,25 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
168168 } ) ;
169169 struct_datum
170170 }
171- RustDefId :: Ref ( _ ) | RustDefId :: RawPtr => Arc :: new ( chalk_rust_ir:: StructDatum {
171+ RustDefId :: Array => Arc :: new ( chalk_rust_ir:: StructDatum {
172172 id : struct_id,
173173 binders : chalk_ir:: Binders :: new (
174174 chalk_ir:: ParameterKinds :: from (
175175 & self . interner ,
176- vec ! [
177- chalk_ir:: ParameterKind :: Lifetime ( ( ) ) ,
178- chalk_ir:: ParameterKind :: Ty ( ( ) ) ,
179- ] ,
176+ Some ( chalk_ir:: ParameterKind :: Ty ( ( ) ) ) ,
180177 ) ,
181178 chalk_rust_ir:: StructDatumBound { fields : vec ! [ ] , where_clauses : vec ! [ ] } ,
182179 ) ,
183180 flags : chalk_rust_ir:: StructFlags { upstream : false , fundamental : false } ,
184181 } ) ,
185- RustDefId :: Array | RustDefId :: Slice => Arc :: new ( chalk_rust_ir:: StructDatum {
182+ RustDefId :: Never | RustDefId :: FnDef ( _ ) => Arc :: new ( chalk_rust_ir:: StructDatum {
186183 id : struct_id,
187184 binders : chalk_ir:: Binders :: new (
188- chalk_ir:: ParameterKinds :: from (
189- & self . interner ,
190- Some ( chalk_ir:: ParameterKind :: Ty ( ( ) ) ) ,
191- ) ,
185+ chalk_ir:: ParameterKinds :: new ( & self . interner ) ,
192186 chalk_rust_ir:: StructDatumBound { fields : vec ! [ ] , where_clauses : vec ! [ ] } ,
193187 ) ,
194188 flags : chalk_rust_ir:: StructFlags { upstream : false , fundamental : false } ,
195189 } ) ,
196- RustDefId :: Str | RustDefId :: Never | RustDefId :: FnDef ( _) => {
197- Arc :: new ( chalk_rust_ir:: StructDatum {
198- id : struct_id,
199- binders : chalk_ir:: Binders :: new (
200- chalk_ir:: ParameterKinds :: new ( & self . interner ) ,
201- chalk_rust_ir:: StructDatumBound { fields : vec ! [ ] , where_clauses : vec ! [ ] } ,
202- ) ,
203- flags : chalk_rust_ir:: StructFlags { upstream : false , fundamental : false } ,
204- } )
205- }
206190
207191 v => bug ! ( "Used not struct variant ({:?}) when expecting struct variant." , v) ,
208192 }
@@ -286,12 +270,8 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
286270 // FIXME(chalk): this match can be removed when builtin types supported
287271 match struct_id. 0 {
288272 RustDefId :: Adt ( _) => { }
289- RustDefId :: Str => return false ,
290273 RustDefId :: Never => return false ,
291- RustDefId :: Slice => return false ,
292274 RustDefId :: Array => return false ,
293- RustDefId :: Ref ( _) => return false ,
294- RustDefId :: RawPtr => return false ,
295275 _ => bug ! ( "Did not use `Adt` variant when expecting adt." ) ,
296276 }
297277 let adt_def_id: DefId = match struct_id. 0 {
@@ -388,7 +368,7 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
388368 chalk_ir:: TypeName :: Struct ( chalk_ir:: StructId ( rust_def_id) ) => {
389369 use rustc_middle:: traits:: ChalkRustDefId :: * ;
390370 match rust_def_id {
391- Never | Array | RawPtr | FnDef ( _ ) | Ref ( _) => Some ( true ) ,
371+ Never | Array | FnDef ( _) => Some ( true ) ,
392372
393373 Adt ( adt_def_id) => {
394374 let adt_def = self . tcx . adt_def ( adt_def_id) ;
@@ -405,8 +385,6 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
405385 }
406386 }
407387
408- Str | Slice => Some ( false ) ,
409-
410388 Trait ( _) | Impl ( _) | AssocTy ( _) | Opaque ( _) => panic ! ( ) ,
411389 }
412390 }
@@ -421,7 +399,7 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
421399 chalk_ir:: TypeName :: Struct ( chalk_ir:: StructId ( rust_def_id) ) => {
422400 use rustc_middle:: traits:: ChalkRustDefId :: * ;
423401 match rust_def_id {
424- Never | RawPtr | Ref ( _ ) | Str | Slice => Some ( false ) ,
402+ Never => Some ( false ) ,
425403 FnDef ( _) | Array => Some ( true ) ,
426404 Adt ( adt_def_id) => {
427405 let adt_def = self . tcx . adt_def ( adt_def_id) ;
@@ -489,6 +467,14 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
489467 } ;
490468 Some ( t)
491469 }
470+
471+ fn is_object_safe ( & self , trait_id : chalk_ir:: TraitId < RustInterner < ' tcx > > ) -> bool {
472+ let def_id: DefId = match trait_id. 0 {
473+ RustDefId :: Trait ( def_id) => def_id,
474+ _ => bug ! ( "Did not use `Trait` variant when expecting trait." ) ,
475+ } ;
476+ self . tcx . is_object_safe ( def_id)
477+ }
492478}
493479
494480/// Creates a `InternalSubsts` that maps each generic parameter to a higher-ranked
0 commit comments