@@ -49,10 +49,10 @@ use crate::{
49
49
semantics:: source_to_def:: { ChildContainer , SourceToDefCache , SourceToDefCtx } ,
50
50
source_analyzer:: { name_hygiene, resolve_hir_path, SourceAnalyzer } ,
51
51
Access , Adjust , Adjustment , Adt , AutoBorrow , BindingMode , BuiltinAttr , Callable , Const ,
52
- ConstParam , Crate , DeriveHelper , Enum , Field , Function , HasSource , HirFileId , Impl , InFile ,
53
- InlineAsmOperand , ItemInNs , Label , LifetimeParam , Local , Macro , Module , ModuleDef , Name ,
54
- OverloadedDeref , Path , ScopeDef , Static , Struct , ToolModule , Trait , TraitAlias , TupleField ,
55
- Type , TypeAlias , TypeParam , Union , Variant , VariantDef ,
52
+ ConstParam , Crate , DeriveHelper , Enum , Field , Function , GenericSubstitution , HasSource ,
53
+ HirFileId , Impl , InFile , InlineAsmOperand , ItemInNs , Label , LifetimeParam , Local , Macro ,
54
+ Module , ModuleDef , Name , OverloadedDeref , Path , ScopeDef , Static , Struct , ToolModule , Trait ,
55
+ TraitAlias , TupleField , Type , TypeAlias , TypeParam , Union , Variant , VariantDef ,
56
56
} ;
57
57
58
58
const CONTINUE_NO_BREAKS : ControlFlow < Infallible , ( ) > = ControlFlow :: Continue ( ( ) ) ;
@@ -1415,7 +1415,7 @@ impl<'db> SemanticsImpl<'db> {
1415
1415
pub fn resolve_method_call_fallback (
1416
1416
& self ,
1417
1417
call : & ast:: MethodCallExpr ,
1418
- ) -> Option < Either < Function , Field > > {
1418
+ ) -> Option < ( Either < Function , Field > , Option < GenericSubstitution > ) > {
1419
1419
self . analyze ( call. syntax ( ) ) ?. resolve_method_call_fallback ( self . db , call)
1420
1420
}
1421
1421
@@ -1458,18 +1458,33 @@ impl<'db> SemanticsImpl<'db> {
1458
1458
pub fn resolve_field_fallback (
1459
1459
& self ,
1460
1460
field : & ast:: FieldExpr ,
1461
- ) -> Option < Either < Either < Field , TupleField > , Function > > {
1461
+ ) -> Option < ( Either < Either < Field , TupleField > , Function > , Option < GenericSubstitution > ) > {
1462
1462
self . analyze ( field. syntax ( ) ) ?. resolve_field_fallback ( self . db , field)
1463
1463
}
1464
1464
1465
1465
pub fn resolve_record_field (
1466
1466
& self ,
1467
1467
field : & ast:: RecordExprField ,
1468
1468
) -> Option < ( Field , Option < Local > , Type ) > {
1469
+ self . resolve_record_field_with_substitution ( field)
1470
+ . map ( |( field, local, ty, _) | ( field, local, ty) )
1471
+ }
1472
+
1473
+ pub fn resolve_record_field_with_substitution (
1474
+ & self ,
1475
+ field : & ast:: RecordExprField ,
1476
+ ) -> Option < ( Field , Option < Local > , Type , GenericSubstitution ) > {
1469
1477
self . analyze ( field. syntax ( ) ) ?. resolve_record_field ( self . db , field)
1470
1478
}
1471
1479
1472
1480
pub fn resolve_record_pat_field ( & self , field : & ast:: RecordPatField ) -> Option < ( Field , Type ) > {
1481
+ self . resolve_record_pat_field_with_subst ( field) . map ( |( field, ty, _) | ( field, ty) )
1482
+ }
1483
+
1484
+ pub fn resolve_record_pat_field_with_subst (
1485
+ & self ,
1486
+ field : & ast:: RecordPatField ,
1487
+ ) -> Option < ( Field , Type , GenericSubstitution ) > {
1473
1488
self . analyze ( field. syntax ( ) ) ?. resolve_record_pat_field ( self . db , field)
1474
1489
}
1475
1490
@@ -1525,6 +1540,13 @@ impl<'db> SemanticsImpl<'db> {
1525
1540
}
1526
1541
1527
1542
pub fn resolve_path ( & self , path : & ast:: Path ) -> Option < PathResolution > {
1543
+ self . resolve_path_with_subst ( path) . map ( |( it, _) | it)
1544
+ }
1545
+
1546
+ pub fn resolve_path_with_subst (
1547
+ & self ,
1548
+ path : & ast:: Path ,
1549
+ ) -> Option < ( PathResolution , Option < GenericSubstitution > ) > {
1528
1550
self . analyze ( path. syntax ( ) ) ?. resolve_path ( self . db , path)
1529
1551
}
1530
1552
0 commit comments