Some refactoring
This commit is contained in:
parent
e4e5db4e42
commit
8ef81388e2
27 changed files with 74 additions and 89 deletions
|
@ -2592,8 +2592,8 @@ impl<'a> Resolver<'a> {
|
|||
debug!("validate_res_from_ribs({:?})", res);
|
||||
let ribs = &all_ribs[rib_index + 1..];
|
||||
|
||||
// An invalid forward use of a type parameter from a previous default.
|
||||
if let ForwardTyParamBanRibKind = all_ribs[rib_index].kind {
|
||||
// An invalid forward use of a generic parameter from a previous default.
|
||||
if let ForwardGenericParamBanRibKind = all_ribs[rib_index].kind {
|
||||
if record_used {
|
||||
let res_error = if rib_ident.name == kw::SelfUpper {
|
||||
ResolutionError::SelfInTyParamDefault
|
||||
|
@ -2617,7 +2617,7 @@ impl<'a> Resolver<'a> {
|
|||
| ClosureOrAsyncRibKind
|
||||
| ModuleRibKind(..)
|
||||
| MacroDefinition(..)
|
||||
| ForwardTyParamBanRibKind => {
|
||||
| ForwardGenericParamBanRibKind => {
|
||||
// Nothing to do. Continue.
|
||||
}
|
||||
ItemRibKind(_) | FnItemRibKind | AssocItemRibKind => {
|
||||
|
@ -2689,7 +2689,9 @@ impl<'a> Resolver<'a> {
|
|||
|
||||
// We only forbid constant items if we are inside of type defaults,
|
||||
// for example `struct Foo<T, U = [u8; std::mem::size_of::<T>()]>`
|
||||
ForwardTyParamBanRibKind => {
|
||||
ForwardGenericParamBanRibKind => {
|
||||
// FIXME(const_generic_defaults): we may need to distinguish between
|
||||
// being in type parameter defaults and const parameter defaults
|
||||
in_ty_param_default = true;
|
||||
continue;
|
||||
}
|
||||
|
@ -2782,7 +2784,9 @@ impl<'a> Resolver<'a> {
|
|||
|
||||
// We only forbid constant items if we are inside of type defaults,
|
||||
// for example `struct Foo<T, U = [u8; std::mem::size_of::<T>()]>`
|
||||
ForwardTyParamBanRibKind => {
|
||||
ForwardGenericParamBanRibKind => {
|
||||
// FIXME(const_generic_defaults): we may need to distinguish between
|
||||
// being in type parameter defaults and const parameter defaults
|
||||
in_ty_param_default = true;
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue