Skip to content

Commit dcdd867

Browse files
authored
Rollup merge of #112322 - compiler-errors:no-IMPLIED_BOUNDS_ENTAILMENT-if-errs, r=eholk
Don't mention `IMPLIED_BOUNDS_ENTAILMENT` if signatures reference error Fixes #112321
2 parents 44acf79 + 0e9e91a commit dcdd867

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

Diff for: compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ fn compare_method_predicate_entailment<'tcx>(
302302
return Err(emitted);
303303
}
304304

305-
if check_implied_wf == CheckImpliedWfMode::Check {
305+
if check_implied_wf == CheckImpliedWfMode::Check && !(impl_sig, trait_sig).references_error() {
306306
// We need to check that the impl's args are well-formed given
307307
// the hybrid param-env (impl + trait method where-clauses).
308308
ocx.register_obligation(traits::Obligation::new(

Diff for: tests/ui/implied-bounds/references-err.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
trait Identity {
2+
type Identity;
3+
}
4+
impl<T> Identity for T {
5+
type Identity = T;
6+
}
7+
8+
trait Trait {
9+
type Assoc: Identity;
10+
fn tokenize(&self) -> <Self::Assoc as Identity>::Identity;
11+
}
12+
13+
impl Trait for () {
14+
type Assoc = DoesNotExist;
15+
//~^ ERROR cannot find type `DoesNotExist` in this scope
16+
17+
fn tokenize(&self) -> <Self::Assoc as Identity>::Identity {
18+
unimplemented!()
19+
}
20+
}
21+
22+
fn main() {}

Diff for: tests/ui/implied-bounds/references-err.stderr

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0412]: cannot find type `DoesNotExist` in this scope
2+
--> $DIR/references-err.rs:14:18
3+
|
4+
LL | type Assoc = DoesNotExist;
5+
| ^^^^^^^^^^^^ not found in this scope
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0412`.

0 commit comments

Comments
 (0)