Skip to content

Fix warnings when compiling stdlib with --test #30458

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
Dec 30, 2015

Conversation

fhahn
Copy link
Contributor

@fhahn fhahn commented Dec 18, 2015

This PR siliences some warnings when compiling stdlib with --test. Mostly remove some unused imports and added a few #[allow(..)].

I also marked some signal handling functions with #[cfg(not(test))], because they are only called through rt::lang_start, which is also marked as #[cfg(not(test))]

@rust-highfive
Copy link
Contributor

r? @aturon

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

@fhahn fhahn force-pushed the fix-warnings-tests-stdlib branch from 6d26750 to a2019f2 Compare December 18, 2015 12:51
@steveklabnik
Copy link
Member

Looks good to me, but this isn't my specialty in the codebase, so I'll let someone else r+

@@ -59,6 +60,8 @@ pub fn init() {
assert!(signal(libc::SIGPIPE, libc::SIG_IGN) != !0);
}
}

#[cfg(not(test))]
#[cfg(target_os = "nacl")]
Copy link
Member

Choose a reason for hiding this comment

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

I think these cfg annotations should be combined, right?

@fhahn fhahn force-pushed the fix-warnings-tests-stdlib branch from a2019f2 to d8a6eb5 Compare December 20, 2015 23:53
@fhahn
Copy link
Contributor Author

fhahn commented Dec 20, 2015

@alexcrichton Thanks for your feedback! I've updated the commit. Now almost all warnings on Linux should be gone. The only remaining warnings are about the use of deprecated items in src/libstd/dynamic_lib.rs (https://github.com/rust-lang/rust/pull/30458/files#diff-59794c31034a5097419f3f376a30b4a4R135 and https://github.com/rust-lang/rust/pull/30458/files#diff-59794c31034a5097419f3f376a30b4a4R168), even though I've added #[allow(deprecated)].

@fhahn fhahn force-pushed the fix-warnings-tests-stdlib branch from d8a6eb5 to aecbb5d Compare December 21, 2015 00:00
@@ -233,9 +233,8 @@ mod tests {
*lock.borrow_mut() = 1;
let lock2 = mc.lock().unwrap();
*lock.borrow_mut() = 2;
let answer = Answer(lock2);
Answer(lock2);
Copy link
Member

Choose a reason for hiding this comment

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

I think this may have slightly changed the semantics here as Answer lives over the call to panic!, but changing the declaration to let _answer = ... and removing the drop should have the same semantics.

@alexcrichton
Copy link
Member

Thanks @fhahn! Looks good to me!

@fhahn fhahn force-pushed the fix-warnings-tests-stdlib branch from aecbb5d to abe9b40 Compare December 22, 2015 13:03
@fhahn
Copy link
Contributor Author

fhahn commented Dec 22, 2015

@alexcrichton thanks for your feedback! I've updated the PR again.

@alexcrichton
Copy link
Member

@bors: r+ abe9b4088989912f0cfa2348e6a103131791f3df

Thanks!

@bors
Copy link
Collaborator

bors commented Dec 23, 2015

⌛ Testing commit abe9b40 with merge efa0caf...

@bors
Copy link
Collaborator

bors commented Dec 23, 2015

💔 Test failed - auto-linux-64-x-android-t

@fhahn fhahn force-pushed the fix-warnings-tests-stdlib branch from abe9b40 to 217bebb Compare December 24, 2015 13:22
@fhahn
Copy link
Contributor Author

fhahn commented Dec 24, 2015

I've update the PR to fix the fail on android

@sanxiyn
Copy link
Member

sanxiyn commented Dec 28, 2015

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 28, 2015

📌 Commit 217bebb has been approved by sanxiyn

@bors
Copy link
Collaborator

bors commented Dec 28, 2015

⌛ Testing commit 217bebb with merge 1d71545...

@bors
Copy link
Collaborator

bors commented Dec 28, 2015

💔 Test failed - auto-linux-64-x-android-t

@fhahn
Copy link
Contributor Author

fhahn commented Dec 28, 2015

The build on Android fails, because I marked os::raw::tests::unix as test. I could disable it again for Android (or in general), but shouldn"t the types of nlink_t in libc and os::raw be equal?

@sanxiyn
Copy link
Member

sanxiyn commented Dec 29, 2015

I agree they should match on Android too, but I think it could be done on a separate PR.

@fhahn fhahn force-pushed the fix-warnings-tests-stdlib branch from 217bebb to e27cbef Compare December 29, 2015 15:07
@fhahn
Copy link
Contributor Author

fhahn commented Dec 29, 2015

I've excluded the test from Android for now (at least I hope) and opened a PR for libc. After this lands, we should enable the test for android again.

@sanxiyn
Copy link
Member

sanxiyn commented Dec 30, 2015

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 30, 2015

📌 Commit e27cbef has been approved by sanxiyn

@bors
Copy link
Collaborator

bors commented Dec 30, 2015

⌛ Testing commit e27cbef with merge a06bb97...

bors added a commit that referenced this pull request Dec 30, 2015
This PR siliences some warnings when compiling stdlib with --test. Mostly remove some unused imports and added a few `#[allow(..)]`.

I also marked some signal handling functions with `#[cfg(not(test))]`, because they are only called through `rt::lang_start`, which is also marked as  `#[cfg(not(test))]`
@bors bors merged commit e27cbef into rust-lang:master Dec 30, 2015
@fhahn fhahn deleted the fix-warnings-tests-stdlib branch December 30, 2015 15:40
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.

7 participants