Skip to content

Commit dcf76b6

Browse files
committed
Move some TyCtxt trait methods close together
1 parent 9b2c9a8 commit dcf76b6

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
@@ -3530,19 +3530,6 @@ impl<'tcx> TyCtxt<'tcx> {
35303530
crate::dep_graph::make_metadata(self)
35313531
}
35323532

3533-
/// Given an `impl_id`, return the trait it implements.
3534-
/// Return `None` if this is an inherent impl.
3535-
pub fn impl_trait_ref(
3536-
self,
3537-
def_id: impl IntoQueryParam<DefId>,
3538-
) -> Option<ty::EarlyBinder<'tcx, ty::TraitRef<'tcx>>> {
3539-
Some(self.impl_trait_header(def_id)?.trait_ref)
3540-
}
3541-
3542-
pub fn impl_polarity(self, def_id: impl IntoQueryParam<DefId>) -> ty::ImplPolarity {
3543-
self.impl_trait_header(def_id).map_or(ty::ImplPolarity::Positive, |h| h.polarity)
3544-
}
3545-
35463533
pub fn needs_coroutine_by_move_body_def_id(self, def_id: DefId) -> bool {
35473534
if let Some(hir::CoroutineKind::Desugared(_, hir::CoroutineSource::Closure)) =
35483535
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)