about summary refs log tree commit diff
path: root/compiler/rustc_session
diff options
context:
space:
mode:
authorJamie Cunliffe <Jamie.Cunliffe@arm.com>2021-12-01 15:56:59 +0000
committerJamie Cunliffe <Jamie.Cunliffe@arm.com>2021-12-01 15:56:59 +0000
commit984ca4689dbceea29bbfcf54c4743b45fccf7ad1 (patch)
tree50e979ae7eed117e44f6bce9a82003fe0270f51c /compiler/rustc_session
parent837cc1687f7c0d35a4e90a2f6bee377b5a2ecfd5 (diff)
downloadrust-984ca4689dbceea29bbfcf54c4743b45fccf7ad1.tar.gz
rust-984ca4689dbceea29bbfcf54c4743b45fccf7ad1.zip
Review comments
- Changed the separator from '+' to ','.
- Moved the branch protection options from -C to -Z.
- Additional test for incorrect branch-protection option.
- Remove LLVM < 12 code.
- Style fixes.

Co-authored-by: James McGregor <james.mcgregor2@arm.com>
Diffstat (limited to 'compiler/rustc_session')
-rw-r--r--compiler/rustc_session/src/options.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs
index 03ce0cc42cd..d3ffae36c67 100644
--- a/compiler/rustc_session/src/options.rs
+++ b/compiler/rustc_session/src/options.rs
@@ -390,7 +390,7 @@ mod desc {
     pub const parse_stack_protector: &str =
         "one of (`none` (default), `basic`, `strong`, or `all`)";
     pub const parse_branch_protection: &str =
-        "a `+` separated combination of `bti`, `b-key`, `pac-ret`, or `leaf`";
+        "a `,` separated combination of `bti`, `b-key`, `pac-ret`, or `leaf`";
 }
 
 mod parse {
@@ -935,7 +935,7 @@ mod parse {
     crate fn parse_branch_protection(slot: &mut BranchProtection, v: Option<&str>) -> bool {
         match v {
             Some(s) => {
-                for opt in s.split('+') {
+                for opt in s.split(',') {
                     match opt {
                         "bti" => slot.bti = true,
                         "pac-ret" if slot.pac_ret.is_none() => {
@@ -953,7 +953,6 @@ mod parse {
                     };
                 }
             }
-
             _ => return false,
         }
         true
@@ -971,8 +970,6 @@ options! {
 
     ar: String = (String::new(), parse_string, [UNTRACKED],
         "this option is deprecated and does nothing"),
-    branch_protection: BranchProtection = (BranchProtection::default(), parse_branch_protection, [TRACKED],
-        "set options for branch target identification and pointer authentication on AArch64"),
     code_model: Option<CodeModel> = (None, parse_code_model, [TRACKED],
         "choose the code model to use (`rustc --print code-models` for details)"),
     codegen_units: Option<usize> = (None, parse_opt_number, [UNTRACKED],
@@ -1101,6 +1098,8 @@ options! {
         (default: no)"),
     borrowck: String = ("migrate".to_string(), parse_string, [UNTRACKED],
         "select which borrowck is used (`mir` or `migrate`) (default: `migrate`)"),
+    branch_protection: BranchProtection = (BranchProtection::default(), parse_branch_protection, [TRACKED],
+        "set options for branch target identification and pointer authentication on AArch64"),
     cgu_partitioning_strategy: Option<String> = (None, parse_opt_string, [TRACKED],
         "the codegen unit partitioning strategy to use"),
     chalk: bool = (false, parse_bool, [TRACKED],