@@ -415,6 +415,7 @@ mod desc {
415415 pub const parse_gcc_ld: & str = "one of: no value, `lld`" ;
416416 pub const parse_link_self_contained: & str = "one of: `y`, `yes`, `on`, `n`, `no`, `off`, or a list of enabled (`+` prefix) and disabled (`-` prefix) \
417417 components: `crto`, `libc`, `unwind`, `linker`, `sanitizers`, `mingw`";
418+ pub const parse_polonius: & str = "either no value or `legacy` (the default), or `next`" ;
418419 pub const parse_stack_protector: & str =
419420 "one of (`none` (default), `basic`, `strong`, or `all`)" ;
420421 pub const parse_branch_protection: & str =
@@ -472,6 +473,21 @@ mod parse {
472473 }
473474 }
474475
476+ /// Parses whether polonius is enabled, and if so, which version.
477+ pub ( crate ) fn parse_polonius ( slot : & mut Polonius , v : Option < & str > ) -> bool {
478+ match v {
479+ Some ( "legacy" ) | None => {
480+ * slot = Polonius :: Legacy ;
481+ true
482+ }
483+ Some ( "next" ) => {
484+ * slot = Polonius :: Next ;
485+ true
486+ }
487+ _ => false ,
488+ }
489+ }
490+
475491 /// Use this for any string option that has a static default.
476492 pub ( crate ) fn parse_string ( slot : & mut String , v : Option < & str > ) -> bool {
477493 match v {
@@ -1669,7 +1685,7 @@ options! {
16691685 "whether to use the PLT when calling into shared libraries;
16701686 only has effect for PIC code on systems with ELF binaries
16711687 (default: PLT is disabled if full relro is enabled on x86_64)" ) ,
1672- polonius: bool = ( false , parse_bool , [ TRACKED ] ,
1688+ polonius: Polonius = ( Polonius :: default ( ) , parse_polonius , [ TRACKED ] ,
16731689 "enable polonius-based borrow-checker (default: no)" ) ,
16741690 polymorphize: bool = ( false , parse_bool, [ TRACKED ] ,
16751691 "perform polymorphization analysis" ) ,
0 commit comments