Skip to content

Commit cca46fd

Browse files
committed
Move some TyCtxt trait methods close together
1 parent 5df526a commit cca46fd

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
@@ -3522,19 +3522,6 @@ impl<'tcx> TyCtxt<'tcx> {
35223522
crate::dep_graph::make_metadata(self)
35233523
}
35243524

3525-
/// Given an `impl_id`, return the trait it implements.
3526-
/// Return `None` if this is an inherent impl.
3527-
pub fn impl_trait_ref(
3528-
self,
3529-
def_id: impl IntoQueryParam<DefId>,
3530-
) -> Option<ty::EarlyBinder<'tcx, ty::TraitRef<'tcx>>> {
3531-
Some(self.impl_trait_header(def_id)?.trait_ref)
3532-
}
3533-
3534-
pub fn impl_polarity(self, def_id: impl IntoQueryParam<DefId>) -> ty::ImplPolarity {
3535-
self.impl_trait_header(def_id).map_or(ty::ImplPolarity::Positive, |h| h.polarity)
3536-
}
3537-
35383525
pub fn needs_coroutine_by_move_body_def_id(self, def_id: DefId) -> bool {
35393526
if let Some(hir::CoroutineKind::Desugared(_, hir::CoroutineSource::Closure)) =
35403527
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
@@ -1970,6 +1970,19 @@ impl<'tcx> TyCtxt<'tcx> {
19701970
}
19711971
}
19721972

1973+
pub fn impl_polarity(self, def_id: impl IntoQueryParam<DefId>) -> ty::ImplPolarity {
1974+
self.impl_trait_header(def_id).map_or(ty::ImplPolarity::Positive, |h| h.polarity)
1975+
}
1976+
1977+
/// Given an `impl_id`, return the trait it implements.
1978+
/// Return `None` if this is an inherent impl.
1979+
pub fn impl_trait_ref(
1980+
self,
1981+
def_id: impl IntoQueryParam<DefId>,
1982+
) -> Option<ty::EarlyBinder<'tcx, ty::TraitRef<'tcx>>> {
1983+
Some(self.impl_trait_header(def_id)?.trait_ref)
1984+
}
1985+
19731986
pub fn is_exportable(self, def_id: DefId) -> bool {
19741987
self.exportable_items(def_id.krate).contains(&def_id)
19751988
}

0 commit comments

Comments
 (0)