Skip to content

Commit 484cf80

Browse files
committed
Add binder for inputs/outputs of FnDef
1 parent 656be2d commit 484cf80

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

chalk-integration/src/lowering.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,10 +1030,15 @@ impl LowerFnDefn for FnDefn {
10301030
let where_clauses = self.lower_where_clauses(env)?;
10311031
let return_type = self.return_type.lower(env)?;
10321032

1033+
let inputs_and_output = env.in_binders(vec![], |_| {
1034+
Ok(rust_ir::FnDefInputsAndOutputDatum {
1035+
argument_types: args?,
1036+
return_type,
1037+
})
1038+
})?;
10331039
Ok(rust_ir::FnDefDatumBound {
1034-
argument_types: args?,
1040+
inputs_and_output,
10351041
where_clauses,
1036-
return_type,
10371042
})
10381043
})?;
10391044

chalk-solve/src/rust_ir.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ pub struct FnDefDatum<I: Interner> {
121121
pub binders: Binders<FnDefDatumBound<I>>,
122122
}
123123

124+
/// Represents the inputs and outputs on a `FnDefDatum`. This is split
125+
/// from the where clauses, since these can contain bound lifetimes.
124126
#[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> {
128128
/// Types of the function's arguments
129129
/// ```ignore
130130
/// fn foo<T>(bar: i32, baz: T);
@@ -138,6 +138,15 @@ pub struct FnDefDatumBound<I: Interner> {
138138
/// ^^^
139139
/// ```
140140
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+
pub inputs_and_output: Binders<FnDefInputsAndOutputDatum<I>>,
149+
141150
/// Where clauses defined on the function
142151
/// ```ignore
143152
/// fn foo<T>() where T: Eq;

0 commit comments

Comments
 (0)