Point out custom Fn-family trait impl
This commit is contained in:
parent
ddb7003b79
commit
d25abdc0c5
3 changed files with 114 additions and 53 deletions
|
@ -128,6 +128,14 @@ impl<'tcx> ClosureKind {
|
|||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_def_id(&self, tcx: TyCtxt<'_>) -> DefId {
|
||||
match self {
|
||||
ClosureKind::Fn => tcx.lang_items().fn_once_trait().unwrap(),
|
||||
ClosureKind::FnMut => tcx.lang_items().fn_mut_trait().unwrap(),
|
||||
ClosureKind::FnOnce => tcx.lang_items().fn_trait().unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A composite describing a `Place` that is captured by a closure.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue