1
Fork 0

Use named fields for OpaqueTyOrigin

This commit is contained in:
Michael Goulet 2024-10-02 22:04:18 -04:00
parent f95bdf453e
commit cb7e3695e8
19 changed files with 53 additions and 40 deletions

View file

@ -259,8 +259,8 @@ where
// If it's owned by this function
&& let opaque =
self.tcx.hir_node_by_def_id(opaque_def_id).expect_item().expect_opaque_ty()
&& let hir::OpaqueTyOrigin::FnReturn(parent_def_id) = opaque.origin
&& parent_def_id == self.parent_def_id
&& let hir::OpaqueTyOrigin::FnReturn { parent } = opaque.origin
&& parent == self.parent_def_id
{
let opaque_span = self.tcx.def_span(opaque_def_id);
let new_capture_rules =

View file

@ -77,7 +77,7 @@ impl<'tcx> LateLintPass<'tcx> for OpaqueHiddenInferredBound {
// That's because although we may have an opaque type on the function,
// it won't have a hidden type, so proving predicates about it is
// not really meaningful.
if let hir::OpaqueTyOrigin::FnReturn(method_def_id) = opaque.origin
if let hir::OpaqueTyOrigin::FnReturn { parent: method_def_id } = opaque.origin
&& let hir::Node::TraitItem(trait_item) = cx.tcx.hir_node_by_def_id(method_def_id)
&& !trait_item.defaultness.has_value()
{
@ -103,7 +103,7 @@ impl<'tcx> LateLintPass<'tcx> for OpaqueHiddenInferredBound {
&& cx.tcx.parent(opaque_ty.def_id) == def_id
&& matches!(
opaque.origin,
hir::OpaqueTyOrigin::FnReturn(_) | hir::OpaqueTyOrigin::AsyncFn(_)
hir::OpaqueTyOrigin::FnReturn { .. } | hir::OpaqueTyOrigin::AsyncFn { .. }
)
{
return;
@ -114,7 +114,7 @@ impl<'tcx> LateLintPass<'tcx> for OpaqueHiddenInferredBound {
// return type is well-formed in traits even when `Self` isn't sized.
if let ty::Param(param_ty) = *proj_term.kind()
&& param_ty.name == kw::SelfUpper
&& matches!(opaque.origin, hir::OpaqueTyOrigin::AsyncFn(_))
&& matches!(opaque.origin, hir::OpaqueTyOrigin::AsyncFn { .. })
&& opaque.in_trait
{
return;