1
Fork 0

Move in_trait into OpaqueTyOrigin

This commit is contained in:
Michael Goulet 2024-10-02 22:21:37 -04:00
parent cb7e3695e8
commit 7cd466a036
19 changed files with 146 additions and 125 deletions

View file

@ -259,7 +259,7 @@ 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 } = opaque.origin
&& let hir::OpaqueTyOrigin::FnReturn { parent, .. } = opaque.origin
&& parent == self.parent_def_id
{
let opaque_span = self.tcx.def_span(opaque_def_id);

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 { parent: 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()
{
@ -114,8 +114,10 @@ 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 { .. })
&& opaque.in_trait
&& matches!(opaque.origin, hir::OpaqueTyOrigin::AsyncFn {
in_trait_or_impl: Some(hir::RpitContext::Trait),
..
})
{
return;
}