Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clearly define
int
and uint
to fix unsoundness
This fixes the gap in the language definition causing #18726 by defining a clear bound on the maximum size for libraries to enforce. Closes #18069
- Loading branch information
1 parent
e09d986
commit 210e059
Showing
6 changed files
with
59 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
use std::mem::size_of; | ||
|
||
#[cfg(target_word_size = "32")] | ||
pub fn main() { | ||
assert_eq!(size_of::<[u8, ..(1 << 31) - 1]>(), (1 << 31) - 1); | ||
} | ||
|
||
#[cfg(target_word_size = "64")] | ||
pub fn main() { | ||
assert_eq!(size_of::<[u8, ..(1 << 47) - 1]>(), (1 << 47) - 1); | ||
} |
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from cmr
at https://github.com/thestinger/rust/commit/210e059750911193af87eb514da0517d6d122189
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging thestinger/rust/int = 210e059 into auto
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thestinger/rust/int = 210e059 merged ok, testing candidate = 133fffed
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some tests failed:
failure: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/2003
exception: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/2351
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/2349
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/2342
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/2349
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/2343
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/2342
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/2342
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/2346
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/2339
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/2338
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/2341
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/1999
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/2005
exception: http://buildbot.rust-lang.org/builders/auto-win-64-opt/builds/842
exception: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-t/builds/836
exception: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-c/builds/831
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from cmr
at https://github.com/thestinger/rust/commit/210e059750911193af87eb514da0517d6d122189
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging thestinger/rust/int = 210e059 into auto
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thestinger/rust/int = 210e059 merged ok, testing candidate = 56d20494
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some tests failed:
failure: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-c/builds/832
exception: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/2352
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/2350
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/2343
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/2350
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/2344
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/2343
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/2343
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/2347
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/2340
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/2339
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/2342
exception: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/2004
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/2000
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/2006
exception: http://buildbot.rust-lang.org/builders/auto-win-64-opt/builds/843
exception: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-t/builds/837
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from cmr
at https://github.com/thestinger/rust/commit/210e059750911193af87eb514da0517d6d122189
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging thestinger/rust/int = 210e059 into auto
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thestinger/rust/int = 210e059 merged ok, testing candidate = f5c1c9d8
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some tests failed:
failure: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/2005
exception: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/2353
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/2351
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/2344
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/2351
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/2345
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/2344
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/2344
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/2348
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/2341
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/2340
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/2343
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/2001
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/2007
exception: http://buildbot.rust-lang.org/builders/auto-win-64-opt/builds/844
exception: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-t/builds/838
exception: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-c/builds/833
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from cmr
at https://github.com/thestinger/rust/commit/210e059750911193af87eb514da0517d6d122189
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging thestinger/rust/int = 210e059 into auto
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thestinger/rust/int = 210e059 merged ok, testing candidate = 879918d4
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some tests failed:
failure: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/2007
exception: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/2355
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/2353
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/2346
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/2353
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/2347
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/2346
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/2346
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/2350
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/2343
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/2342
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/2345
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/2003
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/2009
exception: http://buildbot.rust-lang.org/builders/auto-win-64-opt/builds/846
exception: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-t/builds/840
exception: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-c/builds/835
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from cmr
at https://github.com/thestinger/rust/commit/210e059750911193af87eb514da0517d6d122189
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging thestinger/rust/int = 210e059 into auto
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thestinger/rust/int = 210e059 merged ok, testing candidate = a24b444
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/2359
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/2357
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/2350
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/2357
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/2351
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/2350
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/2350
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/2354
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/2347
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/2346
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/2349
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/2011
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/2007
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/2013
success: http://buildbot.rust-lang.org/builders/auto-win-64-opt/builds/850
success: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-t/builds/844
success: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-c/builds/839
210e059
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = a24b444