Skip to content

Commit

Permalink
Make it 1.26.0 compatible again
Browse files Browse the repository at this point in the history
  • Loading branch information
vorner committed Aug 9, 2019
1 parent b29e570 commit d2119fc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
17 changes: 9 additions & 8 deletions src/access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use std::ops::Deref;
use std::rc::Rc;
use std::sync::Arc;

use crate::gen_lock::LockStorage;
use crate::ref_cnt::RefCnt;
use crate::{ArcSwapAny, Guard};
use super::gen_lock::LockStorage;
use super::ref_cnt::RefCnt;
use super::{ArcSwapAny, Guard};

/// TODO
pub trait Access<T> {
Expand Down Expand Up @@ -65,7 +65,7 @@ impl<T, S: LockStorage> Access<T> for ArcSwapAny<Rc<T>, S> {
}

/// TODO
pub struct DynGuard<T: ?Sized>(Box<dyn Deref<Target = T>>);
pub struct DynGuard<T: ?Sized>(Box<Deref<Target = T>>);

impl<T: ?Sized> Deref for DynGuard<T> {
type Target = T;
Expand Down Expand Up @@ -127,7 +127,8 @@ pub struct Map<A, T, F> {
}

impl<A, T, F> Map<A, T, F> {
pub(crate) fn new<R>(access: A, projection: F) -> Self
/// TODO
pub fn new<R>(access: A, projection: F) -> Self
where
F: Fn(&T) -> &R,
{
Expand Down Expand Up @@ -157,7 +158,7 @@ where

#[cfg(test)]
mod tests {
use crate::{ArcSwap, ArcSwapOption};
use super::super::{ArcSwap, ArcSwapOption};

use super::*;

Expand All @@ -178,11 +179,11 @@ mod tests {
check_static_dispatch(a);
}

fn check_dyn_dispatch_direct(a: &dyn DynAccess<usize>) {
fn check_dyn_dispatch_direct(a: &DynAccess<usize>) {
assert!(42 == *a.load());
}

fn check_dyn_dispatch(a: &dyn DynAccess<Arc<usize>>) {
fn check_dyn_dispatch(a: &DynAccess<Arc<usize>>) {
assert!(42 == **a.load());
}

Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
test(attr(deny(warnings)))
)]
#![deny(missing_docs, warnings)]
#![allow(renamed_and_removed_lints)]
// We aim at older rust too, one without dyn
#![allow(unknown_lints, bare_trait_objects, renamed_and_removed_lints)]
#![cfg_attr(feature = "unstable-weak", feature(weak_into_raw))]
// TODO: The docs might want some rewrite and cleanup too. This is quite a mouthful for
// *introduction* to the library.
Expand Down

0 comments on commit d2119fc

Please sign in to comment.