Remove dead code stemming from an old effects desugaring
This commit is contained in:
parent
154037ffb8
commit
6fc0cf4288
11 changed files with 16 additions and 26 deletions
|
|
@ -2028,7 +2028,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
|
||||
(
|
||||
hir::ParamName::Plain(self.lower_ident(param.ident)),
|
||||
hir::GenericParamKind::Const { ty, default, synthetic: false },
|
||||
hir::GenericParamKind::Const { ty, default },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -784,7 +784,6 @@ pub enum GenericParamKind<'hir> {
|
|||
ty: &'hir Ty<'hir>,
|
||||
/// Optional default value for the const generic param
|
||||
default: Option<&'hir ConstArg<'hir>>,
|
||||
synthetic: bool,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1085,7 +1085,7 @@ pub fn walk_generic_param<'v, V: Visitor<'v>>(
|
|||
GenericParamKind::Type { ref default, .. } => {
|
||||
visit_opt!(visitor, visit_ty_unambig, default)
|
||||
}
|
||||
GenericParamKind::Const { ref ty, ref default, synthetic: _ } => {
|
||||
GenericParamKind::Const { ref ty, ref default } => {
|
||||
try_visit!(visitor.visit_ty_unambig(ty));
|
||||
if let Some(default) = default {
|
||||
try_visit!(visitor.visit_const_param_default(*hir_id, default));
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
|
|||
|
||||
ty::GenericParamDefKind::Type { has_default: default.is_some(), synthetic }
|
||||
}
|
||||
GenericParamKind::Const { ty: _, default, synthetic } => {
|
||||
GenericParamKind::Const { ty: _, default } => {
|
||||
if default.is_some() {
|
||||
match param_default_policy.expect("no policy for generic param default") {
|
||||
ParamDefaultPolicy::Allowed => {}
|
||||
|
|
@ -316,7 +316,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
|
|||
}
|
||||
}
|
||||
|
||||
ty::GenericParamDefKind::Const { has_default: default.is_some(), synthetic }
|
||||
ty::GenericParamDefKind::Const { has_default: default.is_some() }
|
||||
}
|
||||
};
|
||||
Some(ty::GenericParamDef {
|
||||
|
|
@ -523,7 +523,7 @@ impl<'v> Visitor<'v> for AnonConstInParamTyDetector {
|
|||
type Result = ControlFlow<()>;
|
||||
|
||||
fn visit_generic_param(&mut self, p: &'v hir::GenericParam<'v>) -> Self::Result {
|
||||
if let GenericParamKind::Const { ty, default: _, synthetic: _ } = p.kind {
|
||||
if let GenericParamKind::Const { ty, default: _ } = p.kind {
|
||||
let prev = self.in_param_ty;
|
||||
self.in_param_ty = true;
|
||||
let res = self.visit_ty_unambig(ty);
|
||||
|
|
|
|||
|
|
@ -419,14 +419,7 @@ pub(crate) fn check_generic_arg_count(
|
|||
.filter(|param| matches!(param.kind, ty::GenericParamDefKind::Type { synthetic: true, .. }))
|
||||
.count();
|
||||
let named_type_param_count = param_counts.types - has_self as usize - synth_type_param_count;
|
||||
let synth_const_param_count = gen_params
|
||||
.own_params
|
||||
.iter()
|
||||
.filter(|param| {
|
||||
matches!(param.kind, ty::GenericParamDefKind::Const { synthetic: true, .. })
|
||||
})
|
||||
.count();
|
||||
let named_const_param_count = param_counts.consts - synth_const_param_count;
|
||||
let named_const_param_count = param_counts.consts;
|
||||
let infer_lifetimes =
|
||||
(gen_pos != GenericArgPosition::Type || seg.infer_args) && !gen_args.has_lifetime_params();
|
||||
|
||||
|
|
|
|||
|
|
@ -2379,7 +2379,7 @@ impl<'a> State<'a> {
|
|||
self.print_type(default);
|
||||
}
|
||||
}
|
||||
GenericParamKind::Const { ty, ref default, synthetic: _ } => {
|
||||
GenericParamKind::Const { ty, ref default } => {
|
||||
self.word_space(":");
|
||||
self.print_type(ty);
|
||||
if let Some(default) = default {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use crate::ty::{EarlyBinder, GenericArgsRef};
|
|||
pub enum GenericParamDefKind {
|
||||
Lifetime,
|
||||
Type { has_default: bool, synthetic: bool },
|
||||
Const { has_default: bool, synthetic: bool },
|
||||
Const { has_default: bool },
|
||||
}
|
||||
|
||||
impl GenericParamDefKind {
|
||||
|
|
|
|||
|
|
@ -656,13 +656,13 @@ impl<'tcx> Stable<'tcx> for rustc_middle::ty::GenericParamDefKind {
|
|||
|
||||
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
|
||||
use crate::ty::GenericParamDefKind;
|
||||
match self {
|
||||
match *self {
|
||||
ty::GenericParamDefKind::Lifetime => GenericParamDefKind::Lifetime,
|
||||
ty::GenericParamDefKind::Type { has_default, synthetic } => {
|
||||
GenericParamDefKind::Type { has_default: *has_default, synthetic: *synthetic }
|
||||
GenericParamDefKind::Type { has_default, synthetic }
|
||||
}
|
||||
ty::GenericParamDefKind::Const { has_default, synthetic: _ } => {
|
||||
GenericParamDefKind::Const { has_default: *has_default }
|
||||
ty::GenericParamDefKind::Const { has_default } => {
|
||||
GenericParamDefKind::Const { has_default }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -557,7 +557,7 @@ fn clean_generic_param_def(
|
|||
},
|
||||
)
|
||||
}
|
||||
ty::GenericParamDefKind::Const { has_default, synthetic } => (
|
||||
ty::GenericParamDefKind::Const { has_default } => (
|
||||
def.name,
|
||||
GenericParamDefKind::Const {
|
||||
ty: Box::new(clean_middle_ty(
|
||||
|
|
@ -580,7 +580,6 @@ fn clean_generic_param_def(
|
|||
} else {
|
||||
None
|
||||
},
|
||||
synthetic,
|
||||
},
|
||||
),
|
||||
};
|
||||
|
|
@ -636,14 +635,13 @@ fn clean_generic_param<'tcx>(
|
|||
},
|
||||
)
|
||||
}
|
||||
hir::GenericParamKind::Const { ty, default, synthetic } => (
|
||||
hir::GenericParamKind::Const { ty, default } => (
|
||||
param.name.ident().name,
|
||||
GenericParamDefKind::Const {
|
||||
ty: Box::new(clean_ty(ty, cx)),
|
||||
default: default.map(|ct| {
|
||||
Box::new(lower_const_arg_for_rustdoc(cx.tcx, ct, FeedConstTy::No).to_string())
|
||||
}),
|
||||
synthetic,
|
||||
},
|
||||
),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1396,7 +1396,7 @@ pub(crate) enum GenericParamDefKind {
|
|||
Lifetime { outlives: ThinVec<Lifetime> },
|
||||
Type { bounds: ThinVec<GenericBound>, default: Option<Box<Type>>, synthetic: bool },
|
||||
// Option<Box<String>> makes this type smaller than `Option<String>` would.
|
||||
Const { ty: Box<Type>, default: Option<Box<String>>, synthetic: bool },
|
||||
Const { ty: Box<Type>, default: Option<Box<String>> },
|
||||
}
|
||||
|
||||
impl GenericParamDefKind {
|
||||
|
|
|
|||
|
|
@ -466,7 +466,7 @@ impl FromClean<clean::GenericParamDefKind> for GenericParamDefKind {
|
|||
default: default.into_json(renderer),
|
||||
is_synthetic: *synthetic,
|
||||
},
|
||||
Const { ty, default, synthetic: _ } => GenericParamDefKind::Const {
|
||||
Const { ty, default } => GenericParamDefKind::Const {
|
||||
type_: ty.into_json(renderer),
|
||||
default: default.as_ref().map(|x| x.as_ref().clone()),
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue