File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,18 @@ impl<'tcx> LateLintPass<'tcx> for OpaqueHiddenInferredBound {
72
72
let hir:: ItemKind :: OpaqueTy ( opaque) = & item. kind else {
73
73
return ;
74
74
} ;
75
+
76
+ // If this is an RPITIT from a trait method with no body, then skip.
77
+ // That's because although we may have an opaque type on the function,
78
+ // it won't have a hidden type, so proving predicates about it is
79
+ // not really meaningful.
80
+ if let hir:: OpaqueTyOrigin :: FnReturn ( method_def_id) = opaque. origin
81
+ && let hir:: Node :: TraitItem ( trait_item) = cx. tcx . hir_node_by_def_id ( method_def_id)
82
+ && !trait_item. defaultness . has_value ( )
83
+ {
84
+ return ;
85
+ }
86
+
75
87
let def_id = item. owner_id . def_id . to_def_id ( ) ;
76
88
let infcx = & cx. tcx . infer_ctxt ( ) . build ( ) ;
77
89
// For every projection predicate in the opaque type's explicit bounds,
Original file line number Diff line number Diff line change
1
+ //@ check-pass
2
+
3
+ // Make sure that the `opaque_hidden_inferred_bound` lint doesn't fire on
4
+ // RPITITs with no hidden type.
5
+
6
+ trait T0 { }
7
+
8
+ trait T1 {
9
+ type A : Send ;
10
+ }
11
+
12
+ trait T2 {
13
+ fn foo ( ) -> impl T1 < A = ( ( ) , impl T0 ) > ;
14
+ }
15
+
16
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments