mirror of
https://github.com/rust-lang/rust
synced 2024-09-19 08:22:55 +00:00
Fix fallout from rebasing.
This commit is contained in:
parent
8501c9dee5
commit
72d5f39be7
|
@ -1193,7 +1193,7 @@ fn add_to_index(item: &ast::Item, rbml_w: &Encoder,
|
|||
None => {}
|
||||
}
|
||||
}
|
||||
ast::ItemDefaultImpl(unsafety, ref ast_trait_ref) => {
|
||||
ast::ItemDefaultImpl(unsafety, _) => {
|
||||
add_to_index(item, rbml_w, index);
|
||||
rbml_w.start_tag(tag_items_data_item);
|
||||
encode_def_id(rbml_w, def_id);
|
||||
|
@ -1201,7 +1201,7 @@ fn add_to_index(item: &ast::Item, rbml_w: &Encoder,
|
|||
encode_name(rbml_w, item.ident.name);
|
||||
encode_unsafety(rbml_w, unsafety);
|
||||
|
||||
let trait_ref = ty::node_id_to_trait_ref(tcx, ast_trait_ref.ref_id);
|
||||
let trait_ref = ty::impl_id_to_trait_ref(tcx, item.id);
|
||||
encode_trait_ref(rbml_w, ecx, &*trait_ref, tag_item_trait_ref);
|
||||
rbml_w.end_tag();
|
||||
}
|
||||
|
|
|
@ -5116,15 +5116,12 @@ pub fn impl_trait_ref<'tcx>(cx: &ctxt<'tcx>, id: ast::DefId)
|
|||
if id.krate == ast::LOCAL_CRATE {
|
||||
debug!("(impl_trait_ref) searching for trait impl {:?}", id);
|
||||
if let Some(ast_map::NodeItem(item)) = cx.map.find(id.node) {
|
||||
if let ast::ItemImpl(_, _, _, ref opt_trait, _, _) = item.node {
|
||||
opt_trait.as_ref().map(|_| {
|
||||
ty::impl_id_to_trait_ref(cx, id.node)
|
||||
})
|
||||
} else {
|
||||
None
|
||||
ast::ItemDefaultImpl(_, ref ast_trait_ref) => {
|
||||
Some(ty::node_id_to_trait_ref(cx, ast_trait_ref.ref_id))
|
||||
match item.node {
|
||||
ast::ItemImpl(_, _, _, Some(_), _, _) |
|
||||
ast::ItemDefaultImpl(..) => {
|
||||
Some(ty::impl_id_to_trait_ref(cx, id.node))
|
||||
}
|
||||
_ => None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -504,8 +504,8 @@ fn build_reduced_graph_for_item(&mut self, item: &Item, parent: &Rc<Module>) ->
|
|||
parent.clone()
|
||||
}
|
||||
|
||||
ItemImpl(..) => parent.clone(),
|
||||
ItemDefaultImpl(_, _) |
|
||||
ItemImpl(..) => parent.clone(),
|
||||
|
||||
ItemTrait(_, _, _, ref items) => {
|
||||
let name_bindings =
|
||||
|
|
|
@ -2772,7 +2772,7 @@ fn resolve_item(&mut self, item: &Item) {
|
|||
}
|
||||
|
||||
ItemDefaultImpl(_, ref trait_ref) => {
|
||||
self.resolve_trait_reference(item.id, trait_ref, TraitImplementation);
|
||||
self.with_optional_trait_ref(Some(trait_ref), |_| {});
|
||||
}
|
||||
ItemImpl(_, _,
|
||||
ref generics,
|
||||
|
@ -3022,12 +3022,12 @@ fn with_current_self_type<T, F>(&mut self, self_type: &Ty, f: F) -> T where
|
|||
}
|
||||
|
||||
fn with_optional_trait_ref<T, F>(&mut self,
|
||||
opt_trait_ref: &Option<TraitRef>,
|
||||
opt_trait_ref: Option<&TraitRef>,
|
||||
f: F) -> T where
|
||||
F: FnOnce(&mut Resolver) -> T,
|
||||
{
|
||||
let mut new_val = None;
|
||||
if let Some(ref trait_ref) = *opt_trait_ref {
|
||||
if let Some(trait_ref) = opt_trait_ref {
|
||||
match self.resolve_trait_reference(trait_ref.ref_id, &trait_ref.path, 0) {
|
||||
Ok(path_res) => {
|
||||
self.record_def(trait_ref.ref_id, path_res);
|
||||
|
@ -3057,7 +3057,7 @@ fn resolve_implementation(&mut self,
|
|||
this.visit_generics(generics);
|
||||
|
||||
// Resolve the trait reference, if necessary.
|
||||
this.with_optional_trait_ref(opt_trait_reference, |this| {
|
||||
this.with_optional_trait_ref(opt_trait_reference.as_ref(), |this| {
|
||||
// Resolve the self type.
|
||||
this.visit_ty(self_type);
|
||||
|
||||
|
|
|
@ -1004,7 +1004,7 @@ fn process_pat(&mut self, p:&ast::Pat) {
|
|||
self.collected_paths.push((p.id, path.clone(), false, recorder::StructRef));
|
||||
visit::walk_path(self, path);
|
||||
|
||||
let def = self.analysis.ty_cx.def_map.borrow()[p.id];
|
||||
let def = self.analysis.ty_cx.def_map.borrow()[p.id].full_def();
|
||||
let struct_def = match def {
|
||||
def::DefConst(..) => None,
|
||||
def::DefVariant(_, variant_id, _) => Some(variant_id),
|
||||
|
|
|
@ -93,10 +93,10 @@ fn visit_item(&mut self, item: &ast::Item) {
|
|||
}
|
||||
}
|
||||
}
|
||||
ast::ItemDefaultImpl(_, ref ast_trait_ref) => {
|
||||
ast::ItemDefaultImpl(..) => {
|
||||
// "Trait" impl
|
||||
debug!("coherence2::orphan check: default trait impl {}", item.repr(self.tcx));
|
||||
let trait_ref = ty::node_id_to_trait_ref(self.tcx, ast_trait_ref.ref_id);
|
||||
let trait_ref = ty::impl_trait_ref(self.tcx, def_id).unwrap();
|
||||
if trait_ref.def_id.krate != ast::LOCAL_CRATE {
|
||||
span_err!(self.tcx.sess, item.span, E0318,
|
||||
"cannot create default implementations for traits outside the \
|
||||
|
|
|
@ -649,8 +649,12 @@ fn convert_item(ccx: &CollectCtxt, it: &ast::Item) {
|
|||
&enum_definition.variants);
|
||||
},
|
||||
ast::ItemDefaultImpl(_, ref ast_trait_ref) => {
|
||||
let trait_ref = astconv::instantiate_trait_ref(ccx, &ExplicitRscope,
|
||||
ast_trait_ref, None, None);
|
||||
let trait_ref = astconv::instantiate_trait_ref(ccx,
|
||||
&ExplicitRscope,
|
||||
ast_trait_ref,
|
||||
Some(it.id),
|
||||
None,
|
||||
None);
|
||||
|
||||
ty::record_default_trait_implementation(tcx, trait_ref.def_id, local_def(it.id))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue