File tree 2 files changed +25
-5
lines changed
2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -1311,11 +1311,10 @@ impl<'a> TyLoweringContext<'a> {
1311
1311
bounds,
1312
1312
lifetime : match lifetime {
1313
1313
Some ( it) => match it. bound_var ( Interner ) {
1314
- Some ( bound_var) => LifetimeData :: BoundVar ( BoundVar :: new (
1315
- DebruijnIndex :: INNERMOST ,
1316
- bound_var. index ,
1317
- ) )
1318
- . intern ( Interner ) ,
1314
+ Some ( bound_var) => bound_var
1315
+ . shifted_out_to ( DebruijnIndex :: new ( 2 ) )
1316
+ . map ( |bound_var| LifetimeData :: BoundVar ( bound_var) . intern ( Interner ) )
1317
+ . unwrap_or ( it) ,
1319
1318
None => it,
1320
1319
} ,
1321
1320
None => static_lifetime ( ) ,
Original file line number Diff line number Diff line change @@ -4803,3 +4803,24 @@ fn foo() {
4803
4803
"# ,
4804
4804
) ;
4805
4805
}
4806
+
4807
+ #[ test]
4808
+ fn dyn_trait_with_lifetime_in_rpit ( ) {
4809
+ check_types (
4810
+ r#"
4811
+ //- minicore: future
4812
+ pub struct Box<T> {}
4813
+
4814
+ trait Trait {}
4815
+
4816
+ pub async fn foo_async<'a>() -> Box<dyn Trait + 'a> {
4817
+ Box {}
4818
+ }
4819
+
4820
+ fn foo() {
4821
+ foo_async();
4822
+ //^^^^^^^^^^^impl Future<Output = Box<dyn Trait>> + ?Sized
4823
+ }
4824
+ "# ,
4825
+ )
4826
+ }
You can’t perform that action at this time.
0 commit comments