Skip to content

Commit 17605a1

Browse files
Fixup tests for new unknown derive error
1 parent a10989f commit 17605a1

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

src/libsyntax_ext/deriving/mod.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,11 @@ pub fn expand_derive(cx: &mut ExtCtxt,
247247
..mitem.span
248248
};
249249

250-
match cx.resolver.resolve_macro(cx.current_expansion.mark, &path, false) {
251-
Ok(ext) => match *ext {
252-
SyntaxExtension::CustomDerive(ref ext) =>
253-
return ext.expand(cx, span, &mitem, item),
254-
_ => {},
255-
},
256-
_ => {},
257-
};
250+
if let Ok(ext) = cx.resolver.resolve_macro(cx.current_expansion.mark, &path, false) {
251+
if let SyntaxExtension::CustomDerive(ref ext) = *ext {
252+
return ext.expand(cx, span, &mitem, item),
253+
}
254+
}
258255

259256
cx.span_err(span, &format!("cannot find derive macro `{}` in this scope", tname));
260257
return vec![item];

src/test/compile-fail/deriving-meta-unknown-trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// ignore-tidy-linelength
1212

1313
#[derive(Eqr)]
14-
//~^ ERROR `#[derive]` for custom traits is not stable enough for use. It is deprecated and will be removed in v1.15 (see issue #29644)
14+
//~^ ERROR cannot find derive macro `Eqr` in this scope
1515
struct Foo;
1616

1717
pub fn main() {}

src/test/compile-fail/deriving-primitive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#[derive(FromPrimitive)] //~ERROR `#[derive]` for custom traits is not stable
11+
#[derive(FromPrimitive)] //~ERROR cannot find derive macro `FromPrimitive` in this scope
1212
enum Foo {}
1313

1414
fn main() {}

0 commit comments

Comments
 (0)