Skip to content

Commit 743623d

Browse files
authored
Rollup merge of rust-lang#131183 - compiler-errors:opaque-ty-origin, r=estebank
Refactoring to `OpaqueTyOrigin` Pulled out of a larger PR that uses these changes to do cross-crate encoding of opaque origin, so we can use them for edition 2024 migrations. These changes should be self-explanatory on their own, tho 😄
2 parents 277c4e4 + cbd64a4 commit 743623d

File tree

5 files changed

+5
-6
lines changed

5 files changed

+5
-6
lines changed

clippy_lints/src/extra_unused_type_parameters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ impl<'tcx> Visitor<'tcx> for TypeWalker<'_, 'tcx> {
199199
fn visit_ty(&mut self, t: &'tcx Ty<'tcx>) {
200200
if let Some((def_id, _)) = t.peel_refs().as_generic_param() {
201201
self.ty_params.remove(&def_id);
202-
} else if let TyKind::OpaqueDef(id, _, _) = t.kind {
202+
} else if let TyKind::OpaqueDef(id, _) = t.kind {
203203
// Explicitly walk OpaqueDef. Normally `walk_ty` would do the job, but it calls
204204
// `visit_nested_item`, which checks that `Self::NestedFilter::INTER` is set. We're
205205
// using `OnlyBodies`, so the check ends up failing and the type isn't fully walked.

clippy_lints/src/len_zero.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ fn extract_future_output<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<&
313313
kind: ItemKind::OpaqueTy(opaque),
314314
..
315315
} = item
316-
&& let OpaqueTyOrigin::AsyncFn(_) = opaque.origin
316+
&& let OpaqueTyOrigin::AsyncFn { .. } = opaque.origin
317317
&& let [GenericBound::Trait(trait_ref, _)] = &opaque.bounds
318318
&& let Some(segment) = trait_ref.trait_ref.path.segments.last()
319319
&& let Some(generic_args) = segment.args

clippy_lints/src/lifetimes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ impl<'tcx> Visitor<'tcx> for RefVisitor<'_, 'tcx> {
420420

421421
fn visit_ty(&mut self, ty: &'tcx Ty<'_>) {
422422
match ty.kind {
423-
TyKind::OpaqueDef(item, bounds, _) => {
423+
TyKind::OpaqueDef(item, bounds) => {
424424
let map = self.cx.tcx.hir();
425425
let item = map.item(item);
426426
let len = self.lts.len();

clippy_lints/src/manual_async_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn future_trait_ref<'tcx>(
105105
cx: &LateContext<'tcx>,
106106
ty: &'tcx Ty<'tcx>,
107107
) -> Option<(&'tcx TraitRef<'tcx>, Vec<LifetimeName>)> {
108-
if let TyKind::OpaqueDef(item_id, bounds, false) = ty.kind
108+
if let TyKind::OpaqueDef(item_id, bounds) = ty.kind
109109
&& let item = cx.tcx.hir().item(item_id)
110110
&& let ItemKind::OpaqueTy(opaque) = &item.kind
111111
&& let Some(trait_ref) = opaque.bounds.iter().find_map(|bound| {

clippy_utils/src/hir_utils.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,9 +1126,8 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
11261126
}
11271127
},
11281128
TyKind::Path(ref qpath) => self.hash_qpath(qpath),
1129-
TyKind::OpaqueDef(_, arg_list, in_trait) => {
1129+
TyKind::OpaqueDef(_, arg_list) => {
11301130
self.hash_generic_args(arg_list);
1131-
in_trait.hash(&mut self.s);
11321131
},
11331132
TyKind::TraitObject(_, lifetime, _) => {
11341133
self.hash_lifetime(lifetime);

0 commit comments

Comments
 (0)