File tree Expand file tree Collapse file tree 2 files changed +25
-5
lines changed
src/tools/rust-analyzer/crates/hir-ty/src Expand file tree Collapse file tree 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> {
13111311 bounds,
13121312 lifetime : match lifetime {
13131313 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) ,
13191318 None => it,
13201319 } ,
13211320 None => static_lifetime ( ) ,
Original file line number Diff line number Diff line change @@ -4803,3 +4803,24 @@ fn foo() {
48034803"# ,
48044804 ) ;
48054805}
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