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

View file

@ -910,7 +910,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
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 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
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

View file

@ -2308,7 +2308,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
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
}

View file

@ -970,7 +970,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
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)),
};

View file

@ -114,7 +114,7 @@ impl<'a, 'gcx> CheckTypeWellFormedVisitor<'a, 'gcx> {
// 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 @@ impl<'a, 'gcx> CheckTypeWellFormedVisitor<'a, 'gcx> {
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);
}

View file

@ -100,11 +100,11 @@ impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for OrphanChecker<'cx, 'tcx> {
// 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 {