Skip to content
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

Add regression tests for #23649 #26383

Merged
merged 1 commit into from
Jun 20, 2015
Merged

Conversation

frewsxcv
Copy link
Member

Closes #23649

@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@arielb1
Copy link
Contributor

arielb1 commented Jun 18, 2015

I would prefer a test that the generated code is correct, e.g.

use std::mem;

pub struct X([u8]);

fn _f(x: &X) -> usize { match *x { X(ref x) =>  { x.len() } } }

fn main() {
    let b: &[u8] = &[11; 42];
    let v: &X = unsafe { mem::transmute(b) };
    assert_eq!(_f(v), 42);
}

Also, use assert_eq! instead of println!.

@frewsxcv
Copy link
Member Author

I would prefer a test that the generated code is correct

@arielb1 what do you mean by this?

@frewsxcv
Copy link
Member Author

@arielb1 I'm just creating a regression test. The code that I have committed is the exact code that previous caused an ICE. Altering it could result in a no longer accurate regression test.

@alexcrichton
Copy link
Member

@frewsxcv could you add the code that @arielb1 posted as well to a test case here? Other than that this looks good to go, thanks!

@frewsxcv frewsxcv force-pushed the regression-tests-23649 branch from 0b6df8a to 68bb164 Compare June 19, 2015 21:59
@frewsxcv
Copy link
Member Author

Done

I altered src/test/run-pass/issue-23649-1.rs

@alexcrichton
Copy link
Member

@bors: r+ 68bb164

@bors
Copy link
Contributor

bors commented Jun 20, 2015

⌛ Testing commit 68bb164 with merge dd2151c...

@bors bors merged commit 68bb164 into rust-lang:master Jun 20, 2015
@frewsxcv frewsxcv deleted the regression-tests-23649 branch October 2, 2016 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants