1
Fork 0

Rename DefTrait to DefaultImpl

This commit is contained in:
Flavio Percoco 2015-02-07 14:24:34 +01:00
parent 7e382132a5
commit d38aab397e
36 changed files with 93 additions and 93 deletions

View file

@ -126,7 +126,7 @@ enum Family {
TupleVariant, // v TupleVariant, // v
StructVariant, // V StructVariant, // V
Impl, // i Impl, // i
DefTrait, // d DefaultImpl, // d
Trait, // I Trait, // I
Struct, // S Struct, // S
PublicField, // g PublicField, // g
@ -152,7 +152,7 @@ fn item_family(item: rbml::Doc) -> Family {
'v' => TupleVariant, 'v' => TupleVariant,
'V' => StructVariant, 'V' => StructVariant,
'i' => Impl, 'i' => Impl,
'd' => DefTrait, 'd' => DefaultImpl,
'I' => Trait, 'I' => Trait,
'S' => Struct, 'S' => Struct,
'g' => PublicField, 'g' => PublicField,
@ -357,9 +357,9 @@ fn item_to_def_like(item: rbml::Doc, did: ast::DefId, cnum: ast::CrateNum)
let enum_did = item_reqd_and_translated_parent_item(cnum, item); let enum_did = item_reqd_and_translated_parent_item(cnum, item);
DlDef(def::DefVariant(enum_did, did, false)) DlDef(def::DefVariant(enum_did, did, false))
} }
Trait => DlDef(def::DefTrait(did)), Trait => DlDef(def::DefaultImpl(did)),
Enum => DlDef(def::DefTy(did, true)), Enum => DlDef(def::DefTy(did, true)),
Impl | DefTrait => DlImpl(did), Impl | DefaultImpl => DlImpl(did),
PublicField | InheritedField => DlField, PublicField | InheritedField => DlField,
} }
} }
@ -482,7 +482,7 @@ pub fn get_impl_trait<'tcx>(cdata: Cmd,
let item_doc = lookup_item(id, cdata.data()); let item_doc = lookup_item(id, cdata.data());
let fam = item_family(item_doc); let fam = item_family(item_doc);
match fam { match fam {
Family::Impl | Family::DefTrait => { Family::Impl | Family::DefaultImpl => {
reader::maybe_get_doc(item_doc, tag_item_trait_ref).map(|tp| { reader::maybe_get_doc(item_doc, tag_item_trait_ref).map(|tp| {
doc_trait_ref(tp, tcx, cdata) doc_trait_ref(tp, tcx, cdata)
}) })
@ -1358,7 +1358,7 @@ pub fn get_trait_of_item(cdata: Cmd, id: ast::NodeId, tcx: &ty::ctxt)
let parent_item_doc = lookup_item(parent_item_id.node, cdata.data()); let parent_item_doc = lookup_item(parent_item_id.node, cdata.data());
match item_family(parent_item_doc) { match item_family(parent_item_doc) {
Trait => Some(item_def_id(parent_item_doc, cdata)), Trait => Some(item_def_id(parent_item_doc, cdata)),
Impl | DefTrait => { Impl | DefaultImpl => {
reader::maybe_get_doc(parent_item_doc, tag_item_trait_ref) reader::maybe_get_doc(parent_item_doc, tag_item_trait_ref)
.map(|_| item_trait_ref(parent_item_doc, tcx, cdata).def_id) .map(|_| item_trait_ref(parent_item_doc, tcx, cdata).def_id)
} }
@ -1568,7 +1568,7 @@ pub fn is_associated_type(cdata: Cmd, id: ast::NodeId) -> bool {
pub fn is_default_trait<'tcx>(cdata: Cmd, id: ast::NodeId) -> bool { pub fn is_default_trait<'tcx>(cdata: Cmd, id: ast::NodeId) -> bool {
let item_doc = lookup_item(id, cdata.data()); let item_doc = lookup_item(id, cdata.data());
match item_family(item_doc) { match item_family(item_doc) {
Family::DefTrait => true, Family::DefaultImpl => true,
_ => false _ => false
} }
} }

View file

@ -1201,7 +1201,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
None => {} None => {}
} }
} }
ast::ItemDefTrait(unsafety, ref ast_trait_ref) => { ast::ItemDefaultImpl(unsafety, ref ast_trait_ref) => {
add_to_index(item, rbml_w, index); add_to_index(item, rbml_w, index);
rbml_w.start_tag(tag_items_data_item); rbml_w.start_tag(tag_items_data_item);
encode_def_id(rbml_w, def_id); encode_def_id(rbml_w, def_id);

View file

@ -440,7 +440,7 @@ impl tr for def::Def {
def::DefVariant(e_did, v_did, is_s) => { def::DefVariant(e_did, v_did, is_s) => {
def::DefVariant(e_did.tr(dcx), v_did.tr(dcx), is_s) def::DefVariant(e_did.tr(dcx), v_did.tr(dcx), is_s)
}, },
def::DefTrait(did) => def::DefTrait(did.tr(dcx)), def::DefaultImpl(did) => def::DefaultImpl(did.tr(dcx)),
def::DefTy(did, is_enum) => def::DefTy(did.tr(dcx), is_enum), def::DefTy(did, is_enum) => def::DefTy(did.tr(dcx), is_enum),
def::DefAssociatedTy(did) => def::DefAssociatedTy(did.tr(dcx)), def::DefAssociatedTy(did) => def::DefAssociatedTy(did.tr(dcx)),
def::DefAssociatedPath(def::TyParamProvenance::FromSelf(did), ident) => def::DefAssociatedPath(def::TyParamProvenance::FromSelf(did), ident) =>

View file

@ -38,7 +38,7 @@ pub enum Def {
// type `U` (indicated by the Ident). // type `U` (indicated by the Ident).
// FIXME(#20301) -- should use Name // FIXME(#20301) -- should use Name
DefAssociatedPath(TyParamProvenance, ast::Ident), DefAssociatedPath(TyParamProvenance, ast::Ident),
DefTrait(ast::DefId), DefaultImpl(ast::DefId),
DefPrimTy(ast::PrimTy), DefPrimTy(ast::PrimTy),
DefTyParam(ParamSpace, u32, ast::DefId, ast::Name), DefTyParam(ParamSpace, u32, ast::DefId, ast::Name),
DefUse(ast::DefId), DefUse(ast::DefId),
@ -135,7 +135,7 @@ impl Def {
DefFn(id, _) | DefStaticMethod(id, _) | DefMod(id) | DefFn(id, _) | DefStaticMethod(id, _) | DefMod(id) |
DefForeignMod(id) | DefStatic(id, _) | DefForeignMod(id) | DefStatic(id, _) |
DefVariant(_, id, _) | DefTy(id, _) | DefAssociatedTy(id) | DefVariant(_, id, _) | DefTy(id, _) | DefAssociatedTy(id) |
DefTyParam(_, _, id, _) | DefUse(id) | DefStruct(id) | DefTrait(id) | DefTyParam(_, _, id, _) | DefUse(id) | DefStruct(id) | DefaultImpl(id) |
DefMethod(id, _, _) | DefConst(id) | DefMethod(id, _, _) | DefConst(id) |
DefAssociatedPath(TyParamProvenance::FromSelf(id), _) | DefAssociatedPath(TyParamProvenance::FromSelf(id), _) |
DefAssociatedPath(TyParamProvenance::FromParam(id), _) => { DefAssociatedPath(TyParamProvenance::FromParam(id), _) => {

View file

@ -579,7 +579,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
Ok(self.cat_rvalue_node(id, span, expr_ty)) Ok(self.cat_rvalue_node(id, span, expr_ty))
} }
def::DefMod(_) | def::DefForeignMod(_) | def::DefUse(_) | def::DefMod(_) | def::DefForeignMod(_) | def::DefUse(_) |
def::DefTrait(_) | def::DefTy(..) | def::DefPrimTy(_) | def::DefaultImpl(_) | def::DefTy(..) | def::DefPrimTy(_) |
def::DefTyParam(..) | def::DefTyParamBinder(..) | def::DefRegion(_) | def::DefTyParam(..) | def::DefTyParamBinder(..) | def::DefRegion(_) |
def::DefLabel(_) | def::DefSelfTy(..) | def::DefLabel(_) | def::DefSelfTy(..) |
def::DefAssociatedTy(..) | def::DefAssociatedPath(..)=> { def::DefAssociatedTy(..) | def::DefAssociatedPath(..)=> {

View file

@ -302,7 +302,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
ast::ItemMod(..) | ast::ItemForeignMod(..) | ast::ItemMod(..) | ast::ItemForeignMod(..) |
ast::ItemImpl(..) | ast::ItemTrait(..) | ast::ItemImpl(..) | ast::ItemTrait(..) |
ast::ItemStruct(..) | ast::ItemEnum(..) | ast::ItemStruct(..) | ast::ItemEnum(..) |
ast::ItemDefTrait(..) => {} ast::ItemDefaultImpl(..) => {}
_ => { _ => {
self.tcx.sess.span_bug(item.span, self.tcx.sess.span_bug(item.span,

View file

@ -115,7 +115,7 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> {
ast::ItemUse(_) | ast::ItemUse(_) |
ast::ItemMod(..) | ast::ItemMod(..) |
ast::ItemMac(..) | ast::ItemMac(..) |
ast::ItemDefTrait(..) | ast::ItemDefaultImpl(..) |
ast::ItemForeignMod(..) | ast::ItemForeignMod(..) |
ast::ItemStatic(..) | ast::ItemStatic(..) |
ast::ItemConst(..) => { ast::ItemConst(..) => {
@ -169,7 +169,7 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> {
// if this path references a trait, then this will resolve to // if this path references a trait, then this will resolve to
// a trait ref, which introduces a binding scope. // a trait ref, which introduces a binding scope.
match self.def_map.borrow().get(&id) { match self.def_map.borrow().get(&id) {
Some(&def::DefTrait(..)) => { Some(&def::DefaultImpl(..)) => {
self.with(LateScope(&Vec::new(), self.scope), |_, this| { self.with(LateScope(&Vec::new(), self.scope), |_, this| {
this.visit_path(path, id); this.visit_path(path, id);
}); });

View file

@ -222,7 +222,7 @@ pub enum Vtable<'tcx, N> {
VtableImpl(VtableImplData<'tcx, N>), VtableImpl(VtableImplData<'tcx, N>),
/// Vtable for default trait implementations /// Vtable for default trait implementations
VtableDefaultTrait(VtableDefaultTraitData<N>), VtableDefaultImpl(VtableDefaultImplData<N>),
/// Successful resolution to an obligation provided by the caller /// Successful resolution to an obligation provided by the caller
/// for some type parameter. The `Vec<N>` represents the /// for some type parameter. The `Vec<N>` represents the
@ -263,7 +263,7 @@ pub struct VtableImplData<'tcx, N> {
} }
#[derive(Debug,Clone)] #[derive(Debug,Clone)]
pub struct VtableDefaultTraitData<N> { pub struct VtableDefaultImplData<N> {
pub trait_def_id: ast::DefId, pub trait_def_id: ast::DefId,
pub nested: Vec<N> pub nested: Vec<N>
} }
@ -525,7 +525,7 @@ impl<'tcx, N> Vtable<'tcx, N> {
VtableParam(ref n) => n.iter(), VtableParam(ref n) => n.iter(),
VtableBuiltin(ref i) => i.iter_nested(), VtableBuiltin(ref i) => i.iter_nested(),
VtableObject(_) | VtableObject(_) |
VtableDefaultTrait(..) | VtableFnPointer(..) | VtableDefaultImpl(..) | VtableFnPointer(..) |
VtableClosure(..) => (&[]).iter(), VtableClosure(..) => (&[]).iter(),
} }
} }
@ -533,7 +533,7 @@ impl<'tcx, N> Vtable<'tcx, N> {
pub fn map_nested<M, F>(&self, op: F) -> Vtable<'tcx, M> where F: FnMut(&N) -> M { pub fn map_nested<M, F>(&self, op: F) -> Vtable<'tcx, M> where F: FnMut(&N) -> M {
match *self { match *self {
VtableImpl(ref i) => VtableImpl(i.map_nested(op)), VtableImpl(ref i) => VtableImpl(i.map_nested(op)),
VtableDefaultTrait(ref t) => VtableDefaultTrait(t.map_nested(op)), VtableDefaultImpl(ref t) => VtableDefaultImpl(t.map_nested(op)),
VtableFnPointer(ref sig) => VtableFnPointer((*sig).clone()), VtableFnPointer(ref sig) => VtableFnPointer((*sig).clone()),
VtableClosure(d, ref s) => VtableClosure(d, s.clone()), VtableClosure(d, ref s) => VtableClosure(d, s.clone()),
VtableParam(ref n) => VtableParam(n.iter().map(op).collect()), VtableParam(ref n) => VtableParam(n.iter().map(op).collect()),
@ -549,7 +549,7 @@ impl<'tcx, N> Vtable<'tcx, N> {
VtableImpl(i) => VtableImpl(i.map_move_nested(op)), VtableImpl(i) => VtableImpl(i.map_move_nested(op)),
VtableFnPointer(sig) => VtableFnPointer(sig), VtableFnPointer(sig) => VtableFnPointer(sig),
VtableClosure(d, s) => VtableClosure(d, s), VtableClosure(d, s) => VtableClosure(d, s),
VtableDefaultTrait(t) => VtableDefaultTrait(t.map_move_nested(op)), VtableDefaultImpl(t) => VtableDefaultImpl(t.map_move_nested(op)),
VtableParam(n) => VtableParam(n.into_iter().map(op).collect()), VtableParam(n) => VtableParam(n.into_iter().map(op).collect()),
VtableObject(p) => VtableObject(p), VtableObject(p) => VtableObject(p),
VtableBuiltin(no) => VtableBuiltin(no.map_move_nested(op)), VtableBuiltin(no) => VtableBuiltin(no.map_move_nested(op)),
@ -584,25 +584,25 @@ impl<'tcx, N> VtableImplData<'tcx, N> {
} }
} }
impl<N> VtableDefaultTraitData<N> { impl<N> VtableDefaultImplData<N> {
pub fn iter_nested(&self) -> Iter<N> { pub fn iter_nested(&self) -> Iter<N> {
self.nested.iter() self.nested.iter()
} }
pub fn map_nested<M, F>(&self, op: F) -> VtableDefaultTraitData<M> where pub fn map_nested<M, F>(&self, op: F) -> VtableDefaultImplData<M> where
F: FnMut(&N) -> M, F: FnMut(&N) -> M,
{ {
VtableDefaultTraitData { VtableDefaultImplData {
trait_def_id: self.trait_def_id, trait_def_id: self.trait_def_id,
nested: self.nested.iter().map(op).collect() nested: self.nested.iter().map(op).collect()
} }
} }
pub fn map_move_nested<M, F>(self, op: F) -> VtableDefaultTraitData<M> where pub fn map_move_nested<M, F>(self, op: F) -> VtableDefaultImplData<M> where
F: FnMut(N) -> M, F: FnMut(N) -> M,
{ {
let VtableDefaultTraitData { trait_def_id, nested } = self; let VtableDefaultImplData { trait_def_id, nested } = self;
VtableDefaultTraitData { VtableDefaultImplData {
trait_def_id: trait_def_id, trait_def_id: trait_def_id,
nested: nested.into_iter().map(op).collect() nested: nested.into_iter().map(op).collect()
} }

View file

@ -709,7 +709,7 @@ fn assemble_candidates_from_impls<'cx,'tcx>(
// projection. And the projection where clause is handled // projection. And the projection where clause is handled
// in `assemble_candidates_from_param_env`. // in `assemble_candidates_from_param_env`.
} }
super::VtableDefaultTrait(..) | super::VtableDefaultImpl(..) |
super::VtableBuiltin(..) => { super::VtableBuiltin(..) => {
// These traits have no associated types. // These traits have no associated types.
selcx.tcx().sess.span_bug( selcx.tcx().sess.span_bug(

View file

@ -26,8 +26,8 @@ use super::{SelectionError, Unimplemented, Overflow, OutputTypeParameterMismatch
use super::{Selection}; use super::{Selection};
use super::{SelectionResult}; use super::{SelectionResult};
use super::{VtableBuiltin, VtableImpl, VtableParam, VtableClosure, use super::{VtableBuiltin, VtableImpl, VtableParam, VtableClosure,
VtableFnPointer, VtableObject, VtableDefaultTrait}; VtableFnPointer, VtableObject, VtableDefaultImpl};
use super::{VtableImplData, VtableObjectData, VtableBuiltinData, VtableDefaultTraitData}; use super::{VtableImplData, VtableObjectData, VtableBuiltinData, VtableDefaultImplData};
use super::object_safety; use super::object_safety;
use super::{util}; use super::{util};
@ -136,7 +136,7 @@ enum SelectionCandidate<'tcx> {
BuiltinCandidate(ty::BuiltinBound), BuiltinCandidate(ty::BuiltinBound),
ParamCandidate(ty::PolyTraitRef<'tcx>), ParamCandidate(ty::PolyTraitRef<'tcx>),
ImplCandidate(ast::DefId), ImplCandidate(ast::DefId),
DefaultTraitCandidate(ast::DefId), DefaultImplCandidate(ast::DefId),
/// This is a trait matching with a projected type as `Self`, and /// This is a trait matching with a projected type as `Self`, and
/// we found an applicable bound in the trait definition. /// we found an applicable bound in the trait definition.
@ -1150,7 +1150,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
} }
if ty::trait_has_default_impl(self.tcx(), def_id) { if ty::trait_has_default_impl(self.tcx(), def_id) {
candidates.vec.push(DefaultTraitCandidate(def_id.clone())) candidates.vec.push(DefaultImplCandidate(def_id.clone()))
} }
Ok(()) Ok(())
@ -1275,7 +1275,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// #18453. // #18453.
true true
} }
(&DefaultTraitCandidate(_), _) => { (&DefaultImplCandidate(_), _) => {
// Prefer other candidates over default implementations. // Prefer other candidates over default implementations.
true true
} }
@ -1728,9 +1728,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
Ok(VtableParam(obligations)) Ok(VtableParam(obligations))
} }
DefaultTraitCandidate(trait_def_id) => { DefaultImplCandidate(trait_def_id) => {
let data = try!(self.confirm_default_impl_candidate(obligation, trait_def_id)); let data = try!(self.confirm_default_impl_candidate(obligation, trait_def_id));
Ok(VtableDefaultTrait(data)) Ok(VtableDefaultImpl(data))
} }
ImplCandidate(impl_def_id) => { ImplCandidate(impl_def_id) => {
@ -1868,7 +1868,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
fn confirm_default_impl_candidate(&mut self, fn confirm_default_impl_candidate(&mut self,
obligation: &TraitObligation<'tcx>, obligation: &TraitObligation<'tcx>,
impl_def_id: ast::DefId) impl_def_id: ast::DefId)
-> Result<VtableDefaultTraitData<PredicateObligation<'tcx>>, -> Result<VtableDefaultImplData<PredicateObligation<'tcx>>,
SelectionError<'tcx>> SelectionError<'tcx>>
{ {
debug!("confirm_default_impl_candidate({}, {})", debug!("confirm_default_impl_candidate({}, {})",
@ -1884,7 +1884,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
obligation: &TraitObligation<'tcx>, obligation: &TraitObligation<'tcx>,
trait_def_id: ast::DefId, trait_def_id: ast::DefId,
nested: Vec<Ty<'tcx>>) nested: Vec<Ty<'tcx>>)
-> VtableDefaultTraitData<PredicateObligation<'tcx>> -> VtableDefaultImplData<PredicateObligation<'tcx>>
{ {
let derived_cause = self.derived_cause(obligation, ImplDerivedObligation); let derived_cause = self.derived_cause(obligation, ImplDerivedObligation);
let obligations = nested.iter().map(|&nested_ty| { let obligations = nested.iter().map(|&nested_ty| {
@ -1920,7 +1920,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
debug!("vtable_default_impl_data: obligations={}", obligations.repr(self.tcx())); debug!("vtable_default_impl_data: obligations={}", obligations.repr(self.tcx()));
VtableDefaultTraitData { VtableDefaultImplData {
trait_def_id: trait_def_id, trait_def_id: trait_def_id,
nested: obligations nested: obligations
} }
@ -2456,7 +2456,7 @@ impl<'tcx> Repr<'tcx> for SelectionCandidate<'tcx> {
BuiltinCandidate(b) => format!("BuiltinCandidate({:?})", b), BuiltinCandidate(b) => format!("BuiltinCandidate({:?})", b),
ParamCandidate(ref a) => format!("ParamCandidate({})", a.repr(tcx)), ParamCandidate(ref a) => format!("ParamCandidate({})", a.repr(tcx)),
ImplCandidate(a) => format!("ImplCandidate({})", a.repr(tcx)), ImplCandidate(a) => format!("ImplCandidate({})", a.repr(tcx)),
DefaultTraitCandidate(t) => format!("DefaultTraitCandidate({:?})", t), DefaultImplCandidate(t) => format!("DefaultImplCandidate({:?})", t),
ProjectionCandidate => format!("ProjectionCandidate"), ProjectionCandidate => format!("ProjectionCandidate"),
FnPointerCandidate => format!("FnPointerCandidate"), FnPointerCandidate => format!("FnPointerCandidate"),
ObjectCandidate => { ObjectCandidate => {

View file

@ -20,7 +20,7 @@ use util::nodemap::FnvHashSet;
use util::ppaux::Repr; use util::ppaux::Repr;
use super::{Obligation, ObligationCause, PredicateObligation, use super::{Obligation, ObligationCause, PredicateObligation,
VtableImpl, VtableParam, VtableImplData, VtableDefaultTraitData}; VtableImpl, VtableParam, VtableImplData, VtableDefaultImplData};
struct PredicateSet<'a,'tcx:'a> { struct PredicateSet<'a,'tcx:'a> {
tcx: &'a ty::ctxt<'tcx>, tcx: &'a ty::ctxt<'tcx>,
@ -469,7 +469,7 @@ impl<'tcx, N:Repr<'tcx>> Repr<'tcx> for super::Vtable<'tcx, N> {
super::VtableImpl(ref v) => super::VtableImpl(ref v) =>
v.repr(tcx), v.repr(tcx),
super::VtableDefaultTrait(ref t) => super::VtableDefaultImpl(ref t) =>
t.repr(tcx), t.repr(tcx),
super::VtableClosure(ref d, ref s) => super::VtableClosure(ref d, ref s) =>
@ -511,9 +511,9 @@ impl<'tcx, N:Repr<'tcx>> Repr<'tcx> for super::VtableBuiltinData<N> {
} }
} }
impl<'tcx, N:Repr<'tcx>> Repr<'tcx> for super::VtableDefaultTraitData<N> { impl<'tcx, N:Repr<'tcx>> Repr<'tcx> for super::VtableDefaultImplData<N> {
fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String { fn repr(&self, tcx: &ty::ctxt<'tcx>) -> String {
format!("VtableDefaultTraitData(trait_def_id={}, nested={})", format!("VtableDefaultImplData(trait_def_id={}, nested={})",
self.trait_def_id.repr(tcx), self.trait_def_id.repr(tcx),
self.nested.repr(tcx)) self.nested.repr(tcx))
} }

View file

@ -5175,7 +5175,7 @@ pub fn impl_trait_ref<'tcx>(cx: &ctxt<'tcx>, id: ast::DefId)
&None => None &None => None
} }
} }
ast::ItemDefTrait(_, ref ast_trait_ref) => { ast::ItemDefaultImpl(_, ref ast_trait_ref) => {
Some(ty::node_id_to_trait_ref(cx, ast_trait_ref.ref_id)) Some(ty::node_id_to_trait_ref(cx, ast_trait_ref.ref_id))
} }
_ => None _ => None

View file

@ -507,9 +507,9 @@ impl<'tcx, N: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::VtableImplData<
} }
} }
impl<'tcx, N: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::VtableDefaultTraitData<N> { impl<'tcx, N: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::VtableDefaultImplData<N> {
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::VtableDefaultTraitData<N> { fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::VtableDefaultImplData<N> {
traits::VtableDefaultTraitData { traits::VtableDefaultImplData {
trait_def_id: self.trait_def_id, trait_def_id: self.trait_def_id,
nested: self.nested.fold_with(folder), nested: self.nested.fold_with(folder),
} }
@ -528,7 +528,7 @@ impl<'tcx, N: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::Vtable<'tcx, N>
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::Vtable<'tcx, N> { fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::Vtable<'tcx, N> {
match *self { match *self {
traits::VtableImpl(ref v) => traits::VtableImpl(v.fold_with(folder)), traits::VtableImpl(ref v) => traits::VtableImpl(v.fold_with(folder)),
traits::VtableDefaultTrait(ref t) => traits::VtableDefaultTrait(t.fold_with(folder)), traits::VtableDefaultImpl(ref t) => traits::VtableDefaultImpl(t.fold_with(folder)),
traits::VtableClosure(d, ref s) => { traits::VtableClosure(d, ref s) => {
traits::VtableClosure(d, s.fold_with(folder)) traits::VtableClosure(d, s.fold_with(folder))
} }

View file

@ -209,7 +209,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
match item.node { match item.node {
// impls/extern blocks do not break the "public chain" because they // impls/extern blocks do not break the "public chain" because they
// cannot have visibility qualifiers on them anyway // cannot have visibility qualifiers on them anyway
ast::ItemImpl(..) | ast::ItemDefTrait(..) | ast::ItemForeignMod(..) => {} ast::ItemImpl(..) | ast::ItemDefaultImpl(..) | ast::ItemForeignMod(..) => {}
// Traits are a little special in that even if they themselves are // Traits are a little special in that even if they themselves are
// not public they may still be exported. // not public they may still be exported.
@ -802,7 +802,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
def::DefVariant(..) => ck("variant"), def::DefVariant(..) => ck("variant"),
def::DefTy(_, false) => ck("type"), def::DefTy(_, false) => ck("type"),
def::DefTy(_, true) => ck("enum"), def::DefTy(_, true) => ck("enum"),
def::DefTrait(..) => ck("trait"), def::DefaultImpl(..) => ck("trait"),
def::DefStruct(..) => ck("struct"), def::DefStruct(..) => ck("struct"),
def::DefMethod(_, Some(..), _) => ck("trait method"), def::DefMethod(_, Some(..), _) => ck("trait method"),
def::DefMethod(..) => ck("method"), def::DefMethod(..) => ck("method"),
@ -1145,7 +1145,7 @@ impl<'a, 'tcx> SanePrivacyVisitor<'a, 'tcx> {
} }
} }
ast::ItemDefTrait(..) | ast::ItemDefaultImpl(..) |
ast::ItemConst(..) | ast::ItemStatic(..) | ast::ItemStruct(..) | ast::ItemConst(..) | ast::ItemStatic(..) | ast::ItemStruct(..) |
ast::ItemFn(..) | ast::ItemMod(..) | ast::ItemTy(..) | ast::ItemFn(..) | ast::ItemMod(..) | ast::ItemTy(..) |
ast::ItemExternCrate(_) | ast::ItemUse(_) | ast::ItemMac(..) => {} ast::ItemExternCrate(_) | ast::ItemUse(_) | ast::ItemMac(..) => {}
@ -1205,7 +1205,7 @@ impl<'a, 'tcx> SanePrivacyVisitor<'a, 'tcx> {
} }
} }
ast::ItemDefTrait(..) | ast::ItemExternCrate(_) | ast::ItemUse(_) | ast::ItemDefaultImpl(..) | ast::ItemExternCrate(_) | ast::ItemUse(_) |
ast::ItemStatic(..) | ast::ItemConst(..) | ast::ItemStatic(..) | ast::ItemConst(..) |
ast::ItemFn(..) | ast::ItemMod(..) | ast::ItemTy(..) | ast::ItemFn(..) | ast::ItemMod(..) | ast::ItemTy(..) |
ast::ItemMac(..) => {} ast::ItemMac(..) => {}

View file

@ -40,7 +40,7 @@ use syntax::ast::{Block, Crate};
use syntax::ast::{DeclItem, DefId}; use syntax::ast::{DeclItem, DefId};
use syntax::ast::{ForeignItem, ForeignItemFn, ForeignItemStatic}; use syntax::ast::{ForeignItem, ForeignItemFn, ForeignItemStatic};
use syntax::ast::{Item, ItemConst, ItemEnum, ItemExternCrate, ItemFn}; use syntax::ast::{Item, ItemConst, ItemEnum, ItemExternCrate, ItemFn};
use syntax::ast::{ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic, ItemDefTrait}; use syntax::ast::{ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic, ItemDefaultImpl};
use syntax::ast::{ItemStruct, ItemTrait, ItemTy, ItemUse}; use syntax::ast::{ItemStruct, ItemTrait, ItemTy, ItemUse};
use syntax::ast::{MethodImplItem, Name, NamedField, NodeId}; use syntax::ast::{MethodImplItem, Name, NamedField, NodeId};
use syntax::ast::{PathListIdent, PathListMod}; use syntax::ast::{PathListIdent, PathListMod};
@ -656,7 +656,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
parent.clone() parent.clone()
} }
ItemDefTrait(_, _) | ItemDefaultImpl(_, _) |
ItemImpl(_, _, _, Some(_), _, _) => parent.clone(), ItemImpl(_, _, _, Some(_), _, _) => parent.clone(),
ItemTrait(_, _, _, ref items) => { ItemTrait(_, _, _, ref items) => {
@ -736,7 +736,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
self.trait_item_map.insert((name, def_id), kind); self.trait_item_map.insert((name, def_id), kind);
} }
name_bindings.define_type(DefTrait(def_id), sp, modifiers); name_bindings.define_type(DefaultImpl(def_id), sp, modifiers);
parent.clone() parent.clone()
} }
ItemMac(..) => parent.clone() ItemMac(..) => parent.clone()
@ -918,7 +918,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
} }
child_name_bindings.define_value(def, DUMMY_SP, modifiers); child_name_bindings.define_value(def, DUMMY_SP, modifiers);
} }
DefTrait(def_id) => { DefaultImpl(def_id) => {
debug!("(building reduced graph for external \ debug!("(building reduced graph for external \
crate) building type {}", final_ident); crate) building type {}", final_ident);

View file

@ -70,7 +70,7 @@ use syntax::ast::{ExprClosure, ExprLoop, ExprWhile, ExprMethodCall};
use syntax::ast::{ExprPath, ExprQPath, ExprStruct, FnDecl}; use syntax::ast::{ExprPath, ExprQPath, ExprStruct, FnDecl};
use syntax::ast::{ForeignItemFn, ForeignItemStatic, Generics}; use syntax::ast::{ForeignItemFn, ForeignItemStatic, Generics};
use syntax::ast::{Ident, ImplItem, Item, ItemConst, ItemEnum, ItemExternCrate}; use syntax::ast::{Ident, ImplItem, Item, ItemConst, ItemEnum, ItemExternCrate};
use syntax::ast::{ItemFn, ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic, ItemDefTrait}; use syntax::ast::{ItemFn, ItemForeignMod, ItemImpl, ItemMac, ItemMod, ItemStatic, ItemDefaultImpl};
use syntax::ast::{ItemStruct, ItemTrait, ItemTy, ItemUse}; use syntax::ast::{ItemStruct, ItemTrait, ItemTy, ItemUse};
use syntax::ast::{Local, MethodImplItem, Mod, Name, NodeId}; use syntax::ast::{Local, MethodImplItem, Mod, Name, NodeId};
use syntax::ast::{Pat, PatEnum, PatIdent, PatLit}; use syntax::ast::{Pat, PatEnum, PatIdent, PatLit};
@ -2840,7 +2840,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
}); });
} }
ItemDefTrait(_, ref trait_ref) => { ItemDefaultImpl(_, ref trait_ref) => {
self.resolve_trait_reference(item.id, trait_ref, TraitImplementation); self.resolve_trait_reference(item.id, trait_ref, TraitImplementation);
} }
ItemImpl(_, _, ItemImpl(_, _,
@ -3199,7 +3199,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
} }
Some(def) => { Some(def) => {
match def { match def {
(DefTrait(_), _) => { (DefaultImpl(_), _) => {
debug!("(resolving trait) found trait def: {:?}", def); debug!("(resolving trait) found trait def: {:?}", def);
self.record_def(trait_reference.ref_id, def); self.record_def(trait_reference.ref_id, def);
} }
@ -4675,7 +4675,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
None => continue None => continue
}; };
let trait_def_id = match def { let trait_def_id = match def {
DefTrait(trait_def_id) => trait_def_id, DefaultImpl(trait_def_id) => trait_def_id,
_ => continue, _ => continue,
}; };
if self.trait_item_map.contains_key(&(name, trait_def_id)) { if self.trait_item_map.contains_key(&(name, trait_def_id)) {
@ -4691,7 +4691,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
Some(target) => target, Some(target) => target,
}; };
let did = match target.bindings.def_for_namespace(TypeNS) { let did = match target.bindings.def_for_namespace(TypeNS) {
Some(DefTrait(trait_def_id)) => trait_def_id, Some(DefaultImpl(trait_def_id)) => trait_def_id,
Some(..) | None => continue, Some(..) | None => continue,
}; };
if self.trait_item_map.contains_key(&(name, did)) { if self.trait_item_map.contains_key(&(name, did)) {

View file

@ -239,7 +239,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
def::DefTy(..) | def::DefTy(..) |
def::DefAssociatedTy(..) | def::DefAssociatedTy(..) |
def::DefAssociatedPath(..) | def::DefAssociatedPath(..) |
def::DefTrait(_) => Some(recorder::TypeRef), def::DefaultImpl(_) => Some(recorder::TypeRef),
def::DefStatic(_, _) | def::DefStatic(_, _) |
def::DefConst(_) | def::DefConst(_) |
def::DefLocal(_) | def::DefLocal(_) |

View file

@ -207,7 +207,7 @@ fn trans<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, expr: &ast::Expr)
def::DefUpvar(..) => { def::DefUpvar(..) => {
datum_callee(bcx, ref_expr) datum_callee(bcx, ref_expr)
} }
def::DefMod(..) | def::DefForeignMod(..) | def::DefTrait(..) | def::DefMod(..) | def::DefForeignMod(..) | def::DefaultImpl(..) |
def::DefTy(..) | def::DefPrimTy(..) | def::DefAssociatedTy(..) | def::DefTy(..) | def::DefPrimTy(..) | def::DefAssociatedTy(..) |
def::DefUse(..) | def::DefTyParamBinder(..) | def::DefUse(..) | def::DefTyParamBinder(..) |
def::DefRegion(..) | def::DefLabel(..) | def::DefTyParam(..) | def::DefRegion(..) | def::DefLabel(..) | def::DefTyParam(..) |

View file

@ -390,7 +390,7 @@ fn trans_monomorphized_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
Callee { bcx: bcx, data: Fn(llfn) } Callee { bcx: bcx, data: Fn(llfn) }
} }
traits::VtableBuiltin(..) | traits::VtableBuiltin(..) |
traits::VtableDefaultTrait(..) | traits::VtableDefaultImpl(..) |
traits::VtableParam(..) => { traits::VtableParam(..) => {
bcx.sess().bug( bcx.sess().bug(
&format!("resolved vtable bad vtable {} in trans", &format!("resolved vtable bad vtable {} in trans",
@ -716,7 +716,7 @@ pub fn get_vtable<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
let vtable = fulfill_obligation(ccx, DUMMY_SP, trait_ref.clone()); let vtable = fulfill_obligation(ccx, DUMMY_SP, trait_ref.clone());
match vtable { match vtable {
// Should default trait error here? // Should default trait error here?
traits::VtableDefaultTrait(_) | traits::VtableDefaultImpl(_) |
traits::VtableBuiltin(_) => { traits::VtableBuiltin(_) => {
Vec::new().into_iter() Vec::new().into_iter()
} }

View file

@ -617,7 +617,7 @@ pub fn instantiate_trait_ref<'tcx>(
-> Rc<ty::TraitRef<'tcx>> -> Rc<ty::TraitRef<'tcx>>
{ {
match ::lookup_def_tcx(this.tcx(), ast_trait_ref.path.span, ast_trait_ref.ref_id) { match ::lookup_def_tcx(this.tcx(), ast_trait_ref.path.span, ast_trait_ref.ref_id) {
def::DefTrait(trait_def_id) => { def::DefaultImpl(trait_def_id) => {
let trait_ref = ast_path_to_trait_ref(this, let trait_ref = ast_path_to_trait_ref(this,
rscope, rscope,
trait_def_id, trait_def_id,
@ -931,7 +931,7 @@ fn ast_ty_to_trait_ref<'tcx>(this: &AstConv<'tcx>,
match ty.node { match ty.node {
ast::TyPath(ref path, id) => { ast::TyPath(ref path, id) => {
match this.tcx().def_map.borrow().get(&id) { match this.tcx().def_map.borrow().get(&id) {
Some(&def::DefTrait(trait_def_id)) => { Some(&def::DefaultImpl(trait_def_id)) => {
let mut projection_bounds = Vec::new(); let mut projection_bounds = Vec::new();
let trait_ref = object_path_to_poly_trait_ref(this, let trait_ref = object_path_to_poly_trait_ref(this,
rscope, rscope,
@ -1211,7 +1211,7 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
Some(&d) => d Some(&d) => d
}; };
match a_def { match a_def {
def::DefTrait(trait_def_id) => { def::DefaultImpl(trait_def_id) => {
// N.B. this case overlaps somewhat with // N.B. this case overlaps somewhat with
// TyObjectSum, see that fn for details // TyObjectSum, see that fn for details
let mut projection_bounds = Vec::new(); let mut projection_bounds = Vec::new();
@ -1821,7 +1821,7 @@ pub fn partition_bounds<'a>(tcx: &ty::ctxt,
match *ast_bound { match *ast_bound {
ast::TraitTyParamBound(ref b, ast::TraitBoundModifier::None) => { ast::TraitTyParamBound(ref b, ast::TraitBoundModifier::None) => {
match ::lookup_def_tcx(tcx, b.trait_ref.path.span, b.trait_ref.ref_id) { match ::lookup_def_tcx(tcx, b.trait_ref.path.span, b.trait_ref.ref_id) {
def::DefTrait(trait_did) => { def::DefaultImpl(trait_did) => {
match trait_def_ids.get(&trait_did) { match trait_def_ids.get(&trait_did) {
// Already seen this trait. We forbid // Already seen this trait. We forbid
// duplicates in the list (for some // duplicates in the list (for some

View file

@ -435,7 +435,7 @@ pub fn check_pat_struct<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>, pat: &'tcx ast::Pat,
let def = tcx.def_map.borrow()[pat.id].clone(); let def = tcx.def_map.borrow()[pat.id].clone();
let (enum_def_id, variant_def_id) = match def { let (enum_def_id, variant_def_id) = match def {
def::DefTrait(_) => { def::DefaultImpl(_) => {
let name = pprust::path_to_string(path); let name = pprust::path_to_string(path);
span_err!(tcx.sess, pat.span, E0168, span_err!(tcx.sess, pat.span, E0168,
"use of trait `{}` in a struct pattern", name); "use of trait `{}` in a struct pattern", name);

View file

@ -330,7 +330,7 @@ pub fn all_traits<'a>(ccx: &'a CrateCtxt) -> AllTraits<'a> {
cstore: &cstore::CStore, cstore: &cstore::CStore,
dl: decoder::DefLike) { dl: decoder::DefLike) {
match dl { match dl {
decoder::DlDef(def::DefTrait(did)) => { decoder::DlDef(def::DefaultImpl(did)) => {
traits.push(TraitInfo::new(did)); traits.push(TraitInfo::new(did));
} }
decoder::DlDef(def::DefMod(did)) => { decoder::DlDef(def::DefMod(did)) => {

View file

@ -3858,7 +3858,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
variant_id, &fields[..]); variant_id, &fields[..]);
enum_id enum_id
} }
Some(def::DefTrait(def_id)) => { Some(def::DefaultImpl(def_id)) => {
span_err!(tcx.sess, path.span, E0159, span_err!(tcx.sess, path.span, E0159,
"use of trait `{}` as a struct constructor", "use of trait `{}` as a struct constructor",
pprust::path_to_string(path)); pprust::path_to_string(path));
@ -4630,7 +4630,7 @@ fn type_scheme_and_predicates_for_def<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
def::DefStruct(id) | def::DefConst(id) => { def::DefStruct(id) | def::DefConst(id) => {
(ty::lookup_item_type(fcx.tcx(), id), ty::lookup_predicates(fcx.tcx(), id)) (ty::lookup_item_type(fcx.tcx(), id), ty::lookup_predicates(fcx.tcx(), id))
} }
def::DefTrait(_) | def::DefaultImpl(_) |
def::DefTy(..) | def::DefTy(..) |
def::DefAssociatedTy(..) | def::DefAssociatedTy(..) |
def::DefAssociatedPath(..) | def::DefAssociatedPath(..) |
@ -4734,7 +4734,7 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
def::DefTy(..) | def::DefTy(..) |
def::DefAssociatedTy(..) | def::DefAssociatedTy(..) |
def::DefAssociatedPath(..) | def::DefAssociatedPath(..) |
def::DefTrait(..) | def::DefaultImpl(..) |
def::DefPrimTy(..) | def::DefPrimTy(..) |
def::DefTyParam(..) => { def::DefTyParam(..) => {
// Everything but the final segment should have no // Everything but the final segment should have no

View file

@ -96,7 +96,7 @@ impl<'cx, 'tcx,'v> visit::Visitor<'v> for OrphanChecker<'cx, 'tcx> {
} }
} }
} }
ast::ItemDefTrait(_, ref ast_trait_ref) => { ast::ItemDefaultImpl(_, ref ast_trait_ref) => {
// "Trait" impl // "Trait" impl
debug!("coherence2::orphan check: default trait impl {}", item.repr(self.tcx)); 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::node_id_to_trait_ref(self.tcx, ast_trait_ref.ref_id);

View file

@ -648,7 +648,7 @@ fn convert_item(ccx: &CollectCtxt, it: &ast::Item) {
predicates, predicates,
&enum_definition.variants); &enum_definition.variants);
}, },
ast::ItemDefTrait(_, ref ast_trait_ref) => { ast::ItemDefaultImpl(_, ref ast_trait_ref) => {
let trait_ref = astconv::instantiate_trait_ref(ccx, &ExplicitRscope, let trait_ref = astconv::instantiate_trait_ref(ccx, &ExplicitRscope,
ast_trait_ref, None, None); ast_trait_ref, None, None);
@ -1147,7 +1147,7 @@ fn compute_type_scheme_of_item<'a,'tcx>(ccx: &CollectCtxt<'a,'tcx>,
let t = ty::mk_struct(tcx, local_def(it.id), tcx.mk_substs(substs)); let t = ty::mk_struct(tcx, local_def(it.id), tcx.mk_substs(substs));
ty::TypeScheme { ty: t, generics: ty_generics } ty::TypeScheme { ty: t, generics: ty_generics }
} }
ast::ItemDefTrait(..) | ast::ItemDefaultImpl(..) |
ast::ItemTrait(..) | ast::ItemTrait(..) |
ast::ItemImpl(..) | ast::ItemImpl(..) |
ast::ItemMod(..) | ast::ItemMod(..) |

View file

@ -476,7 +476,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for TermsContext<'a, 'tcx> {
ast::ItemExternCrate(_) | ast::ItemExternCrate(_) |
ast::ItemUse(_) | ast::ItemUse(_) |
ast::ItemDefTrait(..) | ast::ItemDefaultImpl(..) |
ast::ItemImpl(..) | ast::ItemImpl(..) |
ast::ItemStatic(..) | ast::ItemStatic(..) |
ast::ItemConst(..) | ast::ItemConst(..) |
@ -627,7 +627,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for ConstraintContext<'a, 'tcx> {
ast::ItemForeignMod(..) | ast::ItemForeignMod(..) |
ast::ItemTy(..) | ast::ItemTy(..) |
ast::ItemImpl(..) | ast::ItemImpl(..) |
ast::ItemDefTrait(..) | ast::ItemDefaultImpl(..) |
ast::ItemMac(..) => { ast::ItemMac(..) => {
} }
} }

View file

@ -69,7 +69,7 @@ fn try_inline_def(cx: &DocContext, tcx: &ty::ctxt,
let mut ret = Vec::new(); let mut ret = Vec::new();
let did = def.def_id(); let did = def.def_id();
let inner = match def { let inner = match def {
def::DefTrait(did) => { def::DefaultImpl(did) => {
record_extern_fqn(cx, did, clean::TypeTrait); record_extern_fqn(cx, did, clean::TypeTrait);
clean::TraitItem(build_external_trait(cx, tcx, did)) clean::TraitItem(build_external_trait(cx, tcx, did))
} }

View file

@ -2431,7 +2431,7 @@ fn register_def(cx: &DocContext, def: def::Def) -> ast::DefId {
def::DefFn(i, _) => (i, TypeFunction), def::DefFn(i, _) => (i, TypeFunction),
def::DefTy(i, false) => (i, TypeTypedef), def::DefTy(i, false) => (i, TypeTypedef),
def::DefTy(i, true) => (i, TypeEnum), def::DefTy(i, true) => (i, TypeEnum),
def::DefTrait(i) => (i, TypeTrait), def::DefaultImpl(i) => (i, TypeTrait),
def::DefStruct(i) => (i, TypeStruct), def::DefStruct(i) => (i, TypeStruct),
def::DefMod(i) => (i, TypeModule), def::DefMod(i) => (i, TypeModule),
def::DefStatic(i, _) => (i, TypeStatic), def::DefStatic(i, _) => (i, TypeStatic),

View file

@ -39,7 +39,7 @@ pub struct Module {
pub vis: ast::Visibility, pub vis: ast::Visibility,
pub stab: Option<attr::Stability>, pub stab: Option<attr::Stability>,
pub impls: Vec<Impl>, pub impls: Vec<Impl>,
pub def_traits: Vec<DefaultTrait>, pub def_traits: Vec<DefaultImpl>,
pub foreigns: Vec<ast::ForeignMod>, pub foreigns: Vec<ast::ForeignMod>,
pub macros: Vec<Macro>, pub macros: Vec<Macro>,
pub is_crate: bool, pub is_crate: bool,
@ -198,7 +198,7 @@ pub struct Impl {
pub id: ast::NodeId, pub id: ast::NodeId,
} }
pub struct DefaultTrait { pub struct DefaultImpl {
pub unsafety: ast::Unsafety, pub unsafety: ast::Unsafety,
pub trait_: ast::TraitRef, pub trait_: ast::TraitRef,
pub id: ast::NodeId, pub id: ast::NodeId,

View file

@ -358,8 +358,8 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
}; };
om.impls.push(i); om.impls.push(i);
}, },
ast::ItemDefTrait(unsafety, ref trait_ref) => { ast::ItemDefaultImpl(unsafety, ref trait_ref) => {
let i = DefaultTrait { let i = DefaultImpl {
unsafety: unsafety, unsafety: unsafety,
trait_: trait_ref.clone(), trait_: trait_ref.clone(),
id: item.id id: item.id

View file

@ -1644,7 +1644,7 @@ pub enum Item_ {
// Default trait implementations // Default trait implementations
// `impl Trait for ..` // `impl Trait for ..`
ItemDefTrait(Unsafety, TraitRef), ItemDefaultImpl(Unsafety, TraitRef),
ItemImpl(Unsafety, ItemImpl(Unsafety,
ImplPolarity, ImplPolarity,
Generics, Generics,
@ -1671,7 +1671,7 @@ impl Item_ {
ItemTrait(..) => "trait", ItemTrait(..) => "trait",
ItemMac(..) | ItemMac(..) |
ItemImpl(..) | ItemImpl(..) |
ItemDefTrait(..) => "item" ItemDefaultImpl(..) => "item"
} }
} }
} }

View file

@ -1044,7 +1044,7 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
ItemStruct(..) => "struct", ItemStruct(..) => "struct",
ItemTrait(..) => "trait", ItemTrait(..) => "trait",
ItemImpl(..) => "impl", ItemImpl(..) => "impl",
ItemDefTrait(..) => "default impl", ItemDefaultImpl(..) => "default impl",
ItemMac(..) => "macro" ItemMac(..) => "macro"
}; };
format!("{} {}{}", item_str, path_str, id_str) format!("{} {}{}", item_str, path_str, id_str)

View file

@ -999,8 +999,8 @@ pub fn noop_fold_item_underscore<T: Folder>(i: Item_, folder: &mut T) -> Item_ {
let struct_def = folder.fold_struct_def(struct_def); let struct_def = folder.fold_struct_def(struct_def);
ItemStruct(struct_def, folder.fold_generics(generics)) ItemStruct(struct_def, folder.fold_generics(generics))
} }
ItemDefTrait(unsafety, ref trait_ref) => { ItemDefaultImpl(unsafety, ref trait_ref) => {
ItemDefTrait(unsafety, folder.fold_trait_ref((*trait_ref).clone())) ItemDefaultImpl(unsafety, folder.fold_trait_ref((*trait_ref).clone()))
} }
ItemImpl(unsafety, polarity, generics, ifce, ty, impl_items) => { ItemImpl(unsafety, polarity, generics, ifce, ty, impl_items) => {
let new_impl_items = impl_items.into_iter().flat_map(|item| { let new_impl_items = impl_items.into_iter().flat_map(|item| {

View file

@ -31,7 +31,7 @@ use ast::{ExprVec, ExprWhile, ExprWhileLet, ExprForLoop, Field, FnDecl};
use ast::{ForeignItem, ForeignItemStatic, ForeignItemFn, ForeignMod, FunctionRetTy}; use ast::{ForeignItem, ForeignItemStatic, ForeignItemFn, ForeignMod, FunctionRetTy};
use ast::{Ident, Inherited, ImplItem, Item, Item_, ItemStatic}; use ast::{Ident, Inherited, ImplItem, Item, Item_, ItemStatic};
use ast::{ItemEnum, ItemFn, ItemForeignMod, ItemImpl, ItemConst}; use ast::{ItemEnum, ItemFn, ItemForeignMod, ItemImpl, ItemConst};
use ast::{ItemMac, ItemMod, ItemStruct, ItemTrait, ItemTy, ItemDefTrait}; use ast::{ItemMac, ItemMod, ItemStruct, ItemTrait, ItemTy, ItemDefaultImpl};
use ast::{ItemExternCrate, ItemUse}; use ast::{ItemExternCrate, ItemUse};
use ast::{LifetimeDef, Lit, Lit_}; use ast::{LifetimeDef, Lit, Lit_};
use ast::{LitBool, LitChar, LitByte, LitBinary}; use ast::{LitBool, LitChar, LitByte, LitBinary};
@ -4843,7 +4843,7 @@ impl<'a> Parser<'a> {
self.expect(&token::OpenDelim(token::Brace)); self.expect(&token::OpenDelim(token::Brace));
self.expect(&token::CloseDelim(token::Brace)); self.expect(&token::CloseDelim(token::Brace));
(ast_util::impl_pretty_name(&opt_trait, None), (ast_util::impl_pretty_name(&opt_trait, None),
ItemDefTrait(unsafety, opt_trait.unwrap()), None) ItemDefaultImpl(unsafety, opt_trait.unwrap()), None)
} else { } else {
if opt_trait.is_some() { if opt_trait.is_some() {
ty = self.parse_ty_sum(); ty = self.parse_ty_sum();

View file

@ -926,7 +926,7 @@ impl<'a> State<'a> {
try!(self.print_struct(&**struct_def, generics, item.ident, item.span)); try!(self.print_struct(&**struct_def, generics, item.ident, item.span));
} }
ast::ItemDefTrait(unsafety, ref trait_ref) => { ast::ItemDefaultImpl(unsafety, ref trait_ref) => {
try!(self.head("")); try!(self.head(""));
try!(self.print_visibility(item.vis)); try!(self.print_visibility(item.vis));
try!(self.print_unsafety(unsafety)); try!(self.print_unsafety(unsafety));

View file

@ -282,7 +282,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
visitor.visit_generics(type_parameters); visitor.visit_generics(type_parameters);
walk_enum_def(visitor, enum_definition, type_parameters) walk_enum_def(visitor, enum_definition, type_parameters)
} }
ItemDefTrait(_, ref trait_ref) => { ItemDefaultImpl(_, ref trait_ref) => {
visitor.visit_trait_ref(trait_ref) visitor.visit_trait_ref(trait_ref)
} }
ItemImpl(_, _, ItemImpl(_, _,