Skip to content

Commit e47384f

Browse files
committed
enable macro visits in deriving
1 parent 179539f commit e47384f

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

src/libsyntax_ext/deriving/generic/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ use std::collections::HashSet;
192192
use std::vec;
193193

194194
use syntax::abi::Abi;
195-
use syntax::ast::{self, EnumDef, Expr, Ident, Generics, VariantData, BinOpKind, PatKind};
195+
use syntax::ast::{self, EnumDef, Expr, Ident, Generics, Mac, VariantData, BinOpKind, PatKind};
196196
use syntax::attr;
197197
use syntax::attr::AttrMetaMethods;
198198
use syntax::ext::base::{ExtCtxt, Annotatable};
@@ -371,6 +371,10 @@ fn find_type_parameters(ty: &ast::Ty, ty_param_names: &[ast::Name]) -> Vec<P<ast
371371

372372
visit::walk_ty(self, ty)
373373
}
374+
375+
fn visit_mac(&mut self, mac: &'a Mac) {
376+
visit::walk_mac(self, mac)
377+
}
374378
}
375379

376380
let mut visitor = Visitor {
+28
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+
// regression test for #32950
12+
13+
#![feature(type_macros)]
14+
15+
macro_rules! passthru {
16+
($t:ty) => { $t }
17+
}
18+
19+
#[derive(Debug)]
20+
struct Thing<T> {
21+
thing: passthru!(T)
22+
}
23+
24+
fn main() {
25+
let t: passthru!(Thing<passthru!(i32)>) = Thing { thing: 42 };
26+
println!("{:?}", t);
27+
}
28+

0 commit comments

Comments
 (0)