Skip to content

Commit 06506bb

Browse files
committed
[Syntax Breaking] Rename DefaultImpl to AutoImpl
DefaultImpl is a highly confusing name for what we now call auto impls, as in `impl Send for ..`. The name auto impl is not formally decided but for sanity anything is better than `DefaultImpl` which refers neither to `default impl` nor to `impl Default`.
1 parent 5ce3d48 commit 06506bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+163
-163
lines changed

src/librustc/dep_graph/dep_node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ define_dep_nodes!( <'tcx>
498498
[] SuperPredicatesOfItem(DefId),
499499
[] TraitDefOfItem(DefId),
500500
[] AdtDefOfItem(DefId),
501-
[] IsDefaultImpl(DefId),
501+
[] IsAutoImpl(DefId),
502502
[] ImplTraitRef(DefId),
503503
[] ImplPolarity(DefId),
504504
[] ClosureKind(DefId),

src/librustc/hir/intravisit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
503503
// visit_enum_def() takes care of visiting the Item's NodeId
504504
visitor.visit_enum_def(enum_definition, type_parameters, item.id, item.span)
505505
}
506-
ItemDefaultImpl(_, ref trait_ref) => {
506+
ItemAutoImpl(_, ref trait_ref) => {
507507
visitor.visit_id(item.id);
508508
visitor.visit_trait_ref(trait_ref)
509509
}

src/librustc/hir/lowering.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub struct LoweringContext<'a> {
9696
exported_macros: Vec<hir::MacroDef>,
9797

9898
trait_impls: BTreeMap<DefId, Vec<NodeId>>,
99-
trait_default_impl: BTreeMap<DefId, NodeId>,
99+
trait_auto_impl: BTreeMap<DefId, NodeId>,
100100

101101
is_generator: bool,
102102

@@ -146,7 +146,7 @@ pub fn lower_crate(sess: &Session,
146146
impl_items: BTreeMap::new(),
147147
bodies: BTreeMap::new(),
148148
trait_impls: BTreeMap::new(),
149-
trait_default_impl: BTreeMap::new(),
149+
trait_auto_impl: BTreeMap::new(),
150150
exported_macros: Vec::new(),
151151
catch_scopes: Vec::new(),
152152
loop_scopes: Vec::new(),
@@ -284,7 +284,7 @@ impl<'a> LoweringContext<'a> {
284284
bodies: self.bodies,
285285
body_ids,
286286
trait_impls: self.trait_impls,
287-
trait_default_impl: self.trait_default_impl,
287+
trait_auto_impl: self.trait_auto_impl,
288288
}
289289
}
290290

@@ -1479,14 +1479,14 @@ impl<'a> LoweringContext<'a> {
14791479
let vdata = self.lower_variant_data(vdata);
14801480
hir::ItemUnion(vdata, self.lower_generics(generics))
14811481
}
1482-
ItemKind::DefaultImpl(unsafety, ref trait_ref) => {
1482+
ItemKind::AutoImpl(unsafety, ref trait_ref) => {
14831483
let trait_ref = self.lower_trait_ref(trait_ref);
14841484

14851485
if let Def::Trait(def_id) = trait_ref.path.def {
1486-
self.trait_default_impl.insert(def_id, id);
1486+
self.trait_auto_impl.insert(def_id, id);
14871487
}
14881488

1489-
hir::ItemDefaultImpl(self.lower_unsafety(unsafety),
1489+
hir::ItemAutoImpl(self.lower_unsafety(unsafety),
14901490
trait_ref)
14911491
}
14921492
ItemKind::Impl(unsafety,

src/librustc/hir/map/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
7171
impl_items: _,
7272
bodies: _,
7373
trait_impls: _,
74-
trait_default_impl: _,
74+
trait_auto_impl: _,
7575
body_ids: _,
7676
} = *krate;
7777

src/librustc/hir/map/def_collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
104104
// Pick the def data. This need not be unique, but the more
105105
// information we encapsulate into
106106
let def_data = match i.node {
107-
ItemKind::DefaultImpl(..) | ItemKind::Impl(..) =>
107+
ItemKind::AutoImpl(..) | ItemKind::Impl(..) =>
108108
DefPathData::Impl,
109109
ItemKind::Enum(..) | ItemKind::Struct(..) | ItemKind::Union(..) | ItemKind::Trait(..) |
110110
ItemKind::ExternCrate(..) | ItemKind::ForeignMod(..) | ItemKind::Ty(..) =>

src/librustc/hir/map/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,16 +474,16 @@ impl<'hir> Map<'hir> {
474474
self.forest.krate.trait_impls.get(&trait_did).map_or(&[], |xs| &xs[..])
475475
}
476476

477-
pub fn trait_default_impl(&self, trait_did: DefId) -> Option<NodeId> {
477+
pub fn trait_auto_impl(&self, trait_did: DefId) -> Option<NodeId> {
478478
self.dep_graph.read(DepNode::new_no_params(DepKind::AllLocalTraitImpls));
479479

480480
// NB: intentionally bypass `self.forest.krate()` so that we
481481
// do not trigger a read of the whole krate here
482-
self.forest.krate.trait_default_impl.get(&trait_did).cloned()
482+
self.forest.krate.trait_auto_impl.get(&trait_did).cloned()
483483
}
484484

485485
pub fn trait_is_auto(&self, trait_did: DefId) -> bool {
486-
self.trait_default_impl(trait_did).is_some()
486+
self.trait_auto_impl(trait_did).is_some()
487487
}
488488

489489
/// Get the attributes on the krate. This is preferable to
@@ -1140,7 +1140,7 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
11401140
ItemUnion(..) => "union",
11411141
ItemTrait(..) => "trait",
11421142
ItemImpl(..) => "impl",
1143-
ItemDefaultImpl(..) => "default impl",
1143+
ItemAutoImpl(..) => "default impl",
11441144
};
11451145
format!("{} {}{}", item_str, path_str(), id_str)
11461146
}

src/librustc/hir/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ pub struct Crate {
499499
pub impl_items: BTreeMap<ImplItemId, ImplItem>,
500500
pub bodies: BTreeMap<BodyId, Body>,
501501
pub trait_impls: BTreeMap<DefId, Vec<NodeId>>,
502-
pub trait_default_impl: BTreeMap<DefId, NodeId>,
502+
pub trait_auto_impl: BTreeMap<DefId, NodeId>,
503503

504504
/// A list of the body ids written out in the order in which they
505505
/// appear in the crate. If you're going to process all the bodies
@@ -1813,10 +1813,10 @@ pub enum Item_ {
18131813
/// Represents a Trait Declaration
18141814
ItemTrait(Unsafety, Generics, TyParamBounds, HirVec<TraitItemRef>),
18151815

1816-
// Default trait implementations
1816+
/// Auto trait implementations
18171817
///
18181818
/// `impl Trait for .. {}`
1819-
ItemDefaultImpl(Unsafety, TraitRef),
1819+
ItemAutoImpl(Unsafety, TraitRef),
18201820
/// An implementation, eg `impl<A> Trait for Foo { .. }`
18211821
ItemImpl(Unsafety,
18221822
ImplPolarity,
@@ -1844,7 +1844,7 @@ impl Item_ {
18441844
ItemUnion(..) => "union",
18451845
ItemTrait(..) => "trait",
18461846
ItemImpl(..) |
1847-
ItemDefaultImpl(..) => "item",
1847+
ItemAutoImpl(..) => "item",
18481848
}
18491849
}
18501850

src/librustc/hir/print.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ impl<'a> State<'a> {
660660
self.head(&visibility_qualified(&item.vis, "union"))?;
661661
self.print_struct(struct_def, generics, item.name, item.span, true)?;
662662
}
663-
hir::ItemDefaultImpl(unsafety, ref trait_ref) => {
663+
hir::ItemAutoImpl(unsafety, ref trait_ref) => {
664664
self.head("")?;
665665
self.print_visibility(&item.vis)?;
666666
self.print_unsafety(unsafety)?;

src/librustc/ich/impls_hir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for hir::Item {
898898
hir::ItemForeignMod(..) |
899899
hir::ItemGlobalAsm(..) |
900900
hir::ItemMod(..) |
901-
hir::ItemDefaultImpl(..) |
901+
hir::ItemAutoImpl(..) |
902902
hir::ItemTrait(..) |
903903
hir::ItemImpl(..) |
904904
hir::ItemTy(..) |
@@ -945,7 +945,7 @@ impl_stable_hash_for!(enum hir::Item_ {
945945
ItemStruct(variant_data, generics),
946946
ItemUnion(variant_data, generics),
947947
ItemTrait(unsafety, generics, bounds, item_refs),
948-
ItemDefaultImpl(unsafety, trait_ref),
948+
ItemAutoImpl(unsafety, trait_ref),
949949
ItemImpl(unsafety, impl_polarity, impl_defaultness, generics, trait_ref, ty, impl_item_refs)
950950
});
951951

src/librustc/ich/impls_ty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,13 +731,13 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::TraitDef {
731731
def_id: _,
732732
unsafety,
733733
paren_sugar,
734-
has_default_impl,
734+
has_auto_impl,
735735
def_path_hash,
736736
} = *self;
737737

738738
unsafety.hash_stable(hcx, hasher);
739739
paren_sugar.hash_stable(hcx, hasher);
740-
has_default_impl.hash_stable(hcx, hasher);
740+
has_auto_impl.hash_stable(hcx, hasher);
741741
def_path_hash.hash_stable(hcx, hasher);
742742
}
743743
}

0 commit comments

Comments
 (0)