diff options
| author | bors <bors@rust-lang.org> | 2018-05-03 05:38:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-05-03 05:38:11 +0000 |
| commit | 427c5487493fbd5e96e81b7d3ba54784e0805df7 (patch) | |
| tree | 6183280d82aae03bb9f5129ff3c4774ce3b7de60 /src/libsyntax/attr.rs | |
| parent | 9e3cbbb60a2a00a5fcce8c150c3e8fe5f3209e26 (diff) | |
| parent | cd2f5f7d977936c409f4bec28075c8918e239f4c (diff) | |
| download | rust-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.rs | 6 |
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") |
