about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/doc/reference.md9
-rw-r--r--src/librustc_trans/trans/base.rs22
-rw-r--r--src/libsyntax/feature_gate.rs5
-rw-r--r--src/test/compile-fail/feature-gate-static-assert.rs14
-rw-r--r--src/test/compile-fail/nonbool_static_assert.rs17
-rw-r--r--src/test/compile-fail/static-assert.rs18
-rw-r--r--src/test/compile-fail/static-assert2.rs17
-rw-r--r--src/test/run-pass/static-assert.rs28
8 files changed, 0 insertions, 130 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md
index e263d40459c..eb3dbfbf136 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -1943,9 +1943,6 @@ macro scope.
 - `simd` - on certain tuple structs, derive the arithmetic operators, which
   lower to the target's SIMD instructions, if any; the `simd` feature gate
   is necessary to use this attribute.
-- `static_assert` - on statics whose type is `bool`, terminates compilation
-  with an error if it is not initialized to `true`. To use this, the `static_assert`
-  feature gate must be enabled.
 - `unsafe_no_drop_flag` - on structs, remove the flag that prevents
   destructors from being run twice. Destructors might be run multiple times on
   the same object with this attribute. To use this, the `unsafe_no_drop_flag` feature
@@ -2301,12 +2298,6 @@ The currently implemented features of the reference compiler are:
                  crate. Stability markers are also attributes: `#[stable]`,
                  `#[unstable]`, and `#[deprecated]` are the three levels.
 
-* `static_assert` - The `#[static_assert]` functionality is experimental and
-                    unstable. The attribute can be attached to a `static` of
-                    type `bool` and the compiler will error if the `bool` is
-                    `false` at compile time. This version of this functionality
-                    is unintuitive and suboptimal.
-
 * `start` - Allows use of the `#[start]` attribute, which changes the entry point
             into a Rust program. This capability, especially the signature for the
             annotated function, is subject to change.
diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs
index c3f614c8cc0..390c0b035fd 100644
--- a/src/librustc_trans/trans/base.rs
+++ b/src/librustc_trans/trans/base.rs
@@ -2032,28 +2032,6 @@ pub fn trans_item(ccx: &CrateContext, item: &ast::Item) {
 
           let g = consts::trans_static(ccx, m, item.id);
           update_linkage(ccx, g, Some(item.id), OriginalTranslation);
-
-          // Do static_assert checking. It can't really be done much earlier
-          // because we need to get the value of the bool out of LLVM
-          if attr::contains_name(&item.attrs, "static_assert") {
-              if !ty::type_is_bool(ty::expr_ty(ccx.tcx(), expr)) {
-                  ccx.sess().span_fatal(expr.span,
-                                        "can only have static_assert on a static \
-                                         with type `bool`");
-              }
-              if m == ast::MutMutable {
-                  ccx.sess().span_fatal(expr.span,
-                                        "cannot have static_assert on a mutable \
-                                         static");
-              }
-
-              let v = ccx.static_values().borrow().get(&item.id).unwrap().clone();
-              unsafe {
-                  if !(llvm::LLVMConstIntGetZExtValue(v) != 0) {
-                      ccx.sess().span_fatal(expr.span, "static assertion failed");
-                  }
-              }
-          }
       },
       ast::ItemForeignMod(ref foreign_mod) => {
         foreign::trans_foreign_mod(ccx, foreign_mod);
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 729e0b721f1..34879606b9e 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -137,9 +137,6 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
     // Allows the use of rustc_* attributes; RFC 572
     ("rustc_attrs", "1.0.0", Active),
 
-    // Allows the use of `static_assert`
-    ("static_assert", "1.0.0", Active),
-
     // Allows the use of #[allow_internal_unstable]. This is an
     // attribute on macro_rules! and can't use the attribute handling
     // below (it has to be checked before expansion possibly makes
@@ -261,8 +258,6 @@ pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
     ("no_builtins", Whitelisted),
     ("no_mangle", Whitelisted),
     ("no_stack_check", Whitelisted),
-    ("static_assert", Gated("static_assert",
-                            "`#[static_assert]` is an experimental feature, and has a poor API")),
     ("no_debug", Whitelisted),
     ("omit_gdb_pretty_printer_section", Whitelisted),
     ("unsafe_no_drop_flag", Gated("unsafe_no_drop_flag",
diff --git a/src/test/compile-fail/feature-gate-static-assert.rs b/src/test/compile-fail/feature-gate-static-assert.rs
deleted file mode 100644
index 25740397d7a..00000000000
--- a/src/test/compile-fail/feature-gate-static-assert.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// 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.
-
-#[static_assert] //~ ERROR `#[static_assert]` is an experimental feature
-static X: bool = true;
-
-fn main() {}
diff --git a/src/test/compile-fail/nonbool_static_assert.rs b/src/test/compile-fail/nonbool_static_assert.rs
deleted file mode 100644
index 7a7912b06f8..00000000000
--- a/src/test/compile-fail/nonbool_static_assert.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// 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.
-
-#![feature(static_assert)]
-#![allow(dead_code)]
-
-#[static_assert]
-static E: i32 = 1; //~ ERROR can only have static_assert on a static with type `bool`
-
-fn main() {}
diff --git a/src/test/compile-fail/static-assert.rs b/src/test/compile-fail/static-assert.rs
deleted file mode 100644
index d0cfbfbbccc..00000000000
--- a/src/test/compile-fail/static-assert.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2014 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.
-
-#![feature(static_assert)]
-#![allow(dead_code)]
-
-#[static_assert]
-static A: bool = false; //~ ERROR static assertion failed
-
-fn main() {
-}
diff --git a/src/test/compile-fail/static-assert2.rs b/src/test/compile-fail/static-assert2.rs
deleted file mode 100644
index 35f840dab0c..00000000000
--- a/src/test/compile-fail/static-assert2.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2014 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.
-
-#![feature(static_assert)]
-#![allow(dead_code)]
-
-#[static_assert]
-static E: bool = 1 == 2; //~ ERROR static assertion failed
-
-fn main() {}
diff --git a/src/test/run-pass/static-assert.rs b/src/test/run-pass/static-assert.rs
deleted file mode 100644
index e5583a3c697..00000000000
--- a/src/test/run-pass/static-assert.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2014 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.
-
-// pretty-expanded FIXME #23616
-
-#![feature(static_assert)]
-
-#[static_assert]
-static b: bool = true;
-
-#[static_assert]
-static c: bool = 1 == 1;
-
-#[static_assert]
-static d: bool = 1 != 2;
-
-#[static_assert]
-static f: bool = (4/2) == 2;
-
-pub fn main() {
-}