@@ -23,7 +23,7 @@ use rustc_hir::GenericParam;
23
23
use rustc_hir:: Item ;
24
24
use rustc_hir:: Node ;
25
25
use rustc_infer:: infer:: error_reporting:: same_type_modulo_infer;
26
- use rustc_infer:: traits:: { AmbiguousSelection , TraitEngine } ;
26
+ use rustc_infer:: traits:: TraitEngine ;
27
27
use rustc_middle:: traits:: select:: OverflowError ;
28
28
use rustc_middle:: ty:: abstract_const:: NotConstEvaluatable ;
29
29
use rustc_middle:: ty:: error:: ExpectedFound ;
@@ -1403,7 +1403,7 @@ trait InferCtxtPrivExt<'hir, 'tcx> {
1403
1403
fn annotate_source_of_ambiguity (
1404
1404
& self ,
1405
1405
err : & mut Diagnostic ,
1406
- impls : & [ AmbiguousSelection ] ,
1406
+ impls : & [ DefId ] ,
1407
1407
predicate : ty:: Predicate < ' tcx > ,
1408
1408
) ;
1409
1409
@@ -2036,14 +2036,6 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
2036
2036
) ;
2037
2037
match selcx. select_from_obligation ( & obligation) {
2038
2038
Err ( SelectionError :: Ambiguous ( impls) ) if impls. len ( ) > 1 => {
2039
- if self . is_tainted_by_errors ( ) && subst. is_none ( ) {
2040
- // If `subst.is_none()`, then this is probably two param-env
2041
- // candidates or impl candidates that are equal modulo lifetimes.
2042
- // Therefore, if we've already emitted an error, just skip this
2043
- // one, since it's not particularly actionable.
2044
- err. cancel ( ) ;
2045
- return ;
2046
- }
2047
2039
self . annotate_source_of_ambiguity ( & mut err, & impls, predicate) ;
2048
2040
}
2049
2041
_ => {
@@ -2224,35 +2216,24 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
2224
2216
fn annotate_source_of_ambiguity (
2225
2217
& self ,
2226
2218
err : & mut Diagnostic ,
2227
- impls : & [ AmbiguousSelection ] ,
2219
+ impls : & [ DefId ] ,
2228
2220
predicate : ty:: Predicate < ' tcx > ,
2229
2221
) {
2230
2222
let mut spans = vec ! [ ] ;
2231
2223
let mut crates = vec ! [ ] ;
2232
2224
let mut post = vec ! [ ] ;
2233
- let mut or_where_clause = false ;
2234
- for ambig in impls {
2235
- match ambig {
2236
- AmbiguousSelection :: Impl ( def_id) => match self . tcx . span_of_impl ( * def_id) {
2237
- Ok ( span) => spans. push ( span) ,
2238
- Err ( name) => {
2239
- crates. push ( name) ;
2240
- if let Some ( header) = to_pretty_impl_header ( self . tcx , * def_id) {
2241
- post. push ( header) ;
2242
- }
2225
+ for def_id in impls {
2226
+ match self . tcx . span_of_impl ( * def_id) {
2227
+ Ok ( span) => spans. push ( span) ,
2228
+ Err ( name) => {
2229
+ crates. push ( name) ;
2230
+ if let Some ( header) = to_pretty_impl_header ( self . tcx , * def_id) {
2231
+ post. push ( header) ;
2243
2232
}
2244
- } ,
2245
- AmbiguousSelection :: ParamEnv ( span) => {
2246
- or_where_clause = true ;
2247
- spans. push ( * span) ;
2248
2233
}
2249
2234
}
2250
2235
}
2251
- let msg = format ! (
2252
- "multiple `impl`s{} satisfying `{}` found" ,
2253
- if or_where_clause { " or `where` clauses" } else { "" } ,
2254
- predicate
2255
- ) ;
2236
+ let msg = format ! ( "multiple `impl`s satisfying `{}` found" , predicate) ;
2256
2237
let mut crate_names: Vec < _ > = crates. iter ( ) . map ( |n| format ! ( "`{}`" , n) ) . collect ( ) ;
2257
2238
crate_names. sort ( ) ;
2258
2239
crate_names. dedup ( ) ;
0 commit comments