stripped_mod: bool,
deref_trait_did: Option<DefId>,
deref_mut_trait_did: Option<DefId>,
+ owned_box_did: Option<DefId>,
// In rare case where a structure is defined in one module but implemented
// in another, if the implementing module is parsed before defining module,
pub external_typarams: FxHashMap<DefId, String>,
pub deref_trait_did: Option<DefId>,
pub deref_mut_trait_did: Option<DefId>,
+ pub owned_box_did: Option<DefId>,
}
/// Helper struct to render all source code to HTML pages
external_typarams,
deref_trait_did,
deref_mut_trait_did,
+ owned_box_did,
} = renderinfo;
let external_paths = external_paths.into_iter()
traits: mem::replace(&mut krate.external_traits, FxHashMap()),
deref_trait_did: deref_trait_did,
deref_mut_trait_did: deref_mut_trait_did,
+ owned_box_did: owned_box_did,
typarams: external_typarams,
};
};
if let Some(self_ty) = self_type_opt {
- let by_mut_ref = match self_ty {
- SelfTy::SelfBorrowed(_lifetime, mutability) => {
- mutability == Mutability::Mutable
- },
+ let (by_mut_ref, by_box) = match self_ty {
+ SelfTy::SelfBorrowed(_, mutability) |
SelfTy::SelfExplicit(clean::BorrowedRef { mutability, .. }) => {
- mutability == Mutability::Mutable
+ (mutability == Mutability::Mutable, false)
+ },
+ SelfTy::SelfExplicit(clean::ResolvedPath { did, .. }) => {
+ (false, Some(did) == cache().owned_box_did)
},
- _ => false,
+ _ => (false, false),
};
- deref_mut_ || !by_mut_ref
+ (deref_mut_ || !by_mut_ref) && !by_box
} else {
false
}
pub fn by_explicit_ref(self: &Foo) {}
pub fn by_mut_ref(&mut self) {}
pub fn by_explicit_mut_ref(self: &mut Foo) {}
+ pub fn by_explicit_box(self: Box<Foo>) {}
+ pub fn by_explicit_self_box(self: Box<Self>) {}
pub fn static_foo() {}
}
// @has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)'
// @has - '//*[@id="by_explicit_mut_ref.v"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
// @has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
+// @!has - '//*[@id="by_explicit_box.v"]' 'fn by_explicit_box(self: Box<Foo>)'
+// @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
+// @!has - '//*[@id="by_explicit_self_box.v"]' 'fn by_explicit_self_box(self: Box<Self>)'
+// @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<Self>)'
// @!has - '//*[@id="static_foo.v"]' 'fn static_foo()'
// @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'
pub fn by_explicit_ref(self: &Foo) {}
pub fn by_mut_ref(&mut self) {}
pub fn by_explicit_mut_ref(self: &mut Foo) {}
+ pub fn by_explicit_box(self: Box<Foo>) {}
+ pub fn by_explicit_self_box(self: Box<Self>) {}
pub fn static_foo() {}
}
// @!has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)'
// @!has - '//*[@id="by_explicit_mut_ref.v"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
// @!has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
+// @!has - '//*[@id="by_explicit_box.v"]' 'fn by_explicit_box(self: Box<Foo>)'
+// @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
+// @!has - '//*[@id="by_explicit_self_box.v"]' 'fn by_explicit_self_box(self: Box<Self>)'
+// @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<Self>)'
// @!has - '//*[@id="static_foo.v"]' 'fn static_foo()'
// @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'