@@ -214,6 +214,8 @@ enum ResolutionError<'a> {
214
214
BindingShadowsSomethingUnacceptable ( & ' static str , Symbol , & ' a NameBinding < ' a > ) ,
215
215
/// Error E0128: type parameters with a default cannot use forward-declared identifiers.
216
216
ForwardDeclaredTyParam , // FIXME(const_generics:defaults)
217
+ /// ERROR E0770: the type of const parameters must not depend on other generic parameters.
218
+ ParamInTyOfConstArg ,
217
219
/// Error E0735: type parameters with a default cannot use `Self`
218
220
SelfInTyParamDefault ,
219
221
/// Error E0767: use of unreachable label
@@ -2480,6 +2482,12 @@ impl<'a> Resolver<'a> {
2480
2482
}
2481
2483
return Res :: Err ;
2482
2484
}
2485
+ ConstParamTyRibKind => {
2486
+ if record_used {
2487
+ self . report_error ( span, ParamInTyOfConstArg ) ;
2488
+ }
2489
+ return Res :: Err ;
2490
+ }
2483
2491
}
2484
2492
}
2485
2493
if let Some ( res_err) = res_err {
@@ -2503,6 +2511,12 @@ impl<'a> Resolver<'a> {
2503
2511
// This was an attempt to use a type parameter outside its scope.
2504
2512
ItemRibKind ( has_generic_params) => has_generic_params,
2505
2513
FnItemRibKind => HasGenericParams :: Yes ,
2514
+ ConstParamTyRibKind => {
2515
+ if record_used {
2516
+ self . report_error ( span, ResolutionError :: ParamInTyOfConstArg ) ;
2517
+ }
2518
+ return Res :: Err ;
2519
+ }
2506
2520
} ;
2507
2521
2508
2522
if record_used {
@@ -2527,9 +2541,21 @@ impl<'a> Resolver<'a> {
2527
2541
}
2528
2542
for rib in ribs {
2529
2543
let has_generic_params = match rib. kind {
2544
+ NormalRibKind
2545
+ | ClosureOrAsyncRibKind
2546
+ | AssocItemRibKind
2547
+ | ModuleRibKind ( ..)
2548
+ | MacroDefinition ( ..)
2549
+ | ForwardTyParamBanRibKind
2550
+ | ConstantItemRibKind => continue ,
2530
2551
ItemRibKind ( has_generic_params) => has_generic_params,
2531
2552
FnItemRibKind => HasGenericParams :: Yes ,
2532
- _ => continue ,
2553
+ ConstParamTyRibKind => {
2554
+ if record_used {
2555
+ self . report_error ( span, ResolutionError :: ParamInTyOfConstArg ) ;
2556
+ }
2557
+ return Res :: Err ;
2558
+ }
2533
2559
} ;
2534
2560
2535
2561
// This was an attempt to use a const parameter outside its scope.
0 commit comments