Skip to content

Commit f95bdf4

Browse files
Remove redundant in_trait from hir::TyKind::OpaqueDef
1 parent 360f7d7 commit f95bdf4

File tree

17 files changed

+18
-20
lines changed

17 files changed

+18
-20
lines changed

compiler/rustc_ast_lowering/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1776,7 +1776,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
17761776
hir::TyKind::OpaqueDef(
17771777
hir::ItemId { owner_id: hir::OwnerId { def_id: opaque_ty_def_id } },
17781778
generic_args,
1779-
in_trait,
17801779
)
17811780
}
17821781

compiler/rustc_borrowck/src/diagnostics/region_name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> {
832832
fn get_future_inner_return_ty(&self, hir_ty: &'tcx hir::Ty<'tcx>) -> &'tcx hir::Ty<'tcx> {
833833
let hir = self.infcx.tcx.hir();
834834

835-
let hir::TyKind::OpaqueDef(id, _, _) = hir_ty.kind else {
835+
let hir::TyKind::OpaqueDef(id, _) = hir_ty.kind else {
836836
span_bug!(
837837
hir_ty.span,
838838
"lowered return type of async fn is not OpaqueDef: {:?}",

compiler/rustc_hir/src/hir.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2632,7 +2632,7 @@ impl<'hir> Ty<'hir> {
26322632
}
26332633
TyKind::Tup(tys) => tys.iter().any(Self::is_suggestable_infer_ty),
26342634
TyKind::Ptr(mut_ty) | TyKind::Ref(_, mut_ty) => mut_ty.ty.is_suggestable_infer_ty(),
2635-
TyKind::OpaqueDef(_, generic_args, _) => are_suggestable_generic_args(generic_args),
2635+
TyKind::OpaqueDef(_, generic_args) => are_suggestable_generic_args(generic_args),
26362636
TyKind::Path(QPath::TypeRelative(ty, segment)) => {
26372637
ty.is_suggestable_infer_ty() || are_suggestable_generic_args(segment.args().args)
26382638
}
@@ -2856,7 +2856,7 @@ pub enum TyKind<'hir> {
28562856
/// possibly parameters) that are actually bound on the `impl Trait`.
28572857
///
28582858
/// The last parameter specifies whether this opaque appears in a trait definition.
2859-
OpaqueDef(ItemId, &'hir [GenericArg<'hir>], bool),
2859+
OpaqueDef(ItemId, &'hir [GenericArg<'hir>]),
28602860
/// A trait object type `Bound1 + Bound2 + Bound3`
28612861
/// where `Bound` is a trait or a lifetime.
28622862
TraitObject(

compiler/rustc_hir/src/intravisit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) -> V::Resul
894894
TyKind::Path(ref qpath) => {
895895
try_visit!(visitor.visit_qpath(qpath, typ.hir_id, typ.span));
896896
}
897-
TyKind::OpaqueDef(item_id, lifetimes, _in_trait) => {
897+
TyKind::OpaqueDef(item_id, lifetimes) => {
898898
try_visit!(visitor.visit_nested_item(item_id));
899899
walk_list!(visitor, visit_generic_arg, lifetimes);
900900
}

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
332332
// and the duplicated parameter, to ensure that they do not get out of sync.
333333
if let Node::Item(&Item { kind: ItemKind::OpaqueTy(..), .. }) = node {
334334
let opaque_ty_node = tcx.parent_hir_node(hir_id);
335-
let Node::Ty(&hir::Ty { kind: TyKind::OpaqueDef(_, lifetimes, _), .. }) = opaque_ty_node
335+
let Node::Ty(&hir::Ty { kind: TyKind::OpaqueDef(_, lifetimes), .. }) = opaque_ty_node
336336
else {
337337
bug!("unexpected {opaque_ty_node:?}")
338338
};

compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
689689
};
690690
self.with(scope, |this| this.visit_ty(mt.ty));
691691
}
692-
hir::TyKind::OpaqueDef(item_id, lifetimes, _in_trait) => {
692+
hir::TyKind::OpaqueDef(item_id, lifetimes) => {
693693
// Resolve the lifetimes in the bounds to the lifetime defs in the generics.
694694
// `fn foo<'a>() -> impl MyTrait<'a> { ... }` desugars to
695695
// `type MyAnonTy<'b> = impl MyTrait<'b>;`

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2087,11 +2087,11 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
20872087
let opt_self_ty = maybe_qself.as_ref().map(|qself| self.lower_ty(qself));
20882088
self.lower_path(opt_self_ty, path, hir_ty.hir_id, false)
20892089
}
2090-
&hir::TyKind::OpaqueDef(item_id, lifetimes, in_trait) => {
2090+
&hir::TyKind::OpaqueDef(item_id, lifetimes) => {
20912091
let opaque_ty = tcx.hir().item(item_id);
20922092

20932093
match opaque_ty.kind {
2094-
hir::ItemKind::OpaqueTy(&hir::OpaqueTy { .. }) => {
2094+
hir::ItemKind::OpaqueTy(&hir::OpaqueTy { in_trait, .. }) => {
20952095
let local_def_id = item_id.owner_id.def_id;
20962096
// If this is an RPITIT and we are using the new RPITIT lowering scheme, we
20972097
// generate the def_id of an associated type for the trait and return as

compiler/rustc_middle/src/ty/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ impl<'v> hir::intravisit::Visitor<'v> for TraitObjectVisitor<'v> {
510510
) => {
511511
self.0.push(ty);
512512
}
513-
hir::TyKind::OpaqueDef(item_id, _, _) => {
513+
hir::TyKind::OpaqueDef(item_id, _) => {
514514
self.0.push(ty);
515515
let item = self.1.item(item_id);
516516
hir::intravisit::walk_item(self, item);

compiler/rustc_passes/src/dead.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> {
656656
}
657657

658658
fn visit_ty(&mut self, ty: &'tcx hir::Ty<'tcx>) {
659-
if let TyKind::OpaqueDef(item_id, _, _) = ty.kind {
659+
if let TyKind::OpaqueDef(item_id, _) = ty.kind {
660660
let item = self.tcx.hir().item(item_id);
661661
intravisit::walk_item(self, item);
662662
}

compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ pub fn suggest_new_region_bound(
284284
}
285285
match fn_return.kind {
286286
// FIXME(precise_captures): Suggest adding to `use<...>` list instead.
287-
TyKind::OpaqueDef(item_id, _, _) => {
287+
TyKind::OpaqueDef(item_id, _) => {
288288
let item = tcx.hir().item(item_id);
289289
let ItemKind::OpaqueTy(opaque) = &item.kind else {
290290
return;

compiler/rustc_trait_selection/src/error_reporting/infer/region.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
857857
}
858858

859859
fn visit_ty(&mut self, ty: &'hir hir::Ty<'hir>) {
860-
let hir::TyKind::OpaqueDef(item_id, _, _) = ty.kind else {
860+
let hir::TyKind::OpaqueDef(item_id, _) = ty.kind else {
861861
return hir::intravisit::walk_ty(self, ty);
862862
};
863863
let opaque_ty = self.tcx.hir().item(item_id).expect_opaque_ty();

compiler/rustc_ty_utils/src/assoc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ fn associated_types_for_impl_traits_in_associated_fn(
323323

324324
impl<'tcx> Visitor<'tcx> for RPITVisitor<'tcx> {
325325
fn visit_ty(&mut self, ty: &'tcx hir::Ty<'tcx>) {
326-
if let hir::TyKind::OpaqueDef(item_id, _, _) = ty.kind
326+
if let hir::TyKind::OpaqueDef(item_id, _) = ty.kind
327327
&& self.rpits.insert(item_id.owner_id.def_id)
328328
{
329329
let opaque_item =

src/librustdoc/clean/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,7 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T
18281828
Array(Box::new(clean_ty(ty, cx)), length.into())
18291829
}
18301830
TyKind::Tup(tys) => Tuple(tys.iter().map(|ty| clean_ty(ty, cx)).collect()),
1831-
TyKind::OpaqueDef(item_id, _, _) => {
1831+
TyKind::OpaqueDef(item_id, _) => {
18321832
let item = cx.tcx.hir().item(item_id);
18331833
if let hir::ItemKind::OpaqueTy(ty) = item.kind {
18341834
ImplTrait(ty.bounds.iter().filter_map(|x| clean_generic_bound(x, cx)).collect())

src/tools/clippy/clippy_lints/src/extra_unused_type_parameters.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for TypeWalker<'cx, '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.

src/tools/clippy/clippy_lints/src/lifetimes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
523523

524524
fn visit_ty(&mut self, ty: &'tcx Ty<'_>) {
525525
match ty.kind {
526-
TyKind::OpaqueDef(item, bounds, _) => {
526+
TyKind::OpaqueDef(item, bounds) => {
527527
let map = self.cx.tcx.hir();
528528
let item = map.item(item);
529529
let len = self.lts.len();

src/tools/clippy/clippy_lints/src/manual_async_fn.rs

+1-1
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| {

src/tools/clippy/clippy_utils/src/hir_utils.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1115,9 +1115,8 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
11151115
}
11161116
},
11171117
TyKind::Path(ref qpath) => self.hash_qpath(qpath),
1118-
TyKind::OpaqueDef(_, arg_list, in_trait) => {
1118+
TyKind::OpaqueDef(_, arg_list) => {
11191119
self.hash_generic_args(arg_list);
1120-
in_trait.hash(&mut self.s);
11211120
},
11221121
TyKind::TraitObject(_, lifetime, _) => {
11231122
self.hash_lifetime(lifetime);

0 commit comments

Comments
 (0)