@@ -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 } ;
@@ -1067,13 +1068,13 @@ fn render_assoc_items(
10671068 return ;
10681069 }
10691070 if !traits. is_empty ( ) {
1070- let deref_impl = traits
1071- . iter ( )
1072- . find ( |t| t . inner_impl ( ) . trait_ . def_id_full ( cache ) == cache . deref_trait_did ) ;
1071+ let deref_impl = traits. iter ( ) . find ( |t| {
1072+ t . inner_impl ( ) . trait_ . def_id_full ( cache ) == cx . tcx ( ) . lang_items ( ) . deref_trait ( )
1073+ } ) ;
10731074 if let Some ( impl_) = deref_impl {
1074- let has_deref_mut = traits
1075- . iter ( )
1076- . any ( |t| t . inner_impl ( ) . trait_ . def_id_full ( cache ) == cache . deref_mut_trait_did ) ;
1075+ let has_deref_mut = traits. iter ( ) . any ( |t| {
1076+ t . inner_impl ( ) . trait_ . def_id_full ( cache ) == cx . tcx ( ) . lang_items ( ) . deref_mut_trait ( )
1077+ } ) ;
10771078 render_deref_methods ( w, cx, impl_, containing_item, has_deref_mut) ;
10781079 }
10791080 let ( synthetic, concrete) : ( Vec < & & Impl > , Vec < & & Impl > ) =
@@ -1163,7 +1164,7 @@ fn render_deref_methods(
11631164 }
11641165}
11651166
1166- fn should_render_item ( item : & clean:: Item , deref_mut_ : bool , cache : & Cache ) -> bool {
1167+ fn should_render_item ( item : & clean:: Item , deref_mut_ : bool , tcx : TyCtxt < ' _ > ) -> bool {
11671168 let self_type_opt = match * item. kind {
11681169 clean:: MethodItem ( ref method, _) => method. decl . self_type ( ) ,
11691170 clean:: TyMethodItem ( ref method) => method. decl . self_type ( ) ,
@@ -1177,7 +1178,7 @@ fn should_render_item(item: &clean::Item, deref_mut_: bool, cache: &Cache) -> bo
11771178 ( mutability == Mutability :: Mut , false , false )
11781179 }
11791180 SelfTy :: SelfExplicit ( clean:: ResolvedPath { did, .. } ) => {
1180- ( false , Some ( did) == cache . owned_box_did , false )
1181+ ( false , Some ( did) == tcx . lang_items ( ) . owned_box ( ) , false )
11811182 }
11821183 SelfTy :: SelfValue => ( false , false , true ) ,
11831184 _ => ( false , false , false ) ,
@@ -1300,7 +1301,7 @@ fn render_impl(
13001301 && match render_mode {
13011302 RenderMode :: Normal => true ,
13021303 RenderMode :: ForDeref { mut_ : deref_mut_ } => {
1303- should_render_item ( & item, deref_mut_, cx. cache ( ) )
1304+ should_render_item ( & item, deref_mut_, cx. tcx ( ) )
13041305 }
13051306 } ;
13061307
@@ -1798,13 +1799,13 @@ fn get_methods(
17981799 for_deref : bool ,
17991800 used_links : & mut FxHashSet < String > ,
18001801 deref_mut : bool ,
1801- cache : & Cache ,
1802+ tcx : TyCtxt < ' _ > ,
18021803) -> Vec < String > {
18031804 i. items
18041805 . iter ( )
18051806 . filter_map ( |item| match item. name {
18061807 Some ( ref name) if !name. is_empty ( ) && item. is_method ( ) => {
1807- if !for_deref || should_render_item ( item, deref_mut, cache ) {
1808+ if !for_deref || should_render_item ( item, deref_mut, tcx ) {
18081809 Some ( format ! (
18091810 "<a href=\" #{}\" >{}</a>" ,
18101811 get_next_url( used_links, format!( "method.{}" , name) ) ,
@@ -1866,7 +1867,9 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) {
18661867 let mut ret = v
18671868 . iter ( )
18681869 . filter ( |i| i. inner_impl ( ) . trait_ . is_none ( ) )
1869- . flat_map ( move |i| get_methods ( i. inner_impl ( ) , false , used_links_bor, false , cache) )
1870+ . flat_map ( move |i| {
1871+ get_methods ( i. inner_impl ( ) , false , used_links_bor, false , cx. tcx ( ) )
1872+ } )
18701873 . collect :: < Vec < _ > > ( ) ;
18711874 if !ret. is_empty ( ) {
18721875 // We want links' order to be reproducible so we don't use unstable sort.
@@ -1884,11 +1887,9 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) {
18841887 }
18851888
18861889 if v. iter ( ) . any ( |i| i. inner_impl ( ) . trait_ . is_some ( ) ) {
1887- if let Some ( impl_) = v
1888- . iter ( )
1889- . filter ( |i| i. inner_impl ( ) . trait_ . is_some ( ) )
1890- . find ( |i| i. inner_impl ( ) . trait_ . def_id_full ( cache) == cache. deref_trait_did )
1891- {
1890+ if let Some ( impl_) = v. iter ( ) . filter ( |i| i. inner_impl ( ) . trait_ . is_some ( ) ) . find ( |i| {
1891+ i. inner_impl ( ) . trait_ . def_id_full ( cache) == cx. tcx ( ) . lang_items ( ) . deref_trait ( )
1892+ } ) {
18921893 sidebar_deref_methods ( cx, out, impl_, v) ;
18931894 }
18941895
@@ -1986,10 +1987,9 @@ fn sidebar_deref_methods(cx: &Context<'_>, out: &mut Buffer, impl_: &Impl, v: &V
19861987 }
19871988 }
19881989 }
1989- let deref_mut = v
1990- . iter ( )
1991- . filter ( |i| i. inner_impl ( ) . trait_ . is_some ( ) )
1992- . any ( |i| i. inner_impl ( ) . trait_ . def_id_full ( c) == c. deref_mut_trait_did ) ;
1990+ let deref_mut = v. iter ( ) . filter ( |i| i. inner_impl ( ) . trait_ . is_some ( ) ) . any ( |i| {
1991+ i. inner_impl ( ) . trait_ . def_id_full ( c) == cx. tcx ( ) . lang_items ( ) . deref_mut_trait ( )
1992+ } ) ;
19931993 let inner_impl = target
19941994 . def_id_full ( c)
19951995 . or_else ( || {
@@ -2002,7 +2002,9 @@ fn sidebar_deref_methods(cx: &Context<'_>, out: &mut Buffer, impl_: &Impl, v: &V
20022002 let mut ret = impls
20032003 . iter ( )
20042004 . filter ( |i| i. inner_impl ( ) . trait_ . is_none ( ) )
2005- . flat_map ( |i| get_methods ( i. inner_impl ( ) , true , & mut used_links, deref_mut, c) )
2005+ . flat_map ( |i| {
2006+ get_methods ( i. inner_impl ( ) , true , & mut used_links, deref_mut, cx. tcx ( ) )
2007+ } )
20062008 . collect :: < Vec < _ > > ( ) ;
20072009 if !ret. is_empty ( ) {
20082010 write ! (
0 commit comments