Skip to content

Commit 27efe12

Browse files
committed
Rename trait_has_auto_impl to trait_is_auto
1 parent 94b07a9 commit 27efe12

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

src/librustc/traits/select.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
910910
fn coinductive_predicate(&self, predicate: ty::Predicate<'tcx>) -> bool {
911911
let result = match predicate {
912912
ty::Predicate::Trait(ref data) => {
913-
self.tcx().trait_has_auto_impl(data.def_id())
913+
self.tcx().trait_is_auto(data.def_id())
914914
}
915915
_ => {
916916
false
@@ -1697,7 +1697,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
16971697

16981698
let def_id = obligation.predicate.def_id();
16991699

1700-
if self.tcx().trait_has_auto_impl(def_id) {
1700+
if self.tcx().trait_is_auto(def_id) {
17011701
match self_ty.sty {
17021702
ty::TyDynamic(..) => {
17031703
// For object types, we don't know what the closed

src/librustc/ty/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -2308,7 +2308,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
23082308
self.get_attrs(did).iter().any(|item| item.check_name(attr))
23092309
}
23102310

2311-
pub fn trait_has_auto_impl(self, trait_def_id: DefId) -> bool {
2311+
/// Returns true if this is an `auto trait`.
2312+
///
2313+
/// NB. For a limited time, also returns true if `impl Trait for .. { }` is in the code-base.
2314+
pub fn trait_is_auto(self, trait_def_id: DefId) -> bool {
23122315
self.trait_def(trait_def_id).has_auto_impl
23132316
}
23142317

src/librustc_metadata/encoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
970970
let data = TraitData {
971971
unsafety: trait_def.unsafety,
972972
paren_sugar: trait_def.paren_sugar,
973-
has_auto_impl: tcx.trait_has_auto_impl(def_id),
973+
has_auto_impl: tcx.trait_is_auto(def_id),
974974
super_predicates: self.lazy(&tcx.super_predicates_of(def_id)),
975975
};
976976

src/librustc_typeck/check/wfcheck.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl<'a, 'gcx> CheckTypeWellFormedVisitor<'a, 'gcx> {
114114
// FIXME(#27579) what amount of WF checking do we need for neg impls?
115115

116116
let trait_ref = tcx.impl_trait_ref(tcx.hir.local_def_id(item.id)).unwrap();
117-
if !tcx.trait_has_auto_impl(trait_ref.def_id) {
117+
if !tcx.trait_is_auto(trait_ref.def_id) {
118118
error_192(tcx, item.span);
119119
}
120120
}
@@ -318,7 +318,7 @@ impl<'a, 'gcx> CheckTypeWellFormedVisitor<'a, 'gcx> {
318318
fn check_trait(&mut self, item: &hir::Item) {
319319
let trait_def_id = self.tcx.hir.local_def_id(item.id);
320320

321-
if self.tcx.trait_has_auto_impl(trait_def_id) {
321+
if self.tcx.trait_is_auto(trait_def_id) {
322322
self.check_auto_trait(trait_def_id, item.span);
323323
}
324324

src/librustc_typeck/coherence/orphan.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for OrphanChecker<'cx, 'tcx> {
100100
// This final impl is legal according to the orpan
101101
// rules, but it invalidates the reasoning from
102102
// `two_foos` above.
103-
debug!("trait_ref={:?} trait_def_id={:?} trait_has_auto_impl={}",
103+
debug!("trait_ref={:?} trait_def_id={:?} trait_is_auto={}",
104104
trait_ref,
105105
trait_def_id,
106-
self.tcx.trait_has_auto_impl(trait_def_id));
107-
if self.tcx.trait_has_auto_impl(trait_def_id) &&
106+
self.tcx.trait_is_auto(trait_def_id));
107+
if self.tcx.trait_is_auto(trait_def_id) &&
108108
!trait_def_id.is_local() {
109109
let self_ty = trait_ref.self_ty();
110110
let opt_self_def_id = match self_ty.sty {

0 commit comments

Comments
 (0)