@@ -69,7 +69,7 @@ impl<'ast> TryEnum<'ast> {
6969 Some ( OutputType :: Ref { lifetime, .. } ) => {
7070 format ! ( "change this to (&{lifetime} {first_generic_type})" )
7171 }
72- Some ( OutputType :: Contained { ..} ) => todo ! ( "74" )
72+ Some ( OutputType :: Contained { .. } ) => todo ! ( "74" ) ,
7373 } ;
7474 error ( "Try requires a single generic type for `Output`" )
7575 // TODO: Check that multiline enum defs show whole def in help
@@ -132,7 +132,7 @@ impl<'ast> TryEnum<'ast> {
132132 #enum_name:: #var_name( never) => * never,
133133 } )
134134 }
135- OutputType :: Contained { .. } => todo ! ( "137" )
135+ OutputType :: Contained { .. } => todo ! ( "137" ) ,
136136 } ;
137137 ( branch_arm, residual_arm)
138138 }
@@ -316,6 +316,33 @@ impl<'ast> TryFrom<(&'ast Type, &'ast Ident)> for OutputType<'ast> {
316316 ty,
317317 } )
318318 }
319+ Type :: Path ( type_path) => {
320+ let last_segment = type_path
321+ . path
322+ . segments
323+ . last ( )
324+ . expect ( "path has at least one segment" ) ;
325+ if let PathArguments :: AngleBracketed ( args) = & last_segment. arguments
326+ && args. args . len ( ) == 1
327+ && let GenericArgument :: Type ( generic_type) =
328+ args. args . first ( ) . expect ( "args.args.len() == 1" )
329+ {
330+ let container = type_path;
331+ let name = checked_name ( generic_type) . ok_or_else ( || {
332+ base_error ( ) . add_help (
333+ generic_type. span ( ) ,
334+ format_args ! ( "change this to {first_generic_type}" ) ,
335+ )
336+ } ) ?;
337+ Result :: Ok ( Self :: Contained {
338+ name,
339+ container,
340+ ty,
341+ } )
342+ } else {
343+ todo ! ( "Very wrong path, or too many generics" )
344+ }
345+ }
319346 Type :: Reference ( tr) => {
320347 let lifetime = tr
321348 . lifetime
0 commit comments