1
Fork 0

adjust const generics defaults FIXMEs to the new feature gate

This commit is contained in:
Rémy Rakic 2020-12-31 02:50:23 +01:00
parent 907ba75eb0
commit 1fc3c4c16d
13 changed files with 14 additions and 14 deletions

View file

@ -774,7 +774,7 @@ fn validate_generic_param_order(
} }
GenericParamKind::Type { default: None } => (), GenericParamKind::Type { default: None } => (),
GenericParamKind::Lifetime => (), GenericParamKind::Lifetime => (),
// FIXME(const_generics:defaults) // FIXME(const_generics_defaults)
GenericParamKind::Const { ty: _, kw_span: _, default: _ } => (), GenericParamKind::Const { ty: _, kw_span: _, default: _ } => (),
} }
first = false; first = false;

View file

@ -958,7 +958,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
ty::GenericParamDefKind::Type { has_default, .. } => { ty::GenericParamDefKind::Type { has_default, .. } => {
Some((param.def_id, has_default)) Some((param.def_id, has_default))
} }
ty::GenericParamDefKind::Const => None, // FIXME(const_generics:defaults) ty::GenericParamDefKind::Const => None, // FIXME(const_generics_defaults)
}) })
.peekable(); .peekable();
let has_default = { let has_default = {

View file

@ -1834,7 +1834,7 @@ impl EncodeContext<'a, 'tcx> {
EntryKind::ConstParam, EntryKind::ConstParam,
true, true,
); );
// FIXME(const_generics:defaults) // FIXME(const_generics_defaults)
} }
} }
} }

View file

@ -203,7 +203,7 @@ pub trait Printer<'tcx>: Sized {
self.tcx().type_of(param.def_id).subst(self.tcx(), substs), self.tcx().type_of(param.def_id).subst(self.tcx(), substs),
) )
} }
ty::GenericParamDefKind::Const => false, // FIXME(const_generics:defaults) ty::GenericParamDefKind::Const => false, // FIXME(const_generics_defaults)
} }
}) })
.count(); .count();

View file

@ -443,7 +443,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
fn visit_generic_param(&mut self, p: &'tcx hir::GenericParam<'tcx>) { fn visit_generic_param(&mut self, p: &'tcx hir::GenericParam<'tcx>) {
let kind = match &p.kind { let kind = match &p.kind {
// FIXME(const_generics:defaults) // FIXME(const_generics_defaults)
hir::GenericParamKind::Type { default, .. } if default.is_some() => { hir::GenericParamKind::Type { default, .. } if default.is_some() => {
AnnotationKind::Container AnnotationKind::Container
} }

View file

@ -214,7 +214,7 @@ enum ResolutionError<'a> {
/// Error E0530: `X` bindings cannot shadow `Y`s. /// Error E0530: `X` bindings cannot shadow `Y`s.
BindingShadowsSomethingUnacceptable(&'static str, Symbol, &'a NameBinding<'a>), BindingShadowsSomethingUnacceptable(&'static str, Symbol, &'a NameBinding<'a>),
/// Error E0128: type parameters with a default cannot use forward-declared identifiers. /// Error E0128: type parameters with a default cannot use forward-declared identifiers.
ForwardDeclaredTyParam, // FIXME(const_generics:defaults) ForwardDeclaredTyParam, // FIXME(const_generics_defaults)
/// ERROR E0770: the type of const parameters must not depend on other generic parameters. /// ERROR E0770: the type of const parameters must not depend on other generic parameters.
ParamInTyOfConstParam(Symbol), ParamInTyOfConstParam(Symbol),
/// constant values inside of type parameter defaults must not depend on generic parameters. /// constant values inside of type parameter defaults must not depend on generic parameters.

View file

@ -387,7 +387,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
defaults.types += has_default as usize defaults.types += has_default as usize
} }
GenericParamDefKind::Const => { GenericParamDefKind::Const => {
// FIXME(const_generics:defaults) // FIXME(const_generics_defaults)
} }
}; };
} }

View file

@ -486,7 +486,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
} }
GenericParamDefKind::Const => { GenericParamDefKind::Const => {
let ty = tcx.at(self.span).type_of(param.def_id); let ty = tcx.at(self.span).type_of(param.def_id);
// FIXME(const_generics:defaults) // FIXME(const_generics_defaults)
if infer_args { if infer_args {
// No const parameters were provided, we can infer all. // No const parameters were provided, we can infer all.
self.astconv.ct_infer(ty, Some(param), self.span).into() self.astconv.ct_infer(ty, Some(param), self.span).into()

View file

@ -1376,7 +1376,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
} }
} }
GenericParamDefKind::Const => { GenericParamDefKind::Const => {
// FIXME(const_generics:defaults) // FIXME(const_generics_defaults)
// No const parameters were provided, we have to infer them. // No const parameters were provided, we have to infer them.
self.fcx.var_for_def(self.span, param) self.fcx.var_for_def(self.span, param)
} }

View file

@ -785,7 +785,7 @@ fn check_where_clauses<'tcx, 'fcx>(
} }
GenericParamDefKind::Const => { GenericParamDefKind::Const => {
// FIXME(const_generics:defaults) // FIXME(const_generics_defaults)
fcx.tcx.mk_param_from_def(param) fcx.tcx.mk_param_from_def(param)
} }
} }

View file

@ -228,7 +228,7 @@ impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
hir::GenericParamKind::Const { .. } => { hir::GenericParamKind::Const { .. } => {
let def_id = self.tcx.hir().local_def_id(param.hir_id); let def_id = self.tcx.hir().local_def_id(param.hir_id);
self.tcx.ensure().type_of(def_id); self.tcx.ensure().type_of(def_id);
// FIXME(const_generics:defaults) // FIXME(const_generics_defaults)
} }
} }
} }

View file

@ -612,7 +612,7 @@ impl Clean<GenericParamDef> for hir::GenericParam<'_> {
GenericParamDefKind::Const { GenericParamDefKind::Const {
did: cx.tcx.hir().local_def_id(self.hir_id).to_def_id(), did: cx.tcx.hir().local_def_id(self.hir_id).to_def_id(),
ty: ty.clean(cx), ty: ty.clean(cx),
// FIXME(const_generics_defaults): add `default` field here to the docs // FIXME(const_generics_defaults): add `default` field here for docs
}, },
), ),
}; };
@ -1386,7 +1386,7 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &DocContext<'_>) -> Type {
if let Some(ct) = const_ { if let Some(ct) = const_ {
ct_substs.insert(const_param_def_id.to_def_id(), ct.clean(cx)); ct_substs.insert(const_param_def_id.to_def_id(), ct.clean(cx));
} }
// FIXME(const_generics:defaults) // FIXME(const_generics_defaults)
indices.consts += 1; indices.consts += 1;
} }
} }

View file

@ -7,7 +7,7 @@ struct Foo<T, U = [u8; std::mem::size_of::<T>()]>(T, U);
//[full]~^ ERROR constant values inside of type parameter defaults //[full]~^ ERROR constant values inside of type parameter defaults
//[min]~^^ ERROR generic parameters may not be used in const operations //[min]~^^ ERROR generic parameters may not be used in const operations
// FIXME(const_generics:defaults): We still don't know how to we deal with type defaults. // FIXME(const_generics_defaults): We still don't know how to deal with type defaults.
struct Bar<T = [u8; N], const N: usize>(T); struct Bar<T = [u8; N], const N: usize>(T);
//~^ ERROR constant values inside of type parameter defaults //~^ ERROR constant values inside of type parameter defaults
//~| ERROR type parameters with a default //~| ERROR type parameters with a default