@@ -568,20 +568,22 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
568
568
}
569
569
tcx. check_stability ( assoc_ty. def_id , Some ( ref_id) , binding. span ) ;
570
570
571
- dup_bindings. entry ( assoc_ty. def_id )
572
- . and_modify ( |prev_span| {
573
- let mut err = self . tcx ( ) . struct_span_lint_node (
574
- :: rustc:: lint:: builtin:: DUPLICATE_ASSOCIATED_TYPE_BINDINGS ,
575
- ref_id,
576
- binding. span ,
577
- & format ! ( "associated type binding `{}` specified more than once" ,
578
- binding. item_name)
579
- ) ;
580
- err. span_label ( binding. span , "used more than once" ) ;
581
- err. span_label ( * prev_span, format ! ( "first use of `{}`" , binding. item_name) ) ;
582
- err. emit ( ) ;
583
- } )
584
- . or_insert ( binding. span ) ;
571
+ if speculative {
572
+ dup_bindings. entry ( assoc_ty. def_id )
573
+ . and_modify ( |prev_span| {
574
+ let mut err = self . tcx ( ) . struct_span_lint_node (
575
+ :: rustc:: lint:: builtin:: DUPLICATE_ASSOCIATED_TYPE_BINDINGS ,
576
+ ref_id,
577
+ binding. span ,
578
+ & format ! ( "associated type binding `{}` specified more than once" ,
579
+ binding. item_name)
580
+ ) ;
581
+ err. span_label ( binding. span , "used more than once" ) ;
582
+ err. span_label ( * prev_span, format ! ( "first use of `{}`" , binding. item_name) ) ;
583
+ err. emit ( ) ;
584
+ } )
585
+ . or_insert ( binding. span ) ;
586
+ }
585
587
586
588
Ok ( candidate. map_bound ( |trait_ref| {
587
589
ty:: ProjectionPredicate {
0 commit comments