@@ -262,6 +262,7 @@ pub struct Cache {
262
262
stripped_mod : bool ,
263
263
deref_trait_did : Option < DefId > ,
264
264
deref_mut_trait_did : Option < DefId > ,
265
+ owned_box_did : Option < DefId > ,
265
266
266
267
// In rare case where a structure is defined in one module but implemented
267
268
// in another, if the implementing module is parsed before defining module,
@@ -280,6 +281,7 @@ pub struct RenderInfo {
280
281
pub external_typarams : FxHashMap < DefId , String > ,
281
282
pub deref_trait_did : Option < DefId > ,
282
283
pub deref_mut_trait_did : Option < DefId > ,
284
+ pub owned_box_did : Option < DefId > ,
283
285
}
284
286
285
287
/// Helper struct to render all source code to HTML pages
@@ -507,6 +509,7 @@ pub fn run(mut krate: clean::Crate,
507
509
external_typarams,
508
510
deref_trait_did,
509
511
deref_mut_trait_did,
512
+ owned_box_did,
510
513
} = renderinfo;
511
514
512
515
let external_paths = external_paths. into_iter ( )
@@ -530,6 +533,7 @@ pub fn run(mut krate: clean::Crate,
530
533
traits : mem:: replace ( & mut krate. external_traits , FxHashMap ( ) ) ,
531
534
deref_trait_did : deref_trait_did,
532
535
deref_mut_trait_did : deref_mut_trait_did,
536
+ owned_box_did : owned_box_did,
533
537
typarams : external_typarams,
534
538
} ;
535
539
@@ -2933,17 +2937,18 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
2933
2937
} ;
2934
2938
2935
2939
if let Some ( self_ty) = self_type_opt {
2936
- let by_mut_ref = match self_ty {
2937
- SelfTy :: SelfBorrowed ( _lifetime, mutability) => {
2938
- mutability == Mutability :: Mutable
2939
- } ,
2940
+ let ( by_mut_ref, by_box) = match self_ty {
2941
+ SelfTy :: SelfBorrowed ( _, mutability) |
2940
2942
SelfTy :: SelfExplicit ( clean:: BorrowedRef { mutability, .. } ) => {
2941
- mutability == Mutability :: Mutable
2943
+ ( mutability == Mutability :: Mutable , false )
2944
+ } ,
2945
+ SelfTy :: SelfExplicit ( clean:: ResolvedPath { did, .. } ) => {
2946
+ ( false , Some ( did) == cache ( ) . owned_box_did )
2942
2947
} ,
2943
- _ => false ,
2948
+ _ => ( false , false ) ,
2944
2949
} ;
2945
2950
2946
- deref_mut_ || !by_mut_ref
2951
+ ( deref_mut_ || !by_mut_ref) && !by_box
2947
2952
} else {
2948
2953
false
2949
2954
}
0 commit comments