about summary refs log tree commit diff
path: root/compiler/rustc_session/src/options.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-01-11 18:01:44 +0000
committerbors <bors@rust-lang.org>2025-01-11 18:01:44 +0000
commiteb54a50837ad4bcc9842924f27e7287ca66e294c (patch)
treea8dc0d72c151ef4dbf4505e246fe35938f344b4d /compiler/rustc_session/src/options.rs
parentfb65a3ee576feab95a632eb062f466d7a0342310 (diff)
parent076c047fe1f18eb8e396b8f2b27ed258393e6f0f (diff)
downloadrust-eb54a50837ad4bcc9842924f27e7287ca66e294c.tar.gz
rust-eb54a50837ad4bcc9842924f27e7287ca66e294c.zip
Auto merge of #135370 - matthiaskrgr:rollup-g2w6d5n, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #134030 (add `-Zmin-function-alignment`)
 - #134776 (Avoid ICE: Account for `for<'a>` types when checking for non-structural type in constant as pattern)
 - #135205 (Rename `BitSet` to `DenseBitSet`)
 - #135314 (Eagerly collect mono items for non-generic closures)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_session/src/options.rs')
-rw-r--r--compiler/rustc_session/src/options.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs
index c1fba4c513d..3af6df63017 100644
--- a/compiler/rustc_session/src/options.rs
+++ b/compiler/rustc_session/src/options.rs
@@ -4,6 +4,7 @@ use std::num::{IntErrorKind, NonZero};
 use std::path::PathBuf;
 use std::str;
 
+use rustc_abi::Align;
 use rustc_data_structures::fx::FxIndexMap;
 use rustc_data_structures::profiling::TimePassesFormat;
 use rustc_data_structures::stable_hasher::Hash64;
@@ -482,6 +483,7 @@ mod desc {
     pub(crate) const parse_wasm_c_abi: &str = "`legacy` or `spec`";
     pub(crate) const parse_mir_include_spans: &str =
         "either a boolean (`yes`, `no`, `on`, `off`, etc), or `nll` (default: `nll`)";
+    pub(crate) const parse_align: &str = "a number that is a power of 2 between 1 and 2^29";
 }
 
 pub mod parse {
@@ -1561,6 +1563,21 @@ pub mod parse {
 
         true
     }
+
+    pub(crate) fn parse_align(slot: &mut Option<Align>, v: Option<&str>) -> bool {
+        let mut bytes = 0u64;
+        if !parse_number(&mut bytes, v) {
+            return false;
+        }
+
+        let Ok(align) = Align::from_bytes(bytes) else {
+            return false;
+        };
+
+        *slot = Some(align);
+
+        true
+    }
 }
 
 options! {
@@ -1921,6 +1938,8 @@ options! {
         "gather metadata statistics (default: no)"),
     metrics_dir: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED],
         "the directory metrics emitted by rustc are dumped into (implicitly enables default set of metrics)"),
+    min_function_alignment: Option<Align> = (None, parse_align, [TRACKED],
+        "align all functions to at least this many bytes. Must be a power of 2"),
     mir_emit_retag: bool = (false, parse_bool, [TRACKED],
         "emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 \
         (default: no)"),