Skip to content

Commit d10e2f4

Browse files
committed
Move some TyCtxt trait methods close together
1 parent e3514bd commit d10e2f4

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

compiler/rustc_middle/src/ty/context.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3411,19 +3411,6 @@ impl<'tcx> TyCtxt<'tcx> {
34113411
crate::dep_graph::make_metadata(self)
34123412
}
34133413

3414-
/// Given an `impl_id`, return the trait it implements.
3415-
/// Return `None` if this is an inherent impl.
3416-
pub fn impl_trait_ref(
3417-
self,
3418-
def_id: impl IntoQueryParam<DefId>,
3419-
) -> Option<ty::EarlyBinder<'tcx, ty::TraitRef<'tcx>>> {
3420-
Some(self.impl_trait_header(def_id)?.trait_ref)
3421-
}
3422-
3423-
pub fn impl_polarity(self, def_id: impl IntoQueryParam<DefId>) -> ty::ImplPolarity {
3424-
self.impl_trait_header(def_id).map_or(ty::ImplPolarity::Positive, |h| h.polarity)
3425-
}
3426-
34273414
pub fn needs_coroutine_by_move_body_def_id(self, def_id: DefId) -> bool {
34283415
if let Some(hir::CoroutineKind::Desugared(_, hir::CoroutineSource::Closure)) =
34293416
self.coroutine_kind(def_id)

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,6 +2005,19 @@ impl<'tcx> TyCtxt<'tcx> {
20052005
self.assoc_parent(def_id).filter(|id| matches!(self.def_kind(id), DefKind::Impl { .. }))
20062006
}
20072007

2008+
pub fn impl_polarity(self, def_id: impl IntoQueryParam<DefId>) -> ty::ImplPolarity {
2009+
self.impl_trait_header(def_id).map_or(ty::ImplPolarity::Positive, |h| h.polarity)
2010+
}
2011+
2012+
/// Given an `impl_id`, return the trait it implements.
2013+
/// Return `None` if this is an inherent impl.
2014+
pub fn impl_trait_ref(
2015+
self,
2016+
def_id: impl IntoQueryParam<DefId>,
2017+
) -> Option<ty::EarlyBinder<'tcx, ty::TraitRef<'tcx>>> {
2018+
Some(self.impl_trait_header(def_id)?.trait_ref)
2019+
}
2020+
20082021
pub fn is_exportable(self, def_id: DefId) -> bool {
20092022
self.exportable_items(def_id.krate).contains(&def_id)
20102023
}

0 commit comments

Comments
 (0)