about summary refs log tree commit diff
path: root/src/libsyntax/attr.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-05-03 05:38:11 +0000
committerbors <bors@rust-lang.org>2018-05-03 05:38:11 +0000
commit427c5487493fbd5e96e81b7d3ba54784e0805df7 (patch)
tree6183280d82aae03bb9f5129ff3c4774ce3b7de60 /src/libsyntax/attr.rs
parent9e3cbbb60a2a00a5fcce8c150c3e8fe5f3209e26 (diff)
parentcd2f5f7d977936c409f4bec28075c8918e239f4c (diff)
downloadrust-427c5487493fbd5e96e81b7d3ba54784e0805df7.tar.gz
rust-427c5487493fbd5e96e81b7d3ba54784e0805df7.zip
Auto merge of #50378 - varkor:repr-align-max-29, r=eddyb
Reduce maximum repr(align(N)) to 2^29

The current maximum `repr(align(N))` alignment is larger than the maximum alignment accepted by LLVM, which can cause issues for huge values of `N`, as seen in #49492. Fixes #49492.

r? @rkruppe
Diffstat (limited to 'src/libsyntax/attr.rs')
-rw-r--r--src/libsyntax/attr.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index f0557277267..13f8bb9a318 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -1012,11 +1012,11 @@ pub fn find_repr_attrs(diagnostic: &Handler, attr: &Attribute) -> Vec<ReprAttr>
                     let parse_alignment = |node: &ast::LitKind| -> Result<u32, &'static str> {
                         if let ast::LitKind::Int(literal, ast::LitIntType::Unsuffixed) = node {
                             if literal.is_power_of_two() {
-                                // rustc::ty::layout::Align restricts align to <= 2147483647
-                                if *literal <= 2147483647 {
+                                // rustc::ty::layout::Align restricts align to <= 2^29
+                                if *literal <= 1 << 29 {
                                     Ok(*literal as u32)
                                 } else {
-                                    Err("larger than 2147483647")
+                                    Err("larger than 2^29")
                                 }
                             } else {
                                 Err("not a power of two")