Skip to content

Commit

Permalink
Run rustfmt --file-lines ... for changes from previous commits.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Jun 12, 2019
1 parent 21ac960 commit fff08cb
Show file tree
Hide file tree
Showing 176 changed files with 2,212 additions and 2,132 deletions.
3 changes: 1 addition & 2 deletions src/librustc/cfg/construct.rs
Expand Up @@ -30,8 +30,7 @@ struct LoopScope {
break_index: CFGIndex, // where to go on a `break`
}

pub fn construct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
body: &hir::Body) -> CFG {
pub fn construct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &hir::Body) -> CFG {
let mut graph = graph::Graph::new();
let entry = graph.add_node(CFGNodeData::Entry);

Expand Down
3 changes: 1 addition & 2 deletions src/librustc/cfg/mod.rs
Expand Up @@ -49,8 +49,7 @@ pub type CFGNode = graph::Node<CFGNodeData>;
pub type CFGEdge = graph::Edge<CFGEdgeData>;

impl CFG {
pub fn new<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
body: &hir::Body) -> CFG {
pub fn new<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &hir::Body) -> CFG {
construct::construct(tcx, body)
}

Expand Down
3 changes: 2 additions & 1 deletion src/librustc/dep_graph/dep_node.rs
Expand Up @@ -480,7 +480,8 @@ trait DepNodeParams<'gcx: 'tcx, 'tcx>: fmt::Debug {
}

impl<'gcx: 'tcx, 'tcx, T> DepNodeParams<'gcx, 'tcx> for T
where T: HashStable<StableHashingContext<'tcx>> + fmt::Debug
where
T: HashStable<StableHashingContext<'tcx>> + fmt::Debug,
{
default const CAN_RECONSTRUCT_QUERY_KEY: bool = false;

Expand Down
7 changes: 3 additions & 4 deletions src/librustc/dep_graph/graph.rs
Expand Up @@ -90,7 +90,6 @@ where
}

