diff --git a/src/librustc/traits/auto_trait.rs b/src/librustc/traits/auto_trait.rs index f2416eb7c8f2..2ee22d494e1c 100644 --- a/src/librustc/traits/auto_trait.rs +++ b/src/librustc/traits/auto_trait.rs @@ -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( + pub fn new(tcx: &'a TyCtxt<'a, 'tcx, 'tcx>) -> Self { + AutoTraitFinder { tcx } + } + + pub fn find_auto_trait_generics( &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 - 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); diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index d3e2dac72ee3..58ee42402d51 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -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 } }