@@ -51,6 +51,7 @@ use rustc_hir::def::CtorKind;
51
51
use rustc_hir:: def_id:: DefId ;
52
52
use rustc_hir:: Mutability ;
53
53
use rustc_middle:: middle:: stability;
54
+ use rustc_middle:: ty:: TyCtxt ;
54
55
use rustc_span:: symbol:: { kw, sym, Symbol } ;
55
56
use serde:: ser:: SerializeSeq ;
56
57
use serde:: { Serialize , Serializer } ;
@@ -1165,7 +1166,7 @@ fn render_deref_methods(
1165
1166
}
1166
1167
}
1167
1168
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 {
1169
1170
let self_type_opt = match * item. kind {
1170
1171
clean:: MethodItem ( ref method, _) => method. decl . self_type ( ) ,
1171
1172
clean:: TyMethodItem ( ref method) => method. decl . self_type ( ) ,
@@ -1179,7 +1180,7 @@ fn should_render_item(item: &clean::Item, deref_mut_: bool, cx: &Context<'_>) ->
1179
1180
( mutability == Mutability :: Mut , false , false )
1180
1181
}
1181
1182
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 )
1183
1184
}
1184
1185
SelfTy :: SelfValue => ( false , false , true ) ,
1185
1186
_ => ( false , false , false ) ,
@@ -1302,7 +1303,7 @@ fn render_impl(
1302
1303
&& match render_mode {
1303
1304
RenderMode :: Normal => true ,
1304
1305
RenderMode :: ForDeref { mut_ : deref_mut_ } => {
1305
- should_render_item ( & item, deref_mut_, cx)
1306
+ should_render_item ( & item, deref_mut_, cx. tcx ( ) )
1306
1307
}
1307
1308
} ;
1308
1309
@@ -1800,13 +1801,13 @@ fn get_methods(
1800
1801
for_deref : bool ,
1801
1802
used_links : & mut FxHashSet < String > ,
1802
1803
deref_mut : bool ,
1803
- cx : & Context < ' _ > ,
1804
+ tcx : TyCtxt < ' _ > ,
1804
1805
) -> Vec < String > {
1805
1806
i. items
1806
1807
. iter ( )
1807
1808
. filter_map ( |item| match item. name {
1808
1809
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 ) {
1810
1811
Some ( format ! (
1811
1812
"<a href=\" #{}\" >{}</a>" ,
1812
1813
get_next_url( used_links, format!( "method.{}" , name) ) ,
@@ -1868,7 +1869,9 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) {
1868
1869
let mut ret = v
1869
1870
. iter ( )
1870
1871
. 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
+ } )
1872
1875
. collect :: < Vec < _ > > ( ) ;
1873
1876
if !ret. is_empty ( ) {
1874
1877
// 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
2001
2004
let mut ret = impls
2002
2005
. iter ( )
2003
2006
. 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
+ } )
2005
2010
. collect :: < Vec < _ > > ( ) ;
2006
2011
if !ret. is_empty ( ) {
2007
2012
write ! (
0 commit comments