mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
Rollup merge of #155007 - josetorrs:rename-is-impl-trait, r=WaffleLapkin,Kivooeo
renaming method is_impl_trait to is_opaque Completing one of the tasks mentioned in this issue: https://github.com/rust-lang/rust/issues/154941 r? @WaffleLapkin
This commit is contained in:
@@ -2167,7 +2167,7 @@ fn visit_ty(&mut self, t: Ty<'tcx>) {
|
||||
for def_id in visitor.opaques {
|
||||
let ty_span = tcx.def_span(def_id);
|
||||
if !seen.contains(&ty_span) {
|
||||
let descr = if ty.is_impl_trait() { "opaque " } else { "" };
|
||||
let descr = if ty.is_opaque() { "opaque " } else { "" };
|
||||
err.span_label(ty_span, format!("returning this {descr}type `{ty}`"));
|
||||
seen.insert(ty_span);
|
||||
}
|
||||
|
||||
@@ -1462,7 +1462,7 @@ fn cat_projection(
|
||||
&& self
|
||||
.cx
|
||||
.structurally_resolve_type(self.cx.tcx().hir_span(base_place.hir_id), place_ty)
|
||||
.is_impl_trait()
|
||||
.is_opaque()
|
||||
{
|
||||
projections.push(Projection { kind: ProjectionKind::OpaqueCast, ty: node_ty });
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) {
|
||||
let def_id = trait_predicate.trait_ref.def_id;
|
||||
if cx.tcx.is_lang_item(def_id, LangItem::Drop) {
|
||||
// Explicitly allow `impl Drop`, a drop-guards-as-unnameable-type pattern.
|
||||
if trait_predicate.trait_ref.self_ty().is_impl_trait() {
|
||||
if trait_predicate.trait_ref.self_ty().is_opaque() {
|
||||
continue;
|
||||
}
|
||||
let Some(def_id) = cx.tcx.get_diagnostic_item(sym::needs_drop) else { return };
|
||||
|
||||
@@ -1594,7 +1594,7 @@ pub fn is_fn_ptr(self) -> bool {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_impl_trait(self) -> bool {
|
||||
pub fn is_opaque(self) -> bool {
|
||||
matches!(self.kind(), Alias(ty::AliasTy { kind: ty::Opaque { .. }, .. }))
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ fn needs_turbofish<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'tcx>) -> bool
|
||||
if !fn_return_ty
|
||||
.skip_binder()
|
||||
.walk()
|
||||
.any(|generic| generic.as_type().is_some_and(Ty::is_impl_trait)) =>
|
||||
.any(|generic| generic.as_type().is_some_and(Ty::is_opaque)) =>
|
||||
{
|
||||
return false;
|
||||
},
|
||||
|
||||
@@ -207,7 +207,7 @@ fn fn_inputs_has_impl_trait_ty(cx: &LateContext<'_>, def_id: LocalDefId) -> bool
|
||||
inputs.iter().any(|input| {
|
||||
matches!(
|
||||
input.kind(),
|
||||
&ty::Alias(ty::AliasTy { kind: ty::Free{def_id} , ..}) if cx.tcx.type_of(def_id).skip_binder().is_impl_trait()
|
||||
&ty::Alias(ty::AliasTy { kind: ty::Free{def_id} , ..}) if cx.tcx.type_of(def_id).skip_binder().is_opaque()
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user