Simplify for loop desugar

This commit is contained in:
Cameron Steffen 2021-10-25 23:33:12 -05:00
parent 3bfde2f1f4
commit 9c83f8c4d1
26 changed files with 181 additions and 256 deletions

View file

@ -1099,18 +1099,11 @@ pub enum DesugaringKind {
OpaqueTy,
Async,
Await,
ForLoop(ForLoopLoc),
ForLoop,
LetElse,
WhileLoop,
}
/// A location in the desugaring of a `for` loop
#[derive(Clone, Copy, PartialEq, Debug, Encodable, Decodable, HashStable_Generic)]
pub enum ForLoopLoc {
Head,
IntoIter,
}
impl DesugaringKind {
/// The description wording should combine well with "desugaring of {}".
pub fn descr(self) -> &'static str {
@ -1121,7 +1114,7 @@ impl DesugaringKind {
DesugaringKind::QuestionMark => "operator `?`",
DesugaringKind::TryBlock => "`try` block",
DesugaringKind::OpaqueTy => "`impl Trait`",
DesugaringKind::ForLoop(_) => "`for` loop",
DesugaringKind::ForLoop => "`for` loop",
DesugaringKind::LetElse => "`let...else`",
DesugaringKind::WhileLoop => "`while` loop",
}

View file

@ -41,7 +41,7 @@ pub mod edition;
use edition::Edition;
pub mod hygiene;
use hygiene::Transparency;
pub use hygiene::{DesugaringKind, ExpnKind, ForLoopLoc, MacroKind};
pub use hygiene::{DesugaringKind, ExpnKind, MacroKind};
pub use hygiene::{ExpnData, ExpnHash, ExpnId, LocalExpnId, SyntaxContext};
pub mod def_id;
use def_id::{CrateNum, DefId, DefPathHash, LocalDefId, LOCAL_CRATE};

View file

@ -269,7 +269,6 @@ symbols! {
__D,
__H,
__S,
__next,
__try_var,
_args,
_d,