1
Fork 0

Adjusted types and visibility in auto trait machinery.

This commit is contained in:
Inokentiy Babushkin 2018-04-07 00:12:51 +02:00
parent 67c226aece
commit 0a4a85e8ae
No known key found for this signature in database
GPG key ID: 7EFC8EC5224DE8EC
2 changed files with 8 additions and 5 deletions

View file

@ -57,18 +57,21 @@ pub struct AutoTraitInfo<'cx> {
}
pub struct AutoTraitFinder<'a, 'tcx: 'a> {
pub tcx: &'a TyCtxt<'a, 'tcx, 'tcx>,
tcx: &'a TyCtxt<'a, 'tcx, 'tcx>,
}
impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
pub fn find_auto_trait_generics<A, F>(
pub fn new(tcx: &'a TyCtxt<'a, 'tcx, 'tcx>) -> Self {
AutoTraitFinder { tcx }
}
pub fn find_auto_trait_generics<A>(
&self,
did: DefId,
trait_did: DefId,
generics: &ty::Generics,
auto_trait_callback: F)
auto_trait_callback: impl for<'i> Fn(&InferCtxt<'_, 'tcx, 'i>, AutoTraitInfo<'i>) -> A)
-> AutoTraitResult<A>
where F: for<'b, 'cx, 'cx2> Fn(&InferCtxt<'b, 'cx, 'cx2>, AutoTraitInfo<'cx2>) -> A
{
let tcx = self.tcx;
let ty = self.tcx.type_of(did);

View file

@ -21,7 +21,7 @@ pub struct AutoTraitFinder<'a, 'tcx: 'a, 'rcx: 'a> {
impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> {
pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> Self {
let f = auto::AutoTraitFinder { tcx: &cx.tcx };
let f = auto::AutoTraitFinder::new(&cx.tcx);
AutoTraitFinder { cx, f }
}