Skip to content

Commit

Permalink
Derive traversable impls for BindingForm
Browse files Browse the repository at this point in the history
BindingForm has been a no-op traversable ever since it was first added
in cac6126, but it was modified in 0193d1f to (optionally) contain a
Place without its implementations being updated to fold/visit such.

By using the derive macro to implement the visitable traits, we ensure
that all contained types of interest are folded/visited.
  • Loading branch information
eggyal committed Mar 21, 2023
1 parent 99e070f commit 408ba98
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_middle/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ pub enum LocalKind {
ReturnPointer,
}

#[derive(Clone, Debug, TyEncodable, TyDecodable, HashStable)]
#[derive(Clone, Debug, TyEncodable, TyDecodable, HashStable, TypeFoldable, TypeVisitable)]
pub struct VarBindingForm<'tcx> {
/// Is variable bound via `x`, `mut x`, `ref x`, or `ref mut x`?
pub binding_mode: ty::BindingMode,
Expand All @@ -696,7 +696,7 @@ pub struct VarBindingForm<'tcx> {
pub pat_span: Span,
}

#[derive(Clone, Debug, TyEncodable, TyDecodable)]
#[derive(Clone, Debug, TyEncodable, TyDecodable, TypeFoldable, TypeVisitable)]
pub enum BindingForm<'tcx> {
/// This is a binding for a non-`self` binding, or a `self` that has an explicit type.
Var(VarBindingForm<'tcx>),
Expand All @@ -706,7 +706,7 @@ pub enum BindingForm<'tcx> {
RefForGuard,
}

TrivialTypeTraversalAndLiftImpls! {
CloneLiftImpls! {
for<'tcx> {
BindingForm<'tcx>,
}
Expand Down

0 comments on commit 408ba98

Please sign in to comment.