Change:
<!-- Thank you for filing a bug report! Please provide a short summary of the bug, along with any information you feel relevant to replicating the bug. --I tried this code: Running does not terminate after a long time. After running for 4 minutes, the process is using 99.2% CPU and about 80 MB memory. <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --:
The following also hangs, though a diagnostic is first emitted:
The hang seems to happen in
I have modified to detect simple cycles like these to obtain a backtrace: <details</details
More minimal example: This one demonstrates that it's a regression, it errors out immediately on 1.35 but hangs on 1.36.
searched toolchains nightly-2019-04-09 through nightly-2019-05-22 Regression in nightly-2019-04-24 found 9 bors merge commits in the specified range commit[0] 2019-04-22UTC: Auto merge of - varkor:tidy-leading-newline, r=alexcrichton commit[1] 2019-04-22UTC: Auto merge of - estebank:continue-eval, r=oli-obk commit[2] 2019-04-23UTC: Auto merge of - euclio:pulldown-cmark, r=GuillaumeGomez commit[3] 2019-04-23UTC: Auto merge of - davazp:fix-sync-all-macos, r=KodrAus commit[4] 2019-04-23UTC: Auto merge of - varkor:tidy-double-trailing-newline, r=kennytm commit[5] 2019-04-23UTC: Auto merge of - estebank:continue-evaluating, r=oli-obk commit[6] 2019-04-23UTC: Auto merge of - stepnivlk:visit_subpats-removal, r=varkor commit[7] 2019-04-23UTC: Auto merge of - davidtwco:issue-, r=oli-obk commit[8] 2019-04-23UTC: Auto merge of - Centril:rollup-akw4r85, r=Centril Probably ? I guess the compiler used to abort early after the recursive type error but now doesn't and hangs because later code assumes structs aren't recursive. label regression-from-stable-to-stable
cc - maybe something similar is necessary here?
What did was stop doing that (aborting early if there's an error) for . Seems a bit drastic to revert that (making the compiler unable to report other, later errors until the recursive type is fixed) for this - I think we can do something more targeted.
Perhaps the recursive field could be replaced by a ?
Assigning and removing as .20leads.20to.20infinite.20loop) in the prioritization working group.
This issue have been also reported in .

Discussion:
use rustc_hir::def::DefKind; use rustc_hir::def_id::DefId; use rustc_macros::HashStable; <del> use rustc_span::Span; </del> <ins> use rustc_span::{Span, DUMMY_SP}; </ins> use rustc_target::abi::{Integer, Size, TargetDataLayout}; use smallvec::SmallVec; use std::{cmp, fmt};

mut ty: Ty<'tcx>, normalize: impl Fn(Ty<'tcx>) -> Ty<'tcx>, ) -> Ty<'tcx> { <del> loop { </del> <ins> for iteration in 0.. { if !self.sess.recursion_limit().value_within_limit(iteration) { return self.ty_error_with_message( DUMMY_SP, &format!("reached the recursion limit finding the struct tail for {}", ty), ); } </ins> match *ty.kind() { ty::Adt(def, substs) => { if !def.is_struct() {

<ins> struct Take(Take); //~^ ERROR has infinite size //~| ERROR cycle detected // check that we don't hang trying to find the tail of a recursive struct (#79437) fn foo() -> Take { Take(loop {}) } fn main() {} </ins>

<ins> error[E0072]: recursive type `Take` has infinite size --> $DIR/infinite-struct.rs:1:1 | LL | struct Take(Take); | ^^^^^^^^^^^^----^^ | |           | | |           recursive without indirection | recursive type has infinite size | help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Take` representable | LL | struct Take(Box<Take>); |             ^^^^    ^ error[E0391]: cycle detected when computing drop-check constraints for `Take` --> $DIR/infinite-struct.rs:1:1 | LL | struct Take(Take); | ^^^^^^^^^^^^^^^^^^ | = note: ...which again requires computing drop-check constraints for `Take`, completing the cycle = note: cycle used when computing dropck types for `Canonical { max_universe: U0, variables: [], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing }, value: Take } }` error: aborting due to 2 previous errors Some errors have detailed explanations: E0072, E0391. For more information about an error, try `rustc --explain E0072`. </ins>