-
Notifications
You must be signed in to change notification settings - Fork 385
Fix a couple of compile-fail tests #376
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
Conversation
@@ -1,17 +0,0 @@ | |||
// This should fail even without validation |
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.
This causes an ICE
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 a bug, isn't it? Why remove the test?
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 causes an ICE in rustc during compilation, not miri: http://play.integer32.com/?gist=76ba0e33563d046120e629846294f4a8&version=nightly&mode=debug
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.
still... ignoring it for now is better so we can add it once upstream fixes it
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.
Ah, I see.
Is this reported upstream? The ignore-test comment should link to the issue.
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.
@@ -1,16 +0,0 @@ | |||
#![feature(alloc, allocator_api)] |
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.
This is simply not possible with the new api
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.
How so? What's changed?
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.
realloc
doesn't have a new alignment param anymore.
unsafe fn realloc(
&self,
ptr: *mut Opaque,
layout: Layout,
new_size: usize
) -> *mut Opaque;
@@ -1,16 +0,0 @@ | |||
#![feature(alloc, allocator_api)] |
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.
This is simply not possible with the new api
tests/compile-fail/repeat2.rs
Outdated
@@ -1,3 +1,5 @@ | |||
// ignore-test |
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.
Takes too long
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.
Is it possible to make the array smaller and still get the failure?
If not I'd vote for just removing the test instead.
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.
fun fact: we don't have any limits except stack frame depth anymore. This test won't ever trigger the error
how were these not failing before? are they disabled by default? |
They are disabled by me at https://github.com/solson/miri/blob/0eb3c18565070e4af530e0ec0f707d99be7c5cef/tests/compiletest.rs#L206-L207 because most of them were just failing, because of the new error format |
Can we turn them back on now? Or what are the next steps for doing that? |
Once all errors have been converted to the new error format. Sadly compile-test only detects the |
you should be able to add |
Will try Edit: it works, will convert them all |
Don't have time to convert them all right now. Some errors have either strange placement or different message. |
Foo::B => {}, | ||
Foo::C => {}, | ||
Foo::D => {}, | ||
} | ||
} | ||
} //~ ERROR constant evaluation error [E0080] |
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.
Why here?
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.
Not sure why exactly here, but it's delayed because we don't have validation anymore
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.
memleak.
@@ -1,6 +1,7 @@ | |||
fn main() { | |||
assert!(std::char::from_u32(-1_i32 as u32).is_none()); | |||
match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ERROR tried to interpret an invalid 32-bit value as a char: 4294967295 | |||
match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ ERROR constant evaluation error [E0080] |
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.
This test doesn't error
@@ -12,5 +12,6 @@ | |||
|
|||
fn main() { | |||
// Make sure we catch overflows that would be hidden by first casting the RHS to u32 | |||
let _n = 1i64 >> (u32::max_value() as i64 + 1); //~ Overflow(Shr) | |||
let _n = 1i64 >> (u32::max_value() as i64 + 1); //~ ERROR constant evaluation error [E0080] |
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.
This test doesn't error
@@ -3,7 +3,8 @@ static X: usize = 5; | |||
#[allow(mutable_transmutes)] | |||
fn main() { | |||
unsafe { | |||
*std::mem::transmute::<&usize, &mut usize>(&X) = 6; //~ ERROR: tried to modify constant memory | |||
*std::mem::transmute::<&usize, &mut usize>(&X) = 6; //~ ERROR constant evaluation error [E0080] |
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.
Statics aren't marked static yet.
@@ -171,6 +171,7 @@ pub fn eval_main<'a, 'tcx: 'a>( | |||
Ok(()) => { | |||
let leaks = ecx.memory().leak_report(); | |||
if leaks != 0 { | |||
// TODO: Prevent leaks which aren't supposed to be there | |||
//tcx.sess.err("the evaluated program leaked memory"); |
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.
Needs to be uncommented to allow memleak.rs
and memleak_rc.rs
to pass.
@@ -203,7 +203,7 @@ fn run_pass_rustc() { | |||
} | |||
|
|||
#[test] | |||
#[ignore] // TODO: update test errors | |||
#[should_panic] // TODO: update test errors |
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.
Remove when all tests pass
698d619
to
623a445
Compare
Rebased on top of #376 |
can you rebase again? |
Rebased |
Thanks! I'm tracking the leftover failing tests in #382 |
Edit: updated failure summary