File tree 3 files changed +32
-0
lines changed
compiler/rustc_hir_analysis/src/collect
tests/ui/impl-trait/in-trait
3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,15 @@ pub(crate) fn opaque_hidden_types(tcx: TyCtxt<'_>) {
11
11
}
12
12
13
13
for id in tcx. hir_crate_items ( ( ) ) . opaques ( ) {
14
+ if let hir:: OpaqueTyOrigin :: FnReturn { parent : fn_def_id, .. }
15
+ | hir:: OpaqueTyOrigin :: AsyncFn { parent : fn_def_id, .. } =
16
+ tcx. hir ( ) . expect_opaque_ty ( id) . origin
17
+ && let hir:: Node :: TraitItem ( trait_item) = tcx. hir_node_by_def_id ( fn_def_id)
18
+ && let ( _, hir:: TraitFn :: Required ( ..) ) = trait_item. expect_fn ( )
19
+ {
20
+ continue ;
21
+ }
22
+
14
23
let ty = tcx. type_of ( id) . instantiate_identity ( ) ;
15
24
let span = tcx. def_span ( id) ;
16
25
tcx. dcx ( ) . emit_err ( crate :: errors:: TypeOf { span, ty } ) ;
Original file line number Diff line number Diff line change
1
+ //@ compile-flags: -Zverbose-internals
2
+
3
+ #![ feature( precise_capturing_in_traits, rustc_attrs) ]
4
+ #![ rustc_hidden_type_of_opaques]
5
+
6
+ trait Foo {
7
+ fn hello ( & self ) -> impl Sized ;
8
+ }
9
+
10
+ fn hello < ' s , T : Foo > ( x : & ' s T ) -> impl Sized + use < ' s , T > {
11
+ //~^ ERROR <T as Foo>::{synthetic#0}<'s/#1>
12
+ x. hello ( )
13
+ }
14
+
15
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error: <T as Foo>::{synthetic#0}<'s/#1>
2
+ --> $DIR/dump.rs:10:35
3
+ |
4
+ LL | fn hello<'s, T: Foo>(x: &'s T) -> impl Sized + use<'s, T> {
5
+ | ^^^^^^^^^^^^^^^^^^^^^^^
6
+
7
+ error: aborting due to 1 previous error
8
+
You can’t perform that action at this time.
0 commit comments