]> git.lizzy.rs Git - rust.git/commit
Error out when using static_assert on a non-boolean value
authorBjörn Steinbrink <bsteinbr@gmail.com>
Sat, 28 Feb 2015 18:22:24 +0000 (19:22 +0100)
committerBjörn Steinbrink <bsteinbr@gmail.com>
Sat, 28 Feb 2015 18:28:49 +0000 (19:28 +0100)
commitd11b48c85c1cceb559ab8a08815ba3f7b3312c44
tree9892ae0c01cce5cc2c47c567ffa65c14cb05f7a2
parent48aeaba9347a25b2e3848e0dcbc1d8f6b0076718
Error out when using static_assert on a non-boolean value

static_assert is documented as working on static with type `bool`, but
we currently accept it on any const static and crash when the const has
an non-integral type.

This is a breaking-change for anyone who used static_assert on types
likes i32, which happened to work but seems like an unintended
consequence of the missing error checking.

[breaking-change]

Fixes #22056
src/librustc_trans/trans/base.rs
src/test/compile-fail/nonbool_static_assert.rs [new file with mode: 0644]