-
Notifications
You must be signed in to change notification settings - Fork 13k
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 #74665 - smmalis37:issue-62200, r=davidtwco
Don't ICE on unconstrained anonymous lifetimes inside associated types. Fixes #62200. The change here is inspired (copied) by how this case is handled on bare fns at https://github.com/rust-lang/rust/blob/e8b55a4ad230ebec762fdfc4f241ba98a98560af/src/librustc_typeck/astconv.rs#L3083-L3106.
- Loading branch information
Showing
3 changed files
with
43 additions
and
12 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,15 @@ | ||
struct S {} | ||
|
||
trait T<'a> { | ||
type A; | ||
} | ||
|
||
impl T<'_> for S { | ||
type A = u32; | ||
} | ||
|
||
fn foo(x: impl Fn(<S as T<'_>>::A) -> <S as T<'_>>::A) {} | ||
//~^ ERROR binding for associated type `Output` references an anonymous lifetime | ||
//~^^ NOTE lifetimes appearing in an associated type are not considered constrained | ||
|
||
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,11 @@ | ||
error[E0582]: binding for associated type `Output` references an anonymous lifetime, which does not appear in the trait input types | ||
--> $DIR/issue-62200.rs:11:39 | ||
| | ||
LL | fn foo(x: impl Fn(<S as T<'_>>::A) -> <S as T<'_>>::A) {} | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= note: lifetimes appearing in an associated type are not considered constrained | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0582`. |