d11b48c85c
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
17 lines
606 B
Rust
17 lines
606 B
Rust
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
|
// file at the top-level directory of this distribution and at
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
// option. This file may not be copied, modified, or distributed
|
|
// except according to those terms.
|
|
|
|
#![allow(dead_code)]
|
|
|
|
#[static_assert]
|
|
static E: i32 = 1; //~ ERROR can only have static_assert on a static with type `bool`
|
|
|
|
fn main() {}
|