mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Remove shorthand from HIR
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(")");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user