diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-11-17 22:33:17 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-17 22:33:17 +0100 |
| commit | 1521795a7da083a16329bcb27d81d34434cfc6d0 (patch) | |
| tree | f344f6af8e0dc9ea0489d055fed887e533eb3881 /src | |
| parent | 83356b78c4ff3e7d84e977aa6143793545967301 (diff) | |
| parent | 72fbb54c5d8cb7e333d14e28d0e683a4363a5ab2 (diff) | |
Rollup merge of #103852 - compiler-errors:rpitit-early-from-impl, r=lcnr
Don't remap early-bound regions for return-position `impl Trait` in trait originating from `impl` long title :sweat: We don't want to remap early-bound regions that originate from the `impl`s themselves, since they have no corresponding region in the trait. Not sure if there's a better condition than checking if the EBR's def-id's parent is the impl -- maybe we should be checking if the region comes from the method or RPITIT... :shrug: r? types Fixes #103850
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/async-await/in-trait/early-bound-1.rs | 17 | ||||
| -rw-r--r-- | src/test/ui/async-await/in-trait/early-bound-2.rs | 15 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/test/ui/async-await/in-trait/early-bound-1.rs b/src/test/ui/async-await/in-trait/early-bound-1.rs new file mode 100644 index 00000000000..6b3b142014b --- /dev/null +++ b/src/test/ui/async-await/in-trait/early-bound-1.rs @@ -0,0 +1,17 @@ +// check-pass +// edition:2021 + +#![feature(async_fn_in_trait)] +#![allow(incomplete_features)] + +pub trait Foo { + async fn foo(&mut self); +} + +struct MyFoo<'a>(&'a mut ()); + +impl<'a> Foo for MyFoo<'a> { + async fn foo(&mut self) {} +} + +fn main() {} diff --git a/src/test/ui/async-await/in-trait/early-bound-2.rs b/src/test/ui/async-await/in-trait/early-bound-2.rs new file mode 100644 index 00000000000..270443229b0 --- /dev/null +++ b/src/test/ui/async-await/in-trait/early-bound-2.rs @@ -0,0 +1,15 @@ +// check-pass +// edition:2021 + +#![feature(async_fn_in_trait)] +#![allow(incomplete_features)] + +pub trait Foo { + async fn foo(&mut self); +} + +impl<T: Foo> Foo for &mut T { + async fn foo(&mut self) {} +} + +fn main() {} |
