@@ -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 ( ( ) ) ;
@@ -1413,7 +1413,7 @@ impl<'db> SemanticsImpl<'db> {
1413
1413
pub fn resolve_method_call_fallback (
1414
1414
& self ,
1415
1415
call : & ast:: MethodCallExpr ,
1416
- ) -> Option < Either < Function , Field > > {
1416
+ ) -> Option < ( Either < Function , Field > , Option < GenericSubstitution > ) > {
1417
1417
self . analyze ( call. syntax ( ) ) ?. resolve_method_call_fallback ( self . db , call)
1418
1418
}
1419
1419
@@ -1456,18 +1456,33 @@ impl<'db> SemanticsImpl<'db> {
1456
1456
pub fn resolve_field_fallback (
1457
1457
& self ,
1458
1458
field : & ast:: FieldExpr ,
1459
- ) -> Option < Either < Either < Field , TupleField > , Function > > {
1459
+ ) -> Option < ( Either < Either < Field , TupleField > , Function > , Option < GenericSubstitution > ) > {
1460
1460
self . analyze ( field. syntax ( ) ) ?. resolve_field_fallback ( self . db , field)
1461
1461
}
1462
1462
1463
1463
pub fn resolve_record_field (
1464
1464
& self ,
1465
1465
field : & ast:: RecordExprField ,
1466
1466
) -> Option < ( Field , Option < Local > , Type ) > {
1467
+ self . resolve_record_field_with_substitution ( field)
1468
+ . map ( |( field, local, ty, _) | ( field, local, ty) )
1469
+ }
1470
+
1471
+ pub fn resolve_record_field_with_substitution (
1472
+ & self ,
1473
+ field : & ast:: RecordExprField ,
1474
+ ) -> Option < ( Field , Option < Local > , Type , GenericSubstitution ) > {
1467
1475
self . analyze ( field. syntax ( ) ) ?. resolve_record_field ( self . db , field)
1468
1476
}
1469
1477
1470
1478
pub fn resolve_record_pat_field ( & self , field : & ast:: RecordPatField ) -> Option < ( Field , Type ) > {
1479
+ self . resolve_record_pat_field_with_subst ( field) . map ( |( field, ty, _) | ( field, ty) )
1480
+ }
1481
+
1482
+ pub fn resolve_record_pat_field_with_subst (
1483
+ & self ,
1484
+ field : & ast:: RecordPatField ,
1485
+ ) -> Option < ( Field , Type , GenericSubstitution ) > {
1471
1486
self . analyze ( field. syntax ( ) ) ?. resolve_record_pat_field ( self . db , field)
1472
1487
}
1473
1488
@@ -1523,6 +1538,13 @@ impl<'db> SemanticsImpl<'db> {
1523
1538
}
1524
1539
1525
1540
pub fn resolve_path ( & self , path : & ast:: Path ) -> Option < PathResolution > {
1541
+ self . resolve_path_with_subst ( path) . map ( |( it, _) | it)
1542
+ }
1543
+
1544
+ pub fn resolve_path_with_subst (
1545
+ & self ,
1546
+ path : & ast:: Path ,
1547
+ ) -> Option < ( PathResolution , Option < GenericSubstitution > ) > {
1526
1548
self . analyze ( path. syntax ( ) ) ?. resolve_path ( self . db , path)
1527
1549
}
1528
1550
0 commit comments