impl DepGraph {

pub fn new(prev_graph: PreviousDepGraph,
prev_work_products: FxHashMap<WorkProductId, WorkProduct>) -> DepGraph {
let prev_graph_node_count = prev_graph.node_count();
Expand Down Expand Up @@ -559,7 +558,7 @@ impl DepGraph {
pub fn try_mark_green_and_read(
&self,
tcx: TyCtxt<'_, '_>,
dep_node: &DepNode
dep_node: &DepNode,
) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> {
self.try_mark_green(tcx, dep_node).map(|(prev_index, dep_node_index)| {
debug_assert!(self.is_green(&dep_node));
Expand All @@ -571,7 +570,7 @@ impl DepGraph {
pub fn try_mark_green(
&self,
tcx: TyCtxt<'_, '_>,
dep_node: &DepNode
dep_node: &DepNode,
) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> {
debug_assert!(!dep_node.kind.is_eval_always());

Expand Down Expand Up @@ -607,7 +606,7 @@ impl DepGraph {
tcx: TyCtxt<'tcx, 'tcx>,
data: &DepGraphData,
prev_dep_node_index: SerializedDepNodeIndex,
dep_node: &DepNode
dep_node: &DepNode,
) -> Option<DepNodeIndex> {
debug!("try_mark_previous_green({:?}) - BEGIN", dep_node);

Expand Down
3 changes: 1 addition & 2 deletions src/librustc/dep_graph/safe.rs
Expand Up @@ -33,8 +33,7 @@ impl DepGraphSafe for DefId {

/// The type context itself can be used to access all kinds of tracked
/// state, but those accesses should always generate read events.
impl<'gcx, 'tcx> DepGraphSafe for TyCtxt<'gcx, 'tcx> {
}
impl<'gcx, 'tcx> DepGraphSafe for TyCtxt<'gcx, 'tcx> {}

/// Tuples make it easy to build up state.
impl<A, B> DepGraphSafe for (A, B)
Expand Down
6 changes: 1 addition & 5 deletions src/librustc/infer/canonical/substitute.rs
Expand Up @@ -14,11 +14,7 @@ use crate::ty::{self, TyCtxt};
impl<'tcx, V> Canonical<'tcx, V> {
/// Instantiate the wrapped value, replacing each canonical value
/// with the value given in `var_values`.
pub fn substitute(
&self,
tcx: TyCtxt<'_, 'tcx>,
var_values: &CanonicalVarValues<'tcx>,
) -> V
pub fn substitute(&self, tcx: TyCtxt<'_, 'tcx>, var_values: &CanonicalVarValues<'tcx>) -> V
where
V: TypeFoldable<'tcx>,
{
Expand Down
14 changes: 8 additions & 6 deletions src/librustc/infer/combine.rs
Expand Up @@ -58,12 +58,14 @@ pub enum RelationDir {
}

impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> {
pub fn super_combine_tys<R>(&self,
relation: &mut R,
a: Ty<'tcx>,
b: Ty<'tcx>)
-> RelateResult<'tcx, Ty<'tcx>>
where R: TypeRelation<'gcx, 'tcx>
pub fn super_combine_tys<R>(
&self,
relation: &mut R,
a: Ty<'tcx>,
b: Ty<'tcx>,
) -> RelateResult<'tcx, Ty<'tcx>>
where
R: TypeRelation<'gcx, 'tcx>,
{
let a_is_expected = relation.a_is_expected();

Expand Down
Expand Up @@ -338,7 +338,10 @@ impl NiceRegionError<'me, 'gcx, 'tcx> {
}

impl<'gcx, 'tcx, T> fmt::Display for Highlighted<'gcx, 'tcx, T>
where T: for<'a, 'b, 'c> Print<'gcx, 'tcx,
where
T: for<'a, 'b, 'c> Print<
'gcx,
'tcx,
FmtPrinter<'a, 'gcx, 'tcx, &'b mut fmt::Formatter<'c>>,
Error = fmt::Error,
>,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/lattice.rs
Expand Up @@ -27,7 +27,7 @@ use crate::ty::TyVar;
use crate::ty::{self, Ty};
use crate::ty::relate::{RelateResult, TypeRelation};

pub trait LatticeDir<'f, 'gcx: 'f+'tcx, 'tcx: 'f> : TypeRelation<'gcx, 'tcx> {
pub trait LatticeDir<'f, 'gcx: 'f + 'tcx, 'tcx: 'f>: TypeRelation<'gcx, 'tcx> {
fn infcx(&self) -> &'f InferCtxt<'f, 'gcx, 'tcx>;

fn cause(&self) -> &ObligationCause<'tcx>;
Expand Down
11 changes: 6 additions & 5 deletions src/librustc/infer/outlives/free_region_map.rs
Expand Up @@ -28,11 +28,12 @@ impl<'tcx> FreeRegionMap<'tcx> {
/// cases, this is more conservative than necessary, in order to
/// avoid making arbitrary choices. See
/// `TransitiveRelation::postdom_upper_bound` for more details.
pub fn lub_free_regions<'gcx>(&self,
tcx: TyCtxt<'gcx, 'tcx>,
r_a: Region<'tcx>,
r_b: Region<'tcx>)
-> Region<'tcx> {
pub fn lub_free_regions<'gcx>(
&self,
tcx: TyCtxt<'gcx, 'tcx>,
r_a: Region<'tcx>,
r_b: Region<'tcx>,
) -> Region<'tcx> {
debug!("lub_free_regions(r_a={:?}, r_b={:?})", r_a, r_b);
assert!(is_free(r_a));
assert!(is_free(r_b));
Expand Down
7 changes: 2 additions & 5 deletions src/librustc/lint/context.rs
Expand Up @@ -1423,10 +1423,7 @@ pub fn late_lint_mod<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
}
}

fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
tcx: TyCtxt<'tcx, 'tcx>,
pass: T
) {
fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(tcx: TyCtxt<'tcx, 'tcx>, pass: T) {
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);

let krate = tcx.hir().krate();
Expand Down Expand Up @@ -1461,7 +1458,7 @@ fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(

fn late_lint_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
tcx: TyCtxt<'tcx, 'tcx>,
builtin_lints: T
builtin_lints: T,
) {
let mut passes = tcx.sess.lint_store.borrow().late_passes.lock().take().unwrap();

Expand Down
4 changes: 1 addition & 3 deletions src/librustc/lint/mod.rs
Expand Up @@ -766,9 +766,7 @@ pub fn maybe_lint_level_root(tcx: TyCtxt<'_, '_>, id: hir::HirId) -> bool {
attrs.iter().any(|attr| Level::from_symbol(attr.name_or_empty()).is_some())
}

fn lint_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum)
-> &'tcx LintLevelMap
{
fn lint_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum) -> &'tcx LintLevelMap {
assert_eq!(cnum, LOCAL_CRATE);
let mut builder = LintLevelMapBuilder {
levels: LintLevelSets::builder(tcx.sess),
Expand Down
8 changes: 2 additions & 6 deletions src/librustc/middle/cstore.rs
Expand Up @@ -211,9 +211,7 @@ pub trait CrateStore {
fn crates_untracked(&self) -> Vec<CrateNum>;

// utility functions
fn encode_metadata<'tcx>(&self,
tcx: TyCtxt<'tcx, 'tcx>)
-> EncodedMetadata;
fn encode_metadata<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> EncodedMetadata;
fn metadata_encoding_version(&self) -> &[u8];
}

Expand All @@ -228,9 +226,7 @@ pub type CrateStoreDyn = dyn CrateStore + sync::Sync;
// In order to get this left-to-right dependency ordering, we perform a
// topological sort of all crates putting the leaves at the right-most
// positions.
pub fn used_crates(tcx: TyCtxt<'_, '_>, prefer: LinkagePreference)
-> Vec<(CrateNum, LibSource)>
{
pub fn used_crates(tcx: TyCtxt<'_, '_>, prefer: LinkagePreference) -> Vec<(CrateNum, LibSource)> {
let mut libs = tcx.crates()
.iter()
.cloned()
Expand Down
20 changes: 11 additions & 9 deletions src/librustc/middle/dead.rs
Expand Up @@ -26,8 +26,7 @@ use syntax_pos;
// explored. For example, if it's a live Node::Item that is a
// function, then we should explore its block to check for codes that
// may need to be marked as live.
fn should_explore<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
hir_id: hir::HirId) -> bool {
fn should_explore<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_id: hir::HirId) -> bool {
match tcx.hir().find_by_hir_id(hir_id) {
Some(Node::Item(..)) |
Some(Node::ImplItem(..)) |
Expand Down Expand Up @@ -302,9 +301,11 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
}
}

fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_>,
id: hir::HirId,
attrs: &[ast::Attribute]) -> bool {
fn has_allow_dead_code_or_lang_attr(
tcx: TyCtxt<'_, '_>,
id: hir::HirId,
attrs: &[ast::Attribute],
) -> bool {
if attr::contains_name(attrs, sym::lang) {
return true;
}
Expand Down Expand Up @@ -451,10 +452,11 @@ fn create_and_seed_worklist<'tcx>(
(life_seeder.worklist, life_seeder.struct_constructors)
}

fn find_live<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
access_levels: &privacy::AccessLevels,
krate: &hir::Crate)
-> FxHashSet<hir::HirId> {
fn find_live<'tcx>(
tcx: TyCtxt<'tcx, 'tcx>,
access_levels: &privacy::AccessLevels,
krate: &hir::Crate,
) -> FxHashSet<hir::HirId> {
let (worklist, struct_constructors) = create_and_seed_worklist(tcx, access_levels, krate);
let mut symbol_visitor = MarkSymbolVisitor {
worklist,
Expand Down
14 changes: 7 additions & 7 deletions src/librustc/middle/dependency_format.rs
Expand Up @@ -92,9 +92,7 @@ pub fn calculate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) {
sess.dependency_formats.set(fmts);
}

fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
ty: config::CrateType) -> DependencyList {

fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: config::CrateType) -> DependencyList {
let sess = &tcx.sess;

if !sess.opts.output_types.should_codegen() {
Expand Down Expand Up @@ -242,10 +240,12 @@ fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
ret
}

fn add_library(tcx: TyCtxt<'_, '_>,
cnum: CrateNum,
link: LinkagePreference,
m: &mut FxHashMap<CrateNum, LinkagePreference>) {
fn add_library(
tcx: TyCtxt<'_, '_>,
cnum: CrateNum,
link: LinkagePreference,
m: &mut FxHashMap<CrateNum, LinkagePreference>,
) {
match m.get(&cnum) {
Some(&link2) => {
// If the linkages differ, then we'd have two copies of the library
Expand Down
13 changes: 6 additions & 7 deletions src/librustc/middle/exported_symbols.rs
Expand Up @@ -38,9 +38,7 @@ pub enum ExportedSymbol<'tcx> {
}

impl<'tcx> ExportedSymbol<'tcx> {
pub fn symbol_name(&self,
tcx: TyCtxt<'tcx, '_>)
-> ty::SymbolName {
pub fn symbol_name(&self, tcx: TyCtxt<'tcx, '_>) -> ty::SymbolName {
match *self {
ExportedSymbol::NonGeneric(def_id) => {
tcx.symbol_name(ty::Instance::mono(tcx, def_id))
Expand All @@ -54,10 +52,11 @@ impl<'tcx> ExportedSymbol<'tcx> {
}
}

pub fn compare_stable(&self,
tcx: TyCtxt<'tcx, '_>,
other: &ExportedSymbol<'tcx>)
-> cmp::Ordering {
pub fn compare_stable(
&self,
tcx: TyCtxt<'tcx, '_>,
other: &ExportedSymbol<'tcx>,
) -> cmp::Ordering {
match *self {
ExportedSymbol::NonGeneric(self_def_id) => match *other {
ExportedSymbol::NonGeneric(other_def_id) => {
Expand Down
18 changes: 9 additions & 9 deletions src/librustc/middle/expr_use_visitor.rs
Expand Up @@ -266,15 +266,15 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx, 'tcx> {
/// `None` means that rvalues will be given more conservative lifetimes.
///
/// See also `with_infer`, which is used *during* typeck.
pub fn new(delegate: &'a mut (dyn Delegate<'tcx>+'a),
tcx: TyCtxt<'tcx, 'tcx>,
body_owner: DefId,
param_env: ty::ParamEnv<'tcx>,
region_scope_tree: &'a region::ScopeTree,
tables: &'a ty::TypeckTables<'tcx>,
rvalue_promotable_map: Option<&'tcx ItemLocalSet>)
-> Self
{
pub fn new(
delegate: &'a mut (dyn Delegate<'tcx> + 'a),
tcx: TyCtxt<'tcx, 'tcx>,
body_owner: DefId,
param_env: ty::ParamEnv<'tcx>,
region_scope_tree: &'a region::ScopeTree,
tables: &'a ty::TypeckTables<'tcx>,
rvalue_promotable_map: Option<&'tcx ItemLocalSet>,
) -> Self {
ExprUseVisitor {
mc: mc::MemCategorizationContext::new(tcx,
body_owner,
Expand Down
6 changes: 2 additions & 4 deletions src/librustc/middle/intrinsicck.rs
Expand Up @@ -25,7 +25,7 @@ pub fn provide(providers: &mut Providers<'_>) {
}

struct ItemVisitor<'tcx> {
tcx: TyCtxt<'tcx, 'tcx>
tcx: TyCtxt<'tcx, 'tcx>,
}

struct ExprVisitor<'tcx> {
Expand All @@ -36,9 +36,7 @@ struct ExprVisitor<'tcx> {

/// If the type is `Option<T>`, it will return `T`, otherwise
/// the type itself. Works on most `Option`-like types.
fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
ty: Ty<'tcx>)
-> Ty<'tcx> {
fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
let (def, substs) = match ty.sty {
ty::Adt(def, substs) => (def, substs),
_ => return ty
Expand Down
14 changes: 8 additions & 6 deletions src/librustc/middle/liveness.rs
Expand Up @@ -352,12 +352,14 @@ impl IrMaps<'tcx> {
}
}

fn visit_fn<'a, 'tcx: 'a>(ir: &mut IrMaps<'tcx>,
fk: FnKind<'tcx>,
decl: &'tcx hir::FnDecl,
body_id: hir::BodyId,
sp: Span,
id: hir::HirId) {
fn visit_fn<'a, 'tcx: 'a>(
ir: &mut IrMaps<'tcx>,
fk: FnKind<'tcx>,
decl: &'tcx hir::FnDecl,
body_id: hir::BodyId,
sp: Span,
id: hir::HirId,
) {
debug!("visit_fn");

// swap in a new set of IR maps for this function body:
Expand Down

0 comments on commit fff08cb

Please sign in to comment.