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#122027 - compiler-errors:rpitit-cycle, r=sp…
…astorino Uplift some feeding out of `associated_type_for_impl_trait_in_impl` and into queries This PR moves the `type_of` and `generics_of` query feeding out of `associated_type_for_impl_trait_in_impl`, since eagerly feeding results in query cycles due to a subtle interaction with `resolve_bound_vars`. Fixes rust-lang#122019 r? spastorino
- Loading branch information
Showing
5 changed files
with
85 additions
and
60 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
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
18 changes: 18 additions & 0 deletions
18
tests/ui/impl-trait/in-trait/rpitit-cycle-in-generics-of.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,18 @@ | ||
//@ check-pass | ||
|
||
// Check that we don't hit a query cycle when: | ||
// 1. Computing generics_of, which requires... | ||
// 2. Calling resolve_bound_vars, which requires... | ||
// 3. Calling associated_items, which requires... | ||
// 4. Calling associated_type_for_impl_trait_in_trait, which requires... | ||
// 5. Computing generics_of, which cycles. | ||
|
||
pub trait Foo<'a> { | ||
type Assoc; | ||
|
||
fn demo<T>(other: T) -> impl Foo<'a, Assoc = Self::Assoc> | ||
where | ||
T: Foo<'a, Assoc = ()>; | ||
} | ||
|
||
fn main() {} |