File tree 3 files changed +23
-2
lines changed
compiler/rustc_hir_analysis/src/collect/type_of
3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -324,6 +324,9 @@ struct RpitConstraintChecker<'tcx> {
324
324
impl RpitConstraintChecker < ' _ > {
325
325
#[ instrument( skip( self ) , level = "debug" ) ]
326
326
fn check ( & self , def_id : LocalDefId ) {
327
+ if self . found . references_error ( ) {
328
+ return ;
329
+ }
327
330
// Use borrowck to get the type with unerased regions.
328
331
let concrete_opaque_types = & self . tcx . mir_borrowck ( def_id) . concrete_opaque_types ;
329
332
debug ! ( ?concrete_opaque_types) ;
@@ -335,8 +338,7 @@ impl RpitConstraintChecker<'_> {
335
338
336
339
debug ! ( ?concrete_type, "found constraint" ) ;
337
340
338
- if concrete_type. ty != self . found . ty && !( concrete_type, self . found ) . references_error ( )
339
- {
341
+ if concrete_type. ty != self . found . ty && !concrete_type. references_error ( ) {
340
342
self . found . report_mismatch ( & concrete_type, self . def_id , self . tcx ) . emit ( ) ;
341
343
}
342
344
}
Original file line number Diff line number Diff line change
1
+ trait Foo { }
2
+
3
+ trait T {
4
+ fn a ( & self ) -> impl Foo {
5
+ self . b ( || 0 )
6
+ //~^ ERROR no method named `b` found for reference `&Self` in the current scope
7
+ }
8
+ }
9
+
10
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0599]: no method named `b` found for reference `&Self` in the current scope
2
+ --> $DIR/issue-117794.rs:5:14
3
+ |
4
+ LL | self.b(|| 0)
5
+ | ^ help: there is a method with a similar name: `a`
6
+
7
+ error: aborting due to previous error
8
+
9
+ For more information about this error, try `rustc --explain E0599`.
You can’t perform that action at this time.
0 commit comments