Skip to content

Commit 8575184

Browse files
committed
Fix rebase breakage
1 parent bf298ae commit 8575184

File tree

7 files changed

+41
-27
lines changed

7 files changed

+41
-27
lines changed

src/librustc/middle/cstore.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ pub struct NativeLibrary {
140140
pub struct InlinedItem {
141141
pub def_id: DefId,
142142
pub body: P<hir::Expr>,
143-
pub const_fn_args: Vec<DefId>,
143+
pub const_fn_args: Vec<Option<DefId>>,
144144
}
145145

146146
/// A borrowed version of `hir::InlinedItem`. This is what's encoded when saving
@@ -149,11 +149,14 @@ pub struct InlinedItem {
149149
pub struct InlinedItemRef<'a> {
150150
pub def_id: DefId,
151151
pub body: &'a hir::Expr,
152-
pub const_fn_args: Vec<DefId>,
152+
pub const_fn_args: Vec<Option<DefId>>,
153153
}
154154

155-
fn get_fn_args(tcx: TyCtxt, decl: &hir::FnDecl) -> Vec<DefId> {
156-
decl.inputs.iter().map(|arg| tcx.expect_def(arg.pat.id).def_id()).collect()
155+
fn get_fn_args(decl: &hir::FnDecl) -> Vec<Option<DefId>> {
156+
decl.inputs.iter().map(|arg| match arg.pat.node {
157+
hir::PatKind::Binding(_, def_id, _, _) => Some(def_id),
158+
_ => None
159+
}).collect()
157160
}
158161

159162
impl<'a> InlinedItemRef<'a> {
@@ -163,7 +166,7 @@ impl<'a> InlinedItemRef<'a> {
163166
-> InlinedItemRef<'a> {
164167
let (body, args) = match item.node {
165168
hir::ItemFn(ref decl, _, _, _, _, body_id) =>
166-
(tcx.map.expr(body_id), get_fn_args(tcx, decl)),
169+
(tcx.map.expr(body_id), get_fn_args(decl)),
167170
hir::ItemConst(_, ref body) => (&**body, Vec::new()),
168171
_ => bug!("InlinedItemRef::from_item wrong kind")
169172
};
@@ -199,7 +202,7 @@ impl<'a> InlinedItemRef<'a> {
199202
-> InlinedItemRef<'a> {
200203
let (body, args) = match item.node {
201204
hir::ImplItemKind::Method(ref sig, body_id) =>
202-
(tcx.map.expr(body_id), get_fn_args(tcx, &sig.decl)),
205+
(tcx.map.expr(body_id), get_fn_args(&sig.decl)),
203206
hir::ImplItemKind::Const(_, ref body) =>
204207
(&**body, Vec::new()),
205208
_ => bug!("InlinedItemRef::from_impl_item wrong kind")

src/librustc/middle/dead.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
292292
}
293293

294294
fn visit_path(&mut self, path: &'tcx hir::Path, id: ast::NodeId) {
295-
self.lookup_and_handle_definition(id);
295+
self.handle_definition(id, path.def);
296296
intravisit::walk_path(self, path);
297297
}
298298
}

src/librustc/middle/stability.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,12 @@ impl<'a, 'tcx: 'a> MissingStabilityAnnotations<'a, 'tcx> {
328328
}
329329
}
330330

331-
impl<'a, 'tcx, 'v> Visitor<'v> for MissingStabilityAnnotations<'a, 'tcx> {
332-
fn visit_item(&mut self, i: &Item) {
331+
impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> {
332+
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
333+
Some(&self.tcx.map)
334+
}
335+
336+
fn visit_item(&mut self, i: &'tcx Item) {
333337
match i.node {
334338
// Inherent impls and foreign modules serve only as containers for other items,
335339
// they don't have their own stability. They still can be annotated as unstable
@@ -343,35 +347,35 @@ impl<'a, 'tcx, 'v> Visitor<'v> for MissingStabilityAnnotations<'a, 'tcx> {
343347
intravisit::walk_item(self, i)
344348
}
345349

346-
fn visit_trait_item(&mut self, ti: &hir::TraitItem) {
350+
fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem) {
347351
self.check_missing_stability(ti.id, ti.span);
348352
intravisit::walk_trait_item(self, ti);
349353
}
350354

351-
fn visit_impl_item(&mut self, ii: &hir::ImplItem) {
355+
fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) {
352356
let impl_def_id = self.tcx.map.local_def_id(self.tcx.map.get_parent(ii.id));
353357
if self.tcx.impl_trait_ref(impl_def_id).is_none() {
354358
self.check_missing_stability(ii.id, ii.span);
355359
}
356360
intravisit::walk_impl_item(self, ii);
357361
}
358362

359-
fn visit_variant(&mut self, var: &Variant, g: &Generics, item_id: NodeId) {
363+
fn visit_variant(&mut self, var: &'tcx Variant, g: &'tcx Generics, item_id: NodeId) {
360364
self.check_missing_stability(var.node.data.id(), var.span);
361365
intravisit::walk_variant(self, var, g, item_id);
362366
}
363367

364-
fn visit_struct_field(&mut self, s: &StructField) {
368+
fn visit_struct_field(&mut self, s: &'tcx StructField) {
365369
self.check_missing_stability(s.id, s.span);
366370
intravisit::walk_struct_field(self, s);
367371
}
368372

369-
fn visit_foreign_item(&mut self, i: &hir::ForeignItem) {
373+
fn visit_foreign_item(&mut self, i: &'tcx hir::ForeignItem) {
370374
self.check_missing_stability(i.id, i.span);
371375
intravisit::walk_foreign_item(self, i);
372376
}
373377

374-
fn visit_macro_def(&mut self, md: &hir::MacroDef) {
378+
fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef) {
375379
if md.imported_from.is_none() {
376380
self.check_missing_stability(md.id, md.span);
377381
}

src/librustc/ty/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,13 +1280,13 @@ impl<'a, 'tcx> ParameterEnvironment<'tcx> {
12801280
}
12811281
Some(ast_map::NodeExpr(expr)) => {
12821282
// This is a convenience to allow closures to work.
1283-
if let hir::ExprClosure(.., ref body, _) = expr.node {
1283+
if let hir::ExprClosure(.., body, _) = expr.node {
12841284
let def_id = tcx.map.local_def_id(id);
12851285
let base_def_id = tcx.closure_base_def_id(def_id);
12861286
tcx.construct_parameter_environment(
12871287
expr.span,
12881288
base_def_id,
1289-
tcx.region_maps.call_site_extent(id, body.id))
1289+
tcx.region_maps.call_site_extent(id, body.node_id()))
12901290
} else {
12911291
tcx.empty_parameter_environment()
12921292
}

src/librustc_const_eval/eval.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -868,15 +868,18 @@ pub fn eval_const_expr_partial<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
868868
Some(ConstFnNode::Inlined(ii)) => (ii.const_fn_args.clone(), ii.body.expr_id()),
869869
Some(ConstFnNode::Local(fn_like)) =>
870870
(fn_like.decl().inputs.iter()
871-
.map(|arg| tcx.expect_def(arg.pat.id).def_id()).collect(),
871+
.map(|arg| match arg.pat.node {
872+
hir::PatKind::Binding(_, def_id, _, _) => Some(def_id),
873+
_ => None
874+
}).collect(),
872875
fn_like.body()),
873876
None => signal!(e, NonConstPath),
874877
};
875878
let result = tcx.map.expr(body_id);
876879
assert_eq!(arg_defs.len(), args.len());
877880

878881
let mut call_args = DefIdMap();
879-
for (arg, arg_expr) in arg_defs.iter().zip(args.iter()) {
882+
for (arg, arg_expr) in arg_defs.into_iter().zip(args.iter()) {
880883
let arg_hint = ty_hint.erase_hint();
881884
let arg_val = eval_const_expr_partial(
882885
tcx,
@@ -885,7 +888,7 @@ pub fn eval_const_expr_partial<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
885888
fn_args
886889
)?;
887890
debug!("const call arg: {:?}", arg);
888-
if let PatKind::Binding(_, def_id, _, _) = arg.pat.node {
891+
if let Some(def_id) = arg {
889892
assert!(call_args.insert(def_id, arg_val).is_none());
890893
}
891894
}

src/librustc_passes/loops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn check_crate(sess: &Session, map: &Map) {
6161

6262
impl<'a, 'ast> Visitor<'ast> for CheckLoopVisitor<'a, 'ast> {
6363
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'ast>> {
64-
Some(&self.map)
64+
Some(&self.hir_map)
6565
}
6666

6767
fn visit_item(&mut self, i: &'ast hir::Item) {

src/librustc_privacy/lib.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,8 +1067,12 @@ impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> {
10671067
}
10681068
}
10691069

1070-
impl<'a, 'tcx, 'v> Visitor<'v> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> {
1071-
fn visit_item(&mut self, item: &hir::Item) {
1070+
impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> {
1071+
fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
1072+
Some(&self.tcx.map)
1073+
}
1074+
1075+
fn visit_item(&mut self, item: &'tcx hir::Item) {
10721076
let tcx = self.tcx;
10731077
let min = |vis1: ty::Visibility, vis2| {
10741078
if vis1.is_at_least(vis2, &tcx.map) { vis2 } else { vis1 }
@@ -1171,11 +1175,11 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivateItemsInPublicInterfacesVisitor<'a, 'tc
11711175
}
11721176
}
11731177

1174-
fn visit_impl_item(&mut self, _impl_item: &'v hir::ImplItem) {
1178+
fn visit_impl_item(&mut self, _impl_item: &'tcx hir::ImplItem) {
11751179
// handled in `visit_item` above
11761180
}
11771181

1178-
fn visit_ty(&mut self, ty: &hir::Ty) {
1182+
fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
11791183
if let hir::TyImplTrait(..) = ty.node {
11801184
// Check the traits being exposed, as they're separate,
11811185
// e.g. `impl Iterator<Item=T>` has two predicates,
@@ -1189,9 +1193,9 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivateItemsInPublicInterfacesVisitor<'a, 'tc
11891193
}
11901194

11911195
// Don't recurse into expressions in array sizes or const initializers
1192-
fn visit_expr(&mut self, _: &hir::Expr) {}
1196+
fn visit_expr(&mut self, _: &'tcx hir::Expr) {}
11931197
// Don't recurse into patterns in function arguments
1194-
fn visit_pat(&mut self, _: &hir::Pat) {}
1198+
fn visit_pat(&mut self, _: &'tcx hir::Pat) {}
11951199
}
11961200

11971201
pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,

0 commit comments

Comments
 (0)