Skip to content

Commit e3a6bdb

Browse files
authored
Rollup merge of rust-lang#38607 - estebank:test-for-36935, r=petrochenkov
Test for appropriate span on second custom derive Adds test for and closes rust-lang#36935.
2 parents 9226613 + dfb6ae6 commit e3a6bdb

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
}
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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 numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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+

0 commit comments

Comments
 (0)