Remove expect_anon and expect_anon_placeholder in favor of var
This commit is contained in:
parent
4646b3df6a
commit
167b70692b
4 changed files with 12 additions and 34 deletions
|
@ -149,17 +149,15 @@ impl<'tcx> CanonicalVarInfo<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn expect_anon_placeholder(self) -> u32 {
|
||||
pub fn expect_placeholder_index(self) -> usize {
|
||||
match self.kind {
|
||||
CanonicalVarKind::Ty(_)
|
||||
| CanonicalVarKind::Region(_)
|
||||
| CanonicalVarKind::Const(_, _) => bug!("expected placeholder: {self:?}"),
|
||||
|
||||
CanonicalVarKind::PlaceholderRegion(placeholder) => {
|
||||
placeholder.bound.kind.expect_anon()
|
||||
}
|
||||
CanonicalVarKind::PlaceholderTy(placeholder) => placeholder.bound.kind.expect_anon(),
|
||||
CanonicalVarKind::PlaceholderConst(placeholder, _) => placeholder.bound.as_u32(),
|
||||
CanonicalVarKind::PlaceholderRegion(placeholder) => placeholder.bound.var.as_usize(),
|
||||
CanonicalVarKind::PlaceholderTy(placeholder) => placeholder.bound.var.as_usize(),
|
||||
CanonicalVarKind::PlaceholderConst(placeholder, _) => placeholder.bound.as_usize(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,15 +107,6 @@ impl BoundRegionKind {
|
|||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn expect_anon(&self) -> u32 {
|
||||
match *self {
|
||||
BoundRegionKind::BrNamed(_, _) | BoundRegionKind::BrEnv => {
|
||||
bug!("expected anon region: {self:?}")
|
||||
}
|
||||
BoundRegionKind::BrAnon(idx, _) => idx,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Article {
|
||||
|
@ -1537,15 +1528,6 @@ pub enum BoundTyKind {
|
|||
Param(DefId, Symbol),
|
||||
}
|
||||
|
||||
impl BoundTyKind {
|
||||
pub fn expect_anon(self) -> u32 {
|
||||
match self {
|
||||
BoundTyKind::Anon(i) => i,
|
||||
_ => bug!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<BoundVar> for BoundTy {
|
||||
fn from(var: BoundVar) -> Self {
|
||||
BoundTy { var, kind: BoundTyKind::Anon(var.as_u32()) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue