diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2019-06-18 19:15:31 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2019-07-02 12:25:22 -0400 |
| commit | cbc75c699c1be9bf6c735351b7b07ab7d0569cdf (patch) | |
| tree | 5f5bb47ea1f6c8d1a634497e3e8d4b8dde23b9a6 /src | |
| parent | 134fc4a929d65978752d958bdc7a92ea7ec95b0a (diff) | |
| download | rust-cbc75c699c1be9bf6c735351b7b07ab7d0569cdf.tar.gz rust-cbc75c699c1be9bf6c735351b7b07ab7d0569cdf.zip | |
implement `TypeFoldable` for `Arc`
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/ty/structural_impls.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index f1749d39d6e..28b52dcea80 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -853,6 +853,16 @@ impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Rc<T> { } } +impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Arc<T> { + fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self { + Arc::new((**self).fold_with(folder)) + } + + fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool { + (**self).visit_with(visitor) + } +} + impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Box<T> { fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self { let content: T = (**self).fold_with(folder); |
