Skip to content

Deprecating i/u suffixes in libcoretest #21895

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

Merged
merged 1 commit into from
Feb 12, 2015
Merged

Deprecating i/u suffixes in libcoretest #21895

merged 1 commit into from
Feb 12, 2015

Conversation

alfiedotwtf
Copy link
Contributor

No description provided.

@rust-highfive
Copy link
Contributor

r? @brson

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

@@ -18,7 +18,7 @@ static TEST: &'static str = "Test";

#[test]
fn any_referenced() {
let (a, b, c) = (&5u as &Any, &TEST as &Any, &Test as &Any);
let (a, b, c) = (&5 as &Any, &TEST as &Any, &Test as &Any);

assert!(a.is::<uint>());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That needs more fixing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the the literal a u32, but later it's checked if it's a uint.

@alfiedotwtf
Copy link
Contributor Author

@tbu- could you please elaborate?

@alfiedotwtf
Copy link
Contributor Author

I think type inference knows it's a uint as 'make check' passed all tests.

@tbu-
Copy link
Contributor

tbu- commented Feb 3, 2015

Let me claim that this is impossible or a bug in the type inference.

@tbu-
Copy link
Contributor

tbu- commented Feb 3, 2015

a.rs:

use std::any::Any;
fn main() {
    println!("{}", (&5 as &Any).is::<uint>())
}

Prints:

$ rustc a.rs && ./a
false

@tbu-
Copy link
Contributor

tbu- commented Feb 3, 2015

If you use make -j <anything greater than 1> check, it can squelch test errors.

@alfiedotwtf
Copy link
Contributor Author

What's the default, as I didn't use -j?

@tbu-
Copy link
Contributor

tbu- commented Feb 3, 2015

Default should be fine. But have you seen my code snippet that demonstrates that this test cannot succeed?

@alfiedotwtf
Copy link
Contributor Author

Yeah, you're definitely correct. I was just worried about how my tests were passing. And if so, there must be other commits out there that aren't being caught too.

I'll fix my change... but why did make check pass?!

Edit: I'll make check again without the fix and review the output.

@alfiedotwtf
Copy link
Contributor Author

Looking at the output, there is zero mention of libcoretest. So I guess these tests aren't even run with 'make check'?

@tbu-
Copy link
Contributor

tbu- commented Feb 3, 2015

Mh. They should be.

@alfiedotwtf
Copy link
Contributor Author

Oh, this explains so much :(

cfg: antlr4 not available, skipping lexer test...
cfg: flex not available, skipping parser test...

Installing and running tests again. Sorry for the run around.

@alfiedotwtf
Copy link
Contributor Author

Well this is weird. libcoretests are definately not firing on my local machine. I've made a post on internal:

http://internals.rust-lang.org/t/make-check-not-firing-libcoretest-tests/1534

@tbu-
Copy link
Contributor

tbu- commented Feb 4, 2015

@Alfie These error messages should have nothing to do with libcoretest. You could try make check-coretest-stage1.

@alfiedotwtf
Copy link
Contributor Author

Yep. I upgraded Valgrind and now something completely unrelated is failing:

test old_io::net::tcp::test::bind_error ... FAILED
test old_io::net::udp::test::bind_error ... FAILED

So back to the drawing board - now that I have all dependencies (flex, bison, antlr4 and valgrind were missing or old), I'm currently running 'make check' on upstream's master to see if there's anything else wrong with my local machine before continuing with this PR.

@alfiedotwtf
Copy link
Contributor Author

@tbu- sorry about the delay. Worked out everything I needed, and was able to identify all the issues. Make check happy now, so this PR is good to go.

@@ -18,7 +18,7 @@ static TEST: &'static str = "Test";

#[test]
fn any_referenced() {
let (a, b, c) = (&5u as &Any, &TEST as &Any, &Test as &Any);
let (a, b, c) = (&5us as &Any, &TEST as &Any, &Test as &Any);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be changed to use i32, there's no need for a platform dependent integer type here.

@tbu-
Copy link
Contributor

tbu- commented Feb 10, 2015

Except for the one note I left, this looks fine.

@alfiedotwtf
Copy link
Contributor Author

Thanks for the suggestion, but I tried modifying as you said (5us to 5i32) and it failed:

failures:

---- any::any_referenced stdout ----
    thread 'any::any_referenced' panicked at 'assertion failed: a.is::<uint>()', /home/alfie/rust/src/libcoretest/any.rs:23

So unless you have any other suggestions, 1f00690 was the last one that passed all tests.

@tbu-
Copy link
Contributor

tbu- commented Feb 10, 2015

@Alfie

#[test]
fn any_referenced() {
    let (a, b, c) = (&5i32 as &Any, &TEST as &Any, &Test as &Any);
    assert!(a.is::<i32>());
    assert!(!b.is::<i32>());
    assert!(!c.is::<i32>());
    assert!(!a.is::<&'static str>());
    assert!(b.is::<&'static str>());
    assert!(!c.is::<&'static str>());
    assert!(!a.is::<Test>());
    assert!(!b.is::<Test>());
    assert!(c.is::<Test>());
}

I.e. change all the checks for uint to checks for i32, too. Thanks for your endurance!

@alfiedotwtf
Copy link
Contributor Author

@tbu- Ahh I see. I only wanted the bare minimum (so only changing the suffixes), but that one makes sense. Fixed now. Thanks!

@alfiedotwtf
Copy link
Contributor Author

ping @tbu-

@pnkfelix
Copy link
Member

@bors r+ bffbcb5

@alfiedotwtf
Copy link
Contributor Author

Awesome. Thanks @pnkfelix and @tbu-!

@bors
Copy link
Collaborator

bors commented Feb 12, 2015

⌛ Testing commit bffbcb5 with merge cca1cf6...

bors added a commit that referenced this pull request Feb 12, 2015
@bors
Copy link
Collaborator

bors commented Feb 12, 2015

@bors bors merged commit bffbcb5 into rust-lang:master Feb 12, 2015
@tbu-
Copy link
Contributor

tbu- commented Feb 12, 2015

Great to see it landed. Thanks for your contribution. :)

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.

6 participants