#[allow(unused)]
impl TryMatch for Crate {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&Crate { module: ref module1, attrs: ref attrs1, span: ref span1 },
&Crate { module: ref module2, attrs: ref attrs2, span: ref span2 }) => {
mcx.try_match(module1, module2)?;
mcx.try_match(attrs1, attrs2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for Mod {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&Mod { inner: ref inner1, items: ref items1, inline: ref inline1 },
&Mod { inner: ref inner2, items: ref items2, inline: ref inline2 }) => {
mcx.try_match(inner1, inner2)?;
mcx.try_match(items1, items2)?;
mcx.try_match(inline1, inline2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for Item {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&Item { ident: ref ident1, attrs: ref attrs1, id: ref id1, node: ref node1, vis: ref vis1, span: ref span1, tokens: ref tokens1 },
&Item { ident: ref ident2, attrs: ref attrs2, id: ref id2, node: ref node2, vis: ref vis2, span: ref span2, tokens: ref tokens2 }) => {
mcx.try_match(ident1, ident2)?;
mcx.try_match(id1, id2)?;
mcx.try_match(node1, node2)?;
mcx.try_match(vis1, vis2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for ItemKind {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&ItemKind::ExternCrate(ref name1),
&ItemKind::ExternCrate(ref name2)) => {
mcx.try_match(name1, name2)?;
Ok(())
}
(&ItemKind::Use(ref vp1),
&ItemKind::Use(ref vp2)) => {
mcx.try_match(vp1, vp2)?;
Ok(())
}
(&ItemKind::Static(ref ty1, ref mutbl1, ref init1),
&ItemKind::Static(ref ty2, ref mutbl2, ref init2)) => {
mcx.try_match(ty1, ty2)?;
mcx.try_match(mutbl1, mutbl2)?;
mcx.try_match(init1, init2)?;
Ok(())
}
(&ItemKind::Const(ref ty1, ref init1),
&ItemKind::Const(ref ty2, ref init2)) => {
mcx.try_match(ty1, ty2)?;
mcx.try_match(init1, init2)?;
Ok(())
}
(&ItemKind::Fn(ref decl1, ref header1, ref generics1, ref block1),
&ItemKind::Fn(ref decl2, ref header2, ref generics2, ref block2)) => {
mcx.try_match(decl1, decl2)?;
mcx.try_match(header1, header2)?;
mcx.try_match(generics1, generics2)?;
mcx.try_match(block1, block2)?;
Ok(())
}
(&ItemKind::Mod(ref module1),
&ItemKind::Mod(ref module2)) => {
mcx.try_match(module1, module2)?;
Ok(())
}
(&ItemKind::ForeignMod(ref fm1),
&ItemKind::ForeignMod(ref fm2)) => {
mcx.try_match(fm1, fm2)?;
Ok(())
}
(&ItemKind::GlobalAsm(ref asm1),
&ItemKind::GlobalAsm(ref asm2)) => {
mcx.try_match(asm1, asm2)?;
Ok(())
}
(&ItemKind::Ty(ref ty1, ref generics1),
&ItemKind::Ty(ref ty2, ref generics2)) => {
mcx.try_match(ty1, ty2)?;
mcx.try_match(generics1, generics2)?;
Ok(())
}
(&ItemKind::Existential(ref bounds1, ref generics1),
&ItemKind::Existential(ref bounds2, ref generics2)) => {
mcx.try_match(bounds1, bounds2)?;
mcx.try_match(generics1, generics2)?;
Ok(())
}
(&ItemKind::Enum(ref def1, ref generics1),
&ItemKind::Enum(ref def2, ref generics2)) => {
mcx.try_match(def1, def2)?;
mcx.try_match(generics1, generics2)?;
Ok(())
}
(&ItemKind::Struct(ref vd1, ref generics1),
&ItemKind::Struct(ref vd2, ref generics2)) => {
mcx.try_match(vd1, vd2)?;
mcx.try_match(generics1, generics2)?;
Ok(())
}
(&ItemKind::Union(ref vd1, ref generics1),
&ItemKind::Union(ref vd2, ref generics2)) => {
mcx.try_match(vd1, vd2)?;
mcx.try_match(generics1, generics2)?;
Ok(())
}
(&ItemKind::Trait(ref is_auto1, ref unsafety1, ref generics1, ref bounds1, ref items1),
&ItemKind::Trait(ref is_auto2, ref unsafety2, ref generics2, ref bounds2, ref items2)) => {
mcx.try_match(is_auto1, is_auto2)?;
mcx.try_match(unsafety1, unsafety2)?;
mcx.try_match(generics1, generics2)?;
mcx.try_match(bounds1, bounds2)?;
mcx.try_match(items1, items2)?;
Ok(())
}
(&ItemKind::Impl(ref unsafety1, ref polarity1, ref generics1, ref defaultness1, ref trait_ref1, ref ty1, ref items1),
&ItemKind::Impl(ref unsafety2, ref polarity2, ref generics2, ref defaultness2, ref trait_ref2, ref ty2, ref items2)) => {
mcx.try_match(unsafety1, unsafety2)?;
mcx.try_match(polarity1, polarity2)?;
mcx.try_match(generics1, generics2)?;
mcx.try_match(defaultness1, defaultness2)?;
mcx.try_match(trait_ref1, trait_ref2)?;
mcx.try_match(ty1, ty2)?;
mcx.try_match(items1, items2)?;
Ok(())
}
(&ItemKind::Mac(ref mac1),
&ItemKind::Mac(ref mac2)) => {
mcx.try_match(mac1, mac2)?;
Ok(())
}
(&ItemKind::MacroDef(ref tts1),
&ItemKind::MacroDef(ref tts2)) => {
mcx.try_match(tts1, tts2)?;
Ok(())
}
(&ItemKind::TraitAlias(ref generics1, ref bounds1),
&ItemKind::TraitAlias(ref generics2, ref bounds2)) => {
mcx.try_match(generics1, generics2)?;
mcx.try_match(bounds1, bounds2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for UseTreeKind {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&UseTreeKind::Simple(ref ident1, ref id11, ref id21),
&UseTreeKind::Simple(ref ident2, ref id12, ref id22)) => {
mcx.try_match(ident1, ident2)?;
mcx.try_match(id11, id12)?;
mcx.try_match(id21, id22)?;
Ok(())
}
(&UseTreeKind::Glob,
&UseTreeKind::Glob) => {
Ok(())
}
(&UseTreeKind::Nested(ref nested1),
&UseTreeKind::Nested(ref nested2)) => {
mcx.try_match(nested1, nested2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for UseTree {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&UseTree { kind: ref kind1, prefix: ref prefix1, span: ref span1 },
&UseTree { kind: ref kind2, prefix: ref prefix2, span: ref span2 }) => {
mcx.try_match(kind1, kind2)?;
mcx.try_match(prefix1, prefix2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for TraitItem {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&TraitItem { id: ref id1, ident: ref ident1, attrs: ref attrs1, generics: ref generics1, node: ref node1, span: ref span1, tokens: ref tokens1 },
&TraitItem { id: ref id2, ident: ref ident2, attrs: ref attrs2, generics: ref generics2, node: ref node2, span: ref span2, tokens: ref tokens2 }) => {
mcx.try_match(id1, id2)?;
mcx.try_match(ident1, ident2)?;
mcx.try_match(generics1, generics2)?;
mcx.try_match(node1, node2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for TraitItemKind {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&TraitItemKind::Const(ref ty1, ref init1),
&TraitItemKind::Const(ref ty2, ref init2)) => {
mcx.try_match(ty1, ty2)?;
mcx.try_match(init1, init2)?;
Ok(())
}
(&TraitItemKind::Method(ref sig1, ref body1),
&TraitItemKind::Method(ref sig2, ref body2)) => {
mcx.try_match(sig1, sig2)?;
mcx.try_match(body1, body2)?;
Ok(())
}
(&TraitItemKind::Type(ref bounds1, ref ty1),
&TraitItemKind::Type(ref bounds2, ref ty2)) => {
mcx.try_match(bounds1, bounds2)?;
mcx.try_match(ty1, ty2)?;
Ok(())
}
(&TraitItemKind::Macro(ref mac1),
&TraitItemKind::Macro(ref mac2)) => {
mcx.try_match(mac1, mac2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for ImplItem {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&ImplItem { id: ref id1, ident: ref ident1, vis: ref vis1, defaultness: ref defaultness1, attrs: ref attrs1, generics: ref generics1, node: ref node1, span: ref span1, tokens: ref tokens1 },
&ImplItem { id: ref id2, ident: ref ident2, vis: ref vis2, defaultness: ref defaultness2, attrs: ref attrs2, generics: ref generics2, node: ref node2, span: ref span2, tokens: ref tokens2 }) => {
mcx.try_match(id1, id2)?;
mcx.try_match(ident1, ident2)?;
mcx.try_match(vis1, vis2)?;
mcx.try_match(defaultness1, defaultness2)?;
mcx.try_match(generics1, generics2)?;
mcx.try_match(node1, node2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for ImplItemKind {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&ImplItemKind::Const(ref ty1, ref init1),
&ImplItemKind::Const(ref ty2, ref init2)) => {
mcx.try_match(ty1, ty2)?;
mcx.try_match(init1, init2)?;
Ok(())
}
(&ImplItemKind::Method(ref sig1, ref body1),
&ImplItemKind::Method(ref sig2, ref body2)) => {
mcx.try_match(sig1, sig2)?;
mcx.try_match(body1, body2)?;
Ok(())
}
(&ImplItemKind::Type(ref ty1),
&ImplItemKind::Type(ref ty2)) => {
mcx.try_match(ty1, ty2)?;
Ok(())
}
(&ImplItemKind::Existential(ref bounds1),
&ImplItemKind::Existential(ref bounds2)) => {
mcx.try_match(bounds1, bounds2)?;
Ok(())
}
(&ImplItemKind::Macro(ref mac1),
&ImplItemKind::Macro(ref mac2)) => {
mcx.try_match(mac1, mac2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for TraitRef {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&TraitRef { path: ref path1, ref_id: ref ref_id1 },
&TraitRef { path: ref path2, ref_id: ref ref_id2 }) => {
mcx.try_match(path1, path2)?;
mcx.try_match(ref_id1, ref_id2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for EnumDef {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&EnumDef { variants: ref variants1 },
&EnumDef { variants: ref variants2 }) => {
mcx.try_match(variants1, variants2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for Variant_ {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&Variant_ { ident: ref ident1, attrs: ref attrs1, id: ref id1, data: ref data1, disr_expr: ref disr_expr1 },
&Variant_ { ident: ref ident2, attrs: ref attrs2, id: ref id2, data: ref data2, disr_expr: ref disr_expr2 }) => {
mcx.try_match(ident1, ident2)?;
mcx.try_match(id1, id2)?;
mcx.try_match(data1, data2)?;
mcx.try_match(disr_expr1, disr_expr2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for VariantData {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&VariantData::Struct(ref fields1, ref id1),
&VariantData::Struct(ref fields2, ref id2)) => {
mcx.try_match(fields1, fields2)?;
mcx.try_match(id1, id2)?;
Ok(())
}
(&VariantData::Tuple(ref fields1, ref id1),
&VariantData::Tuple(ref fields2, ref id2)) => {
mcx.try_match(fields1, fields2)?;
mcx.try_match(id1, id2)?;
Ok(())
}
(&VariantData::Unit(ref id1),
&VariantData::Unit(ref id2)) => {
mcx.try_match(id1, id2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for StructField {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&StructField { span: ref span1, ident: ref ident1, vis: ref vis1, id: ref id1, ty: ref ty1, attrs: ref attrs1 },
&StructField { span: ref span2, ident: ref ident2, vis: ref vis2, id: ref id2, ty: ref ty2, attrs: ref attrs2 }) => {
mcx.try_match(span1, span2)?;
mcx.try_match(ident1, ident2)?;
mcx.try_match(vis1, vis2)?;
mcx.try_match(id1, id2)?;
mcx.try_match(ty1, ty2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for MethodSig {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&MethodSig { header: ref header1, decl: ref decl1 },
&MethodSig { header: ref header2, decl: ref decl2 }) => {
mcx.try_match(header1, header2)?;
mcx.try_match(decl1, decl2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for ForeignMod {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&ForeignMod { abi: ref abi1, items: ref items1 },
&ForeignMod { abi: ref abi2, items: ref items2 }) => {
mcx.try_match(abi1, abi2)?;
mcx.try_match(items1, items2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for ForeignItem {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&ForeignItem { ident: ref ident1, attrs: ref attrs1, node: ref node1, id: ref id1, span: ref span1, vis: ref vis1 },
&ForeignItem { ident: ref ident2, attrs: ref attrs2, node: ref node2, id: ref id2, span: ref span2, vis: ref vis2 }) => {
mcx.try_match(ident1, ident2)?;
mcx.try_match(node1, node2)?;
mcx.try_match(id1, id2)?;
mcx.try_match(span1, span2)?;
mcx.try_match(vis1, vis2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for ForeignItemKind {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&ForeignItemKind::Fn(ref decl1, ref generics1),
&ForeignItemKind::Fn(ref decl2, ref generics2)) => {
mcx.try_match(decl1, decl2)?;
mcx.try_match(generics1, generics2)?;
Ok(())
}
(&ForeignItemKind::Static(ref ty1, ref mutbl1),
&ForeignItemKind::Static(ref ty2, ref mutbl2)) => {
mcx.try_match(ty1, ty2)?;
mcx.try_match(mutbl1, mutbl2)?;
Ok(())
}
(&ForeignItemKind::Ty,
&ForeignItemKind::Ty) => {
Ok(())
}
(&ForeignItemKind::Macro(ref mac1),
&ForeignItemKind::Macro(ref mac2)) => {
mcx.try_match(mac1, mac2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for Generics {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&Generics { params: ref params1, where_clause: ref where_clause1, span: ref span1 },
&Generics { params: ref params2, where_clause: ref where_clause2, span: ref span2 }) => {
mcx.try_match(params1, params2)?;
mcx.try_match(where_clause1, where_clause2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for GenericParam {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&GenericParam { id: ref id1, ident: ref ident1, attrs: ref attrs1, bounds: ref bounds1, kind: ref kind1 },
&GenericParam { id: ref id2, ident: ref ident2, attrs: ref attrs2, bounds: ref bounds2, kind: ref kind2 }) => {
mcx.try_match(id1, id2)?;
mcx.try_match(ident1, ident2)?;
mcx.try_match(attrs1, attrs2)?;
mcx.try_match(bounds1, bounds2)?;
mcx.try_match(kind1, kind2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for GenericParamKind {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&GenericParamKind::Lifetime,
&GenericParamKind::Lifetime) => {
Ok(())
}
(&GenericParamKind::Type { default: ref default1 },
&GenericParamKind::Type { default: ref default2 }) => {
mcx.try_match(default1, default2)?;
Ok(())
}
(&GenericParamKind::Const { ty: ref ty1 },
&GenericParamKind::Const { ty: ref ty2 }) => {
mcx.try_match(ty1, ty2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for WhereClause {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&WhereClause { id: ref id1, predicates: ref predicates1, span: ref span1 },
&WhereClause { id: ref id2, predicates: ref predicates2, span: ref span2 }) => {
mcx.try_match(id1, id2)?;
mcx.try_match(predicates1, predicates2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for WherePredicate {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&WherePredicate::BoundPredicate(ref pred1),
&WherePredicate::BoundPredicate(ref pred2)) => {
mcx.try_match(pred1, pred2)?;
Ok(())
}
(&WherePredicate::RegionPredicate(ref pred1),
&WherePredicate::RegionPredicate(ref pred2)) => {
mcx.try_match(pred1, pred2)?;
Ok(())
}
(&WherePredicate::EqPredicate(ref pred1),
&WherePredicate::EqPredicate(ref pred2)) => {
mcx.try_match(pred1, pred2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for WhereBoundPredicate {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&WhereBoundPredicate { span: ref span1, bounded_ty: ref bounded_ty1, bounds: ref bounds1, bound_generic_params: ref bound_generic_params1 },
&WhereBoundPredicate { span: ref span2, bounded_ty: ref bounded_ty2, bounds: ref bounds2, bound_generic_params: ref bound_generic_params2 }) => {
mcx.try_match(span1, span2)?;
mcx.try_match(bounded_ty1, bounded_ty2)?;
mcx.try_match(bounds1, bounds2)?;
mcx.try_match(bound_generic_params1, bound_generic_params2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for WhereRegionPredicate {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&WhereRegionPredicate { span: ref span1, lifetime: ref lifetime1, bounds: ref bounds1 },
&WhereRegionPredicate { span: ref span2, lifetime: ref lifetime2, bounds: ref bounds2 }) => {
mcx.try_match(span1, span2)?;
mcx.try_match(lifetime1, lifetime2)?;
mcx.try_match(bounds1, bounds2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for WhereEqPredicate {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&WhereEqPredicate { id: ref id1, span: ref span1, lhs_ty: ref lhs_ty1, rhs_ty: ref rhs_ty1 },
&WhereEqPredicate { id: ref id2, span: ref span2, lhs_ty: ref lhs_ty2, rhs_ty: ref rhs_ty2 }) => {
mcx.try_match(id1, id2)?;
mcx.try_match(span1, span2)?;
mcx.try_match(lhs_ty1, lhs_ty2)?;
mcx.try_match(rhs_ty1, rhs_ty2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for TraitBoundModifier {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for VisibilityKind {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for CrateSugar {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&CrateSugar::PubCrate,
&CrateSugar::PubCrate) => {
Ok(())
}
(&CrateSugar::JustCrate,
&CrateSugar::JustCrate) => {
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
fn default_try_match_ty(this: &Ty, target: &Ty, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (this, target) {
(&Ty { id: ref id1, node: ref node1, span: ref span1 },
&Ty { id: ref id2, node: ref node2, span: ref span2 }) => {
mcx.try_match(id1, id2)?;
mcx.try_match(node1, node2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
#[allow(unused)]
impl TryMatch for MutTy {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&MutTy { ty: ref ty1, mutbl: ref mutbl1 },
&MutTy { ty: ref ty2, mutbl: ref mutbl2 }) => {
mcx.try_match(ty1, ty2)?;
mcx.try_match(mutbl1, mutbl2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for TyKind {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&TyKind::Slice(ref ty1),
&TyKind::Slice(ref ty2)) => {
mcx.try_match(ty1, ty2)?;
Ok(())
}
(&TyKind::Array(ref ty1, ref len1),
&TyKind::Array(ref ty2, ref len2)) => {
mcx.try_match(ty1, ty2)?;
mcx.try_match(len1, len2)?;
Ok(())
}
(&TyKind::Ptr(ref mty1),
&TyKind::Ptr(ref mty2)) => {
mcx.try_match(mty1, mty2)?;
Ok(())
}
(&TyKind::Rptr(ref lt1, ref mty1),
&TyKind::Rptr(ref lt2, ref mty2)) => {
mcx.try_match(lt1, lt2)?;
mcx.try_match(mty1, mty2)?;
Ok(())
}
(&TyKind::BareFn(ref ty1),
&TyKind::BareFn(ref ty2)) => {
mcx.try_match(ty1, ty2)?;
Ok(())
}
(&TyKind::Never,
&TyKind::Never) => {
Ok(())
}
(&TyKind::Tup(ref tys1),
&TyKind::Tup(ref tys2)) => {
mcx.try_match(tys1, tys2)?;
Ok(())
}
(&TyKind::Path(ref qself1, ref path1),
&TyKind::Path(ref qself2, ref path2)) => {
mcx.try_match(qself1, qself2)?;
mcx.try_match(path1, path2)?;
Ok(())
}
(&TyKind::TraitObject(ref bounds1, ref trait_object_syntax1),
&TyKind::TraitObject(ref bounds2, ref trait_object_syntax2)) => {
mcx.try_match(bounds1, bounds2)?;
mcx.try_match(trait_object_syntax1, trait_object_syntax2)?;
Ok(())
}
(&TyKind::ImplTrait(ref id1, ref bounds1),
&TyKind::ImplTrait(ref id2, ref bounds2)) => {
mcx.try_match(id1, id2)?;
mcx.try_match(bounds1, bounds2)?;
Ok(())
}
(&TyKind::Paren(ref ty1),
&TyKind::Paren(ref ty2)) => {
mcx.try_match(ty1, ty2)?;
Ok(())
}
(&TyKind::Typeof(ref expr1),
&TyKind::Typeof(ref expr2)) => {
mcx.try_match(expr1, expr2)?;
Ok(())
}
(&TyKind::Infer,
&TyKind::Infer) => {
Ok(())
}
(&TyKind::ImplicitSelf,
&TyKind::ImplicitSelf) => {
Ok(())
}
(&TyKind::Mac(ref mac1),
&TyKind::Mac(ref mac2)) => {
mcx.try_match(mac1, mac2)?;
Ok(())
}
(&TyKind::Err,
&TyKind::Err) => {
Ok(())
}
(&TyKind::CVarArgs,
&TyKind::CVarArgs) => {
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for TraitObjectSyntax {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for LitIntType {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for FloatTy {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for BareFnTy {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&BareFnTy { unsafety: ref unsafety1, abi: ref abi1, decl: ref decl1, generic_params: ref generic_params1 },
&BareFnTy { unsafety: ref unsafety2, abi: ref abi2, decl: ref decl2, generic_params: ref generic_params2 }) => {
mcx.try_match(unsafety1, unsafety2)?;
mcx.try_match(abi1, abi2)?;
mcx.try_match(decl1, decl2)?;
mcx.try_match(generic_params1, generic_params2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for Lifetime {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&Lifetime { id: ref id1, ident: ref ident1 },
&Lifetime { id: ref id2, ident: ref ident2 }) => {
mcx.try_match(id1, id2)?;
mcx.try_match(ident1, ident2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for GenericBound {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&GenericBound::Trait(ref poly_trait_ref1, ref modifier1),
&GenericBound::Trait(ref poly_trait_ref2, ref modifier2)) => {
mcx.try_match(poly_trait_ref1, poly_trait_ref2)?;
mcx.try_match(modifier1, modifier2)?;
Ok(())
}
(&GenericBound::Outlives(ref lt1),
&GenericBound::Outlives(ref lt2)) => {
mcx.try_match(lt1, lt2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for PolyTraitRef {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&PolyTraitRef { trait_ref: ref trait_ref1, span: ref span1, bound_generic_params: ref bound_generic_params1 },
&PolyTraitRef { trait_ref: ref trait_ref2, span: ref span2, bound_generic_params: ref bound_generic_params2 }) => {
mcx.try_match(trait_ref1, trait_ref2)?;
mcx.try_match(span1, span2)?;
mcx.try_match(bound_generic_params1, bound_generic_params2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for FnDecl {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&FnDecl { inputs: ref inputs1, output: ref output1, c_variadic: ref c_variadic1 },
&FnDecl { inputs: ref inputs2, output: ref output2, c_variadic: ref c_variadic2 }) => {
mcx.try_match(inputs1, inputs2)?;
mcx.try_match(output1, output2)?;
mcx.try_match(c_variadic1, c_variadic2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for FnHeader {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&FnHeader { unsafety: ref unsafety1, asyncness: ref asyncness1, constness: ref constness1, abi: ref abi1 },
&FnHeader { unsafety: ref unsafety2, asyncness: ref asyncness2, constness: ref constness2, abi: ref abi2 }) => {
mcx.try_match(unsafety1, unsafety2)?;
mcx.try_match(asyncness1, asyncness2)?;
mcx.try_match(constness1, constness2)?;
mcx.try_match(abi1, abi2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for Arg {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&Arg { ty: ref ty1, pat: ref pat1, id: ref id1 },
&Arg { ty: ref ty2, pat: ref pat2, id: ref id2 }) => {
mcx.try_match(ty1, ty2)?;
mcx.try_match(pat1, pat2)?;
mcx.try_match(id1, id2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for FunctionRetTy {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&FunctionRetTy::Default(ref sp1),
&FunctionRetTy::Default(ref sp2)) => {
mcx.try_match(sp1, sp2)?;
Ok(())
}
(&FunctionRetTy::Ty(ref ty1),
&FunctionRetTy::Ty(ref ty2)) => {
mcx.try_match(ty1, ty2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for TypeBinding {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&TypeBinding { id: ref id1, ident: ref ident1, ty: ref ty1, span: ref span1 },
&TypeBinding { id: ref id2, ident: ref ident2, ty: ref ty2, span: ref span2 }) => {
mcx.try_match(id1, id2)?;
mcx.try_match(ident1, ident2)?;
mcx.try_match(ty1, ty2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
fn default_try_match_stmt(this: &Stmt, target: &Stmt, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (this, target) {
(&Stmt { id: ref id1, node: ref node1, span: ref span1 },
&Stmt { id: ref id2, node: ref node2, span: ref span2 }) => {
mcx.try_match(id1, id2)?;
mcx.try_match(node1, node2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
#[allow(unused)]
impl TryMatch for StmtKind {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&StmtKind::Local(ref local1),
&StmtKind::Local(ref local2)) => {
mcx.try_match(local1, local2)?;
Ok(())
}
(&StmtKind::Item(ref item1),
&StmtKind::Item(ref item2)) => {
mcx.try_match(item1, item2)?;
Ok(())
}
(&StmtKind::Expr(ref expr1),
&StmtKind::Expr(ref expr2)) => {
mcx.try_match(expr1, expr2)?;
Ok(())
}
(&StmtKind::Semi(ref expr1),
&StmtKind::Semi(ref expr2)) => {
mcx.try_match(expr1, expr2)?;
Ok(())
}
(&StmtKind::Mac(ref mac1),
&StmtKind::Mac(ref mac2)) => {
mcx.try_match(mac1, mac2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for Local {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&Local { pat: ref pat1, ty: ref ty1, init: ref init1, id: ref id1, span: ref span1, attrs: ref attrs1 },
&Local { pat: ref pat2, ty: ref ty2, init: ref init2, id: ref id2, span: ref span2, attrs: ref attrs2 }) => {
mcx.try_match(pat1, pat2)?;
mcx.try_match(ty1, ty2)?;
mcx.try_match(init1, init2)?;
mcx.try_match(id1, id2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
fn default_try_match_expr(this: &Expr, target: &Expr, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (this, target) {
(&Expr { id: ref id1, node: ref node1, span: ref span1, attrs: ref attrs1 },
&Expr { id: ref id2, node: ref node2, span: ref span2, attrs: ref attrs2 }) => {
mcx.try_match(id1, id2)?;
mcx.try_match(node1, node2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
#[allow(unused)]
impl TryMatch for ExprKind {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&ExprKind::Box(ref expr1),
&ExprKind::Box(ref expr2)) => {
mcx.try_match(expr1, expr2)?;
Ok(())
}
(&ExprKind::ObsoleteInPlace(ref expr11, ref expr21),
&ExprKind::ObsoleteInPlace(ref expr12, ref expr22)) => {
mcx.try_match(expr11, expr12)?;
mcx.try_match(expr21, expr22)?;
Ok(())
}
(&ExprKind::Array(ref elems1),
&ExprKind::Array(ref elems2)) => {
mcx.try_match(elems1, elems2)?;
Ok(())
}
(&ExprKind::Call(ref func1, ref args1),
&ExprKind::Call(ref func2, ref args2)) => {
mcx.try_match(func1, func2)?;
mcx.try_match(args1, args2)?;
Ok(())
}
(&ExprKind::MethodCall(ref path_seg1, ref args1),
&ExprKind::MethodCall(ref path_seg2, ref args2)) => {
mcx.try_match(path_seg1, path_seg2)?;
mcx.try_match(args1, args2)?;
Ok(())
}
(&ExprKind::Tup(ref elems1),
&ExprKind::Tup(ref elems2)) => {
mcx.try_match(elems1, elems2)?;
Ok(())
}
(&ExprKind::Binary(ref op1, ref a1, ref b1),
&ExprKind::Binary(ref op2, ref a2, ref b2)) => {
mcx.try_match(op1, op2)?;
mcx.try_match(a1, a2)?;
mcx.try_match(b1, b2)?;
Ok(())
}
(&ExprKind::Unary(ref op1, ref a1),
&ExprKind::Unary(ref op2, ref a2)) => {
mcx.try_match(op1, op2)?;
mcx.try_match(a1, a2)?;
Ok(())
}
(&ExprKind::Lit(ref lit1),
&ExprKind::Lit(ref lit2)) => {
mcx.try_match(lit1, lit2)?;
Ok(())
}
(&ExprKind::Cast(ref expr1, ref ty1),
&ExprKind::Cast(ref expr2, ref ty2)) => {
mcx.try_match(expr1, expr2)?;
mcx.try_match(ty1, ty2)?;
Ok(())
}
(&ExprKind::Type(ref expr1, ref ty1),
&ExprKind::Type(ref expr2, ref ty2)) => {
mcx.try_match(expr1, expr2)?;
mcx.try_match(ty1, ty2)?;
Ok(())
}
(&ExprKind::If(ref cond1, ref then_body1, ref else_body1),
&ExprKind::If(ref cond2, ref then_body2, ref else_body2)) => {
mcx.try_match(cond1, cond2)?;
mcx.try_match(then_body1, then_body2)?;
mcx.try_match(else_body1, else_body2)?;
Ok(())
}
(&ExprKind::IfLet(ref pat1, ref expr1, ref then_body1, ref else_body1),
&ExprKind::IfLet(ref pat2, ref expr2, ref then_body2, ref else_body2)) => {
mcx.try_match(pat1, pat2)?;
mcx.try_match(expr1, expr2)?;
mcx.try_match(then_body1, then_body2)?;
mcx.try_match(else_body1, else_body2)?;
Ok(())
}
(&ExprKind::While(ref cond1, ref body1, ref label1),
&ExprKind::While(ref cond2, ref body2, ref label2)) => {
mcx.try_match(cond1, cond2)?;
mcx.try_match(body1, body2)?;
mcx.try_match(label1, label2)?;
Ok(())
}
(&ExprKind::WhileLet(ref pat1, ref expr1, ref body1, ref label1),
&ExprKind::WhileLet(ref pat2, ref expr2, ref body2, ref label2)) => {
mcx.try_match(pat1, pat2)?;
mcx.try_match(expr1, expr2)?;
mcx.try_match(body1, body2)?;
mcx.try_match(label1, label2)?;
Ok(())
}
(&ExprKind::ForLoop(ref pat1, ref iter1, ref body1, ref label1),
&ExprKind::ForLoop(ref pat2, ref iter2, ref body2, ref label2)) => {
mcx.try_match(pat1, pat2)?;
mcx.try_match(iter1, iter2)?;
mcx.try_match(body1, body2)?;
mcx.try_match(label1, label2)?;
Ok(())
}
(&ExprKind::Loop(ref body1, ref label1),
&ExprKind::Loop(ref body2, ref label2)) => {
mcx.try_match(body1, body2)?;
mcx.try_match(label1, label2)?;
Ok(())
}
(&ExprKind::Match(ref target1, ref arms1),
&ExprKind::Match(ref target2, ref arms2)) => {
mcx.try_match(target1, target2)?;
mcx.try_match(arms1, arms2)?;
Ok(())
}
(&ExprKind::Closure(ref cap1, ref is_async1, ref mov1, ref decl1, ref body1, ref span1),
&ExprKind::Closure(ref cap2, ref is_async2, ref mov2, ref decl2, ref body2, ref span2)) => {
mcx.try_match(cap1, cap2)?;
mcx.try_match(is_async1, is_async2)?;
mcx.try_match(mov1, mov2)?;
mcx.try_match(decl1, decl2)?;
mcx.try_match(body1, body2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(&ExprKind::Block(ref body1, ref label1),
&ExprKind::Block(ref body2, ref label2)) => {
mcx.try_match(body1, body2)?;
mcx.try_match(label1, label2)?;
Ok(())
}
(&ExprKind::Async(ref cap1, ref id1, ref block1),
&ExprKind::Async(ref cap2, ref id2, ref block2)) => {
mcx.try_match(cap1, cap2)?;
mcx.try_match(id1, id2)?;
mcx.try_match(block1, block2)?;
Ok(())
}
(&ExprKind::TryBlock(ref body1),
&ExprKind::TryBlock(ref body2)) => {
mcx.try_match(body1, body2)?;
Ok(())
}
(&ExprKind::Assign(ref lhs1, ref rhs1),
&ExprKind::Assign(ref lhs2, ref rhs2)) => {
mcx.try_match(lhs1, lhs2)?;
mcx.try_match(rhs1, rhs2)?;
Ok(())
}
(&ExprKind::AssignOp(ref op1, ref lhs1, ref rhs1),
&ExprKind::AssignOp(ref op2, ref lhs2, ref rhs2)) => {
mcx.try_match(op1, op2)?;
mcx.try_match(lhs1, lhs2)?;
mcx.try_match(rhs1, rhs2)?;
Ok(())
}
(&ExprKind::Field(ref expr1, ref ident1),
&ExprKind::Field(ref expr2, ref ident2)) => {
mcx.try_match(expr1, expr2)?;
mcx.try_match(ident1, ident2)?;
Ok(())
}
(&ExprKind::Index(ref arr1, ref idx1),
&ExprKind::Index(ref arr2, ref idx2)) => {
mcx.try_match(arr1, arr2)?;
mcx.try_match(idx1, idx2)?;
Ok(())
}
(&ExprKind::Range(ref lo1, ref hi1, ref limits1),
&ExprKind::Range(ref lo2, ref hi2, ref limits2)) => {
mcx.try_match(lo1, lo2)?;
mcx.try_match(hi1, hi2)?;
mcx.try_match(limits1, limits2)?;
Ok(())
}
(&ExprKind::Path(ref qself1, ref path1),
&ExprKind::Path(ref qself2, ref path2)) => {
mcx.try_match(qself1, qself2)?;
mcx.try_match(path1, path2)?;
Ok(())
}
(&ExprKind::AddrOf(ref mutbl1, ref expr1),
&ExprKind::AddrOf(ref mutbl2, ref expr2)) => {
mcx.try_match(mutbl1, mutbl2)?;
mcx.try_match(expr1, expr2)?;
Ok(())
}
(&ExprKind::Break(ref label1, ref expr1),
&ExprKind::Break(ref label2, ref expr2)) => {
mcx.try_match(label1, label2)?;
mcx.try_match(expr1, expr2)?;
Ok(())
}
(&ExprKind::Continue(ref label1),
&ExprKind::Continue(ref label2)) => {
mcx.try_match(label1, label2)?;
Ok(())
}
(&ExprKind::Ret(ref expr1),
&ExprKind::Ret(ref expr2)) => {
mcx.try_match(expr1, expr2)?;
Ok(())
}
(&ExprKind::InlineAsm(ref asm1),
&ExprKind::InlineAsm(ref asm2)) => {
mcx.try_match(asm1, asm2)?;
Ok(())
}
(&ExprKind::Mac(ref mac1),
&ExprKind::Mac(ref mac2)) => {
mcx.try_match(mac1, mac2)?;
Ok(())
}
(&ExprKind::Struct(ref path1, ref fields1, ref base1),
&ExprKind::Struct(ref path2, ref fields2, ref base2)) => {
mcx.try_match(path1, path2)?;
mcx.try_match(fields1, fields2)?;
mcx.try_match(base1, base2)?;
Ok(())
}
(&ExprKind::Repeat(ref item1, ref count1),
&ExprKind::Repeat(ref item2, ref count2)) => {
mcx.try_match(item1, item2)?;
mcx.try_match(count1, count2)?;
Ok(())
}
(&ExprKind::Paren(ref expr1),
&ExprKind::Paren(ref expr2)) => {
mcx.try_match(expr1, expr2)?;
Ok(())
}
(&ExprKind::Try(ref expr1),
&ExprKind::Try(ref expr2)) => {
mcx.try_match(expr1, expr2)?;
Ok(())
}
(&ExprKind::Yield(ref expr1),
&ExprKind::Yield(ref expr2)) => {
mcx.try_match(expr1, expr2)?;
Ok(())
}
(&ExprKind::Err,
&ExprKind::Err) => {
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for IsAsync {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&IsAsync::Async { closure_id: ref closure_id1, return_impl_trait_id: ref return_impl_trait_id1 },
&IsAsync::Async { closure_id: ref closure_id2, return_impl_trait_id: ref return_impl_trait_id2 }) => {
mcx.try_match(closure_id1, closure_id2)?;
mcx.try_match(return_impl_trait_id1, return_impl_trait_id2)?;
Ok(())
}
(&IsAsync::NotAsync,
&IsAsync::NotAsync) => {
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for Movability {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&Movability::Static,
&Movability::Static) => {
Ok(())
}
(&Movability::Movable,
&Movability::Movable) => {
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for UnOp {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&UnOp::Deref,
&UnOp::Deref) => {
Ok(())
}
(&UnOp::Not,
&UnOp::Not) => {
Ok(())
}
(&UnOp::Neg,
&UnOp::Neg) => {
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for BinOpKind {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
if self == target {
Ok(())
} else {
Err(matcher::Error::VariantMismatch)
}
}
}
#[allow(unused)]
impl TryMatch for Field {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&Field { ident: ref ident1, expr: ref expr1, span: ref span1, is_shorthand: ref is_shorthand1, attrs: ref attrs1 },
&Field { ident: ref ident2, expr: ref expr2, span: ref span2, is_shorthand: ref is_shorthand2, attrs: ref attrs2 }) => {
mcx.try_match(ident1, ident2)?;
mcx.try_match(expr1, expr2)?;
mcx.try_match(span1, span2)?;
mcx.try_match(is_shorthand1, is_shorthand2)?;
mcx.try_match(attrs1, attrs2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for Arm {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&Arm { attrs: ref attrs1, pats: ref pats1, guard: ref guard1, body: ref body1 },
&Arm { attrs: ref attrs2, pats: ref pats2, guard: ref guard2, body: ref body2 }) => {
mcx.try_match(attrs1, attrs2)?;
mcx.try_match(pats1, pats2)?;
mcx.try_match(guard1, guard2)?;
mcx.try_match(body1, body2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for Guard {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&Guard::If(ref expr1),
&Guard::If(ref expr2)) => {
mcx.try_match(expr1, expr2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
fn default_try_match_block(this: &Block, target: &Block, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (this, target) {
(&Block { stmts: ref stmts1, id: ref id1, rules: ref rules1, span: ref span1 },
&Block { stmts: ref stmts2, id: ref id2, rules: ref rules2, span: ref span2 }) => {
mcx.try_match(stmts1, stmts2)?;
mcx.try_match(id1, id2)?;
mcx.try_match(rules1, rules2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
#[allow(unused)]
fn default_try_match_pat(this: &Pat, target: &Pat, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (this, target) {
(&Pat { id: ref id1, node: ref node1, span: ref span1 },
&Pat { id: ref id2, node: ref node2, span: ref span2 }) => {
mcx.try_match(id1, id2)?;
mcx.try_match(node1, node2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
#[allow(unused)]
impl TryMatch for PatKind {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&PatKind::Wild,
&PatKind::Wild) => {
Ok(())
}
(&PatKind::Ident(ref mode1, ref id1, ref pat1),
&PatKind::Ident(ref mode2, ref id2, ref pat2)) => {
mcx.try_match(mode1, mode2)?;
mcx.try_match(id1, id2)?;
mcx.try_match(pat1, pat2)?;
Ok(())
}
(&PatKind::Struct(ref path1, ref fields1, ref dotdot1),
&PatKind::Struct(ref path2, ref fields2, ref dotdot2)) => {
mcx.try_match(path1, path2)?;
mcx.try_match(fields1, fields2)?;
mcx.try_match(dotdot1, dotdot2)?;
Ok(())
}
(&PatKind::TupleStruct(ref path1, ref fields1, ref dotdot1),
&PatKind::TupleStruct(ref path2, ref fields2, ref dotdot2)) => {
mcx.try_match(path1, path2)?;
mcx.try_match(fields1, fields2)?;
mcx.try_match(dotdot1, dotdot2)?;
Ok(())
}
(&PatKind::Path(ref qself1, ref path1),
&PatKind::Path(ref qself2, ref path2)) => {
mcx.try_match(qself1, qself2)?;
mcx.try_match(path1, path2)?;
Ok(())
}
(&PatKind::Tuple(ref pats1, ref dotdot1),
&PatKind::Tuple(ref pats2, ref dotdot2)) => {
mcx.try_match(pats1, pats2)?;
mcx.try_match(dotdot1, dotdot2)?;
Ok(())
}
(&PatKind::Box(ref pat1),
&PatKind::Box(ref pat2)) => {
mcx.try_match(pat1, pat2)?;
Ok(())
}
(&PatKind::Ref(ref pat1, ref mutbl1),
&PatKind::Ref(ref pat2, ref mutbl2)) => {
mcx.try_match(pat1, pat2)?;
mcx.try_match(mutbl1, mutbl2)?;
Ok(())
}
(&PatKind::Lit(ref expr1),
&PatKind::Lit(ref expr2)) => {
mcx.try_match(expr1, expr2)?;
Ok(())
}
(&PatKind::Range(ref lo1, ref hi1, ref end1),
&PatKind::Range(ref lo2, ref hi2, ref end2)) => {
mcx.try_match(lo1, lo2)?;
mcx.try_match(hi1, hi2)?;
mcx.try_match(end1, end2)?;
Ok(())
}
(&PatKind::Slice(ref start1, ref mid1, ref end1),
&PatKind::Slice(ref start2, ref mid2, ref end2)) => {
mcx.try_match(start1, start2)?;
mcx.try_match(mid1, mid2)?;
mcx.try_match(end1, end2)?;
Ok(())
}
(&PatKind::Paren(ref pat1),
&PatKind::Paren(ref pat2)) => {
mcx.try_match(pat1, pat2)?;
Ok(())
}
(&PatKind::Mac(ref mac1),
&PatKind::Mac(ref mac2)) => {
mcx.try_match(mac1, mac2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for FieldPat {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&FieldPat { ident: ref ident1, pat: ref pat1, is_shorthand: ref is_shorthand1, attrs: ref attrs1 },
&FieldPat { ident: ref ident2, pat: ref pat2, is_shorthand: ref is_shorthand2, attrs: ref attrs2 }) => {
mcx.try_match(ident1, ident2)?;
mcx.try_match(pat1, pat2)?;
mcx.try_match(is_shorthand1, is_shorthand2)?;
mcx.try_match(attrs1, attrs2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for LitKind {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&LitKind::Str(ref sym1, ref style1),
&LitKind::Str(ref sym2, ref style2)) => {
mcx.try_match(sym1, sym2)?;
mcx.try_match(style1, style2)?;
Ok(())
}
(&LitKind::ByteStr(ref bytes1),
&LitKind::ByteStr(ref bytes2)) => {
mcx.try_match(bytes1, bytes2)?;
Ok(())
}
(&LitKind::Byte(ref x1),
&LitKind::Byte(ref x2)) => {
mcx.try_match(x1, x2)?;
Ok(())
}
(&LitKind::Char(ref x1),
&LitKind::Char(ref x2)) => {
mcx.try_match(x1, x2)?;
Ok(())
}
(&LitKind::Int(ref x1, ref ty1),
&LitKind::Int(ref x2, ref ty2)) => {
mcx.try_match(x1, x2)?;
mcx.try_match(ty1, ty2)?;
Ok(())
}
(&LitKind::Float(ref sym1, ref ty1),
&LitKind::Float(ref sym2, ref ty2)) => {
mcx.try_match(sym1, sym2)?;
mcx.try_match(ty1, ty2)?;
Ok(())
}
(&LitKind::FloatUnsuffixed(ref sym1),
&LitKind::FloatUnsuffixed(ref sym2)) => {
mcx.try_match(sym1, sym2)?;
Ok(())
}
(&LitKind::Bool(ref x1),
&LitKind::Bool(ref x2)) => {
mcx.try_match(x1, x2)?;
Ok(())
}
(&LitKind::Err(ref sym1),
&LitKind::Err(ref sym2)) => {
mcx.try_match(sym1, sym2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for Defaultness {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for Constness {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for ImplPolarity {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for IsAuto {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for Unsafety {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for Abi {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for Mutability {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
if self == target {
Ok(())
} else {
Err(matcher::Error::VariantMismatch)
}
}
}
#[allow(unused)]
impl TryMatch for RangeEnd {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&RangeEnd::Included(ref syntax1),
&RangeEnd::Included(ref syntax2)) => {
mcx.try_match(syntax1, syntax2)?;
Ok(())
}
(&RangeEnd::Excluded,
&RangeEnd::Excluded) => {
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for RangeSyntax {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&RangeSyntax::DotDotDot,
&RangeSyntax::DotDotDot) => {
Ok(())
}
(&RangeSyntax::DotDotEq,
&RangeSyntax::DotDotEq) => {
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for BindingMode {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for CaptureBy {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for BlockCheckMode {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&BlockCheckMode::Default,
&BlockCheckMode::Default) => {
Ok(())
}
(&BlockCheckMode::Unsafe(ref source1),
&BlockCheckMode::Unsafe(ref source2)) => {
mcx.try_match(source1, source2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for UnsafeSource {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&UnsafeSource::CompilerGenerated,
&UnsafeSource::CompilerGenerated) => {
Ok(())
}
(&UnsafeSource::UserProvided,
&UnsafeSource::UserProvided) => {
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for StrStyle {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for AsmDialect {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for RangeLimits {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for Attribute {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&Attribute { id: ref id1, style: ref style1, path: ref path1, tokens: ref tokens1, is_sugared_doc: ref is_sugared_doc1, span: ref span1 },
&Attribute { id: ref id2, style: ref style2, path: ref path2, tokens: ref tokens2, is_sugared_doc: ref is_sugared_doc2, span: ref span2 }) => {
mcx.try_match(id1, id2)?;
mcx.try_match(style1, style2)?;
mcx.try_match(path1, path2)?;
mcx.try_match(tokens1, tokens2)?;
mcx.try_match(is_sugared_doc1, is_sugared_doc2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for AttrStyle {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
fn default_try_match_path(this: &Path, target: &Path, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (this, target) {
(&Path { span: ref span1, segments: ref segments1 },
&Path { span: ref span2, segments: ref segments2 }) => {
mcx.try_match(span1, span2)?;
mcx.try_match(segments1, segments2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
#[allow(unused)]
impl TryMatch for PathSegment {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&PathSegment { ident: ref ident1, id: ref id1, args: ref args1 },
&PathSegment { ident: ref ident2, id: ref id2, args: ref args2 }) => {
mcx.try_match(ident1, ident2)?;
mcx.try_match(id1, id2)?;
mcx.try_match(args1, args2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for GenericArgs {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&GenericArgs::AngleBracketed(ref abpd1),
&GenericArgs::AngleBracketed(ref abpd2)) => {
mcx.try_match(abpd1, abpd2)?;
Ok(())
}
(&GenericArgs::Parenthesized(ref ppd1),
&GenericArgs::Parenthesized(ref ppd2)) => {
mcx.try_match(ppd1, ppd2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for AngleBracketedArgs {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&AngleBracketedArgs { span: ref span1, args: ref args1, bindings: ref bindings1 },
&AngleBracketedArgs { span: ref span2, args: ref args2, bindings: ref bindings2 }) => {
mcx.try_match(span1, span2)?;
mcx.try_match(args1, args2)?;
mcx.try_match(bindings1, bindings2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for ParenthesizedArgs {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&ParenthesizedArgs { span: ref span1, inputs: ref inputs1, output: ref output1 },
&ParenthesizedArgs { span: ref span2, inputs: ref inputs2, output: ref output2 }) => {
mcx.try_match(span1, span2)?;
mcx.try_match(inputs1, inputs2)?;
mcx.try_match(output1, output2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for GenericArg {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&GenericArg::Lifetime(ref lt1),
&GenericArg::Lifetime(ref lt2)) => {
mcx.try_match(lt1, lt2)?;
Ok(())
}
(&GenericArg::Type(ref ty1),
&GenericArg::Type(ref ty2)) => {
mcx.try_match(ty1, ty2)?;
Ok(())
}
(&GenericArg::Const(ref c1),
&GenericArg::Const(ref c2)) => {
mcx.try_match(c1, c2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for QSelf {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&QSelf { ty: ref ty1, path_span: ref path_span1, position: ref position1 },
&QSelf { ty: ref ty2, path_span: ref path_span2, position: ref position2 }) => {
mcx.try_match(ty1, ty2)?;
mcx.try_match(path_span1, path_span2)?;
mcx.try_match(position1, position2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for Mac_ {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&Mac_ { path: ref path1, delim: ref delim1, tts: ref tts1 },
&Mac_ { path: ref path2, delim: ref delim2, tts: ref tts2 }) => {
mcx.try_match(path1, path2)?;
mcx.try_match(delim1, delim2)?;
mcx.try_match(tts1, tts2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for MacStmtStyle {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for TokenStream {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for MacroDef {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&MacroDef { tokens: ref tokens1, legacy: ref legacy1 },
&MacroDef { tokens: ref tokens2, legacy: ref legacy2 }) => {
mcx.try_match(tokens1, tokens2)?;
mcx.try_match(legacy1, legacy2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for InlineAsm {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&InlineAsm { asm: ref asm1, asm_str_style: ref asm_str_style1, outputs: ref outputs1, inputs: ref inputs1, clobbers: ref clobbers1, volatile: ref volatile1, alignstack: ref alignstack1, dialect: ref dialect1, ctxt: ref ctxt1 },
&InlineAsm { asm: ref asm2, asm_str_style: ref asm_str_style2, outputs: ref outputs2, inputs: ref inputs2, clobbers: ref clobbers2, volatile: ref volatile2, alignstack: ref alignstack2, dialect: ref dialect2, ctxt: ref ctxt2 }) => {
mcx.try_match(asm1, asm2)?;
mcx.try_match(asm_str_style1, asm_str_style2)?;
mcx.try_match(outputs1, outputs2)?;
mcx.try_match(inputs1, inputs2)?;
mcx.try_match(clobbers1, clobbers2)?;
mcx.try_match(volatile1, volatile2)?;
mcx.try_match(alignstack1, alignstack2)?;
mcx.try_match(dialect1, dialect2)?;
mcx.try_match(ctxt1, ctxt2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for GlobalAsm {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&GlobalAsm { asm: ref asm1, ctxt: ref ctxt1 },
&GlobalAsm { asm: ref asm2, ctxt: ref ctxt2 }) => {
mcx.try_match(asm1, asm2)?;
mcx.try_match(ctxt1, ctxt2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for InlineAsmOutput {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&InlineAsmOutput { constraint: ref constraint1, expr: ref expr1, is_rw: ref is_rw1, is_indirect: ref is_indirect1 },
&InlineAsmOutput { constraint: ref constraint2, expr: ref expr2, is_rw: ref is_rw2, is_indirect: ref is_indirect2 }) => {
mcx.try_match(constraint1, constraint2)?;
mcx.try_match(expr1, expr2)?;
mcx.try_match(is_rw1, is_rw2)?;
mcx.try_match(is_indirect1, is_indirect2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
fn default_try_match_label(this: &Label, target: &Label, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (this, target) {
(&Label { ident: ref ident1 },
&Label { ident: ref ident2 }) => {
mcx.try_match(ident1, ident2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
#[allow(unused)]
impl TryMatch for MacDelimiter {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&MacDelimiter::Parenthesis,
&MacDelimiter::Parenthesis) => {
Ok(())
}
(&MacDelimiter::Bracket,
&MacDelimiter::Bracket) => {
Ok(())
}
(&MacDelimiter::Brace,
&MacDelimiter::Brace) => {
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for AnonConst {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&AnonConst { id: ref id1, value: ref value1 },
&AnonConst { id: ref id2, value: ref value2 }) => {
mcx.try_match(id1, id2)?;
mcx.try_match(value1, value2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
fn default_try_match_ident(this: &Ident, target: &Ident, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (this, target) {
(&Ident { name: ref name1, span: ref span1 },
&Ident { name: ref name2, span: ref span2 }) => {
mcx.try_match(name1, name2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
#[allow(unused)]
impl TryMatch for Name {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
if self == target {
Ok(())
} else {
Err(matcher::Error::VariantMismatch)
}
}
}
#[allow(unused)]
impl TryMatch for SyntaxContext {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
if self == target {
Ok(())
} else {
Err(matcher::Error::VariantMismatch)
}
}
}
#[allow(unused)]
impl TryMatch for Span {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for NodeId {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for AttrId {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for usize {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for bool {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
if self == target {
Ok(())
} else {
Err(matcher::Error::VariantMismatch)
}
}
}
#[allow(unused)]
impl TryMatch for u128 {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
if self == target {
Ok(())
} else {
Err(matcher::Error::VariantMismatch)
}
}
}
#[allow(unused)]
impl TryMatch for u8 {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
if self == target {
Ok(())
} else {
Err(matcher::Error::VariantMismatch)
}
}
}
#[allow(unused)]
impl TryMatch for char {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
if self == target {
Ok(())
} else {
Err(matcher::Error::VariantMismatch)
}
}
}
#[allow(unused)]
impl TryMatch for Nonterminal {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&Nonterminal::NtItem(ref i1),
&Nonterminal::NtItem(ref i2)) => {
mcx.try_match(i1, i2)?;
Ok(())
}
(&Nonterminal::NtBlock(ref b1),
&Nonterminal::NtBlock(ref b2)) => {
mcx.try_match(b1, b2)?;
Ok(())
}
(&Nonterminal::NtStmt(ref s1),
&Nonterminal::NtStmt(ref s2)) => {
mcx.try_match(s1, s2)?;
Ok(())
}
(&Nonterminal::NtPat(ref p1),
&Nonterminal::NtPat(ref p2)) => {
mcx.try_match(p1, p2)?;
Ok(())
}
(&Nonterminal::NtExpr(ref y1),
&Nonterminal::NtExpr(ref y2)) => {
mcx.try_match(y1, y2)?;
Ok(())
}
(&Nonterminal::NtTy(ref t1),
&Nonterminal::NtTy(ref t2)) => {
mcx.try_match(t1, t2)?;
Ok(())
}
(&Nonterminal::NtIdent(ref i1, ref raw1),
&Nonterminal::NtIdent(ref i2, ref raw2)) => {
mcx.try_match(i1, i2)?;
mcx.try_match(raw1, raw2)?;
Ok(())
}
(&Nonterminal::NtLifetime(ref ident1),
&Nonterminal::NtLifetime(ref ident2)) => {
mcx.try_match(ident1, ident2)?;
Ok(())
}
(&Nonterminal::NtLiteral(ref expr1),
&Nonterminal::NtLiteral(ref expr2)) => {
mcx.try_match(expr1, expr2)?;
Ok(())
}
(&Nonterminal::NtMeta(ref m1),
&Nonterminal::NtMeta(ref m2)) => {
mcx.try_match(m1, m2)?;
Ok(())
}
(&Nonterminal::NtPath(ref p1),
&Nonterminal::NtPath(ref p2)) => {
mcx.try_match(p1, p2)?;
Ok(())
}
(&Nonterminal::NtVis(ref v1),
&Nonterminal::NtVis(ref v2)) => {
mcx.try_match(v1, v2)?;
Ok(())
}
(&Nonterminal::NtTT(ref tt1),
&Nonterminal::NtTT(ref tt2)) => {
mcx.try_match(tt1, tt2)?;
Ok(())
}
(&Nonterminal::NtArm(ref a1),
&Nonterminal::NtArm(ref a2)) => {
mcx.try_match(a1, a2)?;
Ok(())
}
(&Nonterminal::NtImplItem(ref ii1),
&Nonterminal::NtImplItem(ref ii2)) => {
mcx.try_match(ii1, ii2)?;
Ok(())
}
(&Nonterminal::NtTraitItem(ref ti1),
&Nonterminal::NtTraitItem(ref ti2)) => {
mcx.try_match(ti1, ti2)?;
Ok(())
}
(&Nonterminal::NtForeignItem(ref fi1),
&Nonterminal::NtForeignItem(ref fi2)) => {
mcx.try_match(fi1, fi2)?;
Ok(())
}
(&Nonterminal::NtGenerics(ref g1),
&Nonterminal::NtGenerics(ref g2)) => {
mcx.try_match(g1, g2)?;
Ok(())
}
(&Nonterminal::NtWhereClause(ref wc1),
&Nonterminal::NtWhereClause(ref wc2)) => {
mcx.try_match(wc1, wc2)?;
Ok(())
}
(&Nonterminal::NtArg(ref a1),
&Nonterminal::NtArg(ref a2)) => {
mcx.try_match(a1, a2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for TokenTree {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&TokenTree::Token(ref sp1, ref t1),
&TokenTree::Token(ref sp2, ref t2)) => {
mcx.try_match(sp1, sp2)?;
mcx.try_match(t1, t2)?;
Ok(())
}
(&TokenTree::Delimited(ref sp1, ref d1, ref tts1),
&TokenTree::Delimited(ref sp2, ref d2, ref tts2)) => {
mcx.try_match(sp1, sp2)?;
mcx.try_match(d1, d2)?;
mcx.try_match(tts1, tts2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for DelimSpan {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&DelimSpan { open: ref open1, close: ref close1 },
&DelimSpan { open: ref open2, close: ref close2 }) => {
mcx.try_match(open1, open2)?;
mcx.try_match(close1, close2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for DelimToken {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for Token {
fn try_match(&self, target: &Self, _mcx: &mut MatchCtxt) -> matcher::Result<()> {
Ok(())
}
}
#[allow(unused)]
impl TryMatch for MetaItem {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&MetaItem { path: ref path1, node: ref node1, span: ref span1 },
&MetaItem { path: ref path2, node: ref node2, span: ref span2 }) => {
mcx.try_match(path1, path2)?;
mcx.try_match(node1, node2)?;
mcx.try_match(span1, span2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for MetaItemKind {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&MetaItemKind::Word,
&MetaItemKind::Word) => {
Ok(())
}
(&MetaItemKind::List(ref l1),
&MetaItemKind::List(ref l2)) => {
mcx.try_match(l1, l2)?;
Ok(())
}
(&MetaItemKind::NameValue(ref lit1),
&MetaItemKind::NameValue(ref lit2)) => {
mcx.try_match(lit1, lit2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}
#[allow(unused)]
impl TryMatch for NestedMetaItem {
fn try_match(&self, target: &Self, mcx: &mut MatchCtxt) -> matcher::Result<()> {
match (self, target) {
(&NestedMetaItem::MetaItem(ref mi1),
&NestedMetaItem::MetaItem(ref mi2)) => {
mcx.try_match(mi1, mi2)?;
Ok(())
}
(&NestedMetaItem::Literal(ref lit1),
&NestedMetaItem::Literal(ref lit2)) => {
mcx.try_match(lit1, lit2)?;
Ok(())
}
(_, _) => Err(matcher::Error::VariantMismatch),
}
}
}