@@ -55,6 +55,7 @@ impl TestMode {
5555
5656// Note that coverage tests use the same test files for multiple test modes. 
5757string_enum !  { 
58+     no_from_str, 
5859    #[ derive( Clone ,  Copy ,  PartialEq ,  Debug ) ] 
5960    pub  enum  TestSuite  { 
6061        Assembly  => "assembly" , 
@@ -79,6 +80,42 @@ string_enum! {
7980    } 
8081} 
8182
83+ impl  :: std:: str:: FromStr  for  TestSuite  { 
84+     type  Err  = String ; 
85+ 
86+     fn  from_str ( s :  & str )  -> Result < Self ,  Self :: Err >  { 
87+         Ok ( match  s { 
88+             "codegen-units"  => Self :: CodegenUnits , 
89+             "coverage"  => Self :: Coverage , 
90+             "coverage-run-rustdoc"  => Self :: CoverageRunRustdoc , 
91+             "crashes"  => Self :: Crashes , 
92+             "debuginfo"  => Self :: Debuginfo , 
93+             "incremental"  => Self :: Incremental , 
94+             "mir-opt"  => Self :: MirOpt , 
95+             "pretty"  => Self :: Pretty , 
96+             "run-make"  => Self :: RunMake , 
97+             "rustdoc"  => Self :: Rustdoc , 
98+             "rustdoc-gui"  => Self :: RustdocGui , 
99+             "rustdoc-js"  => Self :: RustdocJs , 
100+             "rustdoc-js-std"  => Self :: RustdocJsStd , 
101+             "rustdoc-json"  => Self :: RustdocJson , 
102+             "rustdoc-ui"  => Self :: RustdocUi , 
103+             "ui"  => Self :: Ui , 
104+             "ui-fulldeps"  => Self :: UiFullDeps , 
105+             s => { 
106+                 if  let  Some ( ( test_suite @ ( "assembly"  | "codegen" ) ,  codegen_backend) )  =
107+                     s. split_once ( '-' ) 
108+                     && CodegenBackend :: try_from ( codegen_backend) . is_ok ( ) 
109+                 { 
110+                     if  test_suite == "assembly"  {  Self :: Assembly  }  else  {  Self :: Codegen  } 
111+                 }  else  { 
112+                     return  Err ( format ! ( "unknown `TestSuite` variant: `{s}`" ) ) ; 
113+                 } 
114+             } 
115+         } ) 
116+     } 
117+ } 
118+ 
82119string_enum !  { 
83120    #[ derive( Clone ,  Copy ,  PartialEq ,  Debug ,  Hash ) ] 
84121    pub  enum  PassMode  { 
0 commit comments