@@ -99,26 +99,26 @@ impl<'tcx> ClosureKind {
9999 self <= other
100100 }
101101
102- /// Returns the representative scalar type for this closure kind.
103- /// See `Ty::to_opt_closure_kind` for more details.
104- pub fn to_ty ( self , tcx : TyCtxt < ' tcx > ) -> Ty < ' tcx > {
105- match self {
106- ClosureKind :: Fn => tcx. types . i8 ,
107- ClosureKind :: FnMut => tcx. types . i16 ,
108- ClosureKind :: FnOnce => tcx. types . i32 ,
109- }
110- }
111-
112102 /// Converts `self` to a [`DefId`] of the corresponding trait.
113103 ///
114- /// Note: the inverse of this function is [`TyCtxt::fn_trait_kind_from_def_id`]
104+ /// Note: the inverse of this function is [`TyCtxt::fn_trait_kind_from_def_id`].
115105 pub fn to_def_id ( & self , tcx : TyCtxt < ' _ > ) -> DefId {
116106 match self {
117107 ClosureKind :: Fn => tcx. lang_items ( ) . fn_once_trait ( ) . unwrap ( ) ,
118108 ClosureKind :: FnMut => tcx. lang_items ( ) . fn_mut_trait ( ) . unwrap ( ) ,
119109 ClosureKind :: FnOnce => tcx. lang_items ( ) . fn_trait ( ) . unwrap ( ) ,
120110 }
121111 }
112+
113+ /// Returns the representative scalar type for this closure kind.
114+ /// See `Ty::to_opt_closure_kind` for more details.
115+ pub fn to_ty ( self , tcx : TyCtxt < ' tcx > ) -> Ty < ' tcx > {
116+ match self {
117+ ClosureKind :: Fn => tcx. types . i8 ,
118+ ClosureKind :: FnMut => tcx. types . i16 ,
119+ ClosureKind :: FnOnce => tcx. types . i32 ,
120+ }
121+ }
122122}
123123
124124/// A composite describing a `Place` that is captured by a closure.
0 commit comments