Rename DefTrait to DefaultImpl
This commit is contained in:
parent
7e382132a5
commit
d38aab397e
36 changed files with 93 additions and 93 deletions
|
@ -126,7 +126,7 @@ enum Family {
|
|||
TupleVariant, // v
|
||||
StructVariant, // V
|
||||
Impl, // i
|
||||
DefTrait, // d
|
||||
DefaultImpl, // d
|
||||
Trait, // I
|
||||
Struct, // S
|
||||
PublicField, // g
|
||||
|
@ -152,7 +152,7 @@ fn item_family(item: rbml::Doc) -> Family {
|
|||
'v' => TupleVariant,
|
||||
'V' => StructVariant,
|
||||
'i' => Impl,
|
||||
'd' => DefTrait,
|
||||
'd' => DefaultImpl,
|
||||
'I' => Trait,
|
||||
'S' => Struct,
|
||||
'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);
|
||||
DlDef(def::DefVariant(enum_did, did, false))
|
||||
}
|
||||
Trait => DlDef(def::DefTrait(did)),
|
||||
Trait => DlDef(def::DefaultImpl(did)),
|
||||
Enum => DlDef(def::DefTy(did, true)),
|
||||
Impl | DefTrait => DlImpl(did),
|
||||
Impl | DefaultImpl => DlImpl(did),
|
||||
PublicField | InheritedField => DlField,
|
||||
}
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ pub fn get_impl_trait<'tcx>(cdata: Cmd,
|
|||
let item_doc = lookup_item(id, cdata.data());
|
||||
let fam = item_family(item_doc);
|
||||
match fam {
|
||||
Family::Impl | Family::DefTrait => {
|
||||
Family::Impl | Family::DefaultImpl => {
|
||||
reader::maybe_get_doc(item_doc, tag_item_trait_ref).map(|tp| {
|
||||
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());
|
||||
match item_family(parent_item_doc) {
|
||||
Trait => Some(item_def_id(parent_item_doc, cdata)),
|
||||
Impl | DefTrait => {
|
||||
Impl | DefaultImpl => {
|
||||
reader::maybe_get_doc(parent_item_doc, tag_item_trait_ref)
|
||||
.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 {
|
||||
let item_doc = lookup_item(id, cdata.data());
|
||||
match item_family(item_doc) {
|
||||
Family::DefTrait => true,
|
||||
Family::DefaultImpl => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1201,7 +1201,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
|
|||
None => {}
|
||||
}
|
||||
}
|
||||
ast::ItemDefTrait(unsafety, ref ast_trait_ref) => {
|
||||
ast::ItemDefaultImpl(unsafety, ref ast_trait_ref) => {
|
||||
add_to_index(item, rbml_w, index);
|
||||
rbml_w.start_tag(tag_items_data_item);
|
||||
encode_def_id(rbml_w, def_id);
|
||||
|
|
|
@ -440,7 +440,7 @@ impl tr for def::Def {
|
|||
def::DefVariant(e_did, v_did, 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::DefAssociatedTy(did) => def::DefAssociatedTy(did.tr(dcx)),
|
||||
def::DefAssociatedPath(def::TyParamProvenance::FromSelf(did), ident) =>
|
||||
|
|
|
@ -38,7 +38,7 @@ pub enum Def {
|
|||
// type `U` (indicated by the Ident).
|
||||
// FIXME(#20301) -- should use Name
|
||||
DefAssociatedPath(TyParamProvenance, ast::Ident),
|
||||
DefTrait(ast::DefId),
|
||||
DefaultImpl(ast::DefId),
|
||||
DefPrimTy(ast::PrimTy),
|
||||
DefTyParam(ParamSpace, u32, ast::DefId, ast::Name),
|
||||
DefUse(ast::DefId),
|
||||
|
@ -135,7 +135,7 @@ impl Def {
|
|||
DefFn(id, _) | DefStaticMethod(id, _) | DefMod(id) |
|
||||
DefForeignMod(id) | DefStatic(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) |
|
||||
DefAssociatedPath(TyParamProvenance::FromSelf(id), _) |
|
||||
DefAssociatedPath(TyParamProvenance::FromParam(id), _) => {
|
||||
|
|
|
@ -579,7 +579,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
|
|||
Ok(self.cat_rvalue_node(id, span, expr_ty))
|
||||
}
|
||||
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::DefLabel(_) | def::DefSelfTy(..) |
|
||||
def::DefAssociatedTy(..) | def::DefAssociatedPath(..)=> {
|
||||
|
|
|
@ -302,7 +302,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
|
|||
ast::ItemMod(..) | ast::ItemForeignMod(..) |
|
||||
ast::ItemImpl(..) | ast::ItemTrait(..) |
|
||||
ast::ItemStruct(..) | ast::ItemEnum(..) |
|
||||
ast::ItemDefTrait(..) => {}
|
||||
ast::ItemDefaultImpl(..) => {}
|
||||
|
||||
_ => {
|
||||
self.tcx.sess.span_bug(item.span,
|
||||
|
|
|
@ -115,7 +115,7 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> {
|
|||
ast::ItemUse(_) |
|
||||
ast::ItemMod(..) |
|
||||
ast::ItemMac(..) |
|
||||
ast::ItemDefTrait(..) |
|
||||
ast::ItemDefaultImpl(..) |
|
||||
ast::ItemForeignMod(..) |
|
||||
ast::ItemStatic(..) |
|
||||
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
|
||||
// a trait ref, which introduces a binding scope.
|
||||
match self.def_map.borrow().get(&id) {
|
||||
Some(&def::DefTrait(..)) => {
|
||||
Some(&def::DefaultImpl(..)) => {
|
||||
self.with(LateScope(&Vec::new(), self.scope), |_, this| {
|
||||
this.visit_path(path, id);
|
||||
});
|
||||
|
|
|
@ -222,7 +222,7 @@ pub enum Vtable<'tcx, N> {
|
|||
VtableImpl(VtableImplData<'tcx, N>),
|
||||
|
||||
/// Vtable for default trait implementations
|
||||
VtableDefaultTrait(VtableDefaultTraitData<N>),
|
||||
VtableDefaultImpl(VtableDefaultImplData<N>),
|
||||
|
||||
/// Successful resolution to an obligation provided by the caller
|
||||
/// for some type parameter. The `Vec<N>` represents the
|
||||
|
@ -263,7 +263,7 @@ pub struct VtableImplData<'tcx, N> {
|
|||
}
|
||||
|
||||
#[derive(Debug,Clone)]
|
||||
pub struct VtableDefaultTraitData<N> {
|
||||
pub struct VtableDefaultImplData<N> {
|
||||
pub trait_def_id: ast::DefId,
|
||||
pub nested: Vec<N>
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ impl<'tcx, N> Vtable<'tcx, N> {
|
|||
VtableParam(ref n) => n.iter(),
|
||||
VtableBuiltin(ref i) => i.iter_nested(),
|
||||
VtableObject(_) |
|
||||
VtableDefaultTrait(..) | VtableFnPointer(..) |
|
||||
VtableDefaultImpl(..) | VtableFnPointer(..) |
|
||||
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 {
|
||||
match *self {
|
||||
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()),
|
||||
VtableClosure(d, ref s) => VtableClosure(d, s.clone()),
|
||||
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)),
|
||||
VtableFnPointer(sig) => VtableFnPointer(sig),
|
||||
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()),
|
||||
VtableObject(p) => VtableObject(p),
|
||||
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> {
|
||||
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,
|
||||
{
|
||||
VtableDefaultTraitData {
|
||||
VtableDefaultImplData {
|
||||
trait_def_id: self.trait_def_id,
|
||||
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,
|
||||
{
|
||||
let VtableDefaultTraitData { trait_def_id, nested } = self;
|
||||
VtableDefaultTraitData {
|
||||
let VtableDefaultImplData { trait_def_id, nested } = self;
|
||||
VtableDefaultImplData {
|
||||
trait_def_id: trait_def_id,
|
||||
nested: nested.into_iter().map(op).collect()
|
||||
}
|
||||
|
|
|
@ -709,7 +709,7 @@ fn assemble_candidates_from_impls<'cx,'tcx>(
|
|||
// projection. And the projection where clause is handled
|
||||
// in `assemble_candidates_from_param_env`.
|
||||
}
|
||||
super::VtableDefaultTrait(..) |
|
||||
super::VtableDefaultImpl(..) |
|
||||
super::VtableBuiltin(..) => {
|
||||
// These traits have no associated types.
|
||||
selcx.tcx().sess.span_bug(
|
||||
|
|
|
@ -26,8 +26,8 @@ use super::{SelectionError, Unimplemented, Overflow, OutputTypeParameterMismatch
|
|||
use super::{Selection};
|
||||
use super::{SelectionResult};
|
||||
use super::{VtableBuiltin, VtableImpl, VtableParam, VtableClosure,
|
||||
VtableFnPointer, VtableObject, VtableDefaultTrait};
|
||||
use super::{VtableImplData, VtableObjectData, VtableBuiltinData, VtableDefaultTraitData};
|
||||
VtableFnPointer, VtableObject, VtableDefaultImpl};
|
||||
use super::{VtableImplData, VtableObjectData, VtableBuiltinData, VtableDefaultImplData};
|
||||
use super::object_safety;
|
||||
use super::{util};
|
||||
|
||||
|
@ -136,7 +136,7 @@ enum SelectionCandidate<'tcx> {
|
|||
BuiltinCandidate(ty::BuiltinBound),
|
||||
ParamCandidate(ty::PolyTraitRef<'tcx>),
|
||||
ImplCandidate(ast::DefId),
|
||||
DefaultTraitCandidate(ast::DefId),
|
||||
DefaultImplCandidate(ast::DefId),
|
||||
|
||||
/// This is a trait matching with a projected type as `Self`, and
|
||||
/// 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) {
|
||||
candidates.vec.push(DefaultTraitCandidate(def_id.clone()))
|
||||
candidates.vec.push(DefaultImplCandidate(def_id.clone()))
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -1275,7 +1275,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
// #18453.
|
||||
true
|
||||
}
|
||||
(&DefaultTraitCandidate(_), _) => {
|
||||
(&DefaultImplCandidate(_), _) => {
|
||||
// Prefer other candidates over default implementations.
|
||||
true
|
||||
}
|
||||
|
@ -1728,9 +1728,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
Ok(VtableParam(obligations))
|
||||
}
|
||||
|
||||
DefaultTraitCandidate(trait_def_id) => {
|
||||
DefaultImplCandidate(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) => {
|
||||
|
@ -1868,7 +1868,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
fn confirm_default_impl_candidate(&mut self,
|
||||
obligation: &TraitObligation<'tcx>,
|
||||
impl_def_id: ast::DefId)
|
||||
-> Result<VtableDefaultTraitData<PredicateObligation<'tcx>>,
|
||||
-> Result<VtableDefaultImplData<PredicateObligation<'tcx>>,
|
||||
SelectionError<'tcx>>
|
||||
{
|
||||
debug!("confirm_default_impl_candidate({}, {})",
|
||||
|
@ -1884,7 +1884,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
obligation: &TraitObligation<'tcx>,
|
||||
trait_def_id: ast::DefId,
|
||||
nested: Vec<Ty<'tcx>>)
|
||||
-> VtableDefaultTraitData<PredicateObligation<'tcx>>
|
||||
-> VtableDefaultImplData<PredicateObligation<'tcx>>
|
||||
{
|
||||
let derived_cause = self.derived_cause(obligation, ImplDerivedObligation);
|
||||
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()));
|
||||
|
||||
VtableDefaultTraitData {
|
||||
VtableDefaultImplData {
|
||||
trait_def_id: trait_def_id,
|
||||
nested: obligations
|
||||
}
|
||||
|
@ -2456,7 +2456,7 @@ impl<'tcx> Repr<'tcx> for SelectionCandidate<'tcx> {
|
|||
BuiltinCandidate(b) => format!("BuiltinCandidate({:?})", b),
|
||||
ParamCandidate(ref a) => format!("ParamCandidate({})", a.repr(tcx)),
|
||||
ImplCandidate(a) => format!("ImplCandidate({})", a.repr(tcx)),
|
||||
DefaultTraitCandidate(t) => format!("DefaultTraitCandidate({:?})", t),
|
||||
DefaultImplCandidate(t) => format!("DefaultImplCandidate({:?})", t),
|
||||
ProjectionCandidate => format!("ProjectionCandidate"),
|
||||
FnPointerCandidate => format!("FnPointerCandidate"),
|
||||
ObjectCandidate => {
|
||||
|
|
|
@ -20,7 +20,7 @@ use util::nodemap::FnvHashSet;
|
|||
use util::ppaux::Repr;
|
||||
|
||||
use super::{Obligation, ObligationCause, PredicateObligation,
|
||||
VtableImpl, VtableParam, VtableImplData, VtableDefaultTraitData};
|
||||
VtableImpl, VtableParam, VtableImplData, VtableDefaultImplData};
|
||||
|
||||
struct PredicateSet<'a,'tcx:'a> {
|
||||
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) =>
|
||||
v.repr(tcx),
|
||||
|
||||
super::VtableDefaultTrait(ref t) =>
|
||||
super::VtableDefaultImpl(ref t) =>
|
||||
t.repr(tcx),
|
||||
|
||||
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 {
|
||||
format!("VtableDefaultTraitData(trait_def_id={}, nested={})",
|
||||
format!("VtableDefaultImplData(trait_def_id={}, nested={})",
|
||||
self.trait_def_id.repr(tcx),
|
||||
self.nested.repr(tcx))
|
||||
}
|
||||
|
|
|
@ -5175,7 +5175,7 @@ pub fn impl_trait_ref<'tcx>(cx: &ctxt<'tcx>, id: ast::DefId)
|
|||
&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))
|
||||
}
|
||||
_ => None
|
||||
|
|
|
@ -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> {
|
||||
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::VtableDefaultTraitData<N> {
|
||||
traits::VtableDefaultTraitData {
|
||||
impl<'tcx, N: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::VtableDefaultImplData<N> {
|
||||
fn fold_with<F:TypeFolder<'tcx>>(&self, folder: &mut F) -> traits::VtableDefaultImplData<N> {
|
||||
traits::VtableDefaultImplData {
|
||||
trait_def_id: self.trait_def_id,
|
||||
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> {
|
||||
match *self {
|
||||
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, s.fold_with(folder))
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EmbargoVisitor<'a, 'tcx> {
|
|||
match item.node {
|
||||
// impls/extern blocks do not break the "public chain" because they
|
||||
// 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
|
||||
// not public they may still be exported.
|
||||
|
@ -802,7 +802,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
|
|||
def::DefVariant(..) => ck("variant"),
|
||||
def::DefTy(_, false) => ck("type"),
|
||||
def::DefTy(_, true) => ck("enum"),
|
||||
def::DefTrait(..) => ck("trait"),
|
||||
def::DefaultImpl(..) => ck("trait"),
|
||||
def::DefStruct(..) => ck("struct"),
|
||||
def::DefMethod(_, Some(..), _) => ck("trait 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::ItemFn(..) | ast::ItemMod(..) | ast::ItemTy(..) |
|
||||
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::ItemFn(..) | ast::ItemMod(..) | ast::ItemTy(..) |
|
||||
ast::ItemMac(..) => {}
|
||||
|
|
|
@ -40,7 +40,7 @@ use syntax::ast::{Block, Crate};
|
|||
use syntax::ast::{DeclItem, DefId};
|
||||
use syntax::ast::{ForeignItem, ForeignItemFn, ForeignItemStatic};
|
||||
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::{MethodImplItem, Name, NamedField, NodeId};
|
||||
use syntax::ast::{PathListIdent, PathListMod};
|
||||
|
@ -656,7 +656,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
|
|||
parent.clone()
|
||||
}
|
||||
|
||||
ItemDefTrait(_, _) |
|
||||
ItemDefaultImpl(_, _) |
|
||||
ItemImpl(_, _, _, Some(_), _, _) => parent.clone(),
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
name_bindings.define_type(DefTrait(def_id), sp, modifiers);
|
||||
name_bindings.define_type(DefaultImpl(def_id), sp, modifiers);
|
||||
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);
|
||||
}
|
||||
DefTrait(def_id) => {
|
||||
DefaultImpl(def_id) => {
|
||||
debug!("(building reduced graph for external \
|
||||
crate) building type {}", final_ident);
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ use syntax::ast::{ExprClosure, ExprLoop, ExprWhile, ExprMethodCall};
|
|||
use syntax::ast::{ExprPath, ExprQPath, ExprStruct, FnDecl};
|
||||
use syntax::ast::{ForeignItemFn, ForeignItemStatic, Generics};
|
||||
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::{Local, MethodImplItem, Mod, Name, NodeId};
|
||||
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);
|
||||
}
|
||||
ItemImpl(_, _,
|
||||
|
@ -3199,7 +3199,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
}
|
||||
Some(def) => {
|
||||
match def {
|
||||
(DefTrait(_), _) => {
|
||||
(DefaultImpl(_), _) => {
|
||||
debug!("(resolving trait) found trait def: {:?}", def);
|
||||
self.record_def(trait_reference.ref_id, def);
|
||||
}
|
||||
|
@ -4675,7 +4675,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
None => continue
|
||||
};
|
||||
let trait_def_id = match def {
|
||||
DefTrait(trait_def_id) => trait_def_id,
|
||||
DefaultImpl(trait_def_id) => trait_def_id,
|
||||
_ => continue,
|
||||
};
|
||||
if self.trait_item_map.contains_key(&(name, trait_def_id)) {
|
||||
|
@ -4691,7 +4691,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||
Some(target) => target,
|
||||
};
|
||||
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,
|
||||
};
|
||||
if self.trait_item_map.contains_key(&(name, did)) {
|
||||
|
|
|
@ -239,7 +239,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
|
|||
def::DefTy(..) |
|
||||
def::DefAssociatedTy(..) |
|
||||
def::DefAssociatedPath(..) |
|
||||
def::DefTrait(_) => Some(recorder::TypeRef),
|
||||
def::DefaultImpl(_) => Some(recorder::TypeRef),
|
||||
def::DefStatic(_, _) |
|
||||
def::DefConst(_) |
|
||||
def::DefLocal(_) |
|
||||
|
|
|
@ -207,7 +207,7 @@ fn trans<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, expr: &ast::Expr)
|
|||
def::DefUpvar(..) => {
|
||||
datum_callee(bcx, ref_expr)
|
||||
}
|
||||
def::DefMod(..) | def::DefForeignMod(..) | def::DefTrait(..) |
|
||||
def::DefMod(..) | def::DefForeignMod(..) | def::DefaultImpl(..) |
|
||||
def::DefTy(..) | def::DefPrimTy(..) | def::DefAssociatedTy(..) |
|
||||
def::DefUse(..) | def::DefTyParamBinder(..) |
|
||||
def::DefRegion(..) | def::DefLabel(..) | def::DefTyParam(..) |
|
||||
|
|
|
@ -390,7 +390,7 @@ fn trans_monomorphized_callee<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
|||
Callee { bcx: bcx, data: Fn(llfn) }
|
||||
}
|
||||
traits::VtableBuiltin(..) |
|
||||
traits::VtableDefaultTrait(..) |
|
||||
traits::VtableDefaultImpl(..) |
|
||||
traits::VtableParam(..) => {
|
||||
bcx.sess().bug(
|
||||
&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());
|
||||
match vtable {
|
||||
// Should default trait error here?
|
||||
traits::VtableDefaultTrait(_) |
|
||||
traits::VtableDefaultImpl(_) |
|
||||
traits::VtableBuiltin(_) => {
|
||||
Vec::new().into_iter()
|
||||
}
|
||||
|
|
|
@ -617,7 +617,7 @@ pub fn instantiate_trait_ref<'tcx>(
|
|||
-> Rc<ty::TraitRef<'tcx>>
|
||||
{
|
||||
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,
|
||||
rscope,
|
||||
trait_def_id,
|
||||
|
@ -931,7 +931,7 @@ fn ast_ty_to_trait_ref<'tcx>(this: &AstConv<'tcx>,
|
|||
match ty.node {
|
||||
ast::TyPath(ref path, 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 trait_ref = object_path_to_poly_trait_ref(this,
|
||||
rscope,
|
||||
|
@ -1211,7 +1211,7 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
|
|||
Some(&d) => d
|
||||
};
|
||||
match a_def {
|
||||
def::DefTrait(trait_def_id) => {
|
||||
def::DefaultImpl(trait_def_id) => {
|
||||
// N.B. this case overlaps somewhat with
|
||||
// TyObjectSum, see that fn for details
|
||||
let mut projection_bounds = Vec::new();
|
||||
|
@ -1821,7 +1821,7 @@ pub fn partition_bounds<'a>(tcx: &ty::ctxt,
|
|||
match *ast_bound {
|
||||
ast::TraitTyParamBound(ref b, ast::TraitBoundModifier::None) => {
|
||||
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) {
|
||||
// Already seen this trait. We forbid
|
||||
// duplicates in the list (for some
|
||||
|
|
|
@ -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 (enum_def_id, variant_def_id) = match def {
|
||||
def::DefTrait(_) => {
|
||||
def::DefaultImpl(_) => {
|
||||
let name = pprust::path_to_string(path);
|
||||
span_err!(tcx.sess, pat.span, E0168,
|
||||
"use of trait `{}` in a struct pattern", name);
|
||||
|
|
|
@ -330,7 +330,7 @@ pub fn all_traits<'a>(ccx: &'a CrateCtxt) -> AllTraits<'a> {
|
|||
cstore: &cstore::CStore,
|
||||
dl: decoder::DefLike) {
|
||||
match dl {
|
||||
decoder::DlDef(def::DefTrait(did)) => {
|
||||
decoder::DlDef(def::DefaultImpl(did)) => {
|
||||
traits.push(TraitInfo::new(did));
|
||||
}
|
||||
decoder::DlDef(def::DefMod(did)) => {
|
||||
|
|
|
@ -3858,7 +3858,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
|
|||
variant_id, &fields[..]);
|
||||
enum_id
|
||||
}
|
||||
Some(def::DefTrait(def_id)) => {
|
||||
Some(def::DefaultImpl(def_id)) => {
|
||||
span_err!(tcx.sess, path.span, E0159,
|
||||
"use of trait `{}` as a struct constructor",
|
||||
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) => {
|
||||
(ty::lookup_item_type(fcx.tcx(), id), ty::lookup_predicates(fcx.tcx(), id))
|
||||
}
|
||||
def::DefTrait(_) |
|
||||
def::DefaultImpl(_) |
|
||||
def::DefTy(..) |
|
||||
def::DefAssociatedTy(..) |
|
||||
def::DefAssociatedPath(..) |
|
||||
|
@ -4734,7 +4734,7 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
|
|||
def::DefTy(..) |
|
||||
def::DefAssociatedTy(..) |
|
||||
def::DefAssociatedPath(..) |
|
||||
def::DefTrait(..) |
|
||||
def::DefaultImpl(..) |
|
||||
def::DefPrimTy(..) |
|
||||
def::DefTyParam(..) => {
|
||||
// Everything but the final segment should have no
|
||||
|
|
|
@ -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
|
||||
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);
|
||||
|
|
|
@ -648,7 +648,7 @@ fn convert_item(ccx: &CollectCtxt, it: &ast::Item) {
|
|||
predicates,
|
||||
&enum_definition.variants);
|
||||
},
|
||||
ast::ItemDefTrait(_, ref ast_trait_ref) => {
|
||||
ast::ItemDefaultImpl(_, ref ast_trait_ref) => {
|
||||
let trait_ref = astconv::instantiate_trait_ref(ccx, &ExplicitRscope,
|
||||
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));
|
||||
ty::TypeScheme { ty: t, generics: ty_generics }
|
||||
}
|
||||
ast::ItemDefTrait(..) |
|
||||
ast::ItemDefaultImpl(..) |
|
||||
ast::ItemTrait(..) |
|
||||
ast::ItemImpl(..) |
|
||||
ast::ItemMod(..) |
|
||||
|
|
|
@ -476,7 +476,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for TermsContext<'a, 'tcx> {
|
|||
|
||||
ast::ItemExternCrate(_) |
|
||||
ast::ItemUse(_) |
|
||||
ast::ItemDefTrait(..) |
|
||||
ast::ItemDefaultImpl(..) |
|
||||
ast::ItemImpl(..) |
|
||||
ast::ItemStatic(..) |
|
||||
ast::ItemConst(..) |
|
||||
|
@ -627,7 +627,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for ConstraintContext<'a, 'tcx> {
|
|||
ast::ItemForeignMod(..) |
|
||||
ast::ItemTy(..) |
|
||||
ast::ItemImpl(..) |
|
||||
ast::ItemDefTrait(..) |
|
||||
ast::ItemDefaultImpl(..) |
|
||||
ast::ItemMac(..) => {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ fn try_inline_def(cx: &DocContext, tcx: &ty::ctxt,
|
|||
let mut ret = Vec::new();
|
||||
let did = def.def_id();
|
||||
let inner = match def {
|
||||
def::DefTrait(did) => {
|
||||
def::DefaultImpl(did) => {
|
||||
record_extern_fqn(cx, did, clean::TypeTrait);
|
||||
clean::TraitItem(build_external_trait(cx, tcx, did))
|
||||
}
|
||||
|
|
|
@ -2431,7 +2431,7 @@ fn register_def(cx: &DocContext, def: def::Def) -> ast::DefId {
|
|||
def::DefFn(i, _) => (i, TypeFunction),
|
||||
def::DefTy(i, false) => (i, TypeTypedef),
|
||||
def::DefTy(i, true) => (i, TypeEnum),
|
||||
def::DefTrait(i) => (i, TypeTrait),
|
||||
def::DefaultImpl(i) => (i, TypeTrait),
|
||||
def::DefStruct(i) => (i, TypeStruct),
|
||||
def::DefMod(i) => (i, TypeModule),
|
||||
def::DefStatic(i, _) => (i, TypeStatic),
|
||||
|
|
|
@ -39,7 +39,7 @@ pub struct Module {
|
|||
pub vis: ast::Visibility,
|
||||
pub stab: Option<attr::Stability>,
|
||||
pub impls: Vec<Impl>,
|
||||
pub def_traits: Vec<DefaultTrait>,
|
||||
pub def_traits: Vec<DefaultImpl>,
|
||||
pub foreigns: Vec<ast::ForeignMod>,
|
||||
pub macros: Vec<Macro>,
|
||||
pub is_crate: bool,
|
||||
|
@ -198,7 +198,7 @@ pub struct Impl {
|
|||
pub id: ast::NodeId,
|
||||
}
|
||||
|
||||
pub struct DefaultTrait {
|
||||
pub struct DefaultImpl {
|
||||
pub unsafety: ast::Unsafety,
|
||||
pub trait_: ast::TraitRef,
|
||||
pub id: ast::NodeId,
|
||||
|
|
|
@ -358,8 +358,8 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
|||
};
|
||||
om.impls.push(i);
|
||||
},
|
||||
ast::ItemDefTrait(unsafety, ref trait_ref) => {
|
||||
let i = DefaultTrait {
|
||||
ast::ItemDefaultImpl(unsafety, ref trait_ref) => {
|
||||
let i = DefaultImpl {
|
||||
unsafety: unsafety,
|
||||
trait_: trait_ref.clone(),
|
||||
id: item.id
|
||||
|
|
|
@ -1644,7 +1644,7 @@ pub enum Item_ {
|
|||
|
||||
// Default trait implementations
|
||||
// `impl Trait for ..`
|
||||
ItemDefTrait(Unsafety, TraitRef),
|
||||
ItemDefaultImpl(Unsafety, TraitRef),
|
||||
ItemImpl(Unsafety,
|
||||
ImplPolarity,
|
||||
Generics,
|
||||
|
@ -1671,7 +1671,7 @@ impl Item_ {
|
|||
ItemTrait(..) => "trait",
|
||||
ItemMac(..) |
|
||||
ItemImpl(..) |
|
||||
ItemDefTrait(..) => "item"
|
||||
ItemDefaultImpl(..) => "item"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1044,7 +1044,7 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
|
|||
ItemStruct(..) => "struct",
|
||||
ItemTrait(..) => "trait",
|
||||
ItemImpl(..) => "impl",
|
||||
ItemDefTrait(..) => "default impl",
|
||||
ItemDefaultImpl(..) => "default impl",
|
||||
ItemMac(..) => "macro"
|
||||
};
|
||||
format!("{} {}{}", item_str, path_str, id_str)
|
||||
|
|
|
@ -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);
|
||||
ItemStruct(struct_def, folder.fold_generics(generics))
|
||||
}
|
||||
ItemDefTrait(unsafety, ref trait_ref) => {
|
||||
ItemDefTrait(unsafety, folder.fold_trait_ref((*trait_ref).clone()))
|
||||
ItemDefaultImpl(unsafety, ref trait_ref) => {
|
||||
ItemDefaultImpl(unsafety, folder.fold_trait_ref((*trait_ref).clone()))
|
||||
}
|
||||
ItemImpl(unsafety, polarity, generics, ifce, ty, impl_items) => {
|
||||
let new_impl_items = impl_items.into_iter().flat_map(|item| {
|
||||
|
|
|
@ -31,7 +31,7 @@ use ast::{ExprVec, ExprWhile, ExprWhileLet, ExprForLoop, Field, FnDecl};
|
|||
use ast::{ForeignItem, ForeignItemStatic, ForeignItemFn, ForeignMod, FunctionRetTy};
|
||||
use ast::{Ident, Inherited, ImplItem, Item, Item_, ItemStatic};
|
||||
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::{LifetimeDef, Lit, Lit_};
|
||||
use ast::{LitBool, LitChar, LitByte, LitBinary};
|
||||
|
@ -4843,7 +4843,7 @@ impl<'a> Parser<'a> {
|
|||
self.expect(&token::OpenDelim(token::Brace));
|
||||
self.expect(&token::CloseDelim(token::Brace));
|
||||
(ast_util::impl_pretty_name(&opt_trait, None),
|
||||
ItemDefTrait(unsafety, opt_trait.unwrap()), None)
|
||||
ItemDefaultImpl(unsafety, opt_trait.unwrap()), None)
|
||||
} else {
|
||||
if opt_trait.is_some() {
|
||||
ty = self.parse_ty_sum();
|
||||
|
|
|
@ -926,7 +926,7 @@ impl<'a> State<'a> {
|
|||
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.print_visibility(item.vis));
|
||||
try!(self.print_unsafety(unsafety));
|
||||
|
|
|
@ -282,7 +282,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
|
|||
visitor.visit_generics(type_parameters);
|
||||
walk_enum_def(visitor, enum_definition, type_parameters)
|
||||
}
|
||||
ItemDefTrait(_, ref trait_ref) => {
|
||||
ItemDefaultImpl(_, ref trait_ref) => {
|
||||
visitor.visit_trait_ref(trait_ref)
|
||||
}
|
||||
ItemImpl(_, _,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue