about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-03-26 13:30:33 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-03-26 13:53:52 -0700
commit3752958e4029e9d9cfb1ff020e92142b53fb810f (patch)
treed87fa6b5d90a8df3b9be713860800963ec5982c4 /src/libsyntax
parent557d4346a26266d2eb13f6b0adf106b8873b0da1 (diff)
downloadrust-3752958e4029e9d9cfb1ff020e92142b53fb810f.tar.gz
rust-3752958e4029e9d9cfb1ff020e92142b53fb810f.zip
syntax: Remove support for #[should_fail]
This attribute has been deprecated in favor of #[should_panic]. This also
updates rustdoc to no longer accept the `should_fail` directive and instead
renames it to `should_panic`.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/feature_gate.rs1
-rw-r--r--src/libsyntax/test.rs14
2 files changed, 3 insertions, 12 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 60f81dac1e9..d5a8d3cc439 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -201,7 +201,6 @@ pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
     ("no_mangle", Normal),
     ("no_link", Normal),
     ("derive", Normal),
-    ("should_fail", Normal),
     ("should_panic", Normal),
     ("ignore", Normal),
     ("no_implicit_prelude", Normal),
diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs
index 2a47a696b1c..fbee11ee657 100644
--- a/src/libsyntax/test.rs
+++ b/src/libsyntax/test.rs
@@ -134,7 +134,7 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
                         path: self.cx.path.clone(),
                         bench: is_bench_fn(&self.cx, &*i),
                         ignore: is_ignored(&*i),
-                        should_panic: should_panic(&*i, self.cx.span_diagnostic)
+                        should_panic: should_panic(&*i)
                     };
                     self.cx.testfns.push(test);
                     self.tests.push(i.ident);
@@ -386,16 +386,8 @@ fn is_ignored(i: &ast::Item) -> bool {
     i.attrs.iter().any(|attr| attr.check_name("ignore"))
 }
 
-fn should_panic(i: &ast::Item, diag: &diagnostic::SpanHandler) -> ShouldPanic {
-    match i.attrs.iter().find(|attr| {
-        if attr.check_name("should_panic") { return true; }
-        if attr.check_name("should_fail") {
-            diag.span_warn(attr.span, "`#[should_fail]` is deprecated. Use `#[should_panic]` \
-                                       instead");
-            return true;
-        }
-        false
-    }) {
+fn should_panic(i: &ast::Item) -> ShouldPanic {
+    match i.attrs.iter().find(|attr| attr.check_name("should_panic")) {
         Some(attr) => {
             let msg = attr.meta_item_list()
                 .and_then(|list| list.iter().find(|mi| mi.check_name("expected")))