Rename trait_has_auto_impl to trait_is_auto

This commit is contained in:
leonardo.yvens
2017-10-16 17:33:45 -02:00
parent 94b07a91bc
commit 27efe126e0
5 changed files with 12 additions and 9 deletions
+2 -2
View File
@@ -910,7 +910,7 @@ pub fn coinductive_match<I>(&mut self, cycle: I) -> bool
fn coinductive_predicate(&self, predicate: ty::Predicate<'tcx>) -> bool {
let result = match predicate {
ty::Predicate::Trait(ref data) => {
self.tcx().trait_has_auto_impl(data.def_id())
self.tcx().trait_is_auto(data.def_id())
}
_ => {
false
@@ -1697,7 +1697,7 @@ fn assemble_candidates_from_auto_impls(&mut self,
let def_id = obligation.predicate.def_id();
if self.tcx().trait_has_auto_impl(def_id) {
if self.tcx().trait_is_auto(def_id) {
match self_ty.sty {
ty::TyDynamic(..) => {
// For object types, we don't know what the closed
+4 -1
View File
@@ -2308,7 +2308,10 @@ pub fn has_attr(self, did: DefId, attr: &str) -> bool {
self.get_attrs(did).iter().any(|item| item.check_name(attr))
}
pub fn trait_has_auto_impl(self, trait_def_id: DefId) -> bool {
/// Returns true if this is an `auto trait`.
///
/// NB. For a limited time, also returns true if `impl Trait for .. { }` is in the code-base.
pub fn trait_is_auto(self, trait_def_id: DefId) -> bool {
self.trait_def(trait_def_id).has_auto_impl
}
+1 -1
View File
@@ -970,7 +970,7 @@ fn encode_info_for_item(&mut self, (def_id, item): (DefId, &'tcx hir::Item)) ->
let data = TraitData {
unsafety: trait_def.unsafety,
paren_sugar: trait_def.paren_sugar,
has_auto_impl: tcx.trait_has_auto_impl(def_id),
has_auto_impl: tcx.trait_is_auto(def_id),
super_predicates: self.lazy(&tcx.super_predicates_of(def_id)),
};
+2 -2
View File
@@ -114,7 +114,7 @@ fn check_item_well_formed(&mut self, item: &hir::Item) {
// FIXME(#27579) what amount of WF checking do we need for neg impls?
let trait_ref = tcx.impl_trait_ref(tcx.hir.local_def_id(item.id)).unwrap();
if !tcx.trait_has_auto_impl(trait_ref.def_id) {
if !tcx.trait_is_auto(trait_ref.def_id) {
error_192(tcx, item.span);
}
}
@@ -318,7 +318,7 @@ fn check_auto_trait(&mut self, trait_def_id: DefId, span: Span) {
fn check_trait(&mut self, item: &hir::Item) {
let trait_def_id = self.tcx.hir.local_def_id(item.id);
if self.tcx.trait_has_auto_impl(trait_def_id) {
if self.tcx.trait_is_auto(trait_def_id) {
self.check_auto_trait(trait_def_id, item.span);
}
+3 -3
View File
@@ -100,11 +100,11 @@ fn visit_item(&mut self, item: &hir::Item) {
// This final impl is legal according to the orpan
// rules, but it invalidates the reasoning from
// `two_foos` above.
debug!("trait_ref={:?} trait_def_id={:?} trait_has_auto_impl={}",
debug!("trait_ref={:?} trait_def_id={:?} trait_is_auto={}",
trait_ref,
trait_def_id,
self.tcx.trait_has_auto_impl(trait_def_id));
if self.tcx.trait_has_auto_impl(trait_def_id) &&
self.tcx.trait_is_auto(trait_def_id));
if self.tcx.trait_is_auto(trait_def_id) &&
!trait_def_id.is_local() {
let self_ty = trait_ref.self_ty();
let opt_self_def_id = match self_ty.sty {