File tree 1 file changed +9
-8
lines changed
compiler/rustc_hir_analysis/src/astconv
1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -378,7 +378,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
378
378
assert ! ( self_ty. is_none( ) ) ;
379
379
}
380
380
381
- let arg_count = check_generic_arg_count (
381
+ let mut arg_count = check_generic_arg_count (
382
382
tcx,
383
383
span,
384
384
def_id,
@@ -560,6 +560,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
560
560
inferred_params : vec ! [ ] ,
561
561
infer_args,
562
562
} ;
563
+ if let ty:: BoundConstness :: ConstIfConst = constness
564
+ && generics. has_self
565
+ && !tcx. has_attr ( def_id, sym:: const_trait)
566
+ {
567
+ let e = tcx. sess . emit_err ( crate :: errors:: ConstBoundForNonConstTrait { span } ) ;
568
+ arg_count. correct =
569
+ Err ( GenericArgCountMismatch { reported : Some ( e) , invalid_args : vec ! [ ] } ) ;
570
+ }
563
571
let args = create_args_for_parent_generic_args (
564
572
tcx,
565
573
def_id,
@@ -570,13 +578,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
570
578
& mut args_ctx,
571
579
) ;
572
580
573
- if let ty:: BoundConstness :: ConstIfConst = constness
574
- && generics. has_self
575
- && !tcx. has_attr ( def_id, sym:: const_trait)
576
- {
577
- tcx. sess . emit_err ( crate :: errors:: ConstBoundForNonConstTrait { span } ) ;
578
- }
579
-
580
581
( args, arg_count)
581
582
}
582
583
You can’t perform that action at this time.
0 commit comments