diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs index 20fb4bf32ccb7..2dd96c1f11f72 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/libsyntax_ext/deriving/generic/mod.rs @@ -192,7 +192,7 @@ use std::collections::HashSet; use std::vec; use syntax::abi::Abi; -use syntax::ast::{self, EnumDef, Expr, Ident, Generics, VariantData, BinOpKind, PatKind}; +use syntax::ast::{self, EnumDef, Expr, Ident, Generics, Mac, VariantData, BinOpKind, PatKind}; use syntax::attr; use syntax::attr::AttrMetaMethods; use syntax::ext::base::{ExtCtxt, Annotatable}; @@ -371,6 +371,10 @@ fn find_type_parameters(ty: &ast::Ty, ty_param_names: &[ast::Name]) -> Vec or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// regression test for #32950 + +#![feature(type_macros)] + +macro_rules! passthru { + ($t:ty) => { $t } +} + +macro_rules! useassoc { + ($t:ident, $assoc:ident) => { ($t, $t::$assoc) } +} + +trait HasAssoc { type Type; } + +impl HasAssoc for i32 { type Type = i32; } + +#[derive(Debug)] +struct Thing1 { + thing: useassoc!(T, Type) +} +#[derive(Debug)] +struct Thing2 { + thing: (T, T::Type) +} + +fn main() { + let t1: passthru!(Thing1) = Thing1 { thing: (42, 42) }; + let t2: passthru!(Thing2) = Thing2 { thing: (42, 42) }; + println!("{:?} {:?}", t1, t2); +} +