diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-03-27 10:07:48 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-27 10:07:48 -0700 |
| commit | 55c398d651e6b3e4f469325a35e029059ce36f1e (patch) | |
| tree | 23da6bac0134a2989b539e57b0f50c48c6619775 /src/libsyntax | |
| parent | 88c3a0f423ea99be1e835b0dc24d3dcd5306a307 (diff) | |
| parent | 3752958e4029e9d9cfb1ff020e92142b53fb810f (diff) | |
| download | rust-55c398d651e6b3e4f469325a35e029059ce36f1e.tar.gz rust-55c398d651e6b3e4f469325a35e029059ce36f1e.zip | |
rollup merge of #23752: alexcrichton/remove-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.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/test.rs | 14 |
2 files changed, 3 insertions, 12 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 46115ae468f..76887164418 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -202,7 +202,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"))) |
