return vec![];
}
- let item = if let Annotatable::Item(i) = item {
- i
- } else {
- cx.parse_sess
- .span_diagnostic
- .span_fatal(
- item.span(),
+ let item = match item {
+ Annotatable::Item(i) => i,
+ other => {
+ cx.struct_span_err(
+ other.span(),
"`#[test]` attribute is only allowed on non associated functions",
)
- .raise();
+ .emit();
+ return vec![other];
+ }
};
if let ast::ItemKind::MacCall(_) = item.kind {
impl A {
#[test]
- fn new() -> A { //~ ERROR `#[test]` attribute is only allowed on non associated functions
+ fn new() -> A {
+ //~^ ERROR `#[test]` attribute is only allowed on non associated functions
+ A {}
+ }
+ #[test]
+ fn recovery_witness() -> A {
+ //~^ ERROR `#[test]` attribute is only allowed on non associated functions
A {}
}
}
--> $DIR/test-attr-non-associated-functions.rs:9:5
|
LL | / fn new() -> A {
+LL | |
LL | | A {}
LL | | }
| |_____^
-error: aborting due to previous error
+error: `#[test]` attribute is only allowed on non associated functions
+ --> $DIR/test-attr-non-associated-functions.rs:14:5
+ |
+LL | / fn recovery_witness() -> A {
+LL | |
+LL | | A {}
+LL | | }
+ | |_____^
+
+error: aborting due to 2 previous errors