@@ -24,9 +24,9 @@ use chalk_ir::{
24
24
25
25
use either:: Either ;
26
26
use hir_def:: {
27
- AdtId , AssocItemId , CallableDefId , ConstId , ConstParamId , EnumId , EnumVariantId , FunctionId ,
28
- GenericDefId , GenericParamId , ImplId , ItemContainerId , LocalFieldId , Lookup , StaticId ,
29
- StructId , TypeAliasId , TypeOrConstParamId , UnionId , VariantId ,
27
+ AdtId , AssocItemId , ConstId , ConstParamId , EnumId , EnumVariantId , FunctionId , GenericDefId ,
28
+ GenericParamId , ImplId , ItemContainerId , LocalFieldId , Lookup , StaticId , StructId , TypeAliasId ,
29
+ TypeOrConstParamId , UnionId , VariantId ,
30
30
builtin_type:: BuiltinType ,
31
31
expr_store:: { ExpressionStore , path:: Path } ,
32
32
hir:: generics:: { GenericParamDataRef , TypeOrConstParamData , WherePredicate } ,
@@ -45,10 +45,10 @@ use stdx::{impl_from, never};
45
45
use triomphe:: { Arc , ThinArc } ;
46
46
47
47
use crate :: {
48
- AliasTy , Binders , BoundVar , CallableSig , Const , DebruijnIndex , DynTy , FnAbi , FnPointer , FnSig ,
49
- FnSubst , ImplTrait , ImplTraitId , ImplTraits , Interner , Lifetime , LifetimeData ,
50
- LifetimeOutlives , PolyFnSig , QuantifiedWhereClause , QuantifiedWhereClauses , Substitution ,
51
- TraitRef , TraitRefExt , Ty , TyBuilder , TyKind , WhereClause , all_super_traits,
48
+ AliasTy , Binders , BoundVar , Const , DebruijnIndex , DynTy , FnAbi , FnPointer , FnSig , FnSubst ,
49
+ ImplTrait , ImplTraitId , ImplTraits , Interner , Lifetime , LifetimeData , LifetimeOutlives ,
50
+ QuantifiedWhereClause , QuantifiedWhereClauses , Substitution , TraitRef , TraitRefExt , Ty ,
51
+ TyBuilder , TyKind , WhereClause , all_super_traits,
52
52
consteval:: { intern_const_ref, path_to_const, unknown_const, unknown_const_as_generic} ,
53
53
db:: HirDatabase ,
54
54
error_lifetime,
@@ -824,15 +824,6 @@ impl<'a> TyLoweringContext<'a> {
824
824
}
825
825
}
826
826
827
- /// Build the signature of a callable item (function, struct or enum variant).
828
- pub ( crate ) fn callable_item_signature_query ( db : & dyn HirDatabase , def : CallableDefId ) -> PolyFnSig {
829
- match def {
830
- CallableDefId :: FunctionId ( f) => fn_sig_for_fn ( db, f) ,
831
- CallableDefId :: StructId ( s) => fn_sig_for_struct_constructor ( db, s) ,
832
- CallableDefId :: EnumVariantId ( e) => fn_sig_for_enum_variant_constructor ( db, e) ,
833
- }
834
- }
835
-
836
827
fn named_associated_type_shorthand_candidates < R > (
837
828
db : & dyn HirDatabase ,
838
829
// If the type parameter is defined in an impl and we're in a method, there
@@ -1312,73 +1303,6 @@ pub(crate) fn generic_defaults_with_diagnostics_cycle_result(
1312
1303
( GenericDefaults ( None ) , None )
1313
1304
}
1314
1305
1315
- fn fn_sig_for_fn ( db : & dyn HirDatabase , def : FunctionId ) -> PolyFnSig {
1316
- let data = db. function_signature ( def) ;
1317
- let resolver = def. resolver ( db) ;
1318
- let mut ctx_params = TyLoweringContext :: new (
1319
- db,
1320
- & resolver,
1321
- & data. store ,
1322
- def. into ( ) ,
1323
- LifetimeElisionKind :: for_fn_params ( & data) ,
1324
- )
1325
- . with_type_param_mode ( ParamLoweringMode :: Variable ) ;
1326
- let params = data. params . iter ( ) . map ( |& tr| ctx_params. lower_ty ( tr) ) ;
1327
-
1328
- let ret = match data. ret_type {
1329
- Some ( ret_type) => {
1330
- let mut ctx_ret = TyLoweringContext :: new (
1331
- db,
1332
- & resolver,
1333
- & data. store ,
1334
- def. into ( ) ,
1335
- LifetimeElisionKind :: for_fn_ret ( ) ,
1336
- )
1337
- . with_impl_trait_mode ( ImplTraitLoweringMode :: Opaque )
1338
- . with_type_param_mode ( ParamLoweringMode :: Variable ) ;
1339
- ctx_ret. lower_ty ( ret_type)
1340
- }
1341
- None => TyKind :: Tuple ( 0 , Substitution :: empty ( Interner ) ) . intern ( Interner ) ,
1342
- } ;
1343
- let generics = generics ( db, def. into ( ) ) ;
1344
- let sig = CallableSig :: from_params_and_return (
1345
- params,
1346
- ret,
1347
- data. is_varargs ( ) ,
1348
- if data. is_unsafe ( ) { Safety :: Unsafe } else { Safety :: Safe } ,
1349
- data. abi . as_ref ( ) . map_or ( FnAbi :: Rust , FnAbi :: from_symbol) ,
1350
- ) ;
1351
- make_binders ( db, & generics, sig)
1352
- }
1353
-
1354
- fn fn_sig_for_struct_constructor ( db : & dyn HirDatabase , def : StructId ) -> PolyFnSig {
1355
- let field_tys = db. field_types ( def. into ( ) ) ;
1356
- let params = field_tys. iter ( ) . map ( |( _, ty) | ty. skip_binders ( ) . clone ( ) ) ;
1357
- let ( ret, binders) = type_for_adt ( db, def. into ( ) ) . into_value_and_skipped_binders ( ) ;
1358
- Binders :: new (
1359
- binders,
1360
- CallableSig :: from_params_and_return ( params, ret, false , Safety :: Safe , FnAbi :: RustCall ) ,
1361
- )
1362
- }
1363
-
1364
- fn fn_sig_for_enum_variant_constructor ( db : & dyn HirDatabase , def : EnumVariantId ) -> PolyFnSig {
1365
- let field_tys = db. field_types ( def. into ( ) ) ;
1366
- let params = field_tys. iter ( ) . map ( |( _, ty) | ty. skip_binders ( ) . clone ( ) ) ;
1367
- let parent = def. lookup ( db) . parent ;
1368
- let ( ret, binders) = type_for_adt ( db, parent. into ( ) ) . into_value_and_skipped_binders ( ) ;
1369
- Binders :: new (
1370
- binders,
1371
- CallableSig :: from_params_and_return ( params, ret, false , Safety :: Safe , FnAbi :: RustCall ) ,
1372
- )
1373
- }
1374
-
1375
- fn type_for_adt ( db : & dyn HirDatabase , adt : AdtId ) -> Binders < Ty > {
1376
- let generics = generics ( db, adt. into ( ) ) ;
1377
- let subst = generics. bound_vars_subst ( db, DebruijnIndex :: INNERMOST ) ;
1378
- let ty = TyKind :: Adt ( crate :: AdtId ( adt) , subst) . intern ( Interner ) ;
1379
- make_binders ( db, & generics, ty)
1380
- }
1381
-
1382
1306
pub ( crate ) fn type_for_type_alias_with_diagnostics_query (
1383
1307
db : & dyn HirDatabase ,
1384
1308
t : TypeAliasId ,
0 commit comments