Skip to content

rustc_ast_lowering: misc cleanup & rustc dep reductions #67922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jan 10, 2020
2 changes: 1 addition & 1 deletion src/librustc/infer/canonical/query_response.rs
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ use crate::traits::{Obligation, ObligationCause, PredicateObligation};
use crate::ty::fold::TypeFoldable;
use crate::ty::subst::{GenericArg, GenericArgKind};
use crate::ty::{self, BoundVar, Ty, TyCtxt};
use crate::util::captures::Captures;
use rustc_data_structures::captures::Captures;
use rustc_index::vec::Idx;
use rustc_index::vec::IndexVec;
use rustc_span::DUMMY_SP;
2 changes: 1 addition & 1 deletion src/librustc/infer/outlives/verify.rs
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ use crate::infer::{GenericKind, VerifyBound};
use crate::traits;
use crate::ty::subst::{InternalSubsts, Subst};
use crate::ty::{self, Ty, TyCtxt};
use crate::util::captures::Captures;
use rustc_data_structures::captures::Captures;
use rustc_hir::def_id::DefId;

/// The `TypeOutlives` struct has the job of "lowering" a `T: 'a`
1 change: 0 additions & 1 deletion src/librustc/lib.rs
Original file line number Diff line number Diff line change
@@ -100,7 +100,6 @@ pub mod ty;

pub mod util {
pub mod bug;
pub mod captures;
pub mod common;
}

5 changes: 2 additions & 3 deletions src/librustc/middle/cstore.rs
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@
use crate::hir::map as hir_map;
use crate::hir::map::definitions::{DefKey, DefPathTable};
use crate::session::search_paths::PathKind;
use crate::session::{CrateDisambiguator, Session};
use crate::ty::{self, TyCtxt};
use crate::session::CrateDisambiguator;
use crate::ty::TyCtxt;

use rustc_data_structures::svh::Svh;
use rustc_data_structures::sync::{self, MetadataRef};
@@ -208,7 +208,6 @@ pub trait CrateStore {
fn crate_is_private_dep_untracked(&self, cnum: CrateNum) -> bool;
fn crate_disambiguator_untracked(&self, cnum: CrateNum) -> CrateDisambiguator;
fn crate_hash_untracked(&self, cnum: CrateNum) -> Svh;
fn item_generics_cloned_untracked(&self, def: DefId, sess: &Session) -> ty::Generics;

// This is basically a 1-based range of ints, which is a little
// silly - I may fix that.
3 changes: 1 addition & 2 deletions src/librustc/traits/project.rs
Original file line number Diff line number Diff line change
@@ -17,7 +17,6 @@ use crate::infer::{InferCtxt, InferOk, LateBoundRegionConversionTime};
use crate::ty::fold::{TypeFoldable, TypeFolder};
use crate::ty::subst::{InternalSubsts, Subst};
use crate::ty::{self, ToPolyTraitRef, ToPredicate, Ty, TyCtxt};
use crate::util::common::FN_OUTPUT_NAME;
use rustc_data_structures::snapshot_map::{Snapshot, SnapshotMap};
use rustc_hir::def_id::DefId;
use rustc_macros::HashStable;
@@ -1364,7 +1363,7 @@ fn confirm_callable_candidate<'cx, 'tcx>(
projection_ty: ty::ProjectionTy::from_ref_and_name(
tcx,
trait_ref,
Ident::with_dummy_span(FN_OUTPUT_NAME),
Ident::with_dummy_span(rustc_hir::FN_OUTPUT_NAME),
),
ty: ret_type,
});
2 changes: 1 addition & 1 deletion src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
@@ -26,8 +26,8 @@ use crate::ty::layout::VariantIdx;
use crate::ty::subst::{InternalSubsts, Subst, SubstsRef};
use crate::ty::util::{Discr, IntTypeExt};
use crate::ty::walk::TypeWalker;
use crate::util::captures::Captures;
use arena::SyncDroplessArena;
use rustc_data_structures::captures::Captures;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
5 changes: 2 additions & 3 deletions src/librustc/ty/sty.rs
Original file line number Diff line number Diff line change
@@ -13,11 +13,10 @@ use crate::ty::layout::VariantIdx;
use crate::ty::subst::{GenericArg, GenericArgKind, InternalSubsts, Subst, SubstsRef};
use crate::ty::{self, AdtDef, DefIdTree, Discr, Ty, TyCtxt, TypeFlags, TypeFoldable};
use crate::ty::{List, ParamEnv, ParamEnvAnd, TyS};
use crate::util::captures::Captures;
use polonius_engine::Atom;
use rustc_data_structures::captures::Captures;
use rustc_hir as hir;
use rustc_hir::def_id::DefId;

use polonius_engine::Atom;
use rustc_index::vec::Idx;
use rustc_macros::HashStable;
use rustc_span::symbol::{kw, Symbol};
5 changes: 0 additions & 5 deletions src/librustc/util/common.rs
Original file line number Diff line number Diff line change
@@ -5,14 +5,9 @@ use rustc_data_structures::sync::Lock;
use std::fmt::Debug;
use std::time::{Duration, Instant};

use rustc_span::symbol::{sym, Symbol};

#[cfg(test)]
mod tests;

// The name of the associated type for `Fn` return types.
pub const FN_OUTPUT_NAME: Symbol = sym::Output;

pub use errors::ErrorReported;

pub fn to_readable_str(mut val: usize) -> String {
11 changes: 4 additions & 7 deletions src/librustc_ast_lowering/item.rs
Original file line number Diff line number Diff line change
@@ -25,19 +25,16 @@ pub(super) struct ItemLowerer<'a, 'lowering, 'hir> {
pub(super) lctx: &'a mut LoweringContext<'lowering, 'hir>,
}

impl<'a, 'lowering, 'hir> ItemLowerer<'a, 'lowering, 'hir> {
fn with_trait_impl_ref<F>(&mut self, trait_impl_ref: &Option<TraitRef>, f: F)
where
F: FnOnce(&mut Self),
{
impl ItemLowerer<'_, '_, '_> {
fn with_trait_impl_ref(&mut self, impl_ref: &Option<TraitRef>, f: impl FnOnce(&mut Self)) {
let old = self.lctx.is_in_trait_impl;
self.lctx.is_in_trait_impl = if let &None = trait_impl_ref { false } else { true };
self.lctx.is_in_trait_impl = if let &None = impl_ref { false } else { true };
f(self);
self.lctx.is_in_trait_impl = old;
}
}

impl<'a, 'lowering, 'hir> Visitor<'a> for ItemLowerer<'a, 'lowering, 'hir> {
impl<'a> Visitor<'a> for ItemLowerer<'a, '_, '_> {
fn visit_mod(&mut self, m: &'a Mod, _s: Span, _attrs: &[Attribute], n: NodeId) {
let hir_id = self.lctx.lower_node_id(n);

Loading