Skip to content

Commit

Permalink
Rename to __TestExhaustive
Browse files Browse the repository at this point in the history
This calls attention in review that it's not meant to be used the same
as a typical variant.
  • Loading branch information
dtolnay committed Jan 24, 2021
1 parent 8d62642 commit 1368867
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
10 changes: 5 additions & 5 deletions src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ ast_enum_of_structs! {
// Expr::Yield(e) => {...}
//
// #[cfg(test)]
// Expr::TestExhaustive => unimplemented!(),
// Expr::__TestExhaustive => unimplemented!(),
// #[cfg(not(test))]
// _ => { /* some sane fallback */ }
// }
Expand All @@ -244,7 +244,7 @@ ast_enum_of_structs! {
// added, so that you can add code to handle it, but your library will
// continue to compile and work for downstream users in the interim.
#[doc(hidden)]
TestExhaustive,
__TestExhaustive,
}
}

Expand Down Expand Up @@ -823,7 +823,7 @@ impl Expr {
| Expr::TryBlock(ExprTryBlock { attrs, .. })
| Expr::Yield(ExprYield { attrs, .. }) => mem::replace(attrs, new),
Expr::Verbatim(_) => Vec::new(),
Expr::TestExhaustive => unreachable!(),
Expr::__TestExhaustive => unreachable!(),
}
}
}
Expand Down Expand Up @@ -2322,7 +2322,7 @@ pub(crate) mod parsing {
Pat::Type(_) => unreachable!(),
Pat::Verbatim(_) => {}
Pat::Wild(pat) => pat.attrs = attrs,
Pat::TestExhaustive => unreachable!(),
Pat::__TestExhaustive => unreachable!(),
}
Ok(pat)
}
Expand Down Expand Up @@ -2673,7 +2673,7 @@ pub(crate) mod parsing {
}
for part in float_repr.split('.') {
let index = crate::parse_str(part).map_err(|err| Error::new(float.span(), err))?;
let base = mem::replace(e, Expr::TestExhaustive);
let base = mem::replace(e, Expr::__TestExhaustive);
*e = Expr::Field(ExprField {
attrs: Vec::new(),
base: Box::new(base),
Expand Down
24 changes: 12 additions & 12 deletions src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ast_enum_of_structs! {
// Item::Verbatim(e) => {...}
//
// #[cfg(test)]
// Item::TestExhaustive => unimplemented!(),
// Item::__TestExhaustive => unimplemented!(),
// #[cfg(not(test))]
// _ => { /* some sane fallback */ }
// }
Expand All @@ -91,7 +91,7 @@ ast_enum_of_structs! {
// added, so that you can add code to handle it, but your library will
// continue to compile and work for downstream users in the interim.
#[doc(hidden)]
TestExhaustive,
__TestExhaustive,
}
}

Expand Down Expand Up @@ -376,7 +376,7 @@ impl Item {
| Item::Macro(ItemMacro { attrs, .. })
| Item::Macro2(ItemMacro2 { attrs, .. }) => mem::replace(attrs, new),
Item::Verbatim(_) => Vec::new(),
Item::TestExhaustive => unreachable!(),
Item::__TestExhaustive => unreachable!(),
}
}
}
Expand Down Expand Up @@ -582,7 +582,7 @@ ast_enum_of_structs! {
// ForeignItem::Verbatim(e) => {...}
//
// #[cfg(test)]
// ForeignItem::TestExhaustive => unimplemented!(),
// ForeignItem::__TestExhaustive => unimplemented!(),
// #[cfg(not(test))]
// _ => { /* some sane fallback */ }
// }
Expand All @@ -592,7 +592,7 @@ ast_enum_of_structs! {
// added, so that you can add code to handle it, but your library will
// continue to compile and work for downstream users in the interim.
#[doc(hidden)]
TestExhaustive,
__TestExhaustive,
}
}

Expand Down Expand Up @@ -689,7 +689,7 @@ ast_enum_of_structs! {
// TraitItem::Verbatim(e) => {...}
//
// #[cfg(test)]
// TraitItem::TestExhaustive => unimplemented!(),
// TraitItem::__TestExhaustive => unimplemented!(),
// #[cfg(not(test))]
// _ => { /* some sane fallback */ }
// }
Expand All @@ -699,7 +699,7 @@ ast_enum_of_structs! {
// added, so that you can add code to handle it, but your library will
// continue to compile and work for downstream users in the interim.
#[doc(hidden)]
TestExhaustive,
__TestExhaustive,
}
}

Expand Down Expand Up @@ -798,7 +798,7 @@ ast_enum_of_structs! {
// ImplItem::Verbatim(e) => {...}
//
// #[cfg(test)]
// ImplItem::TestExhaustive => unimplemented!(),
// ImplItem::__TestExhaustive => unimplemented!(),
// #[cfg(not(test))]
// _ => { /* some sane fallback */ }
// }
Expand All @@ -808,7 +808,7 @@ ast_enum_of_structs! {
// added, so that you can add code to handle it, but your library will
// continue to compile and work for downstream users in the interim.
#[doc(hidden)]
TestExhaustive,
__TestExhaustive,
}
}

Expand Down Expand Up @@ -1771,7 +1771,7 @@ pub mod parsing {
ForeignItem::Type(item) => &mut item.attrs,
ForeignItem::Macro(item) => &mut item.attrs,
ForeignItem::Verbatim(_) => return Ok(item),
ForeignItem::TestExhaustive => unreachable!(),
ForeignItem::__TestExhaustive => unreachable!(),
};
attrs.extend(item_attrs.drain(..));
*item_attrs = attrs;
Expand Down Expand Up @@ -2249,7 +2249,7 @@ pub mod parsing {
TraitItem::Method(item) => &mut item.attrs,
TraitItem::Type(item) => &mut item.attrs,
TraitItem::Macro(item) => &mut item.attrs,
TraitItem::Verbatim(_) | TraitItem::TestExhaustive => unreachable!(),
TraitItem::Verbatim(_) | TraitItem::__TestExhaustive => unreachable!(),
};
attrs.extend(item_attrs.drain(..));
*item_attrs = attrs;
Expand Down Expand Up @@ -2580,7 +2580,7 @@ pub mod parsing {
ImplItem::Type(item) => &mut item.attrs,
ImplItem::Macro(item) => &mut item.attrs,
ImplItem::Verbatim(_) => return Ok(item),
ImplItem::TestExhaustive => unreachable!(),
ImplItem::__TestExhaustive => unreachable!(),
};
attrs.extend(item_attrs.drain(..));
*item_attrs = attrs;
Expand Down
4 changes: 2 additions & 2 deletions src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ ast_enum_of_structs! {
// Pat::Wild(e) => {...}
//
// #[cfg(test)]
// Pat::TestExhaustive => unimplemented!(),
// Pat::__TestExhaustive => unimplemented!(),
// #[cfg(not(test))]
// _ => { /* some sane fallback */ }
// }
Expand All @@ -92,7 +92,7 @@ ast_enum_of_structs! {
// added, so that you can add code to handle it, but your library will
// continue to compile and work for downstream users in the interim.
#[doc(hidden)]
TestExhaustive,
__TestExhaustive,
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ ast_enum_of_structs! {
// Type::Verbatim(e) => {...}
//
// #[cfg(test)]
// Type::TestExhaustive => unimplemented!(),
// Type::__TestExhaustive => unimplemented!(),
// #[cfg(not(test))]
// _ => { /* some sane fallback */ }
// }
Expand All @@ -83,7 +83,7 @@ ast_enum_of_structs! {
// added, so that you can add code to handle it, but your library will
// continue to compile and work for downstream users in the interim.
#[doc(hidden)]
TestExhaustive,
__TestExhaustive,
}
}

Expand Down

0 comments on commit 1368867

Please sign in to comment.