Skip to content

Overflow evaluating the requirement with GATS #104988

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
agluszak opened this issue Nov 27, 2022 · 2 comments
Open

Overflow evaluating the requirement with GATS #104988

agluszak opened this issue Nov 27, 2022 · 2 comments
Labels
A-GATs Area: Generic associated types (GATs) C-bug Category: This is a bug.

Comments

@agluszak
Copy link

I tried this code:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=0ed2d890d6c301d7d07d6fbdb061d34e

I expected to see this happen: compilation success

Instead, this happened:

Compiling playground v0.0.1 (/playground)
error[[E0275]](https://doc.rust-lang.org/nightly/error-index.html#E0275): overflow evaluating the requirement `Option<List<Optionize>>: Debug`
  --> src/main.rs:36:22
   |
36 |     println!("{:?}", output);
   |                      ^^^^^^
   |
note: required for `List<Optionize>` to implement `Debug`
  --> src/main.rs:18:10
   |
18 | #[derive(Debug)]
   |          ^^^^^
   = note: 1 redundant requirement hidden
   = note: required for `Option<List<Optionize>>` to implement `Debug`
note: required by a bound in `ArgumentV1::<'a>::new_debug`
   = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `arg_new` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0275`.
error: could not compile `playground` due to previous error

rustc --version --verbose:

1.67.0-nightly

(2022-11-26 80a96467ec5675e9f696)

Probably related:
#85063, #39959, #96634

But I guess this is a bit different, because GATs are involved?

@agluszak agluszak added the C-bug Category: This is a bug. label Nov 27, 2022
@jackh726 jackh726 added the F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs label Nov 29, 2022
@VladimirBramstedt
Copy link

yeah, i ran into a similar issue, with a more trivial example:

trait Foo { type Bar<T>; }

struct Tester;
impl Foo for Tester {
    type Bar<T> = Vec<T>;
}

struct Testy {
  rep: <Tester as Foo>::Bar<Testy>
}

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=3a5f31004b9c3ac56b9aa7d9219b6753

im guessing the compiler tries to dive down the recursive type here forever and overflows...

@agluszak
Copy link
Author

@VladimirBramstedt looks like your simpler example was fixed at some point (it compiles with the current nightly), but mine still throws the same error

@fmease fmease added A-GATs Area: Generic associated types (GATs) and removed F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs labels Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-GATs Area: Generic associated types (GATs) C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

4 participants