@@ -121,10 +121,10 @@ pub struct FnDefDatum<I: Interner> {
121
121
pub binders : Binders < FnDefDatumBound < I > > ,
122
122
}
123
123
124
+ /// Represents the inputs and outputs on a `FnDefDatum`. This is split
125
+ /// from the where clauses, since these can contain bound lifetimes.
124
126
#[ 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.
127
- pub struct FnDefDatumBound < I : Interner > {
127
+ pub struct FnDefInputsAndOutputDatum < I : Interner > {
128
128
/// Types of the function's arguments
129
129
/// ```ignore
130
130
/// fn foo<T>(bar: i32, baz: T);
@@ -138,6 +138,26 @@ pub struct FnDefDatumBound<I: Interner> {
138
138
/// ^^^
139
139
/// ```
140
140
pub return_type : Ty < I > ,
141
+ }
142
+
143
+ #[ derive( Clone , Debug , PartialEq , Eq , Hash , Fold , HasInterner ) ]
144
+ /// Represents the bounds on a `FnDefDatum`, including
145
+ /// the function definition's type signature and where clauses.
146
+ pub struct FnDefDatumBound < I : Interner > {
147
+ /// Inputs and outputs defined on a function
148
+ /// These are needed for late-bound regions in rustc. For example the
149
+ /// lifetime `'a` in
150
+ /// ```ignore
151
+ /// fn foo<'a, T>(&'a T);
152
+ /// ^^
153
+ /// ```
154
+ /// Rustc doesn't pass in late-bound the regions in substs, but the inputs
155
+ /// and outputs may use them. `where_clauses` don't need an extra set of
156
+ /// `Binders`, since any lifetimes found in where clauses are not late-bound.
157
+ ///
158
+ /// For more information, see [this rustc-dev-guide chapter](https://rustc-dev-guide.rust-lang.org/early-late-bound.html).
159
+ pub inputs_and_output : Binders < FnDefInputsAndOutputDatum < I > > ,
160
+
141
161
/// Where clauses defined on the function
142
162
/// ```ignore
143
163
/// fn foo<T>() where T: Eq;
0 commit comments