Skip to content

Use compiletest to make sure unsafe things do not compile #46

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

Closed
wants to merge 2 commits into from
Closed

Use compiletest to make sure unsafe things do not compile #46

wants to merge 2 commits into from

Conversation

jonas-schievink
Copy link
Contributor

I only added 2 tests I found in tests.rs, it would be nice to gather more. If anyone finds something unsafe that we should test against, please leave a comment.

@jonas-schievink
Copy link
Contributor Author

Oh yeah, Travis fails since this only works on nightly. Give me a second.

@jonas-schievink
Copy link
Contributor Author

jonas-schievink commented Sep 16, 2017

Dev-dependencies are not allowed to be optional

UGH. Why isn't there a more elegant and usable solution for compile-fail tests? They're pretty important for all sorts of crates...

@kyren
Copy link
Contributor

kyren commented Feb 10, 2018

I ended up working off of what you had and managed to get compiletests_rs working on travis as of 1426bdb. I didn't put compiletest_rs in [dev-dependencies], but it is optional?

I'm not sure if I have it set up in the most optimal way.

@jonas-schievink
Copy link
Contributor Author

@kyren Very nice! The only issue with making compiletest a regular dependency is that downstream crates can now request the compiletest_rs feature to be enabled, too. I don't think that's too big of a deal, though.

Eventually I'll revisit my plans to make compile-fail tests more accessible, probably after rust-lang/cargo#4734 lands or rust-lang/rfcs#2318 is accepted and implemented.

Also closing, since this is implemented now.

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.

2 participants