Rename AssocItemKind::TyAlias to AssocItemKind::Type
This commit is contained in:
parent
81f3919303
commit
d3bd6beb97
@ -2953,7 +2953,7 @@ pub enum AssocItemKind {
|
|||||||
/// An associated function.
|
/// An associated function.
|
||||||
Fn(Box<Fn>),
|
Fn(Box<Fn>),
|
||||||
/// An associated type.
|
/// An associated type.
|
||||||
TyAlias(Box<TyAlias>),
|
Type(Box<TyAlias>),
|
||||||
/// A macro expanding to associated items.
|
/// A macro expanding to associated items.
|
||||||
MacCall(P<MacCall>),
|
MacCall(P<MacCall>),
|
||||||
}
|
}
|
||||||
@ -2963,7 +2963,7 @@ pub fn defaultness(&self) -> Defaultness {
|
|||||||
match *self {
|
match *self {
|
||||||
Self::Const(defaultness, ..)
|
Self::Const(defaultness, ..)
|
||||||
| Self::Fn(box Fn { defaultness, .. })
|
| Self::Fn(box Fn { defaultness, .. })
|
||||||
| Self::TyAlias(box TyAlias { defaultness, .. }) => defaultness,
|
| Self::Type(box TyAlias { defaultness, .. }) => defaultness,
|
||||||
Self::MacCall(..) => Defaultness::Final,
|
Self::MacCall(..) => Defaultness::Final,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2974,7 +2974,7 @@ fn from(assoc_item_kind: AssocItemKind) -> ItemKind {
|
|||||||
match assoc_item_kind {
|
match assoc_item_kind {
|
||||||
AssocItemKind::Const(a, b, c) => ItemKind::Const(a, b, c),
|
AssocItemKind::Const(a, b, c) => ItemKind::Const(a, b, c),
|
||||||
AssocItemKind::Fn(fn_kind) => ItemKind::Fn(fn_kind),
|
AssocItemKind::Fn(fn_kind) => ItemKind::Fn(fn_kind),
|
||||||
AssocItemKind::TyAlias(ty_alias_kind) => ItemKind::TyAlias(ty_alias_kind),
|
AssocItemKind::Type(ty_alias_kind) => ItemKind::TyAlias(ty_alias_kind),
|
||||||
AssocItemKind::MacCall(a) => ItemKind::MacCall(a),
|
AssocItemKind::MacCall(a) => ItemKind::MacCall(a),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2987,7 +2987,7 @@ fn try_from(item_kind: ItemKind) -> Result<AssocItemKind, ItemKind> {
|
|||||||
Ok(match item_kind {
|
Ok(match item_kind {
|
||||||
ItemKind::Const(a, b, c) => AssocItemKind::Const(a, b, c),
|
ItemKind::Const(a, b, c) => AssocItemKind::Const(a, b, c),
|
||||||
ItemKind::Fn(fn_kind) => AssocItemKind::Fn(fn_kind),
|
ItemKind::Fn(fn_kind) => AssocItemKind::Fn(fn_kind),
|
||||||
ItemKind::TyAlias(ty_alias_kind) => AssocItemKind::TyAlias(ty_alias_kind),
|
ItemKind::TyAlias(ty_kind) => AssocItemKind::Type(ty_kind),
|
||||||
ItemKind::MacCall(a) => AssocItemKind::MacCall(a),
|
ItemKind::MacCall(a) => AssocItemKind::MacCall(a),
|
||||||
_ => return Err(item_kind),
|
_ => return Err(item_kind),
|
||||||
})
|
})
|
||||||
|
@ -1106,7 +1106,7 @@ pub fn noop_flat_map_assoc_item<T: MutVisitor>(
|
|||||||
visit_fn_sig(sig, visitor);
|
visit_fn_sig(sig, visitor);
|
||||||
visit_opt(body, |body| visitor.visit_block(body));
|
visit_opt(body, |body| visitor.visit_block(body));
|
||||||
}
|
}
|
||||||
AssocItemKind::TyAlias(box TyAlias {
|
AssocItemKind::Type(box TyAlias {
|
||||||
defaultness,
|
defaultness,
|
||||||
generics,
|
generics,
|
||||||
where_clauses,
|
where_clauses,
|
||||||
|
@ -685,7 +685,7 @@ pub fn walk_assoc_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a AssocItem,
|
|||||||
let kind = FnKind::Fn(FnCtxt::Assoc(ctxt), ident, sig, vis, generics, body.as_deref());
|
let kind = FnKind::Fn(FnCtxt::Assoc(ctxt), ident, sig, vis, generics, body.as_deref());
|
||||||
visitor.visit_fn(kind, span, id);
|
visitor.visit_fn(kind, span, id);
|
||||||
}
|
}
|
||||||
AssocItemKind::TyAlias(box TyAlias { generics, bounds, ty, .. }) => {
|
AssocItemKind::Type(box TyAlias { generics, bounds, ty, .. }) => {
|
||||||
visitor.visit_generics(generics);
|
visitor.visit_generics(generics);
|
||||||
walk_list!(visitor, visit_param_bound, bounds, BoundKind::Bound);
|
walk_list!(visitor, visit_param_bound, bounds, BoundKind::Bound);
|
||||||
walk_list!(visitor, visit_ty, ty);
|
walk_list!(visitor, visit_ty, ty);
|
||||||
|
@ -804,7 +804,7 @@ fn lower_trait_item(&mut self, i: &AssocItem) -> &'hir hir::TraitItem<'hir> {
|
|||||||
);
|
);
|
||||||
(generics, hir::TraitItemKind::Fn(sig, hir::TraitFn::Provided(body_id)), true)
|
(generics, hir::TraitItemKind::Fn(sig, hir::TraitFn::Provided(body_id)), true)
|
||||||
}
|
}
|
||||||
AssocItemKind::TyAlias(box TyAlias {
|
AssocItemKind::Type(box TyAlias {
|
||||||
ref generics,
|
ref generics,
|
||||||
where_clauses,
|
where_clauses,
|
||||||
ref bounds,
|
ref bounds,
|
||||||
@ -850,7 +850,7 @@ fn lower_trait_item(&mut self, i: &AssocItem) -> &'hir hir::TraitItem<'hir> {
|
|||||||
fn lower_trait_item_ref(&mut self, i: &AssocItem) -> hir::TraitItemRef {
|
fn lower_trait_item_ref(&mut self, i: &AssocItem) -> hir::TraitItemRef {
|
||||||
let kind = match &i.kind {
|
let kind = match &i.kind {
|
||||||
AssocItemKind::Const(..) => hir::AssocItemKind::Const,
|
AssocItemKind::Const(..) => hir::AssocItemKind::Const,
|
||||||
AssocItemKind::TyAlias(..) => hir::AssocItemKind::Type,
|
AssocItemKind::Type(..) => hir::AssocItemKind::Type,
|
||||||
AssocItemKind::Fn(box Fn { sig, .. }) => {
|
AssocItemKind::Fn(box Fn { sig, .. }) => {
|
||||||
hir::AssocItemKind::Fn { has_self: sig.decl.has_self() }
|
hir::AssocItemKind::Fn { has_self: sig.decl.has_self() }
|
||||||
}
|
}
|
||||||
@ -898,7 +898,7 @@ fn lower_impl_item(&mut self, i: &AssocItem) -> &'hir hir::ImplItem<'hir> {
|
|||||||
|
|
||||||
(generics, hir::ImplItemKind::Fn(sig, body_id))
|
(generics, hir::ImplItemKind::Fn(sig, body_id))
|
||||||
}
|
}
|
||||||
AssocItemKind::TyAlias(box TyAlias { generics, where_clauses, ty, .. }) => {
|
AssocItemKind::Type(box TyAlias { generics, where_clauses, ty, .. }) => {
|
||||||
let mut generics = generics.clone();
|
let mut generics = generics.clone();
|
||||||
add_ty_alias_where_clause(&mut generics, *where_clauses, false);
|
add_ty_alias_where_clause(&mut generics, *where_clauses, false);
|
||||||
self.lower_generics(
|
self.lower_generics(
|
||||||
@ -941,7 +941,7 @@ fn lower_impl_item_ref(&mut self, i: &AssocItem) -> hir::ImplItemRef {
|
|||||||
span: self.lower_span(i.span),
|
span: self.lower_span(i.span),
|
||||||
kind: match &i.kind {
|
kind: match &i.kind {
|
||||||
AssocItemKind::Const(..) => hir::AssocItemKind::Const,
|
AssocItemKind::Const(..) => hir::AssocItemKind::Const,
|
||||||
AssocItemKind::TyAlias(..) => hir::AssocItemKind::Type,
|
AssocItemKind::Type(..) => hir::AssocItemKind::Type,
|
||||||
AssocItemKind::Fn(box Fn { sig, .. }) => {
|
AssocItemKind::Fn(box Fn { sig, .. }) => {
|
||||||
hir::AssocItemKind::Fn { has_self: sig.decl.has_self() }
|
hir::AssocItemKind::Fn { has_self: sig.decl.has_self() }
|
||||||
}
|
}
|
||||||
|
@ -1556,7 +1556,7 @@ fn visit_assoc_item(&mut self, item: &'a AssocItem, ctxt: AssocCtxt) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AssocItemKind::TyAlias(box TyAlias {
|
AssocItemKind::Type(box TyAlias {
|
||||||
generics,
|
generics,
|
||||||
where_clauses,
|
where_clauses,
|
||||||
where_predicates_split,
|
where_predicates_split,
|
||||||
@ -1595,7 +1595,7 @@ fn visit_assoc_item(&mut self, item: &'a AssocItem, ctxt: AssocCtxt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
match item.kind {
|
match item.kind {
|
||||||
AssocItemKind::TyAlias(box TyAlias { ref generics, ref bounds, ref ty, .. })
|
AssocItemKind::Type(box TyAlias { ref generics, ref bounds, ref ty, .. })
|
||||||
if ctxt == AssocCtxt::Trait =>
|
if ctxt == AssocCtxt::Trait =>
|
||||||
{
|
{
|
||||||
self.visit_vis(&item.vis);
|
self.visit_vis(&item.vis);
|
||||||
|
@ -517,7 +517,7 @@ fn visit_assoc_constraint(&mut self, constraint: &'a AssocConstraint) {
|
|||||||
fn visit_assoc_item(&mut self, i: &'a ast::AssocItem, ctxt: AssocCtxt) {
|
fn visit_assoc_item(&mut self, i: &'a ast::AssocItem, ctxt: AssocCtxt) {
|
||||||
let is_fn = match i.kind {
|
let is_fn = match i.kind {
|
||||||
ast::AssocItemKind::Fn(_) => true,
|
ast::AssocItemKind::Fn(_) => true,
|
||||||
ast::AssocItemKind::TyAlias(box ast::TyAlias { ref ty, .. }) => {
|
ast::AssocItemKind::Type(box ast::TyAlias { ref ty, .. }) => {
|
||||||
if let (Some(_), AssocCtxt::Trait) = (ty, ctxt) {
|
if let (Some(_), AssocCtxt::Trait) = (ty, ctxt) {
|
||||||
gate_feature_post!(
|
gate_feature_post!(
|
||||||
&self,
|
&self,
|
||||||
|
@ -516,7 +516,7 @@ pub(crate) fn print_assoc_item(&mut self, item: &ast::AssocItem) {
|
|||||||
ast::AssocItemKind::Const(def, ty, body) => {
|
ast::AssocItemKind::Const(def, ty, body) => {
|
||||||
self.print_item_const(ident, None, ty, body.as_deref(), vis, *def);
|
self.print_item_const(ident, None, ty, body.as_deref(), vis, *def);
|
||||||
}
|
}
|
||||||
ast::AssocItemKind::TyAlias(box ast::TyAlias {
|
ast::AssocItemKind::Type(box ast::TyAlias {
|
||||||
defaultness,
|
defaultness,
|
||||||
generics,
|
generics,
|
||||||
where_clauses,
|
where_clauses,
|
||||||
|
@ -566,7 +566,7 @@ fn create_derived_impl(
|
|||||||
tokens: None,
|
tokens: None,
|
||||||
},
|
},
|
||||||
attrs: ast::AttrVec::new(),
|
attrs: ast::AttrVec::new(),
|
||||||
kind: ast::AssocItemKind::TyAlias(Box::new(ast::TyAlias {
|
kind: ast::AssocItemKind::Type(Box::new(ast::TyAlias {
|
||||||
defaultness: ast::Defaultness::Final,
|
defaultness: ast::Defaultness::Final,
|
||||||
generics: Generics::default(),
|
generics: Generics::default(),
|
||||||
where_clauses: (
|
where_clauses: (
|
||||||
|
@ -187,7 +187,7 @@ fn check_item(&mut self, cx: &EarlyContext<'_>, it: &ast::Item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn check_trait_item(&mut self, cx: &EarlyContext<'_>, it: &ast::AssocItem) {
|
fn check_trait_item(&mut self, cx: &EarlyContext<'_>, it: &ast::AssocItem) {
|
||||||
if let ast::AssocItemKind::TyAlias(..) = it.kind {
|
if let ast::AssocItemKind::Type(..) = it.kind {
|
||||||
self.check_case(cx, "associated type", &it.ident);
|
self.check_case(cx, "associated type", &it.ident);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -620,7 +620,7 @@ fn visit_fn(&mut self, fk: ast_visit::FnKind<'v>, _: Span, _: NodeId) {
|
|||||||
fn visit_assoc_item(&mut self, i: &'v ast::AssocItem, ctxt: ast_visit::AssocCtxt) {
|
fn visit_assoc_item(&mut self, i: &'v ast::AssocItem, ctxt: ast_visit::AssocCtxt) {
|
||||||
record_variants!(
|
record_variants!(
|
||||||
(self, i, i.kind, Id::None, ast, AssocItem, AssocItemKind),
|
(self, i, i.kind, Id::None, ast, AssocItem, AssocItemKind),
|
||||||
[Const, Fn, TyAlias, MacCall]
|
[Const, Fn, Type, MacCall]
|
||||||
);
|
);
|
||||||
ast_visit::walk_assoc_item(self, i, ctxt);
|
ast_visit::walk_assoc_item(self, i, ctxt);
|
||||||
}
|
}
|
||||||
|
@ -1425,7 +1425,7 @@ fn visit_assoc_item(&mut self, item: &'b AssocItem, ctxt: AssocCtxt) {
|
|||||||
}
|
}
|
||||||
(DefKind::AssocFn, ValueNS)
|
(DefKind::AssocFn, ValueNS)
|
||||||
}
|
}
|
||||||
AssocItemKind::TyAlias(..) => (DefKind::AssocTy, TypeNS),
|
AssocItemKind::Type(..) => (DefKind::AssocTy, TypeNS),
|
||||||
AssocItemKind::MacCall(_) => bug!(), // handled above
|
AssocItemKind::MacCall(_) => bug!(), // handled above
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ fn visit_generic_param(&mut self, param: &'a GenericParam) {
|
|||||||
fn visit_assoc_item(&mut self, i: &'a AssocItem, ctxt: visit::AssocCtxt) {
|
fn visit_assoc_item(&mut self, i: &'a AssocItem, ctxt: visit::AssocCtxt) {
|
||||||
let def_data = match &i.kind {
|
let def_data = match &i.kind {
|
||||||
AssocItemKind::Fn(..) | AssocItemKind::Const(..) => DefPathData::ValueNs(i.ident.name),
|
AssocItemKind::Fn(..) | AssocItemKind::Const(..) => DefPathData::ValueNs(i.ident.name),
|
||||||
AssocItemKind::TyAlias(..) => DefPathData::TypeNs(i.ident.name),
|
AssocItemKind::Type(..) => DefPathData::TypeNs(i.ident.name),
|
||||||
AssocItemKind::MacCall(..) => return self.visit_macro_invoc(i.id),
|
AssocItemKind::MacCall(..) => return self.visit_macro_invoc(i.id),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2498,7 +2498,7 @@ fn resolve_trait_items(&mut self, trait_items: &'ast [P<AssocItem>]) {
|
|||||||
AssocItemKind::Fn(box Fn { generics, .. }) => {
|
AssocItemKind::Fn(box Fn { generics, .. }) => {
|
||||||
walk_assoc_item(self, generics, LifetimeBinderKind::Function, item);
|
walk_assoc_item(self, generics, LifetimeBinderKind::Function, item);
|
||||||
}
|
}
|
||||||
AssocItemKind::TyAlias(box TyAlias { generics, .. }) => self
|
AssocItemKind::Type(box TyAlias { generics, .. }) => self
|
||||||
.with_lifetime_rib(LifetimeRibKind::AnonymousReportError, |this| {
|
.with_lifetime_rib(LifetimeRibKind::AnonymousReportError, |this| {
|
||||||
walk_assoc_item(this, generics, LifetimeBinderKind::Item, item)
|
walk_assoc_item(this, generics, LifetimeBinderKind::Item, item)
|
||||||
}),
|
}),
|
||||||
@ -2694,8 +2694,8 @@ fn resolve_impl_item(&mut self, item: &'ast AssocItem) {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
AssocItemKind::TyAlias(box TyAlias { generics, .. }) => {
|
AssocItemKind::Type(box TyAlias { generics, .. }) => {
|
||||||
debug!("resolve_implementation AssocItemKind::TyAlias");
|
debug!("resolve_implementation AssocItemKind::Type");
|
||||||
// We also need a new scope for the impl item type parameters.
|
// We also need a new scope for the impl item type parameters.
|
||||||
self.with_generic_param_rib(
|
self.with_generic_param_rib(
|
||||||
&generics.params,
|
&generics.params,
|
||||||
@ -2770,7 +2770,7 @@ fn check_trait_item<F>(
|
|||||||
let res = binding.res();
|
let res = binding.res();
|
||||||
let Res::Def(def_kind, _) = res else { bug!() };
|
let Res::Def(def_kind, _) = res else { bug!() };
|
||||||
match (def_kind, kind) {
|
match (def_kind, kind) {
|
||||||
(DefKind::AssocTy, AssocItemKind::TyAlias(..))
|
(DefKind::AssocTy, AssocItemKind::Type(..))
|
||||||
| (DefKind::AssocFn, AssocItemKind::Fn(..))
|
| (DefKind::AssocFn, AssocItemKind::Fn(..))
|
||||||
| (DefKind::AssocConst, AssocItemKind::Const(..)) => {
|
| (DefKind::AssocConst, AssocItemKind::Const(..)) => {
|
||||||
self.r.record_partial_res(id, PartialRes::new(res));
|
self.r.record_partial_res(id, PartialRes::new(res));
|
||||||
@ -2784,7 +2784,7 @@ fn check_trait_item<F>(
|
|||||||
let (code, kind) = match kind {
|
let (code, kind) = match kind {
|
||||||
AssocItemKind::Const(..) => (rustc_errors::error_code!(E0323), "const"),
|
AssocItemKind::Const(..) => (rustc_errors::error_code!(E0323), "const"),
|
||||||
AssocItemKind::Fn(..) => (rustc_errors::error_code!(E0324), "method"),
|
AssocItemKind::Fn(..) => (rustc_errors::error_code!(E0324), "method"),
|
||||||
AssocItemKind::TyAlias(..) => (rustc_errors::error_code!(E0325), "type"),
|
AssocItemKind::Type(..) => (rustc_errors::error_code!(E0325), "type"),
|
||||||
AssocItemKind::MacCall(..) => span_bug!(span, "unexpanded macro"),
|
AssocItemKind::MacCall(..) => span_bug!(span, "unexpanded macro"),
|
||||||
};
|
};
|
||||||
let trait_path = path_names_to_string(path);
|
let trait_path = path_names_to_string(path);
|
||||||
|
@ -1482,7 +1482,7 @@ pub(crate) fn find_similarly_named_assoc_item(
|
|||||||
.filter(|(_, res)| match (kind, res) {
|
.filter(|(_, res)| match (kind, res) {
|
||||||
(AssocItemKind::Const(..), Res::Def(DefKind::AssocConst, _)) => true,
|
(AssocItemKind::Const(..), Res::Def(DefKind::AssocConst, _)) => true,
|
||||||
(AssocItemKind::Fn(_), Res::Def(DefKind::AssocFn, _)) => true,
|
(AssocItemKind::Fn(_), Res::Def(DefKind::AssocFn, _)) => true,
|
||||||
(AssocItemKind::TyAlias(..), Res::Def(DefKind::AssocTy, _)) => true,
|
(AssocItemKind::Type(..), Res::Def(DefKind::AssocTy, _)) => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
})
|
})
|
||||||
.map(|(key, _)| key.ident.name)
|
.map(|(key, _)| key.ident.name)
|
||||||
@ -1546,7 +1546,7 @@ fn extract_node_id(t: &Ty) -> Option<NodeId> {
|
|||||||
AssocSuggestion::MethodWithSelf
|
AssocSuggestion::MethodWithSelf
|
||||||
}
|
}
|
||||||
ast::AssocItemKind::Fn(..) => AssocSuggestion::AssocFn,
|
ast::AssocItemKind::Fn(..) => AssocSuggestion::AssocFn,
|
||||||
ast::AssocItemKind::TyAlias(..) => AssocSuggestion::AssocType,
|
ast::AssocItemKind::Type(..) => AssocSuggestion::AssocType,
|
||||||
ast::AssocItemKind::MacCall(_) => continue,
|
ast::AssocItemKind::MacCall(_) => continue,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ ast-stats-1 Block 288 ( 3.4%) 6 48
|
|||||||
ast-stats-1 GenericBound 352 ( 4.2%) 4 88
|
ast-stats-1 GenericBound 352 ( 4.2%) 4 88
|
||||||
ast-stats-1 - Trait 352 ( 4.2%) 4
|
ast-stats-1 - Trait 352 ( 4.2%) 4
|
||||||
ast-stats-1 AssocItem 416 ( 4.9%) 4 104
|
ast-stats-1 AssocItem 416 ( 4.9%) 4 104
|
||||||
ast-stats-1 - TyAlias 208 ( 2.5%) 2
|
ast-stats-1 - Type 208 ( 2.5%) 2
|
||||||
ast-stats-1 - Fn 208 ( 2.5%) 2
|
ast-stats-1 - Fn 208 ( 2.5%) 2
|
||||||
ast-stats-1 GenericParam 480 ( 5.7%) 5 96
|
ast-stats-1 GenericParam 480 ( 5.7%) 5 96
|
||||||
ast-stats-1 PathSegment 720 ( 8.6%) 30 24
|
ast-stats-1 PathSegment 720 ( 8.6%) 30 24
|
||||||
@ -84,7 +84,7 @@ ast-stats-2 Block 288 ( 3.1%) 6 48
|
|||||||
ast-stats-2 GenericBound 352 ( 3.8%) 4 88
|
ast-stats-2 GenericBound 352 ( 3.8%) 4 88
|
||||||
ast-stats-2 - Trait 352 ( 3.8%) 4
|
ast-stats-2 - Trait 352 ( 3.8%) 4
|
||||||
ast-stats-2 AssocItem 416 ( 4.5%) 4 104
|
ast-stats-2 AssocItem 416 ( 4.5%) 4 104
|
||||||
ast-stats-2 - TyAlias 208 ( 2.3%) 2
|
ast-stats-2 - Type 208 ( 2.3%) 2
|
||||||
ast-stats-2 - Fn 208 ( 2.3%) 2
|
ast-stats-2 - Fn 208 ( 2.3%) 2
|
||||||
ast-stats-2 GenericParam 480 ( 5.2%) 5 96
|
ast-stats-2 GenericParam 480 ( 5.2%) 5 96
|
||||||
ast-stats-2 PathSegment 792 ( 8.7%) 33 24
|
ast-stats-2 PathSegment 792 ( 8.7%) 33 24
|
||||||
|
@ -438,14 +438,14 @@ pub fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
|
|||||||
eq_defaultness(*ld, *rd) && eq_fn_sig(lf, rf) && eq_generics(lg, rg) && both(lb, rb, |l, r| eq_block(l, r))
|
eq_defaultness(*ld, *rd) && eq_fn_sig(lf, rf) && eq_generics(lg, rg) && both(lb, rb, |l, r| eq_block(l, r))
|
||||||
},
|
},
|
||||||
(
|
(
|
||||||
TyAlias(box ast::TyAlias {
|
Type(box ast::TyAlias {
|
||||||
defaultness: ld,
|
defaultness: ld,
|
||||||
generics: lg,
|
generics: lg,
|
||||||
bounds: lb,
|
bounds: lb,
|
||||||
ty: lt,
|
ty: lt,
|
||||||
..
|
..
|
||||||
}),
|
}),
|
||||||
TyAlias(box ast::TyAlias {
|
Type(box ast::TyAlias {
|
||||||
defaultness: rd,
|
defaultness: rd,
|
||||||
generics: rg,
|
generics: rg,
|
||||||
bounds: rb,
|
bounds: rb,
|
||||||
|
@ -594,7 +594,7 @@ fn visit_impl_items(&mut self, items: &[ptr::P<ast::AssocItem>]) {
|
|||||||
let both_type = |l: &TyOpt, r: &TyOpt| is_type(l) && is_type(r);
|
let both_type = |l: &TyOpt, r: &TyOpt| is_type(l) && is_type(r);
|
||||||
let both_opaque = |l: &TyOpt, r: &TyOpt| is_opaque(l) && is_opaque(r);
|
let both_opaque = |l: &TyOpt, r: &TyOpt| is_opaque(l) && is_opaque(r);
|
||||||
let need_empty_line = |a: &ast::AssocItemKind, b: &ast::AssocItemKind| match (a, b) {
|
let need_empty_line = |a: &ast::AssocItemKind, b: &ast::AssocItemKind| match (a, b) {
|
||||||
(TyAlias(lty), TyAlias(rty))
|
(Type(lty), Type(rty))
|
||||||
if both_type(<y.ty, &rty.ty) || both_opaque(<y.ty, &rty.ty) =>
|
if both_type(<y.ty, &rty.ty) || both_opaque(<y.ty, &rty.ty) =>
|
||||||
{
|
{
|
||||||
false
|
false
|
||||||
@ -612,7 +612,7 @@ fn visit_impl_items(&mut self, items: &[ptr::P<ast::AssocItem>]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buffer.sort_by(|(_, a), (_, b)| match (&a.kind, &b.kind) {
|
buffer.sort_by(|(_, a), (_, b)| match (&a.kind, &b.kind) {
|
||||||
(TyAlias(lty), TyAlias(rty))
|
(Type(lty), Type(rty))
|
||||||
if both_type(<y.ty, &rty.ty) || both_opaque(<y.ty, &rty.ty) =>
|
if both_type(<y.ty, &rty.ty) || both_opaque(<y.ty, &rty.ty) =>
|
||||||
{
|
{
|
||||||
a.ident.as_str().cmp(b.ident.as_str())
|
a.ident.as_str().cmp(b.ident.as_str())
|
||||||
@ -621,10 +621,10 @@ fn visit_impl_items(&mut self, items: &[ptr::P<ast::AssocItem>]) {
|
|||||||
a.ident.as_str().cmp(b.ident.as_str())
|
a.ident.as_str().cmp(b.ident.as_str())
|
||||||
}
|
}
|
||||||
(Fn(..), Fn(..)) => a.span.lo().cmp(&b.span.lo()),
|
(Fn(..), Fn(..)) => a.span.lo().cmp(&b.span.lo()),
|
||||||
(TyAlias(ty), _) if is_type(&ty.ty) => Ordering::Less,
|
(Type(ty), _) if is_type(&ty.ty) => Ordering::Less,
|
||||||
(_, TyAlias(ty)) if is_type(&ty.ty) => Ordering::Greater,
|
(_, Type(ty)) if is_type(&ty.ty) => Ordering::Greater,
|
||||||
(TyAlias(..), _) => Ordering::Less,
|
(Type(..), _) => Ordering::Less,
|
||||||
(_, TyAlias(..)) => Ordering::Greater,
|
(_, Type(..)) => Ordering::Greater,
|
||||||
(Const(..), _) => Ordering::Less,
|
(Const(..), _) => Ordering::Less,
|
||||||
(_, Const(..)) => Ordering::Greater,
|
(_, Const(..)) => Ordering::Greater,
|
||||||
(MacCall(..), _) => Ordering::Less,
|
(MacCall(..), _) => Ordering::Less,
|
||||||
|
@ -660,7 +660,7 @@ fn visit_assoc_item(&mut self, visitor_kind: &ItemVisitorKind<'_>) {
|
|||||||
self.push_rewrite(ai.span, rewrite);
|
self.push_rewrite(ai.span, rewrite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(ast::AssocItemKind::TyAlias(ref ty_alias), _) => {
|
(ast::AssocItemKind::Type(ref ty_alias), _) => {
|
||||||
self.visit_ty_alias_kind(ty_alias, visitor_kind, ai.span);
|
self.visit_ty_alias_kind(ty_alias, visitor_kind, ai.span);
|
||||||
}
|
}
|
||||||
(ast::AssocItemKind::MacCall(ref mac), _) => {
|
(ast::AssocItemKind::MacCall(ref mac), _) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user