@@ -415,6 +415,7 @@ mod desc {
415
415
pub const parse_gcc_ld: & str = "one of: no value, `lld`" ;
416
416
pub const parse_link_self_contained: & str = "one of: `y`, `yes`, `on`, `n`, `no`, `off`, or a list of enabled (`+` prefix) and disabled (`-` prefix) \
417
417
components: `crto`, `libc`, `unwind`, `linker`, `sanitizers`, `mingw`";
418
+ pub const parse_polonius: & str = "either no value or `legacy` (the default), or `next`" ;
418
419
pub const parse_stack_protector: & str =
419
420
"one of (`none` (default), `basic`, `strong`, or `all`)" ;
420
421
pub const parse_branch_protection: & str =
@@ -472,6 +473,21 @@ mod parse {
472
473
}
473
474
}
474
475
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
+
475
491
/// Use this for any string option that has a static default.
476
492
pub ( crate ) fn parse_string ( slot : & mut String , v : Option < & str > ) -> bool {
477
493
match v {
@@ -1669,7 +1685,7 @@ options! {
1669
1685
"whether to use the PLT when calling into shared libraries;
1670
1686
only has effect for PIC code on systems with ELF binaries
1671
1687
(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 ] ,
1673
1689
"enable polonius-based borrow-checker (default: no)" ) ,
1674
1690
polymorphize: bool = ( false , parse_bool, [ TRACKED ] ,
1675
1691
"perform polymorphization analysis" ) ,
0 commit comments