]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/attr.rs
Reduce the maximum alignment to repr(align(1 << 29))
[rust.git] / src / libsyntax / attr.rs
index f0557277267a519a5f10d5f2415a549e3e8e608f..13f8bb9a31831afbd3c31e9459dd318247b1bfb9 100644 (file)
@@ -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")