Skip to content

Commit 72d5f39

Browse files
committed
Fix fallout from rebasing.
1 parent 8501c9d commit 72d5f39

File tree

7 files changed

+22
-21
lines changed

7 files changed

+22
-21
lines changed

src/librustc/metadata/encoder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1193,15 +1193,15 @@ fn encode_info_for_item(ecx: &EncodeContext,
11931193
None => {}
11941194
}
11951195
}
1196-
ast::ItemDefaultImpl(unsafety, ref ast_trait_ref) => {
1196+
ast::ItemDefaultImpl(unsafety, _) => {
11971197
add_to_index(item, rbml_w, index);
11981198
rbml_w.start_tag(tag_items_data_item);
11991199
encode_def_id(rbml_w, def_id);
12001200
encode_family(rbml_w, 'd');
12011201
encode_name(rbml_w, item.ident.name);
12021202
encode_unsafety(rbml_w, unsafety);
12031203

1204-
let trait_ref = ty::node_id_to_trait_ref(tcx, ast_trait_ref.ref_id);
1204+
let trait_ref = ty::impl_id_to_trait_ref(tcx, item.id);
12051205
encode_trait_ref(rbml_w, ecx, &*trait_ref, tag_item_trait_ref);
12061206
rbml_w.end_tag();
12071207
}

src/librustc/middle/ty.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -5116,15 +5116,12 @@ pub fn impl_trait_ref<'tcx>(cx: &ctxt<'tcx>, id: ast::DefId)
51165116
if id.krate == ast::LOCAL_CRATE {
51175117
debug!("(impl_trait_ref) searching for trait impl {:?}", id);
51185118
if let Some(ast_map::NodeItem(item)) = cx.map.find(id.node) {
5119-
if let ast::ItemImpl(_, _, _, ref opt_trait, _, _) = item.node {
5120-
opt_trait.as_ref().map(|_| {
5121-
ty::impl_id_to_trait_ref(cx, id.node)
5122-
})
5123-
} else {
5124-
None
5125-
ast::ItemDefaultImpl(_, ref ast_trait_ref) => {
5126-
Some(ty::node_id_to_trait_ref(cx, ast_trait_ref.ref_id))
5127-
}
5119+
match item.node {
5120+
ast::ItemImpl(_, _, _, Some(_), _, _) |
5121+
ast::ItemDefaultImpl(..) => {
5122+
Some(ty::impl_id_to_trait_ref(cx, id.node))
5123+
}
5124+
_ => None
51285125
}
51295126
} else {
51305127
None

src/librustc_resolve/build_reduced_graph.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,8 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
504504
parent.clone()
505505
}
506506

507-
ItemImpl(..) => parent.clone(),
508507
ItemDefaultImpl(_, _) |
508+
ItemImpl(..) => parent.clone(),
509509

510510
ItemTrait(_, _, _, ref items) => {
511511
let name_bindings =

src/librustc_resolve/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2772,7 +2772,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
27722772
}
27732773

27742774
ItemDefaultImpl(_, ref trait_ref) => {
2775-
self.resolve_trait_reference(item.id, trait_ref, TraitImplementation);
2775+
self.with_optional_trait_ref(Some(trait_ref), |_| {});
27762776
}
27772777
ItemImpl(_, _,
27782778
ref generics,
@@ -3022,12 +3022,12 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
30223022
}
30233023

30243024
fn with_optional_trait_ref<T, F>(&mut self,
3025-
opt_trait_ref: &Option<TraitRef>,
3025+
opt_trait_ref: Option<&TraitRef>,
30263026
f: F) -> T where
30273027
F: FnOnce(&mut Resolver) -> T,
30283028
{
30293029
let mut new_val = None;
3030-
if let Some(ref trait_ref) = *opt_trait_ref {
3030+
if let Some(trait_ref) = opt_trait_ref {
30313031
match self.resolve_trait_reference(trait_ref.ref_id, &trait_ref.path, 0) {
30323032
Ok(path_res) => {
30333033
self.record_def(trait_ref.ref_id, path_res);
@@ -3057,7 +3057,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
30573057
this.visit_generics(generics);
30583058

30593059
// Resolve the trait reference, if necessary.
3060-
this.with_optional_trait_ref(opt_trait_reference, |this| {
3060+
this.with_optional_trait_ref(opt_trait_reference.as_ref(), |this| {
30613061
// Resolve the self type.
30623062
this.visit_ty(self_type);
30633063

src/librustc_trans/save/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
10041004
self.collected_paths.push((p.id, path.clone(), false, recorder::StructRef));
10051005
visit::walk_path(self, path);
10061006

1007-
let def = self.analysis.ty_cx.def_map.borrow()[p.id];
1007+
let def = self.analysis.ty_cx.def_map.borrow()[p.id].full_def();
10081008
let struct_def = match def {
10091009
def::DefConst(..) => None,
10101010
def::DefVariant(_, variant_id, _) => Some(variant_id),

src/librustc_typeck/coherence/orphan.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ impl<'cx, 'tcx,'v> visit::Visitor<'v> for OrphanChecker<'cx, 'tcx> {
9393
}
9494
}
9595
}
96-
ast::ItemDefaultImpl(_, ref ast_trait_ref) => {
96+
ast::ItemDefaultImpl(..) => {
9797
// "Trait" impl
9898
debug!("coherence2::orphan check: default trait impl {}", item.repr(self.tcx));
99-
let trait_ref = ty::node_id_to_trait_ref(self.tcx, ast_trait_ref.ref_id);
99+
let trait_ref = ty::impl_trait_ref(self.tcx, def_id).unwrap();
100100
if trait_ref.def_id.krate != ast::LOCAL_CRATE {
101101
span_err!(self.tcx.sess, item.span, E0318,
102102
"cannot create default implementations for traits outside the \

src/librustc_typeck/collect.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,12 @@ fn convert_item(ccx: &CollectCtxt, it: &ast::Item) {
649649
&enum_definition.variants);
650650
},
651651
ast::ItemDefaultImpl(_, ref ast_trait_ref) => {
652-
let trait_ref = astconv::instantiate_trait_ref(ccx, &ExplicitRscope,
653-
ast_trait_ref, None, None);
652+
let trait_ref = astconv::instantiate_trait_ref(ccx,
653+
&ExplicitRscope,
654+
ast_trait_ref,
655+
Some(it.id),
656+
None,
657+
None);
654658

655659
ty::record_default_trait_implementation(tcx, trait_ref.def_id, local_def(it.id))
656660
}

0 commit comments

Comments
 (0)