Skip to content

Commit c9410f5

Browse files
Remove E0719
This hard error serves no purpose. Fixes #143143
1 parent 430d6ed commit c9410f5

File tree

15 files changed

+390
-972
lines changed

15 files changed

+390
-972
lines changed

compiler/rustc_error_codes/src/error_codes/E0719.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
#### Note: this error code is no longer emitted by the compiler.
2+
13
An associated type value was specified more than once.
24

35
Erroneous code example:
46

5-
```compile_fail,E0719
7+
```
68
trait FooTrait {}
79
trait BarTrait {}
810

compiler/rustc_error_codes/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ E0716: 0716,
464464
E0711: 0711,
465465
E0717: 0717,
466466
E0718: 0718,
467-
E0719: 0719,
467+
E0719: 0719, // REMOVED: no longer an error
468468
E0720: 0720,
469469
E0722: 0722,
470470
E0724: 0724,

compiler/rustc_hir_analysis/messages.ftl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -595,11 +595,6 @@ hir_analysis_unused_generic_parameter_ty_alias_help =
595595
596596
hir_analysis_useless_impl_item = this item cannot be used as its where bounds are not satisfied for the `Self` type
597597
598-
hir_analysis_value_of_associated_struct_already_specified =
599-
the value of the associated type `{$item_name}` in trait `{$def_path}` is already specified
600-
.label = re-bound here
601-
.previous_bound_label = `{$item_name}` bound here first
602-
603598
hir_analysis_variadic_function_compatible_convention = C-variadic functions with the {$convention} calling convention are not supported
604599
.label = C-variadic function must have a compatible calling convention
605600

compiler/rustc_hir_analysis/src/errors.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -388,18 +388,6 @@ pub(crate) struct TypeofReservedKeywordUsed<'tcx> {
388388
pub opt_sugg: Option<(Span, Applicability)>,
389389
}
390390

391-
#[derive(Diagnostic)]
392-
#[diag(hir_analysis_value_of_associated_struct_already_specified, code = E0719)]
393-
pub(crate) struct ValueOfAssociatedStructAlreadySpecified {
394-
#[primary_span]
395-
#[label]
396-
pub span: Span,
397-
#[label(hir_analysis_previous_bound_label)]
398-
pub prev_span: Span,
399-
pub item_name: Ident,
400-
pub def_path: String,
401-
}
402-
403391
#[derive(Diagnostic)]
404392
#[diag(hir_analysis_unconstrained_opaque_type)]
405393
#[note]

compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::ops::ControlFlow;
22

3-
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
3+
use rustc_data_structures::fx::FxIndexSet;
44
use rustc_errors::codes::*;
55
use rustc_errors::struct_span_code_err;
66
use rustc_hir as hir;
@@ -511,14 +511,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
511511
/// the `trait_ref` here will be `for<'a> T: Iterator`.
512512
/// The `constraint` data however is from *inside* the binder
513513
/// (e.g., `&'a u32`) and hence may reference bound regions.
514-
#[instrument(level = "debug", skip(self, bounds, duplicates, path_span))]
514+
#[instrument(level = "debug", skip(self, bounds, path_span))]
515515
pub(super) fn lower_assoc_item_constraint(
516516
&self,
517517
hir_ref_id: hir::HirId,
518518
trait_ref: ty::PolyTraitRef<'tcx>,
519519
constraint: &hir::AssocItemConstraint<'tcx>,
520520
bounds: &mut Vec<(ty::Clause<'tcx>, Span)>,
521-
duplicates: &mut FxIndexMap<DefId, Span>,
522521
path_span: Span,
523522
predicate_filter: PredicateFilter,
524523
) -> Result<(), ErrorGuaranteed> {
@@ -574,18 +573,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
574573
)
575574
.expect("failed to find associated item");
576575

577-
duplicates
578-
.entry(assoc_item.def_id)
579-
.and_modify(|prev_span| {
580-
self.dcx().emit_err(errors::ValueOfAssociatedStructAlreadySpecified {
581-
span: constraint.span,
582-
prev_span: *prev_span,
583-
item_name: constraint.ident,
584-
def_path: tcx.def_path_str(assoc_item.container_id(tcx)),
585-
});
586-
})
587-
.or_insert(constraint.span);
588-
589576
let projection_term = if let ty::AssocTag::Fn = assoc_tag {
590577
let bound_vars = tcx.late_bound_vars(constraint.hir_id);
591578
ty::Binder::bind_with_vars(

compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
132132
self.dcx()
133133
.struct_span_err(
134134
span,
135-
format!(
136-
"conflicting associated type bounds for `{item}` when \
137-
expanding trait alias"
138-
),
135+
format!("conflicting associated type bounds for `{item}`"),
139136
)
140137
.with_span_label(
141138
old_proj_span,

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use std::assert_matches::assert_matches;
2424
use std::slice;
2525

2626
use rustc_ast::TraitObjectSyntax;
27-
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
27+
use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
2828
use rustc_errors::codes::*;
2929
use rustc_errors::{
3030
Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, FatalError, struct_span_code_err,
@@ -910,7 +910,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
910910
}
911911
}
912912

913-
let mut dup_constraints = FxIndexMap::default();
914913
for constraint in trait_segment.args().constraints {
915914
// Don't register any associated item constraints for negative bounds,
916915
// since we should have emitted an error for them earlier, and they
@@ -929,7 +928,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
929928
poly_trait_ref,
930929
constraint,
931930
bounds,
932-
&mut dup_constraints,
933931
constraint.span,
934932
predicate_filter,
935933
);

0 commit comments

Comments
 (0)