@@ -720,6 +720,7 @@ mod desc {
720720 pub ( crate ) const parse_list_with_polarity: & str =
721721 "a comma-separated list of strings, with elements beginning with + or -" ;
722722 pub ( crate ) const parse_autodiff: & str = "a comma separated list of settings: `Enable`, `PrintSteps`, `PrintTA`, `PrintAA`, `PrintPerf`, `PrintModBefore`, `PrintModAfter`, `PrintModFinal`, `PrintPasses`, `NoPostopt`, `LooseTypes`, `Inline`" ;
723+ pub ( crate ) const parse_offload: & str = "a comma separated list of settings: `Enable`" ;
723724 pub ( crate ) const parse_comma_list: & str = "a comma-separated list of strings" ;
724725 pub ( crate ) const parse_opt_comma_list: & str = parse_comma_list;
725726 pub ( crate ) const parse_number: & str = "a number" ;
@@ -1351,6 +1352,27 @@ pub mod parse {
13511352 }
13521353 }
13531354
1355+ pub ( crate ) fn parse_offload ( slot : & mut Vec < Offload > , v : Option < & str > ) -> bool {
1356+ let Some ( v) = v else {
1357+ * slot = vec ! [ ] ;
1358+ return true ;
1359+ } ;
1360+ let mut v: Vec < & str > = v. split ( "," ) . collect ( ) ;
1361+ v. sort_unstable ( ) ;
1362+ for & val in v. iter ( ) {
1363+ let variant = match val {
1364+ "Enable" => Offload :: Enable ,
1365+ _ => {
1366+ // FIXME(ZuseZ4): print an error saying which value is not recognized
1367+ return false ;
1368+ }
1369+ } ;
1370+ slot. push ( variant) ;
1371+ }
1372+
1373+ true
1374+ }
1375+
13541376 pub ( crate ) fn parse_autodiff ( slot : & mut Vec < AutoDiff > , v : Option < & str > ) -> bool {
13551377 let Some ( v) = v else {
13561378 * slot = vec ! [ ] ;
@@ -2378,6 +2400,11 @@ options! {
23782400 "do not use unique names for text and data sections when -Z function-sections is used" ) ,
23792401 normalize_docs: bool = ( false , parse_bool, [ TRACKED ] ,
23802402 "normalize associated items in rustdoc when generating documentation" ) ,
2403+ offload: Vec <crate :: config:: Offload > = ( Vec :: new( ) , parse_offload, [ TRACKED ] ,
2404+ "a list of offload flags to enable
2405+ Mandatory setting:
2406+ `=Enable`
2407+ Currently the only option available" ) ,
23812408 on_broken_pipe: OnBrokenPipe = ( OnBrokenPipe :: Default , parse_on_broken_pipe, [ TRACKED ] ,
23822409 "behavior of std::io::ErrorKind::BrokenPipe (SIGPIPE)" ) ,
23832410 oom: OomStrategy = ( OomStrategy :: Abort , parse_oom_strategy, [ TRACKED ] ,
0 commit comments