X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustdoc%2Fcore.rs;h=7da501ef6cb7412943201f6baae81de558d2120d;hb=4c8d00a3ec9cecfdff7b5da5a7157cc532e78ee2;hp=2a3bc5e99617f468375a834110a7e7cf45e431ed;hpb=bf54251f907c0979f14e955e0b4f3760ccba5317;p=rust.git diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 2a3bc5e9961..7da501ef6cb 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -44,7 +44,7 @@ pub struct DocContext<'tcx> { - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx>, pub resolver: Rc>>, /// The stack of module NodeIds up till this point pub crate_name: Option, @@ -67,13 +67,13 @@ pub struct DocContext<'tcx> { pub ct_substs: RefCell>, /// Table DefId of `impl Trait` in argument position -> bounds pub impl_trait_bounds: RefCell>>, - pub send_trait: Option, pub fake_def_ids: RefCell>, pub all_fake_def_ids: RefCell>, /// Auto-trait or blanket impls processed so far, as `(self_ty, trait_def_id)`. // FIXME(eddyb) make this a `ty::TraitRef<'tcx>` set. pub generated_synthetics: RefCell, DefId)>>, pub all_traits: Vec, + pub auto_traits: Vec, } impl<'tcx> DocContext<'tcx> { @@ -317,7 +317,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt // Ensure that rustdoc works even if rustc is feature-staged unstable_features: UnstableFeatures::Allow, actually_rustdoc: true, - debugging_opts: debugging_options.clone(), + debugging_opts: debugging_options, error_format, edition, describe_lints, @@ -367,15 +367,10 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt .collect() }; - let send_trait = if crate_name == Some("core".to_string()) { - clean::path_to_def_local(tcx, &[sym::marker, sym::Send]) - } else { - clean::path_to_def(tcx, &[sym::core, sym::marker, sym::Send]) - }; - let mut renderinfo = RenderInfo::default(); renderinfo.access_levels = access_levels; + let all_traits = tcx.all_traits(LOCAL_CRATE).to_vec(); let ctxt = DocContext { tcx, resolver, @@ -388,11 +383,13 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt lt_substs: Default::default(), ct_substs: Default::default(), impl_trait_bounds: Default::default(), - send_trait: send_trait, fake_def_ids: Default::default(), all_fake_def_ids: Default::default(), generated_synthetics: Default::default(), - all_traits: tcx.all_traits(LOCAL_CRATE).to_vec(), + auto_traits: all_traits.iter().cloned().filter(|trait_def_id| { + tcx.trait_is_auto(*trait_def_id) + }).collect(), + all_traits, }; debug!("crate: {:?}", tcx.hir().krate());