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

Use compile_error! #1138

Closed
killercup opened this Issue Sep 1, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@killercup
Member

killercup commented Sep 1, 2017

Rust 1.20 stabilized the compile_error! macro, which means we can finally output useful errors from macros and unusable feature-flag combinations!

Here are the places with code comments just waiting to use this macro:

// Remove this workaround as soon as rust issue 40872 is implemented
// https://github.com/rust-lang/rust/issues/40872
const ERROR: i32 = env!("invalid table! syntax");

// compile_error!("At least one backend must be enabled to run tests");

// compile_error!("At least one backend must be enabled to run tests");

// compile_error!("At least one backend must be enabled to run tests");

// compile_error!("At least one backend must be enabled to run tests");

@notryanb

This comment has been minimized.

Contributor

notryanb commented Sep 1, 2017

@killercup - I'd like to tackle this issue. I think I may be able to also solve #624 while doing this?

@killercup

This comment has been minimized.

Member

killercup commented Sep 1, 2017

@notryanb it's yours!

#624 might be a bit more tricky. Do you have a good idea how to solve it? I could only come up with one medium and one hard way… (see #624 (comment))

@killercup killercup added the assigned label Sep 1, 2017

@notryanb

This comment has been minimized.

Contributor

notryanb commented Sep 1, 2017

👍 I'll look into #624 separately.

@sgrif

This comment has been minimized.

Member

sgrif commented Sep 1, 2017

Diesel CLI and Infer Schema should also use this in the places they currently fail to compile when built with 0 features.

notryanb added a commit to notryanb/diesel that referenced this issue Sep 5, 2017

Fixes diesel-rs#1138 - Utilize compile_error! macro.
compile_error! was introduced in Rust 1.20. Use to give concise and
correct compile-time error messages.

notryanb added a commit to notryanb/diesel that referenced this issue Sep 5, 2017

Fixes diesel-rs#1138 - Utilize compile_error! macro.
compile_error! was introduced in Rust 1.20. Use to give concise and
correct compile-time error messages.

notryanb added a commit to notryanb/diesel that referenced this issue Sep 5, 2017

Fixes diesel-rs#1138 - Utilize compile_error! macro.
compile_error! was introduced in Rust 1.20. Use to give concise and
correct compile-time error messages.

notryanb added a commit to notryanb/diesel that referenced this issue Sep 5, 2017

Fixes diesel-rs#1138 - Utilize compile_error! macro.
compile_error! was introduced in Rust 1.20. Use to give concise and
correct compile-time error messages.

notryanb added a commit to notryanb/diesel that referenced this issue Sep 6, 2017

Fixes diesel-rs#1138 - Utilize compile_error! macro.
compile_error! was introduced in Rust 1.20. Use to give concise and
correct compile-time error messages.

notryanb added a commit to notryanb/diesel that referenced this issue Sep 11, 2017

Fixes diesel-rs#1138 - Utilize compile_error! macro.
compile_error! was introduced in Rust 1.20. Use to give concise and
correct compile-time error messages.

@sgrif sgrif closed this in e775209 Sep 21, 2017

sgrif added a commit that referenced this issue Sep 21, 2017

Merge pull request #1148 from notryanb/compile-error
Fixes #1138 - Utilize compile_error! macro.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment