fix(codegen): Support extern crate serde not in toplevel module

This commit is contained in:
David Tolnay
2016-04-24 10:59:57 -07:00
parent a959073a81
commit 305fab7c16
10 changed files with 91 additions and 79 deletions
+2 -4
View File
@@ -27,10 +27,8 @@ pub fn with_bound(
item: &ast::Item,
generics: &ast::Generics,
filter: &Fn(&ast::StructField) -> bool,
bound: &[&'static str],
bound: &ast::Path,
) -> ast::Generics {
let path = builder.path().global().ids(bound).build();
builder.from_generics(generics.clone())
.with_predicates(
all_variants(cx, item).iter()
@@ -44,7 +42,7 @@ pub fn with_bound(
// the type that is being bounded e.g. T
.bound().build(ty.clone())
// the bound e.g. Serialize
.bound().trait_(path.clone()).build()
.bound().trait_(bound.clone()).build()
.build()))
.build()
}