mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-15 20:45:45 +03:00
Rename trait_has_auto_impl to trait_is_auto
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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)),
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user