@@ -104,15 +104,45 @@ pub struct StructFlags {
104
104
}
105
105
106
106
#[ derive( Clone , Debug , PartialEq , Eq , Hash ) ]
107
+ /// A rust intermediate represention (rust_ir) of a function definition/declaration.
108
+ /// For example, in the following rust code:
109
+ ///
110
+ /// ```rust
111
+ /// fn foo<T>() -> i32 where T: Eq;
112
+ /// ```
113
+ ///
114
+ /// This would represent the declaration of `foo`.
115
+ ///
116
+ /// Note this is distinct from a function pointer, which points to
117
+ /// a function with a given type signature, whereas this represents
118
+ /// a specific function definition.
107
119
pub struct FnDefDatum < I : Interner > {
108
120
pub id : FnDefId < I > ,
109
121
pub binders : Binders < FnDefDatumBound < I > > ,
110
122
}
111
123
112
124
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Fold , HasInterner ) ]
125
+ /// Represents the bounds on a `FnDefDatum`, including
126
+ /// the function definition's type signature and where clauses.
113
127
pub struct FnDefDatumBound < I : Interner > {
128
+ /// Types of the function's arguments
129
+ /// ```
130
+ /// fn foo<T>(bar: i32, baz: T);
131
+ /// ^^^ ^
132
+ /// ```
133
+ ///
114
134
pub argument_types : Vec < Ty < I > > ,
135
+ /// Return type of the function
136
+ /// ```ignore
137
+ /// fn foo<T>() -> i32;
138
+ /// ^^^
139
+ /// ```
115
140
pub return_type : Ty < I > ,
141
+ /// Where clauses defined on the function
142
+ /// ```ignore
143
+ /// fn foo<T>() where T: Eq;
144
+ /// ^^^^^^^^^^^
145
+ /// ```
116
146
pub where_clauses : Vec < QuantifiedWhereClause < I > > ,
117
147
}
118
148
0 commit comments