File tree Expand file tree Collapse file tree 3 files changed +22
-2
lines changed
compiler/rustc_hir_analysis/src/hir_ty_lowering
tests/ui/impl-trait/in-trait Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -204,8 +204,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
204204 . iter ( )
205205 . flat_map ( |trait_def_id| tcx. associated_items ( * trait_def_id) . in_definition_order ( ) )
206206 . filter_map ( |item| {
207- ( !item. is_impl_trait_in_trait ( ) && item. as_tag ( ) == assoc_tag)
208- . then_some ( item. name ( ) )
207+ ( !item. is_impl_trait_in_trait ( ) && item. as_tag ( ) == assoc_tag) . then ( || item. name ( ) )
209208 } )
210209 . collect ( ) ;
211210
Original file line number Diff line number Diff line change 1+ // Regression test for <https://github.com/rust-lang/rust/issues/139873>.
2+
3+ // Test that we don't try to get the (nonexistent) name of the RPITIT in `Trait::foo`
4+ // when emitting an error for a missing associated item `Trait::Output`.
5+
6+ trait Trait {
7+ fn foo ( ) -> impl Sized ;
8+ fn bar ( ) -> Self :: Output ;
9+ //~^ ERROR associated type `Output` not found for `Self`
10+ }
11+
12+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0220]: associated type `Output` not found for `Self`
2+ --> $DIR/dont-probe-missing-item-name.rs:8:23
3+ |
4+ LL | fn bar() -> Self::Output;
5+ | ^^^^^^ associated type `Output` not found
6+
7+ error: aborting due to 1 previous error
8+
9+ For more information about this error, try `rustc --explain E0220`.
You can’t perform that action at this time.
0 commit comments