diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 4c8d34f1bd77..dae093683b7c 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -1842,13 +1842,10 @@ pub(super) fn lower_impl_restriction( ) -> &'hir hir::ImplRestriction<'hir> { let kind = match &r.kind { RestrictionKind::Unrestricted => hir::RestrictionKind::Unrestricted, - RestrictionKind::Restricted { path, id, shorthand } => { + RestrictionKind::Restricted { path, id, shorthand: _ } => { let res = self.resolver.get_partial_res(*id); if let Some(did) = res.and_then(|res| res.expect_full_res().opt_def_id()) { - hir::RestrictionKind::Restricted { - path: self.lower_mod_path(did, path), - shorthand: *shorthand, - } + hir::RestrictionKind::Restricted(self.lower_mod_path(did, path)) } else { self.dcx().span_delayed_bug(path.span, "should have errored in resolve"); hir::RestrictionKind::Unrestricted diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index d612bdacec7d..9d686ea39d09 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -4416,7 +4416,7 @@ pub enum RestrictionKind<'hir> { /// The restriction does not affect the item. Unrestricted, /// The restriction only applies outside of this path. - Restricted { path: &'hir ModPath<'hir>, shorthand: bool }, + Restricted(&'hir ModPath<'hir>), } /// The actual safety specified in syntax. We may treat diff --git a/compiler/rustc_hir/src/intravisit.rs b/compiler/rustc_hir/src/intravisit.rs index 03b254cf7e35..99511189e928 100644 --- a/compiler/rustc_hir/src/intravisit.rs +++ b/compiler/rustc_hir/src/intravisit.rs @@ -628,7 +628,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) -> V:: bounds, trait_item_refs, ) => { - if let RestrictionKind::Restricted { path, shorthand: _ } = &impl_restriction.kind { + if let RestrictionKind::Restricted(path) = &impl_restriction.kind { walk_list!(visitor, visit_path_segment, path.segments); } try_visit!(visitor.visit_ident(ident)); diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index 426761f98029..14da2fff4609 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -899,7 +899,7 @@ fn trait_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::TraitDef { false, is_auto == hir::IsAuto::Yes, safety, - if let hir::RestrictionKind::Restricted { path, shorthand: _ } = impl_restriction.kind { + if let hir::RestrictionKind::Restricted(path) = impl_restriction.kind { ty::trait_def::ImplRestrictionKind::Restricted(path.res, impl_restriction.span) } else { ty::trait_def::ImplRestrictionKind::Unrestricted diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index 07ee1118390e..6f64d07b01d6 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -2651,11 +2651,9 @@ fn print_is_auto(&mut self, s: hir::IsAuto) { fn print_impl_restriction(&mut self, r: &hir::ImplRestriction<'_>) { match r.kind { hir::RestrictionKind::Unrestricted => {} - hir::RestrictionKind::Restricted { path, shorthand } => { + hir::RestrictionKind::Restricted(path) => { self.word("impl("); - if shorthand { - self.word_nbsp("in"); - } + self.word_nbsp("in"); self.print_path(path, false); self.word(")"); }