-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix capturing duplicated lifetimes via parent
- Loading branch information
1 parent
3fba278
commit 344151a
Showing
2 changed files
with
55 additions
and
7 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
25 changes: 25 additions & 0 deletions
25
tests/ui/impl-trait/precise-capturing/capture-parent-arg.rs
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,25 @@ | ||
#![feature(precise_capturing)] | ||
|
||
trait Tr { | ||
type Assoc; | ||
} | ||
|
||
struct W<'a>(&'a ()); | ||
|
||
impl Tr for W<'_> { | ||
type Assoc = (); | ||
} | ||
|
||
impl<'a> W<'a> { | ||
fn good1() -> impl use<'a> Into<<W<'a> as Tr>::Assoc> {} | ||
|
||
fn good2() -> impl use<'a> Into<<Self as Tr>::Assoc> {} | ||
|
||
fn bad1() -> impl use<> Into<<W<'a> as Tr>::Assoc> {} | ||
//~^ ERROR `impl Trait` captures lifetime parameter, but it is not mentioned in `use<...>` precise captures list | ||
|
||
fn bad2() -> impl use<> Into<<Self as Tr>::Assoc> {} | ||
//~^ ERROR `impl Trait` captures lifetime parameter, but it is not mentioned in `use<...>` precise captures list | ||
} | ||
|
||
fn main() {} |