@@ -51,6 +51,7 @@ use rustc_hir::def::CtorKind;
5151use rustc_hir:: def_id:: DefId ;
5252use rustc_hir:: Mutability ;
5353use rustc_middle:: middle:: stability;
54+ use rustc_middle:: ty:: TyCtxt ;
5455use rustc_span:: symbol:: { kw, sym, Symbol } ;
5556use serde:: ser:: SerializeSeq ;
5657use serde:: { Serialize , Serializer } ;
@@ -1165,7 +1166,7 @@ fn render_deref_methods(
11651166 }
11661167}
11671168
1168- fn should_render_item ( item : & clean:: Item , deref_mut_ : bool , cx : & Context < ' _ > ) -> bool {
1169+ fn should_render_item ( item : & clean:: Item , deref_mut_ : bool , tcx : TyCtxt < ' _ > ) -> bool {
11691170 let self_type_opt = match * item. kind {
11701171 clean:: MethodItem ( ref method, _) => method. decl . self_type ( ) ,
11711172 clean:: TyMethodItem ( ref method) => method. decl . self_type ( ) ,
@@ -1179,7 +1180,7 @@ fn should_render_item(item: &clean::Item, deref_mut_: bool, cx: &Context<'_>) ->
11791180 ( mutability == Mutability :: Mut , false , false )
11801181 }
11811182 SelfTy :: SelfExplicit ( clean:: ResolvedPath { did, .. } ) => {
1182- ( false , Some ( did) == cx . tcx ( ) . lang_items ( ) . owned_box ( ) , false )
1183+ ( false , Some ( did) == tcx. lang_items ( ) . owned_box ( ) , false )
11831184 }
11841185 SelfTy :: SelfValue => ( false , false , true ) ,
11851186 _ => ( false , false , false ) ,
@@ -1302,7 +1303,7 @@ fn render_impl(
13021303 && match render_mode {
13031304 RenderMode :: Normal => true ,
13041305 RenderMode :: ForDeref { mut_ : deref_mut_ } => {
1305- should_render_item ( & item, deref_mut_, cx)
1306+ should_render_item ( & item, deref_mut_, cx. tcx ( ) )
13061307 }
13071308 } ;
13081309
@@ -1800,13 +1801,13 @@ fn get_methods(
18001801 for_deref : bool ,
18011802 used_links : & mut FxHashSet < String > ,
18021803 deref_mut : bool ,
1803- cx : & Context < ' _ > ,
1804+ tcx : TyCtxt < ' _ > ,
18041805) -> Vec < String > {
18051806 i. items
18061807 . iter ( )
18071808 . filter_map ( |item| match item. name {
18081809 Some ( ref name) if !name. is_empty ( ) && item. is_method ( ) => {
1809- if !for_deref || should_render_item ( item, deref_mut, cx ) {
1810+ if !for_deref || should_render_item ( item, deref_mut, tcx ) {
18101811 Some ( format ! (
18111812 "<a href=\" #{}\" >{}</a>" ,
18121813 get_next_url( used_links, format!( "method.{}" , name) ) ,
@@ -1868,7 +1869,9 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) {
18681869 let mut ret = v
18691870 . iter ( )
18701871 . filter ( |i| i. inner_impl ( ) . trait_ . is_none ( ) )
1871- . flat_map ( move |i| get_methods ( i. inner_impl ( ) , false , used_links_bor, false , cx) )
1872+ . flat_map ( move |i| {
1873+ get_methods ( i. inner_impl ( ) , false , used_links_bor, false , cx. tcx ( ) )
1874+ } )
18721875 . collect :: < Vec < _ > > ( ) ;
18731876 if !ret. is_empty ( ) {
18741877 // We want links' order to be reproducible so we don't use unstable sort.
@@ -2001,7 +2004,9 @@ fn sidebar_deref_methods(cx: &Context<'_>, out: &mut Buffer, impl_: &Impl, v: &V
20012004 let mut ret = impls
20022005 . iter ( )
20032006 . filter ( |i| i. inner_impl ( ) . trait_ . is_none ( ) )
2004- . flat_map ( |i| get_methods ( i. inner_impl ( ) , true , & mut used_links, deref_mut, cx) )
2007+ . flat_map ( |i| {
2008+ get_methods ( i. inner_impl ( ) , true , & mut used_links, deref_mut, cx. tcx ( ) )
2009+ } )
20052010 . collect :: < Vec < _ > > ( ) ;
20062011 if !ret. is_empty ( ) {
20072012 write ! (
0 commit comments