mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-02 13:07:37 +00:00
Remove dead code stemming from the old effects desugaring (II)
This commit is contained in:
parent
481b5fadd7
commit
4301d0266d
@ -2117,11 +2117,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||||||
hir::ConstArgKind::Anon(ct)
|
hir::ConstArgKind::Anon(ct)
|
||||||
};
|
};
|
||||||
|
|
||||||
self.arena.alloc(hir::ConstArg {
|
self.arena.alloc(hir::ConstArg { hir_id: self.next_id(), kind: ct_kind })
|
||||||
hir_id: self.next_id(),
|
|
||||||
kind: ct_kind,
|
|
||||||
is_desugared_from_effects: false,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`hir::ConstArg`] for when to use this function vs
|
/// See [`hir::ConstArg`] for when to use this function vs
|
||||||
@ -2163,19 +2159,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
|
||||||
return ConstArg {
|
return ConstArg { hir_id: self.next_id(), kind: hir::ConstArgKind::Path(qpath) };
|
||||||
hir_id: self.next_id(),
|
|
||||||
kind: hir::ConstArgKind::Path(qpath),
|
|
||||||
is_desugared_from_effects: false,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let lowered_anon = self.lower_anon_const_to_anon_const(anon);
|
let lowered_anon = self.lower_anon_const_to_anon_const(anon);
|
||||||
ConstArg {
|
ConstArg { hir_id: self.next_id(), kind: hir::ConstArgKind::Anon(lowered_anon) }
|
||||||
hir_id: self.next_id(),
|
|
||||||
kind: hir::ConstArgKind::Anon(lowered_anon),
|
|
||||||
is_desugared_from_effects: false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See [`hir::ConstArg`] for when to use this function vs
|
/// See [`hir::ConstArg`] for when to use this function vs
|
||||||
|
@ -261,8 +261,6 @@ pub struct ConstArg<'hir> {
|
|||||||
#[stable_hasher(ignore)]
|
#[stable_hasher(ignore)]
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
pub kind: ConstArgKind<'hir>,
|
pub kind: ConstArgKind<'hir>,
|
||||||
/// Indicates whether this comes from a `~const` desugaring.
|
|
||||||
pub is_desugared_from_effects: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'hir> ConstArg<'hir> {
|
impl<'hir> ConstArg<'hir> {
|
||||||
@ -462,14 +460,7 @@ impl<'hir> GenericArgs<'hir> {
|
|||||||
/// This function returns the number of type and const generic params.
|
/// This function returns the number of type and const generic params.
|
||||||
/// It should only be used for diagnostics.
|
/// It should only be used for diagnostics.
|
||||||
pub fn num_generic_params(&self) -> usize {
|
pub fn num_generic_params(&self) -> usize {
|
||||||
self.args
|
self.args.iter().filter(|arg| !matches!(arg, GenericArg::Lifetime(_))).count()
|
||||||
.iter()
|
|
||||||
.filter(|arg| match arg {
|
|
||||||
GenericArg::Lifetime(_)
|
|
||||||
| GenericArg::Const(ConstArg { is_desugared_from_effects: true, .. }) => false,
|
|
||||||
_ => true,
|
|
||||||
})
|
|
||||||
.count()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The span encompassing the arguments and constraints[^1] inside the surrounding brackets.
|
/// The span encompassing the arguments and constraints[^1] inside the surrounding brackets.
|
||||||
|
@ -2516,14 +2516,6 @@ fn clean_generic_args<'tcx>(
|
|||||||
}
|
}
|
||||||
hir::GenericArg::Lifetime(_) => GenericArg::Lifetime(Lifetime::elided()),
|
hir::GenericArg::Lifetime(_) => GenericArg::Lifetime(Lifetime::elided()),
|
||||||
hir::GenericArg::Type(ty) => GenericArg::Type(clean_ty(ty, cx)),
|
hir::GenericArg::Type(ty) => GenericArg::Type(clean_ty(ty, cx)),
|
||||||
// Checking for `is_desugared_from_effects` on the `AnonConst` not only accounts for the case
|
|
||||||
// where the argument is `host` but for all possible cases (e.g., `true`, `false`).
|
|
||||||
hir::GenericArg::Const(hir::ConstArg {
|
|
||||||
is_desugared_from_effects: true,
|
|
||||||
..
|
|
||||||
}) => {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
hir::GenericArg::Const(ct) => GenericArg::Const(Box::new(clean_const(ct, cx))),
|
hir::GenericArg::Const(ct) => GenericArg::Const(Box::new(clean_const(ct, cx))),
|
||||||
hir::GenericArg::Infer(_inf) => GenericArg::Infer,
|
hir::GenericArg::Infer(_inf) => GenericArg::Infer,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user