This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
compiler/rustc_hir_analysis/src/astconv Expand file tree Collapse file tree 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 {
378378 assert ! ( self_ty. is_none( ) ) ;
379379 }
380380
381- let arg_count = check_generic_arg_count (
381+ let mut arg_count = check_generic_arg_count (
382382 tcx,
383383 span,
384384 def_id,
@@ -560,6 +560,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
560560 inferred_params : vec ! [ ] ,
561561 infer_args,
562562 } ;
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+ }
563571 let args = create_args_for_parent_generic_args (
564572 tcx,
565573 def_id,
@@ -570,13 +578,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
570578 & mut args_ctx,
571579 ) ;
572580
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-
580581 ( args, arg_count)
581582 }
582583
You can’t perform that action at this time.
0 commit comments