File tree Expand file tree Collapse file tree 3 files changed +59
-0
lines changed
src/test/ui/custom-derive Expand file tree Collapse file tree 3 files changed +59
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // no-prefer-dynamic
12
+
13
+ #![crate_type = "proc-macro"]
14
+ #![feature(proc_macro, proc_macro_lib)]
15
+
16
+ extern crate proc_macro;
17
+
18
+ use proc_macro::TokenStream;
19
+
20
+ #[proc_macro_derive(Foo)]
21
+ pub fn derive_foo(input: TokenStream) -> TokenStream {
22
+ input
23
+ }
24
+
25
+ #[proc_macro_derive(Bar)]
26
+ pub fn derive_bar(input: TokenStream) -> TokenStream {
27
+ panic!("lolnope");
28
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // aux-build:plugin.rs
12
+
13
+ #![feature(proc_macro)]
14
+
15
+ #[macro_use] extern crate plugin;
16
+
17
+ #[derive(Foo, Bar)]
18
+ struct Baz {
19
+ a: i32,
20
+ b: i32,
21
+ }
22
+
23
+ fn main() {}
Original file line number Diff line number Diff line change
1
+ error: custom derive attribute panicked
2
+ --> $DIR/issue-36935.rs:17:15
3
+ |
4
+ 17 | #[derive(Foo, Bar)]
5
+ | ^^^
6
+ |
7
+ = help: message: lolnope
8
+
You can’t perform that action at this time.
0 commit comments