use field init shorthand in src/librustc

The field init shorthand syntax was stabilized in 1.17.0 (aebd94f); we
are now free to use it in the compiler.
This commit is contained in:
Zack M. Davis 2017-07-03 11:19:51 -07:00
parent 8cab2c73d4
commit f668999153
62 changed files with 374 additions and 374 deletions

View File

@ -58,11 +58,11 @@ pub fn construct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
let tables = tcx.typeck_tables_of(owner_def_id); let tables = tcx.typeck_tables_of(owner_def_id);
let mut cfg_builder = CFGBuilder { let mut cfg_builder = CFGBuilder {
tcx: tcx, tcx,
owner_def_id, owner_def_id,
tables: tables, tables,
graph: graph, graph,
fn_exit: fn_exit, fn_exit,
loop_scopes: Vec::new(), loop_scopes: Vec::new(),
breakable_block_scopes: Vec::new(), breakable_block_scopes: Vec::new(),
}; };
@ -70,8 +70,8 @@ pub fn construct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
cfg_builder.add_contained_edge(body_exit, fn_exit); cfg_builder.add_contained_edge(body_exit, fn_exit);
let CFGBuilder { graph, .. } = cfg_builder; let CFGBuilder { graph, .. } = cfg_builder;
CFG { CFG {
graph: graph, graph,
entry: entry, entry,
exit: fn_exit, exit: fn_exit,
} }
} }

View File

@ -36,7 +36,7 @@ impl<M: DepTrackingMapConfig> DepTrackingMap<M> {
pub fn new(graph: DepGraph) -> DepTrackingMap<M> { pub fn new(graph: DepGraph) -> DepTrackingMap<M> {
DepTrackingMap { DepTrackingMap {
phantom: PhantomData, phantom: PhantomData,
graph: graph, graph,
map: FxHashMap(), map: FxHashMap(),
} }
} }

View File

@ -36,8 +36,8 @@ impl DepGraphQuery {
} }
DepGraphQuery { DepGraphQuery {
graph: graph, graph,
indices: indices indices,
} }
} }

View File

@ -59,7 +59,7 @@ impl ShadowGraph {
ShadowGraph { ShadowGraph {
stack: RefCell::new(vec![]), stack: RefCell::new(vec![]),
forbidden_edge: forbidden_edge, forbidden_edge,
} }
} }

View File

