@@ -214,6 +214,8 @@ enum ResolutionError<'a> {
214214 BindingShadowsSomethingUnacceptable ( & ' static str , Symbol , & ' a NameBinding < ' a > ) ,
215215 /// Error E0128: type parameters with a default cannot use forward-declared identifiers.
216216 ForwardDeclaredTyParam , // FIXME(const_generics:defaults)
217+ /// ERROR E0770: the type of const parameters must not depend on other generic parameters.
218+ ParamInTyOfConstArg ,
217219 /// Error E0735: type parameters with a default cannot use `Self`
218220 SelfInTyParamDefault ,
219221 /// Error E0767: use of unreachable label
@@ -2480,6 +2482,12 @@ impl<'a> Resolver<'a> {
24802482 }
24812483 return Res :: Err ;
24822484 }
2485+ ConstParamTyRibKind => {
2486+ if record_used {
2487+ self . report_error ( span, ParamInTyOfConstArg ) ;
2488+ }
2489+ return Res :: Err ;
2490+ }
24832491 }
24842492 }
24852493 if let Some ( res_err) = res_err {
@@ -2503,6 +2511,12 @@ impl<'a> Resolver<'a> {
25032511 // This was an attempt to use a type parameter outside its scope.
25042512 ItemRibKind ( has_generic_params) => has_generic_params,
25052513 FnItemRibKind => HasGenericParams :: Yes ,
2514+ ConstParamTyRibKind => {
2515+ if record_used {
2516+ self . report_error ( span, ResolutionError :: ParamInTyOfConstArg ) ;
2517+ }
2518+ return Res :: Err ;
2519+ }
25062520 } ;
25072521
25082522 if record_used {
@@ -2527,9 +2541,21 @@ impl<'a> Resolver<'a> {
25272541 }
25282542 for rib in ribs {
25292543 let has_generic_params = match rib. kind {
2544+ NormalRibKind
2545+ | ClosureOrAsyncRibKind
2546+ | AssocItemRibKind
2547+ | ModuleRibKind ( ..)
2548+ | MacroDefinition ( ..)
2549+ | ForwardTyParamBanRibKind
2550+ | ConstantItemRibKind => continue ,
25302551 ItemRibKind ( has_generic_params) => has_generic_params,
25312552 FnItemRibKind => HasGenericParams :: Yes ,
2532- _ => continue ,
2553+ ConstParamTyRibKind => {
2554+ if record_used {
2555+ self . report_error ( span, ResolutionError :: ParamInTyOfConstArg ) ;
2556+ }
2557+ return Res :: Err ;
2558+ }
25332559 } ;
25342560
25352561 // This was an attempt to use a const parameter outside its scope.
0 commit comments