forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#117570 - bvanjoi:fix-117547, r=cjgillot
fallback for `construct_generic_bound_failure` Fixes rust-lang#117547 This case regressed at rust-lang#115882. In this context, `generic_param_scope` is produced by `RPITVisitor` and not included by `hir_owner`. Therefore, I've added a fallback to address this.
- Loading branch information
Showing
3 changed files
with
37 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// edition:2021 | ||
// https://github.com/rust-lang/rust/issues/117547 | ||
|
||
trait T {} | ||
|
||
trait MyTrait { | ||
async fn foo() -> &'static impl T; | ||
//~^ ERROR the associated type `<Self as MyTrait>::{opaque#0}` may not live long enough | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error[E0310]: the associated type `<Self as MyTrait>::{opaque#0}` may not live long enough | ||
--> $DIR/async-and-ret-ref.rs:7:5 | ||
| | ||
LL | async fn foo() -> &'static impl T; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| the associated type `<Self as MyTrait>::{opaque#0}` must be valid for the static lifetime... | ||
| ...so that the reference type `&'static impl T` does not outlive the data it points at | ||
| | ||
= help: consider adding an explicit lifetime bound `<Self as MyTrait>::{opaque#0}: 'static`... | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0310`. |