syntax: Fold macros in default methods. Closes #3911
This commit is contained in:
parent
b90d7d4c81
commit
762101b72a
@ -258,9 +258,15 @@ fn noop_fold_item_underscore(i: item_, fld: ast_fold) -> item_ {
|
||||
*methods, |x| fld.fold_method(*x))))
|
||||
}
|
||||
item_trait(tps, traits, methods) => {
|
||||
let methods = do methods.map |method| {
|
||||
match *method {
|
||||
required(*) => copy *method,
|
||||
provided(method) => provided(fld.fold_method(method))
|
||||
}
|
||||
};
|
||||
item_trait(fold_ty_params(tps, fld),
|
||||
vec::map(traits, |p| fold_trait_ref(*p, fld)),
|
||||
/* FIXME (#2543) */ copy methods)
|
||||
move methods)
|
||||
}
|
||||
item_mac(m) => {
|
||||
// FIXME #2888: we might actually want to do something here.
|
||||
|
17
src/test/run-pass/traits-default-method-macro.rs
Normal file
17
src/test/run-pass/traits-default-method-macro.rs
Normal file
@ -0,0 +1,17 @@
|
||||
trait Foo {
|
||||
fn bar() -> ~str {
|
||||
fmt!("test")
|
||||
}
|
||||
}
|
||||
|
||||
enum Baz {
|
||||
Quux
|
||||
}
|
||||
|
||||
impl Baz: Foo {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let q = Quux;
|
||||
assert q.bar() == ~"test";
|
||||
}
|
Loading…
Reference in New Issue
Block a user