-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always error on SizeOverflow
during mir evaluation
#63152
Merged
Merged
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
83b5eb9
Always error on `SizeOverflow` during mir evaluation
estebank 58bd878
Do not lint on SizeOverflow, always error
estebank d3da411
Nicer labels for type layout errors
estebank 2c56842
avoid mutable state and override main message
estebank db099fb
Point to local place span on "type too big" error
estebank 2340067
Simplify change to layout_of
estebank 387dcff
review comments: clean up
estebank bdd79b8
tweak output and tests
estebank f621f89
revert change to single test
estebank ce8510a
fix tests
estebank 613c0a8
move error with diverging output to compile-fail
estebank 64469ac
review comments
estebank 3144b0a
review comment: reword test comment
estebank File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
File renamed without changes.
File renamed without changes.
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,7 @@ | ||
// normalize-stderr-64bit "18446744073709551615" -> "SIZE" | ||
// normalize-stderr-32bit "4294967295" -> "SIZE" | ||
|
||
// error-pattern: is too big for the current architecture | ||
fn main() { | ||
println!("Size: {}", std::mem::size_of::<[u8; std::u64::MAX as usize]>()); | ||
} | ||
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,11 @@ | ||
// ignore-32bit | ||
|
||
// FIXME https://github.com/rust-lang/rust/issues/59774 | ||
// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" | ||
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" | ||
#![allow(exceeding_bitshifts)] | ||
|
||
fn main() { | ||
let _fat: [u8; (1<<61)+(1<<31)] = //~ ERROR too big for the current architecture | ||
[0; (1u64<<61) as usize +(1u64<<31) as usize]; | ||
} |
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,8 @@ | ||
error: the type `[u8; 2305843011361177600]` is too big for the current architecture | ||
--> $DIR/huge-array-simple-32.rs:9:9 | ||
| | ||
LL | let _fat: [u8; (1<<61)+(1<<31)] = | ||
| ^^^^ | ||
|
||
error: aborting due to previous error | ||
|
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,11 @@ | ||
// ignore-64bit | ||
estebank marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// FIXME https://github.com/rust-lang/rust/issues/59774 | ||
// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" | ||
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" | ||
#![allow(exceeding_bitshifts)] | ||
|
||
fn main() { | ||
let _fat: [u8; (1<<31)+(1<<15)] = //~ ERROR too big for the current architecture | ||
[0; (1u32<<31) as usize +(1u32<<15) as usize]; | ||
} |
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,8 @@ | ||
error: the type `[u8; 2147516416]` is too big for the current architecture | ||
--> $DIR/huge-array-simple-64.rs:9:9 | ||
| | ||
LL | let _fat: [u8; (1<<31)+(1<<15)] = | ||
| ^^^^ | ||
|
||
error: aborting due to previous error | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
error: the type `[[u8; 1518599999]; 1518600000]` is too big for the current architecture | ||
--> $DIR/huge-array.rs:6:9 | ||
| | ||
LL | let s: [T; 1518600000] = [t; 1518600000]; | ||
| ^ | ||
|
||
error: aborting due to previous error | ||
|
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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
error: the type `TYPE` is too big for the current architecture | ||
--> $DIR/huge-enum.rs:15:9 | ||
| | ||
LL | let big: BIG = None; | ||
| ^^^ | ||
|
||
error: aborting due to previous error | ||
|
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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
error: the type `SXX<SXX<SXX<u32>>>` is too big for the current architecture | ||
--> $DIR/huge-struct.rs:49:9 | ||
| | ||
LL | let fat: Option<SXX<SXX<SXX<u32>>>> = None; | ||
| ^^^ | ||
|
||
error: aborting due to previous error | ||
|
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,9 @@ | ||
// ignore-64bit | ||
|
||
// FIXME https://github.com/rust-lang/rust/issues/59774 | ||
// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" | ||
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" | ||
|
||
fn main() { | ||
let x = [0usize; 0xffff_ffff]; //~ ERROR too big | ||
} |
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,8 @@ | ||
error: the type `[usize; 4294967295]` is too big for the current architecture | ||
--> $DIR/issue-15919-32.rs:8:9 | ||
| | ||
LL | let x = [0usize; 0xffff_ffff]; | ||
| ^ | ||
|
||
error: aborting due to previous error | ||
|
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,9 @@ | ||
// ignore-32bit | ||
|
||
// FIXME https://github.com/rust-lang/rust/issues/59774 | ||
// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" | ||
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" | ||
|
||
fn main() { | ||
let x = [0usize; 0xffff_ffff_ffff_ffff]; //~ ERROR too big | ||
} |
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,8 @@ | ||
error: the type `[usize; 18446744073709551615]` is too big for the current architecture | ||
estebank marked this conversation as resolved.
Show resolved
Hide resolved
|
||
--> $DIR/issue-15919-64.rs:8:9 | ||
| | ||
LL | let x = [0usize; 0xffff_ffff_ffff_ffff]; | ||
| ^ | ||
|
||
error: aborting due to previous error | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What is the error here for 32bit vs 64bit, that this cannot be handled by normalization?
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.
Missing a span from (at least) one specific target that is present in others:
vs
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.
That's extremely odd, isn't it?
Normalization could still handle this -- or you use the two-test-cases approach with
ignore-32bit
andignore-64bit
? AFAIKcompile-fail
is on the way out.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.
The divergence is not due to 32bit vs 64bit, it's because the
dist-i586-gnu-i586-i686-musl
rustc
seems to be packaged slightly different than the other targets, so we misscore
andstd
information to point spans to. Adding this info was a relatively recent improvement from the last year.I agree that
compile-fail
should be discouraged, but short of waiting for us to fix the packaging issue I don't see a good solution to this.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.
Oh I see.
Is it possible to ignore musl targets, or so?
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.
It is but I have no way of knowing a priori wether this is a
musl
-only discrepancy or not.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.
I'm not super happy about adding more compile-fail tests, but oh well... :)