@ -78,7 +78,7 @@ impl DepGraphThreadData {
} }
DepGraphThreadData { DepGraphThreadData {
enabled: enabled, enabled,
shadow_graph: ShadowGraph::new(), shadow_graph: ShadowGraph::new(),
messages: VecCell::with_capacity(INITIAL_CAPACITY), messages: VecCell::with_capacity(INITIAL_CAPACITY),
swap_in: rx2, swap_in: rx2,

View File

@ -126,9 +126,9 @@ pub fn lower_crate(sess: &Session,
LoweringContext { LoweringContext {
crate_root: std_inject::injected_crate_name(krate), crate_root: std_inject::injected_crate_name(krate),
sess: sess, sess,
parent_def: None, parent_def: None,
resolver: resolver, resolver,
name_map: FxHashMap(), name_map: FxHashMap(),
items: BTreeMap::new(), items: BTreeMap::new(),
trait_items: BTreeMap::new(), trait_items: BTreeMap::new(),
@ -251,15 +251,15 @@ impl<'a> LoweringContext<'a> {
.init_node_id_to_hir_id_mapping(self.node_id_to_hir_id); .init_node_id_to_hir_id_mapping(self.node_id_to_hir_id);
hir::Crate { hir::Crate {
module: module, module,
attrs: attrs, attrs,
span: c.span, span: c.span,
exported_macros: hir::HirVec::from(self.exported_macros), exported_macros: hir::HirVec::from(self.exported_macros),
items: self.items, items: self.items,
trait_items: self.trait_items, trait_items: self.trait_items,
impl_items: self.impl_items, impl_items: self.impl_items,
bodies: self.bodies, bodies: self.bodies,
body_ids: body_ids, body_ids,
trait_impls: self.trait_impls, trait_impls: self.trait_impls,
trait_default_impl: self.trait_default_impl, trait_default_impl: self.trait_default_impl,
} }
@ -368,7 +368,7 @@ impl<'a> LoweringContext<'a> {
arguments: decl.map_or(hir_vec![], |decl| { arguments: decl.map_or(hir_vec![], |decl| {
decl.inputs.iter().map(|x| self.lower_arg(x)).collect() decl.inputs.iter().map(|x| self.lower_arg(x)).collect()
}), }),
value: value value,
}; };
let id = body.id(); let id = body.id();
self.bodies.insert(id, body); self.bodies.insert(id, body);
@ -809,7 +809,7 @@ impl<'a> LoweringContext<'a> {
self.lower_path_segment(p.span, segment, param_mode, 0) self.lower_path_segment(p.span, segment, param_mode, 0)
}).chain(name.map(|name| { }).chain(name.map(|name| {
hir::PathSegment { hir::PathSegment {
name: name, name,
parameters: hir::PathParameters::none() parameters: hir::PathParameters::none()
} }
})).collect(), })).collect(),
@ -857,7 +857,7 @@ impl<'a> LoweringContext<'a> {
hir::PathSegment { hir::PathSegment {
name: self.lower_ident(segment.identifier), name: self.lower_ident(segment.identifier),
parameters: parameters, parameters,
} }
} }
@ -881,7 +881,7 @@ impl<'a> LoweringContext<'a> {
hir::ParenthesizedParameterData { hir::ParenthesizedParameterData {
inputs: inputs.iter().map(|ty| self.lower_ty(ty)).collect(), inputs: inputs.iter().map(|ty| self.lower_ty(ty)).collect(),
output: output.as_ref().map(|ty| self.lower_ty(ty)), output: output.as_ref().map(|ty| self.lower_ty(ty)),
span: span, span,
} }
} }
@ -970,8 +970,8 @@ impl<'a> LoweringContext<'a> {
hir::TyParam { hir::TyParam {
id: self.lower_node_id(tp.id), id: self.lower_node_id(tp.id),
name: name, name,
bounds: bounds, bounds,
default: tp.default.as_ref().map(|x| self.lower_ty(x)), default: tp.default.as_ref().map(|x| self.lower_ty(x)),
span: tp.span, span: tp.span,
pure_wrt_drop: tp.attrs.iter().any(|attr| attr.check_name("may_dangle")), pure_wrt_drop: tp.attrs.iter().any(|attr| attr.check_name("may_dangle")),
@ -1081,14 +1081,14 @@ impl<'a> LoweringContext<'a> {
TraitTyParamBound(_, TraitBoundModifier::Maybe) => None, TraitTyParamBound(_, TraitBoundModifier::Maybe) => None,
_ => Some(self.lower_ty_param_bound(bound)) _ => Some(self.lower_ty_param_bound(bound))
}).collect(), }).collect(),
span: span, span,
}) })
} }
WherePredicate::RegionPredicate(WhereRegionPredicate{ ref lifetime, WherePredicate::RegionPredicate(WhereRegionPredicate{ ref lifetime,
ref bounds, ref bounds,
span}) => { span}) => {
hir::WherePredicate::RegionPredicate(hir::WhereRegionPredicate { hir::WherePredicate::RegionPredicate(hir::WhereRegionPredicate {
span: span, span,
lifetime: self.lower_lifetime(lifetime), lifetime: self.lower_lifetime(lifetime),
bounds: bounds.iter().map(|bound| self.lower_lifetime(bound)).collect(), bounds: bounds.iter().map(|bound| self.lower_lifetime(bound)).collect(),
}) })
@ -1101,7 +1101,7 @@ impl<'a> LoweringContext<'a> {
id: self.lower_node_id(id), id: self.lower_node_id(id),
lhs_ty: self.lower_ty(lhs_ty), lhs_ty: self.lower_ty(lhs_ty),
rhs_ty: self.lower_ty(rhs_ty), rhs_ty: self.lower_ty(rhs_ty),
span: span, span,
}) })
} }
} }
@ -1133,7 +1133,7 @@ impl<'a> LoweringContext<'a> {
qpath => bug!("lower_trait_ref: unexpected QPath `{:?}`", qpath) qpath => bug!("lower_trait_ref: unexpected QPath `{:?}`", qpath)
}; };
hir::TraitRef { hir::TraitRef {
path: path, path,
ref_id: self.lower_node_id(p.ref_id), ref_id: self.lower_node_id(p.ref_id),
} }
} }
@ -1201,10 +1201,10 @@ impl<'a> LoweringContext<'a> {
P(hir::Block { P(hir::Block {
id: self.lower_node_id(b.id), id: self.lower_node_id(b.id),
stmts: stmts.into(), stmts: stmts.into(),
expr: expr, expr,
rules: self.lower_block_check_mode(&b.rules), rules: self.lower_block_check_mode(&b.rules),
span: b.span, span: b.span,
targeted_by_break: targeted_by_break, targeted_by_break,
}) })
} }
@ -1259,8 +1259,8 @@ impl<'a> LoweringContext<'a> {
name: import.rename.unwrap_or(ident).name, name: import.rename.unwrap_or(ident).name,
attrs: attrs.clone(), attrs: attrs.clone(),
node: hir::ItemUse(P(path), hir::UseKind::Single), node: hir::ItemUse(P(path), hir::UseKind::Single),
vis: vis, vis,
span: span, span,
}); });
}); });
} }
@ -1441,7 +1441,7 @@ impl<'a> LoweringContext<'a> {
name: self.lower_ident(i.ident), name: self.lower_ident(i.ident),
span: i.span, span: i.span,
defaultness: self.lower_defaultness(Defaultness::Default, has_default), defaultness: self.lower_defaultness(Defaultness::Default, has_default),
kind: kind, kind,
} }
} }
@ -1523,9 +1523,9 @@ impl<'a> LoweringContext<'a> {
if let ItemKind::MacroDef(ref def) = i.node { if let ItemKind::MacroDef(ref def) = i.node {
if !def.legacy || i.attrs.iter().any(|attr| attr.path == "macro_export") { if !def.legacy || i.attrs.iter().any(|attr| attr.path == "macro_export") {
self.exported_macros.push(hir::MacroDef { self.exported_macros.push(hir::MacroDef {
name: name, name,
vis: vis, vis,
attrs: attrs, attrs,
id: i.id, id: i.id,
span: i.span, span: i.span,
body: def.stream(), body: def.stream(),
@ -1541,10 +1541,10 @@ impl<'a> LoweringContext<'a> {
Some(hir::Item { Some(hir::Item {
id: self.lower_node_id(i.id), id: self.lower_node_id(i.id),
name: name, name,
attrs: attrs, attrs,
node: node, node,
vis: vis, vis,
span: i.span, span: i.span,
}) })
} }
@ -1650,7 +1650,7 @@ impl<'a> LoweringContext<'a> {
Some(def) => { Some(def) => {
hir::PatKind::Path(hir::QPath::Resolved(None, P(hir::Path { hir::PatKind::Path(hir::QPath::Resolved(None, P(hir::Path {
span: pth1.span, span: pth1.span,
def: def, def,
segments: hir_vec![ segments: hir_vec![
hir::PathSegment::from_name(pth1.node.name) hir::PathSegment::from_name(pth1.node.name)
], ],
@ -1887,9 +1887,9 @@ impl<'a> LoweringContext<'a> {
let blk = P(hir::Block { let blk = P(hir::Block {
stmts: hir_vec![], stmts: hir_vec![],
expr: Some(els), expr: Some(els),
id: id, id,
rules: hir::DefaultBlock, rules: hir::DefaultBlock,
span: span, span,
targeted_by_break: false, targeted_by_break: false,
}); });
P(self.expr_block(blk, ThinVec::new())) P(self.expr_block(blk, ThinVec::new()))
@ -2108,7 +2108,7 @@ impl<'a> LoweringContext<'a> {
sub_expr, sub_expr,
arms.into(), arms.into(),
hir::MatchSource::IfLetDesugar { hir::MatchSource::IfLetDesugar {
contains_else_clause: contains_else_clause, contains_else_clause,
}) })
} }
@ -2536,7 +2536,7 @@ impl<'a> LoweringContext<'a> {
fn arm(&mut self, pats: hir::HirVec<P<hir::Pat>>, expr: P<hir::Expr>) -> hir::Arm { fn arm(&mut self, pats: hir::HirVec<P<hir::Pat>>, expr: P<hir::Expr>) -> hir::Arm {
hir::Arm { hir::Arm {
attrs: hir_vec![], attrs: hir_vec![],
pats: pats, pats,
guard: None, guard: None,
body: expr, body: expr,
} }
@ -2546,10 +2546,10 @@ impl<'a> LoweringContext<'a> {
hir::Field { hir::Field {
name: Spanned { name: Spanned {
node: name, node: name,
span: span, span,
}, },
span: span, span,
expr: expr, expr,
is_shorthand: false, is_shorthand: false,
} }
} }
@ -2578,8 +2578,8 @@ impl<'a> LoweringContext<'a> {
}; };
let expr_path = hir::ExprPath(hir::QPath::Resolved(None, P(hir::Path { let expr_path = hir::ExprPath(hir::QPath::Resolved(None, P(hir::Path {
span: span, span,
def: def, def,
segments: hir_vec![hir::PathSegment::from_name(id)], segments: hir_vec![hir::PathSegment::from_name(id)],
}))); })));
@ -2619,9 +2619,9 @@ impl<'a> LoweringContext<'a> {
fn expr(&mut self, span: Span, node: hir::Expr_, attrs: ThinVec<Attribute>) -> hir::Expr { fn expr(&mut self, span: Span, node: hir::Expr_, attrs: ThinVec<Attribute>) -> hir::Expr {
hir::Expr { hir::Expr {
id: self.next_id(), id: self.next_id(),
node: node, node,
span: span, span,
attrs: attrs, attrs,
} }
} }
@ -2632,7 +2632,7 @@ impl<'a> LoweringContext<'a> {
source: hir::LocalSource) source: hir::LocalSource)
-> hir::Stmt { -> hir::Stmt {
let local = P(hir::Local { let local = P(hir::Local {
pat: pat, pat,
ty: None, ty: None,
init: ex, init: ex,
id: self.next_id(), id: self.next_id(),
@ -2662,11 +2662,11 @@ impl<'a> LoweringContext<'a> {
fn block_all(&mut self, span: Span, stmts: hir::HirVec<hir::Stmt>, expr: Option<P<hir::Expr>>) fn block_all(&mut self, span: Span, stmts: hir::HirVec<hir::Stmt>, expr: Option<P<hir::Expr>>)
-> hir::Block { -> hir::Block {
hir::Block { hir::Block {
stmts: stmts, stmts,
expr: expr, expr,
id: self.next_id(), id: self.next_id(),
rules: hir::DefaultBlock, rules: hir::DefaultBlock,
span: span, span,
targeted_by_break: false, targeted_by_break: false,
} }
} }
@ -2719,15 +2719,15 @@ impl<'a> LoweringContext<'a> {
}; };
P(hir::Pat { P(hir::Pat {
id: id, id,
node: hir::PatKind::Binding(bm, node: hir::PatKind::Binding(bm,
def_id, def_id,
Spanned { Spanned {
span: span, span,
node: name, node: name,
}, },
None), None),
span: span, span,
}) })
} }
@ -2739,7 +2739,7 @@ impl<'a> LoweringContext<'a> {
P(hir::Pat { P(hir::Pat {
id: self.next_id(), id: self.next_id(),
node: pat, node: pat,
span: span, span,
}) })
} }
@ -2748,7 +2748,7 @@ impl<'a> LoweringContext<'a> {
/// The path is also resolved according to `is_value`. /// The path is also resolved according to `is_value`.
fn std_path(&mut self, span: Span, components: &[&str], is_value: bool) -> hir::Path { fn std_path(&mut self, span: Span, components: &[&str], is_value: bool) -> hir::Path {
let mut path = hir::Path { let mut path = hir::Path {
span: span, span,
def: Def::Err, def: Def::Err,
segments: iter::once(keywords::CrateRoot.name()).chain({ segments: iter::once(keywords::CrateRoot.name()).chain({
self.crate_root.into_iter().chain(components.iter().cloned()).map(Symbol::intern) self.crate_root.into_iter().chain(components.iter().cloned()).map(Symbol::intern)
@ -2769,9 +2769,9 @@ impl<'a> LoweringContext<'a> {
let id = self.next_id(); let id = self.next_id();
let block = P(hir::Block { let block = P(hir::Block {
rules: rule, rules: rule,
span: span, span,
id: id, id,
stmts: stmts, stmts,
expr: Some(expr), expr: Some(expr),
targeted_by_break: false, targeted_by_break: false,
}); });
@ -2810,7 +2810,7 @@ impl<'a> LoweringContext<'a> {
fn elided_lifetime(&mut self, span: Span) -> hir::Lifetime { fn elided_lifetime(&mut self, span: Span) -> hir::Lifetime {
hir::Lifetime { hir::Lifetime {
id: self.next_id(), id: self.next_id(),
span: span, span,
name: keywords::Invalid.name() name: keywords::Invalid.name()
} }
} }

View File

@ -130,9 +130,9 @@ impl<'a> ClosureParts<'a> {
ClosureParts { ClosureParts {
decl: d, decl: d,
body: b, body: b,
id: id, id,
span: s, span: s,
attrs: attrs, attrs,
} }
} }
} }
@ -149,7 +149,7 @@ impl<'a> FnLikeNode<'a> {
}; };
if fn_like { if fn_like {
Some(FnLikeNode { Some(FnLikeNode {
node: node node,
}) })
} else { } else {
None None
@ -224,12 +224,12 @@ impl<'a> FnLikeNode<'a> {
id: i.id, id: i.id,
name: i.name, name: i.name,
decl: &decl, decl: &decl,
unsafety: unsafety, unsafety,
body: block, body: block,
generics: generics, generics,
abi: abi, abi,
vis: &i.vis, vis: &i.vis,
constness: constness, constness,
span: i.span, span: i.span,
attrs: &i.attrs, attrs: &i.attrs,
}), }),

View File

@ -28,7 +28,7 @@ pub struct NodeCollector<'hir> {
impl<'hir> NodeCollector<'hir> { impl<'hir> NodeCollector<'hir> {
pub fn root(krate: &'hir Crate) -> NodeCollector<'hir> { pub fn root(krate: &'hir Crate) -> NodeCollector<'hir> {
let mut collector = NodeCollector { let mut collector = NodeCollector {
krate: krate, krate,
map: vec![], map: vec![],
parent_node: CRATE_NODE_ID, parent_node: CRATE_NODE_ID,
}; };

View File

@ -36,8 +36,8 @@ pub struct MacroInvocationData {
impl<'a> DefCollector<'a> { impl<'a> DefCollector<'a> {
pub fn new(definitions: &'a mut Definitions, expansion: Mark) -> Self { pub fn new(definitions: &'a mut Definitions, expansion: Mark) -> Self {
DefCollector { DefCollector {
definitions: definitions, definitions,
expansion: expansion, expansion,
parent_def: None, parent_def: None,
visit_macro_invoc: None, visit_macro_invoc: None,
} }
@ -86,7 +86,7 @@ impl<'a> DefCollector<'a> {
if let Some(ref mut visit) = self.visit_macro_invoc { if let Some(ref mut visit) = self.visit_macro_invoc {
visit(MacroInvocationData { visit(MacroInvocationData {
mark: id.placeholder_to_mark(), mark: id.placeholder_to_mark(),
const_expr: const_expr, const_expr,
def_index: self.parent_def.unwrap(), def_index: self.parent_def.unwrap(),
}) })
} }

View File

@ -190,9 +190,9 @@ impl Decodable for DefPathTable {
} }
Ok(DefPathTable { Ok(DefPathTable {
index_to_key: index_to_key, index_to_key,
key_to_index: key_to_index, key_to_index,
def_path_hashes: def_path_hashes, def_path_hashes,
}) })
} }
} }
@ -578,7 +578,7 @@ impl Definitions {
let mut key = DefKey { let mut key = DefKey {
parent: Some(parent), parent: Some(parent),
disambiguated_data: DisambiguatedDefPathData { disambiguated_data: DisambiguatedDefPathData {
data: data, data,
disambiguator: 0 disambiguator: 0
} }
}; };

View File

@ -16,7 +16,7 @@ use rustc_data_structures::fx::FxHashMap;
pub fn check_crate<'hir>(hir_map: &hir::map::Map<'hir>) { pub fn check_crate<'hir>(hir_map: &hir::map::Map<'hir>) {
let mut outer_visitor = OuterVisitor { let mut outer_visitor = OuterVisitor {
hir_map: hir_map, hir_map,
errors: vec![], errors: vec![],
}; };
@ -49,7 +49,7 @@ impl<'a, 'hir: 'a> OuterVisitor<'a, 'hir> {
hir_map: &'a hir::map::Map<'hir>) hir_map: &'a hir::map::Map<'hir>)
-> HirIdValidator<'a, 'hir> { -> HirIdValidator<'a, 'hir> {
HirIdValidator { HirIdValidator {
hir_map: hir_map, hir_map,
owner_def_index: None, owner_def_index: None,
hir_ids_seen: FxHashMap(), hir_ids_seen: FxHashMap(),
errors: Vec::new(), errors: Vec::new(),

View File

@ -228,7 +228,7 @@ pub struct Forest {
impl Forest { impl Forest {
pub fn new(krate: Crate, dep_graph: &DepGraph) -> Forest { pub fn new(krate: Crate, dep_graph: &DepGraph) -> Forest {
Forest { Forest {
krate: krate, krate,
dep_graph: dep_graph.clone(), dep_graph: dep_graph.clone(),
inlined_bodies: TypedArena::new() inlined_bodies: TypedArena::new()
} }
@ -1057,10 +1057,10 @@ pub fn map_crate<'hir>(forest: &'hir mut Forest,
} }
let map = Map { let map = Map {
forest: forest, forest,
dep_graph: forest.dep_graph.clone(), dep_graph: forest.dep_graph.clone(),
map: map, map,
definitions: definitions, definitions,
inlined_bodies: RefCell::new(DefIdMap()), inlined_bodies: RefCell::new(DefIdMap()),
}; };

View File

@ -218,7 +218,7 @@ impl PathSegment {
/// Convert an identifier to the corresponding segment. /// Convert an identifier to the corresponding segment.
pub fn from_name(name: Name) -> PathSegment { pub fn from_name(name: Name) -> PathSegment {
PathSegment { PathSegment {
name: name, name,
parameters: PathParameters::none() parameters: PathParameters::none()
} }
} }

View File

@ -176,7 +176,7 @@ impl<'a> State<'a> {
cur_lit: 0, cur_lit: 0,
}, },
boxes: Vec::new(), boxes: Vec::new(),
ann: ann, ann,
} }
} }
} }
@ -196,7 +196,7 @@ pub fn to_string<F>(ann: &PpAnn, f: F) -> String
cur_lit: 0, cur_lit: 0,
}, },
boxes: Vec::new(), boxes: Vec::new(),
ann: ann, ann,
}; };
f(&mut printer).unwrap(); f(&mut printer).unwrap();
eof(&mut printer.s).unwrap(); eof(&mut printer.s).unwrap();

View File

@ -44,7 +44,7 @@ impl<'gcx> CachingCodemapView<'gcx> {
}; };
CachingCodemapView { CachingCodemapView {
codemap: codemap, codemap,
line_cache: [entry.clone(), entry.clone(), entry.clone()], line_cache: [entry.clone(), entry.clone(), entry.clone()],
time_stamp: 0, time_stamp: 0,
} }

View File

@ -65,13 +65,13 @@ impl<'a, 'gcx, 'tcx> StableHashingContext<'a, 'gcx, 'tcx> {
ignored_attr_names.sort(); ignored_attr_names.sort();
StableHashingContext { StableHashingContext {
tcx: tcx, tcx,
codemap: CachingCodemapView::new(tcx), codemap: CachingCodemapView::new(tcx),
hash_spans: hash_spans_initial, hash_spans: hash_spans_initial,
hash_bodies: true, hash_bodies: true,
overflow_checks_enabled: check_overflow_initial, overflow_checks_enabled: check_overflow_initial,
node_id_hashing_mode: NodeIdHashingMode::HashDefPath, node_id_hashing_mode: NodeIdHashingMode::HashDefPath,
ignored_attr_names: ignored_attr_names, ignored_attr_names,
} }
} }

View File

@ -268,7 +268,7 @@ impl<'infcx, 'gcx, 'tcx> CombineFields<'infcx, 'gcx, 'tcx> {
infcx: self.infcx, infcx: self.infcx,
span: self.trace.cause.span, span: self.trace.cause.span,
for_vid_sub_root: self.infcx.type_variables.borrow_mut().sub_root_var(for_vid), for_vid_sub_root: self.infcx.type_variables.borrow_mut().sub_root_var(for_vid),
ambient_variance: ambient_variance, ambient_variance,
needs_wf: false, needs_wf: false,
}; };

View File

@ -48,7 +48,7 @@ impl<'a, 'gcx, 'tcx> TypeFreshener<'a, 'gcx, 'tcx> {
pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>)
-> TypeFreshener<'a, 'gcx, 'tcx> { -> TypeFreshener<'a, 'gcx, 'tcx> {
TypeFreshener { TypeFreshener {
infcx: infcx, infcx,
freshen_count: 0, freshen_count: 0,
freshen_map: FxHashMap(), freshen_map: FxHashMap(),
} }

View File

@ -102,7 +102,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
infcx: self, infcx: self,
type_variables: &type_variables, type_variables: &type_variables,
region_vars: &region_vars, region_vars: &region_vars,
origin: origin origin,
}; };
Ok(value.fold_with(&mut fudger)) Ok(value.fold_with(&mut fudger))

View File

@ -218,7 +218,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
Ok(HrMatchResult { Ok(HrMatchResult {
value: a_value, value: a_value,
unconstrained_regions: unconstrained_regions, unconstrained_regions,
}) })
}); });
} }

View File

@ -458,9 +458,9 @@ impl<'gcx> TransNormalize<'gcx> for LvalueTy<'gcx> {
LvalueTy::Ty { ty } => LvalueTy::Ty { ty: ty.trans_normalize(infcx, param_env) }, LvalueTy::Ty { ty } => LvalueTy::Ty { ty: ty.trans_normalize(infcx, param_env) },
LvalueTy::Downcast { adt_def, substs, variant_index } => { LvalueTy::Downcast { adt_def, substs, variant_index } => {
LvalueTy::Downcast { LvalueTy::Downcast {
adt_def: adt_def, adt_def,
substs: substs.trans_normalize(infcx, param_env), substs: substs.trans_normalize(infcx, param_env),
variant_index: variant_index variant_index,
} }
} }
} }
@ -674,7 +674,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
-> CombineFields<'a, 'gcx, 'tcx> { -> CombineFields<'a, 'gcx, 'tcx> {
CombineFields { CombineFields {
infcx: self, infcx: self,
trace: trace, trace,
cause: None, cause: None,
param_env, param_env,
obligations: PredicateObligations::new(), obligations: PredicateObligations::new(),
@ -1235,7 +1235,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
self.report_and_explain_type_error( self.report_and_explain_type_error(
trace, trace,
&TypeError::TyParamDefaultMismatch(ExpectedFound { &TypeError::TyParamDefaultMismatch(ExpectedFound {
expected: expected, expected,
found: actual found: actual
})) }))
.emit(); .emit();
@ -1279,7 +1279,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
let span = cause.span; let span = cause.span;
let match_trait_ref = match_a.skip_binder().projection_ty.trait_ref; let match_trait_ref = match_a.skip_binder().projection_ty.trait_ref;
let trace = TypeTrace { let trace = TypeTrace {
cause: cause, cause,
values: TraitRefs(ExpectedFound::new(true, match_trait_ref, match_b)) values: TraitRefs(ExpectedFound::new(true, match_trait_ref, match_b))
}; };
@ -1443,10 +1443,10 @@ impl<'tcx> SubregionOrigin<'tcx> {
lint_id } => lint_id } =>
SubregionOrigin::CompareImplMethodObligation { SubregionOrigin::CompareImplMethodObligation {
span: cause.span, span: cause.span,
item_name: item_name, item_name,
impl_item_def_id: impl_item_def_id, impl_item_def_id,
trait_item_def_id: trait_item_def_id, trait_item_def_id,
lint_id: lint_id, lint_id,
}, },
_ => default(), _ => default(),

View File

@ -354,7 +354,7 @@ impl<'a, 'gcx, 'tcx> TaintSet<'tcx> {
impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> { impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> RegionVarBindings<'a, 'gcx, 'tcx> { pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> RegionVarBindings<'a, 'gcx, 'tcx> {
RegionVarBindings { RegionVarBindings {
tcx: tcx, tcx,
var_origins: RefCell::new(Vec::new()), var_origins: RefCell::new(Vec::new()),
values: RefCell::new(None), values: RefCell::new(None),
constraints: RefCell::new(FxHashMap()), constraints: RefCell::new(FxHashMap()),
@ -378,7 +378,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
debug!("RegionVarBindings: start_snapshot({})", length); debug!("RegionVarBindings: start_snapshot({})", length);
self.undo_log.borrow_mut().push(OpenSnapshot); self.undo_log.borrow_mut().push(OpenSnapshot);
RegionSnapshot { RegionSnapshot {
length: length, length,
region_snapshot: self.unification_table.borrow_mut().snapshot(), region_snapshot: self.unification_table.borrow_mut().snapshot(),
skolemization_count: self.skolemization_count.get(), skolemization_count: self.skolemization_count.get(),
} }
@ -733,10 +733,10 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
sub: Region<'tcx>, sub: Region<'tcx>,
bound: VerifyBound<'tcx>) { bound: VerifyBound<'tcx>) {
self.add_verify(Verify { self.add_verify(Verify {
kind: kind, kind,
origin: origin, origin,
region: sub, region: sub,
bound: bound bound,
}); });
} }
@ -1459,7 +1459,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
ConstrainRegSubVar(region, _) | ConstrainRegSubVar(region, _) |
ConstrainVarSubReg(_, region) => { ConstrainVarSubReg(_, region) => {
state.result.push(RegionAndOrigin { state.result.push(RegionAndOrigin {
region: region, region,
origin: this.constraints.borrow().get(&edge.data).unwrap().clone(), origin: this.constraints.borrow().get(&edge.data).unwrap().clone(),
}); });
} }

View File

@ -181,8 +181,8 @@ impl<'tcx> TypeVariableTable<'tcx> {
self.sub_relations.new_key(()); self.sub_relations.new_key(());
let index = self.values.push(TypeVariableData { let index = self.values.push(TypeVariableData {
value: Bounded { default: default }, value: Bounded { default: default },
origin: origin, origin,
diverging: diverging diverging,
}); });
let v = ty::TyVid { index: index as u32 }; let v = ty::TyVid { index: index as u32 };
debug!("new_var: diverging={:?} index={:?}", diverging, v); debug!("new_var: diverging={:?} index={:?}", diverging, v);
@ -369,7 +369,7 @@ impl<'tcx> sv::SnapshotVecDelegate for Delegate<'tcx> {
fn reverse(values: &mut Vec<TypeVariableData<'tcx>>, action: Instantiate<'tcx>) { fn reverse(values: &mut Vec<TypeVariableData<'tcx>>, action: Instantiate<'tcx>) {
let Instantiate { vid, default } = action; let Instantiate { vid, default } = action;
values[vid.index as usize].value = Bounded { values[vid.index as usize].value = Bounded {
default: default default,
}; };
} }
} }

View File

@ -140,8 +140,8 @@ impl<'a, S: Into<MultiSpan>> IntoEarlyLint for (S, &'a str) {
let mut diagnostic = Diagnostic::new(errors::Level::Warning, msg); let mut diagnostic = Diagnostic::new(errors::Level::Warning, msg);
diagnostic.set_span(span); diagnostic.set_span(span);
EarlyLint { EarlyLint {
id: id, id,
diagnostic: diagnostic, diagnostic,
} }
} }
} }
@ -149,7 +149,7 @@ impl<'a, S: Into<MultiSpan>> IntoEarlyLint for (S, &'a str) {
impl IntoEarlyLint for Diagnostic { impl IntoEarlyLint for Diagnostic {
fn into_early_lint(self, id: LintId) -> EarlyLint { fn into_early_lint(self, id: LintId) -> EarlyLint {
EarlyLint { EarlyLint {
id: id, id,
diagnostic: self, diagnostic: self,
} }
} }
@ -805,8 +805,8 @@ impl<'a> EarlyContext<'a> {
fn new(sess: &'a Session, fn new(sess: &'a Session,
krate: &'a ast::Crate) -> EarlyContext<'a> { krate: &'a ast::Crate) -> EarlyContext<'a> {
EarlyContext { EarlyContext {
sess: sess, sess,
krate: krate, krate,
lint_sess: LintSession::new(&sess.lint_store), lint_sess: LintSession::new(&sess.lint_store),
} }
} }
@ -1350,10 +1350,10 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
let krate = tcx.hir.krate(); let krate = tcx.hir.krate();
let mut cx = LateContext { let mut cx = LateContext {
tcx: tcx, tcx,
tables: &ty::TypeckTables::empty(), tables: &ty::TypeckTables::empty(),
param_env: ty::ParamEnv::empty(Reveal::UserFacing), param_env: ty::ParamEnv::empty(Reveal::UserFacing),
access_levels: access_levels, access_levels,
lint_sess: LintSession::new(&tcx.sess.lint_store), lint_sess: LintSession::new(&tcx.sess.lint_store),
}; };

View File

@ -294,7 +294,7 @@ impl LintId {
/// Get the `LintId` for a `Lint`. /// Get the `LintId` for a `Lint`.
pub fn of(lint: &'static Lint) -> LintId { pub fn of(lint: &'static Lint) -> LintId {
LintId { LintId {
lint: lint, lint,
} }
} }

View File

@ -260,16 +260,16 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
let nodeid_to_index = build_nodeid_to_index(body, cfg); let nodeid_to_index = build_nodeid_to_index(body, cfg);
DataFlowContext { DataFlowContext {
tcx: tcx, tcx,
analysis_name: analysis_name, analysis_name,
words_per_id: words_per_id, words_per_id,
nodeid_to_index: nodeid_to_index, nodeid_to_index,
bits_per_id: bits_per_id, bits_per_id,
oper: oper, oper,
gens: gens, gens,
action_kills: kills1, action_kills: kills1,
scope_kills: kills2, scope_kills: kills2,
on_entry: on_entry on_entry,
} }
} }

View File

@ -383,8 +383,8 @@ fn create_and_seed_worklist<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
// Seed implemented trait items // Seed implemented trait items
let mut life_seeder = LifeSeeder { let mut life_seeder = LifeSeeder {
worklist: worklist, worklist,
krate: krate, krate,
}; };
krate.visit_all_item_likes(&mut life_seeder); krate.visit_all_item_likes(&mut life_seeder);
@ -397,8 +397,8 @@ fn find_live<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
-> Box<FxHashSet<ast::NodeId>> { -> Box<FxHashSet<ast::NodeId>> {
let worklist = create_and_seed_worklist(tcx, access_levels, krate); let worklist = create_and_seed_worklist(tcx, access_levels, krate);
let mut symbol_visitor = MarkSymbolVisitor { let mut symbol_visitor = MarkSymbolVisitor {
worklist: worklist, worklist,
tcx: tcx, tcx,
tables: &ty::TypeckTables::empty(), tables: &ty::TypeckTables::empty(),
live_symbols: box FxHashSet(), live_symbols: box FxHashSet(),
struct_has_extern_repr: false, struct_has_extern_repr: false,

View File

@ -261,7 +261,7 @@ impl<'a, 'tcx> Visitor<'tcx> for EffectCheckVisitor<'a, 'tcx> {
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
let mut visitor = EffectCheckVisitor { let mut visitor = EffectCheckVisitor {
tcx: tcx, tcx,
tables: &ty::TypeckTables::empty(), tables: &ty::TypeckTables::empty(),
body_id: hir::BodyId { node_id: ast::CRATE_NODE_ID }, body_id: hir::BodyId { node_id: ast::CRATE_NODE_ID },
unsafe_context: UnsafeContext::new(SafeContext), unsafe_context: UnsafeContext::new(SafeContext),

View File

@ -71,7 +71,7 @@ pub fn find_entry_point(session: &Session, hir_map: &hir_map::Map) {
} }
let mut ctxt = EntryContext { let mut ctxt = EntryContext {
session: session, session,
map: hir_map, map: hir_map,
main_fn: None, main_fn: None,
attr_main_fn: None, attr_main_fn: None,

View File

@ -20,7 +20,7 @@ use hir;
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
let mut visitor = ItemVisitor { let mut visitor = ItemVisitor {
tcx: tcx tcx,
}; };
tcx.hir.krate().visit_all_item_likes(&mut visitor.as_deep_visitor()); tcx.hir.krate().visit_all_item_likes(&mut visitor.as_deep_visitor());
} }

View File

@ -156,10 +156,10 @@ impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> {
$( item_refs.insert($name, $variant as usize); )* $( item_refs.insert($name, $variant as usize); )*
LanguageItemCollector { LanguageItemCollector {
session: session, session,
hir_map: hir_map, hir_map,
items: LanguageItems::new(), items: LanguageItems::new(),
item_refs: item_refs, item_refs,
} }
} }

View File

@ -269,7 +269,7 @@ struct IrMaps<'a, 'tcx: 'a> {
impl<'a, 'tcx> IrMaps<'a, 'tcx> { impl<'a, 'tcx> IrMaps<'a, 'tcx> {
fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> IrMaps<'a, 'tcx> { fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> IrMaps<'a, 'tcx> {
IrMaps { IrMaps {
tcx: tcx, tcx,
num_live_nodes: 0, num_live_nodes: 0,
num_vars: 0, num_vars: 0,
live_node_map: NodeMap(), live_node_map: NodeMap(),
@ -385,7 +385,7 @@ fn visit_local<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, local: &'tcx hir::Local) {
ir.add_live_node_for_node(p_id, VarDefNode(sp)); ir.add_live_node_for_node(p_id, VarDefNode(sp));
ir.add_variable(Local(LocalInfo { ir.add_variable(Local(LocalInfo {
id: p_id, id: p_id,
name: name name,
})); }));
}); });
intravisit::walk_local(ir, local); intravisit::walk_local(ir, local);
@ -400,7 +400,7 @@ fn visit_arm<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, arm: &'tcx hir::Arm) {
ir.add_live_node_for_node(p_id, VarDefNode(sp)); ir.add_live_node_for_node(p_id, VarDefNode(sp));
ir.add_variable(Local(LocalInfo { ir.add_variable(Local(LocalInfo {
id: p_id, id: p_id,
name: name name,
})); }));
}) })
} }
@ -534,8 +534,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
let num_vars = ir.num_vars; let num_vars = ir.num_vars;
Liveness { Liveness {
ir: ir, ir,
tables: tables, tables,
s: specials, s: specials,
successors: vec![invalid_node(); num_live_nodes], successors: vec![invalid_node(); num_live_nodes],
users: vec![invalid_users(); num_live_nodes * num_vars], users: vec![invalid_users(); num_live_nodes * num_vars],

View File

@ -656,8 +656,8 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
Def::Local(def_id) => { Def::Local(def_id) => {
let vid = self.tcx.hir.as_local_node_id(def_id).unwrap(); let vid = self.tcx.hir.as_local_node_id(def_id).unwrap();
Ok(Rc::new(cmt_ { Ok(Rc::new(cmt_ {
id: id, id,
span: span, span,
cat: Categorization::Local(vid), cat: Categorization::Local(vid),
mutbl: MutabilityCategory::from_local(self.tcx, vid), mutbl: MutabilityCategory::from_local(self.tcx, vid),
ty: expr_ty, ty: expr_ty,
@ -706,7 +706,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
None => span_bug!(span, "missing closure kind") None => span_bug!(span, "missing closure kind")
}; };
let upvar_id = ty::UpvarId { var_id: var_id, let upvar_id = ty::UpvarId { var_id,
closure_expr_id: fn_node_id }; closure_expr_id: fn_node_id };
let var_ty = self.node_ty(var_id)?; let var_ty = self.node_ty(var_id)?;
@ -717,8 +717,8 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
// from the environment (perhaps we should eventually desugar // from the environment (perhaps we should eventually desugar
// this field further, but it will do for now). // this field further, but it will do for now).
let cmt_result = cmt_ { let cmt_result = cmt_ {
id: id, id,
span: span, span,
cat: Categorization::Upvar(Upvar {id: upvar_id, kind: kind}), cat: Categorization::Upvar(Upvar {id: upvar_id, kind: kind}),
mutbl: var_mutbl, mutbl: var_mutbl,
ty: var_ty, ty: var_ty,
@ -743,7 +743,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
// If this is a by-ref capture, then the upvar we loaded is // If this is a by-ref capture, then the upvar we loaded is
// actually a reference, so we have to add an implicit deref // actually a reference, so we have to add an implicit deref
// for that. // for that.
let upvar_id = ty::UpvarId { var_id: var_id, let upvar_id = ty::UpvarId { var_id,
closure_expr_id: fn_node_id }; closure_expr_id: fn_node_id };
let upvar_capture = self.tables.upvar_capture(upvar_id); let upvar_capture = self.tables.upvar_capture(upvar_id);
let cmt_result = match upvar_capture { let cmt_result = match upvar_capture {
@ -753,8 +753,8 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
ty::UpvarCapture::ByRef(upvar_borrow) => { ty::UpvarCapture::ByRef(upvar_borrow) => {
let ptr = BorrowedPtr(upvar_borrow.kind, upvar_borrow.region); let ptr = BorrowedPtr(upvar_borrow.kind, upvar_borrow.region);
cmt_ { cmt_ {
id: id, id,
span: span, span,
cat: Categorization::Deref(Rc::new(cmt_result), ptr), cat: Categorization::Deref(Rc::new(cmt_result), ptr),
mutbl: MutabilityCategory::from_borrow_kind(upvar_borrow.kind), mutbl: MutabilityCategory::from_borrow_kind(upvar_borrow.kind),
ty: var_ty, ty: var_ty,
@ -813,8 +813,8 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
} }
let ret = cmt_ { let ret = cmt_ {
id: id, id,
span: span, span,
cat: Categorization::Deref(Rc::new(cmt_result), env_ptr), cat: Categorization::Deref(Rc::new(cmt_result), env_ptr),
mutbl: deref_mutbl, mutbl: deref_mutbl,
ty: var_ty, ty: var_ty,

View File

@ -374,11 +374,11 @@ fn reachable_set<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) ->
*ty == config::CrateTypeProcMacro *ty == config::CrateTypeProcMacro
}); });
let mut reachable_context = ReachableContext { let mut reachable_context = ReachableContext {
tcx: tcx, tcx,
tables: &ty::TypeckTables::empty(), tables: &ty::TypeckTables::empty(),
reachable_symbols: NodeSet(), reachable_symbols: NodeSet(),
worklist: Vec::new(), worklist: Vec::new(),
any_library: any_library, any_library,
}; };
// Step 1: Seed the worklist with all nodes which were found to be public as // Step 1: Seed the worklist with all nodes which were found to be public as
@ -398,8 +398,8 @@ fn reachable_set<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) ->
} }
{ {
let mut collect_private_impl_items = CollectPrivateImplItemsVisitor { let mut collect_private_impl_items = CollectPrivateImplItemsVisitor {
tcx: tcx, tcx,
access_levels: access_levels, access_levels,
worklist: &mut reachable_context.worklist, worklist: &mut reachable_context.worklist,
}; };
tcx.hir.krate().visit_all_item_likes(&mut collect_private_impl_items); tcx.hir.krate().visit_all_item_likes(&mut collect_private_impl_items);

View File

@ -266,8 +266,8 @@ pub fn krate(sess: &Session,
}; };
sess.track_errors(|| { sess.track_errors(|| {
let mut visitor = LifetimeContext { let mut visitor = LifetimeContext {
sess: sess, sess,
hir_map: hir_map, hir_map,
map: &mut map, map: &mut map,
scope: ROOT_SCOPE, scope: ROOT_SCOPE,
trait_ref_hack: false, trait_ref_hack: false,
@ -341,7 +341,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
Region::early(&mut index, def) Region::early(&mut index, def)
}).collect(); }).collect();
let scope = Scope::Binder { let scope = Scope::Binder {
lifetimes: lifetimes, lifetimes,
s: ROOT_SCOPE s: ROOT_SCOPE
}; };
self.with(scope, |old_scope, this| { self.with(scope, |old_scope, this| {
@ -777,13 +777,13 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
let xcrate_object_lifetime_defaults = let xcrate_object_lifetime_defaults =
replace(&mut self.xcrate_object_lifetime_defaults, DefIdMap()); replace(&mut self.xcrate_object_lifetime_defaults, DefIdMap());
let mut this = LifetimeContext { let mut this = LifetimeContext {
sess: sess, sess,
hir_map: hir_map, hir_map,
map: *map, map: *map,
scope: &wrap_scope, scope: &wrap_scope,
trait_ref_hack: self.trait_ref_hack, trait_ref_hack: self.trait_ref_hack,
labels_in_fn: labels_in_fn, labels_in_fn,
xcrate_object_lifetime_defaults: xcrate_object_lifetime_defaults, xcrate_object_lifetime_defaults,
}; };
debug!("entering scope {:?}", this.scope); debug!("entering scope {:?}", this.scope);
f(self.scope, &mut this); f(self.scope, &mut this);
@ -849,7 +849,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
}).collect(); }).collect();
let scope = Scope::Binder { let scope = Scope::Binder {
lifetimes: lifetimes, lifetimes,
s: self.scope s: self.scope
}; };
self.with(scope, move |old_scope, this| { self.with(scope, move |old_scope, this| {
@ -1206,7 +1206,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
}; };
let scope = Scope::Elision { let scope = Scope::Elision {
elide: elide, elide,
s: self.scope s: self.scope
}; };
self.with(scope, |_, this| this.visit_ty(output)); self.with(scope, |_, this| this.visit_ty(output));
@ -1620,7 +1620,7 @@ fn insert_late_bound_lifetimes(map: &mut NamedRegionMap,
map.issue_32330.insert( map.issue_32330.insert(
lifetime.lifetime.id, lifetime.lifetime.id,
ty::Issue32330 { ty::Issue32330 {
fn_def_id: fn_def_id, fn_def_id,
region_name: name, region_name: name,
}); });
continue; continue;

View File

@ -70,14 +70,14 @@ impl DeprecationEntry {
fn local(attr: Deprecation, id: DefId) -> DeprecationEntry { fn local(attr: Deprecation, id: DefId) -> DeprecationEntry {
assert!(id.is_local()); assert!(id.is_local());
DeprecationEntry { DeprecationEntry {
attr: attr, attr,
origin: Some(id.index), origin: Some(id.index),
} }
} }
fn external(attr: Deprecation) -> DeprecationEntry { fn external(attr: Deprecation) -> DeprecationEntry {
DeprecationEntry { DeprecationEntry {
attr: attr, attr,
origin: None, origin: None,
} }
} }
@ -384,7 +384,7 @@ impl<'a, 'tcx> Index<'tcx> {
let krate = tcx.hir.krate(); let krate = tcx.hir.krate();
let mut annotator = Annotator { let mut annotator = Annotator {
tcx: tcx, tcx,
index: self, index: self,
parent_stab: None, parent_stab: None,
parent_depr: None, parent_depr: None,
@ -424,7 +424,7 @@ impl<'a, 'tcx> Index<'tcx> {
let mut staged_api = FxHashMap(); let mut staged_api = FxHashMap();
staged_api.insert(LOCAL_CRATE, is_staged_api); staged_api.insert(LOCAL_CRATE, is_staged_api);
Index { Index {
staged_api: staged_api, staged_api,
stab_map: DefIdMap(), stab_map: DefIdMap(),
depr_map: DefIdMap(), depr_map: DefIdMap(),
active_features: FxHashSet(), active_features: FxHashSet(),
@ -717,8 +717,8 @@ pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
if tcx.stability.borrow().staged_api[&LOCAL_CRATE] { if tcx.stability.borrow().staged_api[&LOCAL_CRATE] {
let krate = tcx.hir.krate(); let krate = tcx.hir.krate();
let mut missing = MissingStabilityAnnotations { let mut missing = MissingStabilityAnnotations {
tcx: tcx, tcx,
access_levels: access_levels, access_levels,
}; };
missing.check_missing_stability(ast::CRATE_NODE_ID, krate.span); missing.check_missing_stability(ast::CRATE_NODE_ID, krate.span);
intravisit::walk_crate(&mut missing, krate); intravisit::walk_crate(&mut missing, krate);

View File

@ -136,15 +136,15 @@ impl<'tcx> Mir<'tcx> {
assert_eq!(local_decls[RETURN_POINTER].ty, return_ty); assert_eq!(local_decls[RETURN_POINTER].ty, return_ty);
Mir { Mir {
basic_blocks: basic_blocks, basic_blocks,
visibility_scopes: visibility_scopes, visibility_scopes,
promoted: promoted, promoted,
return_ty: return_ty, return_ty,
local_decls: local_decls, local_decls,
arg_count: arg_count, arg_count,
upvar_decls: upvar_decls, upvar_decls,
spread_arg: None, spread_arg: None,
span: span, span,
cache: cache::Cache::new() cache: cache::Cache::new()
} }
} }
@ -395,10 +395,10 @@ impl<'tcx> LocalDecl<'tcx> {
pub fn new_temp(ty: Ty<'tcx>, span: Span) -> Self { pub fn new_temp(ty: Ty<'tcx>, span: Span) -> Self {
LocalDecl { LocalDecl {
mutability: Mutability::Mut, mutability: Mutability::Mut,
ty: ty, ty,
name: None, name: None,
source_info: SourceInfo { source_info: SourceInfo {
span: span, span,
scope: ARGUMENT_VISIBILITY_SCOPE scope: ARGUMENT_VISIBILITY_SCOPE
}, },
is_user_variable: false is_user_variable: false
@ -414,7 +414,7 @@ impl<'tcx> LocalDecl<'tcx> {
mutability: Mutability::Mut, mutability: Mutability::Mut,
ty: return_ty, ty: return_ty,
source_info: SourceInfo { source_info: SourceInfo {
span: span, span,
scope: ARGUMENT_VISIBILITY_SCOPE scope: ARGUMENT_VISIBILITY_SCOPE
}, },
name: None, // FIXME maybe we do want some name here? name: None, // FIXME maybe we do want some name here?
@ -629,7 +629,7 @@ impl<'tcx> BasicBlockData<'tcx> {
pub fn new(terminator: Option<Terminator<'tcx>>) -> BasicBlockData<'tcx> { pub fn new(terminator: Option<Terminator<'tcx>>) -> BasicBlockData<'tcx> {
BasicBlockData { BasicBlockData {
statements: vec![], statements: vec![],
terminator: terminator, terminator,
is_cleanup: false, is_cleanup: false,
} }
} }
@ -941,7 +941,7 @@ impl<'tcx> Lvalue<'tcx> {
pub fn elem(self, elem: LvalueElem<'tcx>) -> Lvalue<'tcx> { pub fn elem(self, elem: LvalueElem<'tcx>) -> Lvalue<'tcx> {
Lvalue::Projection(Box::new(LvalueProjection { Lvalue::Projection(Box::new(LvalueProjection {
base: self, base: self,
elem: elem, elem,
})) }))
} }
} }
@ -1023,7 +1023,7 @@ impl<'tcx> Operand<'tcx> {
span: Span, span: Span,
) -> Self { ) -> Self {
Operand::Constant(box Constant { Operand::Constant(box Constant {
span: span, span,
ty: tcx.type_of(def_id).subst(tcx, substs), ty: tcx.type_of(def_id).subst(tcx, substs),
literal: Literal::Value { value: ConstVal::Function(def_id, substs) }, literal: Literal::Value { value: ConstVal::Function(def_id, substs) },
}) })
@ -1470,7 +1470,7 @@ impl<'tcx> TypeFoldable<'tcx> for Statement<'tcx> {
Assign(ref lval, ref rval) => Assign(lval.fold_with(folder), rval.fold_with(folder)), Assign(ref lval, ref rval) => Assign(lval.fold_with(folder), rval.fold_with(folder)),
SetDiscriminant { ref lvalue, variant_index } => SetDiscriminant { SetDiscriminant { ref lvalue, variant_index } => SetDiscriminant {
lvalue: lvalue.fold_with(folder), lvalue: lvalue.fold_with(folder),
variant_index: variant_index variant_index,
}, },
StorageLive(ref lval) => StorageLive(lval.fold_with(folder)), StorageLive(ref lval) => StorageLive(lval.fold_with(folder)),
StorageDead(ref lval) => StorageDead(lval.fold_with(folder)), StorageDead(ref lval) => StorageDead(lval.fold_with(folder)),
@ -1490,7 +1490,7 @@ impl<'tcx> TypeFoldable<'tcx> for Statement<'tcx> {
}; };
Statement { Statement {
source_info: self.source_info, source_info: self.source_info,
kind: kind kind,
} }
} }
@ -1530,14 +1530,14 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
}, },
Drop { ref location, target, unwind } => Drop { Drop { ref location, target, unwind } => Drop {
location: location.fold_with(folder), location: location.fold_with(folder),
target: target, target,
unwind: unwind unwind,
}, },
DropAndReplace { ref location, ref value, target, unwind } => DropAndReplace { DropAndReplace { ref location, ref value, target, unwind } => DropAndReplace {
location: location.fold_with(folder), location: location.fold_with(folder),
value: value.fold_with(folder), value: value.fold_with(folder),
target: target, target,
unwind: unwind unwind,
}, },
Call { ref func, ref args, ref destination, cleanup } => { Call { ref func, ref args, ref destination, cleanup } => {
let dest = destination.as_ref().map(|&(ref loc, dest)| { let dest = destination.as_ref().map(|&(ref loc, dest)| {
@ -1548,7 +1548,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
func: func.fold_with(folder), func: func.fold_with(folder),
args: args.fold_with(folder), args: args.fold_with(folder),
destination: dest, destination: dest,
cleanup: cleanup cleanup,
} }
}, },
Assert { ref cond, expected, ref msg, target, cleanup } => { Assert { ref cond, expected, ref msg, target, cleanup } => {
@ -1562,10 +1562,10 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
}; };
Assert { Assert {
cond: cond.fold_with(folder), cond: cond.fold_with(folder),
expected: expected, expected,
msg: msg, msg,
target: target, target,
cleanup: cleanup cleanup,
} }
}, },
Resume => Resume, Resume => Resume,
@ -1574,7 +1574,7 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
}; };
Terminator { Terminator {
source_info: self.source_info, source_info: self.source_info,
kind: kind kind,
} }
} }
@ -1716,8 +1716,8 @@ impl<'tcx, B, V> TypeFoldable<'tcx> for Projection<'tcx, B, V>
}; };
Projection { Projection {
base: base, base,
elem: elem elem,
} }
} }
@ -1750,7 +1750,7 @@ impl<'tcx> TypeFoldable<'tcx> for Literal<'tcx> {
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self { fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
match *self { match *self {
Literal::Item { def_id, substs } => Literal::Item { Literal::Item { def_id, substs } => Literal::Item {
def_id: def_id, def_id,
substs: substs.fold_with(folder) substs: substs.fold_with(folder)
}, },
_ => self.clone() _ => self.clone()

View File

@ -58,7 +58,7 @@ impl<'a, 'gcx, 'tcx> LvalueTy<'tcx> {
}) })
.ty; .ty;
LvalueTy::Ty { LvalueTy::Ty {
ty: ty, ty,
} }
} }
ProjectionElem::Index(_) | ProjectionElem::ConstantIndex { .. } => ProjectionElem::Index(_) | ProjectionElem::ConstantIndex { .. } =>
@ -85,8 +85,8 @@ impl<'a, 'gcx, 'tcx> LvalueTy<'tcx> {
assert!(adt_def.is_enum()); assert!(adt_def.is_enum());
assert!(index < adt_def.variants.len()); assert!(index < adt_def.variants.len());
assert_eq!(adt_def, adt_def1); assert_eq!(adt_def, adt_def1);
LvalueTy::Downcast { adt_def: adt_def, LvalueTy::Downcast { adt_def,
substs: substs, substs,
variant_index: index } variant_index: index }
} }
_ => { _ => {
@ -104,9 +104,9 @@ impl<'tcx> TypeFoldable<'tcx> for LvalueTy<'tcx> {
LvalueTy::Ty { ty } => LvalueTy::Ty { ty: ty.fold_with(folder) }, LvalueTy::Ty { ty } => LvalueTy::Ty { ty: ty.fold_with(folder) },
LvalueTy::Downcast { adt_def, substs, variant_index } => { LvalueTy::Downcast { adt_def, substs, variant_index } => {
LvalueTy::Downcast { LvalueTy::Downcast {
adt_def: adt_def, adt_def,
substs: substs.fold_with(folder), substs: substs.fold_with(folder),
variant_index: variant_index variant_index,
} }
} }
} }

View File

@ -44,9 +44,9 @@ impl<'a, 'tcx> Preorder<'a, 'tcx> {
let worklist = vec![root]; let worklist = vec![root];
Preorder { Preorder {
mir: mir, mir,
visited: BitVector::new(mir.basic_blocks().len()), visited: BitVector::new(mir.basic_blocks().len()),
worklist: worklist worklist,
} }
} }
} }
@ -106,7 +106,7 @@ pub struct Postorder<'a, 'tcx: 'a> {
impl<'a, 'tcx> Postorder<'a, 'tcx> { impl<'a, 'tcx> Postorder<'a, 'tcx> {
pub fn new(mir: &'a Mir<'tcx>, root: BasicBlock) -> Postorder<'a, 'tcx> { pub fn new(mir: &'a Mir<'tcx>, root: BasicBlock) -> Postorder<'a, 'tcx> {
let mut po = Postorder { let mut po = Postorder {
mir: mir, mir,
visited: BitVector::new(mir.basic_blocks().len()), visited: BitVector::new(mir.basic_blocks().len()),
visit_stack: Vec::new() visit_stack: Vec::new()
}; };
@ -251,8 +251,8 @@ impl<'a, 'tcx> ReversePostorder<'a, 'tcx> {
let len = blocks.len(); let len = blocks.len();
ReversePostorder { ReversePostorder {
mir: mir, mir,
blocks: blocks, blocks,
idx: len idx: len
} }
} }

View File

@ -82,12 +82,12 @@ impl CodeStats {
opt_discr_size: Option<Size>, opt_discr_size: Option<Size>,
variants: Vec<VariantInfo>) { variants: Vec<VariantInfo>) {
let info = TypeSizeInfo { let info = TypeSizeInfo {
kind: kind, kind,
type_description: type_desc.to_string(), type_description: type_desc.to_string(),
align: align.abi(), align: align.abi(),
overall_size: overall_size.bytes(), overall_size: overall_size.bytes(),
opt_discr_size: opt_discr_size.map(|s| s.bytes()), opt_discr_size: opt_discr_size.map(|s| s.bytes()),
variants: variants, variants,
}; };
self.type_sizes.insert(info); self.type_sizes.insert(info);
} }

View File

@ -1122,9 +1122,9 @@ pub fn build_target_config(opts: &Options, sp: &Handler) -> Config {
}; };
Config { Config {
target: target, target,
int_type: int_type, int_type,
uint_type: uint_type, uint_type,
} }
} }
@ -1150,7 +1150,7 @@ impl RustcOptGroup {
where F: Fn(&mut getopts::Options) -> &mut getopts::Options + 'static, where F: Fn(&mut getopts::Options) -> &mut getopts::Options + 'static,
{ {
RustcOptGroup { RustcOptGroup {
name: name, name,
apply: Box::new(f), apply: Box::new(f),
stability: OptionStability::Stable, stability: OptionStability::Stable,
} }
@ -1160,7 +1160,7 @@ impl RustcOptGroup {
where F: Fn(&mut getopts::Options) -> &mut getopts::Options + 'static, where F: Fn(&mut getopts::Options) -> &mut getopts::Options + 'static,
{ {
RustcOptGroup { RustcOptGroup {
name: name, name,
apply: Box::new(f), apply: Box::new(f),
stability: OptionStability::Unstable, stability: OptionStability::Unstable,
} }
@ -1627,28 +1627,28 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
let incremental = debugging_opts.incremental.as_ref().map(|m| PathBuf::from(m)); let incremental = debugging_opts.incremental.as_ref().map(|m| PathBuf::from(m));
(Options { (Options {
crate_types: crate_types, crate_types,
optimize: opt_level, optimize: opt_level,
debuginfo: debuginfo, debuginfo,
lint_opts: lint_opts, lint_opts,
lint_cap: lint_cap, lint_cap,
describe_lints: describe_lints, describe_lints,
output_types: OutputTypes(output_types), output_types: OutputTypes(output_types),
search_paths: search_paths, search_paths,
maybe_sysroot: sysroot_opt, maybe_sysroot: sysroot_opt,
target_triple: target, target_triple: target,
test: test, test,
incremental: incremental, incremental,
debugging_opts: debugging_opts, debugging_opts,
prints: prints, prints,
cg: cg, cg,
error_format: error_format, error_format,
externs: Externs(externs), externs: Externs(externs),
crate_name: crate_name, crate_name,
alt_std_name: None, alt_std_name: None,
libs: libs, libs,
unstable_features: UnstableFeatures::from_environment(), unstable_features: UnstableFeatures::from_environment(),
debug_assertions: debug_assertions, debug_assertions,
actually_rustdoc: false, actually_rustdoc: false,
}, },
cfg) cfg)

View File

@ -104,10 +104,10 @@ impl<'a> FileSearch<'a> {
kind: PathKind) -> FileSearch<'a> { kind: PathKind) -> FileSearch<'a> {
debug!("using sysroot = {}, triple = {}", sysroot.display(), triple); debug!("using sysroot = {}, triple = {}", sysroot.display(), triple);
FileSearch { FileSearch {
sysroot: sysroot, sysroot,
search_paths: search_paths, search_paths,
triple: triple, triple,
kind: kind, kind,
} }
} }

View File

@ -485,7 +485,7 @@ impl Session {
*incr_comp_session = IncrCompSession::Active { *incr_comp_session = IncrCompSession::Active {
session_directory: session_dir, session_directory: session_dir,
lock_file: lock_file, lock_file,
}; };
} }
@ -515,7 +515,7 @@ impl Session {
// Note: This will also drop the lock file, thus unlocking the directory // Note: This will also drop the lock file, thus unlocking the directory
*incr_comp_session = IncrCompSession::InvalidBecauseOfErrors { *incr_comp_session = IncrCompSession::InvalidBecauseOfErrors {
session_directory: session_directory session_directory,
}; };
} }
@ -695,18 +695,18 @@ pub fn build_session_(sopts: config::Options,
let sess = Session { let sess = Session {
dep_graph: dep_graph.clone(), dep_graph: dep_graph.clone(),
target: target_cfg, target: target_cfg,
host: host, host,
opts: sopts, opts: sopts,
cstore: cstore, cstore,
parse_sess: p_s, parse_sess: p_s,
// For a library crate, this is always none // For a library crate, this is always none
entry_fn: RefCell::new(None), entry_fn: RefCell::new(None),
entry_type: Cell::new(None), entry_type: Cell::new(None),
plugin_registrar_fn: Cell::new(None), plugin_registrar_fn: Cell::new(None),
derive_registrar_fn: Cell::new(None), derive_registrar_fn: Cell::new(None),
default_sysroot: default_sysroot, default_sysroot,
local_crate_source_file: local_crate_source_file, local_crate_source_file,
working_dir: working_dir, working_dir,
lint_store: RefCell::new(lint::LintStore::new()), lint_store: RefCell::new(lint::LintStore::new()),
lints: RefCell::new(lint::LintTable::new()), lints: RefCell::new(lint::LintTable::new()),
one_time_diagnostics: RefCell::new(FxHashSet()), one_time_diagnostics: RefCell::new(FxHashSet()),
@ -733,10 +733,10 @@ pub fn build_session_(sopts: config::Options,
decode_def_path_tables_time: Cell::new(Duration::from_secs(0)), decode_def_path_tables_time: Cell::new(Duration::from_secs(0)),
}, },
code_stats: RefCell::new(CodeStats::new()), code_stats: RefCell::new(CodeStats::new()),
optimization_fuel_crate: optimization_fuel_crate, optimization_fuel_crate,
optimization_fuel_limit: optimization_fuel_limit, optimization_fuel_limit,
print_fuel_crate: print_fuel_crate, print_fuel_crate,
print_fuel: print_fuel, print_fuel,
out_of_fuel: Cell::new(false), out_of_fuel: Cell::new(false),
// Note that this is unsafe because it may misinterpret file descriptors // Note that this is unsafe because it may misinterpret file descriptors
// on Unix as jobserver file descriptors. We hopefully execute this near // on Unix as jobserver file descriptors. We hopefully execute this near

View File

@ -47,7 +47,7 @@ fn with_fresh_ty_vars<'cx, 'gcx, 'tcx>(selcx: &mut SelectionContext<'cx, 'gcx, '
let impl_substs = selcx.infcx().fresh_substs_for_item(DUMMY_SP, impl_def_id); let impl_substs = selcx.infcx().fresh_substs_for_item(DUMMY_SP, impl_def_id);
let header = ty::ImplHeader { let header = ty::ImplHeader {
impl_def_id: impl_def_id, impl_def_id,
self_ty: tcx.type_of(impl_def_id), self_ty: tcx.type_of(impl_def_id),
trait_ref: tcx.impl_trait_ref(impl_def_id), trait_ref: tcx.impl_trait_ref(impl_def_id),
predicates: tcx.predicates_of(impl_def_id).predicates predicates: tcx.predicates_of(impl_def_id).predicates
@ -102,7 +102,7 @@ fn overlap<'cx, 'gcx, 'tcx>(selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>,
.chain(&b_impl_header.predicates) .chain(&b_impl_header.predicates)
.map(|p| infcx.resolve_type_vars_if_possible(p)) .map(|p| infcx.resolve_type_vars_if_possible(p))
.map(|p| Obligation { cause: ObligationCause::dummy(), .map(|p| Obligation { cause: ObligationCause::dummy(),
param_env: param_env, param_env,
recursion_depth: 0, recursion_depth: 0,
predicate: p }) predicate: p })
.chain(obligations) .chain(obligations)

View File

@ -152,11 +152,11 @@ impl<'a, 'gcx, 'tcx> FulfillmentContext<'tcx> {
cause: ObligationCause<'tcx>) cause: ObligationCause<'tcx>)
{ {
let trait_ref = ty::TraitRef { let trait_ref = ty::TraitRef {
def_id: def_id, def_id,
substs: infcx.tcx.mk_substs_trait(ty, &[]), substs: infcx.tcx.mk_substs_trait(ty, &[]),
}; };
self.register_predicate_obligation(infcx, Obligation { self.register_predicate_obligation(infcx, Obligation {
cause: cause, cause,
recursion_depth: 0, recursion_depth: 0,
param_env, param_env,
predicate: trait_ref.to_predicate() predicate: trait_ref.to_predicate()
@ -191,7 +191,7 @@ impl<'a, 'gcx, 'tcx> FulfillmentContext<'tcx> {
} }
self.predicates.register_obligation(PendingPredicateObligation { self.predicates.register_obligation(PendingPredicateObligation {
obligation: obligation, obligation,
stalled_on: vec![] stalled_on: vec![]
}); });
} }
@ -259,7 +259,7 @@ impl<'a, 'gcx, 'tcx> FulfillmentContext<'tcx> {
// Process pending obligations. // Process pending obligations.
let outcome = self.predicates.process_obligations(&mut FulfillProcessor { let outcome = self.predicates.process_obligations(&mut FulfillProcessor {
selcx: selcx, selcx,
region_obligations: &mut self.region_obligations, region_obligations: &mut self.region_obligations,
}); });
debug!("select: outcome={:?}", outcome); debug!("select: outcome={:?}", outcome);
@ -606,7 +606,7 @@ impl<'a, 'gcx, 'tcx> GlobalFulfilledPredicates<'gcx> {
pub fn new(dep_graph: DepGraph) -> GlobalFulfilledPredicates<'gcx> { pub fn new(dep_graph: DepGraph) -> GlobalFulfilledPredicates<'gcx> {
GlobalFulfilledPredicates { GlobalFulfilledPredicates {
set: FxHashSet(), set: FxHashSet(),
dep_graph: dep_graph, dep_graph,
} }
} }

View File

@ -396,7 +396,7 @@ pub fn type_known_to_meet_bound<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx
infcx.tcx.item_path_str(def_id)); infcx.tcx.item_path_str(def_id));
let trait_ref = ty::TraitRef { let trait_ref = ty::TraitRef {
def_id: def_id, def_id,
substs: infcx.tcx.mk_substs_trait(ty, &[]), substs: infcx.tcx.mk_substs_trait(ty, &[]),
}; };
let obligation = Obligation { let obligation = Obligation {

View File

@ -245,11 +245,11 @@ impl<'a, 'b, 'gcx, 'tcx> AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> {
-> AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> -> AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx>
{ {
AssociatedTypeNormalizer { AssociatedTypeNormalizer {
selcx: selcx, selcx,
param_env: param_env, param_env,
cause: cause, cause,
obligations: vec![], obligations: vec![],
depth: depth, depth,
} }
} }
@ -371,7 +371,7 @@ pub fn normalize_projection_type<'a, 'b, 'gcx, 'tcx>(
let ty_var = selcx.infcx().next_ty_var( let ty_var = selcx.infcx().next_ty_var(
TypeVariableOrigin::NormalizeProjectionType(tcx.def_span(def_id))); TypeVariableOrigin::NormalizeProjectionType(tcx.def_span(def_id)));
let projection = ty::Binder(ty::ProjectionPredicate { let projection = ty::Binder(ty::ProjectionPredicate {
projection_ty: projection_ty, projection_ty,
ty: ty_var ty: ty_var
}); });
let obligation = Obligation::with_depth( let obligation = Obligation::with_depth(
@ -514,12 +514,12 @@ fn opt_normalize_projection_type<'a, 'b, 'gcx, 'tcx>(
obligations.extend(normalizer.obligations); obligations.extend(normalizer.obligations);
Normalized { Normalized {
value: normalized_ty, value: normalized_ty,
obligations: obligations, obligations,
} }
} else { } else {
Normalized { Normalized {
value: projected_ty, value: projected_ty,
obligations: obligations, obligations,
} }
}; };
infcx.projection_cache.borrow_mut() infcx.projection_cache.borrow_mut()
@ -586,7 +586,7 @@ fn normalize_to_error<'a, 'gcx, 'tcx>(selcx: &mut SelectionContext<'a, 'gcx, 'tc
-> NormalizedTy<'tcx> -> NormalizedTy<'tcx>
{ {
let trait_ref = projection_ty.trait_ref.to_poly_trait_ref(); let trait_ref = projection_ty.trait_ref.to_poly_trait_ref();
let trait_obligation = Obligation { cause: cause, let trait_obligation = Obligation { cause,
recursion_depth: depth, recursion_depth: depth,
param_env, param_env,
predicate: trait_ref.to_predicate() }; predicate: trait_ref.to_predicate() };
@ -1232,7 +1232,7 @@ fn confirm_param_env_candidate<'cx, 'gcx, 'tcx>(
Ok(InferOk { value: ty_match, obligations }) => { Ok(InferOk { value: ty_match, obligations }) => {
Progress { Progress {
ty: ty_match.value, ty: ty_match.value,
obligations: obligations, obligations,
cacheable: ty_match.unconstrained_regions.is_empty(), cacheable: ty_match.unconstrained_regions.is_empty(),
} }
} }
@ -1306,7 +1306,7 @@ fn assoc_ty_def<'cx, 'gcx, 'tcx>(
if item.kind == ty::AssociatedKind::Type && item.name == assoc_ty_name { if item.kind == ty::AssociatedKind::Type && item.name == assoc_ty_name {
return specialization_graph::NodeItem { return specialization_graph::NodeItem {
node: specialization_graph::Node::Impl(impl_def_id), node: specialization_graph::Node::Impl(impl_def_id),
item: item, item,
}; };
} }
} }

View File

@ -212,7 +212,7 @@ impl<'a, 'tcx> ty::Lift<'tcx> for SelectionCandidate<'a> {
Some(match *self { Some(match *self {
BuiltinCandidate { has_nested } => { BuiltinCandidate { has_nested } => {
BuiltinCandidate { BuiltinCandidate {
has_nested: has_nested has_nested,
} }
} }
ImplCandidate(def_id) => ImplCandidate(def_id), ImplCandidate(def_id) => ImplCandidate(def_id),
@ -290,7 +290,7 @@ pub struct EvaluationCache<'tcx> {
impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
pub fn new(infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>) -> SelectionContext<'cx, 'gcx, 'tcx> { pub fn new(infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>) -> SelectionContext<'cx, 'gcx, 'tcx> {
SelectionContext { SelectionContext {
infcx: infcx, infcx,
freshener: infcx.freshener(), freshener: infcx.freshener(),
intercrate: false, intercrate: false,
inferred_obligations: SnapshotVec::new(), inferred_obligations: SnapshotVec::new(),
@ -299,7 +299,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
pub fn intercrate(infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>) -> SelectionContext<'cx, 'gcx, 'tcx> { pub fn intercrate(infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>) -> SelectionContext<'cx, 'gcx, 'tcx> {
SelectionContext { SelectionContext {
infcx: infcx, infcx,
freshener: infcx.freshener(), freshener: infcx.freshener(),
intercrate: true, intercrate: true,
inferred_obligations: SnapshotVec::new(), inferred_obligations: SnapshotVec::new(),
@ -2205,7 +2205,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
debug!("vtable_default_impl: obligations={:?}", obligations); debug!("vtable_default_impl: obligations={:?}", obligations);
VtableDefaultImplData { VtableDefaultImplData {
trait_def_id: trait_def_id, trait_def_id,
nested: obligations nested: obligations
} }
} }
@ -2273,7 +2273,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
// e.g. `impl<U: Tr, V: Iterator<Item=U>> Foo<<U as Tr>::T> for V` // e.g. `impl<U: Tr, V: Iterator<Item=U>> Foo<<U as Tr>::T> for V`
impl_obligations.append(&mut substs.obligations); impl_obligations.append(&mut substs.obligations);
VtableImplData { impl_def_id: impl_def_id, VtableImplData { impl_def_id,
substs: substs.value, substs: substs.value,
nested: impl_obligations } nested: impl_obligations }
} }
@ -2336,7 +2336,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
VtableObjectData { VtableObjectData {
upcast_trait_ref: upcast_trait_ref.unwrap(), upcast_trait_ref: upcast_trait_ref.unwrap(),
vtable_base: vtable_base, vtable_base,
nested: vec![] nested: vec![]
} }
} }
@ -2405,7 +2405,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
ty::Predicate::ClosureKind(closure_def_id, kind))); ty::Predicate::ClosureKind(closure_def_id, kind)));
Ok(VtableClosureData { Ok(VtableClosureData {
closure_def_id: closure_def_id, closure_def_id,
substs: substs.clone(), substs: substs.clone(),
nested: obligations nested: obligations
}) })
@ -2826,8 +2826,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
obligation.predicate.to_poly_trait_ref().fold_with(&mut self.freshener); obligation.predicate.to_poly_trait_ref().fold_with(&mut self.freshener);
TraitObligationStack { TraitObligationStack {
obligation: obligation, obligation,
fresh_trait_ref: fresh_trait_ref, fresh_trait_ref,
previous: previous_stack, previous: previous_stack,
} }
} }
@ -2911,7 +2911,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
predicate.obligations.into_iter().chain( predicate.obligations.into_iter().chain(
Some(Obligation { Some(Obligation {
cause: cause.clone(), cause: cause.clone(),
recursion_depth: recursion_depth, recursion_depth,
param_env, param_env,
predicate: predicate.value predicate: predicate.value
})) }))

View File

@ -209,15 +209,15 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> {
trait_item_def_id, trait_item_def_id,
lint_id } => { lint_id } => {
Some(super::CompareImplMethodObligation { Some(super::CompareImplMethodObligation {
item_name: item_name, item_name,
impl_item_def_id: impl_item_def_id, impl_item_def_id,
trait_item_def_id: trait_item_def_id, trait_item_def_id,
lint_id: lint_id, lint_id,
}) })
} }
super::ExprAssignable => Some(super::ExprAssignable), super::ExprAssignable => Some(super::ExprAssignable),
super::MatchExpressionArm { arm_span, source } => { super::MatchExpressionArm { arm_span, source } => {
Some(super::MatchExpressionArm { arm_span: arm_span, Some(super::MatchExpressionArm { arm_span,
source: source }) source: source })
} }
super::IfExpression => Some(super::IfExpression), super::IfExpression => Some(super::IfExpression),
@ -253,7 +253,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCause<'a> {
traits::ObligationCause { traits::ObligationCause {
span: self.span, span: self.span,
body_id: self.body_id, body_id: self.body_id,
code: code, code,
} }
}) })
} }
@ -271,9 +271,9 @@ impl<'a, 'tcx> Lift<'tcx> for traits::Vtable<'a, ()> {
}) => { }) => {
tcx.lift(&substs).map(|substs| { tcx.lift(&substs).map(|substs| {
traits::VtableImpl(traits::VtableImplData { traits::VtableImpl(traits::VtableImplData {
impl_def_id: impl_def_id, impl_def_id,
substs: substs, substs,
nested: nested nested,
}) })
}) })
} }
@ -285,17 +285,17 @@ impl<'a, 'tcx> Lift<'tcx> for traits::Vtable<'a, ()> {
}) => { }) => {
tcx.lift(&substs).map(|substs| { tcx.lift(&substs).map(|substs| {
traits::VtableClosure(traits::VtableClosureData { traits::VtableClosure(traits::VtableClosureData {
closure_def_id: closure_def_id, closure_def_id,
substs: substs, substs,
nested: nested nested,
}) })
}) })
} }
traits::VtableFnPointer(traits::VtableFnPointerData { fn_ty, nested }) => { traits::VtableFnPointer(traits::VtableFnPointerData { fn_ty, nested }) => {
tcx.lift(&fn_ty).map(|fn_ty| { tcx.lift(&fn_ty).map(|fn_ty| {
traits::VtableFnPointer(traits::VtableFnPointerData { traits::VtableFnPointer(traits::VtableFnPointerData {
fn_ty: fn_ty, fn_ty,
nested: nested, nested,
}) })
}) })
} }
@ -309,8 +309,8 @@ impl<'a, 'tcx> Lift<'tcx> for traits::Vtable<'a, ()> {
tcx.lift(&upcast_trait_ref).map(|trait_ref| { tcx.lift(&upcast_trait_ref).map(|trait_ref| {
traits::VtableObject(traits::VtableObjectData { traits::VtableObject(traits::VtableObjectData {
upcast_trait_ref: trait_ref, upcast_trait_ref: trait_ref,
vtable_base: vtable_base, vtable_base,
nested: nested nested,
}) })
}) })
} }

View File

@ -288,7 +288,7 @@ pub fn supertrait_def_ids<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>,
-> SupertraitDefIds<'cx, 'gcx, 'tcx> -> SupertraitDefIds<'cx, 'gcx, 'tcx>
{ {
SupertraitDefIds { SupertraitDefIds {
tcx: tcx, tcx,
stack: vec![trait_def_id], stack: vec![trait_def_id],
visited: Some(trait_def_id).into_iter().collect(), visited: Some(trait_def_id).into_iter().collect(),
} }
@ -399,8 +399,8 @@ pub fn predicates_for_generics<'tcx>(cause: ObligationCause<'tcx>,
generic_bounds.predicates.iter().map(|predicate| { generic_bounds.predicates.iter().map(|predicate| {
Obligation { cause: cause.clone(), Obligation { cause: cause.clone(),
recursion_depth: recursion_depth, recursion_depth,
param_env: param_env, param_env,
predicate: predicate.clone() } predicate: predicate.clone() }
}).collect() }).collect()
} }
@ -413,9 +413,9 @@ pub fn predicate_for_trait_ref<'tcx>(
-> PredicateObligation<'tcx> -> PredicateObligation<'tcx>
{ {
Obligation { Obligation {
cause: cause, cause,
param_env: param_env, param_env,
recursion_depth: recursion_depth, recursion_depth,
predicate: trait_ref.to_predicate(), predicate: trait_ref.to_predicate(),
} }
} }

View File

@ -107,7 +107,7 @@ pub struct CtxtInterners<'tcx> {
impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> { impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> {
fn new(arena: &'tcx DroplessArena) -> CtxtInterners<'tcx> { fn new(arena: &'tcx DroplessArena) -> CtxtInterners<'tcx> {
CtxtInterners { CtxtInterners {
arena: arena, arena,
type_: RefCell::new(FxHashSet()), type_: RefCell::new(FxHashSet()),
type_list: RefCell::new(FxHashSet()), type_list: RefCell::new(FxHashSet()),
substs: RefCell::new(FxHashSet()), substs: RefCell::new(FxHashSet()),
@ -732,12 +732,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
global_interners: interners, global_interners: interners,
dep_graph: dep_graph.clone(), dep_graph: dep_graph.clone(),
types: common_types, types: common_types,
named_region_map: named_region_map, named_region_map,
trait_map: resolutions.trait_map, trait_map: resolutions.trait_map,
export_map: resolutions.export_map, export_map: resolutions.export_map,
fulfilled_predicates: RefCell::new(fulfilled_predicates), fulfilled_predicates: RefCell::new(fulfilled_predicates),
hir: hir, hir,
def_path_hash_to_def_id: def_path_hash_to_def_id, def_path_hash_to_def_id,
maps: maps::Maps::new(providers), maps: maps::Maps::new(providers),
mir_passes, mir_passes,
freevars: RefCell::new(resolutions.freevars), freevars: RefCell::new(resolutions.freevars),
@ -745,7 +745,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
rcache: RefCell::new(FxHashMap()), rcache: RefCell::new(FxHashMap()),
normalized_cache: RefCell::new(FxHashMap()), normalized_cache: RefCell::new(FxHashMap()),
inhabitedness_cache: RefCell::new(FxHashMap()), inhabitedness_cache: RefCell::new(FxHashMap()),
lang_items: lang_items, lang_items,
used_unsafe: RefCell::new(NodeSet()), used_unsafe: RefCell::new(NodeSet()),
used_mut_nodes: RefCell::new(NodeSet()), used_mut_nodes: RefCell::new(NodeSet()),
stability: RefCell::new(stability), stability: RefCell::new(stability),
@ -753,7 +753,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
evaluation_cache: traits::EvaluationCache::new(), evaluation_cache: traits::EvaluationCache::new(),
rvalue_promotable_to_static: RefCell::new(NodeMap()), rvalue_promotable_to_static: RefCell::new(NodeMap()),
crate_name: Symbol::intern(crate_name), crate_name: Symbol::intern(crate_name),
data_layout: data_layout, data_layout,
layout_interner: RefCell::new(FxHashSet()), layout_interner: RefCell::new(FxHashSet()),
layout_depth: Cell::new(0), layout_depth: Cell::new(0),
derive_macros: RefCell::new(NodeMap()), derive_macros: RefCell::new(NodeMap()),
@ -964,8 +964,8 @@ pub mod tls {
let prev = tls.get(); let prev = tls.get();
tls.set(Some((gcx_ptr, interners_ptr))); tls.set(Some((gcx_ptr, interners_ptr)));
let ret = f(TyCtxt { let ret = f(TyCtxt {
gcx: gcx, gcx,
interners: interners interners,
}); });
tls.set(prev); tls.set(prev);
ret ret
@ -980,8 +980,8 @@ pub mod tls {
let gcx = unsafe { &*(gcx as *const GlobalCtxt) }; let gcx = unsafe { &*(gcx as *const GlobalCtxt) };
let interners = unsafe { &*(interners as *const CtxtInterners) }; let interners = unsafe { &*(interners as *const CtxtInterners) };
f(TyCtxt { f(TyCtxt {
gcx: gcx, gcx,
interners: interners interners,
}) })
}) })
} }
@ -1408,7 +1408,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
substs: &'tcx Substs<'tcx>) substs: &'tcx Substs<'tcx>)
-> Ty<'tcx> { -> Ty<'tcx> {
self.mk_closure_from_closure_substs(closure_id, ClosureSubsts { self.mk_closure_from_closure_substs(closure_id, ClosureSubsts {
substs: substs substs,
}) })
} }

View File

@ -238,10 +238,10 @@ impl<'a, 'gcx, 'tcx> RegionFolder<'a, 'gcx, 'tcx> {
where F : FnMut(ty::Region<'tcx>, u32) -> ty::Region<'tcx> where F : FnMut(ty::Region<'tcx>, u32) -> ty::Region<'tcx>
{ {
RegionFolder { RegionFolder {
tcx: tcx, tcx,
skipped_regions: skipped_regions, skipped_regions,
current_depth: 1, current_depth: 1,
fld_r: fld_r, fld_r,
} }
} }
} }
@ -393,9 +393,9 @@ impl<'a, 'gcx, 'tcx> RegionReplacer<'a, 'gcx, 'tcx> {
where F : FnMut(ty::BoundRegion) -> ty::Region<'tcx> where F : FnMut(ty::BoundRegion) -> ty::Region<'tcx>
{ {
RegionReplacer { RegionReplacer {
tcx: tcx, tcx,
current_depth: 1, current_depth: 1,
fld_r: fld_r, fld_r,
map: FxHashMap() map: FxHashMap()
} }
} }
@ -621,7 +621,7 @@ impl LateBoundRegionsCollector {
LateBoundRegionsCollector { LateBoundRegionsCollector {
current_depth: 1, current_depth: 1,
regions: FxHashSet(), regions: FxHashSet(),
just_constrained: just_constrained, just_constrained,
} }
} }
} }

View File

@ -52,7 +52,7 @@ impl<'a, 'gcx, 'tcx> DefIdForest {
let mut root_ids = SmallVec::new(); let mut root_ids = SmallVec::new();
root_ids.push(id); root_ids.push(id);
DefIdForest { DefIdForest {
root_ids: root_ids, root_ids,
} }
} }

View File

@ -397,7 +397,7 @@ struct LocalPathBuffer {
impl LocalPathBuffer { impl LocalPathBuffer {
fn new(root_mode: RootMode) -> LocalPathBuffer { fn new(root_mode: RootMode) -> LocalPathBuffer {
LocalPathBuffer { LocalPathBuffer {
root_mode: root_mode, root_mode,
str: String::new(), str: String::new(),
} }
} }

View File

@ -609,7 +609,7 @@ impl<'a, 'tcx> Struct {
}; };
let mut ret = Struct { let mut ret = Struct {
align: align, align,
primitive_align: align, primitive_align: align,
packed: repr.packed(), packed: repr.packed(),
sized: true, sized: true,
@ -910,10 +910,10 @@ impl<'a, 'tcx> Union {
fn new(dl: &TargetDataLayout, packed: bool) -> Union { fn new(dl: &TargetDataLayout, packed: bool) -> Union {
let align = if packed { dl.i8_align } else { dl.aggregate_align }; let align = if packed { dl.i8_align } else { dl.aggregate_align };
Union { Union {
align: align, align,
primitive_align: align, primitive_align: align,
min_size: Size::from_bytes(0), min_size: Size::from_bytes(0),
packed: packed, packed,
} }
} }
@ -1169,8 +1169,8 @@ impl<'a, 'tcx> Layout {
sized: true, sized: true,
align: element.align(dl), align: element.align(dl),
primitive_align: element.primitive_align(dl), primitive_align: element.primitive_align(dl),
element_size: element_size, element_size,
count: count count,
} }
} }
ty::TySlice(element) => { ty::TySlice(element) => {
@ -1280,9 +1280,9 @@ impl<'a, 'tcx> Layout {
// grok. // grok.
let (discr, signed) = Integer::repr_discr(tcx, ty, &def.repr, min, max); let (discr, signed) = Integer::repr_discr(tcx, ty, &def.repr, min, max);
return success(CEnum { return success(CEnum {
discr: discr, discr,
signed: signed, signed,
non_zero: non_zero, non_zero,
// FIXME: should be u128? // FIXME: should be u128?
min: min as u64, min: min as u64,
max: max as u64 max: max as u64
@ -1364,7 +1364,7 @@ impl<'a, 'tcx> Layout {
}; };
return success(RawNullablePointer { return success(RawNullablePointer {
nndiscr: discr as u64, nndiscr: discr as u64,
value: value, value,
}); });
} }
@ -1491,10 +1491,10 @@ impl<'a, 'tcx> Layout {
General { General {
discr: ity, discr: ity,
variants: variants, variants,
size: size, size,
align: align, align,
primitive_align: primitive_align primitive_align,
} }
} }
@ -1957,7 +1957,7 @@ impl<'a, 'tcx> SizeSkeleton<'tcx> {
ty::TyParam(_) | ty::TyProjection(_) => { ty::TyParam(_) | ty::TyProjection(_) => {
assert!(tail.has_param_types() || tail.has_self_ty()); assert!(tail.has_param_types() || tail.has_self_ty());
Ok(SizeSkeleton::Pointer { Ok(SizeSkeleton::Pointer {
non_zero: non_zero, non_zero,
tail: tcx.erase_regions(&tail) tail: tcx.erase_regions(&tail)
}) })
} }
@ -2016,7 +2016,7 @@ impl<'a, 'tcx> SizeSkeleton<'tcx> {
return Ok(SizeSkeleton::Pointer { return Ok(SizeSkeleton::Pointer {
non_zero: non_zero || non_zero: non_zero ||
Some(def.did) == tcx.lang_items.non_zero(), Some(def.did) == tcx.lang_items.non_zero(),
tail: tail tail,
}); });
} else { } else {
return Err(err); return Err(err);
@ -2030,7 +2030,7 @@ impl<'a, 'tcx> SizeSkeleton<'tcx> {
(None, Some(SizeSkeleton::Pointer { non_zero: true, tail })) => { (None, Some(SizeSkeleton::Pointer { non_zero: true, tail })) => {
Ok(SizeSkeleton::Pointer { Ok(SizeSkeleton::Pointer {
non_zero: false, non_zero: false,
tail: tail tail,
}) })
} }
_ => Err(err) _ => Err(err)
@ -2115,7 +2115,7 @@ impl<'a, 'tcx> LayoutTyper<'tcx> for LayoutCx<'a, 'tcx> {
let ty = self.normalize_projections(ty); let ty = self.normalize_projections(ty);
Ok(TyLayout { Ok(TyLayout {
ty: ty, ty,
layout: ty.layout(self.tcx, self.param_env)?, layout: ty.layout(self.tcx, self.param_env)?,
variant_index: None variant_index: None
}) })

View File

@ -246,7 +246,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
if let Some((i, _)) = stack.iter().enumerate().rev() if let Some((i, _)) = stack.iter().enumerate().rev()
.find(|&(_, &(_, ref q))| *q == query) { .find(|&(_, &(_, ref q))| *q == query) {
return Err(CycleError { return Err(CycleError {
span: span, span,
cycle: RefMut::map(stack, |stack| &mut stack[i..]) cycle: RefMut::map(stack, |stack| &mut stack[i..])
}); });
} }

View File

@ -964,8 +964,8 @@ impl<'tcx> TraitPredicate<'tcx> {
.next() .next()
.unwrap_or(trait_def_id); .unwrap_or(trait_def_id);
DepNode::new(tcx, DepConstructor::TraitSelect { DepNode::new(tcx, DepConstructor::TraitSelect {
trait_def_id: trait_def_id, trait_def_id,
input_def_id: input_def_id input_def_id,
}) })
} }
@ -1244,12 +1244,12 @@ impl<'tcx> ParamEnv<'tcx> {
if value.has_param_types() || value.has_self_ty() { if value.has_param_types() || value.has_self_ty() {
ParamEnvAnd { ParamEnvAnd {
param_env: self, param_env: self,
value: value, value,
} }
} else { } else {
ParamEnvAnd { ParamEnvAnd {
param_env: ParamEnv::empty(self.reveal), param_env: ParamEnv::empty(self.reveal),
value: value, value,
} }
} }
} }
@ -1487,10 +1487,10 @@ impl<'a, 'gcx, 'tcx> AdtDef {
AdtKind::Struct => {} AdtKind::Struct => {}
} }
AdtDef { AdtDef {
did: did, did,
variants: variants, variants,
flags: flags, flags,
repr: repr, repr,
} }
} }
@ -2113,11 +2113,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
AssociatedItem { AssociatedItem {
name: trait_item_ref.name, name: trait_item_ref.name,
kind: kind, kind,
// Visibility of trait items is inherited from their traits. // Visibility of trait items is inherited from their traits.
vis: Visibility::from_hir(parent_vis, trait_item_ref.id.node_id, self), vis: Visibility::from_hir(parent_vis, trait_item_ref.id.node_id, self),
defaultness: trait_item_ref.defaultness, defaultness: trait_item_ref.defaultness,
def_id: def_id, def_id,
container: TraitContainer(parent_def_id), container: TraitContainer(parent_def_id),
method_has_self_argument: has_self method_has_self_argument: has_self
} }
@ -2138,11 +2138,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
ty::AssociatedItem { ty::AssociatedItem {
name: impl_item_ref.name, name: impl_item_ref.name,
kind: kind, kind,
// Visibility of trait impl items doesn't matter. // Visibility of trait impl items doesn't matter.
vis: ty::Visibility::from_hir(&impl_item_ref.vis, impl_item_ref.id.node_id, self), vis: ty::Visibility::from_hir(&impl_item_ref.vis, impl_item_ref.id.node_id, self),
defaultness: impl_item_ref.defaultness, defaultness: impl_item_ref.defaultness,
def_id: def_id, def_id,
container: ImplContainer(parent_def_id), container: ImplContainer(parent_def_id),
method_has_self_argument: has_self method_has_self_argument: has_self
} }

View File

@ -182,8 +182,8 @@ impl<'tcx> Relate<'tcx> for ty::FnSig<'tcx> {
Ok(ty::FnSig { Ok(ty::FnSig {
inputs_and_output: relation.tcx().intern_type_list(&inputs_and_output), inputs_and_output: relation.tcx().intern_type_list(&inputs_and_output),
variadic: a.variadic, variadic: a.variadic,
unsafety: unsafety, unsafety,
abi: abi abi,
}) })
} }
} }
@ -250,9 +250,9 @@ impl<'tcx> Relate<'tcx> for ty::ExistentialProjection<'tcx> {
let trait_ref = relation.relate(&a.trait_ref, &b.trait_ref)?; let trait_ref = relation.relate(&a.trait_ref, &b.trait_ref)?;
let ty = relation.relate(&a.ty, &b.ty)?; let ty = relation.relate(&a.ty, &b.ty)?;
Ok(ty::ExistentialProjection { Ok(ty::ExistentialProjection {
trait_ref: trait_ref, trait_ref,
item_name: a.item_name, item_name: a.item_name,
ty: ty ty,
}) })
} }
} }

View File

@ -78,7 +78,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::TraitRef<'a> {
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> { fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
tcx.lift(&self.substs).map(|substs| ty::TraitRef { tcx.lift(&self.substs).map(|substs| ty::TraitRef {
def_id: self.def_id, def_id: self.def_id,
substs: substs substs,
}) })
} }
} }
@ -88,7 +88,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialTraitRef<'a> {
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> { fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
tcx.lift(&self.substs).map(|substs| ty::ExistentialTraitRef { tcx.lift(&self.substs).map(|substs| ty::ExistentialTraitRef {
def_id: self.def_id, def_id: self.def_id,
substs: substs substs,
}) })
} }
} }
@ -98,7 +98,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::TraitPredicate<'a> {
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>)
-> Option<ty::TraitPredicate<'tcx>> { -> Option<ty::TraitPredicate<'tcx>> {
tcx.lift(&self.trait_ref).map(|trait_ref| ty::TraitPredicate { tcx.lift(&self.trait_ref).map(|trait_ref| ty::TraitPredicate {
trait_ref: trait_ref trait_ref,
}) })
} }
} }
@ -117,8 +117,8 @@ impl<'a, 'tcx> Lift<'tcx> for ty::SubtypePredicate<'a> {
-> Option<ty::SubtypePredicate<'tcx>> { -> Option<ty::SubtypePredicate<'tcx>> {
tcx.lift(&(self.a, self.b)).map(|(a, b)| ty::SubtypePredicate { tcx.lift(&(self.a, self.b)).map(|(a, b)| ty::SubtypePredicate {
a_is_expected: self.a_is_expected, a_is_expected: self.a_is_expected,
a: a, a,
b: b, b,
}) })
} }
} }
@ -146,8 +146,8 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionPredicate<'a> {
-> Option<ty::ProjectionPredicate<'tcx>> { -> Option<ty::ProjectionPredicate<'tcx>> {
tcx.lift(&(self.projection_ty, self.ty)).map(|(projection_ty, ty)| { tcx.lift(&(self.projection_ty, self.ty)).map(|(projection_ty, ty)| {
ty::ProjectionPredicate { ty::ProjectionPredicate {
projection_ty: projection_ty, projection_ty,
ty: ty ty,
} }
}) })
} }
@ -158,9 +158,9 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialProjection<'a> {
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> { fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
tcx.lift(&(self.trait_ref, self.ty)).map(|(trait_ref, ty)| { tcx.lift(&(self.trait_ref, self.ty)).map(|(trait_ref, ty)| {
ty::ExistentialProjection { ty::ExistentialProjection {
trait_ref: trait_ref, trait_ref,
item_name: self.item_name, item_name: self.item_name,
ty: ty ty,
} }
}) })
} }
@ -300,8 +300,8 @@ impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::error::ExpectedFound<T> {
tcx.lift(&self.expected).and_then(|expected| { tcx.lift(&self.expected).and_then(|expected| {
tcx.lift(&self.found).map(|found| { tcx.lift(&self.found).map(|found| {
ty::error::ExpectedFound { ty::error::ExpectedFound {
expected: expected, expected,
found: found found,
} }
}) })
}) })
@ -313,7 +313,7 @@ impl<'a, 'tcx> Lift<'tcx> for type_variable::Default<'a> {
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> { fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
tcx.lift(&self.ty).map(|ty| { tcx.lift(&self.ty).map(|ty| {
type_variable::Default { type_variable::Default {
ty: ty, ty,
origin_span: self.origin_span, origin_span: self.origin_span,
def_id: self.def_id def_id: self.def_id
} }

View File

@ -571,8 +571,8 @@ impl<'a, 'tcx> ProjectionTy<'tcx> {
|item| item.name == item_name).unwrap().def_id; |item| item.name == item_name).unwrap().def_id;
ProjectionTy { ProjectionTy {
trait_ref: trait_ref, trait_ref,
item_def_id: item_def_id, item_def_id,
} }
} }

View File

@ -352,9 +352,9 @@ impl<'tcx, T:TypeFoldable<'tcx>> Subst<'tcx> for T {
span: Option<Span>) span: Option<Span>)
-> T -> T
{ {
let mut folder = SubstFolder { tcx: tcx, let mut folder = SubstFolder { tcx,
substs: substs, substs,
span: span, span,
root_ty: None, root_ty: None,
ty_stack_depth: 0, ty_stack_depth: 0,
region_binders_passed: 0 }; region_binders_passed: 0 };

View File

@ -31,10 +31,10 @@ pub fn obligations<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
span: Span) span: Span)
-> Option<Vec<traits::PredicateObligation<'tcx>>> -> Option<Vec<traits::PredicateObligation<'tcx>>>
{ {
let mut wf = WfPredicates { infcx: infcx, let mut wf = WfPredicates { infcx,
param_env: param_env, param_env,
body_id: body_id, body_id,
span: span, span,
out: vec![] }; out: vec![] };
if wf.compute(ty) { if wf.compute(ty) {
debug!("wf::obligations({:?}, body_id={:?}) = {:?}", ty, body_id, wf.out); debug!("wf::obligations({:?}, body_id={:?}) = {:?}", ty, body_id, wf.out);