@@ -53,7 +53,7 @@ pub fn dyn_compatibility(
5353 db : & dyn HirDatabase ,
5454 trait_ : TraitId ,
5555) -> Option < DynCompatibilityViolation > {
56- let interner = DbInterner :: new_with ( db, Some ( trait_ . krate ( db ) ) , None ) ;
56+ let interner = DbInterner :: new_no_crate ( db) ;
5757 for super_trait in elaborate:: supertrait_def_ids ( interner, trait_. into ( ) ) {
5858 if let Some ( v) = db. dyn_compatibility_of_trait ( super_trait. 0 ) {
5959 return if super_trait. 0 == trait_ {
@@ -75,7 +75,7 @@ pub fn dyn_compatibility_with_callback<F>(
7575where
7676 F : FnMut ( DynCompatibilityViolation ) -> ControlFlow < ( ) > ,
7777{
78- let interner = DbInterner :: new_with ( db, Some ( trait_ . krate ( db ) ) , None ) ;
78+ let interner = DbInterner :: new_no_crate ( db) ;
7979 for super_trait in elaborate:: supertrait_def_ids ( interner, trait_. into ( ) ) . skip ( 1 ) {
8080 if db. dyn_compatibility_of_trait ( super_trait. 0 ) . is_some ( ) {
8181 cb ( DynCompatibilityViolation :: HasNonCompatibleSuperTrait ( trait_) ) ?;
@@ -135,7 +135,7 @@ pub fn generics_require_sized_self(db: &dyn HirDatabase, def: GenericDefId) -> b
135135 return false ;
136136 } ;
137137
138- let interner = DbInterner :: new_with ( db, Some ( krate ) , None ) ;
138+ let interner = DbInterner :: new_no_crate ( db) ;
139139 let predicates = GenericPredicates :: query_explicit ( db, def) ;
140140 // FIXME: We should use `explicit_predicates_of` here, which hasn't been implemented to
141141 // rust-analyzer yet
@@ -234,34 +234,34 @@ fn contains_illegal_self_type_reference<'db, T: rustc_type_ir::TypeVisitable<DbI
234234 & mut self ,
235235 ty : <DbInterner < ' db > as rustc_type_ir:: Interner >:: Ty ,
236236 ) -> Self :: Result {
237- let interner = DbInterner :: new_with ( self . db , None , None ) ;
237+ let interner = DbInterner :: new_no_crate ( self . db ) ;
238238 match ty. kind ( ) {
239239 rustc_type_ir:: TyKind :: Param ( param) if param. index == 0 => ControlFlow :: Break ( ( ) ) ,
240240 rustc_type_ir:: TyKind :: Param ( _) => ControlFlow :: Continue ( ( ) ) ,
241- rustc_type_ir:: TyKind :: Alias ( AliasTyKind :: Projection , proj) => match self
242- . allow_self_projection
243- {
244- AllowSelfProjection :: Yes => {
245- let trait_ = proj . trait_def_id ( DbInterner :: new_with ( self . db , None , None ) ) ;
246- let trait_ = match trait_ {
247- SolverDefId :: TraitId ( id ) => id ,
248- _ => unreachable ! ( ) ,
249- } ;
250- if self . super_traits . is_none ( ) {
251- self . super_traits = Some (
252- elaborate :: supertrait_def_ids ( interner , self . trait_ . into ( ) )
253- . map ( |super_trait| super_trait . 0 )
254- . collect ( ) ,
255- )
256- }
257- if self . super_traits . as_ref ( ) . is_some_and ( |s| s . contains ( & trait_ ) ) {
258- ControlFlow :: Continue ( ( ) )
259- } else {
260- ty . super_visit_with ( self )
241+ rustc_type_ir:: TyKind :: Alias ( AliasTyKind :: Projection , proj) => {
242+ match self . allow_self_projection {
243+ AllowSelfProjection :: Yes => {
244+ let trait_ = proj . trait_def_id ( interner ) ;
245+ let trait_ = match trait_ {
246+ SolverDefId :: TraitId ( id ) => id ,
247+ _ => unreachable ! ( ) ,
248+ } ;
249+ if self . super_traits . is_none ( ) {
250+ self . super_traits = Some (
251+ elaborate :: supertrait_def_ids ( interner , self . trait_ . into ( ) )
252+ . map ( |super_trait| super_trait . 0 )
253+ . collect ( ) ,
254+ )
255+ }
256+ if self . super_traits . as_ref ( ) . is_some_and ( |s| s . contains ( & trait_ ) ) {
257+ ControlFlow :: Continue ( ( ) )
258+ } else {
259+ ty . super_visit_with ( self )
260+ }
261261 }
262+ AllowSelfProjection :: No => ty. super_visit_with ( self ) ,
262263 }
263- AllowSelfProjection :: No => ty. super_visit_with ( self ) ,
264- } ,
264+ }
265265 _ => ty. super_visit_with ( self ) ,
266266 }
267267 }
@@ -401,7 +401,8 @@ fn receiver_is_dispatchable<'db>(
401401) -> bool {
402402 let sig = sig. instantiate_identity ( ) ;
403403
404- let interner: DbInterner < ' _ > = DbInterner :: new_with ( db, Some ( trait_. krate ( db) ) , None ) ;
404+ let module = trait_. module ( db) ;
405+ let interner = DbInterner :: new_with ( db, module. krate ( ) , module. containing_block ( ) ) ;
405406 let self_param_id = TypeParamId :: from_unchecked ( TypeOrConstParamId {
406407 parent : trait_. into ( ) ,
407408 local_id : LocalTypeOrConstParamId :: from_raw ( la_arena:: RawIdx :: from_u32 ( 0 ) ) ,
0 commit comments