File tree 2 files changed +40
-2
lines changed
2 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -1107,8 +1107,12 @@ impl<'a> TyLoweringContext<'a> {
1107
1107
binding. type_ref . as_ref ( ) . map_or ( 0 , |_| 1 ) + binding. bounds . len ( ) ,
1108
1108
) ;
1109
1109
if let Some ( type_ref) = & binding. type_ref {
1110
- if let ( TypeRef :: ImplTrait ( bounds) , ImplTraitLoweringState :: Disallowed ) =
1111
- ( type_ref, & self . impl_trait_mode )
1110
+ if let (
1111
+ TypeRef :: ImplTrait ( bounds) ,
1112
+ ImplTraitLoweringState :: Param ( _)
1113
+ | ImplTraitLoweringState :: Variable ( _)
1114
+ | ImplTraitLoweringState :: Disallowed ,
1115
+ ) = ( type_ref, & self . impl_trait_mode )
1112
1116
{
1113
1117
for bound in bounds {
1114
1118
predicates. extend (
Original file line number Diff line number Diff line change @@ -1278,6 +1278,40 @@ fn bar() {
1278
1278
) ;
1279
1279
}
1280
1280
1281
+ #[ test]
1282
+ fn argument_assoc_impl_trait ( ) {
1283
+ check_infer (
1284
+ r#"
1285
+ trait Outer {
1286
+ type Item;
1287
+ }
1288
+
1289
+ trait Inner { }
1290
+
1291
+ fn foo<T: Outer<Item = impl Inner>>(baz: T) {
1292
+ }
1293
+
1294
+ impl Outer for usize {
1295
+ type Item = usize;
1296
+ }
1297
+
1298
+ impl Inner for usize {}
1299
+
1300
+ fn main() {
1301
+ foo(2);
1302
+ }
1303
+ "# ,
1304
+ expect ! [ [ r#"
1305
+ 85..88 'baz': T
1306
+ 93..96 '{ }': ()
1307
+ 182..197 '{ foo(2); }': ()
1308
+ 188..191 'foo': fn foo<usize>(usize)
1309
+ 188..194 'foo(2)': ()
1310
+ 192..193 '2': usize
1311
+ "# ] ] ,
1312
+ ) ;
1313
+ }
1314
+
1281
1315
#[ test]
1282
1316
fn simple_return_pos_impl_trait ( ) {
1283
1317
cov_mark:: check!( lower_rpit) ;
You can’t perform that action at this time.
0 commit comments