diff options
| author | Gianni Ciccarelli <gianni.ciccarelli@gmail.com> | 2016-11-18 17:14:42 +0100 |
|---|---|---|
| committer | Gianni Ciccarelli <gianni.ciccarelli@gmail.com> | 2017-04-24 10:08:48 +0000 |
| commit | 116e9831a57dd09b4c580c2f480064299137b0b0 (patch) | |
| tree | 7cd1a4b68c97f201a062207064deaa1a5f45fdd7 /src/libsyntax/fold.rs | |
| parent | 15ce54096a589de277771ad1f55a334fe2661a64 (diff) | |
| download | rust-116e9831a57dd09b4c580c2f480064299137b0b0.tar.gz rust-116e9831a57dd09b4c580c2f480064299137b0b0.zip | |
support `default impl` for specialization
this commit implements the first step of the `default impl` feature: all items in a `default impl` are (implicitly) `default` and hence specializable. In order to test this feature I've copied all the tests provided for the `default` method implementation (in run-pass/specialization and compile-fail/specialization directories) and moved the `default` keyword from the item to the impl. See referenced issue for further info
Diffstat (limited to 'src/libsyntax/fold.rs')
| -rw-r--r-- | src/libsyntax/fold.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index f39399a62e8..58cf50cdc00 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -897,9 +897,16 @@ pub fn noop_fold_item_kind<T: Folder>(i: ItemKind, folder: &mut T) -> ItemKind { ItemKind::DefaultImpl(unsafety, ref trait_ref) => { ItemKind::DefaultImpl(unsafety, folder.fold_trait_ref((*trait_ref).clone())) } - ItemKind::Impl(unsafety, polarity, generics, ifce, ty, impl_items) => ItemKind::Impl( + ItemKind::Impl(unsafety, + polarity, + defaultness, + generics, + ifce, + ty, + impl_items) => ItemKind::Impl( unsafety, polarity, + defaultness, folder.fold_generics(generics), ifce.map(|trait_ref| folder.fold_trait_ref(trait_ref.clone())), folder.fold_ty(ty), |
