Skip to content
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

Hang with weird recursive associated type #104230

Open
jruderman opened this issue Nov 10, 2022 · 0 comments
Open

Hang with weird recursive associated type #104230

jruderman opened this issue Nov 10, 2022 · 0 comments
Labels
C-bug Category: This is a bug. I-compiletime Issue: Problems and improvements with respect to compile times. I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jruderman
Copy link
Contributor

Found by mutating src/test/ui/closures/issue-41366.rs with a modified fuzz-rustc

Code

This hangs the compiler:

trait T<'x> {
    type V;
}

impl<'g> T<'g> for u32 {
    type V = dyn for<'x> Fn(<u32 as T<'x>>::V);
}

fn main() {}

Suspicious recursion

If I decrease the recursion limit with #![recursion_limit = "16"], it finishes in 4 seconds with E0275:

Error output with low recursion limit
error[E0275]: overflow evaluating the requirement `for<'x> u32: T<'x>`
 --> oomq.rs:8:14
  |
8 |     type V = dyn for<'x> Fn(<u32 as T<'x>>::V);
  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: consider increasing the recursion limit by adding a `#![recursion_limit = "32"]` attribute to your crate (`oomq`)

This also allows the use of -Z time-passes, which reveals that the slowness is during wf_checking.

Regression

Regression in nightly-2021-08-26, likely with #85499 (@jackh726)

Commits in range
  commit[0] 2021-08-24UTC: Auto merge of #88266 - nikomatsakis:issue-87879, r=jackh726
  commit[1] 2021-08-24UTC: Auto merge of #88271 - sexxi-goose:liveness, r=nikomatsakis
  commit[2] 2021-08-25UTC: Auto merge of #88242 - bonega:allocation_range, r=oli-obk
  commit[3] 2021-08-25UTC: Auto merge of #84333 - tmiasko:liveness-yield, r=tmandry
  commit[4] 2021-08-25UTC: Auto merge of #87875 - asquared31415:generic-lang-items, r=cjgillot
  commit[5] 2021-08-25UTC: Auto merge of #85344 - cbeuw:remap-across-cwd, r=michaelwoerister
  commit[6] 2021-08-25UTC: Auto merge of #87937 - LeSeulArtichaut:active-if-let-guards, r=nagisa
  commit[7] 2021-08-25UTC: Auto merge of #88329 - LeSeulArtichaut:rollup-blg8hc0, r=LeSeulArtichaut
  commit[8] 2021-08-25UTC: Auto merge of #85499 - jackh726:assoc-type-norm-rebase, r=nikomatsakis

Previously, it complained of an unsized type:

Error output before 2021-08-26
$ rustc +bisector-nightly-2021-08-25-x86_64-apple-darwin oomq.rs
error[E0277]: the size for values of type `(dyn for<'x> Fn(<u32 as T<'x>>::V) + 'static)` cannot be known at compilation time
 --> oomq.rs:8:5
  |
8 |     type V = dyn for<'x> Fn(<u32 as T<'x>>::V);
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
  |
  = help: the trait `Sized` is not implemented for `(dyn for<'x> Fn(<u32 as T<'x>>::V) + 'static)`
note: required by a bound in `T::V`
 --> oomq.rs:4:5
  |
4 |     type V;
  |     ^^^^^^^ required by this bound in `T::V`

Version

rustc 1.67.0-nightly (85f4f41de 2022-11-08)
binary: rustc
commit-hash: 85f4f41deb1557ca8ab228319d33003dd2f20f45
commit-date: 2022-11-08
host: x86_64-apple-darwin
release: 1.67.0-nightly
LLVM version: 15.0.4

@rustbot label +I-hang +I-compiletime

@jruderman jruderman added the C-bug Category: This is a bug. label Nov 10, 2022
@rustbot rustbot added I-compiletime Issue: Problems and improvements with respect to compile times. I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. labels Nov 10, 2022
@estebank estebank added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-compiletime Issue: Problems and improvements with respect to compile times. I